@ttsc/graph 0.27.0 → 0.28.0
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/README.md +3 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +15 -3
- package/lib/index.js.map +1 -1
- package/lib/model/TtscGraphMemory.d.ts +26 -0
- package/lib/model/TtscGraphMemory.js +121 -2
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/model/TtscGraphSession.d.ts +23 -0
- package/lib/model/TtscGraphSession.js +248 -96
- package/lib/model/TtscGraphSession.js.map +1 -1
- package/lib/model/TtscGraphShardStore.js +6 -1
- package/lib/model/TtscGraphShardStore.js.map +1 -1
- package/lib/model/TtscLintDaemon.d.ts +54 -0
- package/lib/model/TtscLintDaemon.js +166 -0
- package/lib/model/TtscLintDaemon.js.map +1 -0
- package/lib/model/loadGraph.d.ts +8 -1
- package/lib/model/loadGraph.js +144 -72
- package/lib/model/loadGraph.js.map +1 -1
- package/lib/model/publishedArtifacts.d.ts +142 -0
- package/lib/model/publishedArtifacts.js +403 -0
- package/lib/model/publishedArtifacts.js.map +1 -0
- package/lib/reduce.js +20 -7
- package/lib/reduce.js.map +1 -1
- package/lib/server/createServer.js +38 -2
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/runDetails.d.ts +15 -0
- package/lib/server/runDetails.js +48 -0
- package/lib/server/runDetails.js.map +1 -1
- package/lib/server/runEntrypoints.js +7 -1
- package/lib/server/runEntrypoints.js.map +1 -1
- package/lib/server/runLookup.js +129 -11
- package/lib/server/runLookup.js.map +1 -1
- package/lib/structures/ITtscGraphApplication.d.ts +3 -1
- package/lib/structures/ITtscGraphDetails.d.ts +12 -0
- package/lib/structures/ITtscGraphDocTag.d.ts +44 -0
- package/lib/structures/ITtscGraphDocTag.js +3 -0
- package/lib/structures/ITtscGraphDocTag.js.map +1 -0
- package/lib/structures/ITtscGraphDump.d.ts +23 -4
- package/lib/structures/ITtscGraphLookup.d.ts +29 -0
- package/lib/structures/ITtscGraphNode.d.ts +25 -0
- package/lib/structures/TtscGraphArtifactNodeKind.d.ts +23 -0
- package/lib/structures/TtscGraphArtifactNodeKind.js +37 -0
- package/lib/structures/TtscGraphArtifactNodeKind.js.map +1 -0
- package/lib/structures/TtscGraphDumpEdgeKind.d.ts +1 -1
- package/lib/structures/TtscGraphDumpNodeKind.d.ts +10 -2
- package/lib/structures/TtscGraphEdgeKind.d.ts +8 -1
- package/lib/structures/TtscGraphNodeKind.d.ts +1 -1
- package/lib/structures/index.d.ts +2 -0
- package/lib/structures/index.js +2 -0
- package/lib/structures/index.js.map +1 -1
- package/lib/view.js +17 -1
- package/lib/view.js.map +1 -1
- package/lib/viewer/index.html +5 -13
- package/lib/viewer/viewer.js +190 -190
- package/package.json +5 -5
- package/src/index.ts +23 -6
- package/src/model/TtscGraphMemory.ts +118 -2
- package/src/model/TtscGraphSession.ts +112 -2
- package/src/model/TtscGraphShardStore.ts +6 -1
- package/src/model/TtscLintDaemon.ts +179 -0
- package/src/model/loadGraph.ts +29 -5
- package/src/model/publishedArtifacts.ts +548 -0
- package/src/reduce.ts +20 -7
- package/src/server/runDetails.ts +52 -1
- package/src/server/runEntrypoints.ts +7 -1
- package/src/server/runLookup.ts +139 -14
- package/src/structures/ITtscGraphApplication.ts +3 -1
- package/src/structures/ITtscGraphDetails.ts +13 -0
- package/src/structures/ITtscGraphDocTag.ts +45 -0
- package/src/structures/ITtscGraphDump.ts +25 -4
- package/src/structures/ITtscGraphLookup.ts +31 -0
- package/src/structures/ITtscGraphNode.ts +27 -0
- package/src/structures/TtscGraphArtifactNodeKind.ts +35 -0
- package/src/structures/TtscGraphDumpEdgeKind.ts +1 -0
- package/src/structures/TtscGraphDumpNodeKind.ts +16 -2
- package/src/structures/TtscGraphEdgeKind.ts +8 -0
- package/src/structures/TtscGraphNodeKind.ts +7 -1
- package/src/structures/index.ts +2 -0
- package/src/view.ts +17 -1
- package/src/viewer/index.html +5 -13
- package/src/viewer/legend.ts +107 -0
- package/src/viewer/main.ts +19 -21
package/lib/viewer/viewer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`,o=Array(s+1).join(" "),l=[];for(let c=0;c<e;++c){let h=
|
|
1
|
+
"use strict";(()=>{var Om=Object.create;var Xh=Object.defineProperty;var Fm=Object.getOwnPropertyDescriptor;var Bm=Object.getOwnPropertyNames;var km=Object.getPrototypeOf,zm=Object.prototype.hasOwnProperty;var Ht=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Vm=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Bm(e))!zm.call(n,r)&&r!==t&&Xh(n,r,{get:()=>e[r],enumerable:!(i=Fm(e,r))||i.enumerable});return n};var Gm=(n,e,t)=>(t=n!=null?Om(km(n)):{},Vm(e||!n||!n.__esModule?Xh(t,"default",{value:n,enumerable:!0}):t,n));var ih=Ht((mC,jd)=>{jd.exports=function(e){return e===0?"x":e===1?"y":e===2?"z":"c"+(e+1)}});var Ni=Ht((gC,Zd)=>{var jy=ih();Zd.exports=function(e){return t;function t(i,r){let s=r&&r.indent||0,a=r&&r.join!==void 0?r.join:`
|
|
2
|
+
`,o=Array(s+1).join(" "),l=[];for(let c=0;c<e;++c){let h=jy(c),d=c===0?"":o;l.push(d+i.replace(/{var}/g,h))}return l.join(a)}}});var tp=Ht((_C,ws)=>{var Jd=Ni();ws.exports=Zy;ws.exports.generateCreateBodyFunctionBody=Kd;ws.exports.getVectorCode=ep;ws.exports.getBodyCode=Qd;function Zy(n,e){let t=Kd(n,e),{Body:i}=new Function(t)();return i}function Kd(n,e){return`
|
|
3
|
+
${ep(n,e)}
|
|
3
4
|
${Qd(n,e)}
|
|
4
|
-
${Kd(n,e)}
|
|
5
5
|
return {Body: Body, Vector: Vector};
|
|
6
|
-
`}function
|
|
6
|
+
`}function Qd(n){let e=Jd(n),t=e("{var}",{join:", "});return`
|
|
7
7
|
function Body(${t}) {
|
|
8
8
|
this.isPinned = false;
|
|
9
9
|
this.pos = new Vector(${t});
|
|
@@ -23,7 +23,7 @@ Body.prototype.reset = function() {
|
|
|
23
23
|
|
|
24
24
|
Body.prototype.setPosition = function (${t}) {
|
|
25
25
|
${e("this.pos.{var} = {var} || 0;",{indent:2})}
|
|
26
|
-
};`}function
|
|
26
|
+
};`}function ep(n,e){let t=Jd(n),i="";return e&&(i=`${t(`
|
|
27
27
|
var v{var};
|
|
28
28
|
Object.defineProperty(this, '{var}', {
|
|
29
29
|
set: function(v) {
|
|
@@ -45,12 +45,12 @@ Object.defineProperty(this, '{var}', {
|
|
|
45
45
|
|
|
46
46
|
Vector.prototype.reset = function () {
|
|
47
47
|
${t("this.{var} = ",{join:""})}0;
|
|
48
|
-
};`}});var
|
|
49
|
-
${
|
|
48
|
+
};`}});var lp=Ht((xC,vi)=>{var rh=Ni(),xi=ih();vi.exports=Jy;vi.exports.generateQuadTreeFunctionBody=np;vi.exports.getInsertStackCode=op;vi.exports.getQuadNodeCode=ap;vi.exports.isSamePosition=ip;vi.exports.getChildBodyCode=sp;vi.exports.setChildBodyCode=rp;function Jy(n){let e=np(n);return new Function(e)()}function np(n){let e=rh(n),t=Math.pow(2,n);return`
|
|
49
|
+
${op()}
|
|
50
|
+
${ap(n)}
|
|
51
|
+
${ip(n)}
|
|
50
52
|
${sp(n)}
|
|
51
|
-
${np(n)}
|
|
52
53
|
${rp(n)}
|
|
53
|
-
${ip(n)}
|
|
54
54
|
|
|
55
55
|
function createQuadTree(options, random) {
|
|
56
56
|
options = options || {};
|
|
@@ -291,21 +291,21 @@ return createQuadTree;
|
|
|
291
291
|
`;function r(o){let l=[],c=Array(o+1).join(" ");for(let h=0;h<n;++h)l.push(c+`if (${xi(h)} > max_${xi(h)}) {`),l.push(c+` quadIdx = quadIdx + ${Math.pow(2,h)};`),l.push(c+` min_${xi(h)} = max_${xi(h)};`),l.push(c+` max_${xi(h)} = node.max_${xi(h)};`),l.push(c+"}");return l.join(`
|
|
292
292
|
`)}function s(){let o=Array(11).join(" "),l=[];for(let c=0;c<t;++c)l.push(o+`if (node.quad${c}) {`),l.push(o+` queue[pushIdx] = node.quad${c};`),l.push(o+" queueLength += 1;"),l.push(o+" pushIdx += 1;"),l.push(o+"}");return l.join(`
|
|
293
293
|
`)}function a(o){let l=[];for(let c=0;c<t;++c)l.push(`${o}quad${c} = null;`);return l.join(`
|
|
294
|
-
`)}}function
|
|
294
|
+
`)}}function ip(n){let e=rh(n);return`
|
|
295
295
|
function isSamePosition(point1, point2) {
|
|
296
296
|
${e("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}
|
|
297
297
|
|
|
298
298
|
return ${e("d{var} < 1e-8",{join:" && "})};
|
|
299
299
|
}
|
|
300
|
-
`}function
|
|
300
|
+
`}function rp(n){var e=Math.pow(2,n);return`
|
|
301
301
|
function setChild(node, idx, child) {
|
|
302
302
|
${t()}
|
|
303
303
|
}`;function t(){let i=[];for(let r=0;r<e;++r){let s=r===0?" ":" else ";i.push(`${s}if (idx === ${r}) node.quad${r} = child;`)}return i.join(`
|
|
304
|
-
`)}}function
|
|
304
|
+
`)}}function sp(n){return`function getChild(node, idx) {
|
|
305
305
|
${e()}
|
|
306
306
|
return null;
|
|
307
307
|
}`;function e(){let t=[],i=Math.pow(2,n);for(let r=0;r<i;++r)t.push(` if (idx === ${r}) return node.quad${r};`);return t.join(`
|
|
308
|
-
`)}}function
|
|
308
|
+
`)}}function ap(n){let e=rh(n),t=Math.pow(2,n);var i=`
|
|
309
309
|
function QuadNode() {
|
|
310
310
|
// body stored inside this node. In quad tree only leaf nodes (by construction)
|
|
311
311
|
// contain bodies:
|
|
@@ -328,7 +328,7 @@ ${r(" this.")}
|
|
|
328
328
|
${e("this.max_{var} = 0;",{indent:2})}
|
|
329
329
|
}
|
|
330
330
|
`;return i;function r(s){let a=[];for(let o=0;o<t;++o)a.push(`${s}quad${o} = null;`);return a.join(`
|
|
331
|
-
`)}}function
|
|
331
|
+
`)}}function op(){return`
|
|
332
332
|
/**
|
|
333
333
|
* Our implementation of QuadTree is non-recursive to avoid GC hit
|
|
334
334
|
* This data structure represent stack of elements
|
|
@@ -369,7 +369,7 @@ function InsertStackElement(node, body) {
|
|
|
369
369
|
this.node = node; // QuadTree node
|
|
370
370
|
this.body = body; // physical body which needs to be inserted to node
|
|
371
371
|
}
|
|
372
|
-
`}});var
|
|
372
|
+
`}});var hp=Ht((vC,sh)=>{sh.exports=Qy;sh.exports.generateFunctionBody=cp;var Ky=Ni();function Qy(n){let e=cp(n);return new Function("bodies","settings","random",e)}function cp(n){let e=Ky(n);return`
|
|
373
373
|
var boundingBox = {
|
|
374
374
|
${e("min_{var}: 0, max_{var}: 0,",{indent:4})}
|
|
375
375
|
};
|
|
@@ -423,15 +423,15 @@ function InsertStackElement(node, body) {
|
|
|
423
423
|
function resetBoundingBox() {
|
|
424
424
|
${e("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}
|
|
425
425
|
}
|
|
426
|
-
`}});var
|
|
426
|
+
`}});var fp=Ht((yC,ah)=>{var eb=Ni();ah.exports=tb;ah.exports.generateCreateDragForceFunctionBody=up;function tb(n){let e=up(n);return new Function("options",e)}function up(n){return`
|
|
427
427
|
if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');
|
|
428
428
|
|
|
429
429
|
return {
|
|
430
430
|
update: function(body) {
|
|
431
|
-
${
|
|
431
|
+
${eb(n)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
|
|
432
432
|
}
|
|
433
433
|
};
|
|
434
|
-
`}});var
|
|
434
|
+
`}});var pp=Ht((bC,oh)=>{var nb=Ni();oh.exports=ib;oh.exports.generateCreateSpringForceFunctionBody=dp;function ib(n){let e=dp(n);return new Function("options","random",e)}function dp(n){let e=nb(n);return`
|
|
435
435
|
if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');
|
|
436
436
|
if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');
|
|
437
437
|
|
|
@@ -463,7 +463,7 @@ function InsertStackElement(node, body) {
|
|
|
463
463
|
body2.springLength += r;
|
|
464
464
|
}
|
|
465
465
|
};
|
|
466
|
-
`}});var
|
|
466
|
+
`}});var gp=Ht((MC,lh)=>{var rb=Ni();lh.exports=sb;lh.exports.generateIntegratorFunctionBody=mp;function sb(n){let e=mp(n);return new Function("bodies","timeStep","adaptiveTimeStepWeight",e)}function mp(n){let e=rb(n);return`
|
|
467
467
|
var length = bodies.length;
|
|
468
468
|
if (length === 0) return 0;
|
|
469
469
|
|
|
@@ -497,13 +497,13 @@ function InsertStackElement(node, body) {
|
|
|
497
497
|
}
|
|
498
498
|
|
|
499
499
|
return (${e("t{var} * t{var}",{join:" + "})})/length;
|
|
500
|
-
`}});var _p=Ht((vC,gp)=>{gp.exports=eb;function eb(n,e,t,i){this.from=n,this.to=e,this.length=t,this.coefficient=i}});var yp=Ht((yC,vp)=>{vp.exports=xp;function xp(n,e){var t;if(n||(n={}),e){for(t in e)if(e.hasOwnProperty(t)){var i=n.hasOwnProperty(t),r=typeof e[t],s=!i||typeof n[t]!==r;s?n[t]=e[t]:r==="object"&&(n[t]=xp(n[t],e[t]))}}return n}});var ch=Ht((bC,bp)=>{"use strict";function tb(n){ib(n);let e=nb(n);return n.on=e.on,n.off=e.off,n.fire=e.fire,n}function nb(n){let e=Object.create(null);return{on:function(t,i,r){if(typeof i!="function")throw new Error("callback is expected to be a function");let s=e[t];return s||(s=e[t]=[]),s.push({callback:i,ctx:r}),n},off:function(t,i){if(typeof t>"u")return e=Object.create(null),n;if(e[t])if(typeof i!="function")delete e[t];else{let r=e[t];for(let s=0;s<r.length;++s)r[s].callback===i&&r.splice(s,1)}return n},fire:function(t){let i=e[t];if(!i)return n;let r;arguments.length>1&&(r=Array.prototype.slice.call(arguments,1));for(let s=0;s<i.length;++s){let a=i[s];a.callback.apply(a.ctx,r)}return n}}}function ib(n){if(!n)throw new Error("Eventify cannot use falsy object as events subject");let e=["on","fire","off"];for(let t=0;t<e.length;++t)if(n.hasOwnProperty(e[t]))throw new Error("Subject cannot be eventified, since it already has property '"+e[t]+"'")}bp.exports=tb});var Sp=Ht((MC,Jo)=>{Jo.exports=hh;Jo.exports.random=hh,Jo.exports.randomIterator=ob;function hh(n){var e=typeof n=="number"?n:+new Date;return new Ui(e)}function Ui(n){this.seed=n}Ui.prototype.next=ab;Ui.prototype.nextDouble=uh;Ui.prototype.uniform=uh;Ui.prototype.gaussian=rb;Ui.prototype.random=uh;function rb(){var n,e,t;do e=this.nextDouble()*2-1,t=this.nextDouble()*2-1,n=e*e+t*t;while(n>=1||n===0);return e*Math.sqrt(-2*Math.log(n)/n)}Ui.prototype.levy=sb;function sb(){var n=1.5,e=Math.pow(Mp(1+n)*Math.sin(Math.PI*n/2)/(Mp((1+n)/2)*n*Math.pow(2,(n-1)/2)),1/n);return this.gaussian()*e/Math.pow(Math.abs(this.gaussian()),1/n)}function Mp(n){return Math.sqrt(2*Math.PI/n)*Math.pow(1/Math.E*(n+1/(12*n-1/(10*n))),n)}function uh(){var n=this.seed;return n=n+2127912214+(n<<12)&4294967295,n=(n^3345072700^n>>>19)&4294967295,n=n+374761393+(n<<5)&4294967295,n=(n+3550635116^n<<9)&4294967295,n=n+4251993797+(n<<3)&4294967295,n=(n^3042594569^n>>>16)&4294967295,this.seed=n,(n&268435455)/268435456}function ab(n){return Math.floor(this.nextDouble()*n)}function ob(n,e){var t=e||hh();if(typeof t.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:r,shuffle:i};function i(){var s,a,o;for(s=n.length-1;s>0;--s)a=t.next(s+1),o=n[a],n[a]=n[s],n[s]=o;return n}function r(s){var a,o,l;for(a=n.length-1;a>0;--a)o=t.next(a+1),l=n[o],n[o]=n[a],n[a]=l,s(l);n.length&&s(n[0])}}});var fh=Ht((SC,Tp)=>{Tp.exports=pb;var lb=ep(),cb=op(),hb=cp(),ub=up(),fb=dp(),db=mp(),wp={};function pb(n){var e=_p(),t=yp(),i=ch();if(n){if(n.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(n.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}n=t(n,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var r=wp[n.dimensions];if(!r){var s=n.dimensions;r={Body:lb(s,n.debug),createQuadTree:cb(s),createBounds:hb(s),createDragForce:ub(s),createSpringForce:fb(s),integrate:db(s)},wp[s]=r}var a=r.Body,o=r.createQuadTree,l=r.createBounds,c=r.createDragForce,h=r.createSpringForce,d=r.integrate,u=R=>new a(R),p=Sp().random(42),m=[],x=[],g=o(n,p),f=l(m,n,p),v=h(n,p),M=c(n),S=0,w=[],y=new Map,A=0;D("nbody",V),D("spring",I);var _={bodies:m,quadTree:g,springs:x,settings:n,addForce:D,removeForce:P,getForces:N,step:function(){for(var R=0;R<w.length;++R)w[R](A);var L=d(m,n.timeStep,n.adaptiveTimeStepWeight);return A+=1,L},addBody:function(R){if(!R)throw new Error("Body is required");return m.push(R),R},addBodyAt:function(R){if(!R)throw new Error("Body position is required");var L=u(R);return m.push(L),L},removeBody:function(R){if(R){var L=m.indexOf(R);if(!(L<0))return m.splice(L,1),m.length===0&&f.reset(),!0}},addSpring:function(R,L,k,ee){if(!R||!L)throw new Error("Cannot add null spring to force simulator");typeof k!="number"&&(k=-1);var ne=new e(R,L,k,ee>=0?ee:-1);return x.push(ne),ne},getTotalMovement:function(){return S},removeSpring:function(R){if(R){var L=x.indexOf(R);if(L>-1)return x.splice(L,1),!0}},getBestNewBodyPosition:function(R){return f.getBestNewPosition(R)},getBBox:C,getBoundingBox:C,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(R){return R!==void 0?(n.gravity=R,g.options({gravity:R}),this):n.gravity},theta:function(R){return R!==void 0?(n.theta=R,g.options({theta:R}),this):n.theta},random:p};return mb(n,_),i(_),_;function C(){return f.update(),f.box}function D(R,L){if(y.has(R))throw new Error("Force "+R+" is already added");y.set(R,L),w.push(L)}function P(R){var L=w.indexOf(y.get(R));L<0||(w.splice(L,1),y.delete(R))}function N(){return y}function V(){if(m.length!==0){g.insertBodies(m);for(var R=m.length;R--;){var L=m[R];L.isPinned||(L.reset(),g.updateBodyForce(L),M.update(L))}}}function I(){for(var R=x.length;R--;)v.update(x[R])}}function mb(n,e){for(var t in n)gb(n,e,t)}function gb(n,e,t){if(n.hasOwnProperty(t)&&typeof e[t]!="function"){var i=Number.isFinite(n[t]);i?e[t]=function(r){if(r!==void 0){if(!Number.isFinite(r))throw new Error("Value of "+t+" should be a valid number.");return n[t]=r,e}return n[t]}:e[t]=function(r){return r!==void 0?(n[t]=r,e):n[t]}}}});var Ap=Ht((wC,dh)=>{dh.exports=xb;dh.exports.simulator=fh();var _b=ch();function xb(n,e){if(!n)throw new Error("Graph structure cannot be undefined");var t=e&&e.createSimulator||fh(),i=t(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var r=n.version>19?V:N;e&&typeof e.nodeMass=="function"&&(r=e.nodeMass);var s=new Map,a={},o=0,l=i.settings.springTransform||vb;M(),g();var c=!1,h={step:function(){if(o===0)return d(!0),!0;var I=i.step();h.lastMove=I,h.fire("step");var R=I/o,L=R<=.01;return d(L),L},getNodePosition:function(I){return P(I).pos},setNodePosition:function(I){var R=P(I);R.setPosition.apply(R,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(I){var R=a[I];if(R)return{from:R.from.pos,to:R.to.pos}},getGraphRect:function(){return i.getBBox()},forEachBody:u,pinNode:function(I,R){var L=P(I.id);L.isPinned=!!R},isNodePinned:function(I){return P(I.id).isPinned},dispose:function(){n.off("changed",v),h.fire("disposed")},getBody:x,getSpring:m,getForceVectorLength:p,simulator:i,graph:n,lastMove:0};return _b(h),h;function d(I){c!==I&&(c=I,f(I))}function u(I){s.forEach(I)}function p(){var I=0,R=0;return u(function(L){I+=Math.abs(L.force.x),R+=Math.abs(L.force.y)}),Math.sqrt(I*I+R*R)}function m(I,R){var L;if(R===void 0)typeof I!="object"?L=I:L=I.id;else{var k=n.hasLink(I,R);if(!k)return;L=k.id}return a[L]}function x(I){return s.get(I)}function g(){n.on("changed",v)}function f(I){h.fire("stable",I)}function v(I){for(var R=0;R<I.length;++R){var L=I[R];L.changeType==="add"?(L.node&&S(L.node.id),L.link&&y(L.link)):L.changeType==="remove"&&(L.node&&w(L.node),L.link&&A(L.link))}o=n.getNodesCount()}function M(){o=0,n.forEachNode(function(I){S(I.id),o+=1}),n.forEachLink(y)}function S(I){var R=s.get(I);if(!R){var L=n.getNode(I);if(!L)throw new Error("initBody() was called with unknown node id");var k=L.position;if(!k){var ee=_(L);k=i.getBestNewBodyPosition(ee)}R=i.addBodyAt(k),R.id=I,s.set(I,R),C(I),D(L)&&(R.isPinned=!0)}}function w(I){var R=I.id,L=s.get(R);L&&(s.delete(R),i.removeBody(L))}function y(I){C(I.fromId),C(I.toId);var R=s.get(I.fromId),L=s.get(I.toId),k=i.addSpring(R,L,I.length);l(I,k),a[I.id]=k}function A(I){var R=a[I.id];if(R){var L=n.getNode(I.fromId),k=n.getNode(I.toId);L&&C(L.id),k&&C(k.id),delete a[I.id],i.removeSpring(R)}}function _(I){var R=[];if(!I.links)return R;for(var L=Math.min(I.links.length,2),k=0;k<L;++k){var ee=I.links[k],ne=ee.fromId!==I.id?s.get(ee.fromId):s.get(ee.toId);ne&&ne.pos&&R.push(ne)}return R}function C(I){var R=s.get(I);if(R.mass=r(I),Number.isNaN(R.mass))throw new Error("Node mass should be a number")}function D(I){return I&&(I.isPinned||I.data&&I.data.isPinned)}function P(I){var R=s.get(I);return R||(S(I),R=s.get(I)),R}function N(I){var R=n.getLinks(I);return R?1+R.length/3:1}function V(I){var R=n.getLinks(I);return R?1+R.size/3:1}}function vb(){}});var ui={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},fi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},vu=0,jl=1,yu=2;var ss=1,bu=2,ur=3,Wn=0,Vt=1,Dn=2,Ln=0,Ai=1,Zl=2,Jl=3,Kl=4,Mu=5;var ai=100,Su=101,wu=102,Tu=103,Au=104,Eu=200,Cu=201,Ru=202,Pu=203,ra=204,sa=205,Iu=206,Du=207,Lu=208,Nu=209,Uu=210,Fu=211,Ou=212,Bu=213,ku=214,aa=0,oa=1,la=2,Ei=3,ca=4,ha=5,ua=6,fa=7,Ya=0,zu=1,Vu=2,xn=0,Ql=1,ec=2,tc=3,nc=4,ic=5,rc=6,sc=7;var ac=300,di=301,Pi=302,$a=303,ja=304,as=306,da=1e3,Cn=1001,pa=1002,Et=1003,Gu=1004;var os=1005;var Rt=1006,Za=1007;var pi=1008;var qt=1009,oc=1010,lc=1011,fr=1012,Ja=1013,vn=1014,yn=1015,Nn=1016,Ka=1017,Qa=1018,dr=1020,cc=35902,hc=35899,uc=1021,fc=1022,hn=1023,Pn=1026,mi=1027,dc=1028,eo=1029,gi=1030,to=1031;var no=1033,ls=33776,cs=33777,hs=33778,us=33779,io=35840,ro=35841,so=35842,ao=35843,oo=36196,lo=37492,co=37496,ho=37488,uo=37489,fs=37490,fo=37491,po=37808,mo=37809,go=37810,_o=37811,xo=37812,vo=37813,yo=37814,bo=37815,Mo=37816,So=37817,wo=37818,To=37819,Ao=37820,Eo=37821,Co=36492,Ro=36494,Po=36495,Io=36283,Do=36284,ds=36285,Lo=36286;var Nr=2300,ma=2301,ia=2302,Bl=2303,kl=2400,zl=2401,Vl=2402;var Hu=3200;var No=0,Wu=1,$n="",Qt="srgb",Ur="srgb-linear",Fr="linear",et="srgb";var Ti=7680;var Gl=519,Xu=512,qu=513,Yu=514,Uo=515,$u=516,ju=517,Fo=518,Zu=519,Hl=35044;var pc="300 es",gn=2e3,Ki=2001;function Om(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Bm(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Or(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Ju(){let n=Or("canvas");return n.style.display="block",n}var Xh={},Qi=null;function mc(...n){let e="THREE."+n.shift();Qi?Qi("log",e,...n):console.log(e,...n)}function Ku(n){let e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function Ie(...n){n=Ku(n);let e="THREE."+n.shift();if(Qi)Qi("warn",e,...n);else{let t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Le(...n){n=Ku(n);let e="THREE."+n.shift();if(Qi)Qi("error",e,...n);else{let t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function ga(...n){let e=n.join(" ");e in Xh||(Xh[e]=!0,Ie(...n))}function Qu(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}var ef={[aa]:oa,[la]:ua,[ca]:fa,[Ei]:ha,[oa]:aa,[ua]:la,[fa]:ca,[ha]:Ei},_n=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){let i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){let i=this._listeners;if(i===void 0)return;let r=i[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let i=t[e.type];if(i!==void 0){e.target=this;let r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}},Dt=["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"],qh=1234567,Pr=Math.PI/180,er=180/Math.PI;function pr(){let n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Dt[n&255]+Dt[n>>8&255]+Dt[n>>16&255]+Dt[n>>24&255]+"-"+Dt[e&255]+Dt[e>>8&255]+"-"+Dt[e>>16&15|64]+Dt[e>>24&255]+"-"+Dt[t&63|128]+Dt[t>>8&255]+"-"+Dt[t>>16&255]+Dt[t>>24&255]+Dt[i&255]+Dt[i>>8&255]+Dt[i>>16&255]+Dt[i>>24&255]).toLowerCase()}function Ge(n,e,t){return Math.max(e,Math.min(t,n))}function gc(n,e){return(n%e+e)%e}function km(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function zm(n,e,t){return n!==e?(t-n)/(e-n):0}function Ir(n,e,t){return(1-t)*n+t*e}function Vm(n,e,t,i){return Ir(n,e,1-Math.exp(-t*i))}function Gm(n,e=1){return e-Math.abs(gc(n,e*2)-e)}function Hm(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Wm(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Xm(n,e){return n+Math.floor(Math.random()*(e-n+1))}function qm(n,e){return n+Math.random()*(e-n)}function Ym(n){return n*(.5-Math.random())}function $m(n){n!==void 0&&(qh=n);let e=qh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function jm(n){return n*Pr}function Zm(n){return n*er}function Jm(n){return(n&n-1)===0&&n!==0}function Km(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Qm(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function eg(n,e,t,i,r){let s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),h=a((e+i)/2),d=s((e-i)/2),u=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":n.set(o*h,l*d,l*u,o*c);break;case"YZY":n.set(l*u,o*h,l*d,o*c);break;case"ZXZ":n.set(l*d,l*u,o*h,o*c);break;case"XZX":n.set(o*h,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*h,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*h,o*c);break;default:Ie("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Zi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function kt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var _c={DEG2RAD:Pr,RAD2DEG:er,generateUUID:pr,clamp:Ge,euclideanModulo:gc,mapLinear:km,inverseLerp:zm,lerp:Ir,damp:Vm,pingpong:Gm,smoothstep:Hm,smootherstep:Wm,randInt:Xm,randFloat:qm,randFloatSpread:Ym,seededRandom:$m,degToRad:jm,radToDeg:Zm,isPowerOfTwo:Jm,ceilPowerOfTwo:Km,floorPowerOfTwo:Qm,setQuaternionFromProperEuler:eg,normalize:kt,denormalize:Zi},Sc=class Sc{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Ge(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Ge(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Sc.prototype.isVector2=!0;var Te=Sc,en=class{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],h=i[r+2],d=i[r+3],u=s[a+0],p=s[a+1],m=s[a+2],x=s[a+3];if(d!==x||l!==u||c!==p||h!==m){let g=l*u+c*p+h*m+d*x;g<0&&(u=-u,p=-p,m=-m,x=-x,g=-g);let f=1-o;if(g<.9995){let v=Math.acos(g),M=Math.sin(v);f=Math.sin(f*v)/M,o=Math.sin(o*v)/M,l=l*f+u*o,c=c*f+p*o,h=h*f+m*o,d=d*f+x*o}else{l=l*f+u*o,c=c*f+p*o,h=h*f+m*o,d=d*f+x*o;let v=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=v,c*=v,h*=v,d*=v}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,a){let o=i[r],l=i[r+1],c=i[r+2],h=i[r+3],d=s[a],u=s[a+1],p=s[a+2],m=s[a+3];return e[t]=o*m+h*d+l*p-c*u,e[t+1]=l*m+h*u+c*d-o*p,e[t+2]=c*m+h*p+o*u-l*d,e[t+3]=h*m-o*d-l*u-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),h=o(r/2),d=o(s/2),u=l(i/2),p=l(r/2),m=l(s/2);switch(a){case"XYZ":this._x=u*h*d+c*p*m,this._y=c*p*d-u*h*m,this._z=c*h*m+u*p*d,this._w=c*h*d-u*p*m;break;case"YXZ":this._x=u*h*d+c*p*m,this._y=c*p*d-u*h*m,this._z=c*h*m-u*p*d,this._w=c*h*d+u*p*m;break;case"ZXY":this._x=u*h*d-c*p*m,this._y=c*p*d+u*h*m,this._z=c*h*m+u*p*d,this._w=c*h*d-u*p*m;break;case"ZYX":this._x=u*h*d-c*p*m,this._y=c*p*d+u*h*m,this._z=c*h*m-u*p*d,this._w=c*h*d+u*p*m;break;case"YZX":this._x=u*h*d+c*p*m,this._y=c*p*d+u*h*m,this._z=c*h*m-u*p*d,this._w=c*h*d-u*p*m;break;case"XZY":this._x=u*h*d-c*p*m,this._y=c*p*d-u*h*m,this._z=c*h*m+u*p*d,this._w=c*h*d+u*p*m;break;default:Ie("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],d=t[10],u=i+o+d;if(u>0){let p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>d){let p=2*Math.sqrt(1+i-o-d);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>d){let p=2*Math.sqrt(1+o-i-d);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{let p=2*Math.sqrt(1+d-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ge(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=i*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-i*c,this._z=s*h+a*c+i*l-r*o,this._w=a*h-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){let c=Math.acos(o),h=Math.sin(c);l=Math.sin(l*c)/h,t=Math.sin(t*c)/h,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},wc=class wc{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Yh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Yh.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),h=2*(o*t-s*r),d=2*(s*i-a*t);return this.x=t+l*c+a*d-o*h,this.y=i+l*h+o*c-s*d,this.z=r+l*d+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Ge(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return fl.copy(this).projectOnVector(e),this.sub(fl)}reflect(e){return this.sub(fl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Ge(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};wc.prototype.isVector3=!0;var U=wc,fl=new U,Yh=new en,Tc=class Tc{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){let h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=i,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],h=i[4],d=i[7],u=i[2],p=i[5],m=i[8],x=r[0],g=r[3],f=r[6],v=r[1],M=r[4],S=r[7],w=r[2],y=r[5],A=r[8];return s[0]=a*x+o*v+l*w,s[3]=a*g+o*M+l*y,s[6]=a*f+o*S+l*A,s[1]=c*x+h*v+d*w,s[4]=c*g+h*M+d*y,s[7]=c*f+h*S+d*A,s[2]=u*x+p*v+m*w,s[5]=u*g+p*M+m*y,s[8]=u*f+p*S+m*A,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-i*s*h+i*o*l+r*s*c-r*a*l}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=h*a-o*c,u=o*l-h*s,p=c*s-a*l,m=t*d+i*u+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let x=1/m;return e[0]=d*x,e[1]=(r*c-h*i)*x,e[2]=(o*i-r*a)*x,e[3]=u*x,e[4]=(h*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(a*t-i*s)*x,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){let l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(dl.makeScale(e,t)),this}rotate(e){return this.premultiply(dl.makeRotation(-e)),this}translate(e,t){return this.premultiply(dl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Tc.prototype.isMatrix3=!0;var Be=Tc,dl=new Be,$h=new Be().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),jh=new Be().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function tg(){let n={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===et&&(r.r=Hn(r.r),r.g=Hn(r.g),r.b=Hn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===et&&(r.r=Ji(r.r),r.g=Ji(r.g),r.b=Ji(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===$n?Fr:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ga("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ga("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Ur]:{primaries:e,whitePoint:i,transfer:Fr,toXYZ:$h,fromXYZ:jh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Qt},outputColorSpaceConfig:{drawingBufferColorSpace:Qt}},[Qt]:{primaries:e,whitePoint:i,transfer:et,toXYZ:$h,fromXYZ:jh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Qt}}}),n}var $e=tg();function Hn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ji(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var Bi,_a=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Bi===void 0&&(Bi=Or("canvas")),Bi.width=e.width,Bi.height=e.height;let r=Bi.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Bi}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Or("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=Hn(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Hn(t[i]/255)*255):t[i]=Hn(t[i]);return{data:t,width:e.width,height:e.height}}else return Ie("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},ng=0,tr=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ng++}),this.uuid=pr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(pl(r[a].image)):s.push(pl(r[a]))}else s=pl(r);i.url=s}return t||(e.images[this.uuid]=i),i}};function pl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?_a.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(Ie("Texture: Unable to serialize Texture."),{})}var ig=0,ml=new U,Wt=class n extends _n{constructor(e=n.DEFAULT_IMAGE,t=n.DEFAULT_MAPPING,i=Cn,r=Cn,s=Rt,a=pi,o=hn,l=qt,c=n.DEFAULT_ANISOTROPY,h=$n){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ig++}),this.uuid=pr(),this.name="",this.source=new tr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Te(0,0),this.repeat=new Te(1,1),this.center=new Te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(ml).x}get height(){return this.source.getSize(ml).y}get depth(){return this.source.getSize(ml).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let i=e[t];if(i===void 0){Ie(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Ie(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ac)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case da:e.x=e.x-Math.floor(e.x);break;case Cn:e.x=e.x<0?0:1;break;case pa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case da:e.y=e.y-Math.floor(e.y);break;case Cn:e.y=e.y<0?0:1;break;case pa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Wt.DEFAULT_IMAGE=null;Wt.DEFAULT_MAPPING=ac;Wt.DEFAULT_ANISOTROPY=1;var Ac=class Ac{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s,l=e.elements,c=l[0],h=l[4],d=l[8],u=l[1],p=l[5],m=l[9],x=l[2],g=l[6],f=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-x)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+x)<.1&&Math.abs(m+g)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let M=(c+1)/2,S=(p+1)/2,w=(f+1)/2,y=(h+u)/4,A=(d+x)/4,_=(m+g)/4;return M>S&&M>w?M<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(M),r=y/i,s=A/i):S>w?S<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),i=y/r,s=_/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=A/s,r=_/s),this.set(i,r,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(d-x)*(d-x)+(u-h)*(u-h));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(d-x)/v,this.z=(u-h)/v,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this.w=Ge(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this.w=Ge(this.w,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Ge(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Ac.prototype.isVector4=!0;var pt=Ac,xa=class extends _n{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Rt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:i.depth},s=new Wt(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){let t={minFilter:Rt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new tr(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}},tn=class extends xa{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},Br=class extends Wt{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Et,this.minFilter=Et,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var va=class extends Wt{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Et,this.minFilter=Et,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var qa=class qa{constructor(e,t,i,r,s,a,o,l,c,h,d,u,p,m,x,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,h,d,u,p,m,x,g)}set(e,t,i,r,s,a,o,l,c,h,d,u,p,m,x,g){let f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=d,f[14]=u,f[3]=p,f[7]=m,f[11]=x,f[15]=g,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 qa().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,i=e.elements,r=1/ki.setFromMatrixColumn(e,0).length(),s=1/ki.setFromMatrixColumn(e,1).length(),a=1/ki.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){let u=a*h,p=a*d,m=o*h,x=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=p+m*c,t[5]=u-x*c,t[9]=-o*l,t[2]=x-u*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){let u=l*h,p=l*d,m=c*h,x=c*d;t[0]=u+x*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=p*o-m,t[6]=x+u*o,t[10]=a*l}else if(e.order==="ZXY"){let u=l*h,p=l*d,m=c*h,x=c*d;t[0]=u-x*o,t[4]=-a*d,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*h,t[9]=x-u*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){let u=a*h,p=a*d,m=o*h,x=o*d;t[0]=l*h,t[4]=m*c-p,t[8]=u*c+x,t[1]=l*d,t[5]=x*c+u,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){let u=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*h,t[4]=x-u*d,t[8]=m*d+p,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=p*d+m,t[10]=u-x*d}else if(e.order==="XZY"){let u=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=u*d+x,t[5]=a*h,t[9]=p*d-m,t[2]=m*d-p,t[6]=o*h,t[10]=x*d+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rg,e,sg)}lookAt(e,t,i){let r=this.elements;return Jt.subVectors(e,t),Jt.lengthSq()===0&&(Jt.z=1),Jt.normalize(),Qn.crossVectors(i,Jt),Qn.lengthSq()===0&&(Math.abs(i.z)===1?Jt.x+=1e-4:Jt.z+=1e-4,Jt.normalize(),Qn.crossVectors(i,Jt)),Qn.normalize(),Us.crossVectors(Jt,Qn),r[0]=Qn.x,r[4]=Us.x,r[8]=Jt.x,r[1]=Qn.y,r[5]=Us.y,r[9]=Jt.y,r[2]=Qn.z,r[6]=Us.z,r[10]=Jt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],h=i[1],d=i[5],u=i[9],p=i[13],m=i[2],x=i[6],g=i[10],f=i[14],v=i[3],M=i[7],S=i[11],w=i[15],y=r[0],A=r[4],_=r[8],C=r[12],D=r[1],P=r[5],N=r[9],V=r[13],I=r[2],R=r[6],L=r[10],k=r[14],ee=r[3],ne=r[7],he=r[11],q=r[15];return s[0]=a*y+o*D+l*I+c*ee,s[4]=a*A+o*P+l*R+c*ne,s[8]=a*_+o*N+l*L+c*he,s[12]=a*C+o*V+l*k+c*q,s[1]=h*y+d*D+u*I+p*ee,s[5]=h*A+d*P+u*R+p*ne,s[9]=h*_+d*N+u*L+p*he,s[13]=h*C+d*V+u*k+p*q,s[2]=m*y+x*D+g*I+f*ee,s[6]=m*A+x*P+g*R+f*ne,s[10]=m*_+x*N+g*L+f*he,s[14]=m*C+x*V+g*k+f*q,s[3]=v*y+M*D+S*I+w*ee,s[7]=v*A+M*P+S*R+w*ne,s[11]=v*_+M*N+S*L+w*he,s[15]=v*C+M*V+S*k+w*q,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],d=e[6],u=e[10],p=e[14],m=e[3],x=e[7],g=e[11],f=e[15],v=l*p-c*u,M=o*p-c*d,S=o*u-l*d,w=a*p-c*h,y=a*u-l*h,A=a*d-o*h;return t*(x*v-g*M+f*S)-i*(m*v-g*w+f*y)+r*(m*M-x*w+f*A)-s*(m*S-x*y+g*A)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=e[9],u=e[10],p=e[11],m=e[12],x=e[13],g=e[14],f=e[15],v=t*o-i*a,M=t*l-r*a,S=t*c-s*a,w=i*l-r*o,y=i*c-s*o,A=r*c-s*l,_=h*x-d*m,C=h*g-u*m,D=h*f-p*m,P=d*g-u*x,N=d*f-p*x,V=u*f-p*g,I=v*V-M*N+S*P+w*D-y*C+A*_;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let R=1/I;return e[0]=(o*V-l*N+c*P)*R,e[1]=(r*N-i*V-s*P)*R,e[2]=(x*A-g*y+f*w)*R,e[3]=(u*y-d*A-p*w)*R,e[4]=(l*D-a*V-c*C)*R,e[5]=(t*V-r*D+s*C)*R,e[6]=(g*S-m*A-f*M)*R,e[7]=(h*A-u*S+p*M)*R,e[8]=(a*N-o*D+c*_)*R,e[9]=(i*D-t*N-s*_)*R,e[10]=(m*y-x*S+f*v)*R,e[11]=(d*S-h*y-p*v)*R,e[12]=(o*C-a*P-l*_)*R,e[13]=(t*P-i*C+r*_)*R,e[14]=(x*M-m*w-g*v)*R,e[15]=(h*w-d*M+u*v)*R,this}scale(e){let t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+i,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,d=o+o,u=s*c,p=s*h,m=s*d,x=a*h,g=a*d,f=o*d,v=l*c,M=l*h,S=l*d,w=i.x,y=i.y,A=i.z;return r[0]=(1-(x+f))*w,r[1]=(p+S)*w,r[2]=(m-M)*w,r[3]=0,r[4]=(p-S)*y,r[5]=(1-(u+f))*y,r[6]=(g+v)*y,r[7]=0,r[8]=(m+M)*A,r[9]=(g-v)*A,r[10]=(1-(u+x))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=ki.set(r[0],r[1],r[2]).length(),o=ki.set(r[4],r[5],r[6]).length(),l=ki.set(r[8],r[9],r[10]).length();s<0&&(a=-a),dn.copy(this);let c=1/a,h=1/o,d=1/l;return dn.elements[0]*=c,dn.elements[1]*=c,dn.elements[2]*=c,dn.elements[4]*=h,dn.elements[5]*=h,dn.elements[6]*=h,dn.elements[8]*=d,dn.elements[9]*=d,dn.elements[10]*=d,t.setFromRotationMatrix(dn),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=gn,l=!1){let c=this.elements,h=2*s/(t-e),d=2*s/(i-r),u=(t+e)/(t-e),p=(i+r)/(i-r),m,x;if(l)m=s/(a-s),x=a*s/(a-s);else if(o===gn)m=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===Ki)m=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=d,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=gn,l=!1){let c=this.elements,h=2/(t-e),d=2/(i-r),u=-(t+e)/(t-e),p=-(i+r)/(i-r),m,x;if(l)m=1/(a-s),x=a/(a-s);else if(o===gn)m=-2/(a-s),x=-(a+s)/(a-s);else if(o===Ki)m=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=u,c[1]=0,c[5]=d,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};qa.prototype.isMatrix4=!0;var ct=qa,ki=new U,dn=new ct,rg=new U(0,0,0),sg=new U(1,1,1),Qn=new U,Us=new U,Jt=new U,Zh=new ct,Jh=new en,Xn=class n{constructor(e=0,t=0,i=0,r=n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],d=r[2],u=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ge(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ge(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ge(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ge(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:Ie("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Zh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Zh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Jh.setFromEuler(this),this.setFromQuaternion(Jh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Xn.DEFAULT_ORDER="XYZ";var nr=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},ag=0,Kh=new U,zi=new en,Bn=new ct,Fs=new U,Tr=new U,og=new U,lg=new en,Qh=new U(1,0,0),eu=new U(0,1,0),tu=new U(0,0,1),nu={type:"added"},cg={type:"removed"},Vi={type:"childadded",child:null},gl={type:"childremoved",child:null},Ut=class n extends _n{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ag++}),this.uuid=pr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let e=new U,t=new Xn,i=new en,r=new U(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ct},normalMatrix:{value:new Be}}),this.matrix=new ct,this.matrixWorld=new ct,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new nr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return zi.setFromAxisAngle(e,t),this.quaternion.multiply(zi),this}rotateOnWorldAxis(e,t){return zi.setFromAxisAngle(e,t),this.quaternion.premultiply(zi),this}rotateX(e){return this.rotateOnAxis(Qh,e)}rotateY(e){return this.rotateOnAxis(eu,e)}rotateZ(e){return this.rotateOnAxis(tu,e)}translateOnAxis(e,t){return Kh.copy(e).applyQuaternion(this.quaternion),this.position.add(Kh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Qh,e)}translateY(e){return this.translateOnAxis(eu,e)}translateZ(e){return this.translateOnAxis(tu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Fs.copy(e):Fs.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),Tr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bn.lookAt(Tr,Fs,this.up):Bn.lookAt(Fs,Tr,this.up),this.quaternion.setFromRotationMatrix(Bn),r&&(Bn.extractRotation(r.matrixWorld),zi.setFromRotationMatrix(Bn),this.quaternion.premultiply(zi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Le("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(nu),Vi.child=e,this.dispatchEvent(Vi),Vi.child=null):Le("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(cg),gl.child=e,this.dispatchEvent(gl),gl.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Bn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(nu),Vi.child=e,this.dispatchEvent(Vi),Vi.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Tr,e,og),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Tr,lg,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e===!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)),t===!0){let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){let d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){let l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){let o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),d=a(e.shapes),u=a(e.skeletons),p=a(e.animations),m=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),d.length>0&&(i.shapes=d),u.length>0&&(i.skeletons=u),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function a(o){let l=[];for(let c in o){let h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let r=e.children[i];this.add(r.clone())}return this}};Ut.DEFAULT_UP=new U(0,1,0);Ut.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Rn=class extends Ut{constructor(){super(),this.isGroup=!0,this.type="Group"}},hg={type:"move"},ir=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Rn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Rn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Rn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null,o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(let x of e.hand.values()){let g=t.getJointPose(x,i),f=this._getHandJoint(c,x);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}let h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],u=h.position.distanceTo(d.position),p=.02,m=.005;c.inputState.pinching&&u>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(hg)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new Rn;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},tf={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},ei={h:0,s:0,l:0},Os={h:0,s:0,l:0};function _l(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}var Xe=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Qt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$e.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=$e.workingColorSpace){return this.r=e,this.g=t,this.b=i,$e.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=$e.workingColorSpace){if(e=gc(e,1),t=Ge(t,0,1),i=Ge(i,0,1),t===0)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=_l(a,s,e+1/3),this.g=_l(a,s,e),this.b=_l(a,s,e-1/3)}return $e.colorSpaceToWorking(this,r),this}setStyle(e,t=Qt){function i(s){s!==void 0&&parseFloat(s)<1&&Ie("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ie("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ie("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Qt){let i=tf[e.toLowerCase()];return i!==void 0?this.setHex(i,t):Ie("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Hn(e.r),this.g=Hn(e.g),this.b=Hn(e.b),this}copyLinearToSRGB(e){return this.r=Ji(e.r),this.g=Ji(e.g),this.b=Ji(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Qt){return $e.workingToColorSpace(Lt.copy(this),e),Math.round(Ge(Lt.r*255,0,255))*65536+Math.round(Ge(Lt.g*255,0,255))*256+Math.round(Ge(Lt.b*255,0,255))}getHexString(e=Qt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$e.workingColorSpace){$e.workingToColorSpace(Lt.copy(this),t);let i=Lt.r,r=Lt.g,s=Lt.b,a=Math.max(i,r,s),o=Math.min(i,r,s),l,c,h=(o+a)/2;if(o===a)l=0,c=0;else{let d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=$e.workingColorSpace){return $e.workingToColorSpace(Lt.copy(this),t),e.r=Lt.r,e.g=Lt.g,e.b=Lt.b,e}getStyle(e=Qt){$e.workingToColorSpace(Lt.copy(this),e);let t=Lt.r,i=Lt.g,r=Lt.b;return e!==Qt?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(ei),this.setHSL(ei.h+e,ei.s+t,ei.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ei),e.getHSL(Os);let i=Ir(ei.h,Os.h,t),r=Ir(ei.s,Os.s,t),s=Ir(ei.l,Os.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Lt=new Xe;Xe.NAMES=tf;var kr=class extends Ut{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 Xn,this.environmentIntensity=1,this.environmentRotation=new Xn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},pn=new U,kn=new U,xl=new U,zn=new U,Gi=new U,Hi=new U,iu=new U,vl=new U,yl=new U,bl=new U,Ml=new pt,Sl=new pt,wl=new pt,si=class n{constructor(e=new U,t=new U,i=new U){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),pn.subVectors(e,t),r.cross(pn);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){pn.subVectors(r,t),kn.subVectors(i,t),xl.subVectors(e,t);let a=pn.dot(pn),o=pn.dot(kn),l=pn.dot(xl),c=kn.dot(kn),h=kn.dot(xl),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;let u=1/d,p=(c*l-o*h)*u,m=(a*h-o*l)*u;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,zn)===null?!1:zn.x>=0&&zn.y>=0&&zn.x+zn.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,zn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,zn.x),l.addScaledVector(a,zn.y),l.addScaledVector(o,zn.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Ml.setScalar(0),Sl.setScalar(0),wl.setScalar(0),Ml.fromBufferAttribute(e,t),Sl.fromBufferAttribute(e,i),wl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ml,s.x),a.addScaledVector(Sl,s.y),a.addScaledVector(wl,s.z),a}static isFrontFacing(e,t,i,r){return pn.subVectors(i,t),kn.subVectors(e,t),pn.cross(kn).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return pn.subVectors(this.c,this.b),kn.subVectors(this.a,this.b),pn.cross(kn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return n.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return n.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return n.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return n.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return n.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,r=this.b,s=this.c,a,o;Gi.subVectors(r,i),Hi.subVectors(s,i),vl.subVectors(e,i);let l=Gi.dot(vl),c=Hi.dot(vl);if(l<=0&&c<=0)return t.copy(i);yl.subVectors(e,r);let h=Gi.dot(yl),d=Hi.dot(yl);if(h>=0&&d<=h)return t.copy(r);let u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(i).addScaledVector(Gi,a);bl.subVectors(e,s);let p=Gi.dot(bl),m=Hi.dot(bl);if(m>=0&&p<=m)return t.copy(s);let x=p*c-l*m;if(x<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(Hi,o);let g=h*m-p*d;if(g<=0&&d-h>=0&&p-m>=0)return iu.subVectors(s,r),o=(d-h)/(d-h+(p-m)),t.copy(r).addScaledVector(iu,o);let f=1/(g+x+u);return a=x*f,o=u*f,t.copy(i).addScaledVector(Gi,a).addScaledVector(Hi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},In=class{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(mn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(mn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=mn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,mn):mn.fromBufferAttribute(s,a),mn.applyMatrix4(e.matrixWorld),this.expandByPoint(mn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Bs.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Bs.copy(i.boundingBox)),Bs.applyMatrix4(e.matrixWorld),this.union(Bs)}let r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,mn),mn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ar),ks.subVectors(this.max,Ar),Wi.subVectors(e.a,Ar),Xi.subVectors(e.b,Ar),qi.subVectors(e.c,Ar),ti.subVectors(Xi,Wi),ni.subVectors(qi,Xi),bi.subVectors(Wi,qi);let t=[0,-ti.z,ti.y,0,-ni.z,ni.y,0,-bi.z,bi.y,ti.z,0,-ti.x,ni.z,0,-ni.x,bi.z,0,-bi.x,-ti.y,ti.x,0,-ni.y,ni.x,0,-bi.y,bi.x,0];return!Tl(t,Wi,Xi,qi,ks)||(t=[1,0,0,0,1,0,0,0,1],!Tl(t,Wi,Xi,qi,ks))?!1:(zs.crossVectors(ti,ni),t=[zs.x,zs.y,zs.z],Tl(t,Wi,Xi,qi,ks))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,mn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(mn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Vn=[new U,new U,new U,new U,new U,new U,new U,new U],mn=new U,Bs=new In,Wi=new U,Xi=new U,qi=new U,ti=new U,ni=new U,bi=new U,Ar=new U,ks=new U,zs=new U,Mi=new U;function Tl(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Mi.fromArray(n,s);let o=r.x*Math.abs(Mi.x)+r.y*Math.abs(Mi.y)+r.z*Math.abs(Mi.z),l=e.dot(Mi),c=t.dot(Mi),h=i.dot(Mi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}var bt=new U,Vs=new Te,ug=0,zt=class extends _n{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ug++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Hl,this.updateRanges=[],this.gpuType=yn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix3(e),this.setXY(t,Vs.x,Vs.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.applyMatrix3(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.applyMatrix4(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.applyNormalMatrix(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.transformDirection(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Zi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=kt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Zi(t,this.array)),t}setX(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zi(t,this.array)),t}setY(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zi(t,this.array)),t}setW(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),i=kt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),i=kt(i,this.array),r=kt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),i=kt(i,this.array),r=kt(r,this.array),s=kt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Hl&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var zr=class extends zt{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var Vr=class extends zt{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var _t=class extends zt{constructor(e,t,i){super(new Float32Array(e),t,i)}},fg=new In,Er=new U,Al=new U,Ci=class{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):fg.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Er.subVectors(e,this.center);let t=Er.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Er,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Al.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Er.copy(e.center).add(Al)),this.expandByPoint(Er.copy(e.center).sub(Al))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},dg=0,on=new ct,El=new Ut,Yi=new U,Kt=new In,Cr=new In,At=new U,Ft=class n extends _n{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dg++}),this.uuid=pr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Om(e)?Vr:zr)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new Be().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return on.makeRotationFromQuaternion(e),this.applyMatrix4(on),this}rotateX(e){return on.makeRotationX(e),this.applyMatrix4(on),this}rotateY(e){return on.makeRotationY(e),this.applyMatrix4(on),this}rotateZ(e){return on.makeRotationZ(e),this.applyMatrix4(on),this}translate(e,t,i){return on.makeTranslation(e,t,i),this.applyMatrix4(on),this}scale(e,t,i){return on.makeScale(e,t,i),this.applyMatrix4(on),this}lookAt(e){return El.lookAt(e),El.updateMatrix(),this.applyMatrix4(El.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Yi).negate(),this.translate(Yi.x,Yi.y,Yi.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let i=[];for(let r=0,s=e.length;r<s;r++){let a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new _t(i,3))}else{let i=Math.min(e.length,t.count);for(let r=0;r<i;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Ie("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new In);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){let s=t[i];Kt.setFromBufferAttribute(s),this.morphTargetsRelative?(At.addVectors(this.boundingBox.min,Kt.min),this.boundingBox.expandByPoint(At),At.addVectors(this.boundingBox.max,Kt.max),this.boundingBox.expandByPoint(At)):(this.boundingBox.expandByPoint(Kt.min),this.boundingBox.expandByPoint(Kt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Le('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 Ci);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){let i=this.boundingSphere.center;if(Kt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){let o=t[s];Cr.setFromBufferAttribute(o),this.morphTargetsRelative?(At.addVectors(Kt.min,Cr.min),Kt.expandByPoint(At),At.addVectors(Kt.max,Cr.max),Kt.expandByPoint(At)):(Kt.expandByPoint(Cr.min),Kt.expandByPoint(Cr.max))}Kt.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)At.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(At));if(t)for(let s=0,a=t.length;s<a;s++){let o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)At.fromBufferAttribute(o,c),l&&(Yi.fromBufferAttribute(e,c),At.add(Yi)),r=Math.max(r,i.distanceToSquared(At))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Le('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Le("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new zt(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new U,l[_]=new U;let c=new U,h=new U,d=new U,u=new Te,p=new Te,m=new Te,x=new U,g=new U;function f(_,C,D){c.fromBufferAttribute(i,_),h.fromBufferAttribute(i,C),d.fromBufferAttribute(i,D),u.fromBufferAttribute(s,_),p.fromBufferAttribute(s,C),m.fromBufferAttribute(s,D),h.sub(c),d.sub(c),p.sub(u),m.sub(u);let P=1/(p.x*m.y-m.x*p.y);isFinite(P)&&(x.copy(h).multiplyScalar(m.y).addScaledVector(d,-p.y).multiplyScalar(P),g.copy(d).multiplyScalar(p.x).addScaledVector(h,-m.x).multiplyScalar(P),o[_].add(x),o[C].add(x),o[D].add(x),l[_].add(g),l[C].add(g),l[D].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let _=0,C=v.length;_<C;++_){let D=v[_],P=D.start,N=D.count;for(let V=P,I=P+N;V<I;V+=3)f(e.getX(V+0),e.getX(V+1),e.getX(V+2))}let M=new U,S=new U,w=new U,y=new U;function A(_){w.fromBufferAttribute(r,_),y.copy(w);let C=o[_];M.copy(C),M.sub(w.multiplyScalar(w.dot(C))).normalize(),S.crossVectors(y,C);let P=S.dot(l[_])<0?-1:1;a.setXYZW(_,M.x,M.y,M.z,P)}for(let _=0,C=v.length;_<C;++_){let D=v[_],P=D.start,N=D.count;for(let V=P,I=P+N;V<I;V+=3)A(e.getX(V+0)),A(e.getX(V+1)),A(e.getX(V+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new zt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let u=0,p=i.count;u<p;u++)i.setXYZ(u,0,0,0);let r=new U,s=new U,a=new U,o=new U,l=new U,c=new U,h=new U,d=new U;if(e)for(let u=0,p=e.count;u<p;u+=3){let m=e.getX(u+0),x=e.getX(u+1),g=e.getX(u+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,g),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,g),o.add(h),l.add(h),c.add(h),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let u=0,p=t.count;u<p;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),i.setXYZ(u+0,h.x,h.y,h.z),i.setXYZ(u+1,h.x,h.y,h.z),i.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)At.fromBufferAttribute(e,t),At.normalize(),e.setXYZ(t,At.x,At.y,At.z)}toNonIndexed(){function e(o,l){let c=o.array,h=o.itemSize,d=o.normalized,u=new c.constructor(l.length*h),p=0,m=0;for(let x=0,g=l.length;x<g;x++){o.isInterleavedBufferAttribute?p=l[x]*o.data.stride+o.offset:p=l[x]*h;for(let f=0;f<h;f++)u[m++]=c[p++]}return new zt(u,h,d)}if(this.index===null)return Ie("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new n,i=this.index.array,r=this.attributes;for(let o in r){let l=r[o],c=e(l,i);t.setAttribute(o,c)}let s=this.morphAttributes;for(let o in s){let l=[],c=s[o];for(let h=0,d=c.length;h<d;h++){let u=c[h],p=e(u,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,l=a.length;o<l;o++){let c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let l in i){let c=i[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d<u;d++){let p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone());let r=e.attributes;for(let c in r){let h=r[c];this.setAttribute(c,h.clone(t))}let s=e.morphAttributes;for(let c in s){let h=[],d=s[c];for(let u=0,p=d.length;u<p;u++)h.push(d[u].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let c=0,h=a.length;c<h;c++){let d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var pg=0,qn=class extends _n{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pg++}),this.uuid=pr(),this.name="",this.type="Material",this.blending=Ai,this.side=Wn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ra,this.blendDst=sa,this.blendEquation=ai,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xe(0,0,0),this.blendAlpha=0,this.depthFunc=Ei,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Gl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ti,this.stencilZFail=Ti,this.stencilZPass=Ti,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.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){Ie(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Ie(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.7,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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.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(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ai&&(i.blending=this.blending),this.side!==Wn&&(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!==ra&&(i.blendSrc=this.blendSrc),this.blendDst!==sa&&(i.blendDst=this.blendDst),this.blendEquation!==ai&&(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!==Ei&&(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!==Gl&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ti&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ti&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ti&&(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.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){let a=[];for(let o in s){let l=s[o];delete l.metadata,a.push(l)}return a}if(t){let s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var Gn=new U,Cl=new U,Gs=new U,ii=new U,Rl=new U,Hs=new U,Pl=new U,oi=class{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Gn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Gn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gn.copy(this.origin).addScaledVector(this.direction,t),Gn.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Cl.copy(e).add(t).multiplyScalar(.5),Gs.copy(t).sub(e).normalize(),ii.copy(this.origin).sub(Cl);let s=e.distanceTo(t)*.5,a=-this.direction.dot(Gs),o=ii.dot(this.direction),l=-ii.dot(Gs),c=ii.lengthSq(),h=Math.abs(1-a*a),d,u,p,m;if(h>0)if(d=a*l-o,u=a*o-l,m=s*h,d>=0)if(u>=-m)if(u<=m){let x=1/h;d*=x,u*=x,p=d*(d+a*u+2*o)+u*(a*d+u+2*l)+c}else u=s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u=-s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u<=-m?(d=Math.max(0,-(-a*s+o)),u=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c):u<=m?(d=0,u=Math.min(Math.max(-s,-l),s),p=u*(u+2*l)+c):(d=Math.max(0,-(a*s+o)),u=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c);else u=a>0?-s:s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Cl).addScaledVector(Gs,u),p}intersectSphere(e,t){Gn.subVectors(e.center,this.origin);let i=Gn.dot(this.direction),r=Gn.dot(Gn)-i*i,s=e.radius*e.radius;if(r>s)return null;let a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l,c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),h>=0?(s=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-u.z)*d,l=(e.max.z-u.z)*d):(o=(e.max.z-u.z)*d,l=(e.min.z-u.z)*d),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Gn)!==null}intersectTriangle(e,t,i,r,s){Rl.subVectors(t,e),Hs.subVectors(i,e),Pl.crossVectors(Rl,Hs);let a=this.direction.dot(Pl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ii.subVectors(this.origin,e);let l=o*this.direction.dot(Hs.crossVectors(ii,Hs));if(l<0)return null;let c=o*this.direction.dot(Rl.cross(ii));if(c<0||l+c>a)return null;let h=-o*ii.dot(Pl);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Gr=class extends qn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(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 Xn,this.combine=Ya,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},ru=new ct,Si=new oi,Ws=new Ci,su=new U,Xs=new U,qs=new U,Ys=new U,Il=new U,$s=new U,au=new U,js=new U,Xt=class extends Ut{constructor(e=new Ft,t=new Gr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){let o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(s&&o){$s.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let h=o[l],d=s[l];h!==0&&(Il.fromBufferAttribute(d,e),a?$s.addScaledVector(Il,h):$s.addScaledVector(Il.sub(t),h))}t.add($s)}return t}raycast(e,t){let i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ws.copy(i.boundingSphere),Ws.applyMatrix4(s),Si.copy(e.ray).recast(e.near),!(Ws.containsPoint(Si.origin)===!1&&(Si.intersectSphere(Ws,su)===null||Si.origin.distanceToSquared(su)>(e.far-e.near)**2))&&(ru.copy(s).invert(),Si.copy(e.ray).applyMatrix4(ru),!(i.boundingBox!==null&&Si.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Si)))}_computeIntersections(e,t,i){let r,s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,u=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,x=u.length;m<x;m++){let g=u[m],f=a[g.materialIndex],v=Math.max(g.start,p.start),M=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let S=v,w=M;S<w;S+=3){let y=o.getX(S),A=o.getX(S+1),_=o.getX(S+2);r=Zs(this,f,e,i,c,h,d,y,A,_),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let m=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){let v=o.getX(g),M=o.getX(g+1),S=o.getX(g+2);r=Zs(this,a,e,i,c,h,d,v,M,S),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,x=u.length;m<x;m++){let g=u[m],f=a[g.materialIndex],v=Math.max(g.start,p.start),M=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let S=v,w=M;S<w;S+=3){let y=S,A=S+1,_=S+2;r=Zs(this,f,e,i,c,h,d,y,A,_),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){let v=g,M=g+1,S=g+2;r=Zs(this,a,e,i,c,h,d,v,M,S),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}};function mg(n,e,t,i,r,s,a,o){let l;if(e.side===Vt?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Wn,o),l===null)return null;js.copy(o),js.applyMatrix4(n.matrixWorld);let c=t.ray.origin.distanceTo(js);return c<t.near||c>t.far?null:{distance:c,point:js.clone(),object:n}}function Zs(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Xs),n.getVertexPosition(l,qs),n.getVertexPosition(c,Ys);let h=mg(n,e,t,i,Xs,qs,Ys,au);if(h){let d=new U;si.getBarycoord(au,Xs,qs,Ys,d),r&&(h.uv=si.getInterpolatedAttribute(r,o,l,c,d,new Te)),s&&(h.uv1=si.getInterpolatedAttribute(s,o,l,c,d,new Te)),a&&(h.normal=si.getInterpolatedAttribute(a,o,l,c,d,new U),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));let u={a:o,b:l,c,normal:new U,materialIndex:0};si.getNormal(Xs,qs,Ys,u.normal),h.face=u,h.barycoord=d}return h}var ya=class extends Wt{constructor(e=null,t=1,i=1,r,s,a,o,l,c=Et,h=Et,d,u){super(null,a,o,l,c,h,r,s,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Dl=new U,gg=new U,_g=new Be,ln=class{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let r=Dl.subVectors(i,t).cross(gg.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){let r=e.delta(Dl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||_g.getNormalMatrix(e),r=this.coplanarPoint(Dl).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},wi=new Ci,xg=new Te(.5,.5),Js=new U,rr=class{constructor(e=new ln,t=new ln,i=new ln,r=new ln,s=new ln,a=new ln){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=gn,i=!1){let r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],d=s[5],u=s[6],p=s[7],m=s[8],x=s[9],g=s[10],f=s[11],v=s[12],M=s[13],S=s[14],w=s[15];if(r[0].setComponents(c-a,p-h,f-m,w-v).normalize(),r[1].setComponents(c+a,p+h,f+m,w+v).normalize(),r[2].setComponents(c+o,p+d,f+x,w+M).normalize(),r[3].setComponents(c-o,p-d,f-x,w-M).normalize(),i)r[4].setComponents(l,u,g,S).normalize(),r[5].setComponents(c-l,p-u,f-g,w-S).normalize();else if(r[4].setComponents(c-l,p-u,f-g,w-S).normalize(),t===gn)r[5].setComponents(c+l,p+u,f+g,w+S).normalize();else if(t===Ki)r[5].setComponents(l,u,g,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),wi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),wi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(wi)}intersectsSprite(e){wi.center.set(0,0,0);let t=xg.distanceTo(e.center);return wi.radius=.7071067811865476+t,wi.applyMatrix4(e.matrixWorld),this.intersectsSphere(wi)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(Js.x=r.normal.x>0?e.max.x:e.min.x,Js.y=r.normal.y>0?e.max.y:e.min.y,Js.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Js)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var sr=class extends qn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},ba=new U,Ma=new U,ou=new ct,Rr=new oi,Ks=new Ci,Ll=new U,lu=new U,Hr=class extends Ut{constructor(e=new Ft,t=new sr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)ba.fromBufferAttribute(t,r-1),Ma.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=ba.distanceTo(Ma);e.setAttribute("lineDistance",new _t(i,1))}else Ie("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ks.copy(i.boundingSphere),Ks.applyMatrix4(r),Ks.radius+=s,e.ray.intersectsSphere(Ks)===!1)return;ou.copy(r).invert(),Rr.copy(e.ray).applyMatrix4(ou);let o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=i.index,u=i.attributes.position;if(h!==null){let p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let x=p,g=m-1;x<g;x+=c){let f=h.getX(x),v=h.getX(x+1),M=Qs(this,e,Rr,l,f,v,x);M&&t.push(M)}if(this.isLineLoop){let x=h.getX(m-1),g=h.getX(p),f=Qs(this,e,Rr,l,x,g,m-1);f&&t.push(f)}}else{let p=Math.max(0,a.start),m=Math.min(u.count,a.start+a.count);for(let x=p,g=m-1;x<g;x+=c){let f=Qs(this,e,Rr,l,x,x+1,x);f&&t.push(f)}if(this.isLineLoop){let x=Qs(this,e,Rr,l,m-1,p,m-1);x&&t.push(x)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){let o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}};function Qs(n,e,t,i,r,s,a){let o=n.geometry.attributes.position;if(ba.fromBufferAttribute(o,r),Ma.fromBufferAttribute(o,s),t.distanceSqToSegment(ba,Ma,Ll,lu)>i)return;Ll.applyMatrix4(n.matrixWorld);let c=e.ray.origin.distanceTo(Ll);if(!(c<e.near||c>e.far))return{distance:c,point:lu.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}var Wr=class extends Wt{constructor(e=[],t=di,i,r,s,a,o,l,c,h){super(e,t,i,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Yn=class extends Wt{constructor(e,t,i=vn,r,s,a,o=Et,l=Et,c,h=Pn,d=1){if(h!==Pn&&h!==mi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let u={width:e,height:t,depth:d};super(u,r,s,a,o,l,h,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new tr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Sa=class extends Yn{constructor(e,t=vn,i=di,r,s,a=Et,o=Et,l,c=Pn){let h={width:e,height:e,depth:1},d=[h,h,h,h,h,h];super(e,e,t,i,r,s,a,o,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Xr=class extends Wt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},ar=class n extends Ft{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};let o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);let l=[],c=[],h=[],d=[],u=0,p=0;m("z","y","x",-1,-1,i,t,e,a,s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new _t(c,3)),this.setAttribute("normal",new _t(h,3)),this.setAttribute("uv",new _t(d,2));function m(x,g,f,v,M,S,w,y,A,_,C){let D=S/A,P=w/_,N=S/2,V=w/2,I=y/2,R=A+1,L=_+1,k=0,ee=0,ne=new U;for(let he=0;he<L;he++){let q=he*P-V;for(let J=0;J<R;J++){let fe=J*D-N;ne[x]=fe*v,ne[g]=q*M,ne[f]=I,c.push(ne.x,ne.y,ne.z),ne[x]=0,ne[g]=0,ne[f]=y>0?1:-1,h.push(ne.x,ne.y,ne.z),d.push(J/A),d.push(1-he/_),k+=1}}for(let he=0;he<_;he++)for(let q=0;q<A;q++){let J=u+q+R*he,fe=u+q+R*(he+1),De=u+(q+1)+R*(he+1),Y=u+(q+1)+R*he;l.push(J,fe,Y),l.push(fe,De,Y),ee+=6}o.addGroup(p,ee,C),p+=ee,u+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var or=class n extends Ft{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let h=[],d=[],u=[],p=[],m=0,x=[],g=i/2,f=0;v(),a===!1&&(e>0&&M(!0),t>0&&M(!1)),this.setIndex(h),this.setAttribute("position",new _t(d,3)),this.setAttribute("normal",new _t(u,3)),this.setAttribute("uv",new _t(p,2));function v(){let S=new U,w=new U,y=0,A=(t-e)/i;for(let _=0;_<=s;_++){let C=[],D=_/s,P=D*(t-e)+e;for(let N=0;N<=r;N++){let V=N/r,I=V*l+o,R=Math.sin(I),L=Math.cos(I);w.x=P*R,w.y=-D*i+g,w.z=P*L,d.push(w.x,w.y,w.z),S.set(R,A,L).normalize(),u.push(S.x,S.y,S.z),p.push(V,1-D),C.push(m++)}x.push(C)}for(let _=0;_<r;_++)for(let C=0;C<s;C++){let D=x[C][_],P=x[C+1][_],N=x[C+1][_+1],V=x[C][_+1];(e>0||C!==0)&&(h.push(D,P,V),y+=3),(t>0||C!==s-1)&&(h.push(P,N,V),y+=3)}c.addGroup(f,y,0),f+=y}function M(S){let w=m,y=new Te,A=new U,_=0,C=S===!0?e:t,D=S===!0?1:-1;for(let N=1;N<=r;N++)d.push(0,g*D,0),u.push(0,D,0),p.push(.5,.5),m++;let P=m;for(let N=0;N<=r;N++){let I=N/r*l+o,R=Math.cos(I),L=Math.sin(I);A.x=C*L,A.y=g*D,A.z=C*R,d.push(A.x,A.y,A.z),u.push(0,D,0),y.x=R*.5+.5,y.y=L*.5*D+.5,p.push(y.x,y.y),m++}for(let N=0;N<r;N++){let V=w+N,I=P+N;S===!0?h.push(I,I+1,V):h.push(I+1,I,V),_+=3}c.addGroup(f,_,S===!0?1:2),f+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},qr=class n extends or{constructor(e=1,t=1,i=32,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,i,r,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var cn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Ie("Curve: .getPoint() not implemented.")}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let i=this.getLengths(),r=0,s=i.length,a;t?a=t:a=e*i[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=i[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===a)return r/(s-1);let h=i[r],u=i[r+1]-h,p=(a-h)/u;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new Te:new U);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){let i=new U,r=[],s=[],a=[],o=new U,l=new ct;for(let p=0;p<=e;p++){let m=p/e;r[p]=this.getTangentAt(m,new U)}s[0]=new U,a[0]=new U;let c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=c&&(c=h,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),u<=c&&i.set(0,0,1),o.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();let m=Math.acos(Ge(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,m))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(Ge(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),a[m].crossVectors(r[m],s[m])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Yr=class extends cn{constructor(e=0,t=0,i=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new Te){let i=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);let o=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),u=l-this.aX,p=c-this.aY;l=u*h-p*d+this.aX,c=u*d+p*h+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},wa=class extends Yr{constructor(e,t,i,r,s,a){super(e,t,i,i,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}};function xc(){let n=0,e=0,t=0,i=0;function r(s,a,o,l){n=s,e=o,t=-3*s+3*a-2*o-l,i=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,d){let u=(a-s)/c-(o-s)/(c+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;u*=h,p*=h,r(a,o,u,p)},calc:function(s){let a=s*s,o=a*s;return n+e*s+t*a+i*o}}}var cu=new U,hu=new U,Nl=new xc,Ul=new xc,Fl=new xc,Ta=class extends cn{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new U){let i=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e,o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=r[(o-1)%s]:(hu.subVectors(r[0],r[1]).add(r[0]),c=hu);let d=r[o%s],u=r[(o+1)%s];if(this.closed||o+2<s?h=r[(o+2)%s]:(cu.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=cu),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,m=Math.pow(c.distanceToSquared(d),p),x=Math.pow(d.distanceToSquared(u),p),g=Math.pow(u.distanceToSquared(h),p);x<1e-4&&(x=1),m<1e-4&&(m=x),g<1e-4&&(g=x),Nl.initNonuniformCatmullRom(c.x,d.x,u.x,h.x,m,x,g),Ul.initNonuniformCatmullRom(c.y,d.y,u.y,h.y,m,x,g),Fl.initNonuniformCatmullRom(c.z,d.z,u.z,h.z,m,x,g)}else this.curveType==="catmullrom"&&(Nl.initCatmullRom(c.x,d.x,u.x,h.x,this.tension),Ul.initCatmullRom(c.y,d.y,u.y,h.y,this.tension),Fl.initCatmullRom(c.z,d.z,u.z,h.z,this.tension));return i.set(Nl.calc(l),Ul.calc(l),Fl.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new U().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function uu(n,e,t,i,r){let s=(i-e)*.5,a=(r-t)*.5,o=n*n,l=n*o;return(2*t-2*i+s+a)*l+(-3*t+3*i-2*s-a)*o+s*n+t}function vg(n,e){let t=1-n;return t*t*e}function yg(n,e){return 2*(1-n)*n*e}function bg(n,e){return n*n*e}function Dr(n,e,t,i){return vg(n,e)+yg(n,t)+bg(n,i)}function Mg(n,e){let t=1-n;return t*t*t*e}function Sg(n,e){let t=1-n;return 3*t*t*n*e}function wg(n,e){return 3*(1-n)*n*n*e}function Tg(n,e){return n*n*n*e}function Lr(n,e,t,i,r){return Mg(n,e)+Sg(n,t)+wg(n,i)+Tg(n,r)}var Aa=class extends cn{constructor(e=new Te,t=new Te,i=new Te,r=new Te){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Te){let i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(Lr(e,r.x,s.x,a.x,o.x),Lr(e,r.y,s.y,a.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},lr=class extends cn{constructor(e=new U,t=new U,i=new U,r=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(Lr(e,r.x,s.x,a.x,o.x),Lr(e,r.y,s.y,a.y,o.y),Lr(e,r.z,s.z,a.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Ea=class extends cn{constructor(e=new Te,t=new Te){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Te){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Te){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ca=class extends cn{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ra=class extends cn{constructor(e=new Te,t=new Te,i=new Te){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Te){let i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Dr(e,r.x,s.x,a.x),Dr(e,r.y,s.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ri=class extends cn{constructor(e=new U,t=new U,i=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Dr(e,r.x,s.x,a.x),Dr(e,r.y,s.y,a.y),Dr(e,r.z,s.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Pa=class extends cn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Te){let i=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],h=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return i.set(uu(o,l.x,c.x,h.x,d.x),uu(o,l.y,c.y,h.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new Te().fromArray(r))}return this}},Ag=Object.freeze({__proto__:null,ArcCurve:wa,CatmullRomCurve3:Ta,CubicBezierCurve:Aa,CubicBezierCurve3:lr,EllipseCurve:Yr,LineCurve:Ea,LineCurve3:Ca,QuadraticBezierCurve:Ra,QuadraticBezierCurve3:Ri,SplineCurve:Pa});var $r=class n extends Ft{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};let s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,h=l+1,d=e/o,u=t/l,p=[],m=[],x=[],g=[];for(let f=0;f<h;f++){let v=f*u-a;for(let M=0;M<c;M++){let S=M*d-s;m.push(S,-v,0),x.push(0,0,1),g.push(M/o),g.push(1-f/l)}}for(let f=0;f<l;f++)for(let v=0;v<o;v++){let M=v+c*f,S=v+c*(f+1),w=v+1+c*(f+1),y=v+1+c*f;p.push(M,S,y),p.push(S,w,y)}this.setIndex(p),this.setAttribute("position",new _t(m,3)),this.setAttribute("normal",new _t(x,3)),this.setAttribute("uv",new _t(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}};var jr=class n extends Ft{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let l=Math.min(a+o,Math.PI),c=0,h=[],d=new U,u=new U,p=[],m=[],x=[],g=[];for(let f=0;f<=i;f++){let v=[],M=f/i,S=0;f===0&&a===0?S=.5/t:f===i&&l===Math.PI&&(S=-.5/t);for(let w=0;w<=t;w++){let y=w/t;d.x=-e*Math.cos(r+y*s)*Math.sin(a+M*o),d.y=e*Math.cos(a+M*o),d.z=e*Math.sin(r+y*s)*Math.sin(a+M*o),m.push(d.x,d.y,d.z),u.copy(d).normalize(),x.push(u.x,u.y,u.z),g.push(y+S,1-M),v.push(c++)}h.push(v)}for(let f=0;f<i;f++)for(let v=0;v<t;v++){let M=h[f][v+1],S=h[f][v],w=h[f+1][v],y=h[f+1][v+1];(f!==0||a>0)&&p.push(M,S,y),(f!==i-1||l<Math.PI)&&p.push(S,w,y)}this.setIndex(p),this.setAttribute("position",new _t(m,3)),this.setAttribute("normal",new _t(x,3)),this.setAttribute("uv",new _t(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Zr=class n extends Ft{constructor(e=new Ri(new U(-1,-1,0),new U(-1,1,0),new U(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};let a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let o=new U,l=new U,c=new Te,h=new U,d=[],u=[],p=[],m=[];x(),this.setIndex(m),this.setAttribute("position",new _t(d,3)),this.setAttribute("normal",new _t(u,3)),this.setAttribute("uv",new _t(p,2));function x(){for(let M=0;M<t;M++)g(M);g(s===!1?t:0),v(),f()}function g(M){h=e.getPointAt(M/t,h);let S=a.normals[M],w=a.binormals[M];for(let y=0;y<=r;y++){let A=y/r*Math.PI*2,_=Math.sin(A),C=-Math.cos(A);l.x=C*S.x+_*w.x,l.y=C*S.y+_*w.y,l.z=C*S.z+_*w.z,l.normalize(),u.push(l.x,l.y,l.z),o.x=h.x+i*l.x,o.y=h.y+i*l.y,o.z=h.z+i*l.z,d.push(o.x,o.y,o.z)}}function f(){for(let M=1;M<=t;M++)for(let S=1;S<=r;S++){let w=(r+1)*(M-1)+(S-1),y=(r+1)*M+(S-1),A=(r+1)*M+S,_=(r+1)*(M-1)+S;m.push(w,y,_),m.push(y,A,_)}}function v(){for(let M=0;M<=t;M++)for(let S=0;S<=r;S++)c.x=M/t,c.y=S/r,p.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new n(new Ag[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}};function Ii(n){let e={};for(let t in n){e[t]={};for(let i in n[t]){let r=n[t][i];if(fu(r))r.isRenderTargetTexture?(Ie("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(fu(r[0])){let s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function Ot(n){let e={};for(let t=0;t<n.length;t++){let i=Ii(n[t]);for(let r in i)e[r]=i[r]}return e}function fu(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function Eg(n){let e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function vc(n){let e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:$e.workingColorSpace}var nf={clone:Ii,merge:Ot},Cg=`void main() {
|
|
500
|
+
`}});var xp=Ht((SC,_p)=>{_p.exports=ab;function ab(n,e,t,i){this.from=n,this.to=e,this.length=t,this.coefficient=i}});var bp=Ht((wC,yp)=>{yp.exports=vp;function vp(n,e){var t;if(n||(n={}),e){for(t in e)if(e.hasOwnProperty(t)){var i=n.hasOwnProperty(t),r=typeof e[t],s=!i||typeof n[t]!==r;s?n[t]=e[t]:r==="object"&&(n[t]=vp(n[t],e[t]))}}return n}});var ch=Ht((TC,Mp)=>{"use strict";function ob(n){cb(n);let e=lb(n);return n.on=e.on,n.off=e.off,n.fire=e.fire,n}function lb(n){let e=Object.create(null);return{on:function(t,i,r){if(typeof i!="function")throw new Error("callback is expected to be a function");let s=e[t];return s||(s=e[t]=[]),s.push({callback:i,ctx:r}),n},off:function(t,i){if(typeof t>"u")return e=Object.create(null),n;if(e[t])if(typeof i!="function")delete e[t];else{let r=e[t];for(let s=0;s<r.length;++s)r[s].callback===i&&r.splice(s,1)}return n},fire:function(t){let i=e[t];if(!i)return n;let r;arguments.length>1&&(r=Array.prototype.slice.call(arguments,1));for(let s=0;s<i.length;++s){let a=i[s];a.callback.apply(a.ctx,r)}return n}}}function cb(n){if(!n)throw new Error("Eventify cannot use falsy object as events subject");let e=["on","fire","off"];for(let t=0;t<e.length;++t)if(n.hasOwnProperty(e[t]))throw new Error("Subject cannot be eventified, since it already has property '"+e[t]+"'")}Mp.exports=ob});var wp=Ht((AC,Jo)=>{Jo.exports=hh;Jo.exports.random=hh,Jo.exports.randomIterator=db;function hh(n){var e=typeof n=="number"?n:+new Date;return new Ui(e)}function Ui(n){this.seed=n}Ui.prototype.next=fb;Ui.prototype.nextDouble=uh;Ui.prototype.uniform=uh;Ui.prototype.gaussian=hb;Ui.prototype.random=uh;function hb(){var n,e,t;do e=this.nextDouble()*2-1,t=this.nextDouble()*2-1,n=e*e+t*t;while(n>=1||n===0);return e*Math.sqrt(-2*Math.log(n)/n)}Ui.prototype.levy=ub;function ub(){var n=1.5,e=Math.pow(Sp(1+n)*Math.sin(Math.PI*n/2)/(Sp((1+n)/2)*n*Math.pow(2,(n-1)/2)),1/n);return this.gaussian()*e/Math.pow(Math.abs(this.gaussian()),1/n)}function Sp(n){return Math.sqrt(2*Math.PI/n)*Math.pow(1/Math.E*(n+1/(12*n-1/(10*n))),n)}function uh(){var n=this.seed;return n=n+2127912214+(n<<12)&4294967295,n=(n^3345072700^n>>>19)&4294967295,n=n+374761393+(n<<5)&4294967295,n=(n+3550635116^n<<9)&4294967295,n=n+4251993797+(n<<3)&4294967295,n=(n^3042594569^n>>>16)&4294967295,this.seed=n,(n&268435455)/268435456}function fb(n){return Math.floor(this.nextDouble()*n)}function db(n,e){var t=e||hh();if(typeof t.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:r,shuffle:i};function i(){var s,a,o;for(s=n.length-1;s>0;--s)a=t.next(s+1),o=n[a],n[a]=n[s],n[s]=o;return n}function r(s){var a,o,l;for(a=n.length-1;a>0;--a)o=t.next(a+1),l=n[o],n[o]=n[a],n[a]=l,s(l);n.length&&s(n[0])}}});var fh=Ht((EC,Ap)=>{Ap.exports=yb;var pb=tp(),mb=lp(),gb=hp(),_b=fp(),xb=pp(),vb=gp(),Tp={};function yb(n){var e=xp(),t=bp(),i=ch();if(n){if(n.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(n.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}n=t(n,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var r=Tp[n.dimensions];if(!r){var s=n.dimensions;r={Body:pb(s,n.debug),createQuadTree:mb(s),createBounds:gb(s),createDragForce:_b(s),createSpringForce:xb(s),integrate:vb(s)},Tp[s]=r}var a=r.Body,o=r.createQuadTree,l=r.createBounds,c=r.createDragForce,h=r.createSpringForce,d=r.integrate,u=R=>new a(R),p=wp().random(42),m=[],x=[],g=o(n,p),f=l(m,n,p),v=h(n,p),M=c(n),S=0,w=[],y=new Map,A=0;D("nbody",V),D("spring",I);var _={bodies:m,quadTree:g,springs:x,settings:n,addForce:D,removeForce:P,getForces:N,step:function(){for(var R=0;R<w.length;++R)w[R](A);var L=d(m,n.timeStep,n.adaptiveTimeStepWeight);return A+=1,L},addBody:function(R){if(!R)throw new Error("Body is required");return m.push(R),R},addBodyAt:function(R){if(!R)throw new Error("Body position is required");var L=u(R);return m.push(L),L},removeBody:function(R){if(R){var L=m.indexOf(R);if(!(L<0))return m.splice(L,1),m.length===0&&f.reset(),!0}},addSpring:function(R,L,k,ee){if(!R||!L)throw new Error("Cannot add null spring to force simulator");typeof k!="number"&&(k=-1);var ne=new e(R,L,k,ee>=0?ee:-1);return x.push(ne),ne},getTotalMovement:function(){return S},removeSpring:function(R){if(R){var L=x.indexOf(R);if(L>-1)return x.splice(L,1),!0}},getBestNewBodyPosition:function(R){return f.getBestNewPosition(R)},getBBox:C,getBoundingBox:C,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(R){return R!==void 0?(n.gravity=R,g.options({gravity:R}),this):n.gravity},theta:function(R){return R!==void 0?(n.theta=R,g.options({theta:R}),this):n.theta},random:p};return bb(n,_),i(_),_;function C(){return f.update(),f.box}function D(R,L){if(y.has(R))throw new Error("Force "+R+" is already added");y.set(R,L),w.push(L)}function P(R){var L=w.indexOf(y.get(R));L<0||(w.splice(L,1),y.delete(R))}function N(){return y}function V(){if(m.length!==0){g.insertBodies(m);for(var R=m.length;R--;){var L=m[R];L.isPinned||(L.reset(),g.updateBodyForce(L),M.update(L))}}}function I(){for(var R=x.length;R--;)v.update(x[R])}}function bb(n,e){for(var t in n)Mb(n,e,t)}function Mb(n,e,t){if(n.hasOwnProperty(t)&&typeof e[t]!="function"){var i=Number.isFinite(n[t]);i?e[t]=function(r){if(r!==void 0){if(!Number.isFinite(r))throw new Error("Value of "+t+" should be a valid number.");return n[t]=r,e}return n[t]}:e[t]=function(r){return r!==void 0?(n[t]=r,e):n[t]}}}});var Ep=Ht((CC,dh)=>{dh.exports=wb;dh.exports.simulator=fh();var Sb=ch();function wb(n,e){if(!n)throw new Error("Graph structure cannot be undefined");var t=e&&e.createSimulator||fh(),i=t(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var r=n.version>19?V:N;e&&typeof e.nodeMass=="function"&&(r=e.nodeMass);var s=new Map,a={},o=0,l=i.settings.springTransform||Tb;M(),g();var c=!1,h={step:function(){if(o===0)return d(!0),!0;var I=i.step();h.lastMove=I,h.fire("step");var R=I/o,L=R<=.01;return d(L),L},getNodePosition:function(I){return P(I).pos},setNodePosition:function(I){var R=P(I);R.setPosition.apply(R,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(I){var R=a[I];if(R)return{from:R.from.pos,to:R.to.pos}},getGraphRect:function(){return i.getBBox()},forEachBody:u,pinNode:function(I,R){var L=P(I.id);L.isPinned=!!R},isNodePinned:function(I){return P(I.id).isPinned},dispose:function(){n.off("changed",v),h.fire("disposed")},getBody:x,getSpring:m,getForceVectorLength:p,simulator:i,graph:n,lastMove:0};return Sb(h),h;function d(I){c!==I&&(c=I,f(I))}function u(I){s.forEach(I)}function p(){var I=0,R=0;return u(function(L){I+=Math.abs(L.force.x),R+=Math.abs(L.force.y)}),Math.sqrt(I*I+R*R)}function m(I,R){var L;if(R===void 0)typeof I!="object"?L=I:L=I.id;else{var k=n.hasLink(I,R);if(!k)return;L=k.id}return a[L]}function x(I){return s.get(I)}function g(){n.on("changed",v)}function f(I){h.fire("stable",I)}function v(I){for(var R=0;R<I.length;++R){var L=I[R];L.changeType==="add"?(L.node&&S(L.node.id),L.link&&y(L.link)):L.changeType==="remove"&&(L.node&&w(L.node),L.link&&A(L.link))}o=n.getNodesCount()}function M(){o=0,n.forEachNode(function(I){S(I.id),o+=1}),n.forEachLink(y)}function S(I){var R=s.get(I);if(!R){var L=n.getNode(I);if(!L)throw new Error("initBody() was called with unknown node id");var k=L.position;if(!k){var ee=_(L);k=i.getBestNewBodyPosition(ee)}R=i.addBodyAt(k),R.id=I,s.set(I,R),C(I),D(L)&&(R.isPinned=!0)}}function w(I){var R=I.id,L=s.get(R);L&&(s.delete(R),i.removeBody(L))}function y(I){C(I.fromId),C(I.toId);var R=s.get(I.fromId),L=s.get(I.toId),k=i.addSpring(R,L,I.length);l(I,k),a[I.id]=k}function A(I){var R=a[I.id];if(R){var L=n.getNode(I.fromId),k=n.getNode(I.toId);L&&C(L.id),k&&C(k.id),delete a[I.id],i.removeSpring(R)}}function _(I){var R=[];if(!I.links)return R;for(var L=Math.min(I.links.length,2),k=0;k<L;++k){var ee=I.links[k],ne=ee.fromId!==I.id?s.get(ee.fromId):s.get(ee.toId);ne&&ne.pos&&R.push(ne)}return R}function C(I){var R=s.get(I);if(R.mass=r(I),Number.isNaN(R.mass))throw new Error("Node mass should be a number")}function D(I){return I&&(I.isPinned||I.data&&I.data.isPinned)}function P(I){var R=s.get(I);return R||(S(I),R=s.get(I)),R}function N(I){var R=n.getLinks(I);return R?1+R.length/3:1}function V(I){var R=n.getLinks(I);return R?1+R.size/3:1}}function Tb(){}});var ui={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},fi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},yu=0,jl=1,bu=2;var ss=1,Mu=2,ur=3,Wn=0,Vt=1,Dn=2,Ln=0,Ai=1,Zl=2,Jl=3,Kl=4,Su=5;var ai=100,wu=101,Tu=102,Au=103,Eu=104,Cu=200,Ru=201,Pu=202,Iu=203,ra=204,sa=205,Du=206,Lu=207,Nu=208,Uu=209,Ou=210,Fu=211,Bu=212,ku=213,zu=214,aa=0,oa=1,la=2,Ei=3,ca=4,ha=5,ua=6,fa=7,Ya=0,Vu=1,Gu=2,xn=0,Ql=1,ec=2,tc=3,nc=4,ic=5,rc=6,sc=7;var ac=300,di=301,Pi=302,$a=303,ja=304,as=306,da=1e3,Cn=1001,pa=1002,Et=1003,Hu=1004;var os=1005;var Rt=1006,Za=1007;var pi=1008;var qt=1009,oc=1010,lc=1011,fr=1012,Ja=1013,vn=1014,yn=1015,Nn=1016,Ka=1017,Qa=1018,dr=1020,cc=35902,hc=35899,uc=1021,fc=1022,hn=1023,Pn=1026,mi=1027,dc=1028,eo=1029,gi=1030,to=1031;var no=1033,ls=33776,cs=33777,hs=33778,us=33779,io=35840,ro=35841,so=35842,ao=35843,oo=36196,lo=37492,co=37496,ho=37488,uo=37489,fs=37490,fo=37491,po=37808,mo=37809,go=37810,_o=37811,xo=37812,vo=37813,yo=37814,bo=37815,Mo=37816,So=37817,wo=37818,To=37819,Ao=37820,Eo=37821,Co=36492,Ro=36494,Po=36495,Io=36283,Do=36284,ds=36285,Lo=36286;var Nr=2300,ma=2301,ia=2302,Bl=2303,kl=2400,zl=2401,Vl=2402;var Wu=3200;var No=0,Xu=1,$n="",Qt="srgb",Ur="srgb-linear",Or="linear",et="srgb";var Ti=7680;var Gl=519,qu=512,Yu=513,$u=514,Uo=515,ju=516,Zu=517,Oo=518,Ju=519,Hl=35044;var pc="300 es",gn=2e3,Ki=2001;function Hm(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Wm(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Fr(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Ku(){let n=Fr("canvas");return n.style.display="block",n}var qh={},Qi=null;function mc(...n){let e="THREE."+n.shift();Qi?Qi("log",e,...n):console.log(e,...n)}function Qu(n){let e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function Ie(...n){n=Qu(n);let e="THREE."+n.shift();if(Qi)Qi("warn",e,...n);else{let t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function Le(...n){n=Qu(n);let e="THREE."+n.shift();if(Qi)Qi("error",e,...n);else{let t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function ga(...n){let e=n.join(" ");e in qh||(qh[e]=!0,Ie(...n))}function ef(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}var tf={[aa]:oa,[la]:ua,[ca]:fa,[Ei]:ha,[oa]:aa,[ua]:la,[fa]:ca,[ha]:Ei},_n=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){let i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){let i=this._listeners;if(i===void 0)return;let r=i[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let i=t[e.type];if(i!==void 0){e.target=this;let r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}},Dt=["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"],Yh=1234567,Pr=Math.PI/180,er=180/Math.PI;function pr(){let n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Dt[n&255]+Dt[n>>8&255]+Dt[n>>16&255]+Dt[n>>24&255]+"-"+Dt[e&255]+Dt[e>>8&255]+"-"+Dt[e>>16&15|64]+Dt[e>>24&255]+"-"+Dt[t&63|128]+Dt[t>>8&255]+"-"+Dt[t>>16&255]+Dt[t>>24&255]+Dt[i&255]+Dt[i>>8&255]+Dt[i>>16&255]+Dt[i>>24&255]).toLowerCase()}function Ge(n,e,t){return Math.max(e,Math.min(t,n))}function gc(n,e){return(n%e+e)%e}function Xm(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function qm(n,e,t){return n!==e?(t-n)/(e-n):0}function Ir(n,e,t){return(1-t)*n+t*e}function Ym(n,e,t,i){return Ir(n,e,1-Math.exp(-t*i))}function $m(n,e=1){return e-Math.abs(gc(n,e*2)-e)}function jm(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Zm(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Jm(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Km(n,e){return n+Math.random()*(e-n)}function Qm(n){return n*(.5-Math.random())}function eg(n){n!==void 0&&(Yh=n);let e=Yh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function tg(n){return n*Pr}function ng(n){return n*er}function ig(n){return(n&n-1)===0&&n!==0}function rg(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function sg(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function ag(n,e,t,i,r){let s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),h=a((e+i)/2),d=s((e-i)/2),u=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":n.set(o*h,l*d,l*u,o*c);break;case"YZY":n.set(l*u,o*h,l*d,o*c);break;case"ZXZ":n.set(l*d,l*u,o*h,o*c);break;case"XZX":n.set(o*h,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*h,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*h,o*c);break;default:Ie("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Zi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function kt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var _c={DEG2RAD:Pr,RAD2DEG:er,generateUUID:pr,clamp:Ge,euclideanModulo:gc,mapLinear:Xm,inverseLerp:qm,lerp:Ir,damp:Ym,pingpong:$m,smoothstep:jm,smootherstep:Zm,randInt:Jm,randFloat:Km,randFloatSpread:Qm,seededRandom:eg,degToRad:tg,radToDeg:ng,isPowerOfTwo:ig,ceilPowerOfTwo:rg,floorPowerOfTwo:sg,setQuaternionFromProperEuler:ag,normalize:kt,denormalize:Zi},Sc=class Sc{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Ge(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Ge(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Sc.prototype.isVector2=!0;var Te=Sc,en=class{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],h=i[r+2],d=i[r+3],u=s[a+0],p=s[a+1],m=s[a+2],x=s[a+3];if(d!==x||l!==u||c!==p||h!==m){let g=l*u+c*p+h*m+d*x;g<0&&(u=-u,p=-p,m=-m,x=-x,g=-g);let f=1-o;if(g<.9995){let v=Math.acos(g),M=Math.sin(v);f=Math.sin(f*v)/M,o=Math.sin(o*v)/M,l=l*f+u*o,c=c*f+p*o,h=h*f+m*o,d=d*f+x*o}else{l=l*f+u*o,c=c*f+p*o,h=h*f+m*o,d=d*f+x*o;let v=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=v,c*=v,h*=v,d*=v}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,a){let o=i[r],l=i[r+1],c=i[r+2],h=i[r+3],d=s[a],u=s[a+1],p=s[a+2],m=s[a+3];return e[t]=o*m+h*d+l*p-c*u,e[t+1]=l*m+h*u+c*d-o*p,e[t+2]=c*m+h*p+o*u-l*d,e[t+3]=h*m-o*d-l*u-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),h=o(r/2),d=o(s/2),u=l(i/2),p=l(r/2),m=l(s/2);switch(a){case"XYZ":this._x=u*h*d+c*p*m,this._y=c*p*d-u*h*m,this._z=c*h*m+u*p*d,this._w=c*h*d-u*p*m;break;case"YXZ":this._x=u*h*d+c*p*m,this._y=c*p*d-u*h*m,this._z=c*h*m-u*p*d,this._w=c*h*d+u*p*m;break;case"ZXY":this._x=u*h*d-c*p*m,this._y=c*p*d+u*h*m,this._z=c*h*m+u*p*d,this._w=c*h*d-u*p*m;break;case"ZYX":this._x=u*h*d-c*p*m,this._y=c*p*d+u*h*m,this._z=c*h*m-u*p*d,this._w=c*h*d+u*p*m;break;case"YZX":this._x=u*h*d+c*p*m,this._y=c*p*d+u*h*m,this._z=c*h*m-u*p*d,this._w=c*h*d-u*p*m;break;case"XZY":this._x=u*h*d-c*p*m,this._y=c*p*d-u*h*m,this._z=c*h*m+u*p*d,this._w=c*h*d+u*p*m;break;default:Ie("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],h=t[6],d=t[10],u=i+o+d;if(u>0){let p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>d){let p=2*Math.sqrt(1+i-o-d);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>d){let p=2*Math.sqrt(1+o-i-d);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{let p=2*Math.sqrt(1+d-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ge(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,h=t._w;return this._x=i*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-i*c,this._z=s*h+a*c+i*l-r*o,this._w=a*h-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){let c=Math.acos(o),h=Math.sin(c);l=Math.sin(l*c)/h,t=Math.sin(t*c)/h,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},wc=class wc{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion($h.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion($h.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),h=2*(o*t-s*r),d=2*(s*i-a*t);return this.x=t+l*c+a*d-o*h,this.y=i+l*h+o*c-s*d,this.z=r+l*d+s*h-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Ge(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return fl.copy(this).projectOnVector(e),this.sub(fl)}reflect(e){return this.sub(fl.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Ge(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};wc.prototype.isVector3=!0;var U=wc,fl=new U,$h=new en,Tc=class Tc{constructor(e,t,i,r,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){let h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=i,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],h=i[4],d=i[7],u=i[2],p=i[5],m=i[8],x=r[0],g=r[3],f=r[6],v=r[1],M=r[4],S=r[7],w=r[2],y=r[5],A=r[8];return s[0]=a*x+o*v+l*w,s[3]=a*g+o*M+l*y,s[6]=a*f+o*S+l*A,s[1]=c*x+h*v+d*w,s[4]=c*g+h*M+d*y,s[7]=c*f+h*S+d*A,s[2]=u*x+p*v+m*w,s[5]=u*g+p*M+m*y,s[8]=u*f+p*S+m*A,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8];return t*a*h-t*o*c-i*s*h+i*o*l+r*s*c-r*a*l}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=h*a-o*c,u=o*l-h*s,p=c*s-a*l,m=t*d+i*u+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let x=1/m;return e[0]=d*x,e[1]=(r*c-h*i)*x,e[2]=(o*i-r*a)*x,e[3]=u*x,e[4]=(h*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(i*l-c*t)*x,e[8]=(a*t-i*s)*x,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){let l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(dl.makeScale(e,t)),this}rotate(e){return this.premultiply(dl.makeRotation(-e)),this}translate(e,t){return this.premultiply(dl.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Tc.prototype.isMatrix3=!0;var Be=Tc,dl=new Be,jh=new Be().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Zh=new Be().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function og(){let n={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===et&&(r.r=Hn(r.r),r.g=Hn(r.g),r.b=Hn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===et&&(r.r=Ji(r.r),r.g=Ji(r.g),r.b=Ji(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===$n?Or:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ga("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ga("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Ur]:{primaries:e,whitePoint:i,transfer:Or,toXYZ:jh,fromXYZ:Zh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Qt},outputColorSpaceConfig:{drawingBufferColorSpace:Qt}},[Qt]:{primaries:e,whitePoint:i,transfer:et,toXYZ:jh,fromXYZ:Zh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Qt}}}),n}var $e=og();function Hn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ji(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var Bi,_a=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Bi===void 0&&(Bi=Fr("canvas")),Bi.width=e.width,Bi.height=e.height;let r=Bi.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Bi}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Fr("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=Hn(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Hn(t[i]/255)*255):t[i]=Hn(t[i]);return{data:t,width:e.width,height:e.height}}else return Ie("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},lg=0,tr=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:lg++}),this.uuid=pr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(pl(r[a].image)):s.push(pl(r[a]))}else s=pl(r);i.url=s}return t||(e.images[this.uuid]=i),i}};function pl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?_a.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(Ie("Texture: Unable to serialize Texture."),{})}var cg=0,ml=new U,Wt=class n extends _n{constructor(e=n.DEFAULT_IMAGE,t=n.DEFAULT_MAPPING,i=Cn,r=Cn,s=Rt,a=pi,o=hn,l=qt,c=n.DEFAULT_ANISOTROPY,h=$n){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:cg++}),this.uuid=pr(),this.name="",this.source=new tr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Te(0,0),this.repeat=new Te(1,1),this.center=new Te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(ml).x}get height(){return this.source.getSize(ml).y}get depth(){return this.source.getSize(ml).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let i=e[t];if(i===void 0){Ie(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Ie(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ac)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case da:e.x=e.x-Math.floor(e.x);break;case Cn:e.x=e.x<0?0:1;break;case pa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case da:e.y=e.y-Math.floor(e.y);break;case Cn:e.y=e.y<0?0:1;break;case pa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Wt.DEFAULT_IMAGE=null;Wt.DEFAULT_MAPPING=ac;Wt.DEFAULT_ANISOTROPY=1;var Ac=class Ac{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s,l=e.elements,c=l[0],h=l[4],d=l[8],u=l[1],p=l[5],m=l[9],x=l[2],g=l[6],f=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-x)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+x)<.1&&Math.abs(m+g)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let M=(c+1)/2,S=(p+1)/2,w=(f+1)/2,y=(h+u)/4,A=(d+x)/4,_=(m+g)/4;return M>S&&M>w?M<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(M),r=y/i,s=A/i):S>w?S<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),i=y/r,s=_/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=A/s,r=_/s),this.set(i,r,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(d-x)*(d-x)+(u-h)*(u-h));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(d-x)/v,this.z=(u-h)/v,this.w=Math.acos((c+p+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Ge(this.x,e.x,t.x),this.y=Ge(this.y,e.y,t.y),this.z=Ge(this.z,e.z,t.z),this.w=Ge(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ge(this.x,e,t),this.y=Ge(this.y,e,t),this.z=Ge(this.z,e,t),this.w=Ge(this.w,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Ge(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Ac.prototype.isVector4=!0;var pt=Ac,xa=class extends _n{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Rt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new pt(0,0,e,t),this.scissorTest=!1,this.viewport=new pt(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:i.depth},s=new Wt(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){let t={minFilter:Rt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new tr(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}},tn=class extends xa{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},Br=class extends Wt{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Et,this.minFilter=Et,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var va=class extends Wt{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Et,this.minFilter=Et,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var qa=class qa{constructor(e,t,i,r,s,a,o,l,c,h,d,u,p,m,x,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,h,d,u,p,m,x,g)}set(e,t,i,r,s,a,o,l,c,h,d,u,p,m,x,g){let f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=d,f[14]=u,f[3]=p,f[7]=m,f[11]=x,f[15]=g,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 qa().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,i=e.elements,r=1/ki.setFromMatrixColumn(e,0).length(),s=1/ki.setFromMatrixColumn(e,1).length(),a=1/ki.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){let u=a*h,p=a*d,m=o*h,x=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=p+m*c,t[5]=u-x*c,t[9]=-o*l,t[2]=x-u*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){let u=l*h,p=l*d,m=c*h,x=c*d;t[0]=u+x*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=p*o-m,t[6]=x+u*o,t[10]=a*l}else if(e.order==="ZXY"){let u=l*h,p=l*d,m=c*h,x=c*d;t[0]=u-x*o,t[4]=-a*d,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*h,t[9]=x-u*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){let u=a*h,p=a*d,m=o*h,x=o*d;t[0]=l*h,t[4]=m*c-p,t[8]=u*c+x,t[1]=l*d,t[5]=x*c+u,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){let u=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*h,t[4]=x-u*d,t[8]=m*d+p,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=p*d+m,t[10]=u-x*d}else if(e.order==="XZY"){let u=a*l,p=a*c,m=o*l,x=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=u*d+x,t[5]=a*h,t[9]=p*d-m,t[2]=m*d-p,t[6]=o*h,t[10]=x*d+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(hg,e,ug)}lookAt(e,t,i){let r=this.elements;return Jt.subVectors(e,t),Jt.lengthSq()===0&&(Jt.z=1),Jt.normalize(),Qn.crossVectors(i,Jt),Qn.lengthSq()===0&&(Math.abs(i.z)===1?Jt.x+=1e-4:Jt.z+=1e-4,Jt.normalize(),Qn.crossVectors(i,Jt)),Qn.normalize(),Us.crossVectors(Jt,Qn),r[0]=Qn.x,r[4]=Us.x,r[8]=Jt.x,r[1]=Qn.y,r[5]=Us.y,r[9]=Jt.y,r[2]=Qn.z,r[6]=Us.z,r[10]=Jt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],h=i[1],d=i[5],u=i[9],p=i[13],m=i[2],x=i[6],g=i[10],f=i[14],v=i[3],M=i[7],S=i[11],w=i[15],y=r[0],A=r[4],_=r[8],C=r[12],D=r[1],P=r[5],N=r[9],V=r[13],I=r[2],R=r[6],L=r[10],k=r[14],ee=r[3],ne=r[7],he=r[11],q=r[15];return s[0]=a*y+o*D+l*I+c*ee,s[4]=a*A+o*P+l*R+c*ne,s[8]=a*_+o*N+l*L+c*he,s[12]=a*C+o*V+l*k+c*q,s[1]=h*y+d*D+u*I+p*ee,s[5]=h*A+d*P+u*R+p*ne,s[9]=h*_+d*N+u*L+p*he,s[13]=h*C+d*V+u*k+p*q,s[2]=m*y+x*D+g*I+f*ee,s[6]=m*A+x*P+g*R+f*ne,s[10]=m*_+x*N+g*L+f*he,s[14]=m*C+x*V+g*k+f*q,s[3]=v*y+M*D+S*I+w*ee,s[7]=v*A+M*P+S*R+w*ne,s[11]=v*_+M*N+S*L+w*he,s[15]=v*C+M*V+S*k+w*q,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],h=e[2],d=e[6],u=e[10],p=e[14],m=e[3],x=e[7],g=e[11],f=e[15],v=l*p-c*u,M=o*p-c*d,S=o*u-l*d,w=a*p-c*h,y=a*u-l*h,A=a*d-o*h;return t*(x*v-g*M+f*S)-i*(m*v-g*w+f*y)+r*(m*M-x*w+f*A)-s*(m*S-x*y+g*A)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],h=e[8],d=e[9],u=e[10],p=e[11],m=e[12],x=e[13],g=e[14],f=e[15],v=t*o-i*a,M=t*l-r*a,S=t*c-s*a,w=i*l-r*o,y=i*c-s*o,A=r*c-s*l,_=h*x-d*m,C=h*g-u*m,D=h*f-p*m,P=d*g-u*x,N=d*f-p*x,V=u*f-p*g,I=v*V-M*N+S*P+w*D-y*C+A*_;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let R=1/I;return e[0]=(o*V-l*N+c*P)*R,e[1]=(r*N-i*V-s*P)*R,e[2]=(x*A-g*y+f*w)*R,e[3]=(u*y-d*A-p*w)*R,e[4]=(l*D-a*V-c*C)*R,e[5]=(t*V-r*D+s*C)*R,e[6]=(g*S-m*A-f*M)*R,e[7]=(h*A-u*S+p*M)*R,e[8]=(a*N-o*D+c*_)*R,e[9]=(i*D-t*N-s*_)*R,e[10]=(m*y-x*S+f*v)*R,e[11]=(d*S-h*y-p*v)*R,e[12]=(o*C-a*P-l*_)*R,e[13]=(t*P-i*C+r*_)*R,e[14]=(x*M-m*w-g*v)*R,e[15]=(h*w-d*M+u*v)*R,this}scale(e){let t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,h=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+i,h*l-r*a,0,c*l-r*o,h*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,h=a+a,d=o+o,u=s*c,p=s*h,m=s*d,x=a*h,g=a*d,f=o*d,v=l*c,M=l*h,S=l*d,w=i.x,y=i.y,A=i.z;return r[0]=(1-(x+f))*w,r[1]=(p+S)*w,r[2]=(m-M)*w,r[3]=0,r[4]=(p-S)*y,r[5]=(1-(u+f))*y,r[6]=(g+v)*y,r[7]=0,r[8]=(m+M)*A,r[9]=(g-v)*A,r[10]=(1-(u+x))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=ki.set(r[0],r[1],r[2]).length(),o=ki.set(r[4],r[5],r[6]).length(),l=ki.set(r[8],r[9],r[10]).length();s<0&&(a=-a),dn.copy(this);let c=1/a,h=1/o,d=1/l;return dn.elements[0]*=c,dn.elements[1]*=c,dn.elements[2]*=c,dn.elements[4]*=h,dn.elements[5]*=h,dn.elements[6]*=h,dn.elements[8]*=d,dn.elements[9]*=d,dn.elements[10]*=d,t.setFromRotationMatrix(dn),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=gn,l=!1){let c=this.elements,h=2*s/(t-e),d=2*s/(i-r),u=(t+e)/(t-e),p=(i+r)/(i-r),m,x;if(l)m=s/(a-s),x=a*s/(a-s);else if(o===gn)m=-(a+s)/(a-s),x=-2*a*s/(a-s);else if(o===Ki)m=-a/(a-s),x=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=u,c[12]=0,c[1]=0,c[5]=d,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=gn,l=!1){let c=this.elements,h=2/(t-e),d=2/(i-r),u=-(t+e)/(t-e),p=-(i+r)/(i-r),m,x;if(l)m=1/(a-s),x=a/(a-s);else if(o===gn)m=-2/(a-s),x=-(a+s)/(a-s);else if(o===Ki)m=-1/(a-s),x=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=u,c[1]=0,c[5]=d,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=m,c[14]=x,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};qa.prototype.isMatrix4=!0;var ct=qa,ki=new U,dn=new ct,hg=new U(0,0,0),ug=new U(1,1,1),Qn=new U,Us=new U,Jt=new U,Jh=new ct,Kh=new en,Xn=class n{constructor(e=0,t=0,i=0,r=n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],d=r[2],u=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ge(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ge(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ge(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ge(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:Ie("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Jh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Jh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Kh.setFromEuler(this),this.setFromQuaternion(Kh,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Xn.DEFAULT_ORDER="XYZ";var nr=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},fg=0,Qh=new U,zi=new en,Bn=new ct,Os=new U,Tr=new U,dg=new U,pg=new en,eu=new U(1,0,0),tu=new U(0,1,0),nu=new U(0,0,1),iu={type:"added"},mg={type:"removed"},Vi={type:"childadded",child:null},gl={type:"childremoved",child:null},Ut=class n extends _n{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:fg++}),this.uuid=pr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let e=new U,t=new Xn,i=new en,r=new U(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ct},normalMatrix:{value:new Be}}),this.matrix=new ct,this.matrixWorld=new ct,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new nr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return zi.setFromAxisAngle(e,t),this.quaternion.multiply(zi),this}rotateOnWorldAxis(e,t){return zi.setFromAxisAngle(e,t),this.quaternion.premultiply(zi),this}rotateX(e){return this.rotateOnAxis(eu,e)}rotateY(e){return this.rotateOnAxis(tu,e)}rotateZ(e){return this.rotateOnAxis(nu,e)}translateOnAxis(e,t){return Qh.copy(e).applyQuaternion(this.quaternion),this.position.add(Qh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(eu,e)}translateY(e){return this.translateOnAxis(tu,e)}translateZ(e){return this.translateOnAxis(nu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Os.copy(e):Os.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),Tr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bn.lookAt(Tr,Os,this.up):Bn.lookAt(Os,Tr,this.up),this.quaternion.setFromRotationMatrix(Bn),r&&(Bn.extractRotation(r.matrixWorld),zi.setFromRotationMatrix(Bn),this.quaternion.premultiply(zi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Le("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(iu),Vi.child=e,this.dispatchEvent(Vi),Vi.child=null):Le("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(mg),gl.child=e,this.dispatchEvent(gl),gl.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Bn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Bn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(iu),Vi.child=e,this.dispatchEvent(Vi),Vi.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Tr,e,dg),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Tr,pg,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e===!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)),t===!0){let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){let d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){let l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){let o=a(e.geometries),l=a(e.materials),c=a(e.textures),h=a(e.images),d=a(e.shapes),u=a(e.skeletons),p=a(e.animations),m=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),d.length>0&&(i.shapes=d),u.length>0&&(i.skeletons=u),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function a(o){let l=[];for(let c in o){let h=o[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let r=e.children[i];this.add(r.clone())}return this}};Ut.DEFAULT_UP=new U(0,1,0);Ut.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Rn=class extends Ut{constructor(){super(),this.isGroup=!0,this.type="Group"}},gg={type:"move"},ir=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Rn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Rn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Rn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null,o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(let x of e.hand.values()){let g=t.getJointPose(x,i),f=this._getHandJoint(c,x);g!==null&&(f.matrix.fromArray(g.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=g.radius),f.visible=g!==null}let h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],u=h.position.distanceTo(d.position),p=.02,m=.005;c.inputState.pinching&&u>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(gg)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let i=new Rn;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},nf={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},ei={h:0,s:0,l:0},Fs={h:0,s:0,l:0};function _l(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}var Xe=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Qt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$e.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=$e.workingColorSpace){return this.r=e,this.g=t,this.b=i,$e.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=$e.workingColorSpace){if(e=gc(e,1),t=Ge(t,0,1),i=Ge(i,0,1),t===0)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=_l(a,s,e+1/3),this.g=_l(a,s,e),this.b=_l(a,s,e-1/3)}return $e.colorSpaceToWorking(this,r),this}setStyle(e,t=Qt){function i(s){s!==void 0&&parseFloat(s)<1&&Ie("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ie("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ie("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Qt){let i=nf[e.toLowerCase()];return i!==void 0?this.setHex(i,t):Ie("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Hn(e.r),this.g=Hn(e.g),this.b=Hn(e.b),this}copyLinearToSRGB(e){return this.r=Ji(e.r),this.g=Ji(e.g),this.b=Ji(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Qt){return $e.workingToColorSpace(Lt.copy(this),e),Math.round(Ge(Lt.r*255,0,255))*65536+Math.round(Ge(Lt.g*255,0,255))*256+Math.round(Ge(Lt.b*255,0,255))}getHexString(e=Qt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$e.workingColorSpace){$e.workingToColorSpace(Lt.copy(this),t);let i=Lt.r,r=Lt.g,s=Lt.b,a=Math.max(i,r,s),o=Math.min(i,r,s),l,c,h=(o+a)/2;if(o===a)l=0,c=0;else{let d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case i:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-i)/d+2;break;case s:l=(i-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=$e.workingColorSpace){return $e.workingToColorSpace(Lt.copy(this),t),e.r=Lt.r,e.g=Lt.g,e.b=Lt.b,e}getStyle(e=Qt){$e.workingToColorSpace(Lt.copy(this),e);let t=Lt.r,i=Lt.g,r=Lt.b;return e!==Qt?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(ei),this.setHSL(ei.h+e,ei.s+t,ei.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ei),e.getHSL(Fs);let i=Ir(ei.h,Fs.h,t),r=Ir(ei.s,Fs.s,t),s=Ir(ei.l,Fs.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Lt=new Xe;Xe.NAMES=nf;var kr=class extends Ut{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 Xn,this.environmentIntensity=1,this.environmentRotation=new Xn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},pn=new U,kn=new U,xl=new U,zn=new U,Gi=new U,Hi=new U,ru=new U,vl=new U,yl=new U,bl=new U,Ml=new pt,Sl=new pt,wl=new pt,si=class n{constructor(e=new U,t=new U,i=new U){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),pn.subVectors(e,t),r.cross(pn);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){pn.subVectors(r,t),kn.subVectors(i,t),xl.subVectors(e,t);let a=pn.dot(pn),o=pn.dot(kn),l=pn.dot(xl),c=kn.dot(kn),h=kn.dot(xl),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;let u=1/d,p=(c*l-o*h)*u,m=(a*h-o*l)*u;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,zn)===null?!1:zn.x>=0&&zn.y>=0&&zn.x+zn.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,zn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,zn.x),l.addScaledVector(a,zn.y),l.addScaledVector(o,zn.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Ml.setScalar(0),Sl.setScalar(0),wl.setScalar(0),Ml.fromBufferAttribute(e,t),Sl.fromBufferAttribute(e,i),wl.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ml,s.x),a.addScaledVector(Sl,s.y),a.addScaledVector(wl,s.z),a}static isFrontFacing(e,t,i,r){return pn.subVectors(i,t),kn.subVectors(e,t),pn.cross(kn).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return pn.subVectors(this.c,this.b),kn.subVectors(this.a,this.b),pn.cross(kn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return n.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return n.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return n.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return n.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return n.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,r=this.b,s=this.c,a,o;Gi.subVectors(r,i),Hi.subVectors(s,i),vl.subVectors(e,i);let l=Gi.dot(vl),c=Hi.dot(vl);if(l<=0&&c<=0)return t.copy(i);yl.subVectors(e,r);let h=Gi.dot(yl),d=Hi.dot(yl);if(h>=0&&d<=h)return t.copy(r);let u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(i).addScaledVector(Gi,a);bl.subVectors(e,s);let p=Gi.dot(bl),m=Hi.dot(bl);if(m>=0&&p<=m)return t.copy(s);let x=p*c-l*m;if(x<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(Hi,o);let g=h*m-p*d;if(g<=0&&d-h>=0&&p-m>=0)return ru.subVectors(s,r),o=(d-h)/(d-h+(p-m)),t.copy(r).addScaledVector(ru,o);let f=1/(g+x+u);return a=x*f,o=u*f,t.copy(i).addScaledVector(Gi,a).addScaledVector(Hi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},In=class{constructor(e=new U(1/0,1/0,1/0),t=new U(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(mn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(mn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=mn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,mn):mn.fromBufferAttribute(s,a),mn.applyMatrix4(e.matrixWorld),this.expandByPoint(mn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Bs.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Bs.copy(i.boundingBox)),Bs.applyMatrix4(e.matrixWorld),this.union(Bs)}let r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,mn),mn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ar),ks.subVectors(this.max,Ar),Wi.subVectors(e.a,Ar),Xi.subVectors(e.b,Ar),qi.subVectors(e.c,Ar),ti.subVectors(Xi,Wi),ni.subVectors(qi,Xi),bi.subVectors(Wi,qi);let t=[0,-ti.z,ti.y,0,-ni.z,ni.y,0,-bi.z,bi.y,ti.z,0,-ti.x,ni.z,0,-ni.x,bi.z,0,-bi.x,-ti.y,ti.x,0,-ni.y,ni.x,0,-bi.y,bi.x,0];return!Tl(t,Wi,Xi,qi,ks)||(t=[1,0,0,0,1,0,0,0,1],!Tl(t,Wi,Xi,qi,ks))?!1:(zs.crossVectors(ti,ni),t=[zs.x,zs.y,zs.z],Tl(t,Wi,Xi,qi,ks))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,mn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(mn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Vn=[new U,new U,new U,new U,new U,new U,new U,new U],mn=new U,Bs=new In,Wi=new U,Xi=new U,qi=new U,ti=new U,ni=new U,bi=new U,Ar=new U,ks=new U,zs=new U,Mi=new U;function Tl(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Mi.fromArray(n,s);let o=r.x*Math.abs(Mi.x)+r.y*Math.abs(Mi.y)+r.z*Math.abs(Mi.z),l=e.dot(Mi),c=t.dot(Mi),h=i.dot(Mi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}var bt=new U,Vs=new Te,_g=0,zt=class extends _n{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:_g++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Hl,this.updateRanges=[],this.gpuType=yn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix3(e),this.setXY(t,Vs.x,Vs.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.applyMatrix3(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.applyMatrix4(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.applyNormalMatrix(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)bt.fromBufferAttribute(this,t),bt.transformDirection(e),this.setXYZ(t,bt.x,bt.y,bt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Zi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=kt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Zi(t,this.array)),t}setX(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zi(t,this.array)),t}setY(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zi(t,this.array)),t}setW(e,t){return this.normalized&&(t=kt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),i=kt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),i=kt(i,this.array),r=kt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=kt(t,this.array),i=kt(i,this.array),r=kt(r,this.array),s=kt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Hl&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var zr=class extends zt{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var Vr=class extends zt{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var _t=class extends zt{constructor(e,t,i){super(new Float32Array(e),t,i)}},xg=new In,Er=new U,Al=new U,Ci=class{constructor(e=new U,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):xg.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Er.subVectors(e,this.center);let t=Er.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Er,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Al.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Er.copy(e.center).add(Al)),this.expandByPoint(Er.copy(e.center).sub(Al))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},vg=0,on=new ct,El=new Ut,Yi=new U,Kt=new In,Cr=new In,At=new U,Ot=class n extends _n{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:vg++}),this.uuid=pr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Hm(e)?Vr:zr)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new Be().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return on.makeRotationFromQuaternion(e),this.applyMatrix4(on),this}rotateX(e){return on.makeRotationX(e),this.applyMatrix4(on),this}rotateY(e){return on.makeRotationY(e),this.applyMatrix4(on),this}rotateZ(e){return on.makeRotationZ(e),this.applyMatrix4(on),this}translate(e,t,i){return on.makeTranslation(e,t,i),this.applyMatrix4(on),this}scale(e,t,i){return on.makeScale(e,t,i),this.applyMatrix4(on),this}lookAt(e){return El.lookAt(e),El.updateMatrix(),this.applyMatrix4(El.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Yi).negate(),this.translate(Yi.x,Yi.y,Yi.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let i=[];for(let r=0,s=e.length;r<s;r++){let a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new _t(i,3))}else{let i=Math.min(e.length,t.count);for(let r=0;r<i;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Ie("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new In);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){let s=t[i];Kt.setFromBufferAttribute(s),this.morphTargetsRelative?(At.addVectors(this.boundingBox.min,Kt.min),this.boundingBox.expandByPoint(At),At.addVectors(this.boundingBox.max,Kt.max),this.boundingBox.expandByPoint(At)):(this.boundingBox.expandByPoint(Kt.min),this.boundingBox.expandByPoint(Kt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Le('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 Ci);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Le("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){let i=this.boundingSphere.center;if(Kt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){let o=t[s];Cr.setFromBufferAttribute(o),this.morphTargetsRelative?(At.addVectors(Kt.min,Cr.min),Kt.expandByPoint(At),At.addVectors(Kt.max,Cr.max),Kt.expandByPoint(At)):(Kt.expandByPoint(Cr.min),Kt.expandByPoint(Cr.max))}Kt.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)At.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(At));if(t)for(let s=0,a=t.length;s<a;s++){let o=t[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)At.fromBufferAttribute(o,c),l&&(Yi.fromBufferAttribute(e,c),At.add(Yi)),r=Math.max(r,i.distanceToSquared(At))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Le('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Le("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new zt(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),o=[],l=[];for(let _=0;_<i.count;_++)o[_]=new U,l[_]=new U;let c=new U,h=new U,d=new U,u=new Te,p=new Te,m=new Te,x=new U,g=new U;function f(_,C,D){c.fromBufferAttribute(i,_),h.fromBufferAttribute(i,C),d.fromBufferAttribute(i,D),u.fromBufferAttribute(s,_),p.fromBufferAttribute(s,C),m.fromBufferAttribute(s,D),h.sub(c),d.sub(c),p.sub(u),m.sub(u);let P=1/(p.x*m.y-m.x*p.y);isFinite(P)&&(x.copy(h).multiplyScalar(m.y).addScaledVector(d,-p.y).multiplyScalar(P),g.copy(d).multiplyScalar(p.x).addScaledVector(h,-m.x).multiplyScalar(P),o[_].add(x),o[C].add(x),o[D].add(x),l[_].add(g),l[C].add(g),l[D].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let _=0,C=v.length;_<C;++_){let D=v[_],P=D.start,N=D.count;for(let V=P,I=P+N;V<I;V+=3)f(e.getX(V+0),e.getX(V+1),e.getX(V+2))}let M=new U,S=new U,w=new U,y=new U;function A(_){w.fromBufferAttribute(r,_),y.copy(w);let C=o[_];M.copy(C),M.sub(w.multiplyScalar(w.dot(C))).normalize(),S.crossVectors(y,C);let P=S.dot(l[_])<0?-1:1;a.setXYZW(_,M.x,M.y,M.z,P)}for(let _=0,C=v.length;_<C;++_){let D=v[_],P=D.start,N=D.count;for(let V=P,I=P+N;V<I;V+=3)A(e.getX(V+0)),A(e.getX(V+1)),A(e.getX(V+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new zt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let u=0,p=i.count;u<p;u++)i.setXYZ(u,0,0,0);let r=new U,s=new U,a=new U,o=new U,l=new U,c=new U,h=new U,d=new U;if(e)for(let u=0,p=e.count;u<p;u+=3){let m=e.getX(u+0),x=e.getX(u+1),g=e.getX(u+2);r.fromBufferAttribute(t,m),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,g),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(i,m),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,g),o.add(h),l.add(h),c.add(h),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let u=0,p=t.count;u<p;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),i.setXYZ(u+0,h.x,h.y,h.z),i.setXYZ(u+1,h.x,h.y,h.z),i.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)At.fromBufferAttribute(e,t),At.normalize(),e.setXYZ(t,At.x,At.y,At.z)}toNonIndexed(){function e(o,l){let c=o.array,h=o.itemSize,d=o.normalized,u=new c.constructor(l.length*h),p=0,m=0;for(let x=0,g=l.length;x<g;x++){o.isInterleavedBufferAttribute?p=l[x]*o.data.stride+o.offset:p=l[x]*h;for(let f=0;f<h;f++)u[m++]=c[p++]}return new zt(u,h,d)}if(this.index===null)return Ie("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new n,i=this.index.array,r=this.attributes;for(let o in r){let l=r[o],c=e(l,i);t.setAttribute(o,c)}let s=this.morphAttributes;for(let o in s){let l=[],c=s[o];for(let h=0,d=c.length;h<d;h++){let u=c[h],p=e(u,i);l.push(p)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,l=a.length;o<l;o++){let c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let l in i){let c=i[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d<u;d++){let p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(r[l]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone());let r=e.attributes;for(let c in r){let h=r[c];this.setAttribute(c,h.clone(t))}let s=e.morphAttributes;for(let c in s){let h=[],d=s[c];for(let u=0,p=d.length;u<p;u++)h.push(d[u].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let c=0,h=a.length;c<h;c++){let d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var yg=0,qn=class extends _n{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yg++}),this.uuid=pr(),this.name="",this.type="Material",this.blending=Ai,this.side=Wn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ra,this.blendDst=sa,this.blendEquation=ai,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xe(0,0,0),this.blendAlpha=0,this.depthFunc=Ei,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Gl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ti,this.stencilZFail=Ti,this.stencilZPass=Ti,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.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){Ie(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Ie(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.7,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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),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(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.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(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ai&&(i.blending=this.blending),this.side!==Wn&&(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!==ra&&(i.blendSrc=this.blendSrc),this.blendDst!==sa&&(i.blendDst=this.blendDst),this.blendEquation!==ai&&(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!==Ei&&(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!==Gl&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ti&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ti&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ti&&(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.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){let a=[];for(let o in s){let l=s[o];delete l.metadata,a.push(l)}return a}if(t){let s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var Gn=new U,Cl=new U,Gs=new U,ii=new U,Rl=new U,Hs=new U,Pl=new U,oi=class{constructor(e=new U,t=new U(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Gn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Gn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gn.copy(this.origin).addScaledVector(this.direction,t),Gn.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Cl.copy(e).add(t).multiplyScalar(.5),Gs.copy(t).sub(e).normalize(),ii.copy(this.origin).sub(Cl);let s=e.distanceTo(t)*.5,a=-this.direction.dot(Gs),o=ii.dot(this.direction),l=-ii.dot(Gs),c=ii.lengthSq(),h=Math.abs(1-a*a),d,u,p,m;if(h>0)if(d=a*l-o,u=a*o-l,m=s*h,d>=0)if(u>=-m)if(u<=m){let x=1/h;d*=x,u*=x,p=d*(d+a*u+2*o)+u*(a*d+u+2*l)+c}else u=s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u=-s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u<=-m?(d=Math.max(0,-(-a*s+o)),u=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c):u<=m?(d=0,u=Math.min(Math.max(-s,-l),s),p=u*(u+2*l)+c):(d=Math.max(0,-(a*s+o)),u=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c);else u=a>0?-s:s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Cl).addScaledVector(Gs,u),p}intersectSphere(e,t){Gn.subVectors(e.center,this.origin);let i=Gn.dot(this.direction),r=Gn.dot(Gn)-i*i,s=e.radius*e.radius;if(r>s)return null;let a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l,c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),h>=0?(s=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-u.z)*d,l=(e.max.z-u.z)*d):(o=(e.max.z-u.z)*d,l=(e.min.z-u.z)*d),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Gn)!==null}intersectTriangle(e,t,i,r,s){Rl.subVectors(t,e),Hs.subVectors(i,e),Pl.crossVectors(Rl,Hs);let a=this.direction.dot(Pl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ii.subVectors(this.origin,e);let l=o*this.direction.dot(Hs.crossVectors(ii,Hs));if(l<0)return null;let c=o*this.direction.dot(Rl.cross(ii));if(c<0||l+c>a)return null;let h=-o*ii.dot(Pl);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Gr=class extends qn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(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 Xn,this.combine=Ya,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},su=new ct,Si=new oi,Ws=new Ci,au=new U,Xs=new U,qs=new U,Ys=new U,Il=new U,$s=new U,ou=new U,js=new U,Xt=class extends Ut{constructor(e=new Ot,t=new Gr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){let o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(s&&o){$s.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let h=o[l],d=s[l];h!==0&&(Il.fromBufferAttribute(d,e),a?$s.addScaledVector(Il,h):$s.addScaledVector(Il.sub(t),h))}t.add($s)}return t}raycast(e,t){let i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ws.copy(i.boundingSphere),Ws.applyMatrix4(s),Si.copy(e.ray).recast(e.near),!(Ws.containsPoint(Si.origin)===!1&&(Si.intersectSphere(Ws,au)===null||Si.origin.distanceToSquared(au)>(e.far-e.near)**2))&&(su.copy(s).invert(),Si.copy(e.ray).applyMatrix4(su),!(i.boundingBox!==null&&Si.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Si)))}_computeIntersections(e,t,i){let r,s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,u=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,x=u.length;m<x;m++){let g=u[m],f=a[g.materialIndex],v=Math.max(g.start,p.start),M=Math.min(o.count,Math.min(g.start+g.count,p.start+p.count));for(let S=v,w=M;S<w;S+=3){let y=o.getX(S),A=o.getX(S+1),_=o.getX(S+2);r=Zs(this,f,e,i,c,h,d,y,A,_),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let m=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){let v=o.getX(g),M=o.getX(g+1),S=o.getX(g+2);r=Zs(this,a,e,i,c,h,d,v,M,S),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,x=u.length;m<x;m++){let g=u[m],f=a[g.materialIndex],v=Math.max(g.start,p.start),M=Math.min(l.count,Math.min(g.start+g.count,p.start+p.count));for(let S=v,w=M;S<w;S+=3){let y=S,A=S+1,_=S+2;r=Zs(this,f,e,i,c,h,d,y,A,_),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=g.materialIndex,t.push(r))}}else{let m=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let g=m,f=x;g<f;g+=3){let v=g,M=g+1,S=g+2;r=Zs(this,a,e,i,c,h,d,v,M,S),r&&(r.faceIndex=Math.floor(g/3),t.push(r))}}}};function bg(n,e,t,i,r,s,a,o){let l;if(e.side===Vt?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===Wn,o),l===null)return null;js.copy(o),js.applyMatrix4(n.matrixWorld);let c=t.ray.origin.distanceTo(js);return c<t.near||c>t.far?null:{distance:c,point:js.clone(),object:n}}function Zs(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Xs),n.getVertexPosition(l,qs),n.getVertexPosition(c,Ys);let h=bg(n,e,t,i,Xs,qs,Ys,ou);if(h){let d=new U;si.getBarycoord(ou,Xs,qs,Ys,d),r&&(h.uv=si.getInterpolatedAttribute(r,o,l,c,d,new Te)),s&&(h.uv1=si.getInterpolatedAttribute(s,o,l,c,d,new Te)),a&&(h.normal=si.getInterpolatedAttribute(a,o,l,c,d,new U),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));let u={a:o,b:l,c,normal:new U,materialIndex:0};si.getNormal(Xs,qs,Ys,u.normal),h.face=u,h.barycoord=d}return h}var ya=class extends Wt{constructor(e=null,t=1,i=1,r,s,a,o,l,c=Et,h=Et,d,u){super(null,a,o,l,c,h,r,s,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Dl=new U,Mg=new U,Sg=new Be,ln=class{constructor(e=new U(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let r=Dl.subVectors(i,t).cross(Mg.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,i=!0){let r=e.delta(Dl),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||Sg.getNormalMatrix(e),r=this.coplanarPoint(Dl).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},wi=new Ci,wg=new Te(.5,.5),Js=new U,rr=class{constructor(e=new ln,t=new ln,i=new ln,r=new ln,s=new ln,a=new ln){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=gn,i=!1){let r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],d=s[5],u=s[6],p=s[7],m=s[8],x=s[9],g=s[10],f=s[11],v=s[12],M=s[13],S=s[14],w=s[15];if(r[0].setComponents(c-a,p-h,f-m,w-v).normalize(),r[1].setComponents(c+a,p+h,f+m,w+v).normalize(),r[2].setComponents(c+o,p+d,f+x,w+M).normalize(),r[3].setComponents(c-o,p-d,f-x,w-M).normalize(),i)r[4].setComponents(l,u,g,S).normalize(),r[5].setComponents(c-l,p-u,f-g,w-S).normalize();else if(r[4].setComponents(c-l,p-u,f-g,w-S).normalize(),t===gn)r[5].setComponents(c+l,p+u,f+g,w+S).normalize();else if(t===Ki)r[5].setComponents(l,u,g,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),wi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),wi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(wi)}intersectsSprite(e){wi.center.set(0,0,0);let t=wg.distanceTo(e.center);return wi.radius=.7071067811865476+t,wi.applyMatrix4(e.matrixWorld),this.intersectsSphere(wi)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(Js.x=r.normal.x>0?e.max.x:e.min.x,Js.y=r.normal.y>0?e.max.y:e.min.y,Js.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Js)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};var sr=class extends qn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Xe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},ba=new U,Ma=new U,lu=new ct,Rr=new oi,Ks=new Ci,Ll=new U,cu=new U,Hr=class extends Ut{constructor(e=new Ot,t=new sr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)ba.fromBufferAttribute(t,r-1),Ma.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=ba.distanceTo(Ma);e.setAttribute("lineDistance",new _t(i,1))}else Ie("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ks.copy(i.boundingSphere),Ks.applyMatrix4(r),Ks.radius+=s,e.ray.intersectsSphere(Ks)===!1)return;lu.copy(r).invert(),Rr.copy(e.ray).applyMatrix4(lu);let o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=i.index,u=i.attributes.position;if(h!==null){let p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let x=p,g=m-1;x<g;x+=c){let f=h.getX(x),v=h.getX(x+1),M=Qs(this,e,Rr,l,f,v,x);M&&t.push(M)}if(this.isLineLoop){let x=h.getX(m-1),g=h.getX(p),f=Qs(this,e,Rr,l,x,g,m-1);f&&t.push(f)}}else{let p=Math.max(0,a.start),m=Math.min(u.count,a.start+a.count);for(let x=p,g=m-1;x<g;x+=c){let f=Qs(this,e,Rr,l,x,x+1,x);f&&t.push(f)}if(this.isLineLoop){let x=Qs(this,e,Rr,l,m-1,p,m-1);x&&t.push(x)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){let o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}};function Qs(n,e,t,i,r,s,a){let o=n.geometry.attributes.position;if(ba.fromBufferAttribute(o,r),Ma.fromBufferAttribute(o,s),t.distanceSqToSegment(ba,Ma,Ll,cu)>i)return;Ll.applyMatrix4(n.matrixWorld);let c=e.ray.origin.distanceTo(Ll);if(!(c<e.near||c>e.far))return{distance:c,point:cu.clone().applyMatrix4(n.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:n}}var Wr=class extends Wt{constructor(e=[],t=di,i,r,s,a,o,l,c,h){super(e,t,i,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Yn=class extends Wt{constructor(e,t,i=vn,r,s,a,o=Et,l=Et,c,h=Pn,d=1){if(h!==Pn&&h!==mi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let u={width:e,height:t,depth:d};super(u,r,s,a,o,l,h,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new tr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Sa=class extends Yn{constructor(e,t=vn,i=di,r,s,a=Et,o=Et,l,c=Pn){let h={width:e,height:e,depth:1},d=[h,h,h,h,h,h];super(e,e,t,i,r,s,a,o,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Xr=class extends Wt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},ar=class n extends Ot{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};let o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);let l=[],c=[],h=[],d=[],u=0,p=0;m("z","y","x",-1,-1,i,t,e,a,s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new _t(c,3)),this.setAttribute("normal",new _t(h,3)),this.setAttribute("uv",new _t(d,2));function m(x,g,f,v,M,S,w,y,A,_,C){let D=S/A,P=w/_,N=S/2,V=w/2,I=y/2,R=A+1,L=_+1,k=0,ee=0,ne=new U;for(let he=0;he<L;he++){let q=he*P-V;for(let J=0;J<R;J++){let fe=J*D-N;ne[x]=fe*v,ne[g]=q*M,ne[f]=I,c.push(ne.x,ne.y,ne.z),ne[x]=0,ne[g]=0,ne[f]=y>0?1:-1,h.push(ne.x,ne.y,ne.z),d.push(J/A),d.push(1-he/_),k+=1}}for(let he=0;he<_;he++)for(let q=0;q<A;q++){let J=u+q+R*he,fe=u+q+R*(he+1),De=u+(q+1)+R*(he+1),Y=u+(q+1)+R*he;l.push(J,fe,Y),l.push(fe,De,Y),ee+=6}o.addGroup(p,ee,C),p+=ee,u+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var or=class n extends Ot{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let h=[],d=[],u=[],p=[],m=0,x=[],g=i/2,f=0;v(),a===!1&&(e>0&&M(!0),t>0&&M(!1)),this.setIndex(h),this.setAttribute("position",new _t(d,3)),this.setAttribute("normal",new _t(u,3)),this.setAttribute("uv",new _t(p,2));function v(){let S=new U,w=new U,y=0,A=(t-e)/i;for(let _=0;_<=s;_++){let C=[],D=_/s,P=D*(t-e)+e;for(let N=0;N<=r;N++){let V=N/r,I=V*l+o,R=Math.sin(I),L=Math.cos(I);w.x=P*R,w.y=-D*i+g,w.z=P*L,d.push(w.x,w.y,w.z),S.set(R,A,L).normalize(),u.push(S.x,S.y,S.z),p.push(V,1-D),C.push(m++)}x.push(C)}for(let _=0;_<r;_++)for(let C=0;C<s;C++){let D=x[C][_],P=x[C+1][_],N=x[C+1][_+1],V=x[C][_+1];(e>0||C!==0)&&(h.push(D,P,V),y+=3),(t>0||C!==s-1)&&(h.push(P,N,V),y+=3)}c.addGroup(f,y,0),f+=y}function M(S){let w=m,y=new Te,A=new U,_=0,C=S===!0?e:t,D=S===!0?1:-1;for(let N=1;N<=r;N++)d.push(0,g*D,0),u.push(0,D,0),p.push(.5,.5),m++;let P=m;for(let N=0;N<=r;N++){let I=N/r*l+o,R=Math.cos(I),L=Math.sin(I);A.x=C*L,A.y=g*D,A.z=C*R,d.push(A.x,A.y,A.z),u.push(0,D,0),y.x=R*.5+.5,y.y=L*.5*D+.5,p.push(y.x,y.y),m++}for(let N=0;N<r;N++){let V=w+N,I=P+N;S===!0?h.push(I,I+1,V):h.push(I+1,I,V),_+=3}c.addGroup(f,_,S===!0?1:2),f+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},qr=class n extends or{constructor(e=1,t=1,i=32,r=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,i,r,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var cn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Ie("Curve: .getPoint() not implemented.")}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let i=this.getLengths(),r=0,s=i.length,a;t?a=t:a=e*i[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=i[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===a)return r/(s-1);let h=i[r],u=i[r+1]-h,p=(a-h)/u;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new Te:new U);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){let i=new U,r=[],s=[],a=[],o=new U,l=new ct;for(let p=0;p<=e;p++){let m=p/e;r[p]=this.getTangentAt(m,new U)}s[0]=new U,a[0]=new U;let c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=c&&(c=h,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),u<=c&&i.set(0,0,1),o.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();let m=Math.acos(Ge(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,m))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(Ge(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),a[m].crossVectors(r[m],s[m])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Yr=class extends cn{constructor(e=0,t=0,i=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new Te){let i=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);let o=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),u=l-this.aX,p=c-this.aY;l=u*h-p*d+this.aX,c=u*d+p*h+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},wa=class extends Yr{constructor(e,t,i,r,s,a){super(e,t,i,i,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}};function xc(){let n=0,e=0,t=0,i=0;function r(s,a,o,l){n=s,e=o,t=-3*s+3*a-2*o-l,i=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,d){let u=(a-s)/c-(o-s)/(c+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;u*=h,p*=h,r(a,o,u,p)},calc:function(s){let a=s*s,o=a*s;return n+e*s+t*a+i*o}}}var hu=new U,uu=new U,Nl=new xc,Ul=new xc,Ol=new xc,Ta=class extends cn{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new U){let i=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e,o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=r[(o-1)%s]:(uu.subVectors(r[0],r[1]).add(r[0]),c=uu);let d=r[o%s],u=r[(o+1)%s];if(this.closed||o+2<s?h=r[(o+2)%s]:(hu.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=hu),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,m=Math.pow(c.distanceToSquared(d),p),x=Math.pow(d.distanceToSquared(u),p),g=Math.pow(u.distanceToSquared(h),p);x<1e-4&&(x=1),m<1e-4&&(m=x),g<1e-4&&(g=x),Nl.initNonuniformCatmullRom(c.x,d.x,u.x,h.x,m,x,g),Ul.initNonuniformCatmullRom(c.y,d.y,u.y,h.y,m,x,g),Ol.initNonuniformCatmullRom(c.z,d.z,u.z,h.z,m,x,g)}else this.curveType==="catmullrom"&&(Nl.initCatmullRom(c.x,d.x,u.x,h.x,this.tension),Ul.initCatmullRom(c.y,d.y,u.y,h.y,this.tension),Ol.initCatmullRom(c.z,d.z,u.z,h.z,this.tension));return i.set(Nl.calc(l),Ul.calc(l),Ol.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new U().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function fu(n,e,t,i,r){let s=(i-e)*.5,a=(r-t)*.5,o=n*n,l=n*o;return(2*t-2*i+s+a)*l+(-3*t+3*i-2*s-a)*o+s*n+t}function Tg(n,e){let t=1-n;return t*t*e}function Ag(n,e){return 2*(1-n)*n*e}function Eg(n,e){return n*n*e}function Dr(n,e,t,i){return Tg(n,e)+Ag(n,t)+Eg(n,i)}function Cg(n,e){let t=1-n;return t*t*t*e}function Rg(n,e){let t=1-n;return 3*t*t*n*e}function Pg(n,e){return 3*(1-n)*n*n*e}function Ig(n,e){return n*n*n*e}function Lr(n,e,t,i,r){return Cg(n,e)+Rg(n,t)+Pg(n,i)+Ig(n,r)}var Aa=class extends cn{constructor(e=new Te,t=new Te,i=new Te,r=new Te){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Te){let i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(Lr(e,r.x,s.x,a.x,o.x),Lr(e,r.y,s.y,a.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},lr=class extends cn{constructor(e=new U,t=new U,i=new U,r=new U){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(Lr(e,r.x,s.x,a.x,o.x),Lr(e,r.y,s.y,a.y,o.y),Lr(e,r.z,s.z,a.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Ea=class extends cn{constructor(e=new Te,t=new Te){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Te){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Te){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ca=class extends cn{constructor(e=new U,t=new U){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new U){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ra=class extends cn{constructor(e=new Te,t=new Te,i=new Te){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Te){let i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Dr(e,r.x,s.x,a.x),Dr(e,r.y,s.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ri=class extends cn{constructor(e=new U,t=new U,i=new U){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new U){let i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Dr(e,r.x,s.x,a.x),Dr(e,r.y,s.y,a.y),Dr(e,r.z,s.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Pa=class extends cn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Te){let i=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],h=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return i.set(fu(o,l.x,c.x,h.x,d.x),fu(o,l.y,c.y,h.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new Te().fromArray(r))}return this}},Dg=Object.freeze({__proto__:null,ArcCurve:wa,CatmullRomCurve3:Ta,CubicBezierCurve:Aa,CubicBezierCurve3:lr,EllipseCurve:Yr,LineCurve:Ea,LineCurve3:Ca,QuadraticBezierCurve:Ra,QuadraticBezierCurve3:Ri,SplineCurve:Pa});var $r=class n extends Ot{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};let s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,h=l+1,d=e/o,u=t/l,p=[],m=[],x=[],g=[];for(let f=0;f<h;f++){let v=f*u-a;for(let M=0;M<c;M++){let S=M*d-s;m.push(S,-v,0),x.push(0,0,1),g.push(M/o),g.push(1-f/l)}}for(let f=0;f<l;f++)for(let v=0;v<o;v++){let M=v+c*f,S=v+c*(f+1),w=v+1+c*(f+1),y=v+1+c*f;p.push(M,S,y),p.push(S,w,y)}this.setIndex(p),this.setAttribute("position",new _t(m,3)),this.setAttribute("normal",new _t(x,3)),this.setAttribute("uv",new _t(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}};var jr=class n extends Ot{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let l=Math.min(a+o,Math.PI),c=0,h=[],d=new U,u=new U,p=[],m=[],x=[],g=[];for(let f=0;f<=i;f++){let v=[],M=f/i,S=0;f===0&&a===0?S=.5/t:f===i&&l===Math.PI&&(S=-.5/t);for(let w=0;w<=t;w++){let y=w/t;d.x=-e*Math.cos(r+y*s)*Math.sin(a+M*o),d.y=e*Math.cos(a+M*o),d.z=e*Math.sin(r+y*s)*Math.sin(a+M*o),m.push(d.x,d.y,d.z),u.copy(d).normalize(),x.push(u.x,u.y,u.z),g.push(y+S,1-M),v.push(c++)}h.push(v)}for(let f=0;f<i;f++)for(let v=0;v<t;v++){let M=h[f][v+1],S=h[f][v],w=h[f+1][v],y=h[f+1][v+1];(f!==0||a>0)&&p.push(M,S,y),(f!==i-1||l<Math.PI)&&p.push(S,w,y)}this.setIndex(p),this.setAttribute("position",new _t(m,3)),this.setAttribute("normal",new _t(x,3)),this.setAttribute("uv",new _t(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Zr=class n extends Ot{constructor(e=new Ri(new U(-1,-1,0),new U(-1,1,0),new U(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};let a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let o=new U,l=new U,c=new Te,h=new U,d=[],u=[],p=[],m=[];x(),this.setIndex(m),this.setAttribute("position",new _t(d,3)),this.setAttribute("normal",new _t(u,3)),this.setAttribute("uv",new _t(p,2));function x(){for(let M=0;M<t;M++)g(M);g(s===!1?t:0),v(),f()}function g(M){h=e.getPointAt(M/t,h);let S=a.normals[M],w=a.binormals[M];for(let y=0;y<=r;y++){let A=y/r*Math.PI*2,_=Math.sin(A),C=-Math.cos(A);l.x=C*S.x+_*w.x,l.y=C*S.y+_*w.y,l.z=C*S.z+_*w.z,l.normalize(),u.push(l.x,l.y,l.z),o.x=h.x+i*l.x,o.y=h.y+i*l.y,o.z=h.z+i*l.z,d.push(o.x,o.y,o.z)}}function f(){for(let M=1;M<=t;M++)for(let S=1;S<=r;S++){let w=(r+1)*(M-1)+(S-1),y=(r+1)*M+(S-1),A=(r+1)*M+S,_=(r+1)*(M-1)+S;m.push(w,y,_),m.push(y,A,_)}}function v(){for(let M=0;M<=t;M++)for(let S=0;S<=r;S++)c.x=M/t,c.y=S/r,p.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new n(new Dg[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}};function Ii(n){let e={};for(let t in n){e[t]={};for(let i in n[t]){let r=n[t][i];if(du(r))r.isRenderTargetTexture?(Ie("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone();else if(Array.isArray(r))if(du(r[0])){let s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[t][i]=s}else e[t][i]=r.slice();else e[t][i]=r}}return e}function Ft(n){let e={};for(let t=0;t<n.length;t++){let i=Ii(n[t]);for(let r in i)e[r]=i[r]}return e}function du(n){return n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)}function Lg(n){let e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function vc(n){let e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:$e.workingColorSpace}var rf={clone:Ii,merge:Ft},Ng=`void main() {
|
|
501
501
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
502
|
-
}`,
|
|
502
|
+
}`,Ug=`void main() {
|
|
503
503
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
504
|
-
}`,nn=class extends qn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Cg,this.fragmentShader=Rg,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,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ii(e.uniforms),this.uniformsGroups=Eg(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},Ia=class extends nn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};var Jr=class extends qn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=No,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.combine=Ya,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Da=class extends qn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Hu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},La=class extends qn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function ea(n,e){return!n||n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}var li=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],s=t[i-1];n:{e:{let a;t:{i:if(!(e<r)){for(let o=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(s=r,r=t[++i],e<r)break e}a=t.length;break t}if(!(e>=s)){let o=t[1];e<o&&(i=2,s=o);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break e}a=i,i=0;break t}break n}for(;i<a;){let o=i+a>>>1;e<t[o]?a=o:i=o+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=i[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Na=class extends li{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:kl,endingEnd:kl}}intervalChanged_(e,t,i){let r=this.parameterPositions,s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case zl:s=e,o=2*t-i;break;case Vl:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case zl:a=e,l=2*i-t;break;case Vl:a=1,l=i+r[1]-r[0];break;default:a=e-1,l=t}let c=(i-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-i),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,d=this._offsetNext,u=this._weightPrev,p=this._weightNext,m=(i-t)/(r-t),x=m*m,g=x*m,f=-u*g+2*u*x-u*m,v=(1+u)*g+(-1.5-2*u)*x+(-.5+u)*m+1,M=(-1-p)*g+(1.5+p)*x+.5*m,S=p*g-p*x;for(let w=0;w!==o;++w)s[w]=f*a[h+w]+v*a[c+w]+M*a[l+w]+S*a[d+w];return s}},Ua=class extends li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(i-t)/(r-t),d=1-h;for(let u=0;u!==o;++u)s[u]=a[c+u]*d+a[l+u]*h;return s}},Fa=class extends li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},Oa=class extends li{interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this.settings||this.DefaultSettings_,d=h.inTangents,u=h.outTangents;if(!d||!u){let x=(i-t)/(r-t),g=1-x;for(let f=0;f!==o;++f)s[f]=a[c+f]*g+a[l+f]*x;return s}let p=o*2,m=e-1;for(let x=0;x!==o;++x){let g=a[c+x],f=a[l+x],v=m*p+x*2,M=u[v],S=u[v+1],w=e*p+x*2,y=d[w],A=d[w+1],_=(i-t)/(r-t),C,D,P,N,V;for(let I=0;I<8;I++){C=_*_,D=C*_,P=1-_,N=P*P,V=N*P;let L=V*t+3*N*_*M+3*P*C*y+D*r-i;if(Math.abs(L)<1e-10)break;let k=3*N*(M-t)+6*P*_*(y-M)+3*C*(r-y);if(Math.abs(k)<1e-10)break;_=_-L/k,_=Math.max(0,Math.min(1,_))}s[x]=V*g+3*N*_*S+3*P*C*A+D*f}return s}},rn=class{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ea(t,this.TimeBufferType),this.values=ea(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:ea(e.times,Array),values:ea(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Fa(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ua(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Na(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Oa(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Nr:t=this.InterpolantFactoryMethodDiscrete;break;case ma:t=this.InterpolantFactoryMethodLinear;break;case ia:t=this.InterpolantFactoryMethodSmooth;break;case Bl:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return Ie("KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Nr;case this.InterpolantFactoryMethodLinear:return ma;case this.InterpolantFactoryMethodSmooth:return ia;case this.InterpolantFactoryMethodBezier:return Bl}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,s=0,a=r-1;for(;s!==r&&i[s]<e;)++s;for(;a!==-1&&i[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);let o=this.getValueSize();this.times=i.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Le("KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,s=i.length;s===0&&(Le("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){let l=i[o];if(typeof l=="number"&&isNaN(l)){Le("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Le("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&Bm(r))for(let o=0,l=r.length;o!==l;++o){let c=r[o];if(isNaN(c)){Le("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===ia,s=e.length-1,a=1;for(let o=1;o<s;++o){let l=!1,c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(r)l=!0;else{let d=o*i,u=d-i,p=d+i;for(let m=0;m!==i;++m){let x=t[d+m];if(x!==t[u+m]||x!==t[p+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];let d=o*i,u=a*i;for(let p=0;p!==i;++p)t[u+p]=t[d+p]}++a}}if(s>0){e[a]=e[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};rn.prototype.ValueTypeName="";rn.prototype.TimeBufferType=Float32Array;rn.prototype.ValueBufferType=Float32Array;rn.prototype.DefaultInterpolation=ma;var ci=class extends rn{constructor(e,t,i){super(e,t,i)}};ci.prototype.ValueTypeName="bool";ci.prototype.ValueBufferType=Array;ci.prototype.DefaultInterpolation=Nr;ci.prototype.InterpolantFactoryMethodLinear=void 0;ci.prototype.InterpolantFactoryMethodSmooth=void 0;var Ba=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}};Ba.prototype.ValueTypeName="color";var ka=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}};ka.prototype.ValueTypeName="number";var za=class extends li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(r-t),c=e*o;for(let h=c+o;c!==h;c+=4)en.slerpFlat(s,0,a,c-o,a,c,l);return s}},Kr=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}InterpolantFactoryMethodLinear(e){return new za(this.times,this.values,this.getValueSize(),e)}};Kr.prototype.ValueTypeName="quaternion";Kr.prototype.InterpolantFactoryMethodSmooth=void 0;var hi=class extends rn{constructor(e,t,i){super(e,t,i)}};hi.prototype.ValueTypeName="string";hi.prototype.ValueBufferType=Array;hi.prototype.DefaultInterpolation=Nr;hi.prototype.InterpolantFactoryMethodLinear=void 0;hi.prototype.InterpolantFactoryMethodSmooth=void 0;var Va=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}};Va.prototype.ValueTypeName="vector";var Ga=class{constructor(e,t,i){let r=this,s=!1,a=0,o=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){let d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,u=c.length;d<u;d+=2){let p=c[d],m=c[d+1];if(p.global&&(p.lastIndex=0),p.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},rf=new Ga,Ha=class{constructor(e){this.manager=e!==void 0?e:rf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Ha.DEFAULT_MATERIAL_NAME="__DEFAULT";var Qr=class extends Ut{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Xe(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}};var Ol=new ct,du=new U,pu=new U,Wl=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Te(512,512),this.mapType=qt,this.map=null,this.mapPass=null,this.matrix=new ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new rr,this._frameExtents=new Te(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;du.setFromMatrixPosition(e.matrixWorld),t.position.copy(du),pu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(pu),t.updateMatrixWorld(),Ol.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ol,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Ki||t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ol)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},ta=new U,na=new en,En=new U,es=class extends Ut{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,this.coordinateSystem=gn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(ta,na,En),En.x===1&&En.y===1&&En.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ta,na,En.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(ta,na,En),En.x===1&&En.y===1&&En.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ta,na,En.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ri=new U,mu=new Te,gu=new Te,Nt=class extends es{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=er*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Pr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return er*2*Math.atan(Math.tan(Pr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){ri.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ri.x,ri.y).multiplyScalar(-e/ri.z),ri.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ri.x,ri.y).multiplyScalar(-e/ri.z)}getViewSize(e,t){return this.getViewBounds(e,mu,gu),t.subVectors(gu,mu)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Pr*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}let o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};var cr=class extends es{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Xl=class extends Wl{constructor(){super(new cr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},ts=class extends Qr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ut.DEFAULT_UP),this.updateMatrix(),this.target=new Ut,this.shadow=new Xl}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},ns=class extends Qr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var $i=-90,ji=1,Wa=class extends Ut{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Nt($i,ji,e,t);r.layers=this.layers,this.add(r);let s=new Nt($i,ji,e,t);s.layers=this.layers,this.add(s);let a=new Nt($i,ji,e,t);a.layers=this.layers,this.add(a);let o=new Nt($i,ji,e,t);o.layers=this.layers,this.add(o);let l=new Nt($i,ji,e,t);l.layers=this.layers,this.add(l);let c=new Nt($i,ji,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(let c of t)this.remove(c);if(e===gn)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Ki)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,a,o,l,c,h]=this.children,d=e.getRenderTarget(),u=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;let x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(i,0,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,1,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,3,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,4,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(d,u,p),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}},Xa=class extends Nt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}};var yc="\\[\\]\\.:\\/",Pg=new RegExp("["+yc+"]","g"),bc="[^"+yc+"]",Ig="[^"+yc.replace("\\.","")+"]",Dg=/((?:WC+[\/:])*)/.source.replace("WC",bc),Lg=/(WCOD+)?/.source.replace("WCOD",Ig),Ng=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bc),Ug=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bc),Fg=new RegExp("^"+Dg+Lg+Ng+Ug+"$"),Og=["material","materials","bones","map"],ql=class{constructor(e,t,i){let r=i||ft.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},ft=class n{constructor(e,t,i){this.path=t,this.parsedPath=i||n.parseTrackName(t),this.node=n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new n.Composite(e,t,i):new n(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Pg,"")}static parseTrackName(e){let t=Fg.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=i.nodeName.substring(r+1);Og.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(s){for(let a=0;a<s.length;a++){let o=s[a];if(o.name===t||o.uuid===t)return o;let l=i(o.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=n.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Ie("PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Le("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Le("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Le("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){Le("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){Le("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let a=e[r];if(a===void 0){let c=t.nodeName;Le("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ft.Composite=ql;ft.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ft.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ft.prototype.GetterByBindingType=[ft.prototype._getValue_direct,ft.prototype._getValue_array,ft.prototype._getValue_arrayElement,ft.prototype._getValue_toArray];ft.prototype.SetterByBindingTypeAndVersioning=[[ft.prototype._setValue_direct,ft.prototype._setValue_direct_setNeedsUpdate,ft.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ft.prototype._setValue_array,ft.prototype._setValue_array_setNeedsUpdate,ft.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ft.prototype._setValue_arrayElement,ft.prototype._setValue_arrayElement_setNeedsUpdate,ft.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ft.prototype._setValue_fromArray,ft.prototype._setValue_fromArray_setNeedsUpdate,ft.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var CS=new Float32Array(1);var _u=new ct,is=class{constructor(e,t,i=0,r=1/0){this.ray=new oi(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new nr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Le("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return _u.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_u),this}intersectObject(e,t=!0,i=[]){return Yl(e,this,i,t),i.sort(xu),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Yl(e[r],this,i,t);return i.sort(xu),i}};function xu(n,e){return n.distance-e.distance}function Yl(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){let s=n.children;for(let a=0,o=s.length;a<o;a++)Yl(s[a],e,t,!0)}}var hr=class{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ge(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Ge(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var Ec=class Ec{constructor(e,t,i,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}};Ec.prototype.isMatrix2=!0;var $l=Ec;var rs=class extends _n{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Ie("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Mc(n,e,t,i){let r=Bg(i);switch(t){case uc:return n*e;case dc:return n*e/r.components*r.byteLength;case eo:return n*e/r.components*r.byteLength;case gi:return n*e*2/r.components*r.byteLength;case to:return n*e*2/r.components*r.byteLength;case fc:return n*e*3/r.components*r.byteLength;case hn:return n*e*4/r.components*r.byteLength;case no:return n*e*4/r.components*r.byteLength;case ls:case cs:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case hs:case us:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case ro:case ao:return Math.max(n,16)*Math.max(e,8)/4;case io:case so:return Math.max(n,8)*Math.max(e,8)/2;case oo:case lo:case ho:case uo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case co:case fs:case fo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case po:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case mo:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case go:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case _o:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case xo:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case vo:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case yo:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case bo:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Mo:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case So:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case wo:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case To:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Ao:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Eo:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Co:case Ro:case Po:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Io:case Do:return Math.ceil(n/4)*Math.ceil(e/4)*8;case ds:case Lo:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Bg(n){switch(n){case qt:case oc:return{byteLength:1,components:1};case fr:case lc:case Nn:return{byteLength:2,components:1};case Ka:case Qa:return{byteLength:2,components:4};case vn:case Ja:case yn:return{byteLength:4,components:1};case cc:case hc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?Ie("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");function Ef(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&n!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function zg(n){let e=new WeakMap;function t(o,l){let c=o.array,h=o.usage,d=c.byteLength,u=n.createBuffer();n.bindBuffer(l,u),n.bufferData(l,c,h),o.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:u,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function i(o,l,c){let h=l.array,d=l.updateRanges;if(n.bindBuffer(c,o),d.length===0)n.bufferSubData(c,0,h);else{d.sort((p,m)=>p.start-m.start);let u=0;for(let p=1;p<d.length;p++){let m=d[u],x=d[p];x.start<=m.start+m.count+1?m.count=Math.max(m.count,x.start+x.count-m.start):(++u,d[u]=x)}d.length=u+1;for(let p=0,m=d.length;p<m;p++){let x=d[p];n.bufferSubData(c,x.start*h.BYTES_PER_ELEMENT,h,x.start,x.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);let l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Vg=`#ifdef USE_ALPHAHASH
|
|
504
|
+
}`,nn=class extends qn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Ng,this.fragmentShader=Ug,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,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ii(e.uniforms),this.uniformsGroups=Lg(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},Ia=class extends nn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};var Jr=class extends qn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=No,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Xn,this.combine=Ya,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Da=class extends qn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Wu,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},La=class extends qn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function ea(n,e){return!n||n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}var li=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],s=t[i-1];n:{e:{let a;t:{i:if(!(e<r)){for(let o=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(s=r,r=t[++i],e<r)break e}a=t.length;break t}if(!(e>=s)){let o=t[1];e<o&&(i=2,s=o);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break e}a=i,i=0;break t}break n}for(;i<a;){let o=i+a>>>1;e<t[o]?a=o:i=o+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=i[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Na=class extends li{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:kl,endingEnd:kl}}intervalChanged_(e,t,i){let r=this.parameterPositions,s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case zl:s=e,o=2*t-i;break;case Vl:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case zl:a=e,l=2*i-t;break;case Vl:a=1,l=i+r[1]-r[0];break;default:a=e-1,l=t}let c=(i-t)*.5,h=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-i),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this._offsetPrev,d=this._offsetNext,u=this._weightPrev,p=this._weightNext,m=(i-t)/(r-t),x=m*m,g=x*m,f=-u*g+2*u*x-u*m,v=(1+u)*g+(-1.5-2*u)*x+(-.5+u)*m+1,M=(-1-p)*g+(1.5+p)*x+.5*m,S=p*g-p*x;for(let w=0;w!==o;++w)s[w]=f*a[h+w]+v*a[c+w]+M*a[l+w]+S*a[d+w];return s}},Ua=class extends li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=(i-t)/(r-t),d=1-h;for(let u=0;u!==o;++u)s[u]=a[c+u]*d+a[l+u]*h;return s}},Oa=class extends li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},Fa=class extends li{interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this.settings||this.DefaultSettings_,d=h.inTangents,u=h.outTangents;if(!d||!u){let x=(i-t)/(r-t),g=1-x;for(let f=0;f!==o;++f)s[f]=a[c+f]*g+a[l+f]*x;return s}let p=o*2,m=e-1;for(let x=0;x!==o;++x){let g=a[c+x],f=a[l+x],v=m*p+x*2,M=u[v],S=u[v+1],w=e*p+x*2,y=d[w],A=d[w+1],_=(i-t)/(r-t),C,D,P,N,V;for(let I=0;I<8;I++){C=_*_,D=C*_,P=1-_,N=P*P,V=N*P;let L=V*t+3*N*_*M+3*P*C*y+D*r-i;if(Math.abs(L)<1e-10)break;let k=3*N*(M-t)+6*P*_*(y-M)+3*C*(r-y);if(Math.abs(k)<1e-10)break;_=_-L/k,_=Math.max(0,Math.min(1,_))}s[x]=V*g+3*N*_*S+3*P*C*A+D*f}return s}},rn=class{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ea(t,this.TimeBufferType),this.values=ea(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:ea(e.times,Array),values:ea(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Oa(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Ua(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Na(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Fa(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Nr:t=this.InterpolantFactoryMethodDiscrete;break;case ma:t=this.InterpolantFactoryMethodLinear;break;case ia:t=this.InterpolantFactoryMethodSmooth;break;case Bl:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return Ie("KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Nr;case this.InterpolantFactoryMethodLinear:return ma;case this.InterpolantFactoryMethodSmooth:return ia;case this.InterpolantFactoryMethodBezier:return Bl}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,s=0,a=r-1;for(;s!==r&&i[s]<e;)++s;for(;a!==-1&&i[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);let o=this.getValueSize();this.times=i.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Le("KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,s=i.length;s===0&&(Le("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){let l=i[o];if(typeof l=="number"&&isNaN(l)){Le("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Le("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&Wm(r))for(let o=0,l=r.length;o!==l;++o){let c=r[o];if(isNaN(c)){Le("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===ia,s=e.length-1,a=1;for(let o=1;o<s;++o){let l=!1,c=e[o],h=e[o+1];if(c!==h&&(o!==1||c!==e[0]))if(r)l=!0;else{let d=o*i,u=d-i,p=d+i;for(let m=0;m!==i;++m){let x=t[d+m];if(x!==t[u+m]||x!==t[p+m]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];let d=o*i,u=a*i;for(let p=0;p!==i;++p)t[u+p]=t[d+p]}++a}}if(s>0){e[a]=e[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};rn.prototype.ValueTypeName="";rn.prototype.TimeBufferType=Float32Array;rn.prototype.ValueBufferType=Float32Array;rn.prototype.DefaultInterpolation=ma;var ci=class extends rn{constructor(e,t,i){super(e,t,i)}};ci.prototype.ValueTypeName="bool";ci.prototype.ValueBufferType=Array;ci.prototype.DefaultInterpolation=Nr;ci.prototype.InterpolantFactoryMethodLinear=void 0;ci.prototype.InterpolantFactoryMethodSmooth=void 0;var Ba=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}};Ba.prototype.ValueTypeName="color";var ka=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}};ka.prototype.ValueTypeName="number";var za=class extends li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(r-t),c=e*o;for(let h=c+o;c!==h;c+=4)en.slerpFlat(s,0,a,c-o,a,c,l);return s}},Kr=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}InterpolantFactoryMethodLinear(e){return new za(this.times,this.values,this.getValueSize(),e)}};Kr.prototype.ValueTypeName="quaternion";Kr.prototype.InterpolantFactoryMethodSmooth=void 0;var hi=class extends rn{constructor(e,t,i){super(e,t,i)}};hi.prototype.ValueTypeName="string";hi.prototype.ValueBufferType=Array;hi.prototype.DefaultInterpolation=Nr;hi.prototype.InterpolantFactoryMethodLinear=void 0;hi.prototype.InterpolantFactoryMethodSmooth=void 0;var Va=class extends rn{constructor(e,t,i,r){super(e,t,i,r)}};Va.prototype.ValueTypeName="vector";var Ga=class{constructor(e,t,i){let r=this,s=!1,a=0,o=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(h){o++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,o),a===o&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,d){return c.push(h,d),this},this.removeHandler=function(h){let d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,u=c.length;d<u;d+=2){let p=c[d],m=c[d+1];if(p.global&&(p.lastIndex=0),p.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},sf=new Ga,Ha=class{constructor(e){this.manager=e!==void 0?e:sf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Ha.DEFAULT_MATERIAL_NAME="__DEFAULT";var Qr=class extends Ut{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Xe(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}};var Fl=new ct,pu=new U,mu=new U,Wl=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Te(512,512),this.mapType=qt,this.map=null,this.mapPass=null,this.matrix=new ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new rr,this._frameExtents=new Te(1,1),this._viewportCount=1,this._viewports=[new pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;pu.setFromMatrixPosition(e.matrixWorld),t.position.copy(pu),mu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(mu),t.updateMatrixWorld(),Fl.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Fl,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Ki||t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Fl)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},ta=new U,na=new en,En=new U,es=class extends Ut{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,this.coordinateSystem=gn,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(ta,na,En),En.x===1&&En.y===1&&En.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ta,na,En.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(ta,na,En),En.x===1&&En.y===1&&En.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(ta,na,En.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ri=new U,gu=new Te,_u=new Te,Nt=class extends es{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=er*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Pr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return er*2*Math.atan(Math.tan(Pr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){ri.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ri.x,ri.y).multiplyScalar(-e/ri.z),ri.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ri.x,ri.y).multiplyScalar(-e/ri.z)}getViewSize(e,t){return this.getViewBounds(e,gu,_u),t.subVectors(_u,gu)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Pr*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}let o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};var cr=class extends es{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Xl=class extends Wl{constructor(){super(new cr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},ts=class extends Qr{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ut.DEFAULT_UP),this.updateMatrix(),this.target=new Ut,this.shadow=new Xl}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},ns=class extends Qr{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};var $i=-90,ji=1,Wa=class extends Ut{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Nt($i,ji,e,t);r.layers=this.layers,this.add(r);let s=new Nt($i,ji,e,t);s.layers=this.layers,this.add(s);let a=new Nt($i,ji,e,t);a.layers=this.layers,this.add(a);let o=new Nt($i,ji,e,t);o.layers=this.layers,this.add(o);let l=new Nt($i,ji,e,t);l.layers=this.layers,this.add(l);let c=new Nt($i,ji,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(let c of t)this.remove(c);if(e===gn)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Ki)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,a,o,l,c,h]=this.children,d=e.getRenderTarget(),u=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;let x=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(i,0,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,1,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,3,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,4,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),i.texture.generateMipmaps=x,e.setRenderTarget(i,5,r),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(d,u,p),e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}},Xa=class extends Nt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}};var yc="\\[\\]\\.:\\/",Og=new RegExp("["+yc+"]","g"),bc="[^"+yc+"]",Fg="[^"+yc.replace("\\.","")+"]",Bg=/((?:WC+[\/:])*)/.source.replace("WC",bc),kg=/(WCOD+)?/.source.replace("WCOD",Fg),zg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bc),Vg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bc),Gg=new RegExp("^"+Bg+kg+zg+Vg+"$"),Hg=["material","materials","bones","map"],ql=class{constructor(e,t,i){let r=i||ft.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},ft=class n{constructor(e,t,i){this.path=t,this.parsedPath=i||n.parseTrackName(t),this.node=n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new n.Composite(e,t,i):new n(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Og,"")}static parseTrackName(e){let t=Gg.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=i.nodeName.substring(r+1);Hg.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(s){for(let a=0;a<s.length;a++){let o=s[a];if(o.name===t||o.uuid===t)return o;let l=i(o.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=n.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Ie("PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Le("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Le("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===c){c=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Le("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Le("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){Le("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){Le("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let a=e[r];if(a===void 0){let c=t.nodeName;Le("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Le("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ft.Composite=ql;ft.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ft.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ft.prototype.GetterByBindingType=[ft.prototype._getValue_direct,ft.prototype._getValue_array,ft.prototype._getValue_arrayElement,ft.prototype._getValue_toArray];ft.prototype.SetterByBindingTypeAndVersioning=[[ft.prototype._setValue_direct,ft.prototype._setValue_direct_setNeedsUpdate,ft.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ft.prototype._setValue_array,ft.prototype._setValue_array_setNeedsUpdate,ft.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ft.prototype._setValue_arrayElement,ft.prototype._setValue_arrayElement_setNeedsUpdate,ft.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ft.prototype._setValue_fromArray,ft.prototype._setValue_fromArray_setNeedsUpdate,ft.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var DS=new Float32Array(1);var xu=new ct,is=class{constructor(e,t,i=0,r=1/0){this.ray=new oi(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new nr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Le("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return xu.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(xu),this}intersectObject(e,t=!0,i=[]){return Yl(e,this,i,t),i.sort(vu),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Yl(e[r],this,i,t);return i.sort(vu),i}};function vu(n,e){return n.distance-e.distance}function Yl(n,e,t,i){let r=!0;if(n.layers.test(e.layers)&&n.raycast(e,t)===!1&&(r=!1),r===!0&&i===!0){let s=n.children;for(let a=0,o=s.length;a<o;a++)Yl(s[a],e,t,!0)}}var hr=class{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Ge(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Ge(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var Ec=class Ec{constructor(e,t,i,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=r,this}};Ec.prototype.isMatrix2=!0;var $l=Ec;var rs=class extends _n{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Ie("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Mc(n,e,t,i){let r=Wg(i);switch(t){case uc:return n*e;case dc:return n*e/r.components*r.byteLength;case eo:return n*e/r.components*r.byteLength;case gi:return n*e*2/r.components*r.byteLength;case to:return n*e*2/r.components*r.byteLength;case fc:return n*e*3/r.components*r.byteLength;case hn:return n*e*4/r.components*r.byteLength;case no:return n*e*4/r.components*r.byteLength;case ls:case cs:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case hs:case us:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case ro:case ao:return Math.max(n,16)*Math.max(e,8)/4;case io:case so:return Math.max(n,8)*Math.max(e,8)/2;case oo:case lo:case ho:case uo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case co:case fs:case fo:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case po:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case mo:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case go:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case _o:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case xo:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case vo:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case yo:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case bo:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Mo:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case So:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case wo:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case To:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case Ao:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Eo:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Co:case Ro:case Po:return Math.ceil(n/4)*Math.ceil(e/4)*16;case Io:case Do:return Math.ceil(n/4)*Math.ceil(e/4)*8;case ds:case Lo:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Wg(n){switch(n){case qt:case oc:return{byteLength:1,components:1};case fr:case lc:case Nn:return{byteLength:2,components:1};case Ka:case Qa:return{byteLength:2,components:4};case vn:case Ja:case yn:return{byteLength:4,components:1};case cc:case hc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?Ie("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");function Cf(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&n!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n!==null&&n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function qg(n){let e=new WeakMap;function t(o,l){let c=o.array,h=o.usage,d=c.byteLength,u=n.createBuffer();n.bindBuffer(l,u),n.bufferData(l,c,h),o.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:u,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function i(o,l,c){let h=l.array,d=l.updateRanges;if(n.bindBuffer(c,o),d.length===0)n.bufferSubData(c,0,h);else{d.sort((p,m)=>p.start-m.start);let u=0;for(let p=1;p<d.length;p++){let m=d[u],x=d[p];x.start<=m.start+m.count+1?m.count=Math.max(m.count,x.start+x.count-m.start):(++u,d[u]=x)}d.length=u+1;for(let p=0,m=d.length;p<m;p++){let x=d[p];n.bufferSubData(c,x.start*h.BYTES_PER_ELEMENT,h,x.start,x.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);let l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var Yg=`#ifdef USE_ALPHAHASH
|
|
505
505
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
506
|
-
#endif
|
|
506
|
+
#endif`,$g=`#ifdef USE_ALPHAHASH
|
|
507
507
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
508
508
|
float hash2D( vec2 value ) {
|
|
509
509
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -538,20 +538,20 @@ function InsertStackElement(node, body) {
|
|
|
538
538
|
: cases.z;
|
|
539
539
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
540
540
|
}
|
|
541
|
-
#endif`,
|
|
541
|
+
#endif`,jg=`#ifdef USE_ALPHAMAP
|
|
542
542
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
543
|
-
#endif`,
|
|
543
|
+
#endif`,Zg=`#ifdef USE_ALPHAMAP
|
|
544
544
|
uniform sampler2D alphaMap;
|
|
545
|
-
#endif`,
|
|
545
|
+
#endif`,Jg=`#ifdef USE_ALPHATEST
|
|
546
546
|
#ifdef ALPHA_TO_COVERAGE
|
|
547
547
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
548
548
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
549
549
|
#else
|
|
550
550
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
551
551
|
#endif
|
|
552
|
-
#endif`,
|
|
552
|
+
#endif`,Kg=`#ifdef USE_ALPHATEST
|
|
553
553
|
uniform float alphaTest;
|
|
554
|
-
#endif`,
|
|
554
|
+
#endif`,Qg=`#ifdef USE_AOMAP
|
|
555
555
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
556
556
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
557
557
|
#if defined( USE_CLEARCOAT )
|
|
@@ -564,10 +564,10 @@ function InsertStackElement(node, body) {
|
|
|
564
564
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
565
565
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
566
566
|
#endif
|
|
567
|
-
#endif
|
|
567
|
+
#endif`,e0=`#ifdef USE_AOMAP
|
|
568
568
|
uniform sampler2D aoMap;
|
|
569
569
|
uniform float aoMapIntensity;
|
|
570
|
-
#endif`,
|
|
570
|
+
#endif`,t0=`#ifdef USE_BATCHING
|
|
571
571
|
#if ! defined( GL_ANGLE_multi_draw )
|
|
572
572
|
#define gl_DrawID _gl_DrawID
|
|
573
573
|
uniform int _gl_DrawID;
|
|
@@ -601,15 +601,15 @@ function InsertStackElement(node, body) {
|
|
|
601
601
|
int y = j / size;
|
|
602
602
|
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
|
|
603
603
|
}
|
|
604
|
-
#endif`,
|
|
604
|
+
#endif`,n0=`#ifdef USE_BATCHING
|
|
605
605
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
606
|
-
#endif`,
|
|
606
|
+
#endif`,i0=`vec3 transformed = vec3( position );
|
|
607
607
|
#ifdef USE_ALPHAHASH
|
|
608
608
|
vPosition = vec3( position );
|
|
609
|
-
#endif`,
|
|
609
|
+
#endif`,r0=`vec3 objectNormal = vec3( normal );
|
|
610
610
|
#ifdef USE_TANGENT
|
|
611
611
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
612
|
-
#endif`,
|
|
612
|
+
#endif`,s0=`float G_BlinnPhong_Implicit( ) {
|
|
613
613
|
return 0.25;
|
|
614
614
|
}
|
|
615
615
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -623,7 +623,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
623
623
|
float G = G_BlinnPhong_Implicit( );
|
|
624
624
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
625
625
|
return F * ( G * D );
|
|
626
|
-
} // validated`,
|
|
626
|
+
} // validated`,a0=`#ifdef USE_IRIDESCENCE
|
|
627
627
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
628
628
|
3.2404542, -0.9692660, 0.0556434,
|
|
629
629
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -686,7 +686,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
686
686
|
}
|
|
687
687
|
return max( I, vec3( 0.0 ) );
|
|
688
688
|
}
|
|
689
|
-
#endif`,
|
|
689
|
+
#endif`,o0=`#ifdef USE_BUMPMAP
|
|
690
690
|
uniform sampler2D bumpMap;
|
|
691
691
|
uniform float bumpScale;
|
|
692
692
|
vec2 dHdxy_fwd() {
|
|
@@ -707,7 +707,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
707
707
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
708
708
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
709
709
|
}
|
|
710
|
-
#endif`,
|
|
710
|
+
#endif`,l0=`#if NUM_CLIPPING_PLANES > 0
|
|
711
711
|
vec4 plane;
|
|
712
712
|
#ifdef ALPHA_TO_COVERAGE
|
|
713
713
|
float distanceToPlane, distanceGradient;
|
|
@@ -753,20 +753,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
753
753
|
if ( clipped ) discard;
|
|
754
754
|
#endif
|
|
755
755
|
#endif
|
|
756
|
-
#endif`,
|
|
756
|
+
#endif`,c0=`#if NUM_CLIPPING_PLANES > 0
|
|
757
757
|
varying vec3 vClipPosition;
|
|
758
758
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
759
|
-
#endif`,
|
|
759
|
+
#endif`,h0=`#if NUM_CLIPPING_PLANES > 0
|
|
760
760
|
varying vec3 vClipPosition;
|
|
761
|
-
#endif`,
|
|
761
|
+
#endif`,u0=`#if NUM_CLIPPING_PLANES > 0
|
|
762
762
|
vClipPosition = - mvPosition.xyz;
|
|
763
|
-
#endif`,
|
|
763
|
+
#endif`,f0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
764
764
|
diffuseColor *= vColor;
|
|
765
|
-
#endif`,
|
|
765
|
+
#endif`,d0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
766
766
|
varying vec4 vColor;
|
|
767
|
-
#endif`,
|
|
767
|
+
#endif`,p0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
768
768
|
varying vec4 vColor;
|
|
769
|
-
#endif`,
|
|
769
|
+
#endif`,m0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
770
770
|
vColor = vec4( 1.0 );
|
|
771
771
|
#endif
|
|
772
772
|
#ifdef USE_COLOR_ALPHA
|
|
@@ -779,7 +779,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
779
779
|
#endif
|
|
780
780
|
#ifdef USE_BATCHING_COLOR
|
|
781
781
|
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
782
|
-
#endif`,
|
|
782
|
+
#endif`,g0=`#define PI 3.141592653589793
|
|
783
783
|
#define PI2 6.283185307179586
|
|
784
784
|
#define PI_HALF 1.5707963267948966
|
|
785
785
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -846,7 +846,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
846
846
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
847
847
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
848
848
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
849
|
-
} // validated`,
|
|
849
|
+
} // validated`,_0=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
850
850
|
#define cubeUV_minMipLevel 4.0
|
|
851
851
|
#define cubeUV_minTileSize 16.0
|
|
852
852
|
float getFace( vec3 direction ) {
|
|
@@ -939,7 +939,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
939
939
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
#endif`,
|
|
942
|
+
#endif`,x0=`vec3 transformedNormal = objectNormal;
|
|
943
943
|
#ifdef USE_TANGENT
|
|
944
944
|
vec3 transformedTangent = objectTangent;
|
|
945
945
|
#endif
|
|
@@ -968,21 +968,21 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
968
968
|
#ifdef FLIP_SIDED
|
|
969
969
|
transformedTangent = - transformedTangent;
|
|
970
970
|
#endif
|
|
971
|
-
#endif`,
|
|
971
|
+
#endif`,v0=`#ifdef USE_DISPLACEMENTMAP
|
|
972
972
|
uniform sampler2D displacementMap;
|
|
973
973
|
uniform float displacementScale;
|
|
974
974
|
uniform float displacementBias;
|
|
975
|
-
#endif`,
|
|
975
|
+
#endif`,y0=`#ifdef USE_DISPLACEMENTMAP
|
|
976
976
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
977
|
-
#endif`,
|
|
977
|
+
#endif`,b0=`#ifdef USE_EMISSIVEMAP
|
|
978
978
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
979
979
|
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
980
980
|
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
981
981
|
#endif
|
|
982
982
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
983
|
-
#endif`,
|
|
983
|
+
#endif`,M0=`#ifdef USE_EMISSIVEMAP
|
|
984
984
|
uniform sampler2D emissiveMap;
|
|
985
|
-
#endif`,
|
|
985
|
+
#endif`,S0="gl_FragColor = linearToOutputTexel( gl_FragColor );",w0=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
986
986
|
return value;
|
|
987
987
|
}
|
|
988
988
|
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
@@ -990,7 +990,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
|
990
990
|
}
|
|
991
991
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
992
992
|
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
993
|
-
}`,
|
|
993
|
+
}`,T0=`#ifdef USE_ENVMAP
|
|
994
994
|
#ifdef ENV_WORLDPOS
|
|
995
995
|
vec3 cameraToFrag;
|
|
996
996
|
if ( isOrthographic ) {
|
|
@@ -1017,7 +1017,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
1017
1017
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
1018
1018
|
#endif
|
|
1019
1019
|
#endif
|
|
1020
|
-
#endif`,
|
|
1020
|
+
#endif`,A0=`#ifdef USE_ENVMAP
|
|
1021
1021
|
uniform float envMapIntensity;
|
|
1022
1022
|
uniform mat3 envMapRotation;
|
|
1023
1023
|
#ifdef ENVMAP_TYPE_CUBE
|
|
@@ -1025,7 +1025,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
1025
1025
|
#else
|
|
1026
1026
|
uniform sampler2D envMap;
|
|
1027
1027
|
#endif
|
|
1028
|
-
#endif`,
|
|
1028
|
+
#endif`,E0=`#ifdef USE_ENVMAP
|
|
1029
1029
|
uniform float reflectivity;
|
|
1030
1030
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
1031
1031
|
#define ENV_WORLDPOS
|
|
@@ -1036,7 +1036,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
1036
1036
|
#else
|
|
1037
1037
|
varying vec3 vReflect;
|
|
1038
1038
|
#endif
|
|
1039
|
-
#endif`,
|
|
1039
|
+
#endif`,C0=`#ifdef USE_ENVMAP
|
|
1040
1040
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
1041
1041
|
#define ENV_WORLDPOS
|
|
1042
1042
|
#endif
|
|
@@ -1047,7 +1047,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
1047
1047
|
varying vec3 vReflect;
|
|
1048
1048
|
uniform float refractionRatio;
|
|
1049
1049
|
#endif
|
|
1050
|
-
#endif`,
|
|
1050
|
+
#endif`,R0=`#ifdef USE_ENVMAP
|
|
1051
1051
|
#ifdef ENV_WORLDPOS
|
|
1052
1052
|
vWorldPosition = worldPosition.xyz;
|
|
1053
1053
|
#else
|
|
@@ -1064,18 +1064,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
1064
1064
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
1065
1065
|
#endif
|
|
1066
1066
|
#endif
|
|
1067
|
-
#endif`,
|
|
1067
|
+
#endif`,P0=`#ifdef USE_FOG
|
|
1068
1068
|
vFogDepth = - mvPosition.z;
|
|
1069
|
-
#endif`,
|
|
1069
|
+
#endif`,I0=`#ifdef USE_FOG
|
|
1070
1070
|
varying float vFogDepth;
|
|
1071
|
-
#endif`,
|
|
1071
|
+
#endif`,D0=`#ifdef USE_FOG
|
|
1072
1072
|
#ifdef FOG_EXP2
|
|
1073
1073
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
1074
1074
|
#else
|
|
1075
1075
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
1076
1076
|
#endif
|
|
1077
1077
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
1078
|
-
#endif`,
|
|
1078
|
+
#endif`,L0=`#ifdef USE_FOG
|
|
1079
1079
|
uniform vec3 fogColor;
|
|
1080
1080
|
varying float vFogDepth;
|
|
1081
1081
|
#ifdef FOG_EXP2
|
|
@@ -1084,7 +1084,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
1084
1084
|
uniform float fogNear;
|
|
1085
1085
|
uniform float fogFar;
|
|
1086
1086
|
#endif
|
|
1087
|
-
#endif`,
|
|
1087
|
+
#endif`,N0=`#ifdef USE_GRADIENTMAP
|
|
1088
1088
|
uniform sampler2D gradientMap;
|
|
1089
1089
|
#endif
|
|
1090
1090
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -1096,12 +1096,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
1096
1096
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
1097
1097
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
1098
1098
|
#endif
|
|
1099
|
-
}`,
|
|
1099
|
+
}`,U0=`#ifdef USE_LIGHTMAP
|
|
1100
1100
|
uniform sampler2D lightMap;
|
|
1101
1101
|
uniform float lightMapIntensity;
|
|
1102
|
-
#endif`,
|
|
1102
|
+
#endif`,O0=`LambertMaterial material;
|
|
1103
1103
|
material.diffuseColor = diffuseColor.rgb;
|
|
1104
|
-
material.specularStrength = specularStrength;`,
|
|
1104
|
+
material.specularStrength = specularStrength;`,F0=`varying vec3 vViewPosition;
|
|
1105
1105
|
struct LambertMaterial {
|
|
1106
1106
|
vec3 diffuseColor;
|
|
1107
1107
|
float specularStrength;
|
|
@@ -1115,7 +1115,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
1115
1115
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
1116
1116
|
}
|
|
1117
1117
|
#define RE_Direct RE_Direct_Lambert
|
|
1118
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
1118
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,B0=`uniform bool receiveShadow;
|
|
1119
1119
|
uniform vec3 ambientLightColor;
|
|
1120
1120
|
#if defined( USE_LIGHT_PROBES )
|
|
1121
1121
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -1232,7 +1232,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
1232
1232
|
return irradiance;
|
|
1233
1233
|
}
|
|
1234
1234
|
#endif
|
|
1235
|
-
#include <lightprobes_pars_fragment>`,
|
|
1235
|
+
#include <lightprobes_pars_fragment>`,k0=`#ifdef USE_ENVMAP
|
|
1236
1236
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
1237
1237
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
1238
1238
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
@@ -1265,8 +1265,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
1265
1265
|
#endif
|
|
1266
1266
|
}
|
|
1267
1267
|
#endif
|
|
1268
|
-
#endif`,
|
|
1269
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
1268
|
+
#endif`,z0=`ToonMaterial material;
|
|
1269
|
+
material.diffuseColor = diffuseColor.rgb;`,V0=`varying vec3 vViewPosition;
|
|
1270
1270
|
struct ToonMaterial {
|
|
1271
1271
|
vec3 diffuseColor;
|
|
1272
1272
|
};
|
|
@@ -1278,11 +1278,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
1278
1278
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
1279
1279
|
}
|
|
1280
1280
|
#define RE_Direct RE_Direct_Toon
|
|
1281
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
1281
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,G0=`BlinnPhongMaterial material;
|
|
1282
1282
|
material.diffuseColor = diffuseColor.rgb;
|
|
1283
1283
|
material.specularColor = specular;
|
|
1284
1284
|
material.specularShininess = shininess;
|
|
1285
|
-
material.specularStrength = specularStrength;`,
|
|
1285
|
+
material.specularStrength = specularStrength;`,H0=`varying vec3 vViewPosition;
|
|
1286
1286
|
struct BlinnPhongMaterial {
|
|
1287
1287
|
vec3 diffuseColor;
|
|
1288
1288
|
vec3 specularColor;
|
|
@@ -1299,7 +1299,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
1299
1299
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
1300
1300
|
}
|
|
1301
1301
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
1302
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,
|
|
1302
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,W0=`PhysicalMaterial material;
|
|
1303
1303
|
material.diffuseColor = diffuseColor.rgb;
|
|
1304
1304
|
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
1305
1305
|
material.metalness = metalnessFactor;
|
|
@@ -1389,7 +1389,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
1389
1389
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
1390
1390
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
1391
1391
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
1392
|
-
#endif`,
|
|
1392
|
+
#endif`,X0=`uniform sampler2D dfgLUT;
|
|
1393
1393
|
struct PhysicalMaterial {
|
|
1394
1394
|
vec3 diffuseColor;
|
|
1395
1395
|
vec3 diffuseContribution;
|
|
@@ -1749,7 +1749,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1749
1749
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1750
1750
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1751
1751
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1752
|
-
}`,
|
|
1752
|
+
}`,q0=`
|
|
1753
1753
|
vec3 geometryPosition = - vViewPosition;
|
|
1754
1754
|
vec3 geometryNormal = normal;
|
|
1755
1755
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1871,7 +1871,7 @@ IncidentLight directLight;
|
|
|
1871
1871
|
#if defined( RE_IndirectSpecular )
|
|
1872
1872
|
vec3 radiance = vec3( 0.0 );
|
|
1873
1873
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1874
|
-
#endif`,
|
|
1874
|
+
#endif`,Y0=`#if defined( RE_IndirectDiffuse )
|
|
1875
1875
|
#ifdef USE_LIGHTMAP
|
|
1876
1876
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1877
1877
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1892,7 +1892,7 @@ IncidentLight directLight;
|
|
|
1892
1892
|
#ifdef USE_CLEARCOAT
|
|
1893
1893
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1894
1894
|
#endif
|
|
1895
|
-
#endif
|
|
1895
|
+
#endif`,$0=`#if defined( RE_IndirectDiffuse )
|
|
1896
1896
|
#if defined( LAMBERT ) || defined( PHONG )
|
|
1897
1897
|
irradiance += iblIrradiance;
|
|
1898
1898
|
#endif
|
|
@@ -1900,7 +1900,7 @@ IncidentLight directLight;
|
|
|
1900
1900
|
#endif
|
|
1901
1901
|
#if defined( RE_IndirectSpecular )
|
|
1902
1902
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1903
|
-
#endif`,
|
|
1903
|
+
#endif`,j0=`#ifdef USE_LIGHT_PROBES_GRID
|
|
1904
1904
|
uniform highp sampler3D probesSH;
|
|
1905
1905
|
uniform vec3 probesMin;
|
|
1906
1906
|
uniform vec3 probesMax;
|
|
@@ -1945,27 +1945,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1945
1945
|
result += c8 * 0.429043 * ( x * x - y * y );
|
|
1946
1946
|
return max( result, vec3( 0.0 ) );
|
|
1947
1947
|
}
|
|
1948
|
-
#endif`,
|
|
1948
|
+
#endif`,Z0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1949
1949
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1950
|
-
#endif`,
|
|
1950
|
+
#endif`,J0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1951
1951
|
uniform float logDepthBufFC;
|
|
1952
1952
|
varying float vFragDepth;
|
|
1953
1953
|
varying float vIsPerspective;
|
|
1954
|
-
#endif`,
|
|
1954
|
+
#endif`,K0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1955
1955
|
varying float vFragDepth;
|
|
1956
1956
|
varying float vIsPerspective;
|
|
1957
|
-
#endif`,
|
|
1957
|
+
#endif`,Q0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1958
1958
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1959
1959
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1960
|
-
#endif
|
|
1960
|
+
#endif`,e_=`#ifdef USE_MAP
|
|
1961
1961
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1962
1962
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1963
1963
|
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1964
1964
|
#endif
|
|
1965
1965
|
diffuseColor *= sampledDiffuseColor;
|
|
1966
|
-
#endif`,
|
|
1966
|
+
#endif`,t_=`#ifdef USE_MAP
|
|
1967
1967
|
uniform sampler2D map;
|
|
1968
|
-
#endif`,
|
|
1968
|
+
#endif`,n_=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1969
1969
|
#if defined( USE_POINTS_UV )
|
|
1970
1970
|
vec2 uv = vUv;
|
|
1971
1971
|
#else
|
|
@@ -1977,7 +1977,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1977
1977
|
#endif
|
|
1978
1978
|
#ifdef USE_ALPHAMAP
|
|
1979
1979
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1980
|
-
#endif`,
|
|
1980
|
+
#endif`,i_=`#if defined( USE_POINTS_UV )
|
|
1981
1981
|
varying vec2 vUv;
|
|
1982
1982
|
#else
|
|
1983
1983
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1989,19 +1989,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
1989
1989
|
#endif
|
|
1990
1990
|
#ifdef USE_ALPHAMAP
|
|
1991
1991
|
uniform sampler2D alphaMap;
|
|
1992
|
-
#endif`,
|
|
1992
|
+
#endif`,r_=`float metalnessFactor = metalness;
|
|
1993
1993
|
#ifdef USE_METALNESSMAP
|
|
1994
1994
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1995
1995
|
metalnessFactor *= texelMetalness.b;
|
|
1996
|
-
#endif`,
|
|
1996
|
+
#endif`,s_=`#ifdef USE_METALNESSMAP
|
|
1997
1997
|
uniform sampler2D metalnessMap;
|
|
1998
|
-
#endif`,
|
|
1998
|
+
#endif`,a_=`#ifdef USE_INSTANCING_MORPH
|
|
1999
1999
|
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
2000
2000
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
2001
2001
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
2002
2002
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
2003
2003
|
}
|
|
2004
|
-
#endif`,
|
|
2004
|
+
#endif`,o_=`#if defined( USE_MORPHCOLORS )
|
|
2005
2005
|
vColor *= morphTargetBaseInfluence;
|
|
2006
2006
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
2007
2007
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -2010,12 +2010,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
2010
2010
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
2011
2011
|
#endif
|
|
2012
2012
|
}
|
|
2013
|
-
#endif`,
|
|
2013
|
+
#endif`,l_=`#ifdef USE_MORPHNORMALS
|
|
2014
2014
|
objectNormal *= morphTargetBaseInfluence;
|
|
2015
2015
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
2016
2016
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
2017
2017
|
}
|
|
2018
|
-
#endif`,
|
|
2018
|
+
#endif`,c_=`#ifdef USE_MORPHTARGETS
|
|
2019
2019
|
#ifndef USE_INSTANCING_MORPH
|
|
2020
2020
|
uniform float morphTargetBaseInfluence;
|
|
2021
2021
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
@@ -2029,12 +2029,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
2029
2029
|
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
2030
2030
|
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
2031
2031
|
}
|
|
2032
|
-
#endif`,
|
|
2032
|
+
#endif`,h_=`#ifdef USE_MORPHTARGETS
|
|
2033
2033
|
transformed *= morphTargetBaseInfluence;
|
|
2034
2034
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
2035
2035
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
2036
2036
|
}
|
|
2037
|
-
#endif`,
|
|
2037
|
+
#endif`,u_=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
2038
2038
|
#ifdef FLAT_SHADED
|
|
2039
2039
|
vec3 fdx = dFdx( vViewPosition );
|
|
2040
2040
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -2075,7 +2075,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
|
2075
2075
|
tbn2[1] *= faceDirection;
|
|
2076
2076
|
#endif
|
|
2077
2077
|
#endif
|
|
2078
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
2078
|
+
vec3 nonPerturbedNormal = normal;`,f_=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
2079
2079
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
2080
2080
|
#ifdef FLIP_SIDED
|
|
2081
2081
|
normal = - normal;
|
|
@@ -2093,25 +2093,25 @@ vec3 nonPerturbedNormal = normal;`,a_=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
2093
2093
|
normal = normalize( tbn * mapN );
|
|
2094
2094
|
#elif defined( USE_BUMPMAP )
|
|
2095
2095
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
2096
|
-
#endif`,
|
|
2096
|
+
#endif`,d_=`#ifndef FLAT_SHADED
|
|
2097
2097
|
varying vec3 vNormal;
|
|
2098
2098
|
#ifdef USE_TANGENT
|
|
2099
2099
|
varying vec3 vTangent;
|
|
2100
2100
|
varying vec3 vBitangent;
|
|
2101
2101
|
#endif
|
|
2102
|
-
#endif`,
|
|
2102
|
+
#endif`,p_=`#ifndef FLAT_SHADED
|
|
2103
2103
|
varying vec3 vNormal;
|
|
2104
2104
|
#ifdef USE_TANGENT
|
|
2105
2105
|
varying vec3 vTangent;
|
|
2106
2106
|
varying vec3 vBitangent;
|
|
2107
2107
|
#endif
|
|
2108
|
-
#endif`,
|
|
2108
|
+
#endif`,m_=`#ifndef FLAT_SHADED
|
|
2109
2109
|
vNormal = normalize( transformedNormal );
|
|
2110
2110
|
#ifdef USE_TANGENT
|
|
2111
2111
|
vTangent = normalize( transformedTangent );
|
|
2112
2112
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
2113
2113
|
#endif
|
|
2114
|
-
#endif`,
|
|
2114
|
+
#endif`,g_=`#ifdef USE_NORMALMAP
|
|
2115
2115
|
uniform sampler2D normalMap;
|
|
2116
2116
|
uniform vec2 normalScale;
|
|
2117
2117
|
#endif
|
|
@@ -2133,13 +2133,13 @@ vec3 nonPerturbedNormal = normal;`,a_=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
2133
2133
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
2134
2134
|
return mat3( T * scale, B * scale, N );
|
|
2135
2135
|
}
|
|
2136
|
-
#endif`,
|
|
2136
|
+
#endif`,__=`#ifdef USE_CLEARCOAT
|
|
2137
2137
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
2138
|
-
#endif`,
|
|
2138
|
+
#endif`,x_=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2139
2139
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
2140
2140
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
2141
2141
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
2142
|
-
#endif`,
|
|
2142
|
+
#endif`,v_=`#ifdef USE_CLEARCOATMAP
|
|
2143
2143
|
uniform sampler2D clearcoatMap;
|
|
2144
2144
|
#endif
|
|
2145
2145
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -2148,18 +2148,18 @@ vec3 nonPerturbedNormal = normal;`,a_=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
2148
2148
|
#endif
|
|
2149
2149
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2150
2150
|
uniform sampler2D clearcoatRoughnessMap;
|
|
2151
|
-
#endif`,
|
|
2151
|
+
#endif`,y_=`#ifdef USE_IRIDESCENCEMAP
|
|
2152
2152
|
uniform sampler2D iridescenceMap;
|
|
2153
2153
|
#endif
|
|
2154
2154
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2155
2155
|
uniform sampler2D iridescenceThicknessMap;
|
|
2156
|
-
#endif`,
|
|
2156
|
+
#endif`,b_=`#ifdef OPAQUE
|
|
2157
2157
|
diffuseColor.a = 1.0;
|
|
2158
2158
|
#endif
|
|
2159
2159
|
#ifdef USE_TRANSMISSION
|
|
2160
2160
|
diffuseColor.a *= material.transmissionAlpha;
|
|
2161
2161
|
#endif
|
|
2162
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
2162
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,M_=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
2163
2163
|
return normalize( normal ) * 0.5 + 0.5;
|
|
2164
2164
|
}
|
|
2165
2165
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -2238,9 +2238,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
2238
2238
|
#else
|
|
2239
2239
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
2240
2240
|
#endif
|
|
2241
|
-
}`,
|
|
2241
|
+
}`,S_=`#ifdef PREMULTIPLIED_ALPHA
|
|
2242
2242
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
2243
|
-
#endif`,
|
|
2243
|
+
#endif`,w_=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
2244
2244
|
#ifdef USE_BATCHING
|
|
2245
2245
|
mvPosition = batchingMatrix * mvPosition;
|
|
2246
2246
|
#endif
|
|
@@ -2248,22 +2248,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
2248
2248
|
mvPosition = instanceMatrix * mvPosition;
|
|
2249
2249
|
#endif
|
|
2250
2250
|
mvPosition = modelViewMatrix * mvPosition;
|
|
2251
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
2251
|
+
gl_Position = projectionMatrix * mvPosition;`,T_=`#ifdef DITHERING
|
|
2252
2252
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
2253
|
-
#endif`,
|
|
2253
|
+
#endif`,A_=`#ifdef DITHERING
|
|
2254
2254
|
vec3 dithering( vec3 color ) {
|
|
2255
2255
|
float grid_position = rand( gl_FragCoord.xy );
|
|
2256
2256
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
2257
2257
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
2258
2258
|
return color + dither_shift_RGB;
|
|
2259
2259
|
}
|
|
2260
|
-
#endif`,
|
|
2260
|
+
#endif`,E_=`float roughnessFactor = roughness;
|
|
2261
2261
|
#ifdef USE_ROUGHNESSMAP
|
|
2262
2262
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
2263
2263
|
roughnessFactor *= texelRoughness.g;
|
|
2264
|
-
#endif`,
|
|
2264
|
+
#endif`,C_=`#ifdef USE_ROUGHNESSMAP
|
|
2265
2265
|
uniform sampler2D roughnessMap;
|
|
2266
|
-
#endif`,
|
|
2266
|
+
#endif`,R_=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
2267
2267
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
2268
2268
|
#endif
|
|
2269
2269
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -2463,7 +2463,7 @@ gl_Position = projectionMatrix * mvPosition;`,v_=`#ifdef DITHERING
|
|
|
2463
2463
|
}
|
|
2464
2464
|
#endif
|
|
2465
2465
|
#endif
|
|
2466
|
-
#endif`,
|
|
2466
|
+
#endif`,P_=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
2467
2467
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
2468
2468
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
2469
2469
|
#endif
|
|
@@ -2504,7 +2504,7 @@ gl_Position = projectionMatrix * mvPosition;`,v_=`#ifdef DITHERING
|
|
|
2504
2504
|
};
|
|
2505
2505
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
2506
2506
|
#endif
|
|
2507
|
-
#endif`,
|
|
2507
|
+
#endif`,I_=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
2508
2508
|
#ifdef HAS_NORMAL
|
|
2509
2509
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
2510
2510
|
#else
|
|
@@ -2540,7 +2540,7 @@ gl_Position = projectionMatrix * mvPosition;`,v_=`#ifdef DITHERING
|
|
|
2540
2540
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
2541
2541
|
}
|
|
2542
2542
|
#pragma unroll_loop_end
|
|
2543
|
-
#endif`,
|
|
2543
|
+
#endif`,D_=`float getShadowMask() {
|
|
2544
2544
|
float shadow = 1.0;
|
|
2545
2545
|
#ifdef USE_SHADOWMAP
|
|
2546
2546
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -2572,12 +2572,12 @@ gl_Position = projectionMatrix * mvPosition;`,v_=`#ifdef DITHERING
|
|
|
2572
2572
|
#endif
|
|
2573
2573
|
#endif
|
|
2574
2574
|
return shadow;
|
|
2575
|
-
}`,
|
|
2575
|
+
}`,L_=`#ifdef USE_SKINNING
|
|
2576
2576
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
2577
2577
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
2578
2578
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
2579
2579
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
2580
|
-
#endif`,
|
|
2580
|
+
#endif`,N_=`#ifdef USE_SKINNING
|
|
2581
2581
|
uniform mat4 bindMatrix;
|
|
2582
2582
|
uniform mat4 bindMatrixInverse;
|
|
2583
2583
|
uniform highp sampler2D boneTexture;
|
|
@@ -2592,7 +2592,7 @@ gl_Position = projectionMatrix * mvPosition;`,v_=`#ifdef DITHERING
|
|
|
2592
2592
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2593
2593
|
return mat4( v1, v2, v3, v4 );
|
|
2594
2594
|
}
|
|
2595
|
-
#endif`,
|
|
2595
|
+
#endif`,U_=`#ifdef USE_SKINNING
|
|
2596
2596
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2597
2597
|
vec4 skinned = vec4( 0.0 );
|
|
2598
2598
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2600,7 +2600,7 @@ gl_Position = projectionMatrix * mvPosition;`,v_=`#ifdef DITHERING
|
|
|
2600
2600
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2601
2601
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2602
2602
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2603
|
-
#endif`,
|
|
2603
|
+
#endif`,O_=`#ifdef USE_SKINNING
|
|
2604
2604
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2605
2605
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2606
2606
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2611,17 +2611,17 @@ gl_Position = projectionMatrix * mvPosition;`,v_=`#ifdef DITHERING
|
|
|
2611
2611
|
#ifdef USE_TANGENT
|
|
2612
2612
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2613
2613
|
#endif
|
|
2614
|
-
#endif`,
|
|
2614
|
+
#endif`,F_=`float specularStrength;
|
|
2615
2615
|
#ifdef USE_SPECULARMAP
|
|
2616
2616
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2617
2617
|
specularStrength = texelSpecular.r;
|
|
2618
2618
|
#else
|
|
2619
2619
|
specularStrength = 1.0;
|
|
2620
|
-
#endif`,
|
|
2620
|
+
#endif`,B_=`#ifdef USE_SPECULARMAP
|
|
2621
2621
|
uniform sampler2D specularMap;
|
|
2622
|
-
#endif`,
|
|
2622
|
+
#endif`,k_=`#if defined( TONE_MAPPING )
|
|
2623
2623
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2624
|
-
#endif`,
|
|
2624
|
+
#endif`,z_=`#ifndef saturate
|
|
2625
2625
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2626
2626
|
#endif
|
|
2627
2627
|
uniform float toneMappingExposure;
|
|
@@ -2718,7 +2718,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2718
2718
|
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2719
2719
|
return mix( color, vec3( newPeak ), g );
|
|
2720
2720
|
}
|
|
2721
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2721
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,V_=`#ifdef USE_TRANSMISSION
|
|
2722
2722
|
material.transmission = transmission;
|
|
2723
2723
|
material.transmissionAlpha = 1.0;
|
|
2724
2724
|
material.thickness = thickness;
|
|
@@ -2739,7 +2739,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U_=`#ifdef USE_TRANSMISS
|
|
|
2739
2739
|
material.attenuationColor, material.attenuationDistance );
|
|
2740
2740
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2741
2741
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2742
|
-
#endif`,
|
|
2742
|
+
#endif`,G_=`#ifdef USE_TRANSMISSION
|
|
2743
2743
|
uniform float transmission;
|
|
2744
2744
|
uniform float thickness;
|
|
2745
2745
|
uniform float attenuationDistance;
|
|
@@ -2865,7 +2865,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U_=`#ifdef USE_TRANSMISS
|
|
|
2865
2865
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2866
2866
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2867
2867
|
}
|
|
2868
|
-
#endif`,
|
|
2868
|
+
#endif`,H_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2869
2869
|
varying vec2 vUv;
|
|
2870
2870
|
#endif
|
|
2871
2871
|
#ifdef USE_MAP
|
|
@@ -2935,7 +2935,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U_=`#ifdef USE_TRANSMISS
|
|
|
2935
2935
|
#ifdef USE_THICKNESSMAP
|
|
2936
2936
|
uniform mat3 thicknessMapTransform;
|
|
2937
2937
|
varying vec2 vThicknessMapUv;
|
|
2938
|
-
#endif`,
|
|
2938
|
+
#endif`,W_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2939
2939
|
varying vec2 vUv;
|
|
2940
2940
|
#endif
|
|
2941
2941
|
#ifdef USE_MAP
|
|
@@ -3029,7 +3029,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U_=`#ifdef USE_TRANSMISS
|
|
|
3029
3029
|
#ifdef USE_THICKNESSMAP
|
|
3030
3030
|
uniform mat3 thicknessMapTransform;
|
|
3031
3031
|
varying vec2 vThicknessMapUv;
|
|
3032
|
-
#endif`,
|
|
3032
|
+
#endif`,X_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
3033
3033
|
vUv = vec3( uv, 1 ).xy;
|
|
3034
3034
|
#endif
|
|
3035
3035
|
#ifdef USE_MAP
|
|
@@ -3100,7 +3100,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U_=`#ifdef USE_TRANSMISS
|
|
|
3100
3100
|
#endif
|
|
3101
3101
|
#ifdef USE_THICKNESSMAP
|
|
3102
3102
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
3103
|
-
#endif`,
|
|
3103
|
+
#endif`,q_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
3104
3104
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
3105
3105
|
#ifdef USE_BATCHING
|
|
3106
3106
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -3109,12 +3109,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U_=`#ifdef USE_TRANSMISS
|
|
|
3109
3109
|
worldPosition = instanceMatrix * worldPosition;
|
|
3110
3110
|
#endif
|
|
3111
3111
|
worldPosition = modelMatrix * worldPosition;
|
|
3112
|
-
#endif`,
|
|
3112
|
+
#endif`,Y_=`varying vec2 vUv;
|
|
3113
3113
|
uniform mat3 uvTransform;
|
|
3114
3114
|
void main() {
|
|
3115
3115
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
3116
3116
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
3117
|
-
}
|
|
3117
|
+
}`,$_=`uniform sampler2D t2D;
|
|
3118
3118
|
uniform float backgroundIntensity;
|
|
3119
3119
|
varying vec2 vUv;
|
|
3120
3120
|
void main() {
|
|
@@ -3126,14 +3126,14 @@ void main() {
|
|
|
3126
3126
|
gl_FragColor = texColor;
|
|
3127
3127
|
#include <tonemapping_fragment>
|
|
3128
3128
|
#include <colorspace_fragment>
|
|
3129
|
-
}`,
|
|
3129
|
+
}`,j_=`varying vec3 vWorldDirection;
|
|
3130
3130
|
#include <common>
|
|
3131
3131
|
void main() {
|
|
3132
3132
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
3133
3133
|
#include <begin_vertex>
|
|
3134
3134
|
#include <project_vertex>
|
|
3135
3135
|
gl_Position.z = gl_Position.w;
|
|
3136
|
-
}`,
|
|
3136
|
+
}`,Z_=`#ifdef ENVMAP_TYPE_CUBE
|
|
3137
3137
|
uniform samplerCube envMap;
|
|
3138
3138
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
3139
3139
|
uniform sampler2D envMap;
|
|
@@ -3155,14 +3155,14 @@ void main() {
|
|
|
3155
3155
|
gl_FragColor = texColor;
|
|
3156
3156
|
#include <tonemapping_fragment>
|
|
3157
3157
|
#include <colorspace_fragment>
|
|
3158
|
-
}`,
|
|
3158
|
+
}`,J_=`varying vec3 vWorldDirection;
|
|
3159
3159
|
#include <common>
|
|
3160
3160
|
void main() {
|
|
3161
3161
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
3162
3162
|
#include <begin_vertex>
|
|
3163
3163
|
#include <project_vertex>
|
|
3164
3164
|
gl_Position.z = gl_Position.w;
|
|
3165
|
-
}`,
|
|
3165
|
+
}`,K_=`uniform samplerCube tCube;
|
|
3166
3166
|
uniform float tFlip;
|
|
3167
3167
|
uniform float opacity;
|
|
3168
3168
|
varying vec3 vWorldDirection;
|
|
@@ -3172,7 +3172,7 @@ void main() {
|
|
|
3172
3172
|
gl_FragColor.a *= opacity;
|
|
3173
3173
|
#include <tonemapping_fragment>
|
|
3174
3174
|
#include <colorspace_fragment>
|
|
3175
|
-
}`,
|
|
3175
|
+
}`,Q_=`#include <common>
|
|
3176
3176
|
#include <batching_pars_vertex>
|
|
3177
3177
|
#include <uv_pars_vertex>
|
|
3178
3178
|
#include <displacementmap_pars_vertex>
|
|
@@ -3199,7 +3199,7 @@ void main() {
|
|
|
3199
3199
|
#include <logdepthbuf_vertex>
|
|
3200
3200
|
#include <clipping_planes_vertex>
|
|
3201
3201
|
vHighPrecisionZW = gl_Position.zw;
|
|
3202
|
-
}
|
|
3202
|
+
}`,ex=`#if DEPTH_PACKING == 3200
|
|
3203
3203
|
uniform float opacity;
|
|
3204
3204
|
#endif
|
|
3205
3205
|
#include <common>
|
|
@@ -3237,7 +3237,7 @@ void main() {
|
|
|
3237
3237
|
#elif DEPTH_PACKING == 3203
|
|
3238
3238
|
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
3239
3239
|
#endif
|
|
3240
|
-
}`,
|
|
3240
|
+
}`,tx=`#define DISTANCE
|
|
3241
3241
|
varying vec3 vWorldPosition;
|
|
3242
3242
|
#include <common>
|
|
3243
3243
|
#include <batching_pars_vertex>
|
|
@@ -3264,7 +3264,7 @@ void main() {
|
|
|
3264
3264
|
#include <worldpos_vertex>
|
|
3265
3265
|
#include <clipping_planes_vertex>
|
|
3266
3266
|
vWorldPosition = worldPosition.xyz;
|
|
3267
|
-
}`,
|
|
3267
|
+
}`,nx=`#define DISTANCE
|
|
3268
3268
|
uniform vec3 referencePosition;
|
|
3269
3269
|
uniform float nearDistance;
|
|
3270
3270
|
uniform float farDistance;
|
|
@@ -3287,13 +3287,13 @@ void main () {
|
|
|
3287
3287
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
3288
3288
|
dist = saturate( dist );
|
|
3289
3289
|
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
|
|
3290
|
-
}`,
|
|
3290
|
+
}`,ix=`varying vec3 vWorldDirection;
|
|
3291
3291
|
#include <common>
|
|
3292
3292
|
void main() {
|
|
3293
3293
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
3294
3294
|
#include <begin_vertex>
|
|
3295
3295
|
#include <project_vertex>
|
|
3296
|
-
}`,
|
|
3296
|
+
}`,rx=`uniform sampler2D tEquirect;
|
|
3297
3297
|
varying vec3 vWorldDirection;
|
|
3298
3298
|
#include <common>
|
|
3299
3299
|
void main() {
|
|
@@ -3302,7 +3302,7 @@ void main() {
|
|
|
3302
3302
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
3303
3303
|
#include <tonemapping_fragment>
|
|
3304
3304
|
#include <colorspace_fragment>
|
|
3305
|
-
}`,
|
|
3305
|
+
}`,sx=`uniform float scale;
|
|
3306
3306
|
attribute float lineDistance;
|
|
3307
3307
|
varying float vLineDistance;
|
|
3308
3308
|
#include <common>
|
|
@@ -3324,7 +3324,7 @@ void main() {
|
|
|
3324
3324
|
#include <logdepthbuf_vertex>
|
|
3325
3325
|
#include <clipping_planes_vertex>
|
|
3326
3326
|
#include <fog_vertex>
|
|
3327
|
-
}`,
|
|
3327
|
+
}`,ax=`uniform vec3 diffuse;
|
|
3328
3328
|
uniform float opacity;
|
|
3329
3329
|
uniform float dashSize;
|
|
3330
3330
|
uniform float totalSize;
|
|
@@ -3352,7 +3352,7 @@ void main() {
|
|
|
3352
3352
|
#include <colorspace_fragment>
|
|
3353
3353
|
#include <fog_fragment>
|
|
3354
3354
|
#include <premultiplied_alpha_fragment>
|
|
3355
|
-
}`,
|
|
3355
|
+
}`,ox=`#include <common>
|
|
3356
3356
|
#include <batching_pars_vertex>
|
|
3357
3357
|
#include <uv_pars_vertex>
|
|
3358
3358
|
#include <envmap_pars_vertex>
|
|
@@ -3384,7 +3384,7 @@ void main() {
|
|
|
3384
3384
|
#include <worldpos_vertex>
|
|
3385
3385
|
#include <envmap_vertex>
|
|
3386
3386
|
#include <fog_vertex>
|
|
3387
|
-
}`,
|
|
3387
|
+
}`,lx=`uniform vec3 diffuse;
|
|
3388
3388
|
uniform float opacity;
|
|
3389
3389
|
#ifndef FLAT_SHADED
|
|
3390
3390
|
varying vec3 vNormal;
|
|
@@ -3432,7 +3432,7 @@ void main() {
|
|
|
3432
3432
|
#include <fog_fragment>
|
|
3433
3433
|
#include <premultiplied_alpha_fragment>
|
|
3434
3434
|
#include <dithering_fragment>
|
|
3435
|
-
}`,
|
|
3435
|
+
}`,cx=`#define LAMBERT
|
|
3436
3436
|
varying vec3 vViewPosition;
|
|
3437
3437
|
#include <common>
|
|
3438
3438
|
#include <batching_pars_vertex>
|
|
@@ -3471,7 +3471,7 @@ void main() {
|
|
|
3471
3471
|
#include <envmap_vertex>
|
|
3472
3472
|
#include <shadowmap_vertex>
|
|
3473
3473
|
#include <fog_vertex>
|
|
3474
|
-
}`,
|
|
3474
|
+
}`,hx=`#define LAMBERT
|
|
3475
3475
|
uniform vec3 diffuse;
|
|
3476
3476
|
uniform vec3 emissive;
|
|
3477
3477
|
uniform float opacity;
|
|
@@ -3529,7 +3529,7 @@ void main() {
|
|
|
3529
3529
|
#include <fog_fragment>
|
|
3530
3530
|
#include <premultiplied_alpha_fragment>
|
|
3531
3531
|
#include <dithering_fragment>
|
|
3532
|
-
}`,
|
|
3532
|
+
}`,ux=`#define MATCAP
|
|
3533
3533
|
varying vec3 vViewPosition;
|
|
3534
3534
|
#include <common>
|
|
3535
3535
|
#include <batching_pars_vertex>
|
|
@@ -3563,7 +3563,7 @@ void main() {
|
|
|
3563
3563
|
#include <clipping_planes_vertex>
|
|
3564
3564
|
#include <fog_vertex>
|
|
3565
3565
|
vViewPosition = - mvPosition.xyz;
|
|
3566
|
-
}`,
|
|
3566
|
+
}`,fx=`#define MATCAP
|
|
3567
3567
|
uniform vec3 diffuse;
|
|
3568
3568
|
uniform float opacity;
|
|
3569
3569
|
uniform sampler2D matcap;
|
|
@@ -3609,7 +3609,7 @@ void main() {
|
|
|
3609
3609
|
#include <fog_fragment>
|
|
3610
3610
|
#include <premultiplied_alpha_fragment>
|
|
3611
3611
|
#include <dithering_fragment>
|
|
3612
|
-
}`,
|
|
3612
|
+
}`,dx=`#define NORMAL
|
|
3613
3613
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3614
3614
|
varying vec3 vViewPosition;
|
|
3615
3615
|
#endif
|
|
@@ -3642,7 +3642,7 @@ void main() {
|
|
|
3642
3642
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3643
3643
|
vViewPosition = - mvPosition.xyz;
|
|
3644
3644
|
#endif
|
|
3645
|
-
}`,
|
|
3645
|
+
}`,px=`#define NORMAL
|
|
3646
3646
|
uniform float opacity;
|
|
3647
3647
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3648
3648
|
varying vec3 vViewPosition;
|
|
@@ -3663,7 +3663,7 @@ void main() {
|
|
|
3663
3663
|
#ifdef OPAQUE
|
|
3664
3664
|
gl_FragColor.a = 1.0;
|
|
3665
3665
|
#endif
|
|
3666
|
-
}`,
|
|
3666
|
+
}`,mx=`#define PHONG
|
|
3667
3667
|
varying vec3 vViewPosition;
|
|
3668
3668
|
#include <common>
|
|
3669
3669
|
#include <batching_pars_vertex>
|
|
@@ -3702,7 +3702,7 @@ void main() {
|
|
|
3702
3702
|
#include <envmap_vertex>
|
|
3703
3703
|
#include <shadowmap_vertex>
|
|
3704
3704
|
#include <fog_vertex>
|
|
3705
|
-
}`,
|
|
3705
|
+
}`,gx=`#define PHONG
|
|
3706
3706
|
uniform vec3 diffuse;
|
|
3707
3707
|
uniform vec3 emissive;
|
|
3708
3708
|
uniform vec3 specular;
|
|
@@ -3762,7 +3762,7 @@ void main() {
|
|
|
3762
3762
|
#include <fog_fragment>
|
|
3763
3763
|
#include <premultiplied_alpha_fragment>
|
|
3764
3764
|
#include <dithering_fragment>
|
|
3765
|
-
}`,
|
|
3765
|
+
}`,_x=`#define STANDARD
|
|
3766
3766
|
varying vec3 vViewPosition;
|
|
3767
3767
|
#ifdef USE_TRANSMISSION
|
|
3768
3768
|
varying vec3 vWorldPosition;
|
|
@@ -3805,7 +3805,7 @@ void main() {
|
|
|
3805
3805
|
#ifdef USE_TRANSMISSION
|
|
3806
3806
|
vWorldPosition = worldPosition.xyz;
|
|
3807
3807
|
#endif
|
|
3808
|
-
}`,
|
|
3808
|
+
}`,xx=`#define STANDARD
|
|
3809
3809
|
#ifdef PHYSICAL
|
|
3810
3810
|
#define IOR
|
|
3811
3811
|
#define USE_SPECULAR
|
|
@@ -3930,7 +3930,7 @@ void main() {
|
|
|
3930
3930
|
#include <fog_fragment>
|
|
3931
3931
|
#include <premultiplied_alpha_fragment>
|
|
3932
3932
|
#include <dithering_fragment>
|
|
3933
|
-
}`,
|
|
3933
|
+
}`,vx=`#define TOON
|
|
3934
3934
|
varying vec3 vViewPosition;
|
|
3935
3935
|
#include <common>
|
|
3936
3936
|
#include <batching_pars_vertex>
|
|
@@ -3967,7 +3967,7 @@ void main() {
|
|
|
3967
3967
|
#include <worldpos_vertex>
|
|
3968
3968
|
#include <shadowmap_vertex>
|
|
3969
3969
|
#include <fog_vertex>
|
|
3970
|
-
}`,
|
|
3970
|
+
}`,yx=`#define TOON
|
|
3971
3971
|
uniform vec3 diffuse;
|
|
3972
3972
|
uniform vec3 emissive;
|
|
3973
3973
|
uniform float opacity;
|
|
@@ -4019,7 +4019,7 @@ void main() {
|
|
|
4019
4019
|
#include <fog_fragment>
|
|
4020
4020
|
#include <premultiplied_alpha_fragment>
|
|
4021
4021
|
#include <dithering_fragment>
|
|
4022
|
-
}`,
|
|
4022
|
+
}`,bx=`uniform float size;
|
|
4023
4023
|
uniform float scale;
|
|
4024
4024
|
#include <common>
|
|
4025
4025
|
#include <color_pars_vertex>
|
|
@@ -4050,7 +4050,7 @@ void main() {
|
|
|
4050
4050
|
#include <clipping_planes_vertex>
|
|
4051
4051
|
#include <worldpos_vertex>
|
|
4052
4052
|
#include <fog_vertex>
|
|
4053
|
-
}`,
|
|
4053
|
+
}`,Mx=`uniform vec3 diffuse;
|
|
4054
4054
|
uniform float opacity;
|
|
4055
4055
|
#include <common>
|
|
4056
4056
|
#include <color_pars_fragment>
|
|
@@ -4075,7 +4075,7 @@ void main() {
|
|
|
4075
4075
|
#include <colorspace_fragment>
|
|
4076
4076
|
#include <fog_fragment>
|
|
4077
4077
|
#include <premultiplied_alpha_fragment>
|
|
4078
|
-
}`,
|
|
4078
|
+
}`,Sx=`#include <common>
|
|
4079
4079
|
#include <batching_pars_vertex>
|
|
4080
4080
|
#include <fog_pars_vertex>
|
|
4081
4081
|
#include <morphtarget_pars_vertex>
|
|
@@ -4098,7 +4098,7 @@ void main() {
|
|
|
4098
4098
|
#include <worldpos_vertex>
|
|
4099
4099
|
#include <shadowmap_vertex>
|
|
4100
4100
|
#include <fog_vertex>
|
|
4101
|
-
}`,
|
|
4101
|
+
}`,wx=`uniform vec3 color;
|
|
4102
4102
|
uniform float opacity;
|
|
4103
4103
|
#include <common>
|
|
4104
4104
|
#include <fog_pars_fragment>
|
|
@@ -4114,7 +4114,7 @@ void main() {
|
|
|
4114
4114
|
#include <colorspace_fragment>
|
|
4115
4115
|
#include <fog_fragment>
|
|
4116
4116
|
#include <premultiplied_alpha_fragment>
|
|
4117
|
-
}`,
|
|
4117
|
+
}`,Tx=`uniform float rotation;
|
|
4118
4118
|
uniform vec2 center;
|
|
4119
4119
|
#include <common>
|
|
4120
4120
|
#include <uv_pars_vertex>
|
|
@@ -4138,7 +4138,7 @@ void main() {
|
|
|
4138
4138
|
#include <logdepthbuf_vertex>
|
|
4139
4139
|
#include <clipping_planes_vertex>
|
|
4140
4140
|
#include <fog_vertex>
|
|
4141
|
-
}`,
|
|
4141
|
+
}`,Ax=`uniform vec3 diffuse;
|
|
4142
4142
|
uniform float opacity;
|
|
4143
4143
|
#include <common>
|
|
4144
4144
|
#include <uv_pars_fragment>
|
|
@@ -4163,7 +4163,7 @@ void main() {
|
|
|
4163
4163
|
#include <tonemapping_fragment>
|
|
4164
4164
|
#include <colorspace_fragment>
|
|
4165
4165
|
#include <fog_fragment>
|
|
4166
|
-
}`,He={alphahash_fragment:Vg,alphahash_pars_fragment:Gg,alphamap_fragment:Hg,alphamap_pars_fragment:Wg,alphatest_fragment:Xg,alphatest_pars_fragment:qg,aomap_fragment:Yg,aomap_pars_fragment:$g,batching_pars_vertex:jg,batching_vertex:Zg,begin_vertex:Jg,beginnormal_vertex:Kg,bsdfs:Qg,iridescence_fragment:e0,bumpmap_pars_fragment:t0,clipping_planes_fragment:n0,clipping_planes_pars_fragment:i0,clipping_planes_pars_vertex:r0,clipping_planes_vertex:s0,color_fragment:a0,color_pars_fragment:o0,color_pars_vertex:l0,color_vertex:c0,common:h0,cube_uv_reflection_fragment:u0,defaultnormal_vertex:f0,displacementmap_pars_vertex:d0,displacementmap_vertex:p0,emissivemap_fragment:m0,emissivemap_pars_fragment:g0,colorspace_fragment:_0,colorspace_pars_fragment:x0,envmap_fragment:v0,envmap_common_pars_fragment:y0,envmap_pars_fragment:b0,envmap_pars_vertex:M0,envmap_physical_pars_fragment:L0,envmap_vertex:S0,fog_vertex:w0,fog_pars_vertex:T0,fog_fragment:A0,fog_pars_fragment:E0,gradientmap_pars_fragment:C0,lightmap_pars_fragment:R0,lights_lambert_fragment:P0,lights_lambert_pars_fragment:I0,lights_pars_begin:D0,lights_toon_fragment:N0,lights_toon_pars_fragment:U0,lights_phong_fragment:F0,lights_phong_pars_fragment:O0,lights_physical_fragment:B0,lights_physical_pars_fragment:k0,lights_fragment_begin:z0,lights_fragment_maps:V0,lights_fragment_end:G0,lightprobes_pars_fragment:H0,logdepthbuf_fragment:W0,logdepthbuf_pars_fragment:X0,logdepthbuf_pars_vertex:q0,logdepthbuf_vertex:Y0,map_fragment:$0,map_pars_fragment:j0,map_particle_fragment:Z0,map_particle_pars_fragment:J0,metalnessmap_fragment:K0,metalnessmap_pars_fragment:Q0,morphinstance_vertex:e_,morphcolor_vertex:t_,morphnormal_vertex:n_,morphtarget_pars_vertex:i_,morphtarget_vertex:r_,normal_fragment_begin:s_,normal_fragment_maps:a_,normal_pars_fragment:o_,normal_pars_vertex:l_,normal_vertex:c_,normalmap_pars_fragment:h_,clearcoat_normal_fragment_begin:u_,clearcoat_normal_fragment_maps:f_,clearcoat_pars_fragment:d_,iridescence_pars_fragment:p_,opaque_fragment:m_,packing:g_,premultiplied_alpha_fragment:__,project_vertex:x_,dithering_fragment:v_,dithering_pars_fragment:y_,roughnessmap_fragment:b_,roughnessmap_pars_fragment:M_,shadowmap_pars_fragment:S_,shadowmap_pars_vertex:w_,shadowmap_vertex:T_,shadowmask_pars_fragment:A_,skinbase_vertex:E_,skinning_pars_vertex:C_,skinning_vertex:R_,skinnormal_vertex:P_,specularmap_fragment:I_,specularmap_pars_fragment:D_,tonemapping_fragment:L_,tonemapping_pars_fragment:N_,transmission_fragment:U_,transmission_pars_fragment:F_,uv_pars_fragment:O_,uv_pars_vertex:B_,uv_vertex:k_,worldpos_vertex:z_,background_vert:V_,background_frag:G_,backgroundCube_vert:H_,backgroundCube_frag:W_,cube_vert:X_,cube_frag:q_,depth_vert:Y_,depth_frag:$_,distance_vert:j_,distance_frag:Z_,equirect_vert:J_,equirect_frag:K_,linedashed_vert:Q_,linedashed_frag:ex,meshbasic_vert:tx,meshbasic_frag:nx,meshlambert_vert:ix,meshlambert_frag:rx,meshmatcap_vert:sx,meshmatcap_frag:ax,meshnormal_vert:ox,meshnormal_frag:lx,meshphong_vert:cx,meshphong_frag:hx,meshphysical_vert:ux,meshphysical_frag:fx,meshtoon_vert:dx,meshtoon_frag:px,points_vert:mx,points_frag:gx,shadow_vert:_x,shadow_frag:xx,sprite_vert:vx,sprite_frag:yx},pe={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new Te(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new U},probesMax:{value:new U},probesResolution:{value:new U}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new Te(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},Fn={basic:{uniforms:Ot([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.fog]),vertexShader:He.meshbasic_vert,fragmentShader:He.meshbasic_frag},lambert:{uniforms:Ot([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:He.meshlambert_vert,fragmentShader:He.meshlambert_frag},phong:{uniforms:Ot([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:He.meshphong_vert,fragmentShader:He.meshphong_frag},standard:{uniforms:Ot([pe.common,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.roughnessmap,pe.metalnessmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag},toon:{uniforms:Ot([pe.common,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.gradientmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)}}]),vertexShader:He.meshtoon_vert,fragmentShader:He.meshtoon_frag},matcap:{uniforms:Ot([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,{matcap:{value:null}}]),vertexShader:He.meshmatcap_vert,fragmentShader:He.meshmatcap_frag},points:{uniforms:Ot([pe.points,pe.fog]),vertexShader:He.points_vert,fragmentShader:He.points_frag},dashed:{uniforms:Ot([pe.common,pe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:He.linedashed_vert,fragmentShader:He.linedashed_frag},depth:{uniforms:Ot([pe.common,pe.displacementmap]),vertexShader:He.depth_vert,fragmentShader:He.depth_frag},normal:{uniforms:Ot([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,{opacity:{value:1}}]),vertexShader:He.meshnormal_vert,fragmentShader:He.meshnormal_frag},sprite:{uniforms:Ot([pe.sprite,pe.fog]),vertexShader:He.sprite_vert,fragmentShader:He.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:He.background_vert,fragmentShader:He.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:He.backgroundCube_vert,fragmentShader:He.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:He.cube_vert,fragmentShader:He.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:He.equirect_vert,fragmentShader:He.equirect_frag},distance:{uniforms:Ot([pe.common,pe.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:He.distance_vert,fragmentShader:He.distance_frag},shadow:{uniforms:Ot([pe.lights,pe.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:He.shadow_vert,fragmentShader:He.shadow_frag}};Fn.physical={uniforms:Ot([Fn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new Te(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new Te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new Te},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag};var Oo={r:0,b:0,g:0},bx=new ct,Cf=new Be;Cf.set(-1,0,0,0,1,0,0,0,1);function Mx(n,e,t,i,r,s){let a=new Xe(0),o=r===!0?0:1,l,c,h=null,d=0,u=null;function p(v){let M=v.isScene===!0?v.background:null;if(M&&M.isTexture){let S=v.backgroundBlurriness>0;M=e.get(M,S)}return M}function m(v){let M=!1,S=p(v);S===null?g(a,o):S&&S.isColor&&(g(S,1),M=!0);let w=n.xr.getEnvironmentBlendMode();w==="additive"?t.buffers.color.setClear(0,0,0,1,s):w==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(n.autoClear||M)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function x(v,M){let S=p(M);S&&(S.isCubeTexture||S.mapping===as)?(c===void 0&&(c=new Xt(new ar(1,1,1),new nn({name:"BackgroundCubeMaterial",uniforms:Ii(Fn.backgroundCube.uniforms),vertexShader:Fn.backgroundCube.vertexShader,fragmentShader:Fn.backgroundCube.fragmentShader,side:Vt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(w,y,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=S,c.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(bx.makeRotationFromEuler(M.backgroundRotation)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Cf),c.material.toneMapped=$e.getTransfer(S.colorSpace)!==et,(h!==S||d!==S.version||u!==n.toneMapping)&&(c.material.needsUpdate=!0,h=S,d=S.version,u=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null)):S&&S.isTexture&&(l===void 0&&(l=new Xt(new $r(2,2),new nn({name:"BackgroundMaterial",uniforms:Ii(Fn.background.uniforms),vertexShader:Fn.background.vertexShader,fragmentShader:Fn.background.fragmentShader,side:Wn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=S,l.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,l.material.toneMapped=$e.getTransfer(S.colorSpace)!==et,S.matrixAutoUpdate===!0&&S.updateMatrix(),l.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||d!==S.version||u!==n.toneMapping)&&(l.material.needsUpdate=!0,h=S,d=S.version,u=n.toneMapping),l.layers.enableAll(),v.unshift(l,l.geometry,l.material,0,0,null))}function g(v,M){v.getRGB(Oo,vc(n)),t.buffers.color.setClear(Oo.r,Oo.g,Oo.b,M,s)}function f(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(v,M=1){a.set(v),o=M,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(v){o=v,g(a,o)},render:m,addToRenderList:x,dispose:f}}function Sx(n,e){let t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=u(null),s=r,a=!1;function o(P,N,V,I,R){let L=!1,k=d(P,I,V,N);s!==k&&(s=k,c(s.object)),L=p(P,I,V,R),L&&m(P,I,V,R),R!==null&&e.update(R,n.ELEMENT_ARRAY_BUFFER),(L||a)&&(a=!1,S(P,N,V,I),R!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(R).buffer))}function l(){return n.createVertexArray()}function c(P){return n.bindVertexArray(P)}function h(P){return n.deleteVertexArray(P)}function d(P,N,V,I){let R=I.wireframe===!0,L=i[N.id];L===void 0&&(L={},i[N.id]=L);let k=P.isInstancedMesh===!0?P.id:0,ee=L[k];ee===void 0&&(ee={},L[k]=ee);let ne=ee[V.id];ne===void 0&&(ne={},ee[V.id]=ne);let he=ne[R];return he===void 0&&(he=u(l()),ne[R]=he),he}function u(P){let N=[],V=[],I=[];for(let R=0;R<t;R++)N[R]=0,V[R]=0,I[R]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:V,attributeDivisors:I,object:P,attributes:{},index:null}}function p(P,N,V,I){let R=s.attributes,L=N.attributes,k=0,ee=V.getAttributes();for(let ne in ee)if(ee[ne].location>=0){let q=R[ne],J=L[ne];if(J===void 0&&(ne==="instanceMatrix"&&P.instanceMatrix&&(J=P.instanceMatrix),ne==="instanceColor"&&P.instanceColor&&(J=P.instanceColor)),q===void 0||q.attribute!==J||J&&q.data!==J.data)return!0;k++}return s.attributesNum!==k||s.index!==I}function m(P,N,V,I){let R={},L=N.attributes,k=0,ee=V.getAttributes();for(let ne in ee)if(ee[ne].location>=0){let q=L[ne];q===void 0&&(ne==="instanceMatrix"&&P.instanceMatrix&&(q=P.instanceMatrix),ne==="instanceColor"&&P.instanceColor&&(q=P.instanceColor));let J={};J.attribute=q,q&&q.data&&(J.data=q.data),R[ne]=J,k++}s.attributes=R,s.attributesNum=k,s.index=I}function x(){let P=s.newAttributes;for(let N=0,V=P.length;N<V;N++)P[N]=0}function g(P){f(P,0)}function f(P,N){let V=s.newAttributes,I=s.enabledAttributes,R=s.attributeDivisors;V[P]=1,I[P]===0&&(n.enableVertexAttribArray(P),I[P]=1),R[P]!==N&&(n.vertexAttribDivisor(P,N),R[P]=N)}function v(){let P=s.newAttributes,N=s.enabledAttributes;for(let V=0,I=N.length;V<I;V++)N[V]!==P[V]&&(n.disableVertexAttribArray(V),N[V]=0)}function M(P,N,V,I,R,L,k){k===!0?n.vertexAttribIPointer(P,N,V,R,L):n.vertexAttribPointer(P,N,V,I,R,L)}function S(P,N,V,I){x();let R=I.attributes,L=V.getAttributes(),k=N.defaultAttributeValues;for(let ee in L){let ne=L[ee];if(ne.location>=0){let he=R[ee];if(he===void 0&&(ee==="instanceMatrix"&&P.instanceMatrix&&(he=P.instanceMatrix),ee==="instanceColor"&&P.instanceColor&&(he=P.instanceColor)),he!==void 0){let q=he.normalized,J=he.itemSize,fe=e.get(he);if(fe===void 0)continue;let De=fe.buffer,Y=fe.type,z=fe.bytesPerElement,$=Y===n.INT||Y===n.UNSIGNED_INT||he.gpuType===Ja;if(he.isInterleavedBufferAttribute){let te=he.data,ve=te.stride,Me=he.offset;if(te.isInstancedInterleavedBuffer){for(let xe=0;xe<ne.locationSize;xe++)f(ne.location+xe,te.meshPerAttribute);P.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let xe=0;xe<ne.locationSize;xe++)g(ne.location+xe);n.bindBuffer(n.ARRAY_BUFFER,De);for(let xe=0;xe<ne.locationSize;xe++)M(ne.location+xe,J/ne.locationSize,Y,q,ve*z,(Me+J/ne.locationSize*xe)*z,$)}else{if(he.isInstancedBufferAttribute){for(let te=0;te<ne.locationSize;te++)f(ne.location+te,he.meshPerAttribute);P.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let te=0;te<ne.locationSize;te++)g(ne.location+te);n.bindBuffer(n.ARRAY_BUFFER,De);for(let te=0;te<ne.locationSize;te++)M(ne.location+te,J/ne.locationSize,Y,q,J*z,J/ne.locationSize*te*z,$)}}else if(k!==void 0){let q=k[ee];if(q!==void 0)switch(q.length){case 2:n.vertexAttrib2fv(ne.location,q);break;case 3:n.vertexAttrib3fv(ne.location,q);break;case 4:n.vertexAttrib4fv(ne.location,q);break;default:n.vertexAttrib1fv(ne.location,q)}}}}v()}function w(){C();for(let P in i){let N=i[P];for(let V in N){let I=N[V];for(let R in I){let L=I[R];for(let k in L)h(L[k].object),delete L[k];delete I[R]}}delete i[P]}}function y(P){if(i[P.id]===void 0)return;let N=i[P.id];for(let V in N){let I=N[V];for(let R in I){let L=I[R];for(let k in L)h(L[k].object),delete L[k];delete I[R]}}delete i[P.id]}function A(P){for(let N in i){let V=i[N];for(let I in V){let R=V[I];if(R[P.id]===void 0)continue;let L=R[P.id];for(let k in L)h(L[k].object),delete L[k];delete R[P.id]}}}function _(P){for(let N in i){let V=i[N],I=P.isInstancedMesh===!0?P.id:0,R=V[I];if(R!==void 0){for(let L in R){let k=R[L];for(let ee in k)h(k[ee].object),delete k[ee];delete R[L]}delete V[I],Object.keys(V).length===0&&delete i[N]}}}function C(){D(),a=!0,s!==r&&(s=r,c(s.object))}function D(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:C,resetDefaultState:D,dispose:w,releaseStatesOfGeometry:y,releaseStatesOfObject:_,releaseStatesOfProgram:A,initAttributes:x,enableAttribute:g,disableUnusedAttributes:v}}function wx(n,e,t){let i;function r(l){i=l}function s(l,c){n.drawArrays(i,l,c),t.update(c,i,1)}function a(l,c,h){h!==0&&(n.drawArraysInstanced(i,l,c,h),t.update(c,i,h))}function o(l,c,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,c,0,h);let u=0;for(let p=0;p<h;p++)u+=c[p];t.update(u,i,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Tx(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let A=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(A){return!(A!==hn&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){let _=A===Nn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(A!==qt&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==yn&&!_)}function l(A){if(A==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",h=l(c);h!==c&&(Ie("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);let d=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&Ie("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),f=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),M=n.getParameter(n.MAX_VARYING_VECTORS),S=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=n.getParameter(n.MAX_SAMPLES),y=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:p,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:g,maxAttributes:f,maxVertexUniforms:v,maxVaryings:M,maxFragmentUniforms:S,maxSamples:w,samples:y}}function Ax(n){let e=this,t=null,i=0,r=!1,s=!1,a=new ln,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let p=d.length!==0||u||i!==0||r;return r=u,i=d.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,u){t=h(d,u,0)},this.setState=function(d,u,p){let m=d.clippingPlanes,x=d.clipIntersection,g=d.clipShadows,f=n.get(d);if(!r||m===null||m.length===0||s&&!g)s?h(null):c();else{let v=s?0:i,M=v*4,S=f.clippingState||null;l.value=S,S=h(m,u,M,p);for(let w=0;w!==M;++w)S[w]=t[w];f.clippingState=S,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(d,u,p,m){let x=d!==null?d.length:0,g=null;if(x!==0){if(g=l.value,m!==!0||g===null){let f=p+x*4,v=u.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length<f)&&(g=new Float32Array(f));for(let M=0,S=p;M!==x;++M,S+=4)a.copy(d[M]).applyMatrix4(v,o),a.normal.toArray(g,S),g[S+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,g}}var _i=4,sf=[.125,.215,.35,.446,.526,.582],Di=20,Ex=256,ps=new cr,af=new Xe,Cc=null,Rc=0,Pc=0,Ic=!1,Cx=new U,ko=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,s={}){let{size:a=256,position:o=Cx}=s;Cc=this._renderer.getRenderTarget(),Rc=this._renderer.getActiveCubeFace(),Pc=this._renderer.getActiveMipmapLevel(),Ic=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=cf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=lf(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Cc,Rc,Pc),this._renderer.xr.enabled=Ic,e.scissorTest=!1,mr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===di||e.mapping===Pi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Cc=this._renderer.getRenderTarget(),Rc=this._renderer.getActiveCubeFace(),Pc=this._renderer.getActiveMipmapLevel(),Ic=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Rt,minFilter:Rt,generateMipmaps:!1,type:Nn,format:hn,colorSpace:Ur,depthBuffer:!1},r=of(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=of(e,t,i);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Rx(s)),this._blurMaterial=Ix(s,e,t),this._ggxMaterial=Px(s,e,t)}return r}_compileMaterial(e){let t=new Xt(new Ft,e);this._renderer.compile(t,ps)}_sceneToCubeUV(e,t,i,r,s){let l=new Nt(90,1,t,i),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],d=this._renderer,u=d.autoClear,p=d.toneMapping;d.getClearColor(af),d.toneMapping=xn,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(r),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Xt(new ar,new Gr({name:"PMREM.Background",side:Vt,depthWrite:!1,depthTest:!1})));let x=this._backgroundBox,g=x.material,f=!1,v=e.background;v?v.isColor&&(g.color.copy(v),e.background=null,f=!0):(g.color.copy(af),f=!0);for(let M=0;M<6;M++){let S=M%3;S===0?(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[M],s.y,s.z)):S===1?(l.up.set(0,0,c[M]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[M],s.z)):(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[M]));let w=this._cubeSize;mr(r,S*w,M>2?w:0,w,w),d.setRenderTarget(r),f&&d.render(x,l),d.render(e,l)}d.toneMapping=p,d.autoClear=u,e.background=v}_textureToCubeUV(e,t){let i=this._renderer,r=e.mapping===di||e.mapping===Pi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=cf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=lf());let s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;let o=s.uniforms;o.envMap.value=e;let l=this._cubeSize;mr(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,ps)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=i}_applyGGXFilter(e,t,i){let r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[i];o.material=a;let l=a.uniforms,c=i/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),d=Math.sqrt(c*c-h*h),u=0+c*1.25,p=d*u,{_lodMax:m}=this,x=this._sizeLods[i],g=3*x*(i>m-_i?i-m+_i:0),f=4*(this._cubeSize-x);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=m-t,mr(s,g,f,3*x,2*x),r.setRenderTarget(s),r.render(o,ps),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=m-i,mr(e,g,f,3*x,2*x),r.setRenderTarget(e),r.render(o,ps)}_blur(e,t,i,r,s){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){let l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Le("blur direction must be either latitudinal or longitudinal!");let h=3,d=this._lodMeshes[r];d.material=c;let u=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Di-1),x=s/m,g=isFinite(s)?1+Math.floor(h*x):Di;g>Di&&Ie(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Di}`);let f=[],v=0;for(let A=0;A<Di;++A){let _=A/x,C=Math.exp(-_*_/2);f.push(C),A===0?v+=C:A<g&&(v+=2*C)}for(let A=0;A<f.length;A++)f[A]=f[A]/v;u.envMap.value=e.texture,u.samples.value=g,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);let{_lodMax:M}=this;u.dTheta.value=m,u.mipInt.value=M-i;let S=this._sizeLods[r],w=3*S*(r>M-_i?r-M+_i:0),y=4*(this._cubeSize-S);mr(t,w,y,3*S,2*S),l.setRenderTarget(t),l.render(d,ps)}};function Rx(n){let e=[],t=[],i=[],r=n,s=n-_i+1+sf.length;for(let a=0;a<s;a++){let o=Math.pow(2,r);e.push(o);let l=1/o;a>n-_i?l=sf[a-n+_i-1]:a===0&&(l=0),t.push(l);let c=1/(o-2),h=-c,d=1+c,u=[h,h,d,h,d,d,h,h,d,d,h,d],p=6,m=6,x=3,g=2,f=1,v=new Float32Array(x*m*p),M=new Float32Array(g*m*p),S=new Float32Array(f*m*p);for(let y=0;y<p;y++){let A=y%3*2/3-1,_=y>2?0:-1,C=[A,_,0,A+2/3,_,0,A+2/3,_+1,0,A,_,0,A+2/3,_+1,0,A,_+1,0];v.set(C,x*m*y),M.set(u,g*m*y);let D=[y,y,y,y,y,y];S.set(D,f*m*y)}let w=new Ft;w.setAttribute("position",new zt(v,x)),w.setAttribute("uv",new zt(M,g)),w.setAttribute("faceIndex",new zt(S,f)),i.push(new Xt(w,null)),r>_i&&r--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function of(n,e,t){let i=new tn(n,e,t);return i.texture.mapping=as,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function mr(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function Px(n,e,t){return new nn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Ex,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Go(),fragmentShader:`
|
|
4166
|
+
}`,He={alphahash_fragment:Yg,alphahash_pars_fragment:$g,alphamap_fragment:jg,alphamap_pars_fragment:Zg,alphatest_fragment:Jg,alphatest_pars_fragment:Kg,aomap_fragment:Qg,aomap_pars_fragment:e0,batching_pars_vertex:t0,batching_vertex:n0,begin_vertex:i0,beginnormal_vertex:r0,bsdfs:s0,iridescence_fragment:a0,bumpmap_pars_fragment:o0,clipping_planes_fragment:l0,clipping_planes_pars_fragment:c0,clipping_planes_pars_vertex:h0,clipping_planes_vertex:u0,color_fragment:f0,color_pars_fragment:d0,color_pars_vertex:p0,color_vertex:m0,common:g0,cube_uv_reflection_fragment:_0,defaultnormal_vertex:x0,displacementmap_pars_vertex:v0,displacementmap_vertex:y0,emissivemap_fragment:b0,emissivemap_pars_fragment:M0,colorspace_fragment:S0,colorspace_pars_fragment:w0,envmap_fragment:T0,envmap_common_pars_fragment:A0,envmap_pars_fragment:E0,envmap_pars_vertex:C0,envmap_physical_pars_fragment:k0,envmap_vertex:R0,fog_vertex:P0,fog_pars_vertex:I0,fog_fragment:D0,fog_pars_fragment:L0,gradientmap_pars_fragment:N0,lightmap_pars_fragment:U0,lights_lambert_fragment:O0,lights_lambert_pars_fragment:F0,lights_pars_begin:B0,lights_toon_fragment:z0,lights_toon_pars_fragment:V0,lights_phong_fragment:G0,lights_phong_pars_fragment:H0,lights_physical_fragment:W0,lights_physical_pars_fragment:X0,lights_fragment_begin:q0,lights_fragment_maps:Y0,lights_fragment_end:$0,lightprobes_pars_fragment:j0,logdepthbuf_fragment:Z0,logdepthbuf_pars_fragment:J0,logdepthbuf_pars_vertex:K0,logdepthbuf_vertex:Q0,map_fragment:e_,map_pars_fragment:t_,map_particle_fragment:n_,map_particle_pars_fragment:i_,metalnessmap_fragment:r_,metalnessmap_pars_fragment:s_,morphinstance_vertex:a_,morphcolor_vertex:o_,morphnormal_vertex:l_,morphtarget_pars_vertex:c_,morphtarget_vertex:h_,normal_fragment_begin:u_,normal_fragment_maps:f_,normal_pars_fragment:d_,normal_pars_vertex:p_,normal_vertex:m_,normalmap_pars_fragment:g_,clearcoat_normal_fragment_begin:__,clearcoat_normal_fragment_maps:x_,clearcoat_pars_fragment:v_,iridescence_pars_fragment:y_,opaque_fragment:b_,packing:M_,premultiplied_alpha_fragment:S_,project_vertex:w_,dithering_fragment:T_,dithering_pars_fragment:A_,roughnessmap_fragment:E_,roughnessmap_pars_fragment:C_,shadowmap_pars_fragment:R_,shadowmap_pars_vertex:P_,shadowmap_vertex:I_,shadowmask_pars_fragment:D_,skinbase_vertex:L_,skinning_pars_vertex:N_,skinning_vertex:U_,skinnormal_vertex:O_,specularmap_fragment:F_,specularmap_pars_fragment:B_,tonemapping_fragment:k_,tonemapping_pars_fragment:z_,transmission_fragment:V_,transmission_pars_fragment:G_,uv_pars_fragment:H_,uv_pars_vertex:W_,uv_vertex:X_,worldpos_vertex:q_,background_vert:Y_,background_frag:$_,backgroundCube_vert:j_,backgroundCube_frag:Z_,cube_vert:J_,cube_frag:K_,depth_vert:Q_,depth_frag:ex,distance_vert:tx,distance_frag:nx,equirect_vert:ix,equirect_frag:rx,linedashed_vert:sx,linedashed_frag:ax,meshbasic_vert:ox,meshbasic_frag:lx,meshlambert_vert:cx,meshlambert_frag:hx,meshmatcap_vert:ux,meshmatcap_frag:fx,meshnormal_vert:dx,meshnormal_frag:px,meshphong_vert:mx,meshphong_frag:gx,meshphysical_vert:_x,meshphysical_frag:xx,meshtoon_vert:vx,meshtoon_frag:yx,points_vert:bx,points_frag:Mx,shadow_vert:Sx,shadow_frag:wx,sprite_vert:Tx,sprite_frag:Ax},pe={common:{diffuse:{value:new Xe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new Te(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new U},probesMax:{value:new U},probesResolution:{value:new U}},points:{diffuse:{value:new Xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new Xe(16777215)},opacity:{value:1},center:{value:new Te(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},On={basic:{uniforms:Ft([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.fog]),vertexShader:He.meshbasic_vert,fragmentShader:He.meshbasic_frag},lambert:{uniforms:Ft([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)},envMapIntensity:{value:1}}]),vertexShader:He.meshlambert_vert,fragmentShader:He.meshlambert_frag},phong:{uniforms:Ft([pe.common,pe.specularmap,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)},specular:{value:new Xe(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:He.meshphong_vert,fragmentShader:He.meshphong_frag},standard:{uniforms:Ft([pe.common,pe.envmap,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.roughnessmap,pe.metalnessmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag},toon:{uniforms:Ft([pe.common,pe.aomap,pe.lightmap,pe.emissivemap,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.gradientmap,pe.fog,pe.lights,{emissive:{value:new Xe(0)}}]),vertexShader:He.meshtoon_vert,fragmentShader:He.meshtoon_frag},matcap:{uniforms:Ft([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,pe.fog,{matcap:{value:null}}]),vertexShader:He.meshmatcap_vert,fragmentShader:He.meshmatcap_frag},points:{uniforms:Ft([pe.points,pe.fog]),vertexShader:He.points_vert,fragmentShader:He.points_frag},dashed:{uniforms:Ft([pe.common,pe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:He.linedashed_vert,fragmentShader:He.linedashed_frag},depth:{uniforms:Ft([pe.common,pe.displacementmap]),vertexShader:He.depth_vert,fragmentShader:He.depth_frag},normal:{uniforms:Ft([pe.common,pe.bumpmap,pe.normalmap,pe.displacementmap,{opacity:{value:1}}]),vertexShader:He.meshnormal_vert,fragmentShader:He.meshnormal_frag},sprite:{uniforms:Ft([pe.sprite,pe.fog]),vertexShader:He.sprite_vert,fragmentShader:He.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:He.background_vert,fragmentShader:He.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:He.backgroundCube_vert,fragmentShader:He.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:He.cube_vert,fragmentShader:He.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:He.equirect_vert,fragmentShader:He.equirect_frag},distance:{uniforms:Ft([pe.common,pe.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:He.distance_vert,fragmentShader:He.distance_frag},shadow:{uniforms:Ft([pe.lights,pe.fog,{color:{value:new Xe(0)},opacity:{value:1}}]),vertexShader:He.shadow_vert,fragmentShader:He.shadow_frag}};On.physical={uniforms:Ft([On.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new Te(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new Xe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new Te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new Xe(0)},specularColor:{value:new Xe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new Te},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag};var Fo={r:0,b:0,g:0},Ex=new ct,Rf=new Be;Rf.set(-1,0,0,0,1,0,0,0,1);function Cx(n,e,t,i,r,s){let a=new Xe(0),o=r===!0?0:1,l,c,h=null,d=0,u=null;function p(v){let M=v.isScene===!0?v.background:null;if(M&&M.isTexture){let S=v.backgroundBlurriness>0;M=e.get(M,S)}return M}function m(v){let M=!1,S=p(v);S===null?g(a,o):S&&S.isColor&&(g(S,1),M=!0);let w=n.xr.getEnvironmentBlendMode();w==="additive"?t.buffers.color.setClear(0,0,0,1,s):w==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(n.autoClear||M)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function x(v,M){let S=p(M);S&&(S.isCubeTexture||S.mapping===as)?(c===void 0&&(c=new Xt(new ar(1,1,1),new nn({name:"BackgroundCubeMaterial",uniforms:Ii(On.backgroundCube.uniforms),vertexShader:On.backgroundCube.vertexShader,fragmentShader:On.backgroundCube.fragmentShader,side:Vt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(w,y,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=S,c.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Ex.makeRotationFromEuler(M.backgroundRotation)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Rf),c.material.toneMapped=$e.getTransfer(S.colorSpace)!==et,(h!==S||d!==S.version||u!==n.toneMapping)&&(c.material.needsUpdate=!0,h=S,d=S.version,u=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null)):S&&S.isTexture&&(l===void 0&&(l=new Xt(new $r(2,2),new nn({name:"BackgroundMaterial",uniforms:Ii(On.background.uniforms),vertexShader:On.background.vertexShader,fragmentShader:On.background.fragmentShader,side:Wn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=S,l.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,l.material.toneMapped=$e.getTransfer(S.colorSpace)!==et,S.matrixAutoUpdate===!0&&S.updateMatrix(),l.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||d!==S.version||u!==n.toneMapping)&&(l.material.needsUpdate=!0,h=S,d=S.version,u=n.toneMapping),l.layers.enableAll(),v.unshift(l,l.geometry,l.material,0,0,null))}function g(v,M){v.getRGB(Fo,vc(n)),t.buffers.color.setClear(Fo.r,Fo.g,Fo.b,M,s)}function f(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(v,M=1){a.set(v),o=M,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(v){o=v,g(a,o)},render:m,addToRenderList:x,dispose:f}}function Rx(n,e){let t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=u(null),s=r,a=!1;function o(P,N,V,I,R){let L=!1,k=d(P,I,V,N);s!==k&&(s=k,c(s.object)),L=p(P,I,V,R),L&&m(P,I,V,R),R!==null&&e.update(R,n.ELEMENT_ARRAY_BUFFER),(L||a)&&(a=!1,S(P,N,V,I),R!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(R).buffer))}function l(){return n.createVertexArray()}function c(P){return n.bindVertexArray(P)}function h(P){return n.deleteVertexArray(P)}function d(P,N,V,I){let R=I.wireframe===!0,L=i[N.id];L===void 0&&(L={},i[N.id]=L);let k=P.isInstancedMesh===!0?P.id:0,ee=L[k];ee===void 0&&(ee={},L[k]=ee);let ne=ee[V.id];ne===void 0&&(ne={},ee[V.id]=ne);let he=ne[R];return he===void 0&&(he=u(l()),ne[R]=he),he}function u(P){let N=[],V=[],I=[];for(let R=0;R<t;R++)N[R]=0,V[R]=0,I[R]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:V,attributeDivisors:I,object:P,attributes:{},index:null}}function p(P,N,V,I){let R=s.attributes,L=N.attributes,k=0,ee=V.getAttributes();for(let ne in ee)if(ee[ne].location>=0){let q=R[ne],J=L[ne];if(J===void 0&&(ne==="instanceMatrix"&&P.instanceMatrix&&(J=P.instanceMatrix),ne==="instanceColor"&&P.instanceColor&&(J=P.instanceColor)),q===void 0||q.attribute!==J||J&&q.data!==J.data)return!0;k++}return s.attributesNum!==k||s.index!==I}function m(P,N,V,I){let R={},L=N.attributes,k=0,ee=V.getAttributes();for(let ne in ee)if(ee[ne].location>=0){let q=L[ne];q===void 0&&(ne==="instanceMatrix"&&P.instanceMatrix&&(q=P.instanceMatrix),ne==="instanceColor"&&P.instanceColor&&(q=P.instanceColor));let J={};J.attribute=q,q&&q.data&&(J.data=q.data),R[ne]=J,k++}s.attributes=R,s.attributesNum=k,s.index=I}function x(){let P=s.newAttributes;for(let N=0,V=P.length;N<V;N++)P[N]=0}function g(P){f(P,0)}function f(P,N){let V=s.newAttributes,I=s.enabledAttributes,R=s.attributeDivisors;V[P]=1,I[P]===0&&(n.enableVertexAttribArray(P),I[P]=1),R[P]!==N&&(n.vertexAttribDivisor(P,N),R[P]=N)}function v(){let P=s.newAttributes,N=s.enabledAttributes;for(let V=0,I=N.length;V<I;V++)N[V]!==P[V]&&(n.disableVertexAttribArray(V),N[V]=0)}function M(P,N,V,I,R,L,k){k===!0?n.vertexAttribIPointer(P,N,V,R,L):n.vertexAttribPointer(P,N,V,I,R,L)}function S(P,N,V,I){x();let R=I.attributes,L=V.getAttributes(),k=N.defaultAttributeValues;for(let ee in L){let ne=L[ee];if(ne.location>=0){let he=R[ee];if(he===void 0&&(ee==="instanceMatrix"&&P.instanceMatrix&&(he=P.instanceMatrix),ee==="instanceColor"&&P.instanceColor&&(he=P.instanceColor)),he!==void 0){let q=he.normalized,J=he.itemSize,fe=e.get(he);if(fe===void 0)continue;let De=fe.buffer,Y=fe.type,z=fe.bytesPerElement,$=Y===n.INT||Y===n.UNSIGNED_INT||he.gpuType===Ja;if(he.isInterleavedBufferAttribute){let te=he.data,ve=te.stride,Me=he.offset;if(te.isInstancedInterleavedBuffer){for(let xe=0;xe<ne.locationSize;xe++)f(ne.location+xe,te.meshPerAttribute);P.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let xe=0;xe<ne.locationSize;xe++)g(ne.location+xe);n.bindBuffer(n.ARRAY_BUFFER,De);for(let xe=0;xe<ne.locationSize;xe++)M(ne.location+xe,J/ne.locationSize,Y,q,ve*z,(Me+J/ne.locationSize*xe)*z,$)}else{if(he.isInstancedBufferAttribute){for(let te=0;te<ne.locationSize;te++)f(ne.location+te,he.meshPerAttribute);P.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let te=0;te<ne.locationSize;te++)g(ne.location+te);n.bindBuffer(n.ARRAY_BUFFER,De);for(let te=0;te<ne.locationSize;te++)M(ne.location+te,J/ne.locationSize,Y,q,J*z,J/ne.locationSize*te*z,$)}}else if(k!==void 0){let q=k[ee];if(q!==void 0)switch(q.length){case 2:n.vertexAttrib2fv(ne.location,q);break;case 3:n.vertexAttrib3fv(ne.location,q);break;case 4:n.vertexAttrib4fv(ne.location,q);break;default:n.vertexAttrib1fv(ne.location,q)}}}}v()}function w(){C();for(let P in i){let N=i[P];for(let V in N){let I=N[V];for(let R in I){let L=I[R];for(let k in L)h(L[k].object),delete L[k];delete I[R]}}delete i[P]}}function y(P){if(i[P.id]===void 0)return;let N=i[P.id];for(let V in N){let I=N[V];for(let R in I){let L=I[R];for(let k in L)h(L[k].object),delete L[k];delete I[R]}}delete i[P.id]}function A(P){for(let N in i){let V=i[N];for(let I in V){let R=V[I];if(R[P.id]===void 0)continue;let L=R[P.id];for(let k in L)h(L[k].object),delete L[k];delete R[P.id]}}}function _(P){for(let N in i){let V=i[N],I=P.isInstancedMesh===!0?P.id:0,R=V[I];if(R!==void 0){for(let L in R){let k=R[L];for(let ee in k)h(k[ee].object),delete k[ee];delete R[L]}delete V[I],Object.keys(V).length===0&&delete i[N]}}}function C(){D(),a=!0,s!==r&&(s=r,c(s.object))}function D(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:C,resetDefaultState:D,dispose:w,releaseStatesOfGeometry:y,releaseStatesOfObject:_,releaseStatesOfProgram:A,initAttributes:x,enableAttribute:g,disableUnusedAttributes:v}}function Px(n,e,t){let i;function r(l){i=l}function s(l,c){n.drawArrays(i,l,c),t.update(c,i,1)}function a(l,c,h){h!==0&&(n.drawArraysInstanced(i,l,c,h),t.update(c,i,h))}function o(l,c,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,c,0,h);let u=0;for(let p=0;p<h;p++)u+=c[p];t.update(u,i,1)}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Ix(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let A=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(A){return!(A!==hn&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){let _=A===Nn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(A!==qt&&i.convert(A)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==yn&&!_)}function l(A){if(A==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",h=l(c);h!==c&&(Ie("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);let d=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&Ie("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),x=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),f=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),M=n.getParameter(n.MAX_VARYING_VECTORS),S=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=n.getParameter(n.MAX_SAMPLES),y=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:p,maxVertexTextures:m,maxTextureSize:x,maxCubemapSize:g,maxAttributes:f,maxVertexUniforms:v,maxVaryings:M,maxFragmentUniforms:S,maxSamples:w,samples:y}}function Dx(n){let e=this,t=null,i=0,r=!1,s=!1,a=new ln,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let p=d.length!==0||u||i!==0||r;return r=u,i=d.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,u){t=h(d,u,0)},this.setState=function(d,u,p){let m=d.clippingPlanes,x=d.clipIntersection,g=d.clipShadows,f=n.get(d);if(!r||m===null||m.length===0||s&&!g)s?h(null):c();else{let v=s?0:i,M=v*4,S=f.clippingState||null;l.value=S,S=h(m,u,M,p);for(let w=0;w!==M;++w)S[w]=t[w];f.clippingState=S,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(d,u,p,m){let x=d!==null?d.length:0,g=null;if(x!==0){if(g=l.value,m!==!0||g===null){let f=p+x*4,v=u.matrixWorldInverse;o.getNormalMatrix(v),(g===null||g.length<f)&&(g=new Float32Array(f));for(let M=0,S=p;M!==x;++M,S+=4)a.copy(d[M]).applyMatrix4(v,o),a.normal.toArray(g,S),g[S+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,g}}var _i=4,af=[.125,.215,.35,.446,.526,.582],Di=20,Lx=256,ps=new cr,of=new Xe,Cc=null,Rc=0,Pc=0,Ic=!1,Nx=new U,ko=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,s={}){let{size:a=256,position:o=Nx}=s;Cc=this._renderer.getRenderTarget(),Rc=this._renderer.getActiveCubeFace(),Pc=this._renderer.getActiveMipmapLevel(),Ic=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=hf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=cf(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Cc,Rc,Pc),this._renderer.xr.enabled=Ic,e.scissorTest=!1,mr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===di||e.mapping===Pi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Cc=this._renderer.getRenderTarget(),Rc=this._renderer.getActiveCubeFace(),Pc=this._renderer.getActiveMipmapLevel(),Ic=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Rt,minFilter:Rt,generateMipmaps:!1,type:Nn,format:hn,colorSpace:Ur,depthBuffer:!1},r=lf(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=lf(e,t,i);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Ux(s)),this._blurMaterial=Fx(s,e,t),this._ggxMaterial=Ox(s,e,t)}return r}_compileMaterial(e){let t=new Xt(new Ot,e);this._renderer.compile(t,ps)}_sceneToCubeUV(e,t,i,r,s){let l=new Nt(90,1,t,i),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],d=this._renderer,u=d.autoClear,p=d.toneMapping;d.getClearColor(of),d.toneMapping=xn,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(r),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Xt(new ar,new Gr({name:"PMREM.Background",side:Vt,depthWrite:!1,depthTest:!1})));let x=this._backgroundBox,g=x.material,f=!1,v=e.background;v?v.isColor&&(g.color.copy(v),e.background=null,f=!0):(g.color.copy(of),f=!0);for(let M=0;M<6;M++){let S=M%3;S===0?(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[M],s.y,s.z)):S===1?(l.up.set(0,0,c[M]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[M],s.z)):(l.up.set(0,c[M],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[M]));let w=this._cubeSize;mr(r,S*w,M>2?w:0,w,w),d.setRenderTarget(r),f&&d.render(x,l),d.render(e,l)}d.toneMapping=p,d.autoClear=u,e.background=v}_textureToCubeUV(e,t){let i=this._renderer,r=e.mapping===di||e.mapping===Pi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=hf()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=cf());let s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;let o=s.uniforms;o.envMap.value=e;let l=this._cubeSize;mr(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,ps)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=i}_applyGGXFilter(e,t,i){let r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[i];o.material=a;let l=a.uniforms,c=i/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),d=Math.sqrt(c*c-h*h),u=0+c*1.25,p=d*u,{_lodMax:m}=this,x=this._sizeLods[i],g=3*x*(i>m-_i?i-m+_i:0),f=4*(this._cubeSize-x);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=m-t,mr(s,g,f,3*x,2*x),r.setRenderTarget(s),r.render(o,ps),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=m-i,mr(e,g,f,3*x,2*x),r.setRenderTarget(e),r.render(o,ps)}_blur(e,t,i,r,s){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){let l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Le("blur direction must be either latitudinal or longitudinal!");let h=3,d=this._lodMeshes[r];d.material=c;let u=c.uniforms,p=this._sizeLods[i]-1,m=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Di-1),x=s/m,g=isFinite(s)?1+Math.floor(h*x):Di;g>Di&&Ie(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Di}`);let f=[],v=0;for(let A=0;A<Di;++A){let _=A/x,C=Math.exp(-_*_/2);f.push(C),A===0?v+=C:A<g&&(v+=2*C)}for(let A=0;A<f.length;A++)f[A]=f[A]/v;u.envMap.value=e.texture,u.samples.value=g,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);let{_lodMax:M}=this;u.dTheta.value=m,u.mipInt.value=M-i;let S=this._sizeLods[r],w=3*S*(r>M-_i?r-M+_i:0),y=4*(this._cubeSize-S);mr(t,w,y,3*S,2*S),l.setRenderTarget(t),l.render(d,ps)}};function Ux(n){let e=[],t=[],i=[],r=n,s=n-_i+1+af.length;for(let a=0;a<s;a++){let o=Math.pow(2,r);e.push(o);let l=1/o;a>n-_i?l=af[a-n+_i-1]:a===0&&(l=0),t.push(l);let c=1/(o-2),h=-c,d=1+c,u=[h,h,d,h,d,d,h,h,d,d,h,d],p=6,m=6,x=3,g=2,f=1,v=new Float32Array(x*m*p),M=new Float32Array(g*m*p),S=new Float32Array(f*m*p);for(let y=0;y<p;y++){let A=y%3*2/3-1,_=y>2?0:-1,C=[A,_,0,A+2/3,_,0,A+2/3,_+1,0,A,_,0,A+2/3,_+1,0,A,_+1,0];v.set(C,x*m*y),M.set(u,g*m*y);let D=[y,y,y,y,y,y];S.set(D,f*m*y)}let w=new Ot;w.setAttribute("position",new zt(v,x)),w.setAttribute("uv",new zt(M,g)),w.setAttribute("faceIndex",new zt(S,f)),i.push(new Xt(w,null)),r>_i&&r--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function lf(n,e,t){let i=new tn(n,e,t);return i.texture.mapping=as,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function mr(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function Ox(n,e,t){return new nn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Lx,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Go(),fragmentShader:`
|
|
4167
4167
|
|
|
4168
4168
|
precision highp float;
|
|
4169
4169
|
precision highp int;
|
|
@@ -4267,7 +4267,7 @@ void main() {
|
|
|
4267
4267
|
|
|
4268
4268
|
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
4269
4269
|
}
|
|
4270
|
-
`,blending:Ln,depthTest:!1,depthWrite:!1})}function
|
|
4270
|
+
`,blending:Ln,depthTest:!1,depthWrite:!1})}function Fx(n,e,t){let i=new Float32Array(Di),r=new U(0,1,0);return new nn({name:"SphericalGaussianBlur",defines:{n:Di,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Go(),fragmentShader:`
|
|
4271
4271
|
|
|
4272
4272
|
precision mediump float;
|
|
4273
4273
|
precision mediump int;
|
|
@@ -4327,7 +4327,7 @@ void main() {
|
|
|
4327
4327
|
}
|
|
4328
4328
|
|
|
4329
4329
|
}
|
|
4330
|
-
`,blending:Ln,depthTest:!1,depthWrite:!1})}function
|
|
4330
|
+
`,blending:Ln,depthTest:!1,depthWrite:!1})}function cf(){return new nn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Go(),fragmentShader:`
|
|
4331
4331
|
|
|
4332
4332
|
precision mediump float;
|
|
4333
4333
|
precision mediump int;
|
|
@@ -4346,7 +4346,7 @@ void main() {
|
|
|
4346
4346
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
4347
4347
|
|
|
4348
4348
|
}
|
|
4349
|
-
`,blending:Ln,depthTest:!1,depthWrite:!1})}function
|
|
4349
|
+
`,blending:Ln,depthTest:!1,depthWrite:!1})}function hf(){return new nn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Go(),fragmentShader:`
|
|
4350
4350
|
|
|
4351
4351
|
precision mediump float;
|
|
4352
4352
|
precision mediump int;
|
|
@@ -4452,7 +4452,7 @@ void main() {
|
|
|
4452
4452
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
4453
4453
|
|
|
4454
4454
|
}
|
|
4455
|
-
`},r=new ar(5,5,5),s=new nn({name:"CubemapFromEquirect",uniforms:Ii(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Vt,blending:Ln});s.uniforms.tEquirect.value=t;let a=new Xt(r,s),o=t.minFilter;return t.minFilter===pi&&(t.minFilter=Rt),new Wa(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){let s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}};function
|
|
4455
|
+
`},r=new ar(5,5,5),s=new nn({name:"CubemapFromEquirect",uniforms:Ii(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Vt,blending:Ln});s.uniforms.tEquirect.value=t;let a=new Xt(r,s),o=t.minFilter;return t.minFilter===pi&&(t.minFilter=Rt),new Wa(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){let s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}};function Bx(n){let e=new WeakMap,t=new WeakMap,i=null;function r(u,p=!1){return u==null?null:p?a(u):s(u)}function s(u){if(u&&u.isTexture){let p=u.mapping;if(p===$a||p===ja)if(e.has(u)){let m=e.get(u).texture;return o(m,u.mapping)}else{let m=u.image;if(m&&m.height>0){let x=new zo(m.height);return x.fromEquirectangularTexture(n,u),e.set(u,x),u.addEventListener("dispose",c),o(x.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture){let p=u.mapping,m=p===$a||p===ja,x=p===di||p===Pi;if(m||x){let g=t.get(u),f=g!==void 0?g.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==f)return i===null&&(i=new ko(n)),g=m?i.fromEquirectangular(u,g):i.fromCubemap(u,g),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),g.texture;if(g!==void 0)return g.texture;{let v=u.image;return m&&v&&v.height>0||x&&v&&l(v)?(i===null&&(i=new ko(n)),g=m?i.fromEquirectangular(u):i.fromCubemap(u),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),u.addEventListener("dispose",h),g.texture):null}}}return u}function o(u,p){return p===$a?u.mapping=di:p===ja&&(u.mapping=Pi),u}function l(u){let p=0,m=6;for(let x=0;x<m;x++)u[x]!==void 0&&p++;return p===m}function c(u){let p=u.target;p.removeEventListener("dispose",c);let m=e.get(p);m!==void 0&&(e.delete(p),m.dispose())}function h(u){let p=u.target;p.removeEventListener("dispose",h);let m=t.get(p);m!==void 0&&(t.delete(p),m.dispose())}function d(){e=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:r,dispose:d}}function kx(n){let e={};function t(i){if(e[i]!==void 0)return e[i];let r=n.getExtension(i);return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){let r=t(i);return r===null&&ga("WebGLRenderer: "+i+" extension not supported."),r}}}function zx(n,e,t,i){let r={},s=new WeakMap;function a(d){let u=d.target;u.index!==null&&e.remove(u.index);for(let m in u.attributes)e.remove(u.attributes[m]);u.removeEventListener("dispose",a),delete r[u.id];let p=s.get(u);p&&(e.remove(p),s.delete(u)),i.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(d,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function l(d){let u=d.attributes;for(let p in u)e.update(u[p],n.ARRAY_BUFFER)}function c(d){let u=[],p=d.index,m=d.attributes.position,x=0;if(m===void 0)return;if(p!==null){let v=p.array;x=p.version;for(let M=0,S=v.length;M<S;M+=3){let w=v[M+0],y=v[M+1],A=v[M+2];u.push(w,y,y,A,A,w)}}else{let v=m.array;x=m.version;for(let M=0,S=v.length/3-1;M<S;M+=3){let w=M+0,y=M+1,A=M+2;u.push(w,y,y,A,A,w)}}let g=new(m.count>=65535?Vr:zr)(u,1);g.version=x;let f=s.get(d);f&&e.remove(f),s.set(d,g)}function h(d){let u=s.get(d);if(u){let p=d.index;p!==null&&u.version<p.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:h}}function Vx(n,e,t){let i;function r(d){i=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,u){n.drawElements(i,u,s,d*a),t.update(u,i,1)}function c(d,u,p){p!==0&&(n.drawElementsInstanced(i,u,s,d*a,p),t.update(u,i,p))}function h(d,u,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,u,0,s,d,0,p);let x=0;for(let g=0;g<p;g++)x+=u[g];t.update(x,i,1)}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h}function Gx(n){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(s/3);break;case n.LINES:t.lines+=o*(s/2);break;case n.LINE_STRIP:t.lines+=o*(s-1);break;case n.LINE_LOOP:t.lines+=o*s;break;case n.POINTS:t.points+=o*s;break;default:Le("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function Hx(n,e,t){let i=new WeakMap,r=new pt;function s(a,o,l){let c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=h!==void 0?h.length:0,u=i.get(o);if(u===void 0||u.count!==d){let C=function(){A.dispose(),i.delete(o),o.removeEventListener("dispose",C)};u!==void 0&&u.texture.dispose();let p=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,x=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],v=o.morphAttributes.color||[],M=0;p===!0&&(M=1),m===!0&&(M=2),x===!0&&(M=3);let S=o.attributes.position.count*M,w=1;S>e.maxTextureSize&&(w=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);let y=new Float32Array(S*w*4*d),A=new Br(y,S,w,d);A.type=yn,A.needsUpdate=!0;let _=M*4;for(let D=0;D<d;D++){let P=g[D],N=f[D],V=v[D],I=S*w*4*D;for(let R=0;R<P.count;R++){let L=R*_;p===!0&&(r.fromBufferAttribute(P,R),y[I+L+0]=r.x,y[I+L+1]=r.y,y[I+L+2]=r.z,y[I+L+3]=0),m===!0&&(r.fromBufferAttribute(N,R),y[I+L+4]=r.x,y[I+L+5]=r.y,y[I+L+6]=r.z,y[I+L+7]=0),x===!0&&(r.fromBufferAttribute(V,R),y[I+L+8]=r.x,y[I+L+9]=r.y,y[I+L+10]=r.z,y[I+L+11]=V.itemSize===4?r.w:1)}}u={count:d,texture:A,size:new Te(S,w)},i.set(o,u),o.addEventListener("dispose",C)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let p=0;for(let x=0;x<c.length;x++)p+=c[x];let m=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(n,"morphTargetBaseInfluence",m),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",u.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",u.size)}return{update:s}}function Wx(n,e,t,i,r){let s=new WeakMap;function a(c){let h=r.render.frame,d=c.geometry,u=e.get(c,d);if(s.get(u)!==h&&(e.update(u),s.set(u,h)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==h&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),s.set(c,h))),c.isSkinnedMesh){let p=c.skeleton;s.get(p)!==h&&(p.update(),s.set(p,h))}return u}function o(){s=new WeakMap}function l(c){let h=c.target;h.removeEventListener("dispose",l),i.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:a,dispose:o}}var Xx={[Ql]:"LINEAR_TONE_MAPPING",[ec]:"REINHARD_TONE_MAPPING",[tc]:"CINEON_TONE_MAPPING",[nc]:"ACES_FILMIC_TONE_MAPPING",[rc]:"AGX_TONE_MAPPING",[sc]:"NEUTRAL_TONE_MAPPING",[ic]:"CUSTOM_TONE_MAPPING"};function qx(n,e,t,i,r){let s=new tn(e,t,{type:n,depthBuffer:i,stencilBuffer:r,depthTexture:i?new Yn(e,t):void 0}),a=new tn(e,t,{type:Nn,depthBuffer:!1,stencilBuffer:!1}),o=new Ot;o.setAttribute("position",new _t([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new _t([0,2,0,0,2,0],2));let l=new Ia({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
4456
4456
|
precision highp float;
|
|
4457
4457
|
|
|
4458
4458
|
uniform mat4 modelViewMatrix;
|
|
@@ -4498,17 +4498,17 @@ void main() {
|
|
|
4498
4498
|
#ifdef SRGB_TRANSFER
|
|
4499
4499
|
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
4500
4500
|
#endif
|
|
4501
|
-
}`,depthTest:!1,depthWrite:!1}),c=new Xt(o,l),h=new cr(-1,1,1,-1,0,1),d=null,u=null,p=!1,m,x=null,g=[],f=!1;this.setSize=function(v,M){s.setSize(v,M),a.setSize(v,M);for(let S=0;S<g.length;S++){let w=g[S];w.setSize&&w.setSize(v,M)}},this.setEffects=function(v){g=v,f=g.length>0&&g[0].isRenderPass===!0;let M=s.width,S=s.height;for(let w=0;w<g.length;w++){let y=g[w];y.setSize&&y.setSize(M,S)}},this.begin=function(v,M){if(p||v.toneMapping===xn&&g.length===0)return!1;if(x=M,M!==null){let S=M.width,w=M.height;(s.width!==S||s.height!==w)&&this.setSize(S,w)}return f===!1&&v.setRenderTarget(s),m=v.toneMapping,v.toneMapping=xn,!0},this.hasRenderPass=function(){return f},this.end=function(v,M){v.toneMapping=m,p=!0;let S=s,w=a;for(let y=0;y<g.length;y++){let A=g[y];if(A.enabled!==!1&&(A.render(v,w,S,M),A.needsSwap!==!1)){let _=S;S=w,w=_}}if(d!==v.outputColorSpace||u!==v.toneMapping){d=v.outputColorSpace,u=v.toneMapping,l.defines={},$e.getTransfer(d)===et&&(l.defines.SRGB_TRANSFER="");let y=
|
|
4501
|
+
}`,depthTest:!1,depthWrite:!1}),c=new Xt(o,l),h=new cr(-1,1,1,-1,0,1),d=null,u=null,p=!1,m,x=null,g=[],f=!1;this.setSize=function(v,M){s.setSize(v,M),a.setSize(v,M);for(let S=0;S<g.length;S++){let w=g[S];w.setSize&&w.setSize(v,M)}},this.setEffects=function(v){g=v,f=g.length>0&&g[0].isRenderPass===!0;let M=s.width,S=s.height;for(let w=0;w<g.length;w++){let y=g[w];y.setSize&&y.setSize(M,S)}},this.begin=function(v,M){if(p||v.toneMapping===xn&&g.length===0)return!1;if(x=M,M!==null){let S=M.width,w=M.height;(s.width!==S||s.height!==w)&&this.setSize(S,w)}return f===!1&&v.setRenderTarget(s),m=v.toneMapping,v.toneMapping=xn,!0},this.hasRenderPass=function(){return f},this.end=function(v,M){v.toneMapping=m,p=!0;let S=s,w=a;for(let y=0;y<g.length;y++){let A=g[y];if(A.enabled!==!1&&(A.render(v,w,S,M),A.needsSwap!==!1)){let _=S;S=w,w=_}}if(d!==v.outputColorSpace||u!==v.toneMapping){d=v.outputColorSpace,u=v.toneMapping,l.defines={},$e.getTransfer(d)===et&&(l.defines.SRGB_TRANSFER="");let y=Xx[u];y&&(l.defines[y]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=S.texture,v.setRenderTarget(x),v.render(c,h),x=null,p=!1},this.isCompositing=function(){return p},this.dispose=function(){s.depthTexture&&s.depthTexture.dispose(),s.dispose(),a.dispose(),o.dispose(),l.dispose()}}var Pf=new Wt,Nc=new Yn(1,1),If=new Br,Df=new va,Lf=new Wr,uf=[],ff=[],df=new Float32Array(16),pf=new Float32Array(9),mf=new Float32Array(4);function _r(n,e,t){let i=n[0];if(i<=0||i>0)return n;let r=e*t,s=uf[r];if(s===void 0&&(s=new Float32Array(r),uf[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function St(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function wt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Ho(n,e){let t=ff[e];t===void 0&&(t=new Int32Array(e),ff[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function Yx(n,e){let t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function $x(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(St(t,e))return;n.uniform2fv(this.addr,e),wt(t,e)}}function jx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(St(t,e))return;n.uniform3fv(this.addr,e),wt(t,e)}}function Zx(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(St(t,e))return;n.uniform4fv(this.addr,e),wt(t,e)}}function Jx(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(St(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),wt(t,e)}else{if(St(t,i))return;mf.set(i),n.uniformMatrix2fv(this.addr,!1,mf),wt(t,i)}}function Kx(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(St(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),wt(t,e)}else{if(St(t,i))return;pf.set(i),n.uniformMatrix3fv(this.addr,!1,pf),wt(t,i)}}function Qx(n,e){let t=this.cache,i=e.elements;if(i===void 0){if(St(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),wt(t,e)}else{if(St(t,i))return;df.set(i),n.uniformMatrix4fv(this.addr,!1,df),wt(t,i)}}function ev(n,e){let t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function tv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(St(t,e))return;n.uniform2iv(this.addr,e),wt(t,e)}}function nv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(St(t,e))return;n.uniform3iv(this.addr,e),wt(t,e)}}function iv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(St(t,e))return;n.uniform4iv(this.addr,e),wt(t,e)}}function rv(n,e){let t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function sv(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(St(t,e))return;n.uniform2uiv(this.addr,e),wt(t,e)}}function av(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(St(t,e))return;n.uniform3uiv(this.addr,e),wt(t,e)}}function ov(n,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(St(t,e))return;n.uniform4uiv(this.addr,e),wt(t,e)}}function lv(n,e,t){let i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(Nc.compareFunction=t.isReversedDepthBuffer()?Oo:Uo,s=Nc):s=Pf,t.setTexture2D(e||s,r)}function cv(n,e,t){let i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||Df,r)}function hv(n,e,t){let i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||Lf,r)}function uv(n,e,t){let i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||If,r)}function fv(n){switch(n){case 5126:return Yx;case 35664:return $x;case 35665:return jx;case 35666:return Zx;case 35674:return Jx;case 35675:return Kx;case 35676:return Qx;case 5124:case 35670:return ev;case 35667:case 35671:return tv;case 35668:case 35672:return nv;case 35669:case 35673:return iv;case 5125:return rv;case 36294:return sv;case 36295:return av;case 36296:return ov;case 35678:case 36198:case 36298:case 36306:case 35682:return lv;case 35679:case 36299:case 36307:return cv;case 35680:case 36300:case 36308:case 36293:return hv;case 36289:case 36303:case 36311:case 36292:return uv}}function dv(n,e){n.uniform1fv(this.addr,e)}function pv(n,e){let t=_r(e,this.size,2);n.uniform2fv(this.addr,t)}function mv(n,e){let t=_r(e,this.size,3);n.uniform3fv(this.addr,t)}function gv(n,e){let t=_r(e,this.size,4);n.uniform4fv(this.addr,t)}function _v(n,e){let t=_r(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function xv(n,e){let t=_r(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function vv(n,e){let t=_r(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function yv(n,e){n.uniform1iv(this.addr,e)}function bv(n,e){n.uniform2iv(this.addr,e)}function Mv(n,e){n.uniform3iv(this.addr,e)}function Sv(n,e){n.uniform4iv(this.addr,e)}function wv(n,e){n.uniform1uiv(this.addr,e)}function Tv(n,e){n.uniform2uiv(this.addr,e)}function Av(n,e){n.uniform3uiv(this.addr,e)}function Ev(n,e){n.uniform4uiv(this.addr,e)}function Cv(n,e,t){let i=this.cache,r=e.length,s=Ho(t,r);St(i,s)||(n.uniform1iv(this.addr,s),wt(i,s));let a;this.type===n.SAMPLER_2D_SHADOW?a=Nc:a=Pf;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function Rv(n,e,t){let i=this.cache,r=e.length,s=Ho(t,r);St(i,s)||(n.uniform1iv(this.addr,s),wt(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Df,s[a])}function Pv(n,e,t){let i=this.cache,r=e.length,s=Ho(t,r);St(i,s)||(n.uniform1iv(this.addr,s),wt(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Lf,s[a])}function Iv(n,e,t){let i=this.cache,r=e.length,s=Ho(t,r);St(i,s)||(n.uniform1iv(this.addr,s),wt(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||If,s[a])}function Dv(n){switch(n){case 5126:return dv;case 35664:return pv;case 35665:return mv;case 35666:return gv;case 35674:return _v;case 35675:return xv;case 35676:return vv;case 5124:case 35670:return yv;case 35667:case 35671:return bv;case 35668:case 35672:return Mv;case 35669:case 35673:return Sv;case 5125:return wv;case 36294:return Tv;case 36295:return Av;case 36296:return Ev;case 35678:case 36198:case 36298:case 36306:case 35682:return Cv;case 35679:case 36299:case 36307:return Rv;case 35680:case 36300:case 36308:case 36293:return Pv;case 36289:case 36303:case 36311:case 36292:return Iv}}var Uc=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=fv(t.type)}},Oc=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Dv(t.type)}},Fc=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let r=this.seq;for(let s=0,a=r.length;s!==a;++s){let o=r[s];o.setValue(e,t[o.id],i)}}},Dc=/(\w+)(\])?(\[|\.)?/g;function gf(n,e){n.seq.push(e),n.map[e.id]=e}function Lv(n,e,t){let i=n.name,r=i.length;for(Dc.lastIndex=0;;){let s=Dc.exec(i),a=Dc.lastIndex,o=s[1],l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){gf(t,c===void 0?new Uc(o,n,e):new Oc(o,n,e));break}else{let d=t.map[o];d===void 0&&(d=new Fc(o),gf(t,d)),t=d}}}var gr=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<i;++a){let o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);Lv(o,l,this)}let r=[],s=[];for(let a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,i,r){let s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){let r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){let o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){let i=[];for(let r=0,s=e.length;r!==s;++r){let a=e[r];a.id in t&&i.push(a)}return i}};function _f(n,e,t){let i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}var Nv=37297,Uv=0;function Ov(n,e){let t=n.split(`
|
|
4502
4502
|
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){let o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
|
|
4503
|
-
`)}var
|
|
4503
|
+
`)}var xf=new Be;function Fv(n){$e._getMatrix(xf,$e.workingColorSpace,n);let e=`mat3( ${xf.elements.map(t=>t.toFixed(4))} )`;switch($e.getTransfer(n)){case Or:return[e,"LinearTransferOETF"];case et:return[e,"sRGBTransferOETF"];default:return Ie("WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function vf(n,e,t){let i=n.getShaderParameter(e,n.COMPILE_STATUS),s=(n.getShaderInfoLog(e)||"").trim();if(i&&s==="")return"";let a=/ERROR: 0:(\d+)/.exec(s);if(a){let o=parseInt(a[1]);return t.toUpperCase()+`
|
|
4504
4504
|
|
|
4505
4505
|
`+s+`
|
|
4506
4506
|
|
|
4507
|
-
`+
|
|
4508
|
-
`)}var
|
|
4509
|
-
`)}function
|
|
4510
|
-
`)}function
|
|
4511
|
-
`)}function
|
|
4507
|
+
`+Ov(n.getShaderSource(e),o)}else return s}function Bv(n,e){let t=Fv(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
|
|
4508
|
+
`)}var kv={[Ql]:"Linear",[ec]:"Reinhard",[tc]:"Cineon",[nc]:"ACESFilmic",[rc]:"AgX",[sc]:"Neutral",[ic]:"Custom"};function zv(n,e){let t=kv[e];return t===void 0?(Ie("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var Bo=new U;function Vv(){$e.getLuminanceCoefficients(Bo);let n=Bo.x.toFixed(4),e=Bo.y.toFixed(4),t=Bo.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
|
|
4509
|
+
`)}function Gv(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gs).join(`
|
|
4510
|
+
`)}function Hv(n){let e=[];for(let t in n){let i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
|
|
4511
|
+
`)}function Wv(n,e){let t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){let s=n.getActiveAttrib(e,r),a=s.name,o=1;s.type===n.FLOAT_MAT2&&(o=2),s.type===n.FLOAT_MAT3&&(o=3),s.type===n.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function gs(n){return n!==""}function yf(n,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function bf(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Xv=/^[ \t]*#include +<([\w\d./]+)>/gm;function Bc(n){return n.replace(Xv,Yv)}var qv=new Map;function Yv(n,e){let t=He[e];if(t===void 0){let i=qv.get(e);if(i!==void 0)t=He[i],Ie('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Bc(t)}var $v=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Mf(n){return n.replace($v,jv)}function jv(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Sf(n){let e=`precision ${n.precision} float;
|
|
4512
4512
|
precision ${n.precision} int;
|
|
4513
4513
|
precision ${n.precision} sampler2D;
|
|
4514
4514
|
precision ${n.precision} samplerCube;
|
|
@@ -4528,30 +4528,30 @@ void main() {
|
|
|
4528
4528
|
`;return n.precision==="highp"?e+=`
|
|
4529
4529
|
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
|
|
4530
4530
|
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
|
|
4531
|
-
#define LOW_PRECISION`),e}var
|
|
4531
|
+
#define LOW_PRECISION`),e}var Zv={[ss]:"SHADOWMAP_TYPE_PCF",[ur]:"SHADOWMAP_TYPE_VSM"};function Jv(n){return Zv[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Kv={[di]:"ENVMAP_TYPE_CUBE",[Pi]:"ENVMAP_TYPE_CUBE",[as]:"ENVMAP_TYPE_CUBE_UV"};function Qv(n){return n.envMap===!1?"ENVMAP_TYPE_CUBE":Kv[n.envMapMode]||"ENVMAP_TYPE_CUBE"}var ey={[Pi]:"ENVMAP_MODE_REFRACTION"};function ty(n){return n.envMap===!1?"ENVMAP_MODE_REFLECTION":ey[n.envMapMode]||"ENVMAP_MODE_REFLECTION"}var ny={[Ya]:"ENVMAP_BLENDING_MULTIPLY",[Vu]:"ENVMAP_BLENDING_MIX",[Gu]:"ENVMAP_BLENDING_ADD"};function iy(n){return n.envMap===!1?"ENVMAP_BLENDING_NONE":ny[n.combine]||"ENVMAP_BLENDING_NONE"}function ry(n){let e=n.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function sy(n,e,t,i){let r=n.getContext(),s=t.defines,a=t.vertexShader,o=t.fragmentShader,l=Jv(t),c=Qv(t),h=ty(t),d=iy(t),u=ry(t),p=Gv(t),m=Hv(s),x=r.createProgram(),g,f,v=t.glslVersion?"#version "+t.glslVersion+`
|
|
4532
4532
|
`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(gs).join(`
|
|
4533
4533
|
`),g.length>0&&(g+=`
|
|
4534
4534
|
`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(gs).join(`
|
|
4535
4535
|
`),f.length>0&&(f+=`
|
|
4536
|
-
`)):(g=[
|
|
4536
|
+
`)):(g=[Sf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
4537
4537
|
`].filter(gs).join(`
|
|
4538
|
-
`),f=[
|
|
4538
|
+
`),f=[Sf(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==xn?"#define TONE_MAPPING":"",t.toneMapping!==xn?He.tonemapping_pars_fragment:"",t.toneMapping!==xn?zv("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",He.colorspace_pars_fragment,Bv("linearToOutputTexel",t.outputColorSpace),Vv(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
4539
4539
|
`].filter(gs).join(`
|
|
4540
|
-
`)),a=Bc(a),a=
|
|
4540
|
+
`)),a=Bc(a),a=yf(a,t),a=bf(a,t),o=Bc(o),o=yf(o,t),o=bf(o,t),a=Mf(a),o=Mf(o),t.isRawShaderMaterial!==!0&&(v=`#version 300 es
|
|
4541
4541
|
`,g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
4542
4542
|
`)+`
|
|
4543
4543
|
`+g,f=["#define varying in",t.glslVersion===pc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===pc?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
4544
4544
|
`)+`
|
|
4545
|
-
`+f);let M=v+g+a,S=v+f+o,w=
|
|
4545
|
+
`+f);let M=v+g+a,S=v+f+o,w=_f(r,r.VERTEX_SHADER,M),y=_f(r,r.FRAGMENT_SHADER,S);r.attachShader(x,w),r.attachShader(x,y),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x);function A(P){if(n.debug.checkShaderErrors){let N=r.getProgramInfoLog(x)||"",V=r.getShaderInfoLog(w)||"",I=r.getShaderInfoLog(y)||"",R=N.trim(),L=V.trim(),k=I.trim(),ee=!0,ne=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(ee=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,x,w,y);else{let he=vf(r,w,"vertex"),q=vf(r,y,"fragment");Le("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+`
|
|
4546
4546
|
|
|
4547
4547
|
Material Name: `+P.name+`
|
|
4548
4548
|
Material Type: `+P.type+`
|
|
4549
4549
|
|
|
4550
4550
|
Program Info Log: `+R+`
|
|
4551
4551
|
`+he+`
|
|
4552
|
-
`+q)}else R!==""?Ie("WebGLProgram: Program Info Log:",R):(L===""||k==="")&&(ne=!1);ne&&(P.diagnostics={runnable:ee,programLog:R,vertexShader:{log:L,prefix:g},fragmentShader:{log:k,prefix:f}})}r.deleteShader(w),r.deleteShader(y),_=new gr(r,x),C=Bv(r,x)}let _;this.getUniforms=function(){return _===void 0&&A(this),_};let C;this.getAttributes=function(){return C===void 0&&A(this),C};let D=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(x,Cv)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Rv++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=y,this}var ey=0,kc=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new zc(e),t.set(e,i)),i}},zc=class{constructor(e){this.id=ey++,this.code=e,this.usedTimes=0}};function ty(n){return n===gi||n===fs||n===ds}function ny(n,e,t,i,r,s){let a=new nr,o=new kc,l=new Set,c=[],h=new Map,d=i.logarithmicDepthBuffer,u=i.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(_){return l.add(_),_===0?"uv":`uv${_}`}function x(_,C,D,P,N,V){let I=P.fog,R=N.geometry,L=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?P.environment:null,k=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,ee=e.get(_.envMap||L,k),ne=ee&&ee.mapping===as?ee.image.height:null,he=p[_.type];_.precision!==null&&(u=i.getMaxPrecision(_.precision),u!==_.precision&&Ie("WebGLProgram.getParameters:",_.precision,"not supported, using",u,"instead."));let q=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,J=q!==void 0?q.length:0,fe=0;R.morphAttributes.position!==void 0&&(fe=1),R.morphAttributes.normal!==void 0&&(fe=2),R.morphAttributes.color!==void 0&&(fe=3);let De,Y,z,$;if(he){let ke=Fn[he];De=ke.vertexShader,Y=ke.fragmentShader}else De=_.vertexShader,Y=_.fragmentShader,o.update(_),z=o.getVertexShaderID(_),$=o.getFragmentShaderID(_);let te=n.getRenderTarget(),ve=n.state.buffers.depth.getReversed(),Me=N.isInstancedMesh===!0,xe=N.isBatchedMesh===!0,Ze=!!_.map,Ue=!!_.matcap,qe=!!ee,Qe=!!_.aoMap,Fe=!!_.lightMap,it=!!_.bumpMap,nt=!!_.normalMap,jt=!!_.displacementMap,O=!!_.emissiveMap,Mt=!!_.metalnessMap,Ye=!!_.roughnessMap,ht=_.anisotropy>0,de=_.clearcoat>0,mt=_.dispersion>0,E=_.iridescence>0,b=_.sheen>0,G=_.transmission>0,K=ht&&!!_.anisotropyMap,re=de&&!!_.clearcoatMap,se=de&&!!_.clearcoatNormalMap,ue=de&&!!_.clearcoatRoughnessMap,j=E&&!!_.iridescenceMap,Q=E&&!!_.iridescenceThicknessMap,_e=b&&!!_.sheenColorMap,Se=b&&!!_.sheenRoughnessMap,le=!!_.specularMap,ae=!!_.specularColorMap,Oe=!!_.specularIntensityMap,Ve=G&&!!_.transmissionMap,Ke=G&&!!_.thicknessMap,F=!!_.gradientMap,oe=!!_.alphaMap,Z=_.alphaTest>0,ye=!!_.alphaHash,ce=!!_.extensions,ie=xn;_.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(ie=n.toneMapping);let Ce={shaderID:he,shaderType:_.type,shaderName:_.name,vertexShader:De,fragmentShader:Y,defines:_.defines,customVertexShaderID:z,customFragmentShaderID:$,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:u,batching:xe,batchingColor:xe&&N._colorsTexture!==null,instancing:Me,instancingColor:Me&&N.instanceColor!==null,instancingMorph:Me&&N.morphTexture!==null,outputColorSpace:te===null?n.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:$e.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:Ze,matcap:Ue,envMap:qe,envMapMode:qe&&ee.mapping,envMapCubeUVHeight:ne,aoMap:Qe,lightMap:Fe,bumpMap:it,normalMap:nt,displacementMap:jt,emissiveMap:O,normalMapObjectSpace:nt&&_.normalMapType===Wu,normalMapTangentSpace:nt&&_.normalMapType===No,packedNormalMap:nt&&_.normalMapType===No&&ty(_.normalMap.format),metalnessMap:Mt,roughnessMap:Ye,anisotropy:ht,anisotropyMap:K,clearcoat:de,clearcoatMap:re,clearcoatNormalMap:se,clearcoatRoughnessMap:ue,dispersion:mt,iridescence:E,iridescenceMap:j,iridescenceThicknessMap:Q,sheen:b,sheenColorMap:_e,sheenRoughnessMap:Se,specularMap:le,specularColorMap:ae,specularIntensityMap:Oe,transmission:G,transmissionMap:Ve,thicknessMap:Ke,gradientMap:F,opaque:_.transparent===!1&&_.blending===Ai&&_.alphaToCoverage===!1,alphaMap:oe,alphaTest:Z,alphaHash:ye,combine:_.combine,mapUv:Ze&&m(_.map.channel),aoMapUv:Qe&&m(_.aoMap.channel),lightMapUv:Fe&&m(_.lightMap.channel),bumpMapUv:it&&m(_.bumpMap.channel),normalMapUv:nt&&m(_.normalMap.channel),displacementMapUv:jt&&m(_.displacementMap.channel),emissiveMapUv:O&&m(_.emissiveMap.channel),metalnessMapUv:Mt&&m(_.metalnessMap.channel),roughnessMapUv:Ye&&m(_.roughnessMap.channel),anisotropyMapUv:K&&m(_.anisotropyMap.channel),clearcoatMapUv:re&&m(_.clearcoatMap.channel),clearcoatNormalMapUv:se&&m(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ue&&m(_.clearcoatRoughnessMap.channel),iridescenceMapUv:j&&m(_.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&m(_.iridescenceThicknessMap.channel),sheenColorMapUv:_e&&m(_.sheenColorMap.channel),sheenRoughnessMapUv:Se&&m(_.sheenRoughnessMap.channel),specularMapUv:le&&m(_.specularMap.channel),specularColorMapUv:ae&&m(_.specularColorMap.channel),specularIntensityMapUv:Oe&&m(_.specularIntensityMap.channel),transmissionMapUv:Ve&&m(_.transmissionMap.channel),thicknessMapUv:Ke&&m(_.thicknessMap.channel),alphaMapUv:oe&&m(_.alphaMap.channel),vertexTangents:!!R.attributes.tangent&&(nt||ht),vertexNormals:!!R.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!R.attributes.uv&&(Ze||oe),fog:!!I,useFog:_.fog===!0,fogExp2:!!I&&I.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||R.attributes.normal===void 0&&nt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:ve,skinning:N.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:fe,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numLightProbeGrids:V.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:ie,decodeVideoTexture:Ze&&_.map.isVideoTexture===!0&&$e.getTransfer(_.map.colorSpace)===et,decodeVideoTextureEmissive:O&&_.emissiveMap.isVideoTexture===!0&&$e.getTransfer(_.emissiveMap.colorSpace)===et,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===Dn,flipSided:_.side===Vt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:ce&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ce&&_.extensions.multiDraw===!0||xe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function g(_){let C=[];if(_.shaderID?C.push(_.shaderID):(C.push(_.customVertexShaderID),C.push(_.customFragmentShaderID)),_.defines!==void 0)for(let D in _.defines)C.push(D),C.push(_.defines[D]);return _.isRawShaderMaterial===!1&&(f(C,_),v(C,_),C.push(n.outputColorSpace)),C.push(_.customProgramCacheKey),C.join()}function f(_,C){_.push(C.precision),_.push(C.outputColorSpace),_.push(C.envMapMode),_.push(C.envMapCubeUVHeight),_.push(C.mapUv),_.push(C.alphaMapUv),_.push(C.lightMapUv),_.push(C.aoMapUv),_.push(C.bumpMapUv),_.push(C.normalMapUv),_.push(C.displacementMapUv),_.push(C.emissiveMapUv),_.push(C.metalnessMapUv),_.push(C.roughnessMapUv),_.push(C.anisotropyMapUv),_.push(C.clearcoatMapUv),_.push(C.clearcoatNormalMapUv),_.push(C.clearcoatRoughnessMapUv),_.push(C.iridescenceMapUv),_.push(C.iridescenceThicknessMapUv),_.push(C.sheenColorMapUv),_.push(C.sheenRoughnessMapUv),_.push(C.specularMapUv),_.push(C.specularColorMapUv),_.push(C.specularIntensityMapUv),_.push(C.transmissionMapUv),_.push(C.thicknessMapUv),_.push(C.combine),_.push(C.fogExp2),_.push(C.sizeAttenuation),_.push(C.morphTargetsCount),_.push(C.morphAttributeCount),_.push(C.numDirLights),_.push(C.numPointLights),_.push(C.numSpotLights),_.push(C.numSpotLightMaps),_.push(C.numHemiLights),_.push(C.numRectAreaLights),_.push(C.numDirLightShadows),_.push(C.numPointLightShadows),_.push(C.numSpotLightShadows),_.push(C.numSpotLightShadowsWithMaps),_.push(C.numLightProbes),_.push(C.shadowMapType),_.push(C.toneMapping),_.push(C.numClippingPlanes),_.push(C.numClipIntersection),_.push(C.depthPacking)}function v(_,C){a.disableAll(),C.instancing&&a.enable(0),C.instancingColor&&a.enable(1),C.instancingMorph&&a.enable(2),C.matcap&&a.enable(3),C.envMap&&a.enable(4),C.normalMapObjectSpace&&a.enable(5),C.normalMapTangentSpace&&a.enable(6),C.clearcoat&&a.enable(7),C.iridescence&&a.enable(8),C.alphaTest&&a.enable(9),C.vertexColors&&a.enable(10),C.vertexAlphas&&a.enable(11),C.vertexUv1s&&a.enable(12),C.vertexUv2s&&a.enable(13),C.vertexUv3s&&a.enable(14),C.vertexTangents&&a.enable(15),C.anisotropy&&a.enable(16),C.alphaHash&&a.enable(17),C.batching&&a.enable(18),C.dispersion&&a.enable(19),C.batchingColor&&a.enable(20),C.gradientMap&&a.enable(21),C.packedNormalMap&&a.enable(22),C.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),C.fog&&a.enable(0),C.useFog&&a.enable(1),C.flatShading&&a.enable(2),C.logarithmicDepthBuffer&&a.enable(3),C.reversedDepthBuffer&&a.enable(4),C.skinning&&a.enable(5),C.morphTargets&&a.enable(6),C.morphNormals&&a.enable(7),C.morphColors&&a.enable(8),C.premultipliedAlpha&&a.enable(9),C.shadowMapEnabled&&a.enable(10),C.doubleSided&&a.enable(11),C.flipSided&&a.enable(12),C.useDepthPacking&&a.enable(13),C.dithering&&a.enable(14),C.transmission&&a.enable(15),C.sheen&&a.enable(16),C.opaque&&a.enable(17),C.pointsUvs&&a.enable(18),C.decodeVideoTexture&&a.enable(19),C.decodeVideoTextureEmissive&&a.enable(20),C.alphaToCoverage&&a.enable(21),C.numLightProbeGrids>0&&a.enable(22),_.push(a.mask)}function M(_){let C=p[_.type],D;if(C){let P=Fn[C];D=nf.clone(P.uniforms)}else D=_.uniforms;return D}function S(_,C){let D=h.get(C);return D!==void 0?++D.usedTimes:(D=new Qv(n,C,_,r),c.push(D),h.set(C,D)),D}function w(_){if(--_.usedTimes===0){let C=c.indexOf(_);c[C]=c[c.length-1],c.pop(),h.delete(_.cacheKey),_.destroy()}}function y(_){o.remove(_)}function A(){o.dispose()}return{getParameters:x,getProgramCacheKey:g,getUniforms:M,acquireProgram:S,releaseProgram:w,releaseShaderCache:y,programs:c,dispose:A}}function iy(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function r(a,o,l){n.get(a)[o]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function ry(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function Sf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function wf(){let n=[],e=0,t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(u){let p=0;return u.isInstancedMesh&&(p+=2),u.isSkinnedMesh&&(p+=1),p}function o(u,p,m,x,g,f){let v=n[e];return v===void 0?(v={id:u.id,object:u,geometry:p,material:m,materialVariant:a(u),groupOrder:x,renderOrder:u.renderOrder,z:g,group:f},n[e]=v):(v.id=u.id,v.object=u,v.geometry=p,v.material=m,v.materialVariant=a(u),v.groupOrder=x,v.renderOrder=u.renderOrder,v.z=g,v.group=f),e++,v}function l(u,p,m,x,g,f){let v=o(u,p,m,x,g,f);m.transmission>0?i.push(v):m.transparent===!0?r.push(v):t.push(v)}function c(u,p,m,x,g,f){let v=o(u,p,m,x,g,f);m.transmission>0?i.unshift(v):m.transparent===!0?r.unshift(v):t.unshift(v)}function h(u,p){t.length>1&&t.sort(u||ry),i.length>1&&i.sort(p||Sf),r.length>1&&r.sort(p||Sf)}function d(){for(let u=e,p=n.length;u<p;u++){let m=n[u];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:c,finish:d,sort:h}}function sy(){let n=new WeakMap;function e(i,r){let s=n.get(i),a;return s===void 0?(a=new wf,n.set(i,[a])):r>=s.length?(a=new wf,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function ay(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new Xe};break;case"SpotLight":t={position:new U,direction:new U,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new U,halfWidth:new U,halfHeight:new U};break}return n[e.id]=t,t}}}function oy(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}var ly=0;function cy(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function hy(n){let e=new ay,t=oy(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new U);let r=new U,s=new ct,a=new ct;function o(c){let h=0,d=0,u=0;for(let C=0;C<9;C++)i.probe[C].set(0,0,0);let p=0,m=0,x=0,g=0,f=0,v=0,M=0,S=0,w=0,y=0,A=0;c.sort(cy);for(let C=0,D=c.length;C<D;C++){let P=c[C],N=P.color,V=P.intensity,I=P.distance,R=null;if(P.shadow&&P.shadow.map&&(P.shadow.map.texture.format===gi?R=P.shadow.map.texture:R=P.shadow.map.depthTexture||P.shadow.map.texture),P.isAmbientLight)h+=N.r*V,d+=N.g*V,u+=N.b*V;else if(P.isLightProbe){for(let L=0;L<9;L++)i.probe[L].addScaledVector(P.sh.coefficients[L],V);A++}else if(P.isDirectionalLight){let L=e.get(P);if(L.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){let k=P.shadow,ee=t.get(P);ee.shadowIntensity=k.intensity,ee.shadowBias=k.bias,ee.shadowNormalBias=k.normalBias,ee.shadowRadius=k.radius,ee.shadowMapSize=k.mapSize,i.directionalShadow[p]=ee,i.directionalShadowMap[p]=R,i.directionalShadowMatrix[p]=P.shadow.matrix,v++}i.directional[p]=L,p++}else if(P.isSpotLight){let L=e.get(P);L.position.setFromMatrixPosition(P.matrixWorld),L.color.copy(N).multiplyScalar(V),L.distance=I,L.coneCos=Math.cos(P.angle),L.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),L.decay=P.decay,i.spot[x]=L;let k=P.shadow;if(P.map&&(i.spotLightMap[w]=P.map,w++,k.updateMatrices(P),P.castShadow&&y++),i.spotLightMatrix[x]=k.matrix,P.castShadow){let ee=t.get(P);ee.shadowIntensity=k.intensity,ee.shadowBias=k.bias,ee.shadowNormalBias=k.normalBias,ee.shadowRadius=k.radius,ee.shadowMapSize=k.mapSize,i.spotShadow[x]=ee,i.spotShadowMap[x]=R,S++}x++}else if(P.isRectAreaLight){let L=e.get(P);L.color.copy(N).multiplyScalar(V),L.halfWidth.set(P.width*.5,0,0),L.halfHeight.set(0,P.height*.5,0),i.rectArea[g]=L,g++}else if(P.isPointLight){let L=e.get(P);if(L.color.copy(P.color).multiplyScalar(P.intensity),L.distance=P.distance,L.decay=P.decay,P.castShadow){let k=P.shadow,ee=t.get(P);ee.shadowIntensity=k.intensity,ee.shadowBias=k.bias,ee.shadowNormalBias=k.normalBias,ee.shadowRadius=k.radius,ee.shadowMapSize=k.mapSize,ee.shadowCameraNear=k.camera.near,ee.shadowCameraFar=k.camera.far,i.pointShadow[m]=ee,i.pointShadowMap[m]=R,i.pointShadowMatrix[m]=P.shadow.matrix,M++}i.point[m]=L,m++}else if(P.isHemisphereLight){let L=e.get(P);L.skyColor.copy(P.color).multiplyScalar(V),L.groundColor.copy(P.groundColor).multiplyScalar(V),i.hemi[f]=L,f++}}g>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=pe.LTC_FLOAT_1,i.rectAreaLTC2=pe.LTC_FLOAT_2):(i.rectAreaLTC1=pe.LTC_HALF_1,i.rectAreaLTC2=pe.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=d,i.ambient[2]=u;let _=i.hash;(_.directionalLength!==p||_.pointLength!==m||_.spotLength!==x||_.rectAreaLength!==g||_.hemiLength!==f||_.numDirectionalShadows!==v||_.numPointShadows!==M||_.numSpotShadows!==S||_.numSpotMaps!==w||_.numLightProbes!==A)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=g,i.point.length=m,i.hemi.length=f,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=M,i.pointShadowMap.length=M,i.spotShadow.length=S,i.spotShadowMap.length=S,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=M,i.spotLightMatrix.length=S+w-y,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=y,i.numLightProbes=A,_.directionalLength=p,_.pointLength=m,_.spotLength=x,_.rectAreaLength=g,_.hemiLength=f,_.numDirectionalShadows=v,_.numPointShadows=M,_.numSpotShadows=S,_.numSpotMaps=w,_.numLightProbes=A,i.version=ly++)}function l(c,h){let d=0,u=0,p=0,m=0,x=0,g=h.matrixWorldInverse;for(let f=0,v=c.length;f<v;f++){let M=c[f];if(M.isDirectionalLight){let S=i.directional[d];S.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(g),d++}else if(M.isSpotLight){let S=i.spot[p];S.position.setFromMatrixPosition(M.matrixWorld),S.position.applyMatrix4(g),S.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(g),p++}else if(M.isRectAreaLight){let S=i.rectArea[m];S.position.setFromMatrixPosition(M.matrixWorld),S.position.applyMatrix4(g),a.identity(),s.copy(M.matrixWorld),s.premultiply(g),a.extractRotation(s),S.halfWidth.set(M.width*.5,0,0),S.halfHeight.set(0,M.height*.5,0),S.halfWidth.applyMatrix4(a),S.halfHeight.applyMatrix4(a),m++}else if(M.isPointLight){let S=i.point[u];S.position.setFromMatrixPosition(M.matrixWorld),S.position.applyMatrix4(g),u++}else if(M.isHemisphereLight){let S=i.hemi[x];S.direction.setFromMatrixPosition(M.matrixWorld),S.direction.transformDirection(g),x++}}}return{setup:o,setupView:l,state:i}}function Tf(n){let e=new hy(n),t=[],i=[],r=[];function s(u){d.camera=u,t.length=0,i.length=0,r.length=0}function a(u){t.push(u)}function o(u){i.push(u)}function l(u){r.push(u)}function c(){e.setup(t)}function h(u){e.setupView(t,u)}let d={lightsArray:t,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:d,setupLights:c,setupLightsView:h,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function uy(n){let e=new WeakMap;function t(r,s=0){let a=e.get(r),o;return a===void 0?(o=new Tf(n),e.set(r,[o])):s>=a.length?(o=new Tf(n),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:t,dispose:i}}var fy=`void main() {
|
|
4552
|
+
`+q)}else R!==""?Ie("WebGLProgram: Program Info Log:",R):(L===""||k==="")&&(ne=!1);ne&&(P.diagnostics={runnable:ee,programLog:R,vertexShader:{log:L,prefix:g},fragmentShader:{log:k,prefix:f}})}r.deleteShader(w),r.deleteShader(y),_=new gr(r,x),C=Wv(r,x)}let _;this.getUniforms=function(){return _===void 0&&A(this),_};let C;this.getAttributes=function(){return C===void 0&&A(this),C};let D=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(x,Nv)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Uv++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=y,this}var ay=0,kc=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new zc(e),t.set(e,i)),i}},zc=class{constructor(e){this.id=ay++,this.code=e,this.usedTimes=0}};function oy(n){return n===gi||n===fs||n===ds}function ly(n,e,t,i,r,s){let a=new nr,o=new kc,l=new Set,c=[],h=new Map,d=i.logarithmicDepthBuffer,u=i.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(_){return l.add(_),_===0?"uv":`uv${_}`}function x(_,C,D,P,N,V){let I=P.fog,R=N.geometry,L=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?P.environment:null,k=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,ee=e.get(_.envMap||L,k),ne=ee&&ee.mapping===as?ee.image.height:null,he=p[_.type];_.precision!==null&&(u=i.getMaxPrecision(_.precision),u!==_.precision&&Ie("WebGLProgram.getParameters:",_.precision,"not supported, using",u,"instead."));let q=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,J=q!==void 0?q.length:0,fe=0;R.morphAttributes.position!==void 0&&(fe=1),R.morphAttributes.normal!==void 0&&(fe=2),R.morphAttributes.color!==void 0&&(fe=3);let De,Y,z,$;if(he){let ke=On[he];De=ke.vertexShader,Y=ke.fragmentShader}else De=_.vertexShader,Y=_.fragmentShader,o.update(_),z=o.getVertexShaderID(_),$=o.getFragmentShaderID(_);let te=n.getRenderTarget(),ve=n.state.buffers.depth.getReversed(),Me=N.isInstancedMesh===!0,xe=N.isBatchedMesh===!0,Ze=!!_.map,Ue=!!_.matcap,qe=!!ee,Qe=!!_.aoMap,Oe=!!_.lightMap,it=!!_.bumpMap,nt=!!_.normalMap,jt=!!_.displacementMap,F=!!_.emissiveMap,Mt=!!_.metalnessMap,Ye=!!_.roughnessMap,ht=_.anisotropy>0,de=_.clearcoat>0,mt=_.dispersion>0,E=_.iridescence>0,b=_.sheen>0,G=_.transmission>0,K=ht&&!!_.anisotropyMap,re=de&&!!_.clearcoatMap,se=de&&!!_.clearcoatNormalMap,ue=de&&!!_.clearcoatRoughnessMap,j=E&&!!_.iridescenceMap,Q=E&&!!_.iridescenceThicknessMap,_e=b&&!!_.sheenColorMap,Se=b&&!!_.sheenRoughnessMap,le=!!_.specularMap,ae=!!_.specularColorMap,Fe=!!_.specularIntensityMap,Ve=G&&!!_.transmissionMap,Ke=G&&!!_.thicknessMap,O=!!_.gradientMap,oe=!!_.alphaMap,Z=_.alphaTest>0,ye=!!_.alphaHash,ce=!!_.extensions,ie=xn;_.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(ie=n.toneMapping);let Ce={shaderID:he,shaderType:_.type,shaderName:_.name,vertexShader:De,fragmentShader:Y,defines:_.defines,customVertexShaderID:z,customFragmentShaderID:$,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:u,batching:xe,batchingColor:xe&&N._colorsTexture!==null,instancing:Me,instancingColor:Me&&N.instanceColor!==null,instancingMorph:Me&&N.morphTexture!==null,outputColorSpace:te===null?n.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:$e.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:Ze,matcap:Ue,envMap:qe,envMapMode:qe&&ee.mapping,envMapCubeUVHeight:ne,aoMap:Qe,lightMap:Oe,bumpMap:it,normalMap:nt,displacementMap:jt,emissiveMap:F,normalMapObjectSpace:nt&&_.normalMapType===Xu,normalMapTangentSpace:nt&&_.normalMapType===No,packedNormalMap:nt&&_.normalMapType===No&&oy(_.normalMap.format),metalnessMap:Mt,roughnessMap:Ye,anisotropy:ht,anisotropyMap:K,clearcoat:de,clearcoatMap:re,clearcoatNormalMap:se,clearcoatRoughnessMap:ue,dispersion:mt,iridescence:E,iridescenceMap:j,iridescenceThicknessMap:Q,sheen:b,sheenColorMap:_e,sheenRoughnessMap:Se,specularMap:le,specularColorMap:ae,specularIntensityMap:Fe,transmission:G,transmissionMap:Ve,thicknessMap:Ke,gradientMap:O,opaque:_.transparent===!1&&_.blending===Ai&&_.alphaToCoverage===!1,alphaMap:oe,alphaTest:Z,alphaHash:ye,combine:_.combine,mapUv:Ze&&m(_.map.channel),aoMapUv:Qe&&m(_.aoMap.channel),lightMapUv:Oe&&m(_.lightMap.channel),bumpMapUv:it&&m(_.bumpMap.channel),normalMapUv:nt&&m(_.normalMap.channel),displacementMapUv:jt&&m(_.displacementMap.channel),emissiveMapUv:F&&m(_.emissiveMap.channel),metalnessMapUv:Mt&&m(_.metalnessMap.channel),roughnessMapUv:Ye&&m(_.roughnessMap.channel),anisotropyMapUv:K&&m(_.anisotropyMap.channel),clearcoatMapUv:re&&m(_.clearcoatMap.channel),clearcoatNormalMapUv:se&&m(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ue&&m(_.clearcoatRoughnessMap.channel),iridescenceMapUv:j&&m(_.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&m(_.iridescenceThicknessMap.channel),sheenColorMapUv:_e&&m(_.sheenColorMap.channel),sheenRoughnessMapUv:Se&&m(_.sheenRoughnessMap.channel),specularMapUv:le&&m(_.specularMap.channel),specularColorMapUv:ae&&m(_.specularColorMap.channel),specularIntensityMapUv:Fe&&m(_.specularIntensityMap.channel),transmissionMapUv:Ve&&m(_.transmissionMap.channel),thicknessMapUv:Ke&&m(_.thicknessMap.channel),alphaMapUv:oe&&m(_.alphaMap.channel),vertexTangents:!!R.attributes.tangent&&(nt||ht),vertexNormals:!!R.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!R.attributes.uv&&(Ze||oe),fog:!!I,useFog:_.fog===!0,fogExp2:!!I&&I.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||R.attributes.normal===void 0&&nt===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:ve,skinning:N.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:fe,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numLightProbeGrids:V.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:_.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:ie,decodeVideoTexture:Ze&&_.map.isVideoTexture===!0&&$e.getTransfer(_.map.colorSpace)===et,decodeVideoTextureEmissive:F&&_.emissiveMap.isVideoTexture===!0&&$e.getTransfer(_.emissiveMap.colorSpace)===et,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===Dn,flipSided:_.side===Vt,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:ce&&_.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ce&&_.extensions.multiDraw===!0||xe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function g(_){let C=[];if(_.shaderID?C.push(_.shaderID):(C.push(_.customVertexShaderID),C.push(_.customFragmentShaderID)),_.defines!==void 0)for(let D in _.defines)C.push(D),C.push(_.defines[D]);return _.isRawShaderMaterial===!1&&(f(C,_),v(C,_),C.push(n.outputColorSpace)),C.push(_.customProgramCacheKey),C.join()}function f(_,C){_.push(C.precision),_.push(C.outputColorSpace),_.push(C.envMapMode),_.push(C.envMapCubeUVHeight),_.push(C.mapUv),_.push(C.alphaMapUv),_.push(C.lightMapUv),_.push(C.aoMapUv),_.push(C.bumpMapUv),_.push(C.normalMapUv),_.push(C.displacementMapUv),_.push(C.emissiveMapUv),_.push(C.metalnessMapUv),_.push(C.roughnessMapUv),_.push(C.anisotropyMapUv),_.push(C.clearcoatMapUv),_.push(C.clearcoatNormalMapUv),_.push(C.clearcoatRoughnessMapUv),_.push(C.iridescenceMapUv),_.push(C.iridescenceThicknessMapUv),_.push(C.sheenColorMapUv),_.push(C.sheenRoughnessMapUv),_.push(C.specularMapUv),_.push(C.specularColorMapUv),_.push(C.specularIntensityMapUv),_.push(C.transmissionMapUv),_.push(C.thicknessMapUv),_.push(C.combine),_.push(C.fogExp2),_.push(C.sizeAttenuation),_.push(C.morphTargetsCount),_.push(C.morphAttributeCount),_.push(C.numDirLights),_.push(C.numPointLights),_.push(C.numSpotLights),_.push(C.numSpotLightMaps),_.push(C.numHemiLights),_.push(C.numRectAreaLights),_.push(C.numDirLightShadows),_.push(C.numPointLightShadows),_.push(C.numSpotLightShadows),_.push(C.numSpotLightShadowsWithMaps),_.push(C.numLightProbes),_.push(C.shadowMapType),_.push(C.toneMapping),_.push(C.numClippingPlanes),_.push(C.numClipIntersection),_.push(C.depthPacking)}function v(_,C){a.disableAll(),C.instancing&&a.enable(0),C.instancingColor&&a.enable(1),C.instancingMorph&&a.enable(2),C.matcap&&a.enable(3),C.envMap&&a.enable(4),C.normalMapObjectSpace&&a.enable(5),C.normalMapTangentSpace&&a.enable(6),C.clearcoat&&a.enable(7),C.iridescence&&a.enable(8),C.alphaTest&&a.enable(9),C.vertexColors&&a.enable(10),C.vertexAlphas&&a.enable(11),C.vertexUv1s&&a.enable(12),C.vertexUv2s&&a.enable(13),C.vertexUv3s&&a.enable(14),C.vertexTangents&&a.enable(15),C.anisotropy&&a.enable(16),C.alphaHash&&a.enable(17),C.batching&&a.enable(18),C.dispersion&&a.enable(19),C.batchingColor&&a.enable(20),C.gradientMap&&a.enable(21),C.packedNormalMap&&a.enable(22),C.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),C.fog&&a.enable(0),C.useFog&&a.enable(1),C.flatShading&&a.enable(2),C.logarithmicDepthBuffer&&a.enable(3),C.reversedDepthBuffer&&a.enable(4),C.skinning&&a.enable(5),C.morphTargets&&a.enable(6),C.morphNormals&&a.enable(7),C.morphColors&&a.enable(8),C.premultipliedAlpha&&a.enable(9),C.shadowMapEnabled&&a.enable(10),C.doubleSided&&a.enable(11),C.flipSided&&a.enable(12),C.useDepthPacking&&a.enable(13),C.dithering&&a.enable(14),C.transmission&&a.enable(15),C.sheen&&a.enable(16),C.opaque&&a.enable(17),C.pointsUvs&&a.enable(18),C.decodeVideoTexture&&a.enable(19),C.decodeVideoTextureEmissive&&a.enable(20),C.alphaToCoverage&&a.enable(21),C.numLightProbeGrids>0&&a.enable(22),_.push(a.mask)}function M(_){let C=p[_.type],D;if(C){let P=On[C];D=rf.clone(P.uniforms)}else D=_.uniforms;return D}function S(_,C){let D=h.get(C);return D!==void 0?++D.usedTimes:(D=new sy(n,C,_,r),c.push(D),h.set(C,D)),D}function w(_){if(--_.usedTimes===0){let C=c.indexOf(_);c[C]=c[c.length-1],c.pop(),h.delete(_.cacheKey),_.destroy()}}function y(_){o.remove(_)}function A(){o.dispose()}return{getParameters:x,getProgramCacheKey:g,getUniforms:M,acquireProgram:S,releaseProgram:w,releaseShaderCache:y,programs:c,dispose:A}}function cy(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function r(a,o,l){n.get(a)[o]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function hy(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function wf(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Tf(){let n=[],e=0,t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(u){let p=0;return u.isInstancedMesh&&(p+=2),u.isSkinnedMesh&&(p+=1),p}function o(u,p,m,x,g,f){let v=n[e];return v===void 0?(v={id:u.id,object:u,geometry:p,material:m,materialVariant:a(u),groupOrder:x,renderOrder:u.renderOrder,z:g,group:f},n[e]=v):(v.id=u.id,v.object=u,v.geometry=p,v.material=m,v.materialVariant=a(u),v.groupOrder=x,v.renderOrder=u.renderOrder,v.z=g,v.group=f),e++,v}function l(u,p,m,x,g,f){let v=o(u,p,m,x,g,f);m.transmission>0?i.push(v):m.transparent===!0?r.push(v):t.push(v)}function c(u,p,m,x,g,f){let v=o(u,p,m,x,g,f);m.transmission>0?i.unshift(v):m.transparent===!0?r.unshift(v):t.unshift(v)}function h(u,p){t.length>1&&t.sort(u||hy),i.length>1&&i.sort(p||wf),r.length>1&&r.sort(p||wf)}function d(){for(let u=e,p=n.length;u<p;u++){let m=n[u];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:c,finish:d,sort:h}}function uy(){let n=new WeakMap;function e(i,r){let s=n.get(i),a;return s===void 0?(a=new Tf,n.set(i,[a])):r>=s.length?(a=new Tf,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function fy(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new Xe};break;case"SpotLight":t={position:new U,direction:new U,color:new Xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new Xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new Xe,groundColor:new Xe};break;case"RectAreaLight":t={color:new Xe,position:new U,halfWidth:new U,halfHeight:new U};break}return n[e.id]=t,t}}}function dy(){let n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}var py=0;function my(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function gy(n){let e=new fy,t=dy(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new U);let r=new U,s=new ct,a=new ct;function o(c){let h=0,d=0,u=0;for(let C=0;C<9;C++)i.probe[C].set(0,0,0);let p=0,m=0,x=0,g=0,f=0,v=0,M=0,S=0,w=0,y=0,A=0;c.sort(my);for(let C=0,D=c.length;C<D;C++){let P=c[C],N=P.color,V=P.intensity,I=P.distance,R=null;if(P.shadow&&P.shadow.map&&(P.shadow.map.texture.format===gi?R=P.shadow.map.texture:R=P.shadow.map.depthTexture||P.shadow.map.texture),P.isAmbientLight)h+=N.r*V,d+=N.g*V,u+=N.b*V;else if(P.isLightProbe){for(let L=0;L<9;L++)i.probe[L].addScaledVector(P.sh.coefficients[L],V);A++}else if(P.isDirectionalLight){let L=e.get(P);if(L.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){let k=P.shadow,ee=t.get(P);ee.shadowIntensity=k.intensity,ee.shadowBias=k.bias,ee.shadowNormalBias=k.normalBias,ee.shadowRadius=k.radius,ee.shadowMapSize=k.mapSize,i.directionalShadow[p]=ee,i.directionalShadowMap[p]=R,i.directionalShadowMatrix[p]=P.shadow.matrix,v++}i.directional[p]=L,p++}else if(P.isSpotLight){let L=e.get(P);L.position.setFromMatrixPosition(P.matrixWorld),L.color.copy(N).multiplyScalar(V),L.distance=I,L.coneCos=Math.cos(P.angle),L.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),L.decay=P.decay,i.spot[x]=L;let k=P.shadow;if(P.map&&(i.spotLightMap[w]=P.map,w++,k.updateMatrices(P),P.castShadow&&y++),i.spotLightMatrix[x]=k.matrix,P.castShadow){let ee=t.get(P);ee.shadowIntensity=k.intensity,ee.shadowBias=k.bias,ee.shadowNormalBias=k.normalBias,ee.shadowRadius=k.radius,ee.shadowMapSize=k.mapSize,i.spotShadow[x]=ee,i.spotShadowMap[x]=R,S++}x++}else if(P.isRectAreaLight){let L=e.get(P);L.color.copy(N).multiplyScalar(V),L.halfWidth.set(P.width*.5,0,0),L.halfHeight.set(0,P.height*.5,0),i.rectArea[g]=L,g++}else if(P.isPointLight){let L=e.get(P);if(L.color.copy(P.color).multiplyScalar(P.intensity),L.distance=P.distance,L.decay=P.decay,P.castShadow){let k=P.shadow,ee=t.get(P);ee.shadowIntensity=k.intensity,ee.shadowBias=k.bias,ee.shadowNormalBias=k.normalBias,ee.shadowRadius=k.radius,ee.shadowMapSize=k.mapSize,ee.shadowCameraNear=k.camera.near,ee.shadowCameraFar=k.camera.far,i.pointShadow[m]=ee,i.pointShadowMap[m]=R,i.pointShadowMatrix[m]=P.shadow.matrix,M++}i.point[m]=L,m++}else if(P.isHemisphereLight){let L=e.get(P);L.skyColor.copy(P.color).multiplyScalar(V),L.groundColor.copy(P.groundColor).multiplyScalar(V),i.hemi[f]=L,f++}}g>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=pe.LTC_FLOAT_1,i.rectAreaLTC2=pe.LTC_FLOAT_2):(i.rectAreaLTC1=pe.LTC_HALF_1,i.rectAreaLTC2=pe.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=d,i.ambient[2]=u;let _=i.hash;(_.directionalLength!==p||_.pointLength!==m||_.spotLength!==x||_.rectAreaLength!==g||_.hemiLength!==f||_.numDirectionalShadows!==v||_.numPointShadows!==M||_.numSpotShadows!==S||_.numSpotMaps!==w||_.numLightProbes!==A)&&(i.directional.length=p,i.spot.length=x,i.rectArea.length=g,i.point.length=m,i.hemi.length=f,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=M,i.pointShadowMap.length=M,i.spotShadow.length=S,i.spotShadowMap.length=S,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=M,i.spotLightMatrix.length=S+w-y,i.spotLightMap.length=w,i.numSpotLightShadowsWithMaps=y,i.numLightProbes=A,_.directionalLength=p,_.pointLength=m,_.spotLength=x,_.rectAreaLength=g,_.hemiLength=f,_.numDirectionalShadows=v,_.numPointShadows=M,_.numSpotShadows=S,_.numSpotMaps=w,_.numLightProbes=A,i.version=py++)}function l(c,h){let d=0,u=0,p=0,m=0,x=0,g=h.matrixWorldInverse;for(let f=0,v=c.length;f<v;f++){let M=c[f];if(M.isDirectionalLight){let S=i.directional[d];S.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(g),d++}else if(M.isSpotLight){let S=i.spot[p];S.position.setFromMatrixPosition(M.matrixWorld),S.position.applyMatrix4(g),S.direction.setFromMatrixPosition(M.matrixWorld),r.setFromMatrixPosition(M.target.matrixWorld),S.direction.sub(r),S.direction.transformDirection(g),p++}else if(M.isRectAreaLight){let S=i.rectArea[m];S.position.setFromMatrixPosition(M.matrixWorld),S.position.applyMatrix4(g),a.identity(),s.copy(M.matrixWorld),s.premultiply(g),a.extractRotation(s),S.halfWidth.set(M.width*.5,0,0),S.halfHeight.set(0,M.height*.5,0),S.halfWidth.applyMatrix4(a),S.halfHeight.applyMatrix4(a),m++}else if(M.isPointLight){let S=i.point[u];S.position.setFromMatrixPosition(M.matrixWorld),S.position.applyMatrix4(g),u++}else if(M.isHemisphereLight){let S=i.hemi[x];S.direction.setFromMatrixPosition(M.matrixWorld),S.direction.transformDirection(g),x++}}}return{setup:o,setupView:l,state:i}}function Af(n){let e=new gy(n),t=[],i=[],r=[];function s(u){d.camera=u,t.length=0,i.length=0,r.length=0}function a(u){t.push(u)}function o(u){i.push(u)}function l(u){r.push(u)}function c(){e.setup(t)}function h(u){e.setupView(t,u)}let d={lightsArray:t,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:d,setupLights:c,setupLightsView:h,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function _y(n){let e=new WeakMap;function t(r,s=0){let a=e.get(r),o;return a===void 0?(o=new Af(n),e.set(r,[o])):s>=a.length?(o=new Af(n),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:t,dispose:i}}var xy=`void main() {
|
|
4553
4553
|
gl_Position = vec4( position, 1.0 );
|
|
4554
|
-
}`,
|
|
4554
|
+
}`,vy=`uniform sampler2D shadow_pass;
|
|
4555
4555
|
uniform vec2 resolution;
|
|
4556
4556
|
uniform float radius;
|
|
4557
4557
|
void main() {
|
|
@@ -4576,12 +4576,12 @@ void main() {
|
|
|
4576
4576
|
squared_mean = squared_mean / samples;
|
|
4577
4577
|
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4578
4578
|
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4579
|
-
}`,py=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],my=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],Af=new ct,ms=new U,Lc=new U;function gy(n,e,t){let i=new rr,r=new Te,s=new Te,a=new pt,o=new Da,l=new La,c={},h=t.maxTextureSize,d={[Wn]:Vt,[Vt]:Wn,[Dn]:Dn},u=new nn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Te},radius:{value:4}},vertexShader:fy,fragmentShader:dy}),p=u.clone();p.defines.HORIZONTAL_PASS=1;let m=new Ft;m.setAttribute("position",new zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new Xt(m,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ss;let f=this.type;this.render=function(y,A,_){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||y.length===0)return;this.type===bu&&(Ie("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=ss);let C=n.getRenderTarget(),D=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),N=n.state;N.setBlending(Ln),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);let V=f!==this.type;V&&A.traverse(function(I){I.material&&(Array.isArray(I.material)?I.material.forEach(R=>R.needsUpdate=!0):I.material.needsUpdate=!0)});for(let I=0,R=y.length;I<R;I++){let L=y[I],k=L.shadow;if(k===void 0){Ie("WebGLShadowMap:",L,"has no shadow.");continue}if(k.autoUpdate===!1&&k.needsUpdate===!1)continue;r.copy(k.mapSize);let ee=k.getFrameExtents();r.multiply(ee),s.copy(k.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/ee.x),r.x=s.x*ee.x,k.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/ee.y),r.y=s.y*ee.y,k.mapSize.y=s.y));let ne=n.state.buffers.depth.getReversed();if(k.camera._reversedDepth=ne,k.map===null||V===!0){if(k.map!==null&&(k.map.depthTexture!==null&&(k.map.depthTexture.dispose(),k.map.depthTexture=null),k.map.dispose()),this.type===ur){if(L.isPointLight){Ie("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}k.map=new tn(r.x,r.y,{format:gi,type:Nn,minFilter:Rt,magFilter:Rt,generateMipmaps:!1}),k.map.texture.name=L.name+".shadowMap",k.map.depthTexture=new Yn(r.x,r.y,yn),k.map.depthTexture.name=L.name+".shadowMapDepth",k.map.depthTexture.format=Pn,k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=Et,k.map.depthTexture.magFilter=Et}else L.isPointLight?(k.map=new zo(r.x),k.map.depthTexture=new Sa(r.x,vn)):(k.map=new tn(r.x,r.y),k.map.depthTexture=new Yn(r.x,r.y,vn)),k.map.depthTexture.name=L.name+".shadowMap",k.map.depthTexture.format=Pn,this.type===ss?(k.map.depthTexture.compareFunction=ne?Fo:Uo,k.map.depthTexture.minFilter=Rt,k.map.depthTexture.magFilter=Rt):(k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=Et,k.map.depthTexture.magFilter=Et);k.camera.updateProjectionMatrix()}let he=k.map.isWebGLCubeRenderTarget?6:1;for(let q=0;q<he;q++){if(k.map.isWebGLCubeRenderTarget)n.setRenderTarget(k.map,q),n.clear();else{q===0&&(n.setRenderTarget(k.map),n.clear());let J=k.getViewport(q);a.set(s.x*J.x,s.y*J.y,s.x*J.z,s.y*J.w),N.viewport(a)}if(L.isPointLight){let J=k.camera,fe=k.matrix,De=L.distance||J.far;De!==J.far&&(J.far=De,J.updateProjectionMatrix()),ms.setFromMatrixPosition(L.matrixWorld),J.position.copy(ms),Lc.copy(J.position),Lc.add(py[q]),J.up.copy(my[q]),J.lookAt(Lc),J.updateMatrixWorld(),fe.makeTranslation(-ms.x,-ms.y,-ms.z),Af.multiplyMatrices(J.projectionMatrix,J.matrixWorldInverse),k._frustum.setFromProjectionMatrix(Af,J.coordinateSystem,J.reversedDepth)}else k.updateMatrices(L);i=k.getFrustum(),S(A,_,k.camera,L,this.type)}k.isPointLightShadow!==!0&&this.type===ur&&v(k,_),k.needsUpdate=!1}f=this.type,g.needsUpdate=!1,n.setRenderTarget(C,D,P)};function v(y,A){let _=e.update(x);u.defines.VSM_SAMPLES!==y.blurSamples&&(u.defines.VSM_SAMPLES=y.blurSamples,p.defines.VSM_SAMPLES=y.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),y.mapPass===null&&(y.mapPass=new tn(r.x,r.y,{format:gi,type:Nn})),u.uniforms.shadow_pass.value=y.map.depthTexture,u.uniforms.resolution.value=y.mapSize,u.uniforms.radius.value=y.radius,n.setRenderTarget(y.mapPass),n.clear(),n.renderBufferDirect(A,null,_,u,x,null),p.uniforms.shadow_pass.value=y.mapPass.texture,p.uniforms.resolution.value=y.mapSize,p.uniforms.radius.value=y.radius,n.setRenderTarget(y.map),n.clear(),n.renderBufferDirect(A,null,_,p,x,null)}function M(y,A,_,C){let D=null,P=_.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(P!==void 0)D=P;else if(D=_.isPointLight===!0?l:o,n.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){let N=D.uuid,V=A.uuid,I=c[N];I===void 0&&(I={},c[N]=I);let R=I[V];R===void 0&&(R=D.clone(),I[V]=R,A.addEventListener("dispose",w)),D=R}if(D.visible=A.visible,D.wireframe=A.wireframe,C===ur?D.side=A.shadowSide!==null?A.shadowSide:A.side:D.side=A.shadowSide!==null?A.shadowSide:d[A.side],D.alphaMap=A.alphaMap,D.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,D.map=A.map,D.clipShadows=A.clipShadows,D.clippingPlanes=A.clippingPlanes,D.clipIntersection=A.clipIntersection,D.displacementMap=A.displacementMap,D.displacementScale=A.displacementScale,D.displacementBias=A.displacementBias,D.wireframeLinewidth=A.wireframeLinewidth,D.linewidth=A.linewidth,_.isPointLight===!0&&D.isMeshDistanceMaterial===!0){let N=n.properties.get(D);N.light=_}return D}function S(y,A,_,C,D){if(y.visible===!1)return;if(y.layers.test(A.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&D===ur)&&(!y.frustumCulled||i.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,y.matrixWorld);let V=e.update(y),I=y.material;if(Array.isArray(I)){let R=V.groups;for(let L=0,k=R.length;L<k;L++){let ee=R[L],ne=I[ee.materialIndex];if(ne&&ne.visible){let he=M(y,ne,C,D);y.onBeforeShadow(n,y,A,_,V,he,ee),n.renderBufferDirect(_,null,V,he,y,ee),y.onAfterShadow(n,y,A,_,V,he,ee)}}}else if(I.visible){let R=M(y,I,C,D);y.onBeforeShadow(n,y,A,_,V,R,null),n.renderBufferDirect(_,null,V,R,y,null),y.onAfterShadow(n,y,A,_,V,R,null)}}let N=y.children;for(let V=0,I=N.length;V<I;V++)S(N[V],A,_,C,D)}function w(y){y.target.removeEventListener("dispose",w);for(let _ in c){let C=c[_],D=y.target.uuid;D in C&&(C[D].dispose(),delete C[D])}}}function _y(n,e){function t(){let F=!1,oe=new pt,Z=null,ye=new pt(0,0,0,0);return{setMask:function(ce){Z!==ce&&!F&&(n.colorMask(ce,ce,ce,ce),Z=ce)},setLocked:function(ce){F=ce},setClear:function(ce,ie,Ce,ke,xt){xt===!0&&(ce*=ke,ie*=ke,Ce*=ke),oe.set(ce,ie,Ce,ke),ye.equals(oe)===!1&&(n.clearColor(ce,ie,Ce,ke),ye.copy(oe))},reset:function(){F=!1,Z=null,ye.set(-1,0,0,0)}}}function i(){let F=!1,oe=!1,Z=null,ye=null,ce=null;return{setReversed:function(ie){if(oe!==ie){let Ce=e.get("EXT_clip_control");ie?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),oe=ie;let ke=ce;ce=null,this.setClear(ke)}},getReversed:function(){return oe},setTest:function(ie){ie?te(n.DEPTH_TEST):ve(n.DEPTH_TEST)},setMask:function(ie){Z!==ie&&!F&&(n.depthMask(ie),Z=ie)},setFunc:function(ie){if(oe&&(ie=ef[ie]),ye!==ie){switch(ie){case aa:n.depthFunc(n.NEVER);break;case oa:n.depthFunc(n.ALWAYS);break;case la:n.depthFunc(n.LESS);break;case Ei:n.depthFunc(n.LEQUAL);break;case ca:n.depthFunc(n.EQUAL);break;case ha:n.depthFunc(n.GEQUAL);break;case ua:n.depthFunc(n.GREATER);break;case fa:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}ye=ie}},setLocked:function(ie){F=ie},setClear:function(ie){ce!==ie&&(ce=ie,oe&&(ie=1-ie),n.clearDepth(ie))},reset:function(){F=!1,Z=null,ye=null,ce=null,oe=!1}}}function r(){let F=!1,oe=null,Z=null,ye=null,ce=null,ie=null,Ce=null,ke=null,xt=null;return{setTest:function(rt){F||(rt?te(n.STENCIL_TEST):ve(n.STENCIL_TEST))},setMask:function(rt){oe!==rt&&!F&&(n.stencilMask(rt),oe=rt)},setFunc:function(rt,On,Tn){(Z!==rt||ye!==On||ce!==Tn)&&(n.stencilFunc(rt,On,Tn),Z=rt,ye=On,ce=Tn)},setOp:function(rt,On,Tn){(ie!==rt||Ce!==On||ke!==Tn)&&(n.stencilOp(rt,On,Tn),ie=rt,Ce=On,ke=Tn)},setLocked:function(rt){F=rt},setClear:function(rt){xt!==rt&&(n.clearStencil(rt),xt=rt)},reset:function(){F=!1,oe=null,Z=null,ye=null,ce=null,ie=null,Ce=null,ke=null,xt=null}}}let s=new t,a=new i,o=new r,l=new WeakMap,c=new WeakMap,h={},d={},u={},p=new WeakMap,m=[],x=null,g=!1,f=null,v=null,M=null,S=null,w=null,y=null,A=null,_=new Xe(0,0,0),C=0,D=!1,P=null,N=null,V=null,I=null,R=null,L=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS),k=!1,ee=0,ne=n.getParameter(n.VERSION);ne.indexOf("WebGL")!==-1?(ee=parseFloat(/^WebGL (\d)/.exec(ne)[1]),k=ee>=1):ne.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),k=ee>=2);let he=null,q={},J=n.getParameter(n.SCISSOR_BOX),fe=n.getParameter(n.VIEWPORT),De=new pt().fromArray(J),Y=new pt().fromArray(fe);function z(F,oe,Z,ye){let ce=new Uint8Array(4),ie=n.createTexture();n.bindTexture(F,ie),n.texParameteri(F,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(F,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ce=0;Ce<Z;Ce++)F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY?n.texImage3D(oe,0,n.RGBA,1,1,ye,0,n.RGBA,n.UNSIGNED_BYTE,ce):n.texImage2D(oe+Ce,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,ce);return ie}let $={};$[n.TEXTURE_2D]=z(n.TEXTURE_2D,n.TEXTURE_2D,1),$[n.TEXTURE_CUBE_MAP]=z(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),$[n.TEXTURE_2D_ARRAY]=z(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),$[n.TEXTURE_3D]=z(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),te(n.DEPTH_TEST),a.setFunc(Ei),it(!1),nt(jl),te(n.CULL_FACE),Qe(Ln);function te(F){h[F]!==!0&&(n.enable(F),h[F]=!0)}function ve(F){h[F]!==!1&&(n.disable(F),h[F]=!1)}function Me(F,oe){return u[F]!==oe?(n.bindFramebuffer(F,oe),u[F]=oe,F===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=oe),F===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=oe),!0):!1}function xe(F,oe){let Z=m,ye=!1;if(F){Z=p.get(oe),Z===void 0&&(Z=[],p.set(oe,Z));let ce=F.textures;if(Z.length!==ce.length||Z[0]!==n.COLOR_ATTACHMENT0){for(let ie=0,Ce=ce.length;ie<Ce;ie++)Z[ie]=n.COLOR_ATTACHMENT0+ie;Z.length=ce.length,ye=!0}}else Z[0]!==n.BACK&&(Z[0]=n.BACK,ye=!0);ye&&n.drawBuffers(Z)}function Ze(F){return x!==F?(n.useProgram(F),x=F,!0):!1}let Ue={[ai]:n.FUNC_ADD,[Su]:n.FUNC_SUBTRACT,[wu]:n.FUNC_REVERSE_SUBTRACT};Ue[Tu]=n.MIN,Ue[Au]=n.MAX;let qe={[Eu]:n.ZERO,[Cu]:n.ONE,[Ru]:n.SRC_COLOR,[ra]:n.SRC_ALPHA,[Uu]:n.SRC_ALPHA_SATURATE,[Lu]:n.DST_COLOR,[Iu]:n.DST_ALPHA,[Pu]:n.ONE_MINUS_SRC_COLOR,[sa]:n.ONE_MINUS_SRC_ALPHA,[Nu]:n.ONE_MINUS_DST_COLOR,[Du]:n.ONE_MINUS_DST_ALPHA,[Fu]:n.CONSTANT_COLOR,[Ou]:n.ONE_MINUS_CONSTANT_COLOR,[Bu]:n.CONSTANT_ALPHA,[ku]:n.ONE_MINUS_CONSTANT_ALPHA};function Qe(F,oe,Z,ye,ce,ie,Ce,ke,xt,rt){if(F===Ln){g===!0&&(ve(n.BLEND),g=!1);return}if(g===!1&&(te(n.BLEND),g=!0),F!==Mu){if(F!==f||rt!==D){if((v!==ai||w!==ai)&&(n.blendEquation(n.FUNC_ADD),v=ai,w=ai),rt)switch(F){case Ai:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Zl:n.blendFunc(n.ONE,n.ONE);break;case Jl:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Kl:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:Le("WebGLState: Invalid blending: ",F);break}else switch(F){case Ai:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Zl:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Jl:Le("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Kl:Le("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Le("WebGLState: Invalid blending: ",F);break}M=null,S=null,y=null,A=null,_.set(0,0,0),C=0,f=F,D=rt}return}ce=ce||oe,ie=ie||Z,Ce=Ce||ye,(oe!==v||ce!==w)&&(n.blendEquationSeparate(Ue[oe],Ue[ce]),v=oe,w=ce),(Z!==M||ye!==S||ie!==y||Ce!==A)&&(n.blendFuncSeparate(qe[Z],qe[ye],qe[ie],qe[Ce]),M=Z,S=ye,y=ie,A=Ce),(ke.equals(_)===!1||xt!==C)&&(n.blendColor(ke.r,ke.g,ke.b,xt),_.copy(ke),C=xt),f=F,D=!1}function Fe(F,oe){F.side===Dn?ve(n.CULL_FACE):te(n.CULL_FACE);let Z=F.side===Vt;oe&&(Z=!Z),it(Z),F.blending===Ai&&F.transparent===!1?Qe(Ln):Qe(F.blending,F.blendEquation,F.blendSrc,F.blendDst,F.blendEquationAlpha,F.blendSrcAlpha,F.blendDstAlpha,F.blendColor,F.blendAlpha,F.premultipliedAlpha),a.setFunc(F.depthFunc),a.setTest(F.depthTest),a.setMask(F.depthWrite),s.setMask(F.colorWrite);let ye=F.stencilWrite;o.setTest(ye),ye&&(o.setMask(F.stencilWriteMask),o.setFunc(F.stencilFunc,F.stencilRef,F.stencilFuncMask),o.setOp(F.stencilFail,F.stencilZFail,F.stencilZPass)),O(F.polygonOffset,F.polygonOffsetFactor,F.polygonOffsetUnits),F.alphaToCoverage===!0?te(n.SAMPLE_ALPHA_TO_COVERAGE):ve(n.SAMPLE_ALPHA_TO_COVERAGE)}function it(F){P!==F&&(F?n.frontFace(n.CW):n.frontFace(n.CCW),P=F)}function nt(F){F!==vu?(te(n.CULL_FACE),F!==N&&(F===jl?n.cullFace(n.BACK):F===yu?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):ve(n.CULL_FACE),N=F}function jt(F){F!==V&&(k&&n.lineWidth(F),V=F)}function O(F,oe,Z){F?(te(n.POLYGON_OFFSET_FILL),(I!==oe||R!==Z)&&(I=oe,R=Z,a.getReversed()&&(oe=-oe),n.polygonOffset(oe,Z))):ve(n.POLYGON_OFFSET_FILL)}function Mt(F){F?te(n.SCISSOR_TEST):ve(n.SCISSOR_TEST)}function Ye(F){F===void 0&&(F=n.TEXTURE0+L-1),he!==F&&(n.activeTexture(F),he=F)}function ht(F,oe,Z){Z===void 0&&(he===null?Z=n.TEXTURE0+L-1:Z=he);let ye=q[Z];ye===void 0&&(ye={type:void 0,texture:void 0},q[Z]=ye),(ye.type!==F||ye.texture!==oe)&&(he!==Z&&(n.activeTexture(Z),he=Z),n.bindTexture(F,oe||$[F]),ye.type=F,ye.texture=oe)}function de(){let F=q[he];F!==void 0&&F.type!==void 0&&(n.bindTexture(F.type,null),F.type=void 0,F.texture=void 0)}function mt(){try{n.compressedTexImage2D(...arguments)}catch(F){Le("WebGLState:",F)}}function E(){try{n.compressedTexImage3D(...arguments)}catch(F){Le("WebGLState:",F)}}function b(){try{n.texSubImage2D(...arguments)}catch(F){Le("WebGLState:",F)}}function G(){try{n.texSubImage3D(...arguments)}catch(F){Le("WebGLState:",F)}}function K(){try{n.compressedTexSubImage2D(...arguments)}catch(F){Le("WebGLState:",F)}}function re(){try{n.compressedTexSubImage3D(...arguments)}catch(F){Le("WebGLState:",F)}}function se(){try{n.texStorage2D(...arguments)}catch(F){Le("WebGLState:",F)}}function ue(){try{n.texStorage3D(...arguments)}catch(F){Le("WebGLState:",F)}}function j(){try{n.texImage2D(...arguments)}catch(F){Le("WebGLState:",F)}}function Q(){try{n.texImage3D(...arguments)}catch(F){Le("WebGLState:",F)}}function _e(F){return d[F]!==void 0?d[F]:n.getParameter(F)}function Se(F,oe){d[F]!==oe&&(n.pixelStorei(F,oe),d[F]=oe)}function le(F){De.equals(F)===!1&&(n.scissor(F.x,F.y,F.z,F.w),De.copy(F))}function ae(F){Y.equals(F)===!1&&(n.viewport(F.x,F.y,F.z,F.w),Y.copy(F))}function Oe(F,oe){let Z=c.get(oe);Z===void 0&&(Z=new WeakMap,c.set(oe,Z));let ye=Z.get(F);ye===void 0&&(ye=n.getUniformBlockIndex(oe,F.name),Z.set(F,ye))}function Ve(F,oe){let ye=c.get(oe).get(F);l.get(oe)!==ye&&(n.uniformBlockBinding(oe,ye,F.__bindingPointIndex),l.set(oe,ye))}function Ke(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),h={},d={},he=null,q={},u={},p=new WeakMap,m=[],x=null,g=!1,f=null,v=null,M=null,S=null,w=null,y=null,A=null,_=new Xe(0,0,0),C=0,D=!1,P=null,N=null,V=null,I=null,R=null,De.set(0,0,n.canvas.width,n.canvas.height),Y.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:te,disable:ve,bindFramebuffer:Me,drawBuffers:xe,useProgram:Ze,setBlending:Qe,setMaterial:Fe,setFlipSided:it,setCullFace:nt,setLineWidth:jt,setPolygonOffset:O,setScissorTest:Mt,activeTexture:Ye,bindTexture:ht,unbindTexture:de,compressedTexImage2D:mt,compressedTexImage3D:E,texImage2D:j,texImage3D:Q,pixelStorei:Se,getParameter:_e,updateUBOMapping:Oe,uniformBlockBinding:Ve,texStorage2D:se,texStorage3D:ue,texSubImage2D:b,texSubImage3D:G,compressedTexSubImage2D:K,compressedTexSubImage3D:re,scissor:le,viewport:ae,reset:Ke}}function xy(n,e,t,i,r,s,a){let o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Te,h=new WeakMap,d=new Set,u,p=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(E,b){return m?new OffscreenCanvas(E,b):Or("canvas")}function g(E,b,G){let K=1,re=mt(E);if((re.width>G||re.height>G)&&(K=G/Math.max(re.width,re.height)),K<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){let se=Math.floor(K*re.width),ue=Math.floor(K*re.height);u===void 0&&(u=x(se,ue));let j=b?x(se,ue):u;return j.width=se,j.height=ue,j.getContext("2d").drawImage(E,0,0,se,ue),Ie("WebGLRenderer: Texture has been resized from ("+re.width+"x"+re.height+") to ("+se+"x"+ue+")."),j}else return"data"in E&&Ie("WebGLRenderer: Image in DataTexture is too big ("+re.width+"x"+re.height+")."),E;return E}function f(E){return E.generateMipmaps}function v(E){n.generateMipmap(E)}function M(E){return E.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:E.isWebGL3DRenderTarget?n.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function S(E,b,G,K,re,se=!1){if(E!==null){if(n[E]!==void 0)return n[E];Ie("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let ue;K&&(ue=e.get("EXT_texture_norm16"),ue||Ie("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let j=b;if(b===n.RED&&(G===n.FLOAT&&(j=n.R32F),G===n.HALF_FLOAT&&(j=n.R16F),G===n.UNSIGNED_BYTE&&(j=n.R8),G===n.UNSIGNED_SHORT&&ue&&(j=ue.R16_EXT),G===n.SHORT&&ue&&(j=ue.R16_SNORM_EXT)),b===n.RED_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.R8UI),G===n.UNSIGNED_SHORT&&(j=n.R16UI),G===n.UNSIGNED_INT&&(j=n.R32UI),G===n.BYTE&&(j=n.R8I),G===n.SHORT&&(j=n.R16I),G===n.INT&&(j=n.R32I)),b===n.RG&&(G===n.FLOAT&&(j=n.RG32F),G===n.HALF_FLOAT&&(j=n.RG16F),G===n.UNSIGNED_BYTE&&(j=n.RG8),G===n.UNSIGNED_SHORT&&ue&&(j=ue.RG16_EXT),G===n.SHORT&&ue&&(j=ue.RG16_SNORM_EXT)),b===n.RG_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.RG8UI),G===n.UNSIGNED_SHORT&&(j=n.RG16UI),G===n.UNSIGNED_INT&&(j=n.RG32UI),G===n.BYTE&&(j=n.RG8I),G===n.SHORT&&(j=n.RG16I),G===n.INT&&(j=n.RG32I)),b===n.RGB_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.RGB8UI),G===n.UNSIGNED_SHORT&&(j=n.RGB16UI),G===n.UNSIGNED_INT&&(j=n.RGB32UI),G===n.BYTE&&(j=n.RGB8I),G===n.SHORT&&(j=n.RGB16I),G===n.INT&&(j=n.RGB32I)),b===n.RGBA_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.RGBA8UI),G===n.UNSIGNED_SHORT&&(j=n.RGBA16UI),G===n.UNSIGNED_INT&&(j=n.RGBA32UI),G===n.BYTE&&(j=n.RGBA8I),G===n.SHORT&&(j=n.RGBA16I),G===n.INT&&(j=n.RGBA32I)),b===n.RGB&&(G===n.UNSIGNED_SHORT&&ue&&(j=ue.RGB16_EXT),G===n.SHORT&&ue&&(j=ue.RGB16_SNORM_EXT),G===n.UNSIGNED_INT_5_9_9_9_REV&&(j=n.RGB9_E5),G===n.UNSIGNED_INT_10F_11F_11F_REV&&(j=n.R11F_G11F_B10F)),b===n.RGBA){let Q=se?Fr:$e.getTransfer(re);G===n.FLOAT&&(j=n.RGBA32F),G===n.HALF_FLOAT&&(j=n.RGBA16F),G===n.UNSIGNED_BYTE&&(j=Q===et?n.SRGB8_ALPHA8:n.RGBA8),G===n.UNSIGNED_SHORT&&ue&&(j=ue.RGBA16_EXT),G===n.SHORT&&ue&&(j=ue.RGBA16_SNORM_EXT),G===n.UNSIGNED_SHORT_4_4_4_4&&(j=n.RGBA4),G===n.UNSIGNED_SHORT_5_5_5_1&&(j=n.RGB5_A1)}return(j===n.R16F||j===n.R32F||j===n.RG16F||j===n.RG32F||j===n.RGBA16F||j===n.RGBA32F)&&e.get("EXT_color_buffer_float"),j}function w(E,b){let G;return E?b===null||b===vn||b===dr?G=n.DEPTH24_STENCIL8:b===yn?G=n.DEPTH32F_STENCIL8:b===fr&&(G=n.DEPTH24_STENCIL8,Ie("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===vn||b===dr?G=n.DEPTH_COMPONENT24:b===yn?G=n.DEPTH_COMPONENT32F:b===fr&&(G=n.DEPTH_COMPONENT16),G}function y(E,b){return f(E)===!0||E.isFramebufferTexture&&E.minFilter!==Et&&E.minFilter!==Rt?Math.log2(Math.max(b.width,b.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?b.mipmaps.length:1}function A(E){let b=E.target;b.removeEventListener("dispose",A),C(b),b.isVideoTexture&&h.delete(b),b.isHTMLTexture&&d.delete(b)}function _(E){let b=E.target;b.removeEventListener("dispose",_),P(b)}function C(E){let b=i.get(E);if(b.__webglInit===void 0)return;let G=E.source,K=p.get(G);if(K){let re=K[b.__cacheKey];re.usedTimes--,re.usedTimes===0&&D(E),Object.keys(K).length===0&&p.delete(G)}i.remove(E)}function D(E){let b=i.get(E);n.deleteTexture(b.__webglTexture);let G=E.source,K=p.get(G);delete K[b.__cacheKey],a.memory.textures--}function P(E){let b=i.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),i.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let K=0;K<6;K++){if(Array.isArray(b.__webglFramebuffer[K]))for(let re=0;re<b.__webglFramebuffer[K].length;re++)n.deleteFramebuffer(b.__webglFramebuffer[K][re]);else n.deleteFramebuffer(b.__webglFramebuffer[K]);b.__webglDepthbuffer&&n.deleteRenderbuffer(b.__webglDepthbuffer[K])}else{if(Array.isArray(b.__webglFramebuffer))for(let K=0;K<b.__webglFramebuffer.length;K++)n.deleteFramebuffer(b.__webglFramebuffer[K]);else n.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&n.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&n.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRenderbuffer)for(let K=0;K<b.__webglColorRenderbuffer.length;K++)b.__webglColorRenderbuffer[K]&&n.deleteRenderbuffer(b.__webglColorRenderbuffer[K]);b.__webglDepthRenderbuffer&&n.deleteRenderbuffer(b.__webglDepthRenderbuffer)}let G=E.textures;for(let K=0,re=G.length;K<re;K++){let se=i.get(G[K]);se.__webglTexture&&(n.deleteTexture(se.__webglTexture),a.memory.textures--),i.remove(G[K])}i.remove(E)}let N=0;function V(){N=0}function I(){return N}function R(E){N=E}function L(){let E=N;return E>=r.maxTextures&&Ie("WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+r.maxTextures),N+=1,E}function k(E){let b=[];return b.push(E.wrapS),b.push(E.wrapT),b.push(E.wrapR||0),b.push(E.magFilter),b.push(E.minFilter),b.push(E.anisotropy),b.push(E.internalFormat),b.push(E.format),b.push(E.type),b.push(E.generateMipmaps),b.push(E.premultiplyAlpha),b.push(E.flipY),b.push(E.unpackAlignment),b.push(E.colorSpace),b.join()}function ee(E,b){let G=i.get(E);if(E.isVideoTexture&&ht(E),E.isRenderTargetTexture===!1&&E.isExternalTexture!==!0&&E.version>0&&G.__version!==E.version){let K=E.image;if(K===null)Ie("WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)Ie("WebGLRenderer: Texture marked for update but image is incomplete");else{ve(G,E,b);return}}else E.isExternalTexture&&(G.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,G.__webglTexture,n.TEXTURE0+b)}function ne(E,b){let G=i.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&G.__version!==E.version){ve(G,E,b);return}else E.isExternalTexture&&(G.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,G.__webglTexture,n.TEXTURE0+b)}function he(E,b){let G=i.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&G.__version!==E.version){ve(G,E,b);return}t.bindTexture(n.TEXTURE_3D,G.__webglTexture,n.TEXTURE0+b)}function q(E,b){let G=i.get(E);if(E.isCubeDepthTexture!==!0&&E.version>0&&G.__version!==E.version){Me(G,E,b);return}t.bindTexture(n.TEXTURE_CUBE_MAP,G.__webglTexture,n.TEXTURE0+b)}let J={[da]:n.REPEAT,[Cn]:n.CLAMP_TO_EDGE,[pa]:n.MIRRORED_REPEAT},fe={[Et]:n.NEAREST,[Gu]:n.NEAREST_MIPMAP_NEAREST,[os]:n.NEAREST_MIPMAP_LINEAR,[Rt]:n.LINEAR,[Za]:n.LINEAR_MIPMAP_NEAREST,[pi]:n.LINEAR_MIPMAP_LINEAR},De={[Xu]:n.NEVER,[Zu]:n.ALWAYS,[qu]:n.LESS,[Uo]:n.LEQUAL,[Yu]:n.EQUAL,[Fo]:n.GEQUAL,[$u]:n.GREATER,[ju]:n.NOTEQUAL};function Y(E,b){if(b.type===yn&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===Rt||b.magFilter===Za||b.magFilter===os||b.magFilter===pi||b.minFilter===Rt||b.minFilter===Za||b.minFilter===os||b.minFilter===pi)&&Ie("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(E,n.TEXTURE_WRAP_S,J[b.wrapS]),n.texParameteri(E,n.TEXTURE_WRAP_T,J[b.wrapT]),(E===n.TEXTURE_3D||E===n.TEXTURE_2D_ARRAY)&&n.texParameteri(E,n.TEXTURE_WRAP_R,J[b.wrapR]),n.texParameteri(E,n.TEXTURE_MAG_FILTER,fe[b.magFilter]),n.texParameteri(E,n.TEXTURE_MIN_FILTER,fe[b.minFilter]),b.compareFunction&&(n.texParameteri(E,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(E,n.TEXTURE_COMPARE_FUNC,De[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===Et||b.minFilter!==os&&b.minFilter!==pi||b.type===yn&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||i.get(b).__currentAnisotropy){let G=e.get("EXT_texture_filter_anisotropic");n.texParameterf(E,G.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,r.getMaxAnisotropy())),i.get(b).__currentAnisotropy=b.anisotropy}}}function z(E,b){let G=!1;E.__webglInit===void 0&&(E.__webglInit=!0,b.addEventListener("dispose",A));let K=b.source,re=p.get(K);re===void 0&&(re={},p.set(K,re));let se=k(b);if(se!==E.__cacheKey){re[se]===void 0&&(re[se]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,G=!0),re[se].usedTimes++;let ue=re[E.__cacheKey];ue!==void 0&&(re[E.__cacheKey].usedTimes--,ue.usedTimes===0&&D(b)),E.__cacheKey=se,E.__webglTexture=re[se].texture}return G}function $(E,b,G){return Math.floor(Math.floor(E/G)/b)}function te(E,b,G,K){let se=E.updateRanges;if(se.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,b.width,b.height,G,K,b.data);else{se.sort((Se,le)=>Se.start-le.start);let ue=0;for(let Se=1;Se<se.length;Se++){let le=se[ue],ae=se[Se],Oe=le.start+le.count,Ve=$(ae.start,b.width,4),Ke=$(le.start,b.width,4);ae.start<=Oe+1&&Ve===Ke&&$(ae.start+ae.count-1,b.width,4)===Ve?le.count=Math.max(le.count,ae.start+ae.count-le.start):(++ue,se[ue]=ae)}se.length=ue+1;let j=t.getParameter(n.UNPACK_ROW_LENGTH),Q=t.getParameter(n.UNPACK_SKIP_PIXELS),_e=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,b.width);for(let Se=0,le=se.length;Se<le;Se++){let ae=se[Se],Oe=Math.floor(ae.start/4),Ve=Math.ceil(ae.count/4),Ke=Oe%b.width,F=Math.floor(Oe/b.width),oe=Ve,Z=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(n.UNPACK_SKIP_ROWS,F),t.texSubImage2D(n.TEXTURE_2D,0,Ke,F,oe,Z,G,K,b.data)}E.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,j),t.pixelStorei(n.UNPACK_SKIP_PIXELS,Q),t.pixelStorei(n.UNPACK_SKIP_ROWS,_e)}}function ve(E,b,G){let K=n.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(K=n.TEXTURE_2D_ARRAY),b.isData3DTexture&&(K=n.TEXTURE_3D);let re=z(E,b),se=b.source;t.bindTexture(K,E.__webglTexture,n.TEXTURE0+G);let ue=i.get(se);if(se.version!==ue.__version||re===!0){if(t.activeTexture(n.TEXTURE0+G),(typeof ImageBitmap<"u"&&b.image instanceof ImageBitmap)===!1){let Z=$e.getPrimaries($e.workingColorSpace),ye=b.colorSpace===$n?null:$e.getPrimaries(b.colorSpace),ce=b.colorSpace===$n||Z===ye?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ce)}t.pixelStorei(n.UNPACK_ALIGNMENT,b.unpackAlignment);let Q=g(b.image,!1,r.maxTextureSize);Q=de(b,Q);let _e=s.convert(b.format,b.colorSpace),Se=s.convert(b.type),le=S(b.internalFormat,_e,Se,b.normalized,b.colorSpace,b.isVideoTexture);Y(K,b);let ae,Oe=b.mipmaps,Ve=b.isVideoTexture!==!0,Ke=ue.__version===void 0||re===!0,F=se.dataReady,oe=y(b,Q);if(b.isDepthTexture)le=w(b.format===mi,b.type),Ke&&(Ve?t.texStorage2D(n.TEXTURE_2D,1,le,Q.width,Q.height):t.texImage2D(n.TEXTURE_2D,0,le,Q.width,Q.height,0,_e,Se,null));else if(b.isDataTexture)if(Oe.length>0){Ve&&Ke&&t.texStorage2D(n.TEXTURE_2D,oe,le,Oe[0].width,Oe[0].height);for(let Z=0,ye=Oe.length;Z<ye;Z++)ae=Oe[Z],Ve?F&&t.texSubImage2D(n.TEXTURE_2D,Z,0,0,ae.width,ae.height,_e,Se,ae.data):t.texImage2D(n.TEXTURE_2D,Z,le,ae.width,ae.height,0,_e,Se,ae.data);b.generateMipmaps=!1}else Ve?(Ke&&t.texStorage2D(n.TEXTURE_2D,oe,le,Q.width,Q.height),F&&te(b,Q,_e,Se)):t.texImage2D(n.TEXTURE_2D,0,le,Q.width,Q.height,0,_e,Se,Q.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){Ve&&Ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,oe,le,Oe[0].width,Oe[0].height,Q.depth);for(let Z=0,ye=Oe.length;Z<ye;Z++)if(ae=Oe[Z],b.format!==hn)if(_e!==null)if(Ve){if(F)if(b.layerUpdates.size>0){let ce=Mc(ae.width,ae.height,b.format,b.type);for(let ie of b.layerUpdates){let Ce=ae.data.subarray(ie*ce/ae.data.BYTES_PER_ELEMENT,(ie+1)*ce/ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Z,0,0,ie,ae.width,ae.height,1,_e,Ce)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Z,0,0,0,ae.width,ae.height,Q.depth,_e,ae.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Z,le,ae.width,ae.height,Q.depth,0,ae.data,0,0);else Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ve?F&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Z,0,0,0,ae.width,ae.height,Q.depth,_e,Se,ae.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Z,le,ae.width,ae.height,Q.depth,0,_e,Se,ae.data)}else{Ve&&Ke&&t.texStorage2D(n.TEXTURE_2D,oe,le,Oe[0].width,Oe[0].height);for(let Z=0,ye=Oe.length;Z<ye;Z++)ae=Oe[Z],b.format!==hn?_e!==null?Ve?F&&t.compressedTexSubImage2D(n.TEXTURE_2D,Z,0,0,ae.width,ae.height,_e,ae.data):t.compressedTexImage2D(n.TEXTURE_2D,Z,le,ae.width,ae.height,0,ae.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ve?F&&t.texSubImage2D(n.TEXTURE_2D,Z,0,0,ae.width,ae.height,_e,Se,ae.data):t.texImage2D(n.TEXTURE_2D,Z,le,ae.width,ae.height,0,_e,Se,ae.data)}else if(b.isDataArrayTexture)if(Ve){if(Ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,oe,le,Q.width,Q.height,Q.depth),F)if(b.layerUpdates.size>0){let Z=Mc(Q.width,Q.height,b.format,b.type);for(let ye of b.layerUpdates){let ce=Q.data.subarray(ye*Z/Q.data.BYTES_PER_ELEMENT,(ye+1)*Z/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,ye,Q.width,Q.height,1,_e,Se,ce)}b.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,_e,Se,Q.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,le,Q.width,Q.height,Q.depth,0,_e,Se,Q.data);else if(b.isData3DTexture)Ve?(Ke&&t.texStorage3D(n.TEXTURE_3D,oe,le,Q.width,Q.height,Q.depth),F&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,_e,Se,Q.data)):t.texImage3D(n.TEXTURE_3D,0,le,Q.width,Q.height,Q.depth,0,_e,Se,Q.data);else if(b.isFramebufferTexture){if(Ke)if(Ve)t.texStorage2D(n.TEXTURE_2D,oe,le,Q.width,Q.height);else{let Z=Q.width,ye=Q.height;for(let ce=0;ce<oe;ce++)t.texImage2D(n.TEXTURE_2D,ce,le,Z,ye,0,_e,Se,null),Z>>=1,ye>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in n){let Z=n.canvas;if(Z.hasAttribute("layoutsubtree")||Z.setAttribute("layoutsubtree","true"),Q.parentNode!==Z){Z.appendChild(Q),d.add(b),Z.onpaint=ke=>{let xt=ke.changedElements;for(let rt of d)xt.includes(rt.image)&&(rt.needsUpdate=!0)},Z.requestPaint();return}let ye=0,ce=n.RGBA,ie=n.RGBA,Ce=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,ye,ce,ie,Ce,Q),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(Oe.length>0){if(Ve&&Ke){let Z=mt(Oe[0]);t.texStorage2D(n.TEXTURE_2D,oe,le,Z.width,Z.height)}for(let Z=0,ye=Oe.length;Z<ye;Z++)ae=Oe[Z],Ve?F&&t.texSubImage2D(n.TEXTURE_2D,Z,0,0,_e,Se,ae):t.texImage2D(n.TEXTURE_2D,Z,le,_e,Se,ae);b.generateMipmaps=!1}else if(Ve){if(Ke){let Z=mt(Q);t.texStorage2D(n.TEXTURE_2D,oe,le,Z.width,Z.height)}F&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,_e,Se,Q)}else t.texImage2D(n.TEXTURE_2D,0,le,_e,Se,Q);f(b)&&v(K),ue.__version=se.version,b.onUpdate&&b.onUpdate(b)}E.__version=b.version}function Me(E,b,G){if(b.image.length!==6)return;let K=z(E,b),re=b.source;t.bindTexture(n.TEXTURE_CUBE_MAP,E.__webglTexture,n.TEXTURE0+G);let se=i.get(re);if(re.version!==se.__version||K===!0){t.activeTexture(n.TEXTURE0+G);let ue=$e.getPrimaries($e.workingColorSpace),j=b.colorSpace===$n?null:$e.getPrimaries(b.colorSpace),Q=b.colorSpace===$n||ue===j?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,b.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Q);let _e=b.isCompressedTexture||b.image[0].isCompressedTexture,Se=b.image[0]&&b.image[0].isDataTexture,le=[];for(let ie=0;ie<6;ie++)!_e&&!Se?le[ie]=g(b.image[ie],!0,r.maxCubemapSize):le[ie]=Se?b.image[ie].image:b.image[ie],le[ie]=de(b,le[ie]);let ae=le[0],Oe=s.convert(b.format,b.colorSpace),Ve=s.convert(b.type),Ke=S(b.internalFormat,Oe,Ve,b.normalized,b.colorSpace),F=b.isVideoTexture!==!0,oe=se.__version===void 0||K===!0,Z=re.dataReady,ye=y(b,ae);Y(n.TEXTURE_CUBE_MAP,b);let ce;if(_e){F&&oe&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ye,Ke,ae.width,ae.height);for(let ie=0;ie<6;ie++){ce=le[ie].mipmaps;for(let Ce=0;Ce<ce.length;Ce++){let ke=ce[Ce];b.format!==hn?Oe!==null?F?Z&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,0,0,ke.width,ke.height,Oe,ke.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,Ke,ke.width,ke.height,0,ke.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):F?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,0,0,ke.width,ke.height,Oe,Ve,ke.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,Ke,ke.width,ke.height,0,Oe,Ve,ke.data)}}}else{if(ce=b.mipmaps,F&&oe){ce.length>0&&ye++;let ie=mt(le[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,ye,Ke,ie.width,ie.height)}for(let ie=0;ie<6;ie++)if(Se){F?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,le[ie].width,le[ie].height,Oe,Ve,le[ie].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,Ke,le[ie].width,le[ie].height,0,Oe,Ve,le[ie].data);for(let Ce=0;Ce<ce.length;Ce++){let xt=ce[Ce].image[ie].image;F?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,0,0,xt.width,xt.height,Oe,Ve,xt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,Ke,xt.width,xt.height,0,Oe,Ve,xt.data)}}else{F?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,Oe,Ve,le[ie]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,Ke,Oe,Ve,le[ie]);for(let Ce=0;Ce<ce.length;Ce++){let ke=ce[Ce];F?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,0,0,Oe,Ve,ke.image[ie]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,Ke,Oe,Ve,ke.image[ie])}}}f(b)&&v(n.TEXTURE_CUBE_MAP),se.__version=re.version,b.onUpdate&&b.onUpdate(b)}E.__version=b.version}function xe(E,b,G,K,re,se){let ue=s.convert(G.format,G.colorSpace),j=s.convert(G.type),Q=S(G.internalFormat,ue,j,G.normalized,G.colorSpace),_e=i.get(b),Se=i.get(G);if(Se.__renderTarget=b,!_e.__hasExternalTextures){let le=Math.max(1,b.width>>se),ae=Math.max(1,b.height>>se);re===n.TEXTURE_3D||re===n.TEXTURE_2D_ARRAY?t.texImage3D(re,se,Q,le,ae,b.depth,0,ue,j,null):t.texImage2D(re,se,Q,le,ae,0,ue,j,null)}t.bindFramebuffer(n.FRAMEBUFFER,E),Ye(b)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,K,re,Se.__webglTexture,0,Mt(b)):(re===n.TEXTURE_2D||re>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&re<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,K,re,Se.__webglTexture,se),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ze(E,b,G){if(n.bindRenderbuffer(n.RENDERBUFFER,E),b.depthBuffer){let K=b.depthTexture,re=K&&K.isDepthTexture?K.type:null,se=w(b.stencilBuffer,re),ue=b.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;Ye(b)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Mt(b),se,b.width,b.height):G?n.renderbufferStorageMultisample(n.RENDERBUFFER,Mt(b),se,b.width,b.height):n.renderbufferStorage(n.RENDERBUFFER,se,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,E)}else{let K=b.textures;for(let re=0;re<K.length;re++){let se=K[re],ue=s.convert(se.format,se.colorSpace),j=s.convert(se.type),Q=S(se.internalFormat,ue,j,se.normalized,se.colorSpace);Ye(b)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Mt(b),Q,b.width,b.height):G?n.renderbufferStorageMultisample(n.RENDERBUFFER,Mt(b),Q,b.width,b.height):n.renderbufferStorage(n.RENDERBUFFER,Q,b.width,b.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ue(E,b,G){let K=b.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,E),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let re=i.get(b.depthTexture);if(re.__renderTarget=b,(!re.__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),K){if(re.__webglInit===void 0&&(re.__webglInit=!0,b.depthTexture.addEventListener("dispose",A)),re.__webglTexture===void 0){re.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,re.__webglTexture),Y(n.TEXTURE_CUBE_MAP,b.depthTexture);let _e=s.convert(b.depthTexture.format),Se=s.convert(b.depthTexture.type),le;b.depthTexture.format===Pn?le=n.DEPTH_COMPONENT24:b.depthTexture.format===mi&&(le=n.DEPTH24_STENCIL8);for(let ae=0;ae<6;ae++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,le,b.width,b.height,0,_e,Se,null)}}else ee(b.depthTexture,0);let se=re.__webglTexture,ue=Mt(b),j=K?n.TEXTURE_CUBE_MAP_POSITIVE_X+G:n.TEXTURE_2D,Q=b.depthTexture.format===mi?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(b.depthTexture.format===Pn)Ye(b)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Q,j,se,0,ue):n.framebufferTexture2D(n.FRAMEBUFFER,Q,j,se,0);else if(b.depthTexture.format===mi)Ye(b)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Q,j,se,0,ue):n.framebufferTexture2D(n.FRAMEBUFFER,Q,j,se,0);else throw new Error("Unknown depthTexture format")}function qe(E){let b=i.get(E),G=E.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==E.depthTexture){let K=E.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),K){let re=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,K.removeEventListener("dispose",re)};K.addEventListener("dispose",re),b.__depthDisposeCallback=re}b.__boundDepthTexture=K}if(E.depthTexture&&!b.__autoAllocateDepthBuffer)if(G)for(let K=0;K<6;K++)Ue(b.__webglFramebuffer[K],E,K);else{let K=E.texture.mipmaps;K&&K.length>0?Ue(b.__webglFramebuffer[0],E,0):Ue(b.__webglFramebuffer,E,0)}else if(G){b.__webglDepthbuffer=[];for(let K=0;K<6;K++)if(t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer[K]),b.__webglDepthbuffer[K]===void 0)b.__webglDepthbuffer[K]=n.createRenderbuffer(),Ze(b.__webglDepthbuffer[K],E,!1);else{let re=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,se=b.__webglDepthbuffer[K];n.bindRenderbuffer(n.RENDERBUFFER,se),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,se)}}else{let K=E.texture.mipmaps;if(K&&K.length>0?t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=n.createRenderbuffer(),Ze(b.__webglDepthbuffer,E,!1);else{let re=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,se=b.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,se),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,se)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Qe(E,b,G){let K=i.get(E);b!==void 0&&xe(K.__webglFramebuffer,E,E.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),G!==void 0&&qe(E)}function Fe(E){let b=E.texture,G=i.get(E),K=i.get(b);E.addEventListener("dispose",_);let re=E.textures,se=E.isWebGLCubeRenderTarget===!0,ue=re.length>1;if(ue||(K.__webglTexture===void 0&&(K.__webglTexture=n.createTexture()),K.__version=b.version,a.memory.textures++),se){G.__webglFramebuffer=[];for(let j=0;j<6;j++)if(b.mipmaps&&b.mipmaps.length>0){G.__webglFramebuffer[j]=[];for(let Q=0;Q<b.mipmaps.length;Q++)G.__webglFramebuffer[j][Q]=n.createFramebuffer()}else G.__webglFramebuffer[j]=n.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){G.__webglFramebuffer=[];for(let j=0;j<b.mipmaps.length;j++)G.__webglFramebuffer[j]=n.createFramebuffer()}else G.__webglFramebuffer=n.createFramebuffer();if(ue)for(let j=0,Q=re.length;j<Q;j++){let _e=i.get(re[j]);_e.__webglTexture===void 0&&(_e.__webglTexture=n.createTexture(),a.memory.textures++)}if(E.samples>0&&Ye(E)===!1){G.__webglMultisampledFramebuffer=n.createFramebuffer(),G.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,G.__webglMultisampledFramebuffer);for(let j=0;j<re.length;j++){let Q=re[j];G.__webglColorRenderbuffer[j]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,G.__webglColorRenderbuffer[j]);let _e=s.convert(Q.format,Q.colorSpace),Se=s.convert(Q.type),le=S(Q.internalFormat,_e,Se,Q.normalized,Q.colorSpace,E.isXRRenderTarget===!0),ae=Mt(E);n.renderbufferStorageMultisample(n.RENDERBUFFER,ae,le,E.width,E.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+j,n.RENDERBUFFER,G.__webglColorRenderbuffer[j])}n.bindRenderbuffer(n.RENDERBUFFER,null),E.depthBuffer&&(G.__webglDepthRenderbuffer=n.createRenderbuffer(),Ze(G.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(se){t.bindTexture(n.TEXTURE_CUBE_MAP,K.__webglTexture),Y(n.TEXTURE_CUBE_MAP,b);for(let j=0;j<6;j++)if(b.mipmaps&&b.mipmaps.length>0)for(let Q=0;Q<b.mipmaps.length;Q++)xe(G.__webglFramebuffer[j][Q],E,b,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+j,Q);else xe(G.__webglFramebuffer[j],E,b,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+j,0);f(b)&&v(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ue){for(let j=0,Q=re.length;j<Q;j++){let _e=re[j],Se=i.get(_e),le=n.TEXTURE_2D;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(le=E.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(le,Se.__webglTexture),Y(le,_e),xe(G.__webglFramebuffer,E,_e,n.COLOR_ATTACHMENT0+j,le,0),f(_e)&&v(le)}t.unbindTexture()}else{let j=n.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(j=E.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(j,K.__webglTexture),Y(j,b),b.mipmaps&&b.mipmaps.length>0)for(let Q=0;Q<b.mipmaps.length;Q++)xe(G.__webglFramebuffer[Q],E,b,n.COLOR_ATTACHMENT0,j,Q);else xe(G.__webglFramebuffer,E,b,n.COLOR_ATTACHMENT0,j,0);f(b)&&v(j),t.unbindTexture()}E.depthBuffer&&qe(E)}function it(E){let b=E.textures;for(let G=0,K=b.length;G<K;G++){let re=b[G];if(f(re)){let se=M(E),ue=i.get(re).__webglTexture;t.bindTexture(se,ue),v(se),t.unbindTexture()}}}let nt=[],jt=[];function O(E){if(E.samples>0){if(Ye(E)===!1){let b=E.textures,G=E.width,K=E.height,re=n.COLOR_BUFFER_BIT,se=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ue=i.get(E),j=b.length>1;if(j)for(let _e=0;_e<b.length;_e++)t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,ue.__webglMultisampledFramebuffer);let Q=E.texture.mipmaps;Q&&Q.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglFramebuffer);for(let _e=0;_e<b.length;_e++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(re|=n.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(re|=n.STENCIL_BUFFER_BIT)),j){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,ue.__webglColorRenderbuffer[_e]);let Se=i.get(b[_e]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Se,0)}n.blitFramebuffer(0,0,G,K,0,0,G,K,re,n.NEAREST),l===!0&&(nt.length=0,jt.length=0,nt.push(n.COLOR_ATTACHMENT0+_e),E.depthBuffer&&E.resolveDepthBuffer===!1&&(nt.push(se),jt.push(se),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,jt)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,nt))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),j)for(let _e=0;_e<b.length;_e++){t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.RENDERBUFFER,ue.__webglColorRenderbuffer[_e]);let Se=i.get(b[_e]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.TEXTURE_2D,Se,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&l){let b=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[b])}}}function Mt(E){return Math.min(r.maxSamples,E.samples)}function Ye(E){let b=i.get(E);return E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function ht(E){let b=a.render.frame;h.get(E)!==b&&(h.set(E,b),E.update())}function de(E,b){let G=E.colorSpace,K=E.format,re=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||G!==Ur&&G!==$n&&($e.getTransfer(G)===et?(K!==hn||re!==qt)&&Ie("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Le("WebGLTextures: Unsupported texture color space:",G)),b}function mt(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(c.width=E.naturalWidth||E.width,c.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(c.width=E.displayWidth,c.height=E.displayHeight):(c.width=E.width,c.height=E.height),c}this.allocateTextureUnit=L,this.resetTextureUnits=V,this.getTextureUnits=I,this.setTextureUnits=R,this.setTexture2D=ee,this.setTexture2DArray=ne,this.setTexture3D=he,this.setTextureCube=q,this.rebindTextures=Qe,this.setupRenderTarget=Fe,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=O,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=Ye,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function vy(n,e){function t(i,r=$n){let s,a=$e.getTransfer(r);if(i===qt)return n.UNSIGNED_BYTE;if(i===Ka)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Qa)return n.UNSIGNED_SHORT_5_5_5_1;if(i===cc)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===hc)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===oc)return n.BYTE;if(i===lc)return n.SHORT;if(i===fr)return n.UNSIGNED_SHORT;if(i===Ja)return n.INT;if(i===vn)return n.UNSIGNED_INT;if(i===yn)return n.FLOAT;if(i===Nn)return n.HALF_FLOAT;if(i===uc)return n.ALPHA;if(i===fc)return n.RGB;if(i===hn)return n.RGBA;if(i===Pn)return n.DEPTH_COMPONENT;if(i===mi)return n.DEPTH_STENCIL;if(i===dc)return n.RED;if(i===eo)return n.RED_INTEGER;if(i===gi)return n.RG;if(i===to)return n.RG_INTEGER;if(i===no)return n.RGBA_INTEGER;if(i===ls||i===cs||i===hs||i===us)if(a===et)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===ls)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===cs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===hs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===us)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===ls)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===cs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===hs)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===us)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===io||i===ro||i===so||i===ao)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===io)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ro)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===so)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===ao)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===oo||i===lo||i===co||i===ho||i===uo||i===fs||i===fo)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===oo||i===lo)return a===et?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===co)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===ho)return s.COMPRESSED_R11_EAC;if(i===uo)return s.COMPRESSED_SIGNED_R11_EAC;if(i===fs)return s.COMPRESSED_RG11_EAC;if(i===fo)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===po||i===mo||i===go||i===_o||i===xo||i===vo||i===yo||i===bo||i===Mo||i===So||i===wo||i===To||i===Ao||i===Eo)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===po)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===mo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===go)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===_o)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===xo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===vo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===yo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===bo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Mo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===So)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===wo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===To)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Ao)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Eo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Co||i===Ro||i===Po)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Co)return a===et?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ro)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Po)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Io||i===Do||i===ds||i===Lo)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Io)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Do)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ds)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Lo)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===dr?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}var yy=`
|
|
4579
|
+
}`,yy=[new U(1,0,0),new U(-1,0,0),new U(0,1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1)],by=[new U(0,-1,0),new U(0,-1,0),new U(0,0,1),new U(0,0,-1),new U(0,-1,0),new U(0,-1,0)],Ef=new ct,ms=new U,Lc=new U;function My(n,e,t){let i=new rr,r=new Te,s=new Te,a=new pt,o=new Da,l=new La,c={},h=t.maxTextureSize,d={[Wn]:Vt,[Vt]:Wn,[Dn]:Dn},u=new nn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Te},radius:{value:4}},vertexShader:xy,fragmentShader:vy}),p=u.clone();p.defines.HORIZONTAL_PASS=1;let m=new Ot;m.setAttribute("position",new zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let x=new Xt(m,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ss;let f=this.type;this.render=function(y,A,_){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||y.length===0)return;this.type===Mu&&(Ie("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=ss);let C=n.getRenderTarget(),D=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),N=n.state;N.setBlending(Ln),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);let V=f!==this.type;V&&A.traverse(function(I){I.material&&(Array.isArray(I.material)?I.material.forEach(R=>R.needsUpdate=!0):I.material.needsUpdate=!0)});for(let I=0,R=y.length;I<R;I++){let L=y[I],k=L.shadow;if(k===void 0){Ie("WebGLShadowMap:",L,"has no shadow.");continue}if(k.autoUpdate===!1&&k.needsUpdate===!1)continue;r.copy(k.mapSize);let ee=k.getFrameExtents();r.multiply(ee),s.copy(k.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/ee.x),r.x=s.x*ee.x,k.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/ee.y),r.y=s.y*ee.y,k.mapSize.y=s.y));let ne=n.state.buffers.depth.getReversed();if(k.camera._reversedDepth=ne,k.map===null||V===!0){if(k.map!==null&&(k.map.depthTexture!==null&&(k.map.depthTexture.dispose(),k.map.depthTexture=null),k.map.dispose()),this.type===ur){if(L.isPointLight){Ie("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}k.map=new tn(r.x,r.y,{format:gi,type:Nn,minFilter:Rt,magFilter:Rt,generateMipmaps:!1}),k.map.texture.name=L.name+".shadowMap",k.map.depthTexture=new Yn(r.x,r.y,yn),k.map.depthTexture.name=L.name+".shadowMapDepth",k.map.depthTexture.format=Pn,k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=Et,k.map.depthTexture.magFilter=Et}else L.isPointLight?(k.map=new zo(r.x),k.map.depthTexture=new Sa(r.x,vn)):(k.map=new tn(r.x,r.y),k.map.depthTexture=new Yn(r.x,r.y,vn)),k.map.depthTexture.name=L.name+".shadowMap",k.map.depthTexture.format=Pn,this.type===ss?(k.map.depthTexture.compareFunction=ne?Oo:Uo,k.map.depthTexture.minFilter=Rt,k.map.depthTexture.magFilter=Rt):(k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=Et,k.map.depthTexture.magFilter=Et);k.camera.updateProjectionMatrix()}let he=k.map.isWebGLCubeRenderTarget?6:1;for(let q=0;q<he;q++){if(k.map.isWebGLCubeRenderTarget)n.setRenderTarget(k.map,q),n.clear();else{q===0&&(n.setRenderTarget(k.map),n.clear());let J=k.getViewport(q);a.set(s.x*J.x,s.y*J.y,s.x*J.z,s.y*J.w),N.viewport(a)}if(L.isPointLight){let J=k.camera,fe=k.matrix,De=L.distance||J.far;De!==J.far&&(J.far=De,J.updateProjectionMatrix()),ms.setFromMatrixPosition(L.matrixWorld),J.position.copy(ms),Lc.copy(J.position),Lc.add(yy[q]),J.up.copy(by[q]),J.lookAt(Lc),J.updateMatrixWorld(),fe.makeTranslation(-ms.x,-ms.y,-ms.z),Ef.multiplyMatrices(J.projectionMatrix,J.matrixWorldInverse),k._frustum.setFromProjectionMatrix(Ef,J.coordinateSystem,J.reversedDepth)}else k.updateMatrices(L);i=k.getFrustum(),S(A,_,k.camera,L,this.type)}k.isPointLightShadow!==!0&&this.type===ur&&v(k,_),k.needsUpdate=!1}f=this.type,g.needsUpdate=!1,n.setRenderTarget(C,D,P)};function v(y,A){let _=e.update(x);u.defines.VSM_SAMPLES!==y.blurSamples&&(u.defines.VSM_SAMPLES=y.blurSamples,p.defines.VSM_SAMPLES=y.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),y.mapPass===null&&(y.mapPass=new tn(r.x,r.y,{format:gi,type:Nn})),u.uniforms.shadow_pass.value=y.map.depthTexture,u.uniforms.resolution.value=y.mapSize,u.uniforms.radius.value=y.radius,n.setRenderTarget(y.mapPass),n.clear(),n.renderBufferDirect(A,null,_,u,x,null),p.uniforms.shadow_pass.value=y.mapPass.texture,p.uniforms.resolution.value=y.mapSize,p.uniforms.radius.value=y.radius,n.setRenderTarget(y.map),n.clear(),n.renderBufferDirect(A,null,_,p,x,null)}function M(y,A,_,C){let D=null,P=_.isPointLight===!0?y.customDistanceMaterial:y.customDepthMaterial;if(P!==void 0)D=P;else if(D=_.isPointLight===!0?l:o,n.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){let N=D.uuid,V=A.uuid,I=c[N];I===void 0&&(I={},c[N]=I);let R=I[V];R===void 0&&(R=D.clone(),I[V]=R,A.addEventListener("dispose",w)),D=R}if(D.visible=A.visible,D.wireframe=A.wireframe,C===ur?D.side=A.shadowSide!==null?A.shadowSide:A.side:D.side=A.shadowSide!==null?A.shadowSide:d[A.side],D.alphaMap=A.alphaMap,D.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,D.map=A.map,D.clipShadows=A.clipShadows,D.clippingPlanes=A.clippingPlanes,D.clipIntersection=A.clipIntersection,D.displacementMap=A.displacementMap,D.displacementScale=A.displacementScale,D.displacementBias=A.displacementBias,D.wireframeLinewidth=A.wireframeLinewidth,D.linewidth=A.linewidth,_.isPointLight===!0&&D.isMeshDistanceMaterial===!0){let N=n.properties.get(D);N.light=_}return D}function S(y,A,_,C,D){if(y.visible===!1)return;if(y.layers.test(A.layers)&&(y.isMesh||y.isLine||y.isPoints)&&(y.castShadow||y.receiveShadow&&D===ur)&&(!y.frustumCulled||i.intersectsObject(y))){y.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,y.matrixWorld);let V=e.update(y),I=y.material;if(Array.isArray(I)){let R=V.groups;for(let L=0,k=R.length;L<k;L++){let ee=R[L],ne=I[ee.materialIndex];if(ne&&ne.visible){let he=M(y,ne,C,D);y.onBeforeShadow(n,y,A,_,V,he,ee),n.renderBufferDirect(_,null,V,he,y,ee),y.onAfterShadow(n,y,A,_,V,he,ee)}}}else if(I.visible){let R=M(y,I,C,D);y.onBeforeShadow(n,y,A,_,V,R,null),n.renderBufferDirect(_,null,V,R,y,null),y.onAfterShadow(n,y,A,_,V,R,null)}}let N=y.children;for(let V=0,I=N.length;V<I;V++)S(N[V],A,_,C,D)}function w(y){y.target.removeEventListener("dispose",w);for(let _ in c){let C=c[_],D=y.target.uuid;D in C&&(C[D].dispose(),delete C[D])}}}function Sy(n,e){function t(){let O=!1,oe=new pt,Z=null,ye=new pt(0,0,0,0);return{setMask:function(ce){Z!==ce&&!O&&(n.colorMask(ce,ce,ce,ce),Z=ce)},setLocked:function(ce){O=ce},setClear:function(ce,ie,Ce,ke,xt){xt===!0&&(ce*=ke,ie*=ke,Ce*=ke),oe.set(ce,ie,Ce,ke),ye.equals(oe)===!1&&(n.clearColor(ce,ie,Ce,ke),ye.copy(oe))},reset:function(){O=!1,Z=null,ye.set(-1,0,0,0)}}}function i(){let O=!1,oe=!1,Z=null,ye=null,ce=null;return{setReversed:function(ie){if(oe!==ie){let Ce=e.get("EXT_clip_control");ie?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),oe=ie;let ke=ce;ce=null,this.setClear(ke)}},getReversed:function(){return oe},setTest:function(ie){ie?te(n.DEPTH_TEST):ve(n.DEPTH_TEST)},setMask:function(ie){Z!==ie&&!O&&(n.depthMask(ie),Z=ie)},setFunc:function(ie){if(oe&&(ie=tf[ie]),ye!==ie){switch(ie){case aa:n.depthFunc(n.NEVER);break;case oa:n.depthFunc(n.ALWAYS);break;case la:n.depthFunc(n.LESS);break;case Ei:n.depthFunc(n.LEQUAL);break;case ca:n.depthFunc(n.EQUAL);break;case ha:n.depthFunc(n.GEQUAL);break;case ua:n.depthFunc(n.GREATER);break;case fa:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}ye=ie}},setLocked:function(ie){O=ie},setClear:function(ie){ce!==ie&&(ce=ie,oe&&(ie=1-ie),n.clearDepth(ie))},reset:function(){O=!1,Z=null,ye=null,ce=null,oe=!1}}}function r(){let O=!1,oe=null,Z=null,ye=null,ce=null,ie=null,Ce=null,ke=null,xt=null;return{setTest:function(rt){O||(rt?te(n.STENCIL_TEST):ve(n.STENCIL_TEST))},setMask:function(rt){oe!==rt&&!O&&(n.stencilMask(rt),oe=rt)},setFunc:function(rt,Fn,Tn){(Z!==rt||ye!==Fn||ce!==Tn)&&(n.stencilFunc(rt,Fn,Tn),Z=rt,ye=Fn,ce=Tn)},setOp:function(rt,Fn,Tn){(ie!==rt||Ce!==Fn||ke!==Tn)&&(n.stencilOp(rt,Fn,Tn),ie=rt,Ce=Fn,ke=Tn)},setLocked:function(rt){O=rt},setClear:function(rt){xt!==rt&&(n.clearStencil(rt),xt=rt)},reset:function(){O=!1,oe=null,Z=null,ye=null,ce=null,ie=null,Ce=null,ke=null,xt=null}}}let s=new t,a=new i,o=new r,l=new WeakMap,c=new WeakMap,h={},d={},u={},p=new WeakMap,m=[],x=null,g=!1,f=null,v=null,M=null,S=null,w=null,y=null,A=null,_=new Xe(0,0,0),C=0,D=!1,P=null,N=null,V=null,I=null,R=null,L=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS),k=!1,ee=0,ne=n.getParameter(n.VERSION);ne.indexOf("WebGL")!==-1?(ee=parseFloat(/^WebGL (\d)/.exec(ne)[1]),k=ee>=1):ne.indexOf("OpenGL ES")!==-1&&(ee=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),k=ee>=2);let he=null,q={},J=n.getParameter(n.SCISSOR_BOX),fe=n.getParameter(n.VIEWPORT),De=new pt().fromArray(J),Y=new pt().fromArray(fe);function z(O,oe,Z,ye){let ce=new Uint8Array(4),ie=n.createTexture();n.bindTexture(O,ie),n.texParameteri(O,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(O,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ce=0;Ce<Z;Ce++)O===n.TEXTURE_3D||O===n.TEXTURE_2D_ARRAY?n.texImage3D(oe,0,n.RGBA,1,1,ye,0,n.RGBA,n.UNSIGNED_BYTE,ce):n.texImage2D(oe+Ce,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,ce);return ie}let $={};$[n.TEXTURE_2D]=z(n.TEXTURE_2D,n.TEXTURE_2D,1),$[n.TEXTURE_CUBE_MAP]=z(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),$[n.TEXTURE_2D_ARRAY]=z(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),$[n.TEXTURE_3D]=z(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),te(n.DEPTH_TEST),a.setFunc(Ei),it(!1),nt(jl),te(n.CULL_FACE),Qe(Ln);function te(O){h[O]!==!0&&(n.enable(O),h[O]=!0)}function ve(O){h[O]!==!1&&(n.disable(O),h[O]=!1)}function Me(O,oe){return u[O]!==oe?(n.bindFramebuffer(O,oe),u[O]=oe,O===n.DRAW_FRAMEBUFFER&&(u[n.FRAMEBUFFER]=oe),O===n.FRAMEBUFFER&&(u[n.DRAW_FRAMEBUFFER]=oe),!0):!1}function xe(O,oe){let Z=m,ye=!1;if(O){Z=p.get(oe),Z===void 0&&(Z=[],p.set(oe,Z));let ce=O.textures;if(Z.length!==ce.length||Z[0]!==n.COLOR_ATTACHMENT0){for(let ie=0,Ce=ce.length;ie<Ce;ie++)Z[ie]=n.COLOR_ATTACHMENT0+ie;Z.length=ce.length,ye=!0}}else Z[0]!==n.BACK&&(Z[0]=n.BACK,ye=!0);ye&&n.drawBuffers(Z)}function Ze(O){return x!==O?(n.useProgram(O),x=O,!0):!1}let Ue={[ai]:n.FUNC_ADD,[wu]:n.FUNC_SUBTRACT,[Tu]:n.FUNC_REVERSE_SUBTRACT};Ue[Au]=n.MIN,Ue[Eu]=n.MAX;let qe={[Cu]:n.ZERO,[Ru]:n.ONE,[Pu]:n.SRC_COLOR,[ra]:n.SRC_ALPHA,[Ou]:n.SRC_ALPHA_SATURATE,[Nu]:n.DST_COLOR,[Du]:n.DST_ALPHA,[Iu]:n.ONE_MINUS_SRC_COLOR,[sa]:n.ONE_MINUS_SRC_ALPHA,[Uu]:n.ONE_MINUS_DST_COLOR,[Lu]:n.ONE_MINUS_DST_ALPHA,[Fu]:n.CONSTANT_COLOR,[Bu]:n.ONE_MINUS_CONSTANT_COLOR,[ku]:n.CONSTANT_ALPHA,[zu]:n.ONE_MINUS_CONSTANT_ALPHA};function Qe(O,oe,Z,ye,ce,ie,Ce,ke,xt,rt){if(O===Ln){g===!0&&(ve(n.BLEND),g=!1);return}if(g===!1&&(te(n.BLEND),g=!0),O!==Su){if(O!==f||rt!==D){if((v!==ai||w!==ai)&&(n.blendEquation(n.FUNC_ADD),v=ai,w=ai),rt)switch(O){case Ai:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Zl:n.blendFunc(n.ONE,n.ONE);break;case Jl:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Kl:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:Le("WebGLState: Invalid blending: ",O);break}else switch(O){case Ai:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Zl:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Jl:Le("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Kl:Le("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Le("WebGLState: Invalid blending: ",O);break}M=null,S=null,y=null,A=null,_.set(0,0,0),C=0,f=O,D=rt}return}ce=ce||oe,ie=ie||Z,Ce=Ce||ye,(oe!==v||ce!==w)&&(n.blendEquationSeparate(Ue[oe],Ue[ce]),v=oe,w=ce),(Z!==M||ye!==S||ie!==y||Ce!==A)&&(n.blendFuncSeparate(qe[Z],qe[ye],qe[ie],qe[Ce]),M=Z,S=ye,y=ie,A=Ce),(ke.equals(_)===!1||xt!==C)&&(n.blendColor(ke.r,ke.g,ke.b,xt),_.copy(ke),C=xt),f=O,D=!1}function Oe(O,oe){O.side===Dn?ve(n.CULL_FACE):te(n.CULL_FACE);let Z=O.side===Vt;oe&&(Z=!Z),it(Z),O.blending===Ai&&O.transparent===!1?Qe(Ln):Qe(O.blending,O.blendEquation,O.blendSrc,O.blendDst,O.blendEquationAlpha,O.blendSrcAlpha,O.blendDstAlpha,O.blendColor,O.blendAlpha,O.premultipliedAlpha),a.setFunc(O.depthFunc),a.setTest(O.depthTest),a.setMask(O.depthWrite),s.setMask(O.colorWrite);let ye=O.stencilWrite;o.setTest(ye),ye&&(o.setMask(O.stencilWriteMask),o.setFunc(O.stencilFunc,O.stencilRef,O.stencilFuncMask),o.setOp(O.stencilFail,O.stencilZFail,O.stencilZPass)),F(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?te(n.SAMPLE_ALPHA_TO_COVERAGE):ve(n.SAMPLE_ALPHA_TO_COVERAGE)}function it(O){P!==O&&(O?n.frontFace(n.CW):n.frontFace(n.CCW),P=O)}function nt(O){O!==yu?(te(n.CULL_FACE),O!==N&&(O===jl?n.cullFace(n.BACK):O===bu?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):ve(n.CULL_FACE),N=O}function jt(O){O!==V&&(k&&n.lineWidth(O),V=O)}function F(O,oe,Z){O?(te(n.POLYGON_OFFSET_FILL),(I!==oe||R!==Z)&&(I=oe,R=Z,a.getReversed()&&(oe=-oe),n.polygonOffset(oe,Z))):ve(n.POLYGON_OFFSET_FILL)}function Mt(O){O?te(n.SCISSOR_TEST):ve(n.SCISSOR_TEST)}function Ye(O){O===void 0&&(O=n.TEXTURE0+L-1),he!==O&&(n.activeTexture(O),he=O)}function ht(O,oe,Z){Z===void 0&&(he===null?Z=n.TEXTURE0+L-1:Z=he);let ye=q[Z];ye===void 0&&(ye={type:void 0,texture:void 0},q[Z]=ye),(ye.type!==O||ye.texture!==oe)&&(he!==Z&&(n.activeTexture(Z),he=Z),n.bindTexture(O,oe||$[O]),ye.type=O,ye.texture=oe)}function de(){let O=q[he];O!==void 0&&O.type!==void 0&&(n.bindTexture(O.type,null),O.type=void 0,O.texture=void 0)}function mt(){try{n.compressedTexImage2D(...arguments)}catch(O){Le("WebGLState:",O)}}function E(){try{n.compressedTexImage3D(...arguments)}catch(O){Le("WebGLState:",O)}}function b(){try{n.texSubImage2D(...arguments)}catch(O){Le("WebGLState:",O)}}function G(){try{n.texSubImage3D(...arguments)}catch(O){Le("WebGLState:",O)}}function K(){try{n.compressedTexSubImage2D(...arguments)}catch(O){Le("WebGLState:",O)}}function re(){try{n.compressedTexSubImage3D(...arguments)}catch(O){Le("WebGLState:",O)}}function se(){try{n.texStorage2D(...arguments)}catch(O){Le("WebGLState:",O)}}function ue(){try{n.texStorage3D(...arguments)}catch(O){Le("WebGLState:",O)}}function j(){try{n.texImage2D(...arguments)}catch(O){Le("WebGLState:",O)}}function Q(){try{n.texImage3D(...arguments)}catch(O){Le("WebGLState:",O)}}function _e(O){return d[O]!==void 0?d[O]:n.getParameter(O)}function Se(O,oe){d[O]!==oe&&(n.pixelStorei(O,oe),d[O]=oe)}function le(O){De.equals(O)===!1&&(n.scissor(O.x,O.y,O.z,O.w),De.copy(O))}function ae(O){Y.equals(O)===!1&&(n.viewport(O.x,O.y,O.z,O.w),Y.copy(O))}function Fe(O,oe){let Z=c.get(oe);Z===void 0&&(Z=new WeakMap,c.set(oe,Z));let ye=Z.get(O);ye===void 0&&(ye=n.getUniformBlockIndex(oe,O.name),Z.set(O,ye))}function Ve(O,oe){let ye=c.get(oe).get(O);l.get(oe)!==ye&&(n.uniformBlockBinding(oe,ye,O.__bindingPointIndex),l.set(oe,ye))}function Ke(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),n.pixelStorei(n.PACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_ALIGNMENT,4),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.BROWSER_DEFAULT_WEBGL),n.pixelStorei(n.PACK_ROW_LENGTH,0),n.pixelStorei(n.PACK_SKIP_PIXELS,0),n.pixelStorei(n.PACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_ROW_LENGTH,0),n.pixelStorei(n.UNPACK_IMAGE_HEIGHT,0),n.pixelStorei(n.UNPACK_SKIP_PIXELS,0),n.pixelStorei(n.UNPACK_SKIP_ROWS,0),n.pixelStorei(n.UNPACK_SKIP_IMAGES,0),h={},d={},he=null,q={},u={},p=new WeakMap,m=[],x=null,g=!1,f=null,v=null,M=null,S=null,w=null,y=null,A=null,_=new Xe(0,0,0),C=0,D=!1,P=null,N=null,V=null,I=null,R=null,De.set(0,0,n.canvas.width,n.canvas.height),Y.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:te,disable:ve,bindFramebuffer:Me,drawBuffers:xe,useProgram:Ze,setBlending:Qe,setMaterial:Oe,setFlipSided:it,setCullFace:nt,setLineWidth:jt,setPolygonOffset:F,setScissorTest:Mt,activeTexture:Ye,bindTexture:ht,unbindTexture:de,compressedTexImage2D:mt,compressedTexImage3D:E,texImage2D:j,texImage3D:Q,pixelStorei:Se,getParameter:_e,updateUBOMapping:Fe,uniformBlockBinding:Ve,texStorage2D:se,texStorage3D:ue,texSubImage2D:b,texSubImage3D:G,compressedTexSubImage2D:K,compressedTexSubImage3D:re,scissor:le,viewport:ae,reset:Ke}}function wy(n,e,t,i,r,s,a){let o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Te,h=new WeakMap,d=new Set,u,p=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(E,b){return m?new OffscreenCanvas(E,b):Fr("canvas")}function g(E,b,G){let K=1,re=mt(E);if((re.width>G||re.height>G)&&(K=G/Math.max(re.width,re.height)),K<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){let se=Math.floor(K*re.width),ue=Math.floor(K*re.height);u===void 0&&(u=x(se,ue));let j=b?x(se,ue):u;return j.width=se,j.height=ue,j.getContext("2d").drawImage(E,0,0,se,ue),Ie("WebGLRenderer: Texture has been resized from ("+re.width+"x"+re.height+") to ("+se+"x"+ue+")."),j}else return"data"in E&&Ie("WebGLRenderer: Image in DataTexture is too big ("+re.width+"x"+re.height+")."),E;return E}function f(E){return E.generateMipmaps}function v(E){n.generateMipmap(E)}function M(E){return E.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:E.isWebGL3DRenderTarget?n.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function S(E,b,G,K,re,se=!1){if(E!==null){if(n[E]!==void 0)return n[E];Ie("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let ue;K&&(ue=e.get("EXT_texture_norm16"),ue||Ie("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let j=b;if(b===n.RED&&(G===n.FLOAT&&(j=n.R32F),G===n.HALF_FLOAT&&(j=n.R16F),G===n.UNSIGNED_BYTE&&(j=n.R8),G===n.UNSIGNED_SHORT&&ue&&(j=ue.R16_EXT),G===n.SHORT&&ue&&(j=ue.R16_SNORM_EXT)),b===n.RED_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.R8UI),G===n.UNSIGNED_SHORT&&(j=n.R16UI),G===n.UNSIGNED_INT&&(j=n.R32UI),G===n.BYTE&&(j=n.R8I),G===n.SHORT&&(j=n.R16I),G===n.INT&&(j=n.R32I)),b===n.RG&&(G===n.FLOAT&&(j=n.RG32F),G===n.HALF_FLOAT&&(j=n.RG16F),G===n.UNSIGNED_BYTE&&(j=n.RG8),G===n.UNSIGNED_SHORT&&ue&&(j=ue.RG16_EXT),G===n.SHORT&&ue&&(j=ue.RG16_SNORM_EXT)),b===n.RG_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.RG8UI),G===n.UNSIGNED_SHORT&&(j=n.RG16UI),G===n.UNSIGNED_INT&&(j=n.RG32UI),G===n.BYTE&&(j=n.RG8I),G===n.SHORT&&(j=n.RG16I),G===n.INT&&(j=n.RG32I)),b===n.RGB_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.RGB8UI),G===n.UNSIGNED_SHORT&&(j=n.RGB16UI),G===n.UNSIGNED_INT&&(j=n.RGB32UI),G===n.BYTE&&(j=n.RGB8I),G===n.SHORT&&(j=n.RGB16I),G===n.INT&&(j=n.RGB32I)),b===n.RGBA_INTEGER&&(G===n.UNSIGNED_BYTE&&(j=n.RGBA8UI),G===n.UNSIGNED_SHORT&&(j=n.RGBA16UI),G===n.UNSIGNED_INT&&(j=n.RGBA32UI),G===n.BYTE&&(j=n.RGBA8I),G===n.SHORT&&(j=n.RGBA16I),G===n.INT&&(j=n.RGBA32I)),b===n.RGB&&(G===n.UNSIGNED_SHORT&&ue&&(j=ue.RGB16_EXT),G===n.SHORT&&ue&&(j=ue.RGB16_SNORM_EXT),G===n.UNSIGNED_INT_5_9_9_9_REV&&(j=n.RGB9_E5),G===n.UNSIGNED_INT_10F_11F_11F_REV&&(j=n.R11F_G11F_B10F)),b===n.RGBA){let Q=se?Or:$e.getTransfer(re);G===n.FLOAT&&(j=n.RGBA32F),G===n.HALF_FLOAT&&(j=n.RGBA16F),G===n.UNSIGNED_BYTE&&(j=Q===et?n.SRGB8_ALPHA8:n.RGBA8),G===n.UNSIGNED_SHORT&&ue&&(j=ue.RGBA16_EXT),G===n.SHORT&&ue&&(j=ue.RGBA16_SNORM_EXT),G===n.UNSIGNED_SHORT_4_4_4_4&&(j=n.RGBA4),G===n.UNSIGNED_SHORT_5_5_5_1&&(j=n.RGB5_A1)}return(j===n.R16F||j===n.R32F||j===n.RG16F||j===n.RG32F||j===n.RGBA16F||j===n.RGBA32F)&&e.get("EXT_color_buffer_float"),j}function w(E,b){let G;return E?b===null||b===vn||b===dr?G=n.DEPTH24_STENCIL8:b===yn?G=n.DEPTH32F_STENCIL8:b===fr&&(G=n.DEPTH24_STENCIL8,Ie("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===vn||b===dr?G=n.DEPTH_COMPONENT24:b===yn?G=n.DEPTH_COMPONENT32F:b===fr&&(G=n.DEPTH_COMPONENT16),G}function y(E,b){return f(E)===!0||E.isFramebufferTexture&&E.minFilter!==Et&&E.minFilter!==Rt?Math.log2(Math.max(b.width,b.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?b.mipmaps.length:1}function A(E){let b=E.target;b.removeEventListener("dispose",A),C(b),b.isVideoTexture&&h.delete(b),b.isHTMLTexture&&d.delete(b)}function _(E){let b=E.target;b.removeEventListener("dispose",_),P(b)}function C(E){let b=i.get(E);if(b.__webglInit===void 0)return;let G=E.source,K=p.get(G);if(K){let re=K[b.__cacheKey];re.usedTimes--,re.usedTimes===0&&D(E),Object.keys(K).length===0&&p.delete(G)}i.remove(E)}function D(E){let b=i.get(E);n.deleteTexture(b.__webglTexture);let G=E.source,K=p.get(G);delete K[b.__cacheKey],a.memory.textures--}function P(E){let b=i.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),i.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let K=0;K<6;K++){if(Array.isArray(b.__webglFramebuffer[K]))for(let re=0;re<b.__webglFramebuffer[K].length;re++)n.deleteFramebuffer(b.__webglFramebuffer[K][re]);else n.deleteFramebuffer(b.__webglFramebuffer[K]);b.__webglDepthbuffer&&n.deleteRenderbuffer(b.__webglDepthbuffer[K])}else{if(Array.isArray(b.__webglFramebuffer))for(let K=0;K<b.__webglFramebuffer.length;K++)n.deleteFramebuffer(b.__webglFramebuffer[K]);else n.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&n.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&n.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRenderbuffer)for(let K=0;K<b.__webglColorRenderbuffer.length;K++)b.__webglColorRenderbuffer[K]&&n.deleteRenderbuffer(b.__webglColorRenderbuffer[K]);b.__webglDepthRenderbuffer&&n.deleteRenderbuffer(b.__webglDepthRenderbuffer)}let G=E.textures;for(let K=0,re=G.length;K<re;K++){let se=i.get(G[K]);se.__webglTexture&&(n.deleteTexture(se.__webglTexture),a.memory.textures--),i.remove(G[K])}i.remove(E)}let N=0;function V(){N=0}function I(){return N}function R(E){N=E}function L(){let E=N;return E>=r.maxTextures&&Ie("WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+r.maxTextures),N+=1,E}function k(E){let b=[];return b.push(E.wrapS),b.push(E.wrapT),b.push(E.wrapR||0),b.push(E.magFilter),b.push(E.minFilter),b.push(E.anisotropy),b.push(E.internalFormat),b.push(E.format),b.push(E.type),b.push(E.generateMipmaps),b.push(E.premultiplyAlpha),b.push(E.flipY),b.push(E.unpackAlignment),b.push(E.colorSpace),b.join()}function ee(E,b){let G=i.get(E);if(E.isVideoTexture&&ht(E),E.isRenderTargetTexture===!1&&E.isExternalTexture!==!0&&E.version>0&&G.__version!==E.version){let K=E.image;if(K===null)Ie("WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)Ie("WebGLRenderer: Texture marked for update but image is incomplete");else{ve(G,E,b);return}}else E.isExternalTexture&&(G.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,G.__webglTexture,n.TEXTURE0+b)}function ne(E,b){let G=i.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&G.__version!==E.version){ve(G,E,b);return}else E.isExternalTexture&&(G.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,G.__webglTexture,n.TEXTURE0+b)}function he(E,b){let G=i.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&G.__version!==E.version){ve(G,E,b);return}t.bindTexture(n.TEXTURE_3D,G.__webglTexture,n.TEXTURE0+b)}function q(E,b){let G=i.get(E);if(E.isCubeDepthTexture!==!0&&E.version>0&&G.__version!==E.version){Me(G,E,b);return}t.bindTexture(n.TEXTURE_CUBE_MAP,G.__webglTexture,n.TEXTURE0+b)}let J={[da]:n.REPEAT,[Cn]:n.CLAMP_TO_EDGE,[pa]:n.MIRRORED_REPEAT},fe={[Et]:n.NEAREST,[Hu]:n.NEAREST_MIPMAP_NEAREST,[os]:n.NEAREST_MIPMAP_LINEAR,[Rt]:n.LINEAR,[Za]:n.LINEAR_MIPMAP_NEAREST,[pi]:n.LINEAR_MIPMAP_LINEAR},De={[qu]:n.NEVER,[Ju]:n.ALWAYS,[Yu]:n.LESS,[Uo]:n.LEQUAL,[$u]:n.EQUAL,[Oo]:n.GEQUAL,[ju]:n.GREATER,[Zu]:n.NOTEQUAL};function Y(E,b){if(b.type===yn&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===Rt||b.magFilter===Za||b.magFilter===os||b.magFilter===pi||b.minFilter===Rt||b.minFilter===Za||b.minFilter===os||b.minFilter===pi)&&Ie("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(E,n.TEXTURE_WRAP_S,J[b.wrapS]),n.texParameteri(E,n.TEXTURE_WRAP_T,J[b.wrapT]),(E===n.TEXTURE_3D||E===n.TEXTURE_2D_ARRAY)&&n.texParameteri(E,n.TEXTURE_WRAP_R,J[b.wrapR]),n.texParameteri(E,n.TEXTURE_MAG_FILTER,fe[b.magFilter]),n.texParameteri(E,n.TEXTURE_MIN_FILTER,fe[b.minFilter]),b.compareFunction&&(n.texParameteri(E,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(E,n.TEXTURE_COMPARE_FUNC,De[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===Et||b.minFilter!==os&&b.minFilter!==pi||b.type===yn&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||i.get(b).__currentAnisotropy){let G=e.get("EXT_texture_filter_anisotropic");n.texParameterf(E,G.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,r.getMaxAnisotropy())),i.get(b).__currentAnisotropy=b.anisotropy}}}function z(E,b){let G=!1;E.__webglInit===void 0&&(E.__webglInit=!0,b.addEventListener("dispose",A));let K=b.source,re=p.get(K);re===void 0&&(re={},p.set(K,re));let se=k(b);if(se!==E.__cacheKey){re[se]===void 0&&(re[se]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,G=!0),re[se].usedTimes++;let ue=re[E.__cacheKey];ue!==void 0&&(re[E.__cacheKey].usedTimes--,ue.usedTimes===0&&D(b)),E.__cacheKey=se,E.__webglTexture=re[se].texture}return G}function $(E,b,G){return Math.floor(Math.floor(E/G)/b)}function te(E,b,G,K){let se=E.updateRanges;if(se.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,b.width,b.height,G,K,b.data);else{se.sort((Se,le)=>Se.start-le.start);let ue=0;for(let Se=1;Se<se.length;Se++){let le=se[ue],ae=se[Se],Fe=le.start+le.count,Ve=$(ae.start,b.width,4),Ke=$(le.start,b.width,4);ae.start<=Fe+1&&Ve===Ke&&$(ae.start+ae.count-1,b.width,4)===Ve?le.count=Math.max(le.count,ae.start+ae.count-le.start):(++ue,se[ue]=ae)}se.length=ue+1;let j=t.getParameter(n.UNPACK_ROW_LENGTH),Q=t.getParameter(n.UNPACK_SKIP_PIXELS),_e=t.getParameter(n.UNPACK_SKIP_ROWS);t.pixelStorei(n.UNPACK_ROW_LENGTH,b.width);for(let Se=0,le=se.length;Se<le;Se++){let ae=se[Se],Fe=Math.floor(ae.start/4),Ve=Math.ceil(ae.count/4),Ke=Fe%b.width,O=Math.floor(Fe/b.width),oe=Ve,Z=1;t.pixelStorei(n.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(n.UNPACK_SKIP_ROWS,O),t.texSubImage2D(n.TEXTURE_2D,0,Ke,O,oe,Z,G,K,b.data)}E.clearUpdateRanges(),t.pixelStorei(n.UNPACK_ROW_LENGTH,j),t.pixelStorei(n.UNPACK_SKIP_PIXELS,Q),t.pixelStorei(n.UNPACK_SKIP_ROWS,_e)}}function ve(E,b,G){let K=n.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(K=n.TEXTURE_2D_ARRAY),b.isData3DTexture&&(K=n.TEXTURE_3D);let re=z(E,b),se=b.source;t.bindTexture(K,E.__webglTexture,n.TEXTURE0+G);let ue=i.get(se);if(se.version!==ue.__version||re===!0){if(t.activeTexture(n.TEXTURE0+G),(typeof ImageBitmap<"u"&&b.image instanceof ImageBitmap)===!1){let Z=$e.getPrimaries($e.workingColorSpace),ye=b.colorSpace===$n?null:$e.getPrimaries(b.colorSpace),ce=b.colorSpace===$n||Z===ye?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ce)}t.pixelStorei(n.UNPACK_ALIGNMENT,b.unpackAlignment);let Q=g(b.image,!1,r.maxTextureSize);Q=de(b,Q);let _e=s.convert(b.format,b.colorSpace),Se=s.convert(b.type),le=S(b.internalFormat,_e,Se,b.normalized,b.colorSpace,b.isVideoTexture);Y(K,b);let ae,Fe=b.mipmaps,Ve=b.isVideoTexture!==!0,Ke=ue.__version===void 0||re===!0,O=se.dataReady,oe=y(b,Q);if(b.isDepthTexture)le=w(b.format===mi,b.type),Ke&&(Ve?t.texStorage2D(n.TEXTURE_2D,1,le,Q.width,Q.height):t.texImage2D(n.TEXTURE_2D,0,le,Q.width,Q.height,0,_e,Se,null));else if(b.isDataTexture)if(Fe.length>0){Ve&&Ke&&t.texStorage2D(n.TEXTURE_2D,oe,le,Fe[0].width,Fe[0].height);for(let Z=0,ye=Fe.length;Z<ye;Z++)ae=Fe[Z],Ve?O&&t.texSubImage2D(n.TEXTURE_2D,Z,0,0,ae.width,ae.height,_e,Se,ae.data):t.texImage2D(n.TEXTURE_2D,Z,le,ae.width,ae.height,0,_e,Se,ae.data);b.generateMipmaps=!1}else Ve?(Ke&&t.texStorage2D(n.TEXTURE_2D,oe,le,Q.width,Q.height),O&&te(b,Q,_e,Se)):t.texImage2D(n.TEXTURE_2D,0,le,Q.width,Q.height,0,_e,Se,Q.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){Ve&&Ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,oe,le,Fe[0].width,Fe[0].height,Q.depth);for(let Z=0,ye=Fe.length;Z<ye;Z++)if(ae=Fe[Z],b.format!==hn)if(_e!==null)if(Ve){if(O)if(b.layerUpdates.size>0){let ce=Mc(ae.width,ae.height,b.format,b.type);for(let ie of b.layerUpdates){let Ce=ae.data.subarray(ie*ce/ae.data.BYTES_PER_ELEMENT,(ie+1)*ce/ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Z,0,0,ie,ae.width,ae.height,1,_e,Ce)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Z,0,0,0,ae.width,ae.height,Q.depth,_e,ae.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Z,le,ae.width,ae.height,Q.depth,0,ae.data,0,0);else Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ve?O&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Z,0,0,0,ae.width,ae.height,Q.depth,_e,Se,ae.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Z,le,ae.width,ae.height,Q.depth,0,_e,Se,ae.data)}else{Ve&&Ke&&t.texStorage2D(n.TEXTURE_2D,oe,le,Fe[0].width,Fe[0].height);for(let Z=0,ye=Fe.length;Z<ye;Z++)ae=Fe[Z],b.format!==hn?_e!==null?Ve?O&&t.compressedTexSubImage2D(n.TEXTURE_2D,Z,0,0,ae.width,ae.height,_e,ae.data):t.compressedTexImage2D(n.TEXTURE_2D,Z,le,ae.width,ae.height,0,ae.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ve?O&&t.texSubImage2D(n.TEXTURE_2D,Z,0,0,ae.width,ae.height,_e,Se,ae.data):t.texImage2D(n.TEXTURE_2D,Z,le,ae.width,ae.height,0,_e,Se,ae.data)}else if(b.isDataArrayTexture)if(Ve){if(Ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,oe,le,Q.width,Q.height,Q.depth),O)if(b.layerUpdates.size>0){let Z=Mc(Q.width,Q.height,b.format,b.type);for(let ye of b.layerUpdates){let ce=Q.data.subarray(ye*Z/Q.data.BYTES_PER_ELEMENT,(ye+1)*Z/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,ye,Q.width,Q.height,1,_e,Se,ce)}b.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,_e,Se,Q.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,le,Q.width,Q.height,Q.depth,0,_e,Se,Q.data);else if(b.isData3DTexture)Ve?(Ke&&t.texStorage3D(n.TEXTURE_3D,oe,le,Q.width,Q.height,Q.depth),O&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,_e,Se,Q.data)):t.texImage3D(n.TEXTURE_3D,0,le,Q.width,Q.height,Q.depth,0,_e,Se,Q.data);else if(b.isFramebufferTexture){if(Ke)if(Ve)t.texStorage2D(n.TEXTURE_2D,oe,le,Q.width,Q.height);else{let Z=Q.width,ye=Q.height;for(let ce=0;ce<oe;ce++)t.texImage2D(n.TEXTURE_2D,ce,le,Z,ye,0,_e,Se,null),Z>>=1,ye>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in n){let Z=n.canvas;if(Z.hasAttribute("layoutsubtree")||Z.setAttribute("layoutsubtree","true"),Q.parentNode!==Z){Z.appendChild(Q),d.add(b),Z.onpaint=ke=>{let xt=ke.changedElements;for(let rt of d)xt.includes(rt.image)&&(rt.needsUpdate=!0)},Z.requestPaint();return}let ye=0,ce=n.RGBA,ie=n.RGBA,Ce=n.UNSIGNED_BYTE;n.texElementImage2D(n.TEXTURE_2D,ye,ce,ie,Ce,Q),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)}}else if(Fe.length>0){if(Ve&&Ke){let Z=mt(Fe[0]);t.texStorage2D(n.TEXTURE_2D,oe,le,Z.width,Z.height)}for(let Z=0,ye=Fe.length;Z<ye;Z++)ae=Fe[Z],Ve?O&&t.texSubImage2D(n.TEXTURE_2D,Z,0,0,_e,Se,ae):t.texImage2D(n.TEXTURE_2D,Z,le,_e,Se,ae);b.generateMipmaps=!1}else if(Ve){if(Ke){let Z=mt(Q);t.texStorage2D(n.TEXTURE_2D,oe,le,Z.width,Z.height)}O&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,_e,Se,Q)}else t.texImage2D(n.TEXTURE_2D,0,le,_e,Se,Q);f(b)&&v(K),ue.__version=se.version,b.onUpdate&&b.onUpdate(b)}E.__version=b.version}function Me(E,b,G){if(b.image.length!==6)return;let K=z(E,b),re=b.source;t.bindTexture(n.TEXTURE_CUBE_MAP,E.__webglTexture,n.TEXTURE0+G);let se=i.get(re);if(re.version!==se.__version||K===!0){t.activeTexture(n.TEXTURE0+G);let ue=$e.getPrimaries($e.workingColorSpace),j=b.colorSpace===$n?null:$e.getPrimaries(b.colorSpace),Q=b.colorSpace===$n||ue===j?n.NONE:n.BROWSER_DEFAULT_WEBGL;t.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(n.UNPACK_ALIGNMENT,b.unpackAlignment),t.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Q);let _e=b.isCompressedTexture||b.image[0].isCompressedTexture,Se=b.image[0]&&b.image[0].isDataTexture,le=[];for(let ie=0;ie<6;ie++)!_e&&!Se?le[ie]=g(b.image[ie],!0,r.maxCubemapSize):le[ie]=Se?b.image[ie].image:b.image[ie],le[ie]=de(b,le[ie]);let ae=le[0],Fe=s.convert(b.format,b.colorSpace),Ve=s.convert(b.type),Ke=S(b.internalFormat,Fe,Ve,b.normalized,b.colorSpace),O=b.isVideoTexture!==!0,oe=se.__version===void 0||K===!0,Z=re.dataReady,ye=y(b,ae);Y(n.TEXTURE_CUBE_MAP,b);let ce;if(_e){O&&oe&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ye,Ke,ae.width,ae.height);for(let ie=0;ie<6;ie++){ce=le[ie].mipmaps;for(let Ce=0;Ce<ce.length;Ce++){let ke=ce[Ce];b.format!==hn?Fe!==null?O?Z&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,0,0,ke.width,ke.height,Fe,ke.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,Ke,ke.width,ke.height,0,ke.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):O?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,0,0,ke.width,ke.height,Fe,Ve,ke.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce,Ke,ke.width,ke.height,0,Fe,Ve,ke.data)}}}else{if(ce=b.mipmaps,O&&oe){ce.length>0&&ye++;let ie=mt(le[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,ye,Ke,ie.width,ie.height)}for(let ie=0;ie<6;ie++)if(Se){O?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,le[ie].width,le[ie].height,Fe,Ve,le[ie].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,Ke,le[ie].width,le[ie].height,0,Fe,Ve,le[ie].data);for(let Ce=0;Ce<ce.length;Ce++){let xt=ce[Ce].image[ie].image;O?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,0,0,xt.width,xt.height,Fe,Ve,xt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,Ke,xt.width,xt.height,0,Fe,Ve,xt.data)}}else{O?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,Fe,Ve,le[ie]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,Ke,Fe,Ve,le[ie]);for(let Ce=0;Ce<ce.length;Ce++){let ke=ce[Ce];O?Z&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,0,0,Fe,Ve,ke.image[ie]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,Ce+1,Ke,Fe,Ve,ke.image[ie])}}}f(b)&&v(n.TEXTURE_CUBE_MAP),se.__version=re.version,b.onUpdate&&b.onUpdate(b)}E.__version=b.version}function xe(E,b,G,K,re,se){let ue=s.convert(G.format,G.colorSpace),j=s.convert(G.type),Q=S(G.internalFormat,ue,j,G.normalized,G.colorSpace),_e=i.get(b),Se=i.get(G);if(Se.__renderTarget=b,!_e.__hasExternalTextures){let le=Math.max(1,b.width>>se),ae=Math.max(1,b.height>>se);re===n.TEXTURE_3D||re===n.TEXTURE_2D_ARRAY?t.texImage3D(re,se,Q,le,ae,b.depth,0,ue,j,null):t.texImage2D(re,se,Q,le,ae,0,ue,j,null)}t.bindFramebuffer(n.FRAMEBUFFER,E),Ye(b)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,K,re,Se.__webglTexture,0,Mt(b)):(re===n.TEXTURE_2D||re>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&re<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,K,re,Se.__webglTexture,se),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ze(E,b,G){if(n.bindRenderbuffer(n.RENDERBUFFER,E),b.depthBuffer){let K=b.depthTexture,re=K&&K.isDepthTexture?K.type:null,se=w(b.stencilBuffer,re),ue=b.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;Ye(b)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Mt(b),se,b.width,b.height):G?n.renderbufferStorageMultisample(n.RENDERBUFFER,Mt(b),se,b.width,b.height):n.renderbufferStorage(n.RENDERBUFFER,se,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,E)}else{let K=b.textures;for(let re=0;re<K.length;re++){let se=K[re],ue=s.convert(se.format,se.colorSpace),j=s.convert(se.type),Q=S(se.internalFormat,ue,j,se.normalized,se.colorSpace);Ye(b)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Mt(b),Q,b.width,b.height):G?n.renderbufferStorageMultisample(n.RENDERBUFFER,Mt(b),Q,b.width,b.height):n.renderbufferStorage(n.RENDERBUFFER,Q,b.width,b.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ue(E,b,G){let K=b.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,E),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let re=i.get(b.depthTexture);if(re.__renderTarget=b,(!re.__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),K){if(re.__webglInit===void 0&&(re.__webglInit=!0,b.depthTexture.addEventListener("dispose",A)),re.__webglTexture===void 0){re.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,re.__webglTexture),Y(n.TEXTURE_CUBE_MAP,b.depthTexture);let _e=s.convert(b.depthTexture.format),Se=s.convert(b.depthTexture.type),le;b.depthTexture.format===Pn?le=n.DEPTH_COMPONENT24:b.depthTexture.format===mi&&(le=n.DEPTH24_STENCIL8);for(let ae=0;ae<6;ae++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0,le,b.width,b.height,0,_e,Se,null)}}else ee(b.depthTexture,0);let se=re.__webglTexture,ue=Mt(b),j=K?n.TEXTURE_CUBE_MAP_POSITIVE_X+G:n.TEXTURE_2D,Q=b.depthTexture.format===mi?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(b.depthTexture.format===Pn)Ye(b)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Q,j,se,0,ue):n.framebufferTexture2D(n.FRAMEBUFFER,Q,j,se,0);else if(b.depthTexture.format===mi)Ye(b)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Q,j,se,0,ue):n.framebufferTexture2D(n.FRAMEBUFFER,Q,j,se,0);else throw new Error("Unknown depthTexture format")}function qe(E){let b=i.get(E),G=E.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==E.depthTexture){let K=E.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),K){let re=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,K.removeEventListener("dispose",re)};K.addEventListener("dispose",re),b.__depthDisposeCallback=re}b.__boundDepthTexture=K}if(E.depthTexture&&!b.__autoAllocateDepthBuffer)if(G)for(let K=0;K<6;K++)Ue(b.__webglFramebuffer[K],E,K);else{let K=E.texture.mipmaps;K&&K.length>0?Ue(b.__webglFramebuffer[0],E,0):Ue(b.__webglFramebuffer,E,0)}else if(G){b.__webglDepthbuffer=[];for(let K=0;K<6;K++)if(t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer[K]),b.__webglDepthbuffer[K]===void 0)b.__webglDepthbuffer[K]=n.createRenderbuffer(),Ze(b.__webglDepthbuffer[K],E,!1);else{let re=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,se=b.__webglDepthbuffer[K];n.bindRenderbuffer(n.RENDERBUFFER,se),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,se)}}else{let K=E.texture.mipmaps;if(K&&K.length>0?t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=n.createRenderbuffer(),Ze(b.__webglDepthbuffer,E,!1);else{let re=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,se=b.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,se),n.framebufferRenderbuffer(n.FRAMEBUFFER,re,n.RENDERBUFFER,se)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Qe(E,b,G){let K=i.get(E);b!==void 0&&xe(K.__webglFramebuffer,E,E.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),G!==void 0&&qe(E)}function Oe(E){let b=E.texture,G=i.get(E),K=i.get(b);E.addEventListener("dispose",_);let re=E.textures,se=E.isWebGLCubeRenderTarget===!0,ue=re.length>1;if(ue||(K.__webglTexture===void 0&&(K.__webglTexture=n.createTexture()),K.__version=b.version,a.memory.textures++),se){G.__webglFramebuffer=[];for(let j=0;j<6;j++)if(b.mipmaps&&b.mipmaps.length>0){G.__webglFramebuffer[j]=[];for(let Q=0;Q<b.mipmaps.length;Q++)G.__webglFramebuffer[j][Q]=n.createFramebuffer()}else G.__webglFramebuffer[j]=n.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){G.__webglFramebuffer=[];for(let j=0;j<b.mipmaps.length;j++)G.__webglFramebuffer[j]=n.createFramebuffer()}else G.__webglFramebuffer=n.createFramebuffer();if(ue)for(let j=0,Q=re.length;j<Q;j++){let _e=i.get(re[j]);_e.__webglTexture===void 0&&(_e.__webglTexture=n.createTexture(),a.memory.textures++)}if(E.samples>0&&Ye(E)===!1){G.__webglMultisampledFramebuffer=n.createFramebuffer(),G.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,G.__webglMultisampledFramebuffer);for(let j=0;j<re.length;j++){let Q=re[j];G.__webglColorRenderbuffer[j]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,G.__webglColorRenderbuffer[j]);let _e=s.convert(Q.format,Q.colorSpace),Se=s.convert(Q.type),le=S(Q.internalFormat,_e,Se,Q.normalized,Q.colorSpace,E.isXRRenderTarget===!0),ae=Mt(E);n.renderbufferStorageMultisample(n.RENDERBUFFER,ae,le,E.width,E.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+j,n.RENDERBUFFER,G.__webglColorRenderbuffer[j])}n.bindRenderbuffer(n.RENDERBUFFER,null),E.depthBuffer&&(G.__webglDepthRenderbuffer=n.createRenderbuffer(),Ze(G.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(se){t.bindTexture(n.TEXTURE_CUBE_MAP,K.__webglTexture),Y(n.TEXTURE_CUBE_MAP,b);for(let j=0;j<6;j++)if(b.mipmaps&&b.mipmaps.length>0)for(let Q=0;Q<b.mipmaps.length;Q++)xe(G.__webglFramebuffer[j][Q],E,b,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+j,Q);else xe(G.__webglFramebuffer[j],E,b,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+j,0);f(b)&&v(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ue){for(let j=0,Q=re.length;j<Q;j++){let _e=re[j],Se=i.get(_e),le=n.TEXTURE_2D;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(le=E.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(le,Se.__webglTexture),Y(le,_e),xe(G.__webglFramebuffer,E,_e,n.COLOR_ATTACHMENT0+j,le,0),f(_e)&&v(le)}t.unbindTexture()}else{let j=n.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(j=E.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(j,K.__webglTexture),Y(j,b),b.mipmaps&&b.mipmaps.length>0)for(let Q=0;Q<b.mipmaps.length;Q++)xe(G.__webglFramebuffer[Q],E,b,n.COLOR_ATTACHMENT0,j,Q);else xe(G.__webglFramebuffer,E,b,n.COLOR_ATTACHMENT0,j,0);f(b)&&v(j),t.unbindTexture()}E.depthBuffer&&qe(E)}function it(E){let b=E.textures;for(let G=0,K=b.length;G<K;G++){let re=b[G];if(f(re)){let se=M(E),ue=i.get(re).__webglTexture;t.bindTexture(se,ue),v(se),t.unbindTexture()}}}let nt=[],jt=[];function F(E){if(E.samples>0){if(Ye(E)===!1){let b=E.textures,G=E.width,K=E.height,re=n.COLOR_BUFFER_BIT,se=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ue=i.get(E),j=b.length>1;if(j)for(let _e=0;_e<b.length;_e++)t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,ue.__webglMultisampledFramebuffer);let Q=E.texture.mipmaps;Q&&Q.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglFramebuffer);for(let _e=0;_e<b.length;_e++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(re|=n.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(re|=n.STENCIL_BUFFER_BIT)),j){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,ue.__webglColorRenderbuffer[_e]);let Se=i.get(b[_e]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Se,0)}n.blitFramebuffer(0,0,G,K,0,0,G,K,re,n.NEAREST),l===!0&&(nt.length=0,jt.length=0,nt.push(n.COLOR_ATTACHMENT0+_e),E.depthBuffer&&E.resolveDepthBuffer===!1&&(nt.push(se),jt.push(se),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,jt)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,nt))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),j)for(let _e=0;_e<b.length;_e++){t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.RENDERBUFFER,ue.__webglColorRenderbuffer[_e]);let Se=i.get(b[_e]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,ue.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+_e,n.TEXTURE_2D,Se,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&l){let b=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[b])}}}function Mt(E){return Math.min(r.maxSamples,E.samples)}function Ye(E){let b=i.get(E);return E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function ht(E){let b=a.render.frame;h.get(E)!==b&&(h.set(E,b),E.update())}function de(E,b){let G=E.colorSpace,K=E.format,re=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||G!==Ur&&G!==$n&&($e.getTransfer(G)===et?(K!==hn||re!==qt)&&Ie("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Le("WebGLTextures: Unsupported texture color space:",G)),b}function mt(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(c.width=E.naturalWidth||E.width,c.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(c.width=E.displayWidth,c.height=E.displayHeight):(c.width=E.width,c.height=E.height),c}this.allocateTextureUnit=L,this.resetTextureUnits=V,this.getTextureUnits=I,this.setTextureUnits=R,this.setTexture2D=ee,this.setTexture2DArray=ne,this.setTexture3D=he,this.setTextureCube=q,this.rebindTextures=Qe,this.setupRenderTarget=Oe,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=F,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=Ye,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Ty(n,e){function t(i,r=$n){let s,a=$e.getTransfer(r);if(i===qt)return n.UNSIGNED_BYTE;if(i===Ka)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Qa)return n.UNSIGNED_SHORT_5_5_5_1;if(i===cc)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===hc)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===oc)return n.BYTE;if(i===lc)return n.SHORT;if(i===fr)return n.UNSIGNED_SHORT;if(i===Ja)return n.INT;if(i===vn)return n.UNSIGNED_INT;if(i===yn)return n.FLOAT;if(i===Nn)return n.HALF_FLOAT;if(i===uc)return n.ALPHA;if(i===fc)return n.RGB;if(i===hn)return n.RGBA;if(i===Pn)return n.DEPTH_COMPONENT;if(i===mi)return n.DEPTH_STENCIL;if(i===dc)return n.RED;if(i===eo)return n.RED_INTEGER;if(i===gi)return n.RG;if(i===to)return n.RG_INTEGER;if(i===no)return n.RGBA_INTEGER;if(i===ls||i===cs||i===hs||i===us)if(a===et)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===ls)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===cs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===hs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===us)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===ls)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===cs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===hs)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===us)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===io||i===ro||i===so||i===ao)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===io)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ro)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===so)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===ao)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===oo||i===lo||i===co||i===ho||i===uo||i===fs||i===fo)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===oo||i===lo)return a===et?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===co)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===ho)return s.COMPRESSED_R11_EAC;if(i===uo)return s.COMPRESSED_SIGNED_R11_EAC;if(i===fs)return s.COMPRESSED_RG11_EAC;if(i===fo)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===po||i===mo||i===go||i===_o||i===xo||i===vo||i===yo||i===bo||i===Mo||i===So||i===wo||i===To||i===Ao||i===Eo)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===po)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===mo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===go)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===_o)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===xo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===vo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===yo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===bo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Mo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===So)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===wo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===To)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Ao)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Eo)return a===et?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Co||i===Ro||i===Po)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Co)return a===et?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ro)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Po)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Io||i===Do||i===ds||i===Lo)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Io)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Do)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===ds)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Lo)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===dr?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}var Ay=`
|
|
4580
4580
|
void main() {
|
|
4581
4581
|
|
|
4582
4582
|
gl_Position = vec4( position, 1.0 );
|
|
4583
4583
|
|
|
4584
|
-
}`,
|
|
4584
|
+
}`,Ey=`
|
|
4585
4585
|
uniform sampler2DArray depthColor;
|
|
4586
4586
|
uniform float depthWidth;
|
|
4587
4587
|
uniform float depthHeight;
|
|
@@ -4600,11 +4600,11 @@ void main() {
|
|
|
4600
4600
|
|
|
4601
4601
|
}
|
|
4602
4602
|
|
|
4603
|
-
}`,Vc=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let i=new Xr(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,i=new nn({vertexShader:yy,fragmentShader:by,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Xt(new $r(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Gc=class extends _n{constructor(e,t){super();let i=this,r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,u=null,p=null,m=null,x=typeof XRWebGLBinding<"u",g=new Vc,f={},v=t.getContextAttributes(),M=null,S=null,w=[],y=[],A=new Te,_=null,C=new Nt;C.viewport=new pt;let D=new Nt;D.viewport=new pt;let P=[C,D],N=new Xa,V=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(z){let $=w[z];return $===void 0&&($=new ir,w[z]=$),$.getTargetRaySpace()},this.getControllerGrip=function(z){let $=w[z];return $===void 0&&($=new ir,w[z]=$),$.getGripSpace()},this.getHand=function(z){let $=w[z];return $===void 0&&($=new ir,w[z]=$),$.getHandSpace()};function R(z){let $=y.indexOf(z.inputSource);if($===-1)return;let te=w[$];te!==void 0&&(te.update(z.inputSource,z.frame,c||a),te.dispatchEvent({type:z.type,data:z.inputSource}))}function L(){r.removeEventListener("select",R),r.removeEventListener("selectstart",R),r.removeEventListener("selectend",R),r.removeEventListener("squeeze",R),r.removeEventListener("squeezestart",R),r.removeEventListener("squeezeend",R),r.removeEventListener("end",L),r.removeEventListener("inputsourceschange",k);for(let z=0;z<w.length;z++){let $=y[z];$!==null&&(y[z]=null,w[z].disconnect($))}V=null,I=null,g.reset();for(let z in f)delete f[z];e.setRenderTarget(M),p=null,u=null,d=null,r=null,S=null,Y.stop(),i.isPresenting=!1,e.setPixelRatio(_),e.setSize(A.width,A.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(z){s=z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(z){o=z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(z){c=z},this.getBaseLayer=function(){return u!==null?u:p},this.getBinding=function(){return d===null&&x&&(d=new XRWebGLBinding(r,t)),d},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(z){if(r=z,r!==null){if(M=e.getRenderTarget(),r.addEventListener("select",R),r.addEventListener("selectstart",R),r.addEventListener("selectend",R),r.addEventListener("squeeze",R),r.addEventListener("squeezestart",R),r.addEventListener("squeezeend",R),r.addEventListener("end",L),r.addEventListener("inputsourceschange",k),v.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(A),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let te=null,ve=null,Me=null;v.depth&&(Me=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,te=v.stencil?mi:Pn,ve=v.stencil?dr:vn);let xe={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:s};d=this.getBinding(),u=d.createProjectionLayer(xe),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),S=new tn(u.textureWidth,u.textureHeight,{format:hn,type:qt,depthTexture:new Yn(u.textureWidth,u.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,te),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{let te={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,te),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),S=new tn(p.framebufferWidth,p.framebufferHeight,{format:hn,type:qt,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Y.setContext(r),Y.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function k(z){for(let $=0;$<z.removed.length;$++){let te=z.removed[$],ve=y.indexOf(te);ve>=0&&(y[ve]=null,w[ve].disconnect(te))}for(let $=0;$<z.added.length;$++){let te=z.added[$],ve=y.indexOf(te);if(ve===-1){for(let xe=0;xe<w.length;xe++)if(xe>=y.length){y.push(te),ve=xe;break}else if(y[xe]===null){y[xe]=te,ve=xe;break}if(ve===-1)break}let Me=w[ve];Me&&Me.connect(te)}}let ee=new U,ne=new U;function he(z,$,te){ee.setFromMatrixPosition($.matrixWorld),ne.setFromMatrixPosition(te.matrixWorld);let ve=ee.distanceTo(ne),Me=$.projectionMatrix.elements,xe=te.projectionMatrix.elements,Ze=Me[14]/(Me[10]-1),Ue=Me[14]/(Me[10]+1),qe=(Me[9]+1)/Me[5],Qe=(Me[9]-1)/Me[5],Fe=(Me[8]-1)/Me[0],it=(xe[8]+1)/xe[0],nt=Ze*Fe,jt=Ze*it,O=ve/(-Fe+it),Mt=O*-Fe;if($.matrixWorld.decompose(z.position,z.quaternion,z.scale),z.translateX(Mt),z.translateZ(O),z.matrixWorld.compose(z.position,z.quaternion,z.scale),z.matrixWorldInverse.copy(z.matrixWorld).invert(),Me[10]===-1)z.projectionMatrix.copy($.projectionMatrix),z.projectionMatrixInverse.copy($.projectionMatrixInverse);else{let Ye=Ze+O,ht=Ue+O,de=nt-Mt,mt=jt+(ve-Mt),E=qe*Ue/ht*Ye,b=Qe*Ue/ht*Ye;z.projectionMatrix.makePerspective(de,mt,E,b,Ye,ht),z.projectionMatrixInverse.copy(z.projectionMatrix).invert()}}function q(z,$){$===null?z.matrixWorld.copy(z.matrix):z.matrixWorld.multiplyMatrices($.matrixWorld,z.matrix),z.matrixWorldInverse.copy(z.matrixWorld).invert()}this.updateCamera=function(z){if(r===null)return;let $=z.near,te=z.far;g.texture!==null&&(g.depthNear>0&&($=g.depthNear),g.depthFar>0&&(te=g.depthFar)),N.near=D.near=C.near=$,N.far=D.far=C.far=te,(V!==N.near||I!==N.far)&&(r.updateRenderState({depthNear:N.near,depthFar:N.far}),V=N.near,I=N.far),N.layers.mask=z.layers.mask|6,C.layers.mask=N.layers.mask&-5,D.layers.mask=N.layers.mask&-3;let ve=z.parent,Me=N.cameras;q(N,ve);for(let xe=0;xe<Me.length;xe++)q(Me[xe],ve);Me.length===2?he(N,C,D):N.projectionMatrix.copy(C.projectionMatrix),J(z,N,ve)};function J(z,$,te){te===null?z.matrix.copy($.matrixWorld):(z.matrix.copy(te.matrixWorld),z.matrix.invert(),z.matrix.multiply($.matrixWorld)),z.matrix.decompose(z.position,z.quaternion,z.scale),z.updateMatrixWorld(!0),z.projectionMatrix.copy($.projectionMatrix),z.projectionMatrixInverse.copy($.projectionMatrixInverse),z.isPerspectiveCamera&&(z.fov=er*2*Math.atan(1/z.projectionMatrix.elements[5]),z.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(u===null&&p===null))return l},this.setFoveation=function(z){l=z,u!==null&&(u.fixedFoveation=z),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=z)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(N)},this.getCameraTexture=function(z){return f[z]};let fe=null;function De(z,$){if(h=$.getViewerPose(c||a),m=$,h!==null){let te=h.views;p!==null&&(e.setRenderTargetFramebuffer(S,p.framebuffer),e.setRenderTarget(S));let ve=!1;te.length!==N.cameras.length&&(N.cameras.length=0,ve=!0);for(let Ue=0;Ue<te.length;Ue++){let qe=te[Ue],Qe=null;if(p!==null)Qe=p.getViewport(qe);else{let it=d.getViewSubImage(u,qe);Qe=it.viewport,Ue===0&&(e.setRenderTargetTextures(S,it.colorTexture,it.depthStencilTexture),e.setRenderTarget(S))}let Fe=P[Ue];Fe===void 0&&(Fe=new Nt,Fe.layers.enable(Ue),Fe.viewport=new pt,P[Ue]=Fe),Fe.matrix.fromArray(qe.transform.matrix),Fe.matrix.decompose(Fe.position,Fe.quaternion,Fe.scale),Fe.projectionMatrix.fromArray(qe.projectionMatrix),Fe.projectionMatrixInverse.copy(Fe.projectionMatrix).invert(),Fe.viewport.set(Qe.x,Qe.y,Qe.width,Qe.height),Ue===0&&(N.matrix.copy(Fe.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),ve===!0&&N.cameras.push(Fe)}let Me=r.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&x){d=i.getBinding();let Ue=d.getDepthInformation(te[0]);Ue&&Ue.isValid&&Ue.texture&&g.init(Ue,r.renderState)}if(Me&&Me.includes("camera-access")&&x){e.state.unbindTexture(),d=i.getBinding();for(let Ue=0;Ue<te.length;Ue++){let qe=te[Ue].camera;if(qe){let Qe=f[qe];Qe||(Qe=new Xr,f[qe]=Qe);let Fe=d.getCameraImage(qe);Qe.sourceTexture=Fe}}}}for(let te=0;te<w.length;te++){let ve=y[te],Me=w[te];ve!==null&&Me!==void 0&&Me.update(ve,$,c||a)}fe&&fe(z,$),$.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:$}),m=null}let Y=new Ef;Y.setAnimationLoop(De),this.setAnimationLoop=function(z){fe=z},this.dispose=function(){}}},My=new ct,Lf=new Be;Lf.set(-1,0,0,0,1,0,0,0,1);function Sy(n,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function i(g,f){f.color.getRGB(g.fogColor.value,vc(n)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function r(g,f,v,M,S){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?s(g,f):f.isMeshLambertMaterial?(s(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(g,f),d(g,f)):f.isMeshPhongMaterial?(s(g,f),h(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(g,f),u(g,f),f.isMeshPhysicalMaterial&&p(g,f,S)):f.isMeshMatcapMaterial?(s(g,f),m(g,f)):f.isMeshDepthMaterial?s(g,f):f.isMeshDistanceMaterial?(s(g,f),x(g,f)):f.isMeshNormalMaterial?s(g,f):f.isLineBasicMaterial?(a(g,f),f.isLineDashedMaterial&&o(g,f)):f.isPointsMaterial?l(g,f,v,M):f.isSpriteMaterial?c(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===Vt&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===Vt&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);let v=e.get(f),M=v.envMap,S=v.envMapRotation;M&&(g.envMap.value=M,g.envMapRotation.value.setFromMatrix4(My.makeRotationFromEuler(S)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(Lf),g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function a(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function o(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function l(g,f,v,M){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*v,g.scale.value=M*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function c(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function h(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function d(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function u(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function p(g,f,v){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Vt&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,f){f.matcap&&(g.matcap.value=f.matcap)}function x(g,f){let v=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function wy(n,e,t,i){let r={},s={},a=[],o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,M){let S=M.program;i.uniformBlockBinding(v,S)}function c(v,M){let S=r[v.id];S===void 0&&(m(v),S=h(v),r[v.id]=S,v.addEventListener("dispose",g));let w=M.program;i.updateUBOMapping(v,w);let y=e.render.frame;s[v.id]!==y&&(u(v),s[v.id]=y)}function h(v){let M=d();v.__bindingPointIndex=M;let S=n.createBuffer(),w=v.__size,y=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,S),n.bufferData(n.UNIFORM_BUFFER,w,y),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,M,S),S}function d(){for(let v=0;v<o;v++)if(a.indexOf(v)===-1)return a.push(v),v;return Le("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(v){let M=r[v.id],S=v.uniforms,w=v.__cache;n.bindBuffer(n.UNIFORM_BUFFER,M);for(let y=0,A=S.length;y<A;y++){let _=Array.isArray(S[y])?S[y]:[S[y]];for(let C=0,D=_.length;C<D;C++){let P=_[C];if(p(P,y,C,w)===!0){let N=P.__offset,V=Array.isArray(P.value)?P.value:[P.value],I=0;for(let R=0;R<V.length;R++){let L=V[R],k=x(L);typeof L=="number"||typeof L=="boolean"?(P.__data[0]=L,n.bufferSubData(n.UNIFORM_BUFFER,N+I,P.__data)):L.isMatrix3?(P.__data[0]=L.elements[0],P.__data[1]=L.elements[1],P.__data[2]=L.elements[2],P.__data[3]=0,P.__data[4]=L.elements[3],P.__data[5]=L.elements[4],P.__data[6]=L.elements[5],P.__data[7]=0,P.__data[8]=L.elements[6],P.__data[9]=L.elements[7],P.__data[10]=L.elements[8],P.__data[11]=0):ArrayBuffer.isView(L)?P.__data.set(new L.constructor(L.buffer,L.byteOffset,P.__data.length)):(L.toArray(P.__data,I),I+=k.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,N,P.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(v,M,S,w){let y=v.value,A=M+"_"+S;if(w[A]===void 0)return typeof y=="number"||typeof y=="boolean"?w[A]=y:ArrayBuffer.isView(y)?w[A]=y.slice():w[A]=y.clone(),!0;{let _=w[A];if(typeof y=="number"||typeof y=="boolean"){if(_!==y)return w[A]=y,!0}else{if(ArrayBuffer.isView(y))return!0;if(_.equals(y)===!1)return _.copy(y),!0}}return!1}function m(v){let M=v.uniforms,S=0,w=16;for(let A=0,_=M.length;A<_;A++){let C=Array.isArray(M[A])?M[A]:[M[A]];for(let D=0,P=C.length;D<P;D++){let N=C[D],V=Array.isArray(N.value)?N.value:[N.value];for(let I=0,R=V.length;I<R;I++){let L=V[I],k=x(L),ee=S%w,ne=ee%k.boundary,he=ee+ne;S+=ne,he!==0&&w-he<k.storage&&(S+=w-he),N.__data=new Float32Array(k.storage/Float32Array.BYTES_PER_ELEMENT),N.__offset=S,S+=k.storage}}}let y=S%w;return y>0&&(S+=w-y),v.__size=S,v.__cache={},this}function x(v){let M={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(M.boundary=4,M.storage=4):v.isVector2?(M.boundary=8,M.storage=8):v.isVector3||v.isColor?(M.boundary=16,M.storage=12):v.isVector4?(M.boundary=16,M.storage=16):v.isMatrix3?(M.boundary=48,M.storage=48):v.isMatrix4?(M.boundary=64,M.storage=64):v.isTexture?Ie("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(v)?(M.boundary=16,M.storage=v.byteLength):Ie("WebGLRenderer: Unsupported uniform value type.",v),M}function g(v){let M=v.target;M.removeEventListener("dispose",g);let S=a.indexOf(M.__bindingPointIndex);a.splice(S,1),n.deleteBuffer(r[M.id]),delete r[M.id],delete s[M.id]}function f(){for(let v in r)n.deleteBuffer(r[v]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}var Ty=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Un=null;function Ay(){return Un===null&&(Un=new ya(Ty,16,16,gi,Nn),Un.name="DFG_LUT",Un.minFilter=Rt,Un.magFilter=Rt,Un.wrapS=Cn,Un.wrapT=Cn,Un.generateMipmaps=!1,Un.needsUpdate=!0),Un}var Vo=class{constructor(e={}){let{canvas:t=Ju(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:u=!1,outputBufferType:p=qt}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=a;let x=p,g=new Set([no,to,eo]),f=new Set([qt,vn,fr,dr,Ka,Qa]),v=new Uint32Array(4),M=new Int32Array(4),S=new U,w=null,y=null,A=[],_=[],C=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=xn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let D=this,P=!1,N=null;this._outputColorSpace=Qt;let V=0,I=0,R=null,L=-1,k=null,ee=new pt,ne=new pt,he=null,q=new Xe(0),J=0,fe=t.width,De=t.height,Y=1,z=null,$=null,te=new pt(0,0,fe,De),ve=new pt(0,0,fe,De),Me=!1,xe=new rr,Ze=!1,Ue=!1,qe=new ct,Qe=new U,Fe=new pt,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},nt=!1;function jt(){return R===null?Y:1}let O=i;function Mt(T,B){return t.getContext(T,B)}try{let T={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"184"}`),t.addEventListener("webglcontextlost",ie,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",ke,!1),O===null){let B="webgl2";if(O=Mt(B,T),O===null)throw Mt(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(T){throw Le("WebGLRenderer: "+T.message),T}let Ye,ht,de,mt,E,b,G,K,re,se,ue,j,Q,_e,Se,le,ae,Oe,Ve,Ke,F,oe,Z;function ye(){Ye=new Lx(O),Ye.init(),F=new vy(O,Ye),ht=new Tx(O,Ye,e,F),de=new _y(O,Ye),ht.reversedDepthBuffer&&u&&de.buffers.depth.setReversed(!0),mt=new Fx(O),E=new iy,b=new xy(O,Ye,de,E,ht,F,mt),G=new Dx(D),K=new zg(O),oe=new Sx(O,K),re=new Nx(O,K,mt,oe),se=new Bx(O,re,K,oe,mt),Oe=new Ox(O,ht,b),Se=new Ax(E),ue=new ny(D,G,Ye,ht,oe,Se),j=new Sy(D,E),Q=new sy,_e=new uy(Ye),ae=new Mx(D,G,de,se,m,l),le=new gy(D,se,ht),Z=new wy(O,mt,ht,de),Ve=new wx(O,Ye,mt),Ke=new Ux(O,Ye,mt),mt.programs=ue.programs,D.capabilities=ht,D.extensions=Ye,D.properties=E,D.renderLists=Q,D.shadowMap=le,D.state=de,D.info=mt}ye(),x!==qt&&(C=new zx(x,t.width,t.height,r,s));let ce=new Gc(D,O);this.xr=ce,this.getContext=function(){return O},this.getContextAttributes=function(){return O.getContextAttributes()},this.forceContextLoss=function(){let T=Ye.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){let T=Ye.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(T){T!==void 0&&(Y=T,this.setSize(fe,De,!1))},this.getSize=function(T){return T.set(fe,De)},this.setSize=function(T,B,X=!0){if(ce.isPresenting){Ie("WebGLRenderer: Can't change size while VR device is presenting.");return}fe=T,De=B,t.width=Math.floor(T*Y),t.height=Math.floor(B*Y),X===!0&&(t.style.width=T+"px",t.style.height=B+"px"),C!==null&&C.setSize(t.width,t.height),this.setViewport(0,0,T,B)},this.getDrawingBufferSize=function(T){return T.set(fe*Y,De*Y).floor()},this.setDrawingBufferSize=function(T,B,X){fe=T,De=B,Y=X,t.width=Math.floor(T*X),t.height=Math.floor(B*X),this.setViewport(0,0,T,B)},this.setEffects=function(T){if(x===qt){Le("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let B=0;B<T.length;B++)if(T[B].isOutputPass===!0){Ie("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}C.setEffects(T||[])},this.getCurrentViewport=function(T){return T.copy(ee)},this.getViewport=function(T){return T.copy(te)},this.setViewport=function(T,B,X,H){T.isVector4?te.set(T.x,T.y,T.z,T.w):te.set(T,B,X,H),de.viewport(ee.copy(te).multiplyScalar(Y).round())},this.getScissor=function(T){return T.copy(ve)},this.setScissor=function(T,B,X,H){T.isVector4?ve.set(T.x,T.y,T.z,T.w):ve.set(T,B,X,H),de.scissor(ne.copy(ve).multiplyScalar(Y).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(T){de.setScissorTest(Me=T)},this.setOpaqueSort=function(T){z=T},this.setTransparentSort=function(T){$=T},this.getClearColor=function(T){return T.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor(...arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha(...arguments)},this.clear=function(T=!0,B=!0,X=!0){let H=0;if(T){let W=!1;if(R!==null){let ge=R.texture.format;W=g.has(ge)}if(W){let ge=R.texture.type,we=f.has(ge),me=ae.getClearColor(),Ae=ae.getClearAlpha(),Re=me.r,ze=me.g,We=me.b;we?(v[0]=Re,v[1]=ze,v[2]=We,v[3]=Ae,O.clearBufferuiv(O.COLOR,0,v)):(M[0]=Re,M[1]=ze,M[2]=We,M[3]=Ae,O.clearBufferiv(O.COLOR,0,M))}else H|=O.COLOR_BUFFER_BIT}B&&(H|=O.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),X&&(H|=O.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H!==0&&O.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(T){T.setRenderer(this),N=T},this.dispose=function(){t.removeEventListener("webglcontextlost",ie,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",ke,!1),ae.dispose(),Q.dispose(),_e.dispose(),E.dispose(),G.dispose(),se.dispose(),oe.dispose(),Z.dispose(),ue.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",Fh),ce.removeEventListener("sessionend",Oh),yi.stop()};function ie(T){T.preventDefault(),mc("WebGLRenderer: Context Lost."),P=!0}function Ce(){mc("WebGLRenderer: Context Restored."),P=!1;let T=mt.autoReset,B=le.enabled,X=le.autoUpdate,H=le.needsUpdate,W=le.type;ye(),mt.autoReset=T,le.enabled=B,le.autoUpdate=X,le.needsUpdate=H,le.type=W}function ke(T){Le("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function xt(T){let B=T.target;B.removeEventListener("dispose",xt),rt(B)}function rt(T){On(T),E.remove(T)}function On(T){let B=E.get(T).programs;B!==void 0&&(B.forEach(function(X){ue.releaseProgram(X)}),T.isShaderMaterial&&ue.releaseShaderCache(T))}this.renderBufferDirect=function(T,B,X,H,W,ge){B===null&&(B=it);let we=W.isMesh&&W.matrixWorld.determinant()<0,me=wm(T,B,X,H,W);de.setMaterial(H,we);let Ae=X.index,Re=1;if(H.wireframe===!0){if(Ae=re.getWireframeAttribute(X),Ae===void 0)return;Re=2}let ze=X.drawRange,We=X.attributes.position,Pe=ze.start*Re,st=(ze.start+ze.count)*Re;ge!==null&&(Pe=Math.max(Pe,ge.start*Re),st=Math.min(st,(ge.start+ge.count)*Re)),Ae!==null?(Pe=Math.max(Pe,0),st=Math.min(st,Ae.count)):We!=null&&(Pe=Math.max(Pe,0),st=Math.min(st,We.count));let vt=st-Pe;if(vt<0||vt===1/0)return;oe.setup(W,H,me,X,Ae);let gt,ot=Ve;if(Ae!==null&&(gt=K.get(Ae),ot=Ke,ot.setIndex(gt)),W.isMesh)H.wireframe===!0?(de.setLineWidth(H.wireframeLinewidth*jt()),ot.setMode(O.LINES)):ot.setMode(O.TRIANGLES);else if(W.isLine){let It=H.linewidth;It===void 0&&(It=1),de.setLineWidth(It*jt()),W.isLineSegments?ot.setMode(O.LINES):W.isLineLoop?ot.setMode(O.LINE_LOOP):ot.setMode(O.LINE_STRIP)}else W.isPoints?ot.setMode(O.POINTS):W.isSprite&&ot.setMode(O.TRIANGLES);if(W.isBatchedMesh)if(Ye.get("WEBGL_multi_draw"))ot.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else{let It=W._multiDrawStarts,be=W._multiDrawCounts,Zt=W._multiDrawCount,Je=Ae?K.get(Ae).bytesPerElement:1,an=E.get(H).currentProgram.getUniforms();for(let An=0;An<Zt;An++)an.setValue(O,"_gl_DrawID",An),ot.render(It[An]/Je,be[An])}else if(W.isInstancedMesh)ot.renderInstances(Pe,vt,W.count);else if(X.isInstancedBufferGeometry){let It=X._maxInstanceCount!==void 0?X._maxInstanceCount:1/0,be=Math.min(X.instanceCount,It);ot.renderInstances(Pe,vt,be)}else ot.render(Pe,vt)};function Tn(T,B,X){T.transparent===!0&&T.side===Dn&&T.forceSinglePass===!1?(T.side=Vt,T.needsUpdate=!0,Ns(T,B,X),T.side=Wn,T.needsUpdate=!0,Ns(T,B,X),T.side=Dn):Ns(T,B,X)}this.compile=function(T,B,X=null){X===null&&(X=T),y=_e.get(X),y.init(B),_.push(y),X.traverseVisible(function(W){W.isLight&&W.layers.test(B.layers)&&(y.pushLight(W),W.castShadow&&y.pushShadow(W))}),T!==X&&T.traverseVisible(function(W){W.isLight&&W.layers.test(B.layers)&&(y.pushLight(W),W.castShadow&&y.pushShadow(W))}),y.setupLights();let H=new Set;return T.traverse(function(W){if(!(W.isMesh||W.isPoints||W.isLine||W.isSprite))return;let ge=W.material;if(ge)if(Array.isArray(ge))for(let we=0;we<ge.length;we++){let me=ge[we];Tn(me,X,W),H.add(me)}else Tn(ge,X,W),H.add(ge)}),y=_.pop(),H},this.compileAsync=function(T,B,X=null){let H=this.compile(T,B,X);return new Promise(W=>{function ge(){if(H.forEach(function(we){E.get(we).currentProgram.isReady()&&H.delete(we)}),H.size===0){W(T);return}setTimeout(ge,10)}Ye.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let hl=null;function Mm(T){hl&&hl(T)}function Fh(){yi.stop()}function Oh(){yi.start()}let yi=new Ef;yi.setAnimationLoop(Mm),typeof self<"u"&&yi.setContext(self),this.setAnimationLoop=function(T){hl=T,ce.setAnimationLoop(T),T===null?yi.stop():yi.start()},ce.addEventListener("sessionstart",Fh),ce.addEventListener("sessionend",Oh),this.render=function(T,B){if(B!==void 0&&B.isCamera!==!0){Le("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;N!==null&&N.renderStart(T,B);let X=ce.enabled===!0&&ce.isPresenting===!0,H=C!==null&&(R===null||X)&&C.begin(D,R);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),ce.enabled===!0&&ce.isPresenting===!0&&(C===null||C.isCompositing()===!1)&&(ce.cameraAutoUpdate===!0&&ce.updateCamera(B),B=ce.getCamera()),T.isScene===!0&&T.onBeforeRender(D,T,B,R),y=_e.get(T,_.length),y.init(B),y.state.textureUnits=b.getTextureUnits(),_.push(y),qe.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),xe.setFromProjectionMatrix(qe,gn,B.reversedDepth),Ue=this.localClippingEnabled,Ze=Se.init(this.clippingPlanes,Ue),w=Q.get(T,A.length),w.init(),A.push(w),ce.enabled===!0&&ce.isPresenting===!0){let we=D.xr.getDepthSensingMesh();we!==null&&ul(we,B,-1/0,D.sortObjects)}ul(T,B,0,D.sortObjects),w.finish(),D.sortObjects===!0&&w.sort(z,$),nt=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,nt&&ae.addToRenderList(w,T),this.info.render.frame++,Ze===!0&&Se.beginShadows();let W=y.state.shadowsArray;if(le.render(W,T,B),Ze===!0&&Se.endShadows(),this.info.autoReset===!0&&this.info.reset(),(H&&C.hasRenderPass())===!1){let we=w.opaque,me=w.transmissive;if(y.setupLights(),B.isArrayCamera){let Ae=B.cameras;if(me.length>0)for(let Re=0,ze=Ae.length;Re<ze;Re++){let We=Ae[Re];kh(we,me,T,We)}nt&&ae.render(T);for(let Re=0,ze=Ae.length;Re<ze;Re++){let We=Ae[Re];Bh(w,T,We,We.viewport)}}else me.length>0&&kh(we,me,T,B),nt&&ae.render(T),Bh(w,T,B)}R!==null&&I===0&&(b.updateMultisampleRenderTarget(R),b.updateRenderTargetMipmap(R)),H&&C.end(D),T.isScene===!0&&T.onAfterRender(D,T,B),oe.resetDefaultState(),L=-1,k=null,_.pop(),_.length>0?(y=_[_.length-1],b.setTextureUnits(y.state.textureUnits),Ze===!0&&Se.setGlobalState(D.clippingPlanes,y.state.camera)):y=null,A.pop(),A.length>0?w=A[A.length-1]:w=null,N!==null&&N.renderEnd()};function ul(T,B,X,H){if(T.visible===!1)return;if(T.layers.test(B.layers)){if(T.isGroup)X=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(B);else if(T.isLightProbeGrid)y.pushLightProbeGrid(T);else if(T.isLight)y.pushLight(T),T.castShadow&&y.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||xe.intersectsSprite(T)){H&&Fe.setFromMatrixPosition(T.matrixWorld).applyMatrix4(qe);let we=se.update(T),me=T.material;me.visible&&w.push(T,we,me,X,Fe.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||xe.intersectsObject(T))){let we=se.update(T),me=T.material;if(H&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),Fe.copy(T.boundingSphere.center)):(we.boundingSphere===null&&we.computeBoundingSphere(),Fe.copy(we.boundingSphere.center)),Fe.applyMatrix4(T.matrixWorld).applyMatrix4(qe)),Array.isArray(me)){let Ae=we.groups;for(let Re=0,ze=Ae.length;Re<ze;Re++){let We=Ae[Re],Pe=me[We.materialIndex];Pe&&Pe.visible&&w.push(T,we,Pe,X,Fe.z,We)}}else me.visible&&w.push(T,we,me,X,Fe.z,null)}}let ge=T.children;for(let we=0,me=ge.length;we<me;we++)ul(ge[we],B,X,H)}function Bh(T,B,X,H){let{opaque:W,transmissive:ge,transparent:we}=T;y.setupLightsView(X),Ze===!0&&Se.setGlobalState(D.clippingPlanes,X),H&&de.viewport(ee.copy(H)),W.length>0&&Ls(W,B,X),ge.length>0&&Ls(ge,B,X),we.length>0&&Ls(we,B,X),de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function kh(T,B,X,H){if((X.isScene===!0?X.overrideMaterial:null)!==null)return;if(y.state.transmissionRenderTarget[H.id]===void 0){let Pe=Ye.has("EXT_color_buffer_half_float")||Ye.has("EXT_color_buffer_float");y.state.transmissionRenderTarget[H.id]=new tn(1,1,{generateMipmaps:!0,type:Pe?Nn:qt,minFilter:pi,samples:Math.max(4,ht.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:$e.workingColorSpace})}let ge=y.state.transmissionRenderTarget[H.id],we=H.viewport||ee;ge.setSize(we.z*D.transmissionResolutionScale,we.w*D.transmissionResolutionScale);let me=D.getRenderTarget(),Ae=D.getActiveCubeFace(),Re=D.getActiveMipmapLevel();D.setRenderTarget(ge),D.getClearColor(q),J=D.getClearAlpha(),J<1&&D.setClearColor(16777215,.5),D.clear(),nt&&ae.render(X);let ze=D.toneMapping;D.toneMapping=xn;let We=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),y.setupLightsView(H),Ze===!0&&Se.setGlobalState(D.clippingPlanes,H),Ls(T,X,H),b.updateMultisampleRenderTarget(ge),b.updateRenderTargetMipmap(ge),Ye.has("WEBGL_multisampled_render_to_texture")===!1){let Pe=!1;for(let st=0,vt=B.length;st<vt;st++){let gt=B[st],{object:ot,geometry:It,material:be,group:Zt}=gt;if(be.side===Dn&&ot.layers.test(H.layers)){let Je=be.side;be.side=Vt,be.needsUpdate=!0,zh(ot,X,H,It,be,Zt),be.side=Je,be.needsUpdate=!0,Pe=!0}}Pe===!0&&(b.updateMultisampleRenderTarget(ge),b.updateRenderTargetMipmap(ge))}D.setRenderTarget(me,Ae,Re),D.setClearColor(q,J),We!==void 0&&(H.viewport=We),D.toneMapping=ze}function Ls(T,B,X){let H=B.isScene===!0?B.overrideMaterial:null;for(let W=0,ge=T.length;W<ge;W++){let we=T[W],{object:me,geometry:Ae,group:Re}=we,ze=we.material;ze.allowOverride===!0&&H!==null&&(ze=H),me.layers.test(X.layers)&&zh(me,B,X,Ae,ze,Re)}}function zh(T,B,X,H,W,ge){T.onBeforeRender(D,B,X,H,W,ge),T.modelViewMatrix.multiplyMatrices(X.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),W.onBeforeRender(D,B,X,H,T,ge),W.transparent===!0&&W.side===Dn&&W.forceSinglePass===!1?(W.side=Vt,W.needsUpdate=!0,D.renderBufferDirect(X,B,H,W,T,ge),W.side=Wn,W.needsUpdate=!0,D.renderBufferDirect(X,B,H,W,T,ge),W.side=Dn):D.renderBufferDirect(X,B,H,W,T,ge),T.onAfterRender(D,B,X,H,W,ge)}function Ns(T,B,X){B.isScene!==!0&&(B=it);let H=E.get(T),W=y.state.lights,ge=y.state.shadowsArray,we=W.state.version,me=ue.getParameters(T,W.state,ge,B,X,y.state.lightProbeGridArray),Ae=ue.getProgramCacheKey(me),Re=H.programs;H.environment=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?B.environment:null,H.fog=B.fog;let ze=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap;H.envMap=G.get(T.envMap||H.environment,ze),H.envMapRotation=H.environment!==null&&T.envMap===null?B.environmentRotation:T.envMapRotation,Re===void 0&&(T.addEventListener("dispose",xt),Re=new Map,H.programs=Re);let We=Re.get(Ae);if(We!==void 0){if(H.currentProgram===We&&H.lightsStateVersion===we)return Gh(T,me),We}else me.uniforms=ue.getUniforms(T),N!==null&&T.isNodeMaterial&&N.build(T,X,me),T.onBeforeCompile(me,D),We=ue.acquireProgram(me,Ae),Re.set(Ae,We),H.uniforms=me.uniforms;let Pe=H.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Pe.clippingPlanes=Se.uniform),Gh(T,me),H.needsLights=Am(T),H.lightsStateVersion=we,H.needsLights&&(Pe.ambientLightColor.value=W.state.ambient,Pe.lightProbe.value=W.state.probe,Pe.directionalLights.value=W.state.directional,Pe.directionalLightShadows.value=W.state.directionalShadow,Pe.spotLights.value=W.state.spot,Pe.spotLightShadows.value=W.state.spotShadow,Pe.rectAreaLights.value=W.state.rectArea,Pe.ltc_1.value=W.state.rectAreaLTC1,Pe.ltc_2.value=W.state.rectAreaLTC2,Pe.pointLights.value=W.state.point,Pe.pointLightShadows.value=W.state.pointShadow,Pe.hemisphereLights.value=W.state.hemi,Pe.directionalShadowMatrix.value=W.state.directionalShadowMatrix,Pe.spotLightMatrix.value=W.state.spotLightMatrix,Pe.spotLightMap.value=W.state.spotLightMap,Pe.pointShadowMatrix.value=W.state.pointShadowMatrix),H.lightProbeGrid=y.state.lightProbeGridArray.length>0,H.currentProgram=We,H.uniformsList=null,We}function Vh(T){if(T.uniformsList===null){let B=T.currentProgram.getUniforms();T.uniformsList=gr.seqWithValue(B.seq,T.uniforms)}return T.uniformsList}function Gh(T,B){let X=E.get(T);X.outputColorSpace=B.outputColorSpace,X.batching=B.batching,X.batchingColor=B.batchingColor,X.instancing=B.instancing,X.instancingColor=B.instancingColor,X.instancingMorph=B.instancingMorph,X.skinning=B.skinning,X.morphTargets=B.morphTargets,X.morphNormals=B.morphNormals,X.morphColors=B.morphColors,X.morphTargetsCount=B.morphTargetsCount,X.numClippingPlanes=B.numClippingPlanes,X.numIntersection=B.numClipIntersection,X.vertexAlphas=B.vertexAlphas,X.vertexTangents=B.vertexTangents,X.toneMapping=B.toneMapping}function Sm(T,B){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;S.setFromMatrixPosition(B.matrixWorld);for(let X=0,H=T.length;X<H;X++){let W=T[X];if(W.texture!==null&&W.boundingBox.containsPoint(S))return W}return null}function wm(T,B,X,H,W){B.isScene!==!0&&(B=it),b.resetTextureUnits();let ge=B.fog,we=H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial?B.environment:null,me=R===null?D.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:$e.workingColorSpace,Ae=H.isMeshStandardMaterial||H.isMeshLambertMaterial&&!H.envMap||H.isMeshPhongMaterial&&!H.envMap,Re=G.get(H.envMap||we,Ae),ze=H.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,We=!!X.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Pe=!!X.morphAttributes.position,st=!!X.morphAttributes.normal,vt=!!X.morphAttributes.color,gt=xn;H.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(gt=D.toneMapping);let ot=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,It=ot!==void 0?ot.length:0,be=E.get(H),Zt=y.state.lights;if(Ze===!0&&(Ue===!0||T!==k)){let ut=T===k&&H.id===L;Se.setState(H,T,ut)}let Je=!1;H.version===be.__version?(be.needsLights&&be.lightsStateVersion!==Zt.state.version||be.outputColorSpace!==me||W.isBatchedMesh&&be.batching===!1||!W.isBatchedMesh&&be.batching===!0||W.isBatchedMesh&&be.batchingColor===!0&&W.colorTexture===null||W.isBatchedMesh&&be.batchingColor===!1&&W.colorTexture!==null||W.isInstancedMesh&&be.instancing===!1||!W.isInstancedMesh&&be.instancing===!0||W.isSkinnedMesh&&be.skinning===!1||!W.isSkinnedMesh&&be.skinning===!0||W.isInstancedMesh&&be.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&be.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&be.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&be.instancingMorph===!1&&W.morphTexture!==null||be.envMap!==Re||H.fog===!0&&be.fog!==ge||be.numClippingPlanes!==void 0&&(be.numClippingPlanes!==Se.numPlanes||be.numIntersection!==Se.numIntersection)||be.vertexAlphas!==ze||be.vertexTangents!==We||be.morphTargets!==Pe||be.morphNormals!==st||be.morphColors!==vt||be.toneMapping!==gt||be.morphTargetsCount!==It||!!be.lightProbeGrid!=y.state.lightProbeGridArray.length>0)&&(Je=!0):(Je=!0,be.__version=H.version);let an=be.currentProgram;Je===!0&&(an=Ns(H,B,W),N&&H.isNodeMaterial&&N.onUpdateProgram(H,an,be));let An=!1,Zn=!1,Fi=!1,lt=an.getUniforms(),yt=be.uniforms;if(de.useProgram(an.program)&&(An=!0,Zn=!0,Fi=!0),H.id!==L&&(L=H.id,Zn=!0),be.needsLights){let ut=Sm(y.state.lightProbeGridArray,W);be.lightProbeGrid!==ut&&(be.lightProbeGrid=ut,Zn=!0)}if(An||k!==T){de.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),lt.setValue(O,"projectionMatrix",T.projectionMatrix),lt.setValue(O,"viewMatrix",T.matrixWorldInverse);let Kn=lt.map.cameraPosition;Kn!==void 0&&Kn.setValue(O,Qe.setFromMatrixPosition(T.matrixWorld)),ht.logarithmicDepthBuffer&<.setValue(O,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&<.setValue(O,"isOrthographic",T.isOrthographicCamera===!0),k!==T&&(k=T,Zn=!0,Fi=!0)}if(be.needsLights&&(Zt.state.directionalShadowMap.length>0&<.setValue(O,"directionalShadowMap",Zt.state.directionalShadowMap,b),Zt.state.spotShadowMap.length>0&<.setValue(O,"spotShadowMap",Zt.state.spotShadowMap,b),Zt.state.pointShadowMap.length>0&<.setValue(O,"pointShadowMap",Zt.state.pointShadowMap,b)),W.isSkinnedMesh){lt.setOptional(O,W,"bindMatrix"),lt.setOptional(O,W,"bindMatrixInverse");let ut=W.skeleton;ut&&(ut.boneTexture===null&&ut.computeBoneTexture(),lt.setValue(O,"boneTexture",ut.boneTexture,b))}W.isBatchedMesh&&(lt.setOptional(O,W,"batchingTexture"),lt.setValue(O,"batchingTexture",W._matricesTexture,b),lt.setOptional(O,W,"batchingIdTexture"),lt.setValue(O,"batchingIdTexture",W._indirectTexture,b),lt.setOptional(O,W,"batchingColorTexture"),W._colorsTexture!==null&<.setValue(O,"batchingColorTexture",W._colorsTexture,b));let Jn=X.morphAttributes;if((Jn.position!==void 0||Jn.normal!==void 0||Jn.color!==void 0)&&Oe.update(W,X,an),(Zn||be.receiveShadow!==W.receiveShadow)&&(be.receiveShadow=W.receiveShadow,lt.setValue(O,"receiveShadow",W.receiveShadow)),(H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial)&&H.envMap===null&&B.environment!==null&&(yt.envMapIntensity.value=B.environmentIntensity),yt.dfgLUT!==void 0&&(yt.dfgLUT.value=Ay()),Zn){if(lt.setValue(O,"toneMappingExposure",D.toneMappingExposure),be.needsLights&&Tm(yt,Fi),ge&&H.fog===!0&&j.refreshFogUniforms(yt,ge),j.refreshMaterialUniforms(yt,H,Y,De,y.state.transmissionRenderTarget[T.id]),be.needsLights&&be.lightProbeGrid){let ut=be.lightProbeGrid;yt.probesSH.value=ut.texture,yt.probesMin.value.copy(ut.boundingBox.min),yt.probesMax.value.copy(ut.boundingBox.max),yt.probesResolution.value.copy(ut.resolution)}gr.upload(O,Vh(be),yt,b)}if(H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(gr.upload(O,Vh(be),yt,b),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&<.setValue(O,"center",W.center),lt.setValue(O,"modelViewMatrix",W.modelViewMatrix),lt.setValue(O,"normalMatrix",W.normalMatrix),lt.setValue(O,"modelMatrix",W.matrixWorld),H.uniformsGroups!==void 0){let ut=H.uniformsGroups;for(let Kn=0,Oi=ut.length;Kn<Oi;Kn++){let Hh=ut[Kn];Z.update(Hh,an),Z.bind(Hh,an)}}return an}function Tm(T,B){T.ambientLightColor.needsUpdate=B,T.lightProbe.needsUpdate=B,T.directionalLights.needsUpdate=B,T.directionalLightShadows.needsUpdate=B,T.pointLights.needsUpdate=B,T.pointLightShadows.needsUpdate=B,T.spotLights.needsUpdate=B,T.spotLightShadows.needsUpdate=B,T.rectAreaLights.needsUpdate=B,T.hemisphereLights.needsUpdate=B}function Am(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return V},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(T,B,X){let H=E.get(T);H.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),E.get(T.texture).__webglTexture=B,E.get(T.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:X,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,B){let X=E.get(T);X.__webglFramebuffer=B,X.__useDefaultFramebuffer=B===void 0};let Em=O.createFramebuffer();this.setRenderTarget=function(T,B=0,X=0){R=T,V=B,I=X;let H=null,W=!1,ge=!1;if(T){let me=E.get(T);if(me.__useDefaultFramebuffer!==void 0){de.bindFramebuffer(O.FRAMEBUFFER,me.__webglFramebuffer),ee.copy(T.viewport),ne.copy(T.scissor),he=T.scissorTest,de.viewport(ee),de.scissor(ne),de.setScissorTest(he),L=-1;return}else if(me.__webglFramebuffer===void 0)b.setupRenderTarget(T);else if(me.__hasExternalTextures)b.rebindTextures(T,E.get(T.texture).__webglTexture,E.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){let ze=T.depthTexture;if(me.__boundDepthTexture!==ze){if(ze!==null&&E.has(ze)&&(T.width!==ze.image.width||T.height!==ze.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");b.setupDepthRenderbuffer(T)}}let Ae=T.texture;(Ae.isData3DTexture||Ae.isDataArrayTexture||Ae.isCompressedArrayTexture)&&(ge=!0);let Re=E.get(T).__webglFramebuffer;T.isWebGLCubeRenderTarget?(Array.isArray(Re[B])?H=Re[B][X]:H=Re[B],W=!0):T.samples>0&&b.useMultisampledRTT(T)===!1?H=E.get(T).__webglMultisampledFramebuffer:Array.isArray(Re)?H=Re[X]:H=Re,ee.copy(T.viewport),ne.copy(T.scissor),he=T.scissorTest}else ee.copy(te).multiplyScalar(Y).floor(),ne.copy(ve).multiplyScalar(Y).floor(),he=Me;if(X!==0&&(H=Em),de.bindFramebuffer(O.FRAMEBUFFER,H)&&de.drawBuffers(T,H),de.viewport(ee),de.scissor(ne),de.setScissorTest(he),W){let me=E.get(T.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+B,me.__webglTexture,X)}else if(ge){let me=B;for(let Ae=0;Ae<T.textures.length;Ae++){let Re=E.get(T.textures[Ae]);O.framebufferTextureLayer(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0+Ae,Re.__webglTexture,X,me)}}else if(T!==null&&X!==0){let me=E.get(T.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,me.__webglTexture,X)}L=-1},this.readRenderTargetPixels=function(T,B,X,H,W,ge,we,me=0){if(!(T&&T.isWebGLRenderTarget)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ae=E.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&we!==void 0&&(Ae=Ae[we]),Ae){de.bindFramebuffer(O.FRAMEBUFFER,Ae);try{let Re=T.textures[me],ze=Re.format,We=Re.type;if(T.textures.length>1&&O.readBuffer(O.COLOR_ATTACHMENT0+me),!ht.textureFormatReadable(ze)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ht.textureTypeReadable(We)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=T.width-H&&X>=0&&X<=T.height-W&&O.readPixels(B,X,H,W,F.convert(ze),F.convert(We),ge)}finally{let Re=R!==null?E.get(R).__webglFramebuffer:null;de.bindFramebuffer(O.FRAMEBUFFER,Re)}}},this.readRenderTargetPixelsAsync=async function(T,B,X,H,W,ge,we,me=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ae=E.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&we!==void 0&&(Ae=Ae[we]),Ae)if(B>=0&&B<=T.width-H&&X>=0&&X<=T.height-W){de.bindFramebuffer(O.FRAMEBUFFER,Ae);let Re=T.textures[me],ze=Re.format,We=Re.type;if(T.textures.length>1&&O.readBuffer(O.COLOR_ATTACHMENT0+me),!ht.textureFormatReadable(ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ht.textureTypeReadable(We))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Pe=O.createBuffer();O.bindBuffer(O.PIXEL_PACK_BUFFER,Pe),O.bufferData(O.PIXEL_PACK_BUFFER,ge.byteLength,O.STREAM_READ),O.readPixels(B,X,H,W,F.convert(ze),F.convert(We),0);let st=R!==null?E.get(R).__webglFramebuffer:null;de.bindFramebuffer(O.FRAMEBUFFER,st);let vt=O.fenceSync(O.SYNC_GPU_COMMANDS_COMPLETE,0);return O.flush(),await Qu(O,vt,4),O.bindBuffer(O.PIXEL_PACK_BUFFER,Pe),O.getBufferSubData(O.PIXEL_PACK_BUFFER,0,ge),O.deleteBuffer(Pe),O.deleteSync(vt),ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,B=null,X=0){let H=Math.pow(2,-X),W=Math.floor(T.image.width*H),ge=Math.floor(T.image.height*H),we=B!==null?B.x:0,me=B!==null?B.y:0;b.setTexture2D(T,0),O.copyTexSubImage2D(O.TEXTURE_2D,X,0,0,we,me,W,ge),de.unbindTexture()};let Cm=O.createFramebuffer(),Rm=O.createFramebuffer();this.copyTextureToTexture=function(T,B,X=null,H=null,W=0,ge=0){let we,me,Ae,Re,ze,We,Pe,st,vt,gt=T.isCompressedTexture?T.mipmaps[ge]:T.image;if(X!==null)we=X.max.x-X.min.x,me=X.max.y-X.min.y,Ae=X.isBox3?X.max.z-X.min.z:1,Re=X.min.x,ze=X.min.y,We=X.isBox3?X.min.z:0;else{let yt=Math.pow(2,-W);we=Math.floor(gt.width*yt),me=Math.floor(gt.height*yt),T.isDataArrayTexture?Ae=gt.depth:T.isData3DTexture?Ae=Math.floor(gt.depth*yt):Ae=1,Re=0,ze=0,We=0}H!==null?(Pe=H.x,st=H.y,vt=H.z):(Pe=0,st=0,vt=0);let ot=F.convert(B.format),It=F.convert(B.type),be;B.isData3DTexture?(b.setTexture3D(B,0),be=O.TEXTURE_3D):B.isDataArrayTexture||B.isCompressedArrayTexture?(b.setTexture2DArray(B,0),be=O.TEXTURE_2D_ARRAY):(b.setTexture2D(B,0),be=O.TEXTURE_2D),de.activeTexture(O.TEXTURE0),de.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,B.flipY),de.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),de.pixelStorei(O.UNPACK_ALIGNMENT,B.unpackAlignment);let Zt=de.getParameter(O.UNPACK_ROW_LENGTH),Je=de.getParameter(O.UNPACK_IMAGE_HEIGHT),an=de.getParameter(O.UNPACK_SKIP_PIXELS),An=de.getParameter(O.UNPACK_SKIP_ROWS),Zn=de.getParameter(O.UNPACK_SKIP_IMAGES);de.pixelStorei(O.UNPACK_ROW_LENGTH,gt.width),de.pixelStorei(O.UNPACK_IMAGE_HEIGHT,gt.height),de.pixelStorei(O.UNPACK_SKIP_PIXELS,Re),de.pixelStorei(O.UNPACK_SKIP_ROWS,ze),de.pixelStorei(O.UNPACK_SKIP_IMAGES,We);let Fi=T.isDataArrayTexture||T.isData3DTexture,lt=B.isDataArrayTexture||B.isData3DTexture;if(T.isDepthTexture){let yt=E.get(T),Jn=E.get(B),ut=E.get(yt.__renderTarget),Kn=E.get(Jn.__renderTarget);de.bindFramebuffer(O.READ_FRAMEBUFFER,ut.__webglFramebuffer),de.bindFramebuffer(O.DRAW_FRAMEBUFFER,Kn.__webglFramebuffer);for(let Oi=0;Oi<Ae;Oi++)Fi&&(O.framebufferTextureLayer(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,E.get(T).__webglTexture,W,We+Oi),O.framebufferTextureLayer(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,E.get(B).__webglTexture,ge,vt+Oi)),O.blitFramebuffer(Re,ze,we,me,Pe,st,we,me,O.DEPTH_BUFFER_BIT,O.NEAREST);de.bindFramebuffer(O.READ_FRAMEBUFFER,null),de.bindFramebuffer(O.DRAW_FRAMEBUFFER,null)}else if(W!==0||T.isRenderTargetTexture||E.has(T)){let yt=E.get(T),Jn=E.get(B);de.bindFramebuffer(O.READ_FRAMEBUFFER,Cm),de.bindFramebuffer(O.DRAW_FRAMEBUFFER,Rm);for(let ut=0;ut<Ae;ut++)Fi?O.framebufferTextureLayer(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,yt.__webglTexture,W,We+ut):O.framebufferTexture2D(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,yt.__webglTexture,W),lt?O.framebufferTextureLayer(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,Jn.__webglTexture,ge,vt+ut):O.framebufferTexture2D(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,Jn.__webglTexture,ge),W!==0?O.blitFramebuffer(Re,ze,we,me,Pe,st,we,me,O.COLOR_BUFFER_BIT,O.NEAREST):lt?O.copyTexSubImage3D(be,ge,Pe,st,vt+ut,Re,ze,we,me):O.copyTexSubImage2D(be,ge,Pe,st,Re,ze,we,me);de.bindFramebuffer(O.READ_FRAMEBUFFER,null),de.bindFramebuffer(O.DRAW_FRAMEBUFFER,null)}else lt?T.isDataTexture||T.isData3DTexture?O.texSubImage3D(be,ge,Pe,st,vt,we,me,Ae,ot,It,gt.data):B.isCompressedArrayTexture?O.compressedTexSubImage3D(be,ge,Pe,st,vt,we,me,Ae,ot,gt.data):O.texSubImage3D(be,ge,Pe,st,vt,we,me,Ae,ot,It,gt):T.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,ge,Pe,st,we,me,ot,It,gt.data):T.isCompressedTexture?O.compressedTexSubImage2D(O.TEXTURE_2D,ge,Pe,st,gt.width,gt.height,ot,gt.data):O.texSubImage2D(O.TEXTURE_2D,ge,Pe,st,we,me,ot,It,gt);de.pixelStorei(O.UNPACK_ROW_LENGTH,Zt),de.pixelStorei(O.UNPACK_IMAGE_HEIGHT,Je),de.pixelStorei(O.UNPACK_SKIP_PIXELS,an),de.pixelStorei(O.UNPACK_SKIP_ROWS,An),de.pixelStorei(O.UNPACK_SKIP_IMAGES,Zn),ge===0&&B.generateMipmaps&&O.generateMipmap(be),de.unbindTexture()},this.initRenderTarget=function(T){E.get(T).__webglFramebuffer===void 0&&b.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?b.setTextureCube(T,0):T.isData3DTexture?b.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?b.setTexture2DArray(T,0):b.setTexture2D(T,0),de.unbindTexture()},this.resetState=function(){V=0,I=0,R=null,de.reset(),oe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return gn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=$e._getDrawingBufferColorSpace(e),t.unpackColorSpace=$e._getUnpackColorSpace()}};function Hc(n,e,t){var i,r=1;n==null&&(n=0),e==null&&(e=0),t==null&&(t=0);function s(){var a,o=i.length,l,c=0,h=0,d=0;for(a=0;a<o;++a)l=i[a],c+=l.x||0,h+=l.y||0,d+=l.z||0;for(c=(c/o-n)*r,h=(h/o-e)*r,d=(d/o-t)*r,a=0;a<o;++a)l=i[a],c&&(l.x-=c),h&&(l.y-=h),d&&(l.z-=d)}return s.initialize=function(a){i=a},s.x=function(a){return arguments.length?(n=+a,s):n},s.y=function(a){return arguments.length?(e=+a,s):e},s.z=function(a){return arguments.length?(t=+a,s):t},s.strength=function(a){return arguments.length?(r=+a,s):r},s}function Nf(n){let e=+this._x.call(null,n);return Uf(this.cover(e),e,n)}function Uf(n,e,t){if(isNaN(e))return n;var i,r=n._root,s={data:t},a=n._x0,o=n._x1,l,c,h,d,u;if(!r)return n._root=s,n;for(;r.length;)if((h=e>=(l=(a+o)/2))?a=l:o=l,i=r,!(r=r[d=+h]))return i[d]=s,n;if(c=+n._x.call(null,r.data),e===c)return s.next=r,i?i[d]=s:n._root=s,n;do i=i?i[d]=new Array(2):n._root=new Array(2),(h=e>=(l=(a+o)/2))?a=l:o=l;while((d=+h)==(u=+(c>=l)));return i[u]=r,i[d]=s,n}function Ff(n){Array.isArray(n)||(n=Array.from(n));let e=n.length,t=new Float64Array(e),i=1/0,r=-1/0;for(let s=0,a;s<e;++s)isNaN(a=+this._x.call(null,n[s]))||(t[s]=a,a<i&&(i=a),a>r&&(r=a));if(i>r)return this;this.cover(i).cover(r);for(let s=0;s<e;++s)Uf(this,t[s],n[s]);return this}function Of(n){if(isNaN(n=+n))return this;var e=this._x0,t=this._x1;if(isNaN(e))t=(e=Math.floor(n))+1;else{for(var i=t-e||1,r=this._root,s,a;e>n||n>=t;)switch(a=+(n<e),s=new Array(2),s[a]=r,r=s,i*=2,a){case 0:t=e+i;break;case 1:e=t-i;break}this._root&&this._root.length&&(this._root=r)}return this._x0=e,this._x1=t,this}function Bf(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function kf(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function un(n,e,t){this.node=n,this.x0=e,this.x1=t}function zf(n,e){var t,i=this._x0,r,s,a=this._x1,o=[],l=this._root,c,h;for(l&&o.push(new un(l,i,a)),e==null?e=1/0:(i=n-e,a=n+e);c=o.pop();)if(!(!(l=c.node)||(r=c.x0)>a||(s=c.x1)<i))if(l.length){var d=(r+s)/2;o.push(new un(l[1],d,s),new un(l[0],r,d)),(h=+(n>=d))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-h],o[o.length-1-h]=c)}else{var u=Math.abs(n-+this._x.call(null,l.data));u<e&&(e=u,i=n-u,a=n+u,t=l.data)}return t}function Vf(n){if(isNaN(l=+this._x.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._x1,l,c,h,d,u;if(!t)return this;if(t.length)for(;;){if((h=l>=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[d=+h]))return this;if(!t.length)break;e[d+1&1]&&(i=e,u=d)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[d]=s:delete e[d],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(i?i[u]=t:this._root=t),this):(this._root=s,this)}function Gf(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Hf(){return this._root}function Wf(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Xf(n){var e=[],t,i=this._root,r,s,a;for(i&&e.push(new un(i,this._x0,this._x1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.x1)&&i.length){var o=(s+a)/2;(r=i[1])&&e.push(new un(r,o,a)),(r=i[0])&&e.push(new un(r,s,o))}return this}function qf(n){var e=[],t=[],i;for(this._root&&e.push(new un(this._root,this._x0,this._x1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.x1,l=(a+o)/2;(s=r[0])&&e.push(new un(s,a,l)),(s=r[1])&&e.push(new un(s,l,o))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.x1);return this}function Yf(n){return n[0]}function $f(n){return arguments.length?(this._x=n,this):this._x}function _s(n,e){var t=new Wc(e??Yf,NaN,NaN);return n==null?t:t.addAll(n)}function Wc(n,e,t){this._x=n,this._x0=e,this._x1=t,this._root=void 0}function jf(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Yt=_s.prototype=Wc.prototype;Yt.copy=function(){var n=new Wc(this._x,this._x0,this._x1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=jf(e),n;for(t=[{source:e,target:n._root=new Array(2)}];e=t.pop();)for(var r=0;r<2;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(2)}):e.target[r]=jf(i));return n};Yt.add=Nf;Yt.addAll=Ff;Yt.cover=Of;Yt.data=Bf;Yt.extent=kf;Yt.find=zf;Yt.remove=Vf;Yt.removeAll=Gf;Yt.root=Hf;Yt.size=Wf;Yt.visit=Xf;Yt.visitAfter=qf;Yt.x=$f;function Zf(n){let e=+this._x.call(null,n),t=+this._y.call(null,n);return Jf(this.cover(e,t),e,t,n)}function Jf(n,e,t,i){if(isNaN(e)||isNaN(t))return n;var r,s=n._root,a={data:i},o=n._x0,l=n._y0,c=n._x1,h=n._y1,d,u,p,m,x,g,f,v;if(!s)return n._root=a,n;for(;s.length;)if((x=e>=(d=(o+c)/2))?o=d:c=d,(g=t>=(u=(l+h)/2))?l=u:h=u,r=s,!(s=s[f=g<<1|x]))return r[f]=a,n;if(p=+n._x.call(null,s.data),m=+n._y.call(null,s.data),e===p&&t===m)return a.next=s,r?r[f]=a:n._root=a,n;do r=r?r[f]=new Array(4):n._root=new Array(4),(x=e>=(d=(o+c)/2))?o=d:c=d,(g=t>=(u=(l+h)/2))?l=u:h=u;while((f=g<<1|x)===(v=(m>=u)<<1|p>=d));return r[v]=s,r[f]=a,n}function Kf(n){var e,t,i=n.length,r,s,a=new Array(i),o=new Array(i),l=1/0,c=1/0,h=-1/0,d=-1/0;for(t=0;t<i;++t)isNaN(r=+this._x.call(null,e=n[t]))||isNaN(s=+this._y.call(null,e))||(a[t]=r,o[t]=s,r<l&&(l=r),r>h&&(h=r),s<c&&(c=s),s>d&&(d=s));if(l>h||c>d)return this;for(this.cover(l,c).cover(h,d),t=0;t<i;++t)Jf(this,a[t],o[t],n[t]);return this}function Qf(n,e){if(isNaN(n=+n)||isNaN(e=+e))return this;var t=this._x0,i=this._y0,r=this._x1,s=this._y1;if(isNaN(t))r=(t=Math.floor(n))+1,s=(i=Math.floor(e))+1;else{for(var a=r-t||1,o=this._root,l,c;t>n||n>=r||i>e||e>=s;)switch(c=(e<i)<<1|n<t,l=new Array(4),l[c]=o,o=l,a*=2,c){case 0:r=t+a,s=i+a;break;case 1:t=r-a,s=i+a;break;case 2:r=t+a,i=s-a;break;case 3:t=r-a,i=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=i,this._x1=r,this._y1=s,this}function ed(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function td(n){return arguments.length?this.cover(+n[0][0],+n[0][1]).cover(+n[1][0],+n[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ct(n,e,t,i,r){this.node=n,this.x0=e,this.y0=t,this.x1=i,this.y1=r}function nd(n,e,t){var i,r=this._x0,s=this._y0,a,o,l,c,h=this._x1,d=this._y1,u=[],p=this._root,m,x;for(p&&u.push(new Ct(p,r,s,h,d)),t==null?t=1/0:(r=n-t,s=e-t,h=n+t,d=e+t,t*=t);m=u.pop();)if(!(!(p=m.node)||(a=m.x0)>h||(o=m.y0)>d||(l=m.x1)<r||(c=m.y1)<s))if(p.length){var g=(a+l)/2,f=(o+c)/2;u.push(new Ct(p[3],g,f,l,c),new Ct(p[2],a,f,g,c),new Ct(p[1],g,o,l,f),new Ct(p[0],a,o,g,f)),(x=(e>=f)<<1|n>=g)&&(m=u[u.length-1],u[u.length-1]=u[u.length-1-x],u[u.length-1-x]=m)}else{var v=n-+this._x.call(null,p.data),M=e-+this._y.call(null,p.data),S=v*v+M*M;if(S<t){var w=Math.sqrt(t=S);r=n-w,s=e-w,h=n+w,d=e+w,i=p.data}}return i}function id(n){if(isNaN(h=+this._x.call(null,n))||isNaN(d=+this._y.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._y0,l=this._x1,c=this._y1,h,d,u,p,m,x,g,f;if(!t)return this;if(t.length)for(;;){if((m=h>=(u=(a+l)/2))?a=u:l=u,(x=d>=(p=(o+c)/2))?o=p:c=p,e=t,!(t=t[g=x<<1|m]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(i=e,f=g)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[g]=s:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[f]=t:this._root=t),this):(this._root=s,this)}function rd(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function sd(){return this._root}function ad(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function od(n){var e=[],t,i=this._root,r,s,a,o,l;for(i&&e.push(new Ct(i,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.y0,o=t.x1,l=t.y1)&&i.length){var c=(s+o)/2,h=(a+l)/2;(r=i[3])&&e.push(new Ct(r,c,h,o,l)),(r=i[2])&&e.push(new Ct(r,s,h,c,l)),(r=i[1])&&e.push(new Ct(r,c,a,o,h)),(r=i[0])&&e.push(new Ct(r,s,a,c,h))}return this}function ld(n){var e=[],t=[],i;for(this._root&&e.push(new Ct(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.y0,l=i.x1,c=i.y1,h=(a+l)/2,d=(o+c)/2;(s=r[0])&&e.push(new Ct(s,a,o,h,d)),(s=r[1])&&e.push(new Ct(s,h,o,l,d)),(s=r[2])&&e.push(new Ct(s,a,d,h,c)),(s=r[3])&&e.push(new Ct(s,h,d,l,c))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.y0,i.x1,i.y1);return this}function cd(n){return n[0]}function hd(n){return arguments.length?(this._x=n,this):this._x}function ud(n){return n[1]}function fd(n){return arguments.length?(this._y=n,this):this._y}function xs(n,e,t){var i=new Xc(e??cd,t??ud,NaN,NaN,NaN,NaN);return n==null?i:i.addAll(n)}function Xc(n,e,t,i,r,s){this._x=n,this._y=e,this._x0=t,this._y0=i,this._x1=r,this._y1=s,this._root=void 0}function dd(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Gt=xs.prototype=Xc.prototype;Gt.copy=function(){var n=new Xc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=dd(e),n;for(t=[{source:e,target:n._root=new Array(4)}];e=t.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=dd(i));return n};Gt.add=Zf;Gt.addAll=Kf;Gt.cover=Qf;Gt.data=ed;Gt.extent=td;Gt.find=nd;Gt.remove=id;Gt.removeAll=rd;Gt.root=sd;Gt.size=ad;Gt.visit=od;Gt.visitAfter=ld;Gt.x=hd;Gt.y=fd;function pd(n){let e=+this._x.call(null,n),t=+this._y.call(null,n),i=+this._z.call(null,n);return md(this.cover(e,t,i),e,t,i,n)}function md(n,e,t,i,r){if(isNaN(e)||isNaN(t)||isNaN(i))return n;var s,a=n._root,o={data:r},l=n._x0,c=n._y0,h=n._z0,d=n._x1,u=n._y1,p=n._z1,m,x,g,f,v,M,S,w,y,A,_;if(!a)return n._root=o,n;for(;a.length;)if((S=e>=(m=(l+d)/2))?l=m:d=m,(w=t>=(x=(c+u)/2))?c=x:u=x,(y=i>=(g=(h+p)/2))?h=g:p=g,s=a,!(a=a[A=y<<2|w<<1|S]))return s[A]=o,n;if(f=+n._x.call(null,a.data),v=+n._y.call(null,a.data),M=+n._z.call(null,a.data),e===f&&t===v&&i===M)return o.next=a,s?s[A]=o:n._root=o,n;do s=s?s[A]=new Array(8):n._root=new Array(8),(S=e>=(m=(l+d)/2))?l=m:d=m,(w=t>=(x=(c+u)/2))?c=x:u=x,(y=i>=(g=(h+p)/2))?h=g:p=g;while((A=y<<2|w<<1|S)===(_=(M>=g)<<2|(v>=x)<<1|f>=m));return s[_]=a,s[A]=o,n}function gd(n){Array.isArray(n)||(n=Array.from(n));let e=n.length,t=new Float64Array(e),i=new Float64Array(e),r=new Float64Array(e),s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=0,u,p,m,x;d<e;++d)isNaN(p=+this._x.call(null,u=n[d]))||isNaN(m=+this._y.call(null,u))||isNaN(x=+this._z.call(null,u))||(t[d]=p,i[d]=m,r[d]=x,p<s&&(s=p),p>l&&(l=p),m<a&&(a=m),m>c&&(c=m),x<o&&(o=x),x>h&&(h=x));if(s>l||a>c||o>h)return this;this.cover(s,a,o).cover(l,c,h);for(let d=0;d<e;++d)md(this,t[d],i[d],r[d],n[d]);return this}function _d(n,e,t){if(isNaN(n=+n)||isNaN(e=+e)||isNaN(t=+t))return this;var i=this._x0,r=this._y0,s=this._z0,a=this._x1,o=this._y1,l=this._z1;if(isNaN(i))a=(i=Math.floor(n))+1,o=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=a-i||1,h=this._root,d,u;i>n||n>=a||r>e||e>=o||s>t||t>=l;)switch(u=(t<s)<<2|(e<r)<<1|n<i,d=new Array(8),d[u]=h,h=d,c*=2,u){case 0:a=i+c,o=r+c,l=s+c;break;case 1:i=a-c,o=r+c,l=s+c;break;case 2:a=i+c,r=o-c,l=s+c;break;case 3:i=a-c,r=o-c,l=s+c;break;case 4:a=i+c,o=r+c,s=l-c;break;case 5:i=a-c,o=r+c,s=l-c;break;case 6:a=i+c,r=o-c,s=l-c;break;case 7:i=a-c,r=o-c,s=l-c;break}this._root&&this._root.length&&(this._root=h)}return this._x0=i,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this}function xd(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function vd(n){return arguments.length?this.cover(+n[0][0],+n[0][1],+n[0][2]).cover(+n[1][0],+n[1][1],+n[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function tt(n,e,t,i,r,s,a){this.node=n,this.x0=e,this.y0=t,this.z0=i,this.x1=r,this.y1=s,this.z1=a}function yd(n,e,t,i){var r,s=this._x0,a=this._y0,o=this._z0,l,c,h,d,u,p,m=this._x1,x=this._y1,g=this._z1,f=[],v=this._root,M,S;for(v&&f.push(new tt(v,s,a,o,m,x,g)),i==null?i=1/0:(s=n-i,a=e-i,o=t-i,m=n+i,x=e+i,g=t+i,i*=i);M=f.pop();)if(!(!(v=M.node)||(l=M.x0)>m||(c=M.y0)>x||(h=M.z0)>g||(d=M.x1)<s||(u=M.y1)<a||(p=M.z1)<o))if(v.length){var w=(l+d)/2,y=(c+u)/2,A=(h+p)/2;f.push(new tt(v[7],w,y,A,d,u,p),new tt(v[6],l,y,A,w,u,p),new tt(v[5],w,c,A,d,y,p),new tt(v[4],l,c,A,w,y,p),new tt(v[3],w,y,h,d,u,A),new tt(v[2],l,y,h,w,u,A),new tt(v[1],w,c,h,d,y,A),new tt(v[0],l,c,h,w,y,A)),(S=(t>=A)<<2|(e>=y)<<1|n>=w)&&(M=f[f.length-1],f[f.length-1]=f[f.length-1-S],f[f.length-1-S]=M)}else{var _=n-+this._x.call(null,v.data),C=e-+this._y.call(null,v.data),D=t-+this._z.call(null,v.data),P=_*_+C*C+D*D;if(P<i){var N=Math.sqrt(i=P);s=n-N,a=e-N,o=t-N,m=n+N,x=e+N,g=t+N,r=v.data}}return r}var Cy=(n,e,t,i,r,s)=>Math.sqrt((n-i)**2+(e-r)**2+(t-s)**2);function bd(n,e,t,i){let r=[],s=n-i,a=e-i,o=t-i,l=n+i,c=e+i,h=t+i;return this.visit((d,u,p,m,x,g,f)=>{if(!d.length)do{let v=d.data;Cy(n,e,t,this._x(v),this._y(v),this._z(v))<=i&&r.push(v)}while(d=d.next);return u>l||p>c||m>h||x<s||g<a||f<o}),r}function Md(n){if(isNaN(u=+this._x.call(null,n))||isNaN(p=+this._y.call(null,n))||isNaN(m=+this._z.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._y0,l=this._z0,c=this._x1,h=this._y1,d=this._z1,u,p,m,x,g,f,v,M,S,w,y;if(!t)return this;if(t.length)for(;;){if((v=u>=(x=(a+c)/2))?a=x:c=x,(M=p>=(g=(o+h)/2))?o=g:h=g,(S=m>=(f=(l+d)/2))?l=f:d=f,e=t,!(t=t[w=S<<2|M<<1|v]))return this;if(!t.length)break;(e[w+1&7]||e[w+2&7]||e[w+3&7]||e[w+4&7]||e[w+5&7]||e[w+6&7]||e[w+7&7])&&(i=e,y=w)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[w]=s:delete e[w],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[y]=t:this._root=t),this):(this._root=s,this)}function Sd(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function wd(){return this._root}function Td(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Ad(n){var e=[],t,i=this._root,r,s,a,o,l,c,h;for(i&&e.push(new tt(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.y0,o=t.z0,l=t.x1,c=t.y1,h=t.z1)&&i.length){var d=(s+l)/2,u=(a+c)/2,p=(o+h)/2;(r=i[7])&&e.push(new tt(r,d,u,p,l,c,h)),(r=i[6])&&e.push(new tt(r,s,u,p,d,c,h)),(r=i[5])&&e.push(new tt(r,d,a,p,l,u,h)),(r=i[4])&&e.push(new tt(r,s,a,p,d,u,h)),(r=i[3])&&e.push(new tt(r,d,u,o,l,c,p)),(r=i[2])&&e.push(new tt(r,s,u,o,d,c,p)),(r=i[1])&&e.push(new tt(r,d,a,o,l,u,p)),(r=i[0])&&e.push(new tt(r,s,a,o,d,u,p))}return this}function Ed(n){var e=[],t=[],i;for(this._root&&e.push(new tt(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.y0,l=i.z0,c=i.x1,h=i.y1,d=i.z1,u=(a+c)/2,p=(o+h)/2,m=(l+d)/2;(s=r[0])&&e.push(new tt(s,a,o,l,u,p,m)),(s=r[1])&&e.push(new tt(s,u,o,l,c,p,m)),(s=r[2])&&e.push(new tt(s,a,p,l,u,h,m)),(s=r[3])&&e.push(new tt(s,u,p,l,c,h,m)),(s=r[4])&&e.push(new tt(s,a,o,m,u,p,d)),(s=r[5])&&e.push(new tt(s,u,o,m,c,p,d)),(s=r[6])&&e.push(new tt(s,a,p,m,u,h,d)),(s=r[7])&&e.push(new tt(s,u,p,m,c,h,d))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function Cd(n){return n[0]}function Rd(n){return arguments.length?(this._x=n,this):this._x}function Pd(n){return n[1]}function Id(n){return arguments.length?(this._y=n,this):this._y}function Dd(n){return n[2]}function Ld(n){return arguments.length?(this._z=n,this):this._z}function vs(n,e,t,i){var r=new qc(e??Cd,t??Pd,i??Dd,NaN,NaN,NaN,NaN,NaN,NaN);return n==null?r:r.addAll(n)}function qc(n,e,t,i,r,s,a,o,l){this._x=n,this._y=e,this._z=t,this._x0=i,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function Nd(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Pt=vs.prototype=qc.prototype;Pt.copy=function(){var n=new qc(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=Nd(e),n;for(t=[{source:e,target:n._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(8)}):e.target[r]=Nd(i));return n};Pt.add=pd;Pt.addAll=gd;Pt.cover=_d;Pt.data=xd;Pt.extent=vd;Pt.find=yd;Pt.findAllWithinRadius=bd;Pt.remove=Md;Pt.removeAll=Sd;Pt.root=wd;Pt.size=Td;Pt.visit=Ad;Pt.visitAfter=Ed;Pt.x=Rd;Pt.y=Id;Pt.z=Ld;function fn(n){return function(){return n}}function bn(n){return(n()-.5)*1e-6}function Ry(n){return n.index}function Ud(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function Yc(n){var e=Ry,t=u,i,r=fn(30),s,a,o,l,c,h,d=1;n==null&&(n=[]);function u(f){return 1/Math.min(l[f.source.index],l[f.target.index])}function p(f){for(var v=0,M=n.length;v<d;++v)for(var S=0,w,y,A,_=0,C=0,D=0,P,N;S<M;++S)w=n[S],y=w.source,A=w.target,_=A.x+A.vx-y.x-y.vx||bn(h),o>1&&(C=A.y+A.vy-y.y-y.vy||bn(h)),o>2&&(D=A.z+A.vz-y.z-y.vz||bn(h)),P=Math.sqrt(_*_+C*C+D*D),P=(P-s[S])/P*f*i[S],_*=P,C*=P,D*=P,A.vx-=_*(N=c[S]),o>1&&(A.vy-=C*N),o>2&&(A.vz-=D*N),y.vx+=_*(N=1-N),o>1&&(y.vy+=C*N),o>2&&(y.vz+=D*N)}function m(){if(a){var f,v=a.length,M=n.length,S=new Map(a.map((y,A)=>[e(y,A,a),y])),w;for(f=0,l=new Array(v);f<M;++f)w=n[f],w.index=f,typeof w.source!="object"&&(w.source=Ud(S,w.source)),typeof w.target!="object"&&(w.target=Ud(S,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(f=0,c=new Array(M);f<M;++f)w=n[f],c[f]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);i=new Array(M),x(),s=new Array(M),g()}}function x(){if(a)for(var f=0,v=n.length;f<v;++f)i[f]=+t(n[f],f,n)}function g(){if(a)for(var f=0,v=n.length;f<v;++f)s[f]=+r(n[f],f,n)}return p.initialize=function(f,...v){a=f,h=v.find(M=>typeof M=="function")||Math.random,o=v.find(M=>[1,2,3].includes(M))||2,m()},p.links=function(f){return arguments.length?(n=f,m(),p):n},p.id=function(f){return arguments.length?(e=f,p):e},p.iterations=function(f){return arguments.length?(d=+f,p):d},p.strength=function(f){return arguments.length?(t=typeof f=="function"?f:fn(+f),x(),p):t},p.distance=function(f){return arguments.length?(r=typeof f=="function"?f:fn(+f),g(),p):r},p}var Py={value:()=>{}};function Od(){for(var n=0,e=arguments.length,t={},i;n<e;++n){if(!(i=arguments[n]+"")||i in t||/[\s.]/.test(i))throw new Error("illegal type: "+i);t[i]=[]}return new Wo(t)}function Wo(n){this._=n}function Iy(n,e){return n.trim().split(/^|\s+/).map(function(t){var i="",r=t.indexOf(".");if(r>=0&&(i=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}})}Wo.prototype=Od.prototype={constructor:Wo,on:function(n,e){var t=this._,i=Iy(n+"",t),r,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((r=(n=i[s]).type)&&(r=Dy(t[r],n.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(n=i[s]).type)t[r]=Fd(t[r],n.name,e);else if(e==null)for(r in t)t[r]=Fd(t[r],n.name,null);return this},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new Wo(n)},call:function(n,e){if((r=arguments.length-2)>0)for(var t=new Array(r),i=0,r,s;i<r;++i)t[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(s=this._[n],i=0,r=s.length;i<r;++i)s[i].value.apply(e,t)},apply:function(n,e,t){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var i=this._[n],r=0,s=i.length;r<s;++r)i[r].value.apply(e,t)}};function Dy(n,e){for(var t=0,i=n.length,r;t<i;++t)if((r=n[t]).name===e)return r.value}function Fd(n,e,t){for(var i=0,r=n.length;i<r;++i)if(n[i].name===e){n[i]=Py,n=n.slice(0,i).concat(n.slice(i+1));break}return t!=null&&n.push({name:e,value:t}),n}var $c=Od;var xr=0,bs=0,ys=0,kd=1e3,Xo,Ms,qo=0,Li=0,Yo=0,Ss=typeof performance=="object"&&performance.now?performance:Date,zd=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Jc(){return Li||(zd(Ly),Li=Ss.now()+Yo)}function Ly(){Li=0}function jc(){this._call=this._time=this._next=null}jc.prototype=$o.prototype={constructor:jc,restart:function(n,e,t){if(typeof n!="function")throw new TypeError("callback is not a function");t=(t==null?Jc():+t)+(e==null?0:+e),!this._next&&Ms!==this&&(Ms?Ms._next=this:Xo=this,Ms=this),this._call=n,this._time=t,Zc()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zc())}};function $o(n,e,t){var i=new jc;return i.restart(n,e,t),i}function Vd(){Jc(),++xr;for(var n=Xo,e;n;)(e=Li-n._time)>=0&&n._call.call(void 0,e),n=n._next;--xr}function Bd(){Li=(qo=Ss.now())+Yo,xr=bs=0;try{Vd()}finally{xr=0,Uy(),Li=0}}function Ny(){var n=Ss.now(),e=n-qo;e>kd&&(Yo-=e,qo=n)}function Uy(){for(var n,e=Xo,t,i=1/0;e;)e._call?(i>e._time&&(i=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:Xo=t);Ms=n,Zc(i)}function Zc(n){if(!xr){bs&&(bs=clearTimeout(bs));var e=n-Li;e>24?(n<1/0&&(bs=setTimeout(Bd,n-Ss.now()-Yo)),ys&&(ys=clearInterval(ys))):(ys||(qo=Ss.now(),ys=setInterval(Ny,kd)),xr=1,zd(Bd))}}function Gd(){let n=1;return()=>(n=(1664525*n+1013904223)%4294967296)/4294967296}var Hd=3;function jo(n){return n.x}function Kc(n){return n.y}function Wd(n){return n.z}var Fy=10,Oy=Math.PI*(3-Math.sqrt(5)),By=Math.PI*20/(9+Math.sqrt(221));function Qc(n,e){e=e||2;var t=Math.min(Hd,Math.max(1,Math.round(e))),i,r=1,s=.001,a=1-Math.pow(s,1/300),o=0,l=.6,c=new Map,h=$o(p),d=$c("tick","end"),u=Gd();n==null&&(n=[]);function p(){m(),d.call("tick",i),r<s&&(h.stop(),d.call("end",i))}function m(f){var v,M=n.length,S;f===void 0&&(f=1);for(var w=0;w<f;++w)for(r+=(o-r)*a,c.forEach(function(y){y(r)}),v=0;v<M;++v)S=n[v],S.fx==null?S.x+=S.vx*=l:(S.x=S.fx,S.vx=0),t>1&&(S.fy==null?S.y+=S.vy*=l:(S.y=S.fy,S.vy=0)),t>2&&(S.fz==null?S.z+=S.vz*=l:(S.z=S.fz,S.vz=0));return i}function x(){for(var f=0,v=n.length,M;f<v;++f){if(M=n[f],M.index=f,M.fx!=null&&(M.x=M.fx),M.fy!=null&&(M.y=M.fy),M.fz!=null&&(M.z=M.fz),isNaN(M.x)||t>1&&isNaN(M.y)||t>2&&isNaN(M.z)){var S=Fy*(t>2?Math.cbrt(.5+f):t>1?Math.sqrt(.5+f):f),w=f*Oy,y=f*By;t===1?M.x=S:t===2?(M.x=S*Math.cos(w),M.y=S*Math.sin(w)):(M.x=S*Math.sin(w)*Math.cos(y),M.y=S*Math.cos(w),M.z=S*Math.sin(w)*Math.sin(y))}(isNaN(M.vx)||t>1&&isNaN(M.vy)||t>2&&isNaN(M.vz))&&(M.vx=0,t>1&&(M.vy=0),t>2&&(M.vz=0))}}function g(f){return f.initialize&&f.initialize(n,u,t),f}return x(),i={tick:m,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(f){return arguments.length?(t=Math.min(Hd,Math.max(1,Math.round(f))),c.forEach(g),i):t},nodes:function(f){return arguments.length?(n=f,x(),c.forEach(g),i):n},alpha:function(f){return arguments.length?(r=+f,i):r},alphaMin:function(f){return arguments.length?(s=+f,i):s},alphaDecay:function(f){return arguments.length?(a=+f,i):+a},alphaTarget:function(f){return arguments.length?(o=+f,i):o},velocityDecay:function(f){return arguments.length?(l=1-f,i):1-l},randomSource:function(f){return arguments.length?(u=f,c.forEach(g),i):u},force:function(f,v){return arguments.length>1?(v==null?c.delete(f):c.set(f,g(v)),i):c.get(f)},find:function(){var f=Array.prototype.slice.call(arguments),v=f.shift()||0,M=(t>1?f.shift():null)||0,S=(t>2?f.shift():null)||0,w=f.shift()||1/0,y=0,A=n.length,_,C,D,P,N,V;for(w*=w,y=0;y<A;++y)N=n[y],_=v-N.x,C=M-(N.y||0),D=S-(N.z||0),P=_*_+C*C+D*D,P<w&&(V=N,w=P);return V},on:function(f,v){return arguments.length>1?(d.on(f,v),i):d.on(f)}}}function eh(){var n,e,t,i,r,s=fn(-30),a,o=1,l=1/0,c=.81;function h(m){var x,g=n.length,f=(e===1?_s(n,jo):e===2?xs(n,jo,Kc):e===3?vs(n,jo,Kc,Wd):null).visitAfter(u);for(r=m,x=0;x<g;++x)t=n[x],f.visit(p)}function d(){if(n){var m,x=n.length,g;for(a=new Array(x),m=0;m<x;++m)g=n[m],a[g.index]=+s(g,m,n)}}function u(m){var x=0,g,f,v=0,M,S,w,y,A=m.length;if(A){for(M=S=w=y=0;y<A;++y)(g=m[y])&&(f=Math.abs(g.value))&&(x+=g.value,v+=f,M+=f*(g.x||0),S+=f*(g.y||0),w+=f*(g.z||0));x*=Math.sqrt(4/A),m.x=M/v,e>1&&(m.y=S/v),e>2&&(m.z=w/v)}else{g=m,g.x=g.data.x,e>1&&(g.y=g.data.y),e>2&&(g.z=g.data.z);do x+=a[g.data.index];while(g=g.next)}m.value=x}function p(m,x,g,f,v){if(!m.value)return!0;var M=[g,f,v][e-1],S=m.x-t.x,w=e>1?m.y-t.y:0,y=e>2?m.z-t.z:0,A=M-x,_=S*S+w*w+y*y;if(A*A/c<_)return _<l&&(S===0&&(S=bn(i),_+=S*S),e>1&&w===0&&(w=bn(i),_+=w*w),e>2&&y===0&&(y=bn(i),_+=y*y),_<o&&(_=Math.sqrt(o*_)),t.vx+=S*m.value*r/_,e>1&&(t.vy+=w*m.value*r/_),e>2&&(t.vz+=y*m.value*r/_)),!0;if(m.length||_>=l)return;(m.data!==t||m.next)&&(S===0&&(S=bn(i),_+=S*S),e>1&&w===0&&(w=bn(i),_+=w*w),e>2&&y===0&&(y=bn(i),_+=y*y),_<o&&(_=Math.sqrt(o*_)));do m.data!==t&&(A=a[m.data.index]*r/_,t.vx+=S*A,e>1&&(t.vy+=w*A),e>2&&(t.vz+=y*A));while(m=m.next)}return h.initialize=function(m,...x){n=m,i=x.find(g=>typeof g=="function")||Math.random,e=x.find(g=>[1,2,3].includes(g))||2,d()},h.strength=function(m){return arguments.length?(s=typeof m=="function"?m:fn(+m),d(),h):s},h.distanceMin=function(m){return arguments.length?(o=m*m,h):Math.sqrt(o)},h.distanceMax=function(m){return arguments.length?(l=m*m,h):Math.sqrt(l)},h.theta=function(m){return arguments.length?(c=m*m,h):Math.sqrt(c)},h}function th(n,e,t,i){var r,s,a=fn(.1),o,l;typeof n!="function"&&(n=fn(+n)),e==null&&(e=0),t==null&&(t=0),i==null&&(i=0);function c(d){for(var u=0,p=r.length;u<p;++u){var m=r[u],x=m.x-e||1e-6,g=(m.y||0)-t||1e-6,f=(m.z||0)-i||1e-6,v=Math.sqrt(x*x+g*g+f*f),M=(l[u]-v)*o[u]*d/v;m.vx+=x*M,s>1&&(m.vy+=g*M),s>2&&(m.vz+=f*M)}}function h(){if(r){var d,u=r.length;for(o=new Array(u),l=new Array(u),d=0;d<u;++d)l[d]=+n(r[d],d,r),o[d]=isNaN(l[d])?0:+a(r[d],d,r)}}return c.initialize=function(d,...u){r=d,s=u.find(p=>[1,2,3].includes(p))||2,h()},c.strength=function(d){return arguments.length?(a=typeof d=="function"?d:fn(+d),h(),c):a},c.radius=function(d){return arguments.length?(n=typeof d=="function"?d:fn(+d),h(),c):n},c.x=function(d){return arguments.length?(e=+d,c):e},c.y=function(d){return arguments.length?(t=+d,c):t},c.z=function(d){return arguments.length?(i=+d,c):i},c}function nh(n){zy(n);let e=ky(n);return n.on=e.on,n.off=e.off,n.fire=e.fire,n}function ky(n){let e=Object.create(null);return{on:function(t,i,r){if(typeof i!="function")throw new Error("callback is expected to be a function");let s=e[t];return s||(s=e[t]=[]),s.push({callback:i,ctx:r}),n},off:function(t,i){if(typeof t>"u")return e=Object.create(null),n;if(e[t])if(typeof i!="function")delete e[t];else{let a=e[t];for(let o=0;o<a.length;++o)a[o].callback===i&&a.splice(o,1)}return n},fire:function(t){let i=e[t];if(!i)return n;let r;arguments.length>1&&(r=Array.prototype.slice.call(arguments,1));for(let s=0;s<i.length;++s){let a=i[s];a.callback.apply(a.ctx,r)}return n}}}function zy(n){if(!n)throw new Error("Eventify cannot use falsy object as events subject");let e=["on","fire","off"];for(let t=0;t<e.length;++t)if(n.hasOwnProperty(e[t]))throw new Error("Subject cannot be eventified, since it already has property '"+e[t]+"'")}var Yd=Vy;function Vy(n){if(n=n||{},"uniqueLinkId"in n&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
4603
|
+
}`,Vc=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let i=new Xr(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,i=new nn({vertexShader:Ay,fragmentShader:Ey,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Xt(new $r(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Gc=class extends _n{constructor(e,t){super();let i=this,r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,u=null,p=null,m=null,x=typeof XRWebGLBinding<"u",g=new Vc,f={},v=t.getContextAttributes(),M=null,S=null,w=[],y=[],A=new Te,_=null,C=new Nt;C.viewport=new pt;let D=new Nt;D.viewport=new pt;let P=[C,D],N=new Xa,V=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(z){let $=w[z];return $===void 0&&($=new ir,w[z]=$),$.getTargetRaySpace()},this.getControllerGrip=function(z){let $=w[z];return $===void 0&&($=new ir,w[z]=$),$.getGripSpace()},this.getHand=function(z){let $=w[z];return $===void 0&&($=new ir,w[z]=$),$.getHandSpace()};function R(z){let $=y.indexOf(z.inputSource);if($===-1)return;let te=w[$];te!==void 0&&(te.update(z.inputSource,z.frame,c||a),te.dispatchEvent({type:z.type,data:z.inputSource}))}function L(){r.removeEventListener("select",R),r.removeEventListener("selectstart",R),r.removeEventListener("selectend",R),r.removeEventListener("squeeze",R),r.removeEventListener("squeezestart",R),r.removeEventListener("squeezeend",R),r.removeEventListener("end",L),r.removeEventListener("inputsourceschange",k);for(let z=0;z<w.length;z++){let $=y[z];$!==null&&(y[z]=null,w[z].disconnect($))}V=null,I=null,g.reset();for(let z in f)delete f[z];e.setRenderTarget(M),p=null,u=null,d=null,r=null,S=null,Y.stop(),i.isPresenting=!1,e.setPixelRatio(_),e.setSize(A.width,A.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(z){s=z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(z){o=z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(z){c=z},this.getBaseLayer=function(){return u!==null?u:p},this.getBinding=function(){return d===null&&x&&(d=new XRWebGLBinding(r,t)),d},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(z){if(r=z,r!==null){if(M=e.getRenderTarget(),r.addEventListener("select",R),r.addEventListener("selectstart",R),r.addEventListener("selectend",R),r.addEventListener("squeeze",R),r.addEventListener("squeezestart",R),r.addEventListener("squeezeend",R),r.addEventListener("end",L),r.addEventListener("inputsourceschange",k),v.xrCompatible!==!0&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(A),x&&"createProjectionLayer"in XRWebGLBinding.prototype){let te=null,ve=null,Me=null;v.depth&&(Me=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,te=v.stencil?mi:Pn,ve=v.stencil?dr:vn);let xe={colorFormat:t.RGBA8,depthFormat:Me,scaleFactor:s};d=this.getBinding(),u=d.createProjectionLayer(xe),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),S=new tn(u.textureWidth,u.textureHeight,{format:hn,type:qt,depthTexture:new Yn(u.textureWidth,u.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,te),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{let te={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,te),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),S=new tn(p.framebufferWidth,p.framebufferHeight,{format:hn,type:qt,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}S.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Y.setContext(r),Y.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function k(z){for(let $=0;$<z.removed.length;$++){let te=z.removed[$],ve=y.indexOf(te);ve>=0&&(y[ve]=null,w[ve].disconnect(te))}for(let $=0;$<z.added.length;$++){let te=z.added[$],ve=y.indexOf(te);if(ve===-1){for(let xe=0;xe<w.length;xe++)if(xe>=y.length){y.push(te),ve=xe;break}else if(y[xe]===null){y[xe]=te,ve=xe;break}if(ve===-1)break}let Me=w[ve];Me&&Me.connect(te)}}let ee=new U,ne=new U;function he(z,$,te){ee.setFromMatrixPosition($.matrixWorld),ne.setFromMatrixPosition(te.matrixWorld);let ve=ee.distanceTo(ne),Me=$.projectionMatrix.elements,xe=te.projectionMatrix.elements,Ze=Me[14]/(Me[10]-1),Ue=Me[14]/(Me[10]+1),qe=(Me[9]+1)/Me[5],Qe=(Me[9]-1)/Me[5],Oe=(Me[8]-1)/Me[0],it=(xe[8]+1)/xe[0],nt=Ze*Oe,jt=Ze*it,F=ve/(-Oe+it),Mt=F*-Oe;if($.matrixWorld.decompose(z.position,z.quaternion,z.scale),z.translateX(Mt),z.translateZ(F),z.matrixWorld.compose(z.position,z.quaternion,z.scale),z.matrixWorldInverse.copy(z.matrixWorld).invert(),Me[10]===-1)z.projectionMatrix.copy($.projectionMatrix),z.projectionMatrixInverse.copy($.projectionMatrixInverse);else{let Ye=Ze+F,ht=Ue+F,de=nt-Mt,mt=jt+(ve-Mt),E=qe*Ue/ht*Ye,b=Qe*Ue/ht*Ye;z.projectionMatrix.makePerspective(de,mt,E,b,Ye,ht),z.projectionMatrixInverse.copy(z.projectionMatrix).invert()}}function q(z,$){$===null?z.matrixWorld.copy(z.matrix):z.matrixWorld.multiplyMatrices($.matrixWorld,z.matrix),z.matrixWorldInverse.copy(z.matrixWorld).invert()}this.updateCamera=function(z){if(r===null)return;let $=z.near,te=z.far;g.texture!==null&&(g.depthNear>0&&($=g.depthNear),g.depthFar>0&&(te=g.depthFar)),N.near=D.near=C.near=$,N.far=D.far=C.far=te,(V!==N.near||I!==N.far)&&(r.updateRenderState({depthNear:N.near,depthFar:N.far}),V=N.near,I=N.far),N.layers.mask=z.layers.mask|6,C.layers.mask=N.layers.mask&-5,D.layers.mask=N.layers.mask&-3;let ve=z.parent,Me=N.cameras;q(N,ve);for(let xe=0;xe<Me.length;xe++)q(Me[xe],ve);Me.length===2?he(N,C,D):N.projectionMatrix.copy(C.projectionMatrix),J(z,N,ve)};function J(z,$,te){te===null?z.matrix.copy($.matrixWorld):(z.matrix.copy(te.matrixWorld),z.matrix.invert(),z.matrix.multiply($.matrixWorld)),z.matrix.decompose(z.position,z.quaternion,z.scale),z.updateMatrixWorld(!0),z.projectionMatrix.copy($.projectionMatrix),z.projectionMatrixInverse.copy($.projectionMatrixInverse),z.isPerspectiveCamera&&(z.fov=er*2*Math.atan(1/z.projectionMatrix.elements[5]),z.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(u===null&&p===null))return l},this.setFoveation=function(z){l=z,u!==null&&(u.fixedFoveation=z),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=z)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(N)},this.getCameraTexture=function(z){return f[z]};let fe=null;function De(z,$){if(h=$.getViewerPose(c||a),m=$,h!==null){let te=h.views;p!==null&&(e.setRenderTargetFramebuffer(S,p.framebuffer),e.setRenderTarget(S));let ve=!1;te.length!==N.cameras.length&&(N.cameras.length=0,ve=!0);for(let Ue=0;Ue<te.length;Ue++){let qe=te[Ue],Qe=null;if(p!==null)Qe=p.getViewport(qe);else{let it=d.getViewSubImage(u,qe);Qe=it.viewport,Ue===0&&(e.setRenderTargetTextures(S,it.colorTexture,it.depthStencilTexture),e.setRenderTarget(S))}let Oe=P[Ue];Oe===void 0&&(Oe=new Nt,Oe.layers.enable(Ue),Oe.viewport=new pt,P[Ue]=Oe),Oe.matrix.fromArray(qe.transform.matrix),Oe.matrix.decompose(Oe.position,Oe.quaternion,Oe.scale),Oe.projectionMatrix.fromArray(qe.projectionMatrix),Oe.projectionMatrixInverse.copy(Oe.projectionMatrix).invert(),Oe.viewport.set(Qe.x,Qe.y,Qe.width,Qe.height),Ue===0&&(N.matrix.copy(Oe.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),ve===!0&&N.cameras.push(Oe)}let Me=r.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&x){d=i.getBinding();let Ue=d.getDepthInformation(te[0]);Ue&&Ue.isValid&&Ue.texture&&g.init(Ue,r.renderState)}if(Me&&Me.includes("camera-access")&&x){e.state.unbindTexture(),d=i.getBinding();for(let Ue=0;Ue<te.length;Ue++){let qe=te[Ue].camera;if(qe){let Qe=f[qe];Qe||(Qe=new Xr,f[qe]=Qe);let Oe=d.getCameraImage(qe);Qe.sourceTexture=Oe}}}}for(let te=0;te<w.length;te++){let ve=y[te],Me=w[te];ve!==null&&Me!==void 0&&Me.update(ve,$,c||a)}fe&&fe(z,$),$.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:$}),m=null}let Y=new Cf;Y.setAnimationLoop(De),this.setAnimationLoop=function(z){fe=z},this.dispose=function(){}}},Cy=new ct,Nf=new Be;Nf.set(-1,0,0,0,1,0,0,0,1);function Ry(n,e){function t(g,f){g.matrixAutoUpdate===!0&&g.updateMatrix(),f.value.copy(g.matrix)}function i(g,f){f.color.getRGB(g.fogColor.value,vc(n)),f.isFog?(g.fogNear.value=f.near,g.fogFar.value=f.far):f.isFogExp2&&(g.fogDensity.value=f.density)}function r(g,f,v,M,S){f.isNodeMaterial?f.uniformsNeedUpdate=!1:f.isMeshBasicMaterial?s(g,f):f.isMeshLambertMaterial?(s(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshToonMaterial?(s(g,f),d(g,f)):f.isMeshPhongMaterial?(s(g,f),h(g,f),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)):f.isMeshStandardMaterial?(s(g,f),u(g,f),f.isMeshPhysicalMaterial&&p(g,f,S)):f.isMeshMatcapMaterial?(s(g,f),m(g,f)):f.isMeshDepthMaterial?s(g,f):f.isMeshDistanceMaterial?(s(g,f),x(g,f)):f.isMeshNormalMaterial?s(g,f):f.isLineBasicMaterial?(a(g,f),f.isLineDashedMaterial&&o(g,f)):f.isPointsMaterial?l(g,f,v,M):f.isSpriteMaterial?c(g,f):f.isShadowMaterial?(g.color.value.copy(f.color),g.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(g,f){g.opacity.value=f.opacity,f.color&&g.diffuse.value.copy(f.color),f.emissive&&g.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.bumpMap&&(g.bumpMap.value=f.bumpMap,t(f.bumpMap,g.bumpMapTransform),g.bumpScale.value=f.bumpScale,f.side===Vt&&(g.bumpScale.value*=-1)),f.normalMap&&(g.normalMap.value=f.normalMap,t(f.normalMap,g.normalMapTransform),g.normalScale.value.copy(f.normalScale),f.side===Vt&&g.normalScale.value.negate()),f.displacementMap&&(g.displacementMap.value=f.displacementMap,t(f.displacementMap,g.displacementMapTransform),g.displacementScale.value=f.displacementScale,g.displacementBias.value=f.displacementBias),f.emissiveMap&&(g.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,g.emissiveMapTransform)),f.specularMap&&(g.specularMap.value=f.specularMap,t(f.specularMap,g.specularMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest);let v=e.get(f),M=v.envMap,S=v.envMapRotation;M&&(g.envMap.value=M,g.envMapRotation.value.setFromMatrix4(Cy.makeRotationFromEuler(S)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(Nf),g.reflectivity.value=f.reflectivity,g.ior.value=f.ior,g.refractionRatio.value=f.refractionRatio),f.lightMap&&(g.lightMap.value=f.lightMap,g.lightMapIntensity.value=f.lightMapIntensity,t(f.lightMap,g.lightMapTransform)),f.aoMap&&(g.aoMap.value=f.aoMap,g.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,g.aoMapTransform))}function a(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform))}function o(g,f){g.dashSize.value=f.dashSize,g.totalSize.value=f.dashSize+f.gapSize,g.scale.value=f.scale}function l(g,f,v,M){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.size.value=f.size*v,g.scale.value=M*.5,f.map&&(g.map.value=f.map,t(f.map,g.uvTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function c(g,f){g.diffuse.value.copy(f.color),g.opacity.value=f.opacity,g.rotation.value=f.rotation,f.map&&(g.map.value=f.map,t(f.map,g.mapTransform)),f.alphaMap&&(g.alphaMap.value=f.alphaMap,t(f.alphaMap,g.alphaMapTransform)),f.alphaTest>0&&(g.alphaTest.value=f.alphaTest)}function h(g,f){g.specular.value.copy(f.specular),g.shininess.value=Math.max(f.shininess,1e-4)}function d(g,f){f.gradientMap&&(g.gradientMap.value=f.gradientMap)}function u(g,f){g.metalness.value=f.metalness,f.metalnessMap&&(g.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,g.metalnessMapTransform)),g.roughness.value=f.roughness,f.roughnessMap&&(g.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,g.roughnessMapTransform)),f.envMap&&(g.envMapIntensity.value=f.envMapIntensity)}function p(g,f,v){g.ior.value=f.ior,f.sheen>0&&(g.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),g.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(g.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,g.sheenColorMapTransform)),f.sheenRoughnessMap&&(g.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,g.sheenRoughnessMapTransform))),f.clearcoat>0&&(g.clearcoat.value=f.clearcoat,g.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(g.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,g.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(g.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Vt&&g.clearcoatNormalScale.value.negate())),f.dispersion>0&&(g.dispersion.value=f.dispersion),f.iridescence>0&&(g.iridescence.value=f.iridescence,g.iridescenceIOR.value=f.iridescenceIOR,g.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(g.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,g.iridescenceMapTransform)),f.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),f.transmission>0&&(g.transmission.value=f.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(g.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,g.transmissionMapTransform)),g.thickness.value=f.thickness,f.thicknessMap&&(g.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=f.attenuationDistance,g.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(g.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(g.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=f.specularIntensity,g.specularColor.value.copy(f.specularColor),f.specularColorMap&&(g.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,g.specularColorMapTransform)),f.specularIntensityMap&&(g.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,f){f.matcap&&(g.matcap.value=f.matcap)}function x(g,f){let v=e.get(f).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Py(n,e,t,i){let r={},s={},a=[],o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,M){let S=M.program;i.uniformBlockBinding(v,S)}function c(v,M){let S=r[v.id];S===void 0&&(m(v),S=h(v),r[v.id]=S,v.addEventListener("dispose",g));let w=M.program;i.updateUBOMapping(v,w);let y=e.render.frame;s[v.id]!==y&&(u(v),s[v.id]=y)}function h(v){let M=d();v.__bindingPointIndex=M;let S=n.createBuffer(),w=v.__size,y=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,S),n.bufferData(n.UNIFORM_BUFFER,w,y),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,M,S),S}function d(){for(let v=0;v<o;v++)if(a.indexOf(v)===-1)return a.push(v),v;return Le("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(v){let M=r[v.id],S=v.uniforms,w=v.__cache;n.bindBuffer(n.UNIFORM_BUFFER,M);for(let y=0,A=S.length;y<A;y++){let _=Array.isArray(S[y])?S[y]:[S[y]];for(let C=0,D=_.length;C<D;C++){let P=_[C];if(p(P,y,C,w)===!0){let N=P.__offset,V=Array.isArray(P.value)?P.value:[P.value],I=0;for(let R=0;R<V.length;R++){let L=V[R],k=x(L);typeof L=="number"||typeof L=="boolean"?(P.__data[0]=L,n.bufferSubData(n.UNIFORM_BUFFER,N+I,P.__data)):L.isMatrix3?(P.__data[0]=L.elements[0],P.__data[1]=L.elements[1],P.__data[2]=L.elements[2],P.__data[3]=0,P.__data[4]=L.elements[3],P.__data[5]=L.elements[4],P.__data[6]=L.elements[5],P.__data[7]=0,P.__data[8]=L.elements[6],P.__data[9]=L.elements[7],P.__data[10]=L.elements[8],P.__data[11]=0):ArrayBuffer.isView(L)?P.__data.set(new L.constructor(L.buffer,L.byteOffset,P.__data.length)):(L.toArray(P.__data,I),I+=k.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,N,P.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function p(v,M,S,w){let y=v.value,A=M+"_"+S;if(w[A]===void 0)return typeof y=="number"||typeof y=="boolean"?w[A]=y:ArrayBuffer.isView(y)?w[A]=y.slice():w[A]=y.clone(),!0;{let _=w[A];if(typeof y=="number"||typeof y=="boolean"){if(_!==y)return w[A]=y,!0}else{if(ArrayBuffer.isView(y))return!0;if(_.equals(y)===!1)return _.copy(y),!0}}return!1}function m(v){let M=v.uniforms,S=0,w=16;for(let A=0,_=M.length;A<_;A++){let C=Array.isArray(M[A])?M[A]:[M[A]];for(let D=0,P=C.length;D<P;D++){let N=C[D],V=Array.isArray(N.value)?N.value:[N.value];for(let I=0,R=V.length;I<R;I++){let L=V[I],k=x(L),ee=S%w,ne=ee%k.boundary,he=ee+ne;S+=ne,he!==0&&w-he<k.storage&&(S+=w-he),N.__data=new Float32Array(k.storage/Float32Array.BYTES_PER_ELEMENT),N.__offset=S,S+=k.storage}}}let y=S%w;return y>0&&(S+=w-y),v.__size=S,v.__cache={},this}function x(v){let M={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(M.boundary=4,M.storage=4):v.isVector2?(M.boundary=8,M.storage=8):v.isVector3||v.isColor?(M.boundary=16,M.storage=12):v.isVector4?(M.boundary=16,M.storage=16):v.isMatrix3?(M.boundary=48,M.storage=48):v.isMatrix4?(M.boundary=64,M.storage=64):v.isTexture?Ie("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(v)?(M.boundary=16,M.storage=v.byteLength):Ie("WebGLRenderer: Unsupported uniform value type.",v),M}function g(v){let M=v.target;M.removeEventListener("dispose",g);let S=a.indexOf(M.__bindingPointIndex);a.splice(S,1),n.deleteBuffer(r[M.id]),delete r[M.id],delete s[M.id]}function f(){for(let v in r)n.deleteBuffer(r[v]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}var Iy=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Un=null;function Dy(){return Un===null&&(Un=new ya(Iy,16,16,gi,Nn),Un.name="DFG_LUT",Un.minFilter=Rt,Un.magFilter=Rt,Un.wrapS=Cn,Un.wrapT=Cn,Un.generateMipmaps=!1,Un.needsUpdate=!0),Un}var Vo=class{constructor(e={}){let{canvas:t=Ku(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:u=!1,outputBufferType:p=qt}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=a;let x=p,g=new Set([no,to,eo]),f=new Set([qt,vn,fr,dr,Ka,Qa]),v=new Uint32Array(4),M=new Int32Array(4),S=new U,w=null,y=null,A=[],_=[],C=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=xn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let D=this,P=!1,N=null;this._outputColorSpace=Qt;let V=0,I=0,R=null,L=-1,k=null,ee=new pt,ne=new pt,he=null,q=new Xe(0),J=0,fe=t.width,De=t.height,Y=1,z=null,$=null,te=new pt(0,0,fe,De),ve=new pt(0,0,fe,De),Me=!1,xe=new rr,Ze=!1,Ue=!1,qe=new ct,Qe=new U,Oe=new pt,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},nt=!1;function jt(){return R===null?Y:1}let F=i;function Mt(T,B){return t.getContext(T,B)}try{let T={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"184"}`),t.addEventListener("webglcontextlost",ie,!1),t.addEventListener("webglcontextrestored",Ce,!1),t.addEventListener("webglcontextcreationerror",ke,!1),F===null){let B="webgl2";if(F=Mt(B,T),F===null)throw Mt(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(T){throw Le("WebGLRenderer: "+T.message),T}let Ye,ht,de,mt,E,b,G,K,re,se,ue,j,Q,_e,Se,le,ae,Fe,Ve,Ke,O,oe,Z;function ye(){Ye=new kx(F),Ye.init(),O=new Ty(F,Ye),ht=new Ix(F,Ye,e,O),de=new Sy(F,Ye),ht.reversedDepthBuffer&&u&&de.buffers.depth.setReversed(!0),mt=new Gx(F),E=new cy,b=new wy(F,Ye,de,E,ht,O,mt),G=new Bx(D),K=new qg(F),oe=new Rx(F,K),re=new zx(F,K,mt,oe),se=new Wx(F,re,K,oe,mt),Fe=new Hx(F,ht,b),Se=new Dx(E),ue=new ly(D,G,Ye,ht,oe,Se),j=new Ry(D,E),Q=new uy,_e=new _y(Ye),ae=new Cx(D,G,de,se,m,l),le=new My(D,se,ht),Z=new Py(F,mt,ht,de),Ve=new Px(F,Ye,mt),Ke=new Vx(F,Ye,mt),mt.programs=ue.programs,D.capabilities=ht,D.extensions=Ye,D.properties=E,D.renderLists=Q,D.shadowMap=le,D.state=de,D.info=mt}ye(),x!==qt&&(C=new qx(x,t.width,t.height,r,s));let ce=new Gc(D,F);this.xr=ce,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){let T=Ye.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){let T=Ye.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(T){T!==void 0&&(Y=T,this.setSize(fe,De,!1))},this.getSize=function(T){return T.set(fe,De)},this.setSize=function(T,B,X=!0){if(ce.isPresenting){Ie("WebGLRenderer: Can't change size while VR device is presenting.");return}fe=T,De=B,t.width=Math.floor(T*Y),t.height=Math.floor(B*Y),X===!0&&(t.style.width=T+"px",t.style.height=B+"px"),C!==null&&C.setSize(t.width,t.height),this.setViewport(0,0,T,B)},this.getDrawingBufferSize=function(T){return T.set(fe*Y,De*Y).floor()},this.setDrawingBufferSize=function(T,B,X){fe=T,De=B,Y=X,t.width=Math.floor(T*X),t.height=Math.floor(B*X),this.setViewport(0,0,T,B)},this.setEffects=function(T){if(x===qt){Le("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let B=0;B<T.length;B++)if(T[B].isOutputPass===!0){Ie("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}C.setEffects(T||[])},this.getCurrentViewport=function(T){return T.copy(ee)},this.getViewport=function(T){return T.copy(te)},this.setViewport=function(T,B,X,H){T.isVector4?te.set(T.x,T.y,T.z,T.w):te.set(T,B,X,H),de.viewport(ee.copy(te).multiplyScalar(Y).round())},this.getScissor=function(T){return T.copy(ve)},this.setScissor=function(T,B,X,H){T.isVector4?ve.set(T.x,T.y,T.z,T.w):ve.set(T,B,X,H),de.scissor(ne.copy(ve).multiplyScalar(Y).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(T){de.setScissorTest(Me=T)},this.setOpaqueSort=function(T){z=T},this.setTransparentSort=function(T){$=T},this.getClearColor=function(T){return T.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor(...arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha(...arguments)},this.clear=function(T=!0,B=!0,X=!0){let H=0;if(T){let W=!1;if(R!==null){let ge=R.texture.format;W=g.has(ge)}if(W){let ge=R.texture.type,we=f.has(ge),me=ae.getClearColor(),Ae=ae.getClearAlpha(),Re=me.r,ze=me.g,We=me.b;we?(v[0]=Re,v[1]=ze,v[2]=We,v[3]=Ae,F.clearBufferuiv(F.COLOR,0,v)):(M[0]=Re,M[1]=ze,M[2]=We,M[3]=Ae,F.clearBufferiv(F.COLOR,0,M))}else H|=F.COLOR_BUFFER_BIT}B&&(H|=F.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),X&&(H|=F.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H!==0&&F.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(T){T.setRenderer(this),N=T},this.dispose=function(){t.removeEventListener("webglcontextlost",ie,!1),t.removeEventListener("webglcontextrestored",Ce,!1),t.removeEventListener("webglcontextcreationerror",ke,!1),ae.dispose(),Q.dispose(),_e.dispose(),E.dispose(),G.dispose(),se.dispose(),oe.dispose(),Z.dispose(),ue.dispose(),ce.dispose(),ce.removeEventListener("sessionstart",Fh),ce.removeEventListener("sessionend",Bh),yi.stop()};function ie(T){T.preventDefault(),mc("WebGLRenderer: Context Lost."),P=!0}function Ce(){mc("WebGLRenderer: Context Restored."),P=!1;let T=mt.autoReset,B=le.enabled,X=le.autoUpdate,H=le.needsUpdate,W=le.type;ye(),mt.autoReset=T,le.enabled=B,le.autoUpdate=X,le.needsUpdate=H,le.type=W}function ke(T){Le("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function xt(T){let B=T.target;B.removeEventListener("dispose",xt),rt(B)}function rt(T){Fn(T),E.remove(T)}function Fn(T){let B=E.get(T).programs;B!==void 0&&(B.forEach(function(X){ue.releaseProgram(X)}),T.isShaderMaterial&&ue.releaseShaderCache(T))}this.renderBufferDirect=function(T,B,X,H,W,ge){B===null&&(B=it);let we=W.isMesh&&W.matrixWorld.determinant()<0,me=Pm(T,B,X,H,W);de.setMaterial(H,we);let Ae=X.index,Re=1;if(H.wireframe===!0){if(Ae=re.getWireframeAttribute(X),Ae===void 0)return;Re=2}let ze=X.drawRange,We=X.attributes.position,Pe=ze.start*Re,st=(ze.start+ze.count)*Re;ge!==null&&(Pe=Math.max(Pe,ge.start*Re),st=Math.min(st,(ge.start+ge.count)*Re)),Ae!==null?(Pe=Math.max(Pe,0),st=Math.min(st,Ae.count)):We!=null&&(Pe=Math.max(Pe,0),st=Math.min(st,We.count));let vt=st-Pe;if(vt<0||vt===1/0)return;oe.setup(W,H,me,X,Ae);let gt,ot=Ve;if(Ae!==null&&(gt=K.get(Ae),ot=Ke,ot.setIndex(gt)),W.isMesh)H.wireframe===!0?(de.setLineWidth(H.wireframeLinewidth*jt()),ot.setMode(F.LINES)):ot.setMode(F.TRIANGLES);else if(W.isLine){let It=H.linewidth;It===void 0&&(It=1),de.setLineWidth(It*jt()),W.isLineSegments?ot.setMode(F.LINES):W.isLineLoop?ot.setMode(F.LINE_LOOP):ot.setMode(F.LINE_STRIP)}else W.isPoints?ot.setMode(F.POINTS):W.isSprite&&ot.setMode(F.TRIANGLES);if(W.isBatchedMesh)if(Ye.get("WEBGL_multi_draw"))ot.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else{let It=W._multiDrawStarts,be=W._multiDrawCounts,Zt=W._multiDrawCount,Je=Ae?K.get(Ae).bytesPerElement:1,an=E.get(H).currentProgram.getUniforms();for(let An=0;An<Zt;An++)an.setValue(F,"_gl_DrawID",An),ot.render(It[An]/Je,be[An])}else if(W.isInstancedMesh)ot.renderInstances(Pe,vt,W.count);else if(X.isInstancedBufferGeometry){let It=X._maxInstanceCount!==void 0?X._maxInstanceCount:1/0,be=Math.min(X.instanceCount,It);ot.renderInstances(Pe,vt,be)}else ot.render(Pe,vt)};function Tn(T,B,X){T.transparent===!0&&T.side===Dn&&T.forceSinglePass===!1?(T.side=Vt,T.needsUpdate=!0,Ns(T,B,X),T.side=Wn,T.needsUpdate=!0,Ns(T,B,X),T.side=Dn):Ns(T,B,X)}this.compile=function(T,B,X=null){X===null&&(X=T),y=_e.get(X),y.init(B),_.push(y),X.traverseVisible(function(W){W.isLight&&W.layers.test(B.layers)&&(y.pushLight(W),W.castShadow&&y.pushShadow(W))}),T!==X&&T.traverseVisible(function(W){W.isLight&&W.layers.test(B.layers)&&(y.pushLight(W),W.castShadow&&y.pushShadow(W))}),y.setupLights();let H=new Set;return T.traverse(function(W){if(!(W.isMesh||W.isPoints||W.isLine||W.isSprite))return;let ge=W.material;if(ge)if(Array.isArray(ge))for(let we=0;we<ge.length;we++){let me=ge[we];Tn(me,X,W),H.add(me)}else Tn(ge,X,W),H.add(ge)}),y=_.pop(),H},this.compileAsync=function(T,B,X=null){let H=this.compile(T,B,X);return new Promise(W=>{function ge(){if(H.forEach(function(we){E.get(we).currentProgram.isReady()&&H.delete(we)}),H.size===0){W(T);return}setTimeout(ge,10)}Ye.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let hl=null;function Cm(T){hl&&hl(T)}function Fh(){yi.stop()}function Bh(){yi.start()}let yi=new Cf;yi.setAnimationLoop(Cm),typeof self<"u"&&yi.setContext(self),this.setAnimationLoop=function(T){hl=T,ce.setAnimationLoop(T),T===null?yi.stop():yi.start()},ce.addEventListener("sessionstart",Fh),ce.addEventListener("sessionend",Bh),this.render=function(T,B){if(B!==void 0&&B.isCamera!==!0){Le("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;N!==null&&N.renderStart(T,B);let X=ce.enabled===!0&&ce.isPresenting===!0,H=C!==null&&(R===null||X)&&C.begin(D,R);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),ce.enabled===!0&&ce.isPresenting===!0&&(C===null||C.isCompositing()===!1)&&(ce.cameraAutoUpdate===!0&&ce.updateCamera(B),B=ce.getCamera()),T.isScene===!0&&T.onBeforeRender(D,T,B,R),y=_e.get(T,_.length),y.init(B),y.state.textureUnits=b.getTextureUnits(),_.push(y),qe.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),xe.setFromProjectionMatrix(qe,gn,B.reversedDepth),Ue=this.localClippingEnabled,Ze=Se.init(this.clippingPlanes,Ue),w=Q.get(T,A.length),w.init(),A.push(w),ce.enabled===!0&&ce.isPresenting===!0){let we=D.xr.getDepthSensingMesh();we!==null&&ul(we,B,-1/0,D.sortObjects)}ul(T,B,0,D.sortObjects),w.finish(),D.sortObjects===!0&&w.sort(z,$),nt=ce.enabled===!1||ce.isPresenting===!1||ce.hasDepthSensing()===!1,nt&&ae.addToRenderList(w,T),this.info.render.frame++,Ze===!0&&Se.beginShadows();let W=y.state.shadowsArray;if(le.render(W,T,B),Ze===!0&&Se.endShadows(),this.info.autoReset===!0&&this.info.reset(),(H&&C.hasRenderPass())===!1){let we=w.opaque,me=w.transmissive;if(y.setupLights(),B.isArrayCamera){let Ae=B.cameras;if(me.length>0)for(let Re=0,ze=Ae.length;Re<ze;Re++){let We=Ae[Re];zh(we,me,T,We)}nt&&ae.render(T);for(let Re=0,ze=Ae.length;Re<ze;Re++){let We=Ae[Re];kh(w,T,We,We.viewport)}}else me.length>0&&zh(we,me,T,B),nt&&ae.render(T),kh(w,T,B)}R!==null&&I===0&&(b.updateMultisampleRenderTarget(R),b.updateRenderTargetMipmap(R)),H&&C.end(D),T.isScene===!0&&T.onAfterRender(D,T,B),oe.resetDefaultState(),L=-1,k=null,_.pop(),_.length>0?(y=_[_.length-1],b.setTextureUnits(y.state.textureUnits),Ze===!0&&Se.setGlobalState(D.clippingPlanes,y.state.camera)):y=null,A.pop(),A.length>0?w=A[A.length-1]:w=null,N!==null&&N.renderEnd()};function ul(T,B,X,H){if(T.visible===!1)return;if(T.layers.test(B.layers)){if(T.isGroup)X=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(B);else if(T.isLightProbeGrid)y.pushLightProbeGrid(T);else if(T.isLight)y.pushLight(T),T.castShadow&&y.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||xe.intersectsSprite(T)){H&&Oe.setFromMatrixPosition(T.matrixWorld).applyMatrix4(qe);let we=se.update(T),me=T.material;me.visible&&w.push(T,we,me,X,Oe.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||xe.intersectsObject(T))){let we=se.update(T),me=T.material;if(H&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),Oe.copy(T.boundingSphere.center)):(we.boundingSphere===null&&we.computeBoundingSphere(),Oe.copy(we.boundingSphere.center)),Oe.applyMatrix4(T.matrixWorld).applyMatrix4(qe)),Array.isArray(me)){let Ae=we.groups;for(let Re=0,ze=Ae.length;Re<ze;Re++){let We=Ae[Re],Pe=me[We.materialIndex];Pe&&Pe.visible&&w.push(T,we,Pe,X,Oe.z,We)}}else me.visible&&w.push(T,we,me,X,Oe.z,null)}}let ge=T.children;for(let we=0,me=ge.length;we<me;we++)ul(ge[we],B,X,H)}function kh(T,B,X,H){let{opaque:W,transmissive:ge,transparent:we}=T;y.setupLightsView(X),Ze===!0&&Se.setGlobalState(D.clippingPlanes,X),H&&de.viewport(ee.copy(H)),W.length>0&&Ls(W,B,X),ge.length>0&&Ls(ge,B,X),we.length>0&&Ls(we,B,X),de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function zh(T,B,X,H){if((X.isScene===!0?X.overrideMaterial:null)!==null)return;if(y.state.transmissionRenderTarget[H.id]===void 0){let Pe=Ye.has("EXT_color_buffer_half_float")||Ye.has("EXT_color_buffer_float");y.state.transmissionRenderTarget[H.id]=new tn(1,1,{generateMipmaps:!0,type:Pe?Nn:qt,minFilter:pi,samples:Math.max(4,ht.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:$e.workingColorSpace})}let ge=y.state.transmissionRenderTarget[H.id],we=H.viewport||ee;ge.setSize(we.z*D.transmissionResolutionScale,we.w*D.transmissionResolutionScale);let me=D.getRenderTarget(),Ae=D.getActiveCubeFace(),Re=D.getActiveMipmapLevel();D.setRenderTarget(ge),D.getClearColor(q),J=D.getClearAlpha(),J<1&&D.setClearColor(16777215,.5),D.clear(),nt&&ae.render(X);let ze=D.toneMapping;D.toneMapping=xn;let We=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),y.setupLightsView(H),Ze===!0&&Se.setGlobalState(D.clippingPlanes,H),Ls(T,X,H),b.updateMultisampleRenderTarget(ge),b.updateRenderTargetMipmap(ge),Ye.has("WEBGL_multisampled_render_to_texture")===!1){let Pe=!1;for(let st=0,vt=B.length;st<vt;st++){let gt=B[st],{object:ot,geometry:It,material:be,group:Zt}=gt;if(be.side===Dn&&ot.layers.test(H.layers)){let Je=be.side;be.side=Vt,be.needsUpdate=!0,Vh(ot,X,H,It,be,Zt),be.side=Je,be.needsUpdate=!0,Pe=!0}}Pe===!0&&(b.updateMultisampleRenderTarget(ge),b.updateRenderTargetMipmap(ge))}D.setRenderTarget(me,Ae,Re),D.setClearColor(q,J),We!==void 0&&(H.viewport=We),D.toneMapping=ze}function Ls(T,B,X){let H=B.isScene===!0?B.overrideMaterial:null;for(let W=0,ge=T.length;W<ge;W++){let we=T[W],{object:me,geometry:Ae,group:Re}=we,ze=we.material;ze.allowOverride===!0&&H!==null&&(ze=H),me.layers.test(X.layers)&&Vh(me,B,X,Ae,ze,Re)}}function Vh(T,B,X,H,W,ge){T.onBeforeRender(D,B,X,H,W,ge),T.modelViewMatrix.multiplyMatrices(X.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),W.onBeforeRender(D,B,X,H,T,ge),W.transparent===!0&&W.side===Dn&&W.forceSinglePass===!1?(W.side=Vt,W.needsUpdate=!0,D.renderBufferDirect(X,B,H,W,T,ge),W.side=Wn,W.needsUpdate=!0,D.renderBufferDirect(X,B,H,W,T,ge),W.side=Dn):D.renderBufferDirect(X,B,H,W,T,ge),T.onAfterRender(D,B,X,H,W,ge)}function Ns(T,B,X){B.isScene!==!0&&(B=it);let H=E.get(T),W=y.state.lights,ge=y.state.shadowsArray,we=W.state.version,me=ue.getParameters(T,W.state,ge,B,X,y.state.lightProbeGridArray),Ae=ue.getProgramCacheKey(me),Re=H.programs;H.environment=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?B.environment:null,H.fog=B.fog;let ze=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap;H.envMap=G.get(T.envMap||H.environment,ze),H.envMapRotation=H.environment!==null&&T.envMap===null?B.environmentRotation:T.envMapRotation,Re===void 0&&(T.addEventListener("dispose",xt),Re=new Map,H.programs=Re);let We=Re.get(Ae);if(We!==void 0){if(H.currentProgram===We&&H.lightsStateVersion===we)return Hh(T,me),We}else me.uniforms=ue.getUniforms(T),N!==null&&T.isNodeMaterial&&N.build(T,X,me),T.onBeforeCompile(me,D),We=ue.acquireProgram(me,Ae),Re.set(Ae,We),H.uniforms=me.uniforms;let Pe=H.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Pe.clippingPlanes=Se.uniform),Hh(T,me),H.needsLights=Dm(T),H.lightsStateVersion=we,H.needsLights&&(Pe.ambientLightColor.value=W.state.ambient,Pe.lightProbe.value=W.state.probe,Pe.directionalLights.value=W.state.directional,Pe.directionalLightShadows.value=W.state.directionalShadow,Pe.spotLights.value=W.state.spot,Pe.spotLightShadows.value=W.state.spotShadow,Pe.rectAreaLights.value=W.state.rectArea,Pe.ltc_1.value=W.state.rectAreaLTC1,Pe.ltc_2.value=W.state.rectAreaLTC2,Pe.pointLights.value=W.state.point,Pe.pointLightShadows.value=W.state.pointShadow,Pe.hemisphereLights.value=W.state.hemi,Pe.directionalShadowMatrix.value=W.state.directionalShadowMatrix,Pe.spotLightMatrix.value=W.state.spotLightMatrix,Pe.spotLightMap.value=W.state.spotLightMap,Pe.pointShadowMatrix.value=W.state.pointShadowMatrix),H.lightProbeGrid=y.state.lightProbeGridArray.length>0,H.currentProgram=We,H.uniformsList=null,We}function Gh(T){if(T.uniformsList===null){let B=T.currentProgram.getUniforms();T.uniformsList=gr.seqWithValue(B.seq,T.uniforms)}return T.uniformsList}function Hh(T,B){let X=E.get(T);X.outputColorSpace=B.outputColorSpace,X.batching=B.batching,X.batchingColor=B.batchingColor,X.instancing=B.instancing,X.instancingColor=B.instancingColor,X.instancingMorph=B.instancingMorph,X.skinning=B.skinning,X.morphTargets=B.morphTargets,X.morphNormals=B.morphNormals,X.morphColors=B.morphColors,X.morphTargetsCount=B.morphTargetsCount,X.numClippingPlanes=B.numClippingPlanes,X.numIntersection=B.numClipIntersection,X.vertexAlphas=B.vertexAlphas,X.vertexTangents=B.vertexTangents,X.toneMapping=B.toneMapping}function Rm(T,B){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;S.setFromMatrixPosition(B.matrixWorld);for(let X=0,H=T.length;X<H;X++){let W=T[X];if(W.texture!==null&&W.boundingBox.containsPoint(S))return W}return null}function Pm(T,B,X,H,W){B.isScene!==!0&&(B=it),b.resetTextureUnits();let ge=B.fog,we=H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial?B.environment:null,me=R===null?D.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:$e.workingColorSpace,Ae=H.isMeshStandardMaterial||H.isMeshLambertMaterial&&!H.envMap||H.isMeshPhongMaterial&&!H.envMap,Re=G.get(H.envMap||we,Ae),ze=H.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,We=!!X.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Pe=!!X.morphAttributes.position,st=!!X.morphAttributes.normal,vt=!!X.morphAttributes.color,gt=xn;H.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(gt=D.toneMapping);let ot=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,It=ot!==void 0?ot.length:0,be=E.get(H),Zt=y.state.lights;if(Ze===!0&&(Ue===!0||T!==k)){let ut=T===k&&H.id===L;Se.setState(H,T,ut)}let Je=!1;H.version===be.__version?(be.needsLights&&be.lightsStateVersion!==Zt.state.version||be.outputColorSpace!==me||W.isBatchedMesh&&be.batching===!1||!W.isBatchedMesh&&be.batching===!0||W.isBatchedMesh&&be.batchingColor===!0&&W.colorTexture===null||W.isBatchedMesh&&be.batchingColor===!1&&W.colorTexture!==null||W.isInstancedMesh&&be.instancing===!1||!W.isInstancedMesh&&be.instancing===!0||W.isSkinnedMesh&&be.skinning===!1||!W.isSkinnedMesh&&be.skinning===!0||W.isInstancedMesh&&be.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&be.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&be.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&be.instancingMorph===!1&&W.morphTexture!==null||be.envMap!==Re||H.fog===!0&&be.fog!==ge||be.numClippingPlanes!==void 0&&(be.numClippingPlanes!==Se.numPlanes||be.numIntersection!==Se.numIntersection)||be.vertexAlphas!==ze||be.vertexTangents!==We||be.morphTargets!==Pe||be.morphNormals!==st||be.morphColors!==vt||be.toneMapping!==gt||be.morphTargetsCount!==It||!!be.lightProbeGrid!=y.state.lightProbeGridArray.length>0)&&(Je=!0):(Je=!0,be.__version=H.version);let an=be.currentProgram;Je===!0&&(an=Ns(H,B,W),N&&H.isNodeMaterial&&N.onUpdateProgram(H,an,be));let An=!1,Zn=!1,Oi=!1,lt=an.getUniforms(),yt=be.uniforms;if(de.useProgram(an.program)&&(An=!0,Zn=!0,Oi=!0),H.id!==L&&(L=H.id,Zn=!0),be.needsLights){let ut=Rm(y.state.lightProbeGridArray,W);be.lightProbeGrid!==ut&&(be.lightProbeGrid=ut,Zn=!0)}if(An||k!==T){de.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),lt.setValue(F,"projectionMatrix",T.projectionMatrix),lt.setValue(F,"viewMatrix",T.matrixWorldInverse);let Kn=lt.map.cameraPosition;Kn!==void 0&&Kn.setValue(F,Qe.setFromMatrixPosition(T.matrixWorld)),ht.logarithmicDepthBuffer&<.setValue(F,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&<.setValue(F,"isOrthographic",T.isOrthographicCamera===!0),k!==T&&(k=T,Zn=!0,Oi=!0)}if(be.needsLights&&(Zt.state.directionalShadowMap.length>0&<.setValue(F,"directionalShadowMap",Zt.state.directionalShadowMap,b),Zt.state.spotShadowMap.length>0&<.setValue(F,"spotShadowMap",Zt.state.spotShadowMap,b),Zt.state.pointShadowMap.length>0&<.setValue(F,"pointShadowMap",Zt.state.pointShadowMap,b)),W.isSkinnedMesh){lt.setOptional(F,W,"bindMatrix"),lt.setOptional(F,W,"bindMatrixInverse");let ut=W.skeleton;ut&&(ut.boneTexture===null&&ut.computeBoneTexture(),lt.setValue(F,"boneTexture",ut.boneTexture,b))}W.isBatchedMesh&&(lt.setOptional(F,W,"batchingTexture"),lt.setValue(F,"batchingTexture",W._matricesTexture,b),lt.setOptional(F,W,"batchingIdTexture"),lt.setValue(F,"batchingIdTexture",W._indirectTexture,b),lt.setOptional(F,W,"batchingColorTexture"),W._colorsTexture!==null&<.setValue(F,"batchingColorTexture",W._colorsTexture,b));let Jn=X.morphAttributes;if((Jn.position!==void 0||Jn.normal!==void 0||Jn.color!==void 0)&&Fe.update(W,X,an),(Zn||be.receiveShadow!==W.receiveShadow)&&(be.receiveShadow=W.receiveShadow,lt.setValue(F,"receiveShadow",W.receiveShadow)),(H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial)&&H.envMap===null&&B.environment!==null&&(yt.envMapIntensity.value=B.environmentIntensity),yt.dfgLUT!==void 0&&(yt.dfgLUT.value=Dy()),Zn){if(lt.setValue(F,"toneMappingExposure",D.toneMappingExposure),be.needsLights&&Im(yt,Oi),ge&&H.fog===!0&&j.refreshFogUniforms(yt,ge),j.refreshMaterialUniforms(yt,H,Y,De,y.state.transmissionRenderTarget[T.id]),be.needsLights&&be.lightProbeGrid){let ut=be.lightProbeGrid;yt.probesSH.value=ut.texture,yt.probesMin.value.copy(ut.boundingBox.min),yt.probesMax.value.copy(ut.boundingBox.max),yt.probesResolution.value.copy(ut.resolution)}gr.upload(F,Gh(be),yt,b)}if(H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(gr.upload(F,Gh(be),yt,b),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&<.setValue(F,"center",W.center),lt.setValue(F,"modelViewMatrix",W.modelViewMatrix),lt.setValue(F,"normalMatrix",W.normalMatrix),lt.setValue(F,"modelMatrix",W.matrixWorld),H.uniformsGroups!==void 0){let ut=H.uniformsGroups;for(let Kn=0,Fi=ut.length;Kn<Fi;Kn++){let Wh=ut[Kn];Z.update(Wh,an),Z.bind(Wh,an)}}return an}function Im(T,B){T.ambientLightColor.needsUpdate=B,T.lightProbe.needsUpdate=B,T.directionalLights.needsUpdate=B,T.directionalLightShadows.needsUpdate=B,T.pointLights.needsUpdate=B,T.pointLightShadows.needsUpdate=B,T.spotLights.needsUpdate=B,T.spotLightShadows.needsUpdate=B,T.rectAreaLights.needsUpdate=B,T.hemisphereLights.needsUpdate=B}function Dm(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return V},this.getActiveMipmapLevel=function(){return I},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(T,B,X){let H=E.get(T);H.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),E.get(T.texture).__webglTexture=B,E.get(T.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:X,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,B){let X=E.get(T);X.__webglFramebuffer=B,X.__useDefaultFramebuffer=B===void 0};let Lm=F.createFramebuffer();this.setRenderTarget=function(T,B=0,X=0){R=T,V=B,I=X;let H=null,W=!1,ge=!1;if(T){let me=E.get(T);if(me.__useDefaultFramebuffer!==void 0){de.bindFramebuffer(F.FRAMEBUFFER,me.__webglFramebuffer),ee.copy(T.viewport),ne.copy(T.scissor),he=T.scissorTest,de.viewport(ee),de.scissor(ne),de.setScissorTest(he),L=-1;return}else if(me.__webglFramebuffer===void 0)b.setupRenderTarget(T);else if(me.__hasExternalTextures)b.rebindTextures(T,E.get(T.texture).__webglTexture,E.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){let ze=T.depthTexture;if(me.__boundDepthTexture!==ze){if(ze!==null&&E.has(ze)&&(T.width!==ze.image.width||T.height!==ze.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");b.setupDepthRenderbuffer(T)}}let Ae=T.texture;(Ae.isData3DTexture||Ae.isDataArrayTexture||Ae.isCompressedArrayTexture)&&(ge=!0);let Re=E.get(T).__webglFramebuffer;T.isWebGLCubeRenderTarget?(Array.isArray(Re[B])?H=Re[B][X]:H=Re[B],W=!0):T.samples>0&&b.useMultisampledRTT(T)===!1?H=E.get(T).__webglMultisampledFramebuffer:Array.isArray(Re)?H=Re[X]:H=Re,ee.copy(T.viewport),ne.copy(T.scissor),he=T.scissorTest}else ee.copy(te).multiplyScalar(Y).floor(),ne.copy(ve).multiplyScalar(Y).floor(),he=Me;if(X!==0&&(H=Lm),de.bindFramebuffer(F.FRAMEBUFFER,H)&&de.drawBuffers(T,H),de.viewport(ee),de.scissor(ne),de.setScissorTest(he),W){let me=E.get(T.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+B,me.__webglTexture,X)}else if(ge){let me=B;for(let Ae=0;Ae<T.textures.length;Ae++){let Re=E.get(T.textures[Ae]);F.framebufferTextureLayer(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0+Ae,Re.__webglTexture,X,me)}}else if(T!==null&&X!==0){let me=E.get(T.texture);F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,me.__webglTexture,X)}L=-1},this.readRenderTargetPixels=function(T,B,X,H,W,ge,we,me=0){if(!(T&&T.isWebGLRenderTarget)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ae=E.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&we!==void 0&&(Ae=Ae[we]),Ae){de.bindFramebuffer(F.FRAMEBUFFER,Ae);try{let Re=T.textures[me],ze=Re.format,We=Re.type;if(T.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+me),!ht.textureFormatReadable(ze)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ht.textureTypeReadable(We)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=T.width-H&&X>=0&&X<=T.height-W&&F.readPixels(B,X,H,W,O.convert(ze),O.convert(We),ge)}finally{let Re=R!==null?E.get(R).__webglFramebuffer:null;de.bindFramebuffer(F.FRAMEBUFFER,Re)}}},this.readRenderTargetPixelsAsync=async function(T,B,X,H,W,ge,we,me=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ae=E.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&we!==void 0&&(Ae=Ae[we]),Ae)if(B>=0&&B<=T.width-H&&X>=0&&X<=T.height-W){de.bindFramebuffer(F.FRAMEBUFFER,Ae);let Re=T.textures[me],ze=Re.format,We=Re.type;if(T.textures.length>1&&F.readBuffer(F.COLOR_ATTACHMENT0+me),!ht.textureFormatReadable(ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ht.textureTypeReadable(We))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Pe=F.createBuffer();F.bindBuffer(F.PIXEL_PACK_BUFFER,Pe),F.bufferData(F.PIXEL_PACK_BUFFER,ge.byteLength,F.STREAM_READ),F.readPixels(B,X,H,W,O.convert(ze),O.convert(We),0);let st=R!==null?E.get(R).__webglFramebuffer:null;de.bindFramebuffer(F.FRAMEBUFFER,st);let vt=F.fenceSync(F.SYNC_GPU_COMMANDS_COMPLETE,0);return F.flush(),await ef(F,vt,4),F.bindBuffer(F.PIXEL_PACK_BUFFER,Pe),F.getBufferSubData(F.PIXEL_PACK_BUFFER,0,ge),F.deleteBuffer(Pe),F.deleteSync(vt),ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,B=null,X=0){let H=Math.pow(2,-X),W=Math.floor(T.image.width*H),ge=Math.floor(T.image.height*H),we=B!==null?B.x:0,me=B!==null?B.y:0;b.setTexture2D(T,0),F.copyTexSubImage2D(F.TEXTURE_2D,X,0,0,we,me,W,ge),de.unbindTexture()};let Nm=F.createFramebuffer(),Um=F.createFramebuffer();this.copyTextureToTexture=function(T,B,X=null,H=null,W=0,ge=0){let we,me,Ae,Re,ze,We,Pe,st,vt,gt=T.isCompressedTexture?T.mipmaps[ge]:T.image;if(X!==null)we=X.max.x-X.min.x,me=X.max.y-X.min.y,Ae=X.isBox3?X.max.z-X.min.z:1,Re=X.min.x,ze=X.min.y,We=X.isBox3?X.min.z:0;else{let yt=Math.pow(2,-W);we=Math.floor(gt.width*yt),me=Math.floor(gt.height*yt),T.isDataArrayTexture?Ae=gt.depth:T.isData3DTexture?Ae=Math.floor(gt.depth*yt):Ae=1,Re=0,ze=0,We=0}H!==null?(Pe=H.x,st=H.y,vt=H.z):(Pe=0,st=0,vt=0);let ot=O.convert(B.format),It=O.convert(B.type),be;B.isData3DTexture?(b.setTexture3D(B,0),be=F.TEXTURE_3D):B.isDataArrayTexture||B.isCompressedArrayTexture?(b.setTexture2DArray(B,0),be=F.TEXTURE_2D_ARRAY):(b.setTexture2D(B,0),be=F.TEXTURE_2D),de.activeTexture(F.TEXTURE0),de.pixelStorei(F.UNPACK_FLIP_Y_WEBGL,B.flipY),de.pixelStorei(F.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),de.pixelStorei(F.UNPACK_ALIGNMENT,B.unpackAlignment);let Zt=de.getParameter(F.UNPACK_ROW_LENGTH),Je=de.getParameter(F.UNPACK_IMAGE_HEIGHT),an=de.getParameter(F.UNPACK_SKIP_PIXELS),An=de.getParameter(F.UNPACK_SKIP_ROWS),Zn=de.getParameter(F.UNPACK_SKIP_IMAGES);de.pixelStorei(F.UNPACK_ROW_LENGTH,gt.width),de.pixelStorei(F.UNPACK_IMAGE_HEIGHT,gt.height),de.pixelStorei(F.UNPACK_SKIP_PIXELS,Re),de.pixelStorei(F.UNPACK_SKIP_ROWS,ze),de.pixelStorei(F.UNPACK_SKIP_IMAGES,We);let Oi=T.isDataArrayTexture||T.isData3DTexture,lt=B.isDataArrayTexture||B.isData3DTexture;if(T.isDepthTexture){let yt=E.get(T),Jn=E.get(B),ut=E.get(yt.__renderTarget),Kn=E.get(Jn.__renderTarget);de.bindFramebuffer(F.READ_FRAMEBUFFER,ut.__webglFramebuffer),de.bindFramebuffer(F.DRAW_FRAMEBUFFER,Kn.__webglFramebuffer);for(let Fi=0;Fi<Ae;Fi++)Oi&&(F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,E.get(T).__webglTexture,W,We+Fi),F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,E.get(B).__webglTexture,ge,vt+Fi)),F.blitFramebuffer(Re,ze,we,me,Pe,st,we,me,F.DEPTH_BUFFER_BIT,F.NEAREST);de.bindFramebuffer(F.READ_FRAMEBUFFER,null),de.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else if(W!==0||T.isRenderTargetTexture||E.has(T)){let yt=E.get(T),Jn=E.get(B);de.bindFramebuffer(F.READ_FRAMEBUFFER,Nm),de.bindFramebuffer(F.DRAW_FRAMEBUFFER,Um);for(let ut=0;ut<Ae;ut++)Oi?F.framebufferTextureLayer(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,yt.__webglTexture,W,We+ut):F.framebufferTexture2D(F.READ_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,yt.__webglTexture,W),lt?F.framebufferTextureLayer(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,Jn.__webglTexture,ge,vt+ut):F.framebufferTexture2D(F.DRAW_FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_2D,Jn.__webglTexture,ge),W!==0?F.blitFramebuffer(Re,ze,we,me,Pe,st,we,me,F.COLOR_BUFFER_BIT,F.NEAREST):lt?F.copyTexSubImage3D(be,ge,Pe,st,vt+ut,Re,ze,we,me):F.copyTexSubImage2D(be,ge,Pe,st,Re,ze,we,me);de.bindFramebuffer(F.READ_FRAMEBUFFER,null),de.bindFramebuffer(F.DRAW_FRAMEBUFFER,null)}else lt?T.isDataTexture||T.isData3DTexture?F.texSubImage3D(be,ge,Pe,st,vt,we,me,Ae,ot,It,gt.data):B.isCompressedArrayTexture?F.compressedTexSubImage3D(be,ge,Pe,st,vt,we,me,Ae,ot,gt.data):F.texSubImage3D(be,ge,Pe,st,vt,we,me,Ae,ot,It,gt):T.isDataTexture?F.texSubImage2D(F.TEXTURE_2D,ge,Pe,st,we,me,ot,It,gt.data):T.isCompressedTexture?F.compressedTexSubImage2D(F.TEXTURE_2D,ge,Pe,st,gt.width,gt.height,ot,gt.data):F.texSubImage2D(F.TEXTURE_2D,ge,Pe,st,we,me,ot,It,gt);de.pixelStorei(F.UNPACK_ROW_LENGTH,Zt),de.pixelStorei(F.UNPACK_IMAGE_HEIGHT,Je),de.pixelStorei(F.UNPACK_SKIP_PIXELS,an),de.pixelStorei(F.UNPACK_SKIP_ROWS,An),de.pixelStorei(F.UNPACK_SKIP_IMAGES,Zn),ge===0&&B.generateMipmaps&&F.generateMipmap(be),de.unbindTexture()},this.initRenderTarget=function(T){E.get(T).__webglFramebuffer===void 0&&b.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?b.setTextureCube(T,0):T.isData3DTexture?b.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?b.setTexture2DArray(T,0):b.setTexture2D(T,0),de.unbindTexture()},this.resetState=function(){V=0,I=0,R=null,de.reset(),oe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return gn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=$e._getDrawingBufferColorSpace(e),t.unpackColorSpace=$e._getUnpackColorSpace()}};function Hc(n,e,t){var i,r=1;n==null&&(n=0),e==null&&(e=0),t==null&&(t=0);function s(){var a,o=i.length,l,c=0,h=0,d=0;for(a=0;a<o;++a)l=i[a],c+=l.x||0,h+=l.y||0,d+=l.z||0;for(c=(c/o-n)*r,h=(h/o-e)*r,d=(d/o-t)*r,a=0;a<o;++a)l=i[a],c&&(l.x-=c),h&&(l.y-=h),d&&(l.z-=d)}return s.initialize=function(a){i=a},s.x=function(a){return arguments.length?(n=+a,s):n},s.y=function(a){return arguments.length?(e=+a,s):e},s.z=function(a){return arguments.length?(t=+a,s):t},s.strength=function(a){return arguments.length?(r=+a,s):r},s}function Uf(n){let e=+this._x.call(null,n);return Of(this.cover(e),e,n)}function Of(n,e,t){if(isNaN(e))return n;var i,r=n._root,s={data:t},a=n._x0,o=n._x1,l,c,h,d,u;if(!r)return n._root=s,n;for(;r.length;)if((h=e>=(l=(a+o)/2))?a=l:o=l,i=r,!(r=r[d=+h]))return i[d]=s,n;if(c=+n._x.call(null,r.data),e===c)return s.next=r,i?i[d]=s:n._root=s,n;do i=i?i[d]=new Array(2):n._root=new Array(2),(h=e>=(l=(a+o)/2))?a=l:o=l;while((d=+h)==(u=+(c>=l)));return i[u]=r,i[d]=s,n}function Ff(n){Array.isArray(n)||(n=Array.from(n));let e=n.length,t=new Float64Array(e),i=1/0,r=-1/0;for(let s=0,a;s<e;++s)isNaN(a=+this._x.call(null,n[s]))||(t[s]=a,a<i&&(i=a),a>r&&(r=a));if(i>r)return this;this.cover(i).cover(r);for(let s=0;s<e;++s)Of(this,t[s],n[s]);return this}function Bf(n){if(isNaN(n=+n))return this;var e=this._x0,t=this._x1;if(isNaN(e))t=(e=Math.floor(n))+1;else{for(var i=t-e||1,r=this._root,s,a;e>n||n>=t;)switch(a=+(n<e),s=new Array(2),s[a]=r,r=s,i*=2,a){case 0:t=e+i;break;case 1:e=t-i;break}this._root&&this._root.length&&(this._root=r)}return this._x0=e,this._x1=t,this}function kf(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function zf(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function un(n,e,t){this.node=n,this.x0=e,this.x1=t}function Vf(n,e){var t,i=this._x0,r,s,a=this._x1,o=[],l=this._root,c,h;for(l&&o.push(new un(l,i,a)),e==null?e=1/0:(i=n-e,a=n+e);c=o.pop();)if(!(!(l=c.node)||(r=c.x0)>a||(s=c.x1)<i))if(l.length){var d=(r+s)/2;o.push(new un(l[1],d,s),new un(l[0],r,d)),(h=+(n>=d))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-h],o[o.length-1-h]=c)}else{var u=Math.abs(n-+this._x.call(null,l.data));u<e&&(e=u,i=n-u,a=n+u,t=l.data)}return t}function Gf(n){if(isNaN(l=+this._x.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._x1,l,c,h,d,u;if(!t)return this;if(t.length)for(;;){if((h=l>=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[d=+h]))return this;if(!t.length)break;e[d+1&1]&&(i=e,u=d)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[d]=s:delete e[d],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(i?i[u]=t:this._root=t),this):(this._root=s,this)}function Hf(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Wf(){return this._root}function Xf(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function qf(n){var e=[],t,i=this._root,r,s,a;for(i&&e.push(new un(i,this._x0,this._x1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.x1)&&i.length){var o=(s+a)/2;(r=i[1])&&e.push(new un(r,o,a)),(r=i[0])&&e.push(new un(r,s,o))}return this}function Yf(n){var e=[],t=[],i;for(this._root&&e.push(new un(this._root,this._x0,this._x1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.x1,l=(a+o)/2;(s=r[0])&&e.push(new un(s,a,l)),(s=r[1])&&e.push(new un(s,l,o))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.x1);return this}function $f(n){return n[0]}function jf(n){return arguments.length?(this._x=n,this):this._x}function _s(n,e){var t=new Wc(e??$f,NaN,NaN);return n==null?t:t.addAll(n)}function Wc(n,e,t){this._x=n,this._x0=e,this._x1=t,this._root=void 0}function Zf(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Yt=_s.prototype=Wc.prototype;Yt.copy=function(){var n=new Wc(this._x,this._x0,this._x1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=Zf(e),n;for(t=[{source:e,target:n._root=new Array(2)}];e=t.pop();)for(var r=0;r<2;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(2)}):e.target[r]=Zf(i));return n};Yt.add=Uf;Yt.addAll=Ff;Yt.cover=Bf;Yt.data=kf;Yt.extent=zf;Yt.find=Vf;Yt.remove=Gf;Yt.removeAll=Hf;Yt.root=Wf;Yt.size=Xf;Yt.visit=qf;Yt.visitAfter=Yf;Yt.x=jf;function Jf(n){let e=+this._x.call(null,n),t=+this._y.call(null,n);return Kf(this.cover(e,t),e,t,n)}function Kf(n,e,t,i){if(isNaN(e)||isNaN(t))return n;var r,s=n._root,a={data:i},o=n._x0,l=n._y0,c=n._x1,h=n._y1,d,u,p,m,x,g,f,v;if(!s)return n._root=a,n;for(;s.length;)if((x=e>=(d=(o+c)/2))?o=d:c=d,(g=t>=(u=(l+h)/2))?l=u:h=u,r=s,!(s=s[f=g<<1|x]))return r[f]=a,n;if(p=+n._x.call(null,s.data),m=+n._y.call(null,s.data),e===p&&t===m)return a.next=s,r?r[f]=a:n._root=a,n;do r=r?r[f]=new Array(4):n._root=new Array(4),(x=e>=(d=(o+c)/2))?o=d:c=d,(g=t>=(u=(l+h)/2))?l=u:h=u;while((f=g<<1|x)===(v=(m>=u)<<1|p>=d));return r[v]=s,r[f]=a,n}function Qf(n){var e,t,i=n.length,r,s,a=new Array(i),o=new Array(i),l=1/0,c=1/0,h=-1/0,d=-1/0;for(t=0;t<i;++t)isNaN(r=+this._x.call(null,e=n[t]))||isNaN(s=+this._y.call(null,e))||(a[t]=r,o[t]=s,r<l&&(l=r),r>h&&(h=r),s<c&&(c=s),s>d&&(d=s));if(l>h||c>d)return this;for(this.cover(l,c).cover(h,d),t=0;t<i;++t)Kf(this,a[t],o[t],n[t]);return this}function ed(n,e){if(isNaN(n=+n)||isNaN(e=+e))return this;var t=this._x0,i=this._y0,r=this._x1,s=this._y1;if(isNaN(t))r=(t=Math.floor(n))+1,s=(i=Math.floor(e))+1;else{for(var a=r-t||1,o=this._root,l,c;t>n||n>=r||i>e||e>=s;)switch(c=(e<i)<<1|n<t,l=new Array(4),l[c]=o,o=l,a*=2,c){case 0:r=t+a,s=i+a;break;case 1:t=r-a,s=i+a;break;case 2:r=t+a,i=s-a;break;case 3:t=r-a,i=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._y0=i,this._x1=r,this._y1=s,this}function td(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function nd(n){return arguments.length?this.cover(+n[0][0],+n[0][1]).cover(+n[1][0],+n[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ct(n,e,t,i,r){this.node=n,this.x0=e,this.y0=t,this.x1=i,this.y1=r}function id(n,e,t){var i,r=this._x0,s=this._y0,a,o,l,c,h=this._x1,d=this._y1,u=[],p=this._root,m,x;for(p&&u.push(new Ct(p,r,s,h,d)),t==null?t=1/0:(r=n-t,s=e-t,h=n+t,d=e+t,t*=t);m=u.pop();)if(!(!(p=m.node)||(a=m.x0)>h||(o=m.y0)>d||(l=m.x1)<r||(c=m.y1)<s))if(p.length){var g=(a+l)/2,f=(o+c)/2;u.push(new Ct(p[3],g,f,l,c),new Ct(p[2],a,f,g,c),new Ct(p[1],g,o,l,f),new Ct(p[0],a,o,g,f)),(x=(e>=f)<<1|n>=g)&&(m=u[u.length-1],u[u.length-1]=u[u.length-1-x],u[u.length-1-x]=m)}else{var v=n-+this._x.call(null,p.data),M=e-+this._y.call(null,p.data),S=v*v+M*M;if(S<t){var w=Math.sqrt(t=S);r=n-w,s=e-w,h=n+w,d=e+w,i=p.data}}return i}function rd(n){if(isNaN(h=+this._x.call(null,n))||isNaN(d=+this._y.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._y0,l=this._x1,c=this._y1,h,d,u,p,m,x,g,f;if(!t)return this;if(t.length)for(;;){if((m=h>=(u=(a+l)/2))?a=u:l=u,(x=d>=(p=(o+c)/2))?o=p:c=p,e=t,!(t=t[g=x<<1|m]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(i=e,f=g)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[g]=s:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[f]=t:this._root=t),this):(this._root=s,this)}function sd(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function ad(){return this._root}function od(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function ld(n){var e=[],t,i=this._root,r,s,a,o,l;for(i&&e.push(new Ct(i,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.y0,o=t.x1,l=t.y1)&&i.length){var c=(s+o)/2,h=(a+l)/2;(r=i[3])&&e.push(new Ct(r,c,h,o,l)),(r=i[2])&&e.push(new Ct(r,s,h,c,l)),(r=i[1])&&e.push(new Ct(r,c,a,o,h)),(r=i[0])&&e.push(new Ct(r,s,a,c,h))}return this}function cd(n){var e=[],t=[],i;for(this._root&&e.push(new Ct(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.y0,l=i.x1,c=i.y1,h=(a+l)/2,d=(o+c)/2;(s=r[0])&&e.push(new Ct(s,a,o,h,d)),(s=r[1])&&e.push(new Ct(s,h,o,l,d)),(s=r[2])&&e.push(new Ct(s,a,d,h,c)),(s=r[3])&&e.push(new Ct(s,h,d,l,c))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.y0,i.x1,i.y1);return this}function hd(n){return n[0]}function ud(n){return arguments.length?(this._x=n,this):this._x}function fd(n){return n[1]}function dd(n){return arguments.length?(this._y=n,this):this._y}function xs(n,e,t){var i=new Xc(e??hd,t??fd,NaN,NaN,NaN,NaN);return n==null?i:i.addAll(n)}function Xc(n,e,t,i,r,s){this._x=n,this._y=e,this._x0=t,this._y0=i,this._x1=r,this._y1=s,this._root=void 0}function pd(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Gt=xs.prototype=Xc.prototype;Gt.copy=function(){var n=new Xc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=pd(e),n;for(t=[{source:e,target:n._root=new Array(4)}];e=t.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=pd(i));return n};Gt.add=Jf;Gt.addAll=Qf;Gt.cover=ed;Gt.data=td;Gt.extent=nd;Gt.find=id;Gt.remove=rd;Gt.removeAll=sd;Gt.root=ad;Gt.size=od;Gt.visit=ld;Gt.visitAfter=cd;Gt.x=ud;Gt.y=dd;function md(n){let e=+this._x.call(null,n),t=+this._y.call(null,n),i=+this._z.call(null,n);return gd(this.cover(e,t,i),e,t,i,n)}function gd(n,e,t,i,r){if(isNaN(e)||isNaN(t)||isNaN(i))return n;var s,a=n._root,o={data:r},l=n._x0,c=n._y0,h=n._z0,d=n._x1,u=n._y1,p=n._z1,m,x,g,f,v,M,S,w,y,A,_;if(!a)return n._root=o,n;for(;a.length;)if((S=e>=(m=(l+d)/2))?l=m:d=m,(w=t>=(x=(c+u)/2))?c=x:u=x,(y=i>=(g=(h+p)/2))?h=g:p=g,s=a,!(a=a[A=y<<2|w<<1|S]))return s[A]=o,n;if(f=+n._x.call(null,a.data),v=+n._y.call(null,a.data),M=+n._z.call(null,a.data),e===f&&t===v&&i===M)return o.next=a,s?s[A]=o:n._root=o,n;do s=s?s[A]=new Array(8):n._root=new Array(8),(S=e>=(m=(l+d)/2))?l=m:d=m,(w=t>=(x=(c+u)/2))?c=x:u=x,(y=i>=(g=(h+p)/2))?h=g:p=g;while((A=y<<2|w<<1|S)===(_=(M>=g)<<2|(v>=x)<<1|f>=m));return s[_]=a,s[A]=o,n}function _d(n){Array.isArray(n)||(n=Array.from(n));let e=n.length,t=new Float64Array(e),i=new Float64Array(e),r=new Float64Array(e),s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=0,u,p,m,x;d<e;++d)isNaN(p=+this._x.call(null,u=n[d]))||isNaN(m=+this._y.call(null,u))||isNaN(x=+this._z.call(null,u))||(t[d]=p,i[d]=m,r[d]=x,p<s&&(s=p),p>l&&(l=p),m<a&&(a=m),m>c&&(c=m),x<o&&(o=x),x>h&&(h=x));if(s>l||a>c||o>h)return this;this.cover(s,a,o).cover(l,c,h);for(let d=0;d<e;++d)gd(this,t[d],i[d],r[d],n[d]);return this}function xd(n,e,t){if(isNaN(n=+n)||isNaN(e=+e)||isNaN(t=+t))return this;var i=this._x0,r=this._y0,s=this._z0,a=this._x1,o=this._y1,l=this._z1;if(isNaN(i))a=(i=Math.floor(n))+1,o=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=a-i||1,h=this._root,d,u;i>n||n>=a||r>e||e>=o||s>t||t>=l;)switch(u=(t<s)<<2|(e<r)<<1|n<i,d=new Array(8),d[u]=h,h=d,c*=2,u){case 0:a=i+c,o=r+c,l=s+c;break;case 1:i=a-c,o=r+c,l=s+c;break;case 2:a=i+c,r=o-c,l=s+c;break;case 3:i=a-c,r=o-c,l=s+c;break;case 4:a=i+c,o=r+c,s=l-c;break;case 5:i=a-c,o=r+c,s=l-c;break;case 6:a=i+c,r=o-c,s=l-c;break;case 7:i=a-c,r=o-c,s=l-c;break}this._root&&this._root.length&&(this._root=h)}return this._x0=i,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this}function vd(){var n=[];return this.visit(function(e){if(!e.length)do n.push(e.data);while(e=e.next)}),n}function yd(n){return arguments.length?this.cover(+n[0][0],+n[0][1],+n[0][2]).cover(+n[1][0],+n[1][1],+n[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function tt(n,e,t,i,r,s,a){this.node=n,this.x0=e,this.y0=t,this.z0=i,this.x1=r,this.y1=s,this.z1=a}function bd(n,e,t,i){var r,s=this._x0,a=this._y0,o=this._z0,l,c,h,d,u,p,m=this._x1,x=this._y1,g=this._z1,f=[],v=this._root,M,S;for(v&&f.push(new tt(v,s,a,o,m,x,g)),i==null?i=1/0:(s=n-i,a=e-i,o=t-i,m=n+i,x=e+i,g=t+i,i*=i);M=f.pop();)if(!(!(v=M.node)||(l=M.x0)>m||(c=M.y0)>x||(h=M.z0)>g||(d=M.x1)<s||(u=M.y1)<a||(p=M.z1)<o))if(v.length){var w=(l+d)/2,y=(c+u)/2,A=(h+p)/2;f.push(new tt(v[7],w,y,A,d,u,p),new tt(v[6],l,y,A,w,u,p),new tt(v[5],w,c,A,d,y,p),new tt(v[4],l,c,A,w,y,p),new tt(v[3],w,y,h,d,u,A),new tt(v[2],l,y,h,w,u,A),new tt(v[1],w,c,h,d,y,A),new tt(v[0],l,c,h,w,y,A)),(S=(t>=A)<<2|(e>=y)<<1|n>=w)&&(M=f[f.length-1],f[f.length-1]=f[f.length-1-S],f[f.length-1-S]=M)}else{var _=n-+this._x.call(null,v.data),C=e-+this._y.call(null,v.data),D=t-+this._z.call(null,v.data),P=_*_+C*C+D*D;if(P<i){var N=Math.sqrt(i=P);s=n-N,a=e-N,o=t-N,m=n+N,x=e+N,g=t+N,r=v.data}}return r}var Ny=(n,e,t,i,r,s)=>Math.sqrt((n-i)**2+(e-r)**2+(t-s)**2);function Md(n,e,t,i){let r=[],s=n-i,a=e-i,o=t-i,l=n+i,c=e+i,h=t+i;return this.visit((d,u,p,m,x,g,f)=>{if(!d.length)do{let v=d.data;Ny(n,e,t,this._x(v),this._y(v),this._z(v))<=i&&r.push(v)}while(d=d.next);return u>l||p>c||m>h||x<s||g<a||f<o}),r}function Sd(n){if(isNaN(u=+this._x.call(null,n))||isNaN(p=+this._y.call(null,n))||isNaN(m=+this._z.call(null,n)))return this;var e,t=this._root,i,r,s,a=this._x0,o=this._y0,l=this._z0,c=this._x1,h=this._y1,d=this._z1,u,p,m,x,g,f,v,M,S,w,y;if(!t)return this;if(t.length)for(;;){if((v=u>=(x=(a+c)/2))?a=x:c=x,(M=p>=(g=(o+h)/2))?o=g:h=g,(S=m>=(f=(l+d)/2))?l=f:d=f,e=t,!(t=t[w=S<<2|M<<1|v]))return this;if(!t.length)break;(e[w+1&7]||e[w+2&7]||e[w+3&7]||e[w+4&7]||e[w+5&7]||e[w+6&7]||e[w+7&7])&&(i=e,y=w)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[w]=s:delete e[w],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[y]=t:this._root=t),this):(this._root=s,this)}function wd(n){for(var e=0,t=n.length;e<t;++e)this.remove(n[e]);return this}function Td(){return this._root}function Ad(){var n=0;return this.visit(function(e){if(!e.length)do++n;while(e=e.next)}),n}function Ed(n){var e=[],t,i=this._root,r,s,a,o,l,c,h;for(i&&e.push(new tt(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!n(i=t.node,s=t.x0,a=t.y0,o=t.z0,l=t.x1,c=t.y1,h=t.z1)&&i.length){var d=(s+l)/2,u=(a+c)/2,p=(o+h)/2;(r=i[7])&&e.push(new tt(r,d,u,p,l,c,h)),(r=i[6])&&e.push(new tt(r,s,u,p,d,c,h)),(r=i[5])&&e.push(new tt(r,d,a,p,l,u,h)),(r=i[4])&&e.push(new tt(r,s,a,p,d,u,h)),(r=i[3])&&e.push(new tt(r,d,u,o,l,c,p)),(r=i[2])&&e.push(new tt(r,s,u,o,d,c,p)),(r=i[1])&&e.push(new tt(r,d,a,o,l,u,p)),(r=i[0])&&e.push(new tt(r,s,a,o,d,u,p))}return this}function Cd(n){var e=[],t=[],i;for(this._root&&e.push(new tt(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.y0,l=i.z0,c=i.x1,h=i.y1,d=i.z1,u=(a+c)/2,p=(o+h)/2,m=(l+d)/2;(s=r[0])&&e.push(new tt(s,a,o,l,u,p,m)),(s=r[1])&&e.push(new tt(s,u,o,l,c,p,m)),(s=r[2])&&e.push(new tt(s,a,p,l,u,h,m)),(s=r[3])&&e.push(new tt(s,u,p,l,c,h,m)),(s=r[4])&&e.push(new tt(s,a,o,m,u,p,d)),(s=r[5])&&e.push(new tt(s,u,o,m,c,p,d)),(s=r[6])&&e.push(new tt(s,a,p,m,u,h,d)),(s=r[7])&&e.push(new tt(s,u,p,m,c,h,d))}t.push(i)}for(;i=t.pop();)n(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function Rd(n){return n[0]}function Pd(n){return arguments.length?(this._x=n,this):this._x}function Id(n){return n[1]}function Dd(n){return arguments.length?(this._y=n,this):this._y}function Ld(n){return n[2]}function Nd(n){return arguments.length?(this._z=n,this):this._z}function vs(n,e,t,i){var r=new qc(e??Rd,t??Id,i??Ld,NaN,NaN,NaN,NaN,NaN,NaN);return n==null?r:r.addAll(n)}function qc(n,e,t,i,r,s,a,o,l){this._x=n,this._y=e,this._z=t,this._x0=i,this._y0=r,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function Ud(n){for(var e={data:n.data},t=e;n=n.next;)t=t.next={data:n.data};return e}var Pt=vs.prototype=qc.prototype;Pt.copy=function(){var n=new qc(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,i;if(!e)return n;if(!e.length)return n._root=Ud(e),n;for(t=[{source:e,target:n._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(i=e.source[r])&&(i.length?t.push({source:i,target:e.target[r]=new Array(8)}):e.target[r]=Ud(i));return n};Pt.add=md;Pt.addAll=_d;Pt.cover=xd;Pt.data=vd;Pt.extent=yd;Pt.find=bd;Pt.findAllWithinRadius=Md;Pt.remove=Sd;Pt.removeAll=wd;Pt.root=Td;Pt.size=Ad;Pt.visit=Ed;Pt.visitAfter=Cd;Pt.x=Pd;Pt.y=Dd;Pt.z=Nd;function fn(n){return function(){return n}}function bn(n){return(n()-.5)*1e-6}function Uy(n){return n.index}function Od(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function Yc(n){var e=Uy,t=u,i,r=fn(30),s,a,o,l,c,h,d=1;n==null&&(n=[]);function u(f){return 1/Math.min(l[f.source.index],l[f.target.index])}function p(f){for(var v=0,M=n.length;v<d;++v)for(var S=0,w,y,A,_=0,C=0,D=0,P,N;S<M;++S)w=n[S],y=w.source,A=w.target,_=A.x+A.vx-y.x-y.vx||bn(h),o>1&&(C=A.y+A.vy-y.y-y.vy||bn(h)),o>2&&(D=A.z+A.vz-y.z-y.vz||bn(h)),P=Math.sqrt(_*_+C*C+D*D),P=(P-s[S])/P*f*i[S],_*=P,C*=P,D*=P,A.vx-=_*(N=c[S]),o>1&&(A.vy-=C*N),o>2&&(A.vz-=D*N),y.vx+=_*(N=1-N),o>1&&(y.vy+=C*N),o>2&&(y.vz+=D*N)}function m(){if(a){var f,v=a.length,M=n.length,S=new Map(a.map((y,A)=>[e(y,A,a),y])),w;for(f=0,l=new Array(v);f<M;++f)w=n[f],w.index=f,typeof w.source!="object"&&(w.source=Od(S,w.source)),typeof w.target!="object"&&(w.target=Od(S,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(f=0,c=new Array(M);f<M;++f)w=n[f],c[f]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);i=new Array(M),x(),s=new Array(M),g()}}function x(){if(a)for(var f=0,v=n.length;f<v;++f)i[f]=+t(n[f],f,n)}function g(){if(a)for(var f=0,v=n.length;f<v;++f)s[f]=+r(n[f],f,n)}return p.initialize=function(f,...v){a=f,h=v.find(M=>typeof M=="function")||Math.random,o=v.find(M=>[1,2,3].includes(M))||2,m()},p.links=function(f){return arguments.length?(n=f,m(),p):n},p.id=function(f){return arguments.length?(e=f,p):e},p.iterations=function(f){return arguments.length?(d=+f,p):d},p.strength=function(f){return arguments.length?(t=typeof f=="function"?f:fn(+f),x(),p):t},p.distance=function(f){return arguments.length?(r=typeof f=="function"?f:fn(+f),g(),p):r},p}var Oy={value:()=>{}};function Bd(){for(var n=0,e=arguments.length,t={},i;n<e;++n){if(!(i=arguments[n]+"")||i in t||/[\s.]/.test(i))throw new Error("illegal type: "+i);t[i]=[]}return new Wo(t)}function Wo(n){this._=n}function Fy(n,e){return n.trim().split(/^|\s+/).map(function(t){var i="",r=t.indexOf(".");if(r>=0&&(i=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}})}Wo.prototype=Bd.prototype={constructor:Wo,on:function(n,e){var t=this._,i=Fy(n+"",t),r,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((r=(n=i[s]).type)&&(r=By(t[r],n.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(n=i[s]).type)t[r]=Fd(t[r],n.name,e);else if(e==null)for(r in t)t[r]=Fd(t[r],n.name,null);return this},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new Wo(n)},call:function(n,e){if((r=arguments.length-2)>0)for(var t=new Array(r),i=0,r,s;i<r;++i)t[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(s=this._[n],i=0,r=s.length;i<r;++i)s[i].value.apply(e,t)},apply:function(n,e,t){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var i=this._[n],r=0,s=i.length;r<s;++r)i[r].value.apply(e,t)}};function By(n,e){for(var t=0,i=n.length,r;t<i;++t)if((r=n[t]).name===e)return r.value}function Fd(n,e,t){for(var i=0,r=n.length;i<r;++i)if(n[i].name===e){n[i]=Oy,n=n.slice(0,i).concat(n.slice(i+1));break}return t!=null&&n.push({name:e,value:t}),n}var $c=Bd;var xr=0,bs=0,ys=0,zd=1e3,Xo,Ms,qo=0,Li=0,Yo=0,Ss=typeof performance=="object"&&performance.now?performance:Date,Vd=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Jc(){return Li||(Vd(ky),Li=Ss.now()+Yo)}function ky(){Li=0}function jc(){this._call=this._time=this._next=null}jc.prototype=$o.prototype={constructor:jc,restart:function(n,e,t){if(typeof n!="function")throw new TypeError("callback is not a function");t=(t==null?Jc():+t)+(e==null?0:+e),!this._next&&Ms!==this&&(Ms?Ms._next=this:Xo=this,Ms=this),this._call=n,this._time=t,Zc()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zc())}};function $o(n,e,t){var i=new jc;return i.restart(n,e,t),i}function Gd(){Jc(),++xr;for(var n=Xo,e;n;)(e=Li-n._time)>=0&&n._call.call(void 0,e),n=n._next;--xr}function kd(){Li=(qo=Ss.now())+Yo,xr=bs=0;try{Gd()}finally{xr=0,Vy(),Li=0}}function zy(){var n=Ss.now(),e=n-qo;e>zd&&(Yo-=e,qo=n)}function Vy(){for(var n,e=Xo,t,i=1/0;e;)e._call?(i>e._time&&(i=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:Xo=t);Ms=n,Zc(i)}function Zc(n){if(!xr){bs&&(bs=clearTimeout(bs));var e=n-Li;e>24?(n<1/0&&(bs=setTimeout(kd,n-Ss.now()-Yo)),ys&&(ys=clearInterval(ys))):(ys||(qo=Ss.now(),ys=setInterval(zy,zd)),xr=1,Vd(kd))}}function Hd(){let n=1;return()=>(n=(1664525*n+1013904223)%4294967296)/4294967296}var Wd=3;function jo(n){return n.x}function Kc(n){return n.y}function Xd(n){return n.z}var Gy=10,Hy=Math.PI*(3-Math.sqrt(5)),Wy=Math.PI*20/(9+Math.sqrt(221));function Qc(n,e){e=e||2;var t=Math.min(Wd,Math.max(1,Math.round(e))),i,r=1,s=.001,a=1-Math.pow(s,1/300),o=0,l=.6,c=new Map,h=$o(p),d=$c("tick","end"),u=Hd();n==null&&(n=[]);function p(){m(),d.call("tick",i),r<s&&(h.stop(),d.call("end",i))}function m(f){var v,M=n.length,S;f===void 0&&(f=1);for(var w=0;w<f;++w)for(r+=(o-r)*a,c.forEach(function(y){y(r)}),v=0;v<M;++v)S=n[v],S.fx==null?S.x+=S.vx*=l:(S.x=S.fx,S.vx=0),t>1&&(S.fy==null?S.y+=S.vy*=l:(S.y=S.fy,S.vy=0)),t>2&&(S.fz==null?S.z+=S.vz*=l:(S.z=S.fz,S.vz=0));return i}function x(){for(var f=0,v=n.length,M;f<v;++f){if(M=n[f],M.index=f,M.fx!=null&&(M.x=M.fx),M.fy!=null&&(M.y=M.fy),M.fz!=null&&(M.z=M.fz),isNaN(M.x)||t>1&&isNaN(M.y)||t>2&&isNaN(M.z)){var S=Gy*(t>2?Math.cbrt(.5+f):t>1?Math.sqrt(.5+f):f),w=f*Hy,y=f*Wy;t===1?M.x=S:t===2?(M.x=S*Math.cos(w),M.y=S*Math.sin(w)):(M.x=S*Math.sin(w)*Math.cos(y),M.y=S*Math.cos(w),M.z=S*Math.sin(w)*Math.sin(y))}(isNaN(M.vx)||t>1&&isNaN(M.vy)||t>2&&isNaN(M.vz))&&(M.vx=0,t>1&&(M.vy=0),t>2&&(M.vz=0))}}function g(f){return f.initialize&&f.initialize(n,u,t),f}return x(),i={tick:m,restart:function(){return h.restart(p),i},stop:function(){return h.stop(),i},numDimensions:function(f){return arguments.length?(t=Math.min(Wd,Math.max(1,Math.round(f))),c.forEach(g),i):t},nodes:function(f){return arguments.length?(n=f,x(),c.forEach(g),i):n},alpha:function(f){return arguments.length?(r=+f,i):r},alphaMin:function(f){return arguments.length?(s=+f,i):s},alphaDecay:function(f){return arguments.length?(a=+f,i):+a},alphaTarget:function(f){return arguments.length?(o=+f,i):o},velocityDecay:function(f){return arguments.length?(l=1-f,i):1-l},randomSource:function(f){return arguments.length?(u=f,c.forEach(g),i):u},force:function(f,v){return arguments.length>1?(v==null?c.delete(f):c.set(f,g(v)),i):c.get(f)},find:function(){var f=Array.prototype.slice.call(arguments),v=f.shift()||0,M=(t>1?f.shift():null)||0,S=(t>2?f.shift():null)||0,w=f.shift()||1/0,y=0,A=n.length,_,C,D,P,N,V;for(w*=w,y=0;y<A;++y)N=n[y],_=v-N.x,C=M-(N.y||0),D=S-(N.z||0),P=_*_+C*C+D*D,P<w&&(V=N,w=P);return V},on:function(f,v){return arguments.length>1?(d.on(f,v),i):d.on(f)}}}function eh(){var n,e,t,i,r,s=fn(-30),a,o=1,l=1/0,c=.81;function h(m){var x,g=n.length,f=(e===1?_s(n,jo):e===2?xs(n,jo,Kc):e===3?vs(n,jo,Kc,Xd):null).visitAfter(u);for(r=m,x=0;x<g;++x)t=n[x],f.visit(p)}function d(){if(n){var m,x=n.length,g;for(a=new Array(x),m=0;m<x;++m)g=n[m],a[g.index]=+s(g,m,n)}}function u(m){var x=0,g,f,v=0,M,S,w,y,A=m.length;if(A){for(M=S=w=y=0;y<A;++y)(g=m[y])&&(f=Math.abs(g.value))&&(x+=g.value,v+=f,M+=f*(g.x||0),S+=f*(g.y||0),w+=f*(g.z||0));x*=Math.sqrt(4/A),m.x=M/v,e>1&&(m.y=S/v),e>2&&(m.z=w/v)}else{g=m,g.x=g.data.x,e>1&&(g.y=g.data.y),e>2&&(g.z=g.data.z);do x+=a[g.data.index];while(g=g.next)}m.value=x}function p(m,x,g,f,v){if(!m.value)return!0;var M=[g,f,v][e-1],S=m.x-t.x,w=e>1?m.y-t.y:0,y=e>2?m.z-t.z:0,A=M-x,_=S*S+w*w+y*y;if(A*A/c<_)return _<l&&(S===0&&(S=bn(i),_+=S*S),e>1&&w===0&&(w=bn(i),_+=w*w),e>2&&y===0&&(y=bn(i),_+=y*y),_<o&&(_=Math.sqrt(o*_)),t.vx+=S*m.value*r/_,e>1&&(t.vy+=w*m.value*r/_),e>2&&(t.vz+=y*m.value*r/_)),!0;if(m.length||_>=l)return;(m.data!==t||m.next)&&(S===0&&(S=bn(i),_+=S*S),e>1&&w===0&&(w=bn(i),_+=w*w),e>2&&y===0&&(y=bn(i),_+=y*y),_<o&&(_=Math.sqrt(o*_)));do m.data!==t&&(A=a[m.data.index]*r/_,t.vx+=S*A,e>1&&(t.vy+=w*A),e>2&&(t.vz+=y*A));while(m=m.next)}return h.initialize=function(m,...x){n=m,i=x.find(g=>typeof g=="function")||Math.random,e=x.find(g=>[1,2,3].includes(g))||2,d()},h.strength=function(m){return arguments.length?(s=typeof m=="function"?m:fn(+m),d(),h):s},h.distanceMin=function(m){return arguments.length?(o=m*m,h):Math.sqrt(o)},h.distanceMax=function(m){return arguments.length?(l=m*m,h):Math.sqrt(l)},h.theta=function(m){return arguments.length?(c=m*m,h):Math.sqrt(c)},h}function th(n,e,t,i){var r,s,a=fn(.1),o,l;typeof n!="function"&&(n=fn(+n)),e==null&&(e=0),t==null&&(t=0),i==null&&(i=0);function c(d){for(var u=0,p=r.length;u<p;++u){var m=r[u],x=m.x-e||1e-6,g=(m.y||0)-t||1e-6,f=(m.z||0)-i||1e-6,v=Math.sqrt(x*x+g*g+f*f),M=(l[u]-v)*o[u]*d/v;m.vx+=x*M,s>1&&(m.vy+=g*M),s>2&&(m.vz+=f*M)}}function h(){if(r){var d,u=r.length;for(o=new Array(u),l=new Array(u),d=0;d<u;++d)l[d]=+n(r[d],d,r),o[d]=isNaN(l[d])?0:+a(r[d],d,r)}}return c.initialize=function(d,...u){r=d,s=u.find(p=>[1,2,3].includes(p))||2,h()},c.strength=function(d){return arguments.length?(a=typeof d=="function"?d:fn(+d),h(),c):a},c.radius=function(d){return arguments.length?(n=typeof d=="function"?d:fn(+d),h(),c):n},c.x=function(d){return arguments.length?(e=+d,c):e},c.y=function(d){return arguments.length?(t=+d,c):t},c.z=function(d){return arguments.length?(i=+d,c):i},c}function nh(n){qy(n);let e=Xy(n);return n.on=e.on,n.off=e.off,n.fire=e.fire,n}function Xy(n){let e=Object.create(null);return{on:function(t,i,r){if(typeof i!="function")throw new Error("callback is expected to be a function");let s=e[t];return s||(s=e[t]=[]),s.push({callback:i,ctx:r}),n},off:function(t,i){if(typeof t>"u")return e=Object.create(null),n;if(e[t])if(typeof i!="function")delete e[t];else{let a=e[t];for(let o=0;o<a.length;++o)a[o].callback===i&&a.splice(o,1)}return n},fire:function(t){let i=e[t];if(!i)return n;let r;arguments.length>1&&(r=Array.prototype.slice.call(arguments,1));for(let s=0;s<i.length;++s){let a=i[s];a.callback.apply(a.ctx,r)}return n}}}function qy(n){if(!n)throw new Error("Eventify cannot use falsy object as events subject");let e=["on","fire","off"];for(let t=0;t<e.length;++t)if(n.hasOwnProperty(e[t]))throw new Error("Subject cannot be eventified, since it already has property '"+e[t]+"'")}var $d=Yy;function Yy(n){if(n=n||{},"uniqueLinkId"in n&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
4604
4604
|
`,`Note: there is also change in default behavior: From now on each graph
|
|
4605
|
-
is considered to be not a multigraph by default (each edge is unique).`),n.multigraph=n.uniqueLinkId),n.multigraph===void 0&&(n.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,t=new Map,i={},r=0,s=n.multigraph?S:M,a=[],o=k,l=k,c=k,h=k,d={version:20,addNode:x,addLink:v,removeLink:_,removeNode:f,getNode:g,getNodeCount:w,getLinkCount:y,getEdgeCount:y,getLinksCount:y,getNodesCount:w,getLinks:A,forEachNode:he,forEachLinkedNode:I,forEachLink:V,beginUpdate:c,endUpdate:h,clear:N,hasLink:D,hasNode:g,getLink:D,getLinkById:P};return nh(d),u(),d;function u(){var q=d.on;d.on=J;function J(){return d.beginUpdate=c=ee,d.endUpdate=h=ne,o=p,l=m,d.on=q,q.apply(d,arguments)}}function p(q,J){a.push({link:q,changeType:J})}function m(q,J){a.push({node:q,changeType:J})}function x(q,J){if(q===void 0)throw new Error("Invalid node identifier");c();var fe=g(q);return fe?(fe.data=J,l(fe,"update")):(fe=new
|
|
4606
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
4607
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
4608
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xM(n,e){return lM(n)||mM(n,e)||Hp(n,e)||gM()}function vM(n){return cM(n)||pM(n)||Hp(n)||_M()}function yM(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function bM(n){var e=yM(n,"string");return typeof e=="symbol"?e:e+""}function Hp(n,e){if(n){if(typeof n=="string")return xh(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?xh(n,e):void 0}}var Mr=new WeakMap,Es=new WeakMap,Sr=new WeakMap,mh=new WeakMap,gh=new WeakMap,_h=new WeakMap,Wp=(function(){function n(){uM(this,n),br(this,Mr,new Map),br(this,Es,new Map),br(this,Sr,function(e){return e}),br(this,mh,function(){return{}}),br(this,gh,function(){}),br(this,_h,function(){})}return dM(n,[{key:"getObj",value:function(t){return Bt(Mr,this).get(Bt(Sr,this).call(this,t))}},{key:"getData",value:function(t){return Bt(Es,this).get(t)}},{key:"entries",value:function(){return vM(Bt(Es,this).entries()).map(function(t){var i=xM(t,2),r=i[0],s=i[1];return[s,r]})}},{key:"id",value:function(t){return nl(Sr,this,je(t)),this}},{key:"onCreateObj",value:function(t){return nl(mh,this,t),this}},{key:"onUpdateObj",value:function(t){return nl(gh,this,t),this}},{key:"onRemoveObj",value:function(t){return nl(_h,this,t),this}},{key:"digest",value:function(t){var i=this;t.filter(function(s){return!Bt(Mr,i).has(Bt(Sr,i).call(i,s))}).forEach(function(s){var a=Bt(mh,i).call(i,s);Bt(Mr,i).set(Bt(Sr,i).call(i,s),a),Bt(Es,i).set(a,s)});var r=new Map(t.map(function(s){return[Bt(Sr,i).call(i,s),s]}));return Bt(Mr,this).forEach(function(s,a){r.has(a)?Bt(gh,i).call(i,s,r.get(a)):(Bt(_h,i).call(i,s,a),Bt(Mr,i).delete(a),Bt(Es,i).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();function Xp(n,e){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(e).domain(n);break}return this}var vh=Symbol("implicit");function Cs(){var n=new yr,e=[],t=[],i=vh;function r(s){let a=n.get(s);if(a===void 0){if(i!==vh)return i;n.set(s,a=e.push(s)-1)}return t[a%t.length]}return r.domain=function(s){if(!arguments.length)return e.slice();e=[],n=new yr;for(let a of s)n.has(a)||n.set(a,e.push(a)-1);return r},r.range=function(s){return arguments.length?(t=Array.from(s),r):t.slice()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return Cs(e,t).unknown(i)},Xp.apply(r,arguments),r}function qp(n){for(var e=n.length/6|0,t=new Array(e),i=0;i<e;)t[i]="#"+n.slice(i*6,++i*6);return t}var yh=qp("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function il(n){"@babel/helpers - typeof";return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},il(n)}var MM=/^\s+/,SM=/\s+$/;function Ee(n,e){if(n=n||"",e=e||{},n instanceof Ee)return n;if(!(this instanceof Ee))return new Ee(n,e);var t=wM(n);this._originalInput=n,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}Ee.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,i,r,s,a,o;return t=e.r/255,i=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*a+.0722*o},setAlpha:function(e){return this._a=Qp(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=$p(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=$p(this._r,this._g,this._b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+i+"%, "+r+"%)":"hsva("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=Yp(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=Yp(this._r,this._g,this._b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+i+"%, "+r+"%)":"hsla("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return jp(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return CM(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(dt(this._r,255)*100)+"%",g:Math.round(dt(this._g,255)*100)+"%",b:Math.round(dt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(dt(this._r,255)*100)+"%, "+Math.round(dt(this._g,255)*100)+"%, "+Math.round(dt(this._b,255)*100)+"%)":"rgba("+Math.round(dt(this._r,255)*100)+"%, "+Math.round(dt(this._g,255)*100)+"%, "+Math.round(dt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:zM[jp(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+Zp(this._r,this._g,this._b,this._a),i=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=Ee(e);i="#"+Zp(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+i+")"},toString:function(e){var t=!!e;e=e||this._format;var i=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(i=this.toRgbString()),e==="prgb"&&(i=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(i=this.toHexString()),e==="hex3"&&(i=this.toHexString(!0)),e==="hex4"&&(i=this.toHex8String(!0)),e==="hex8"&&(i=this.toHex8String()),e==="name"&&(i=this.toName()),e==="hsl"&&(i=this.toHslString()),e==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return Ee(this.toString())},_applyModification:function(e,t){var i=e.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(DM,arguments)},brighten:function(){return this._applyModification(LM,arguments)},darken:function(){return this._applyModification(NM,arguments)},desaturate:function(){return this._applyModification(RM,arguments)},saturate:function(){return this._applyModification(PM,arguments)},greyscale:function(){return this._applyModification(IM,arguments)},spin:function(){return this._applyModification(UM,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(BM,arguments)},complement:function(){return this._applyCombination(FM,arguments)},monochromatic:function(){return this._applyCombination(kM,arguments)},splitcomplement:function(){return this._applyCombination(OM,arguments)},triad:function(){return this._applyCombination(Jp,[3])},tetrad:function(){return this._applyCombination(Jp,[4])}};Ee.fromRatio=function(n,e){if(il(n)=="object"){var t={};for(var i in n)n.hasOwnProperty(i)&&(i==="a"?t[i]=n[i]:t[i]=Rs(n[i]));n=t}return Ee(n,e)};function wM(n){var e={r:0,g:0,b:0},t=1,i=null,r=null,s=null,a=!1,o=!1;return typeof n=="string"&&(n=WM(n)),il(n)=="object"&&(jn(n.r)&&jn(n.g)&&jn(n.b)?(e=TM(n.r,n.g,n.b),a=!0,o=String(n.r).substr(-1)==="%"?"prgb":"rgb"):jn(n.h)&&jn(n.s)&&jn(n.v)?(i=Rs(n.s),r=Rs(n.v),e=EM(n.h,i,r),a=!0,o="hsv"):jn(n.h)&&jn(n.s)&&jn(n.l)&&(i=Rs(n.s),s=Rs(n.l),e=AM(n.h,i,s),a=!0,o="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=Qp(t),{ok:a,format:n.format||o,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function TM(n,e,t){return{r:dt(n,255)*255,g:dt(e,255)*255,b:dt(t,255)*255}}function Yp(n,e,t){n=dt(n,255),e=dt(e,255),t=dt(t,255);var i=Math.max(n,e,t),r=Math.min(n,e,t),s,a,o=(i+r)/2;if(i==r)s=a=0;else{var l=i-r;switch(a=o>.5?l/(2-i-r):l/(i+r),i){case n:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-n)/l+2;break;case t:s=(n-e)/l+4;break}s/=6}return{h:s,s:a,l:o}}function AM(n,e,t){var i,r,s;n=dt(n,360),e=dt(e,100),t=dt(t,100);function a(c,h,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?c+(h-c)*6*d:d<1/2?h:d<2/3?c+(h-c)*(2/3-d)*6:c}if(e===0)i=r=s=t;else{var o=t<.5?t*(1+e):t+e-t*e,l=2*t-o;i=a(l,o,n+1/3),r=a(l,o,n),s=a(l,o,n-1/3)}return{r:i*255,g:r*255,b:s*255}}function $p(n,e,t){n=dt(n,255),e=dt(e,255),t=dt(t,255);var i=Math.max(n,e,t),r=Math.min(n,e,t),s,a,o=i,l=i-r;if(a=i===0?0:l/i,i==r)s=0;else{switch(i){case n:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-n)/l+2;break;case t:s=(n-e)/l+4;break}s/=6}return{h:s,s:a,v:o}}function EM(n,e,t){n=dt(n,360)*6,e=dt(e,100),t=dt(t,100);var i=Math.floor(n),r=n-i,s=t*(1-e),a=t*(1-r*e),o=t*(1-(1-r)*e),l=i%6,c=[t,a,s,s,o,t][l],h=[o,t,t,a,s,s][l],d=[s,s,o,t,t,a][l];return{r:c*255,g:h*255,b:d*255}}function jp(n,e,t,i){var r=[Sn(Math.round(n).toString(16)),Sn(Math.round(e).toString(16)),Sn(Math.round(t).toString(16))];return i&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function CM(n,e,t,i,r){var s=[Sn(Math.round(n).toString(16)),Sn(Math.round(e).toString(16)),Sn(Math.round(t).toString(16)),Sn(em(i))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function Zp(n,e,t,i){var r=[Sn(em(i)),Sn(Math.round(n).toString(16)),Sn(Math.round(e).toString(16)),Sn(Math.round(t).toString(16))];return r.join("")}Ee.equals=function(n,e){return!n||!e?!1:Ee(n).toRgbString()==Ee(e).toRgbString()};Ee.random=function(){return Ee.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function RM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.s-=e/100,t.s=rl(t.s),Ee(t)}function PM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.s+=e/100,t.s=rl(t.s),Ee(t)}function IM(n){return Ee(n).desaturate(100)}function DM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.l+=e/100,t.l=rl(t.l),Ee(t)}function LM(n,e){e=e===0?0:e||10;var t=Ee(n).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),Ee(t)}function NM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.l-=e/100,t.l=rl(t.l),Ee(t)}function UM(n,e){var t=Ee(n).toHsl(),i=(t.h+e)%360;return t.h=i<0?360+i:i,Ee(t)}function FM(n){var e=Ee(n).toHsl();return e.h=(e.h+180)%360,Ee(e)}function Jp(n,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=Ee(n).toHsl(),i=[Ee(n)],r=360/e,s=1;s<e;s++)i.push(Ee({h:(t.h+s*r)%360,s:t.s,l:t.l}));return i}function OM(n){var e=Ee(n).toHsl(),t=e.h;return[Ee(n),Ee({h:(t+72)%360,s:e.s,l:e.l}),Ee({h:(t+216)%360,s:e.s,l:e.l})]}function BM(n,e,t){e=e||6,t=t||30;var i=Ee(n).toHsl(),r=360/t,s=[Ee(n)];for(i.h=(i.h-(r*e>>1)+720)%360;--e;)i.h=(i.h+r)%360,s.push(Ee(i));return s}function kM(n,e){e=e||6;for(var t=Ee(n).toHsv(),i=t.h,r=t.s,s=t.v,a=[],o=1/e;e--;)a.push(Ee({h:i,s:r,v:s})),s=(s+o)%1;return a}Ee.mix=function(n,e,t){t=t===0?0:t||50;var i=Ee(n).toRgb(),r=Ee(e).toRgb(),s=t/100,a={r:(r.r-i.r)*s+i.r,g:(r.g-i.g)*s+i.g,b:(r.b-i.b)*s+i.b,a:(r.a-i.a)*s+i.a};return Ee(a)};Ee.readability=function(n,e){var t=Ee(n),i=Ee(e);return(Math.max(t.getLuminance(),i.getLuminance())+.05)/(Math.min(t.getLuminance(),i.getLuminance())+.05)};Ee.isReadable=function(n,e,t){var i=Ee.readability(n,e),r,s;switch(s=!1,r=XM(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=i>=4.5;break;case"AAlarge":s=i>=3;break;case"AAAsmall":s=i>=7;break}return s};Ee.mostReadable=function(n,e,t){var i=null,r=0,s,a,o,l;t=t||{},a=t.includeFallbackColors,o=t.level,l=t.size;for(var c=0;c<e.length;c++)s=Ee.readability(n,e[c]),s>r&&(r=s,i=Ee(e[c]));return Ee.isReadable(n,i,{level:o,size:l})||!a?i:(t.includeFallbackColors=!1,Ee.mostReadable(n,["#fff","#000"],t))};var bh=Ee.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},zM=Ee.hexNames=VM(bh);function VM(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function Qp(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function dt(n,e){GM(n)&&(n="100%");var t=HM(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function rl(n){return Math.min(1,Math.max(0,n))}function sn(n){return parseInt(n,16)}function GM(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function HM(n){return typeof n=="string"&&n.indexOf("%")!=-1}function Sn(n){return n.length==1?"0"+n:""+n}function Rs(n){return n<=1&&(n=n*100+"%"),n}function em(n){return Math.round(parseFloat(n)*255).toString(16)}function Kp(n){return sn(n)/255}var Mn=(function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function jn(n){return!!Mn.CSS_UNIT.exec(n)}function WM(n){n=n.replace(MM,"").replace(SM,"").toLowerCase();var e=!1;if(bh[n])n=bh[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Mn.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=Mn.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Mn.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=Mn.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Mn.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=Mn.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Mn.hex8.exec(n))?{r:sn(t[1]),g:sn(t[2]),b:sn(t[3]),a:Kp(t[4]),format:e?"name":"hex8"}:(t=Mn.hex6.exec(n))?{r:sn(t[1]),g:sn(t[2]),b:sn(t[3]),format:e?"name":"hex"}:(t=Mn.hex4.exec(n))?{r:sn(t[1]+""+t[1]),g:sn(t[2]+""+t[2]),b:sn(t[3]+""+t[3]),a:Kp(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Mn.hex3.exec(n))?{r:sn(t[1]+""+t[1]),g:sn(t[2]+""+t[2]),b:sn(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function XM(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function Eh(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function qM(n){if(Array.isArray(n))return n}function YM(n){if(Array.isArray(n))return Eh(n)}function lm(n,e,t){if(typeof n=="function"?n===e:n.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function $M(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function cm(n,e,t){return e=wr(e),nS(n,Ih()?Reflect.construct(e,t||[],wr(n).constructor):e.apply(n,t))}function jM(n,e){if(e.has(n))throw new TypeError("Cannot initialize the same private elements twice on an object")}function hm(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Mh(n,e){return n.get(lm(n,e))}function tm(n,e,t){jM(n,e),e.set(n,t)}function nm(n,e,t){return n.set(lm(n,e),t),t}function um(n,e,t){if(Ih())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,e);var r=new(n.bind.apply(n,i));return r}function ZM(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,pm(i.key),i)}}function fm(n,e,t){return e&&ZM(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function ol(n,e,t){return(e=pm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ch(){return Ch=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(n,e,t){var i=iS(n,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?n:t):r.value}},Ch.apply(null,arguments)}function wr(n){return wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},wr(n)}function dm(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Rh(n,e)}function Ih(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ih=function(){return!!n})()}function JM(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function KM(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,r,s,a,o=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(i=s.call(t)).done)&&(o.push(i.value),o.length!==e);l=!0);}catch(h){c=!0,r=h}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}function QM(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4609
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
4610
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function im(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function tS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?im(Object(t),!0).forEach(function(i){ol(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):im(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function nS(n,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $M(n)}function Rh(n,e){return Rh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},Rh(n,e)}function Ds(n,e){return qM(n)||KM(n,e)||mm(n,e)||QM()}function iS(n,e){for(;!{}.hasOwnProperty.call(n,e)&&(n=wr(n))!==null;);return n}function Sh(n,e,t,i){var r=Ch(wr(n.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function wn(n){return YM(n)||JM(n)||mm(n)||eS()}function rS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function pm(n){var e=rS(n,"string");return typeof e=="symbol"?e:e+""}function Ph(n){"@babel/helpers - typeof";return Ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ph(n)}function mm(n,e){if(n){if(typeof n=="string")return Eh(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Eh(n,e):void 0}}var gm=function(e){e instanceof Array?e.forEach(gm):(e.map&&e.map.dispose(),e.dispose())},Dh=function(e){e.geometry&&e.geometry.dispose(),e.material&&gm(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Dh)},rm=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Dh(t)}},wh=new WeakMap,sl=new WeakMap,Ps=(function(n){function e(t){var i,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,a=s===void 0?"__data":s,o=r.objBindAttr,l=o===void 0?"__threeObj":o;return hm(this,e),i=cm(this,e),ol(i,"scene",void 0),tm(i,wh,void 0),tm(i,sl,void 0),i.scene=t,nm(wh,i,a),nm(sl,i,l),i.onRemoveObj(function(){}),i}return dm(e,n),fm(e,[{key:"onCreateObj",value:function(i){var r=this;return Sh(e,"onCreateObj",this)([function(s){var a=i(s);return s[Mh(sl,r)]=a,a[Mh(wh,r)]=s,r.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(i){var r=this;return Sh(e,"onRemoveObj",this)([function(s,a){var o=Sh(e,"getData",r)([s]);i(s,a),r.scene.remove(s),Dh(s),delete o[Mh(sl,r)]}]),this}}])})(Wp),Is=function(e){return isNaN(e)?parseInt(Ee(e).toHex(),16):e},Th=function(e){return isNaN(e)?Ee(e).getAlpha():1},sS=Cs(yh);function sm(n,e,t){!e||typeof t!="string"||n.filter(function(i){return!i[t]}).forEach(function(i){i[t]=sS(e(i))})}function aS(n,e){var t=n.nodes,i=n.links,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=r.nodeFilter,a=s===void 0?function(){return!0}:s,o=r.onLoopError,l=o===void 0?function(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:o,c={};t.forEach(function(p){return c[e(p)]={data:p,out:[],depth:-1,skip:!a(p)}}),i.forEach(function(p){var m=p.source,x=p.target,g=S(m),f=S(x);if(!c.hasOwnProperty(g))throw"Missing source node with id: ".concat(g);if(!c.hasOwnProperty(f))throw"Missing target node with id: ".concat(f);var v=c[g],M=c[f];v.out.push(M);function S(w){return Ph(w)==="object"?e(w):w}});var h=[];u(Object.values(c));var d=Object.assign.apply(Object,[{}].concat(wn(Object.entries(c).filter(function(p){var m=Ds(p,2),x=m[1];return!x.skip}).map(function(p){var m=Ds(p,2),x=m[0],g=m[1];return ol({},x,g.depth)}))));return d;function u(p){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,g=function(){var S=p[f];if(m.indexOf(S)!==-1){var w=[].concat(wn(m.slice(m.indexOf(S))),[S]).map(function(y){return e(y.data)});return h.some(function(y){return y.length===w.length&&y.every(function(A,_){return A===w[_]})})||(h.push(w),l(w)),1}x>S.depth&&(S.depth=x,u(S.out,[].concat(wn(m),[S]),x+(S.skip?0:1)))},f=0,v=p.length;f<v;f++)g()}}var Ne=window.THREE?window.THREE:{Group:Rn,Mesh:Xt,MeshLambertMaterial:Jr,Color:Xe,BufferGeometry:Ft,BufferAttribute:zt,Matrix4:ct,Vector3:U,SphereGeometry:jr,CylinderGeometry:or,TubeGeometry:Zr,ConeGeometry:qr,Line:Hr,LineBasicMaterial:sr,QuadraticBezierCurve3:Ri,CubicBezierCurve3:lr,Box3:In},am={graph:Yd,forcelayout:om.default},oS=2,Ah=new Ne.BufferGeometry().setAttribute?"setAttribute":"addAttribute",al=new Ne.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",lS=zp({props:{jsonUrl:{onChange:function(e,t){var i=this;e&&!t.fetchingJson&&(t.fetchingJson=!0,t.onLoading(),fetch(e).then(function(r){return r.json()}).then(function(r){t.fetchingJson=!1,t.onFinishLoading(r),i.graphData(r)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(e,t){t.engineRunning=!1}},numDimensions:{default:3,onChange:function(e,t){var i=t.d3ForceLayout.force("charge");i&&i.strength(e>2?-60:-30),e<3&&r(t.graphData.nodes,"z"),e<2&&r(t.graphData.nodes,"y");function r(s,a){s.forEach(function(o){delete o[a],delete o["v".concat(a)]})}}},dagMode:{onChange:function(e,t){!e&&t.forceEngine==="d3"&&(t.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=i.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(e){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaDecay(e)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaTarget(e)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.velocityDecay(e)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(e){return e._flushObjects=!0,e._rerender(),this},d3Force:function(e,t,i){return i===void 0?e.d3ForceLayout.force(t):(e.d3ForceLayout.force(t,i),this)},d3ReheatSimulation:function(e){return e.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(e){return e.cntTicks=0,e.startTickTime=new Date,e.engineRunning=!0,this},tickFrame:function(e){var t=e.forceEngine!=="ngraph";return e.engineRunning&&i(),r(),s(),this;function i(){++e.cntTicks>e.cooldownTicks||new Date-e.startTickTime>e.cooldownTime||t&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin?(e.engineRunning=!1,e.onEngineStop()):(e.layout[t?"tick":"step"](),e.onEngineTick());var a=je(e.nodeThreeObjectExtend);e.nodeDataMapper.entries().forEach(function(u){var p=Ds(u,2),m=p[0],x=p[1];if(x){var g=t?m:e.layout.getNodePosition(m[e.nodeId]),f=a(m);(!e.nodePositionUpdate||!e.nodePositionUpdate(f?x.children[0]:x,{x:g.x,y:g.y,z:g.z},m)||f)&&(x.position.x=g.x,x.position.y=g.y||0,x.position.z=g.z||0)}});var o=je(e.linkWidth),l=je(e.linkCurvature),c=je(e.linkCurveRotation),h=je(e.linkThreeObjectExtend);e.linkDataMapper.entries().forEach(function(u){var p=Ds(u,2),m=p[0],x=p[1];if(x){var g=t?m:e.layout.getLinkPosition(e.layout.graph.getLink(m.source,m.target).id),f=g[t?"source":"from"],v=g[t?"target":"to"];if(!(!f||!v||!f.hasOwnProperty("x")||!v.hasOwnProperty("x"))){d(m);var M=h(m);if(!(e.linkPositionUpdate&&e.linkPositionUpdate(M?x.children[1]:x,{start:{x:f.x,y:f.y,z:f.z},end:{x:v.x,y:v.y,z:v.z}},m)&&!M)){var S=30,w=m.__curve,y=x.children.length?x.children[0]:x;if(y.type==="Line"){if(w){var _=w.getPoints(S);y.geometry.getAttribute("position").array.length!==_.length*3&&y.geometry[Ah]("position",new Ne.BufferAttribute(new Float32Array(_.length*3),3)),y.geometry.setFromPoints(_)}else{var A=y.geometry.getAttribute("position");(!A||!A.array||A.array.length!==6)&&y.geometry[Ah]("position",A=new Ne.BufferAttribute(new Float32Array(6),3)),A.array[0]=f.x,A.array[1]=f.y||0,A.array[2]=f.z||0,A.array[3]=v.x,A.array[4]=v.y||0,A.array[5]=v.z||0,A.needsUpdate=!0}y.geometry.computeBoundingSphere()}else if(y.type==="Mesh")if(w){y.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(y.position.set(0,0,0),y.rotation.set(0,0,0),y.scale.set(1,1,1));var R=Math.ceil(o(m)*10)/10,L=R/2,k=new Ne.TubeGeometry(w,S,L,e.linkResolution,!1);y.geometry.dispose(),y.geometry=k}else{if(!y.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var C=Math.ceil(o(m)*10)/10,D=C/2,P=new Ne.CylinderGeometry(D,D,1,e.linkResolution,1,!1);P[al](new Ne.Matrix4().makeTranslation(0,1/2,0)),P[al](new Ne.Matrix4().makeRotationX(Math.PI/2)),y.geometry.dispose(),y.geometry=P}var N=new Ne.Vector3(f.x,f.y||0,f.z||0),V=new Ne.Vector3(v.x,v.y||0,v.z||0),I=N.distanceTo(V);y.position.x=N.x,y.position.y=N.y,y.position.z=N.z,y.scale.z=I,y.parent.localToWorld(V),y.lookAt(V)}}}}});function d(u){var p=t?u:e.layout.getLinkPosition(e.layout.graph.getLink(u.source,u.target).id),m=p[t?"source":"from"],x=p[t?"target":"to"];if(!(!m||!x||!m.hasOwnProperty("x")||!x.hasOwnProperty("x"))){var g=l(u);if(!g)u.__curve=null;else{var f=new Ne.Vector3(m.x,m.y||0,m.z||0),v=new Ne.Vector3(x.x,x.y||0,x.z||0),M=f.distanceTo(v),S,w=c(u);if(M>0){var y=x.x-m.x,A=x.y-m.y||0,_=new Ne.Vector3().subVectors(v,f),C=_.clone().multiplyScalar(g).cross(y!==0||A!==0?new Ne.Vector3(0,0,1):new Ne.Vector3(0,1,0)).applyAxisAngle(_.normalize(),w).add(new Ne.Vector3().addVectors(f,v).divideScalar(2));S=new Ne.QuadraticBezierCurve3(f,C,v)}else{var D=g*70,P=-w,N=P+Math.PI/2;S=new Ne.CubicBezierCurve3(f,new Ne.Vector3(D*Math.cos(N),D*Math.sin(N),0).add(f),new Ne.Vector3(D*Math.cos(P),D*Math.sin(P),0).add(f),v)}u.__curve=S}}}}function r(){var a=je(e.linkDirectionalArrowRelPos),o=je(e.linkDirectionalArrowLength),l=je(e.nodeVal);e.arrowDataMapper.entries().forEach(function(c){var h=Ds(c,2),d=h[0],u=h[1];if(u){var p=t?d:e.layout.getLinkPosition(e.layout.graph.getLink(d.source,d.target).id),m=p[t?"source":"from"],x=p[t?"target":"to"];if(!(!m||!x||!m.hasOwnProperty("x")||!x.hasOwnProperty("x"))){var g=Math.cbrt(Math.max(0,l(m)||1))*e.nodeRelSize,f=Math.cbrt(Math.max(0,l(x)||1))*e.nodeRelSize,v=o(d),M=a(d),S=d.__curve?function(D){return d.__curve.getPoint(D)}:function(D){var P=function(V,I,R,L){return I[V]+(R[V]-I[V])*L||0};return{x:P("x",m,x,D),y:P("y",m,x,D),z:P("z",m,x,D)}},w=d.__curve?d.__curve.getLength():Math.sqrt(["x","y","z"].map(function(D){return Math.pow((x[D]||0)-(m[D]||0),2)}).reduce(function(D,P){return D+P},0)),y=g+v+(w-g-f-v)*M,A=S(y/w),_=S((y-v)/w);["x","y","z"].forEach(function(D){return u.position[D]=_[D]});var C=um(Ne.Vector3,wn(["x","y","z"].map(function(D){return A[D]})));u.parent.localToWorld(C),u.lookAt(C)}}})}function s(){var a=je(e.linkDirectionalParticleSpeed),o=je(e.linkDirectionalParticleOffset);e.graphData.links.forEach(function(l){var c=e.particlesDataMapper.getObj(l),h=c&&c.children,d=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!d||!d.length)&&(!h||!h.length))){var u=t?l:e.layout.getLinkPosition(e.layout.graph.getLink(l.source,l.target).id),p=u[t?"source":"from"],m=u[t?"target":"to"];if(!(!p||!m||!p.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var x=a(l),g=Math.abs(o(l)),f=l.__curve?function(M){return l.__curve.getPoint(M)}:function(M){var S=function(y,A,_,C){return A[y]+(_[y]-A[y])*C||0};return{x:S("x",p,m,M),y:S("y",p,m,M),z:S("z",p,m,M)}},v=[].concat(wn(h||[]),wn(d||[]));v.forEach(function(M,S){var w=M.parent.__linkThreeObjType==="singleHopPhotons";if(M.hasOwnProperty("__progressRatio")||(M.__progressRatio=w?x<0?1:0:(S+g)/h.length),M.__progressRatio+=x,M.__progressRatio>=1||M.__progressRatio<0)if(!w)M.__progressRatio=M.__progressRatio%1,M.__progressRatio<0&&M.__progressRatio++;else{M.parent.remove(M),rm(M);return}var y=M.__progressRatio,A=f(y);M.geometry.type!=="SphereGeometry"&&M.lookAt(A.x,A.y,A.z),["x","y","z"].forEach(function(_){return M.position[_]=A[_]})})}}})}},emitParticle:function(e,t){if(t&&e.graphData.links.includes(t)){if(!t.__singleHopPhotonsObj){var i=new Ne.Group;i.__linkThreeObjType="singleHopPhotons",t.__singleHopPhotonsObj=i,e.graphScene.add(i)}var r=je(e.linkDirectionalParticleThreeObject)(t);if(r&&e.linkDirectionalParticleThreeObject===r&&(r=r.clone()),!r){var s=je(e.linkDirectionalParticleWidth),a=Math.ceil(s(t)*10)/10/2,o=e.linkDirectionalParticleResolution,l=new Ne.SphereGeometry(a,o,o),c=je(e.linkColor),h=je(e.linkDirectionalParticleColor),d=h(t)||c(t)||"#f0f0f0",u=new Ne.Color(Is(d)),p=e.linkOpacity*3,m=new Ne.MeshLambertMaterial({color:u,transparent:!0,opacity:p});r=new Ne.Mesh(l,m)}t.__singleHopPhotonsObj.add(r)}return this},getGraphBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!e.initialised)return null;var i=(function r(s){var a=[];if(s.geometry){s.geometry.computeBoundingBox();var o=new Ne.Box3;o.copy(s.geometry.boundingBox).applyMatrix4(s.matrixWorld),a.push(o)}return a.concat.apply(a,wn((s.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&t(l.__data)}).map(r)))})(e.graphScene);return i.length?Object.assign.apply(Object,wn(["x","y","z"].map(function(r){return ol({},r,[tl(i,function(s){return s.min[r]}),el(i,function(s){return s.max[r]})])}))):null}},stateInit:function(){return{d3ForceLayout:Qc().force("link",Yc()).force("charge",eh()).force("center",Hc()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(e,t){t.graphScene=e,t.nodeDataMapper=new Ps(e,{objBindAttr:"__threeObj"}),t.linkDataMapper=new Ps(e,{objBindAttr:"__lineObj"}),t.arrowDataMapper=new Ps(e,{objBindAttr:"__arrowObj"}),t.particlesDataMapper=new Ps(e,{objBindAttr:"__photonsObj"})},update:function(e,t){var i=function(z){return z.some(function($){return t.hasOwnProperty($)})};if(e.engineRunning=!1,typeof e.onUpdate=="function"&&e.onUpdate(),e.nodeAutoColorBy!==null&&i(["nodeAutoColorBy","graphData","nodeColor"])&&sm(e.graphData.nodes,je(e.nodeAutoColorBy),e.nodeColor),e.linkAutoColorBy!==null&&i(["linkAutoColorBy","graphData","linkColor"])&&sm(e.graphData.links,je(e.linkAutoColorBy),e.linkColor),e._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var r=je(e.nodeThreeObject),s=je(e.nodeThreeObjectExtend),a=je(e.nodeVal),o=je(e.nodeColor),l=je(e.nodeVisibility),c={},h={};(e._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]))&&e.nodeDataMapper.clear(),e.nodeDataMapper.onCreateObj(function(Y){var z=r(Y),$=s(Y);z&&e.nodeThreeObject===z&&(z=z.clone());var te;return z&&!$?te=z:(te=new Ne.Mesh,te.__graphDefaultObj=!0,z&&$&&te.add(z)),te.__graphObjType="node",te}).onUpdateObj(function(Y,z){if(Y.__graphDefaultObj){var $=a(z)||1,te=Math.cbrt($)*e.nodeRelSize,ve=e.nodeResolution;(!Y.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||Y.geometry.parameters.radius!==te||Y.geometry.parameters.widthSegments!==ve)&&(c.hasOwnProperty($)||(c[$]=new Ne.SphereGeometry(te,ve,ve)),Y.geometry.dispose(),Y.geometry=c[$]);var Me=o(z),xe=new Ne.Color(Is(Me||"#ffffaa")),Ze=e.nodeOpacity*Th(Me);(Y.material.type!=="MeshLambertMaterial"||!Y.material.color.equals(xe)||Y.material.opacity!==Ze)&&(h.hasOwnProperty(Me)||(h[Me]=new Ne.MeshLambertMaterial({color:xe,transparent:!0,opacity:Ze})),Y.material.dispose(),Y.material=h[Me])}}).digest(e.graphData.nodes.filter(l))}if(e._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var d=je(e.linkThreeObject),u=je(e.linkThreeObjectExtend),p=je(e.linkMaterial),m=je(e.linkVisibility),x=je(e.linkColor),g=je(e.linkWidth),f={},v={},M={},S=e.graphData.links.filter(m);if((e._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&e.linkDataMapper.clear(),e.linkDataMapper.onRemoveObj(function(Y){var z=Y.__data&&Y.__data.__singleHopPhotonsObj;z&&(z.parent.remove(z),rm(z),delete Y.__data.__singleHopPhotonsObj)}).onCreateObj(function(Y){var z=d(Y),$=u(Y);z&&e.linkThreeObject===z&&(z=z.clone());var te;if(!z||$){var ve=!!g(Y);if(ve)te=new Ne.Mesh;else{var Me=new Ne.BufferGeometry;Me[Ah]("position",new Ne.BufferAttribute(new Float32Array(6),3)),te=new Ne.Line(Me)}}var xe;return z?$?(xe=new Ne.Group,xe.__graphDefaultObj=!0,xe.add(te),xe.add(z)):xe=z:(xe=te,xe.__graphDefaultObj=!0),xe.renderOrder=10,xe.__graphObjType="link",xe}).onUpdateObj(function(Y,z){if(Y.__graphDefaultObj){var $=Y.children.length?Y.children[0]:Y,te=Math.ceil(g(z)*10)/10,ve=!!te;if(ve){var Me=te/2,xe=e.linkResolution;if(!$.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||$.geometry.parameters.radiusTop!==Me||$.geometry.parameters.radialSegments!==xe){if(!f.hasOwnProperty(te)){var Ze=new Ne.CylinderGeometry(Me,Me,1,xe,1,!1);Ze[al](new Ne.Matrix4().makeTranslation(0,1/2,0)),Ze[al](new Ne.Matrix4().makeRotationX(Math.PI/2)),f[te]=Ze}$.geometry.dispose(),$.geometry=f[te]}}var Ue=p(z);if(Ue)$.material=Ue;else{var qe=x(z),Qe=new Ne.Color(Is(qe||"#f0f0f0")),Fe=e.linkOpacity*Th(qe),it=ve?"MeshLambertMaterial":"LineBasicMaterial";if($.material.type!==it||!$.material.color.equals(Qe)||$.material.opacity!==Fe){var nt=ve?v:M;nt.hasOwnProperty(qe)||(nt[qe]=new Ne[it]({color:Qe,transparent:Fe<1,opacity:Fe,depthWrite:Fe>=1})),$.material.dispose(),$.material=nt[qe]}}}}).digest(S),e.linkDirectionalArrowLength||t.hasOwnProperty("linkDirectionalArrowLength")){var w=je(e.linkDirectionalArrowLength),y=je(e.linkDirectionalArrowColor);e.arrowDataMapper.onCreateObj(function(){var Y=new Ne.Mesh(void 0,new Ne.MeshLambertMaterial({transparent:!0}));return Y.__linkThreeObjType="arrow",Y}).onUpdateObj(function(Y,z){var $=w(z),te=e.linkDirectionalArrowResolution;if(!Y.geometry.type.match(/^Cone(Buffer)?Geometry$/)||Y.geometry.parameters.height!==$||Y.geometry.parameters.radialSegments!==te){var ve=new Ne.ConeGeometry($*.25,$,te);ve.translate(0,$/2,0),ve.rotateX(Math.PI/2),Y.geometry.dispose(),Y.geometry=ve}var Me=y(z)||x(z)||"#f0f0f0";Y.material.color=new Ne.Color(Is(Me)),Y.material.opacity=e.linkOpacity*3*Th(Me)}).digest(S.filter(w))}if(e.linkDirectionalParticles||t.hasOwnProperty("linkDirectionalParticles")){var A=je(e.linkDirectionalParticles),_=je(e.linkDirectionalParticleWidth),C=je(e.linkDirectionalParticleColor),D=je(e.linkDirectionalParticleThreeObject),P={},N={};e.particlesDataMapper.onCreateObj(function(){var Y=new Ne.Group;return Y.__linkThreeObjType="photons",Y.__photonDataMapper=new Ps(Y),Y}).onUpdateObj(function(Y,z){var $=!!Y.children.length&&Y.children[0],te=D(z),ve,Me;if(te)ve=te.geometry,Me=te.material;else{var xe=Math.ceil(_(z)*10)/10/2,Ze=e.linkDirectionalParticleResolution;$&&$.geometry.parameters.radius===xe&&$.geometry.parameters.widthSegments===Ze?ve=$.geometry:(N.hasOwnProperty(xe)||(N[xe]=new Ne.SphereGeometry(xe,Ze,Ze)),ve=N[xe]);var Ue=C(z)||x(z)||"#f0f0f0",qe=new Ne.Color(Is(Ue)),Qe=e.linkOpacity*3;$&&$.material.color.equals(qe)&&$.material.opacity===Qe?Me=$.material:(P.hasOwnProperty(Ue)||(P[Ue]=new Ne.MeshLambertMaterial({color:qe,transparent:!0,opacity:Qe})),Me=P[Ue])}$&&($.geometry!==ve&&$.geometry.dispose(),$.material!==Me&&$.material.dispose());var Fe=Math.round(Math.abs(A(z)));Y.__photonDataMapper.id(function(it){return it.idx}).onCreateObj(function(){return new Ne.Mesh(ve,Me)}).onUpdateObj(function(it){it.geometry=ve,it.material=Me}).digest(wn(new Array(Fe)).map(function(it,nt){return{idx:nt}}))}).digest(S.filter(A))}}if(e._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){e.engineRunning=!1,e.graphData.links.forEach(function(Y){Y.source=Y[e.linkSource],Y.target=Y[e.linkTarget]});var V=e.forceEngine!=="ngraph",I;if(V){(I=e.d3ForceLayout).stop().alpha(1).numDimensions(e.numDimensions).nodes(e.graphData.nodes);var R=e.d3ForceLayout.force("link");R&&R.id(function(Y){return Y[e.nodeId]}).links(e.graphData.links);var L=e.dagMode&&aS(e.graphData,function(Y){return Y[e.nodeId]},{nodeFilter:e.dagNodeFilter,onLoopError:e.onDagError||void 0}),k=Math.max.apply(Math,wn(Object.values(L||[]))),ee=e.dagLevelDistance||e.graphData.nodes.length/(k||1)*oS*(["radialin","radialout"].indexOf(e.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var ne=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(Y){return delete Y[ne]})}if(["lr","rl","td","bu","zin","zout"].includes(e.dagMode)){var he=["rl","td","zout"].includes(e.dagMode),q=function(z){return(L[z[e.nodeId]]-k/2)*ee*(he?-1:1)},J=["lr","rl"].includes(e.dagMode)?"fx":["td","bu"].includes(e.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(Y){return Y[J]=q(Y)})}e.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(e.dagMode)!==-1?th(function(Y){var z=L[Y[e.nodeId]]||-1;return(e.dagMode==="radialin"?k-z:z)*ee}).strength(function(Y){return e.dagNodeFilter(Y)?1:0}):null)}else{var fe=am.graph();e.graphData.nodes.forEach(function(Y){fe.addNode(Y[e.nodeId])}),e.graphData.links.forEach(function(Y){fe.addLink(Y.source,Y.target)}),I=am.forcelayout(fe,tS({dimensions:e.numDimensions},e.ngraphPhysics)),I.graph=fe}for(var De=0;De<e.warmupTicks&&!(V&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin);De++)I[V?"tick":"step"]();e.layout=I,this.resetCountdown()}e.engineRunning=!0,e.onFinishUpdate()}});function cS(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=(function(r){function s(){var a;hm(this,s);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return a=cm(this,s,[].concat(l)),a.__kapsuleInstance=um(n,[].concat(wn(t?[a]:[]),l)),a}return dm(s,r),fm(s)})(e);return Object.keys(n()).forEach(function(r){return i.prototype[r]=function(){var s,a=(s=this.__kapsuleInstance)[r].apply(s,arguments);return a===this.__kapsuleInstance?this:a}}),i}var hS=window.THREE?window.THREE:{Group:Rn},_m=cS(lS,hS.Group,!0);var xm={type:"change"},Nh={type:"start"},ym={type:"end"},ll=new oi,vm=new ln,uS=Math.cos(70*_c.DEG2RAD),Tt=new U,$t=2*Math.PI,at={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Lh=1e-6,cl=class extends rs{constructor(e,t=null){super(e,t),this.state=at.NONE,this.target=new U,this.cursor=new U,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ui.ROTATE,MIDDLE:ui.DOLLY,RIGHT:ui.PAN},this.touches={ONE:fi.ROTATE,TWO:fi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new U,this._lastQuaternion=new en,this._lastTargetPosition=new U,this._quat=new en().setFromUnitVectors(e.up,new U(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new hr,this._sphericalDelta=new hr,this._scale=1,this._panOffset=new U,this._rotateStart=new Te,this._rotateEnd=new Te,this._rotateDelta=new Te,this._panStart=new Te,this._panEnd=new Te,this._panDelta=new Te,this._dollyStart=new Te,this._dollyEnd=new Te,this._dollyDelta=new Te,this._dollyDirection=new U,this._mouse=new Te,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=dS.bind(this),this._onPointerDown=fS.bind(this),this._onPointerUp=pS.bind(this),this._onContextMenu=bS.bind(this),this._onMouseWheel=_S.bind(this),this._onKeyDown=xS.bind(this),this._onTouchStart=vS.bind(this),this._onTouchMove=yS.bind(this),this._onMouseDown=mS.bind(this),this._onMouseMove=gS.bind(this),this._interceptControlDown=MS.bind(this),this._interceptControlUp=SS.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(xm),this.update(),this.state=at.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;Tt.copy(t).sub(this.target),Tt.applyQuaternion(this._quat),this._spherical.setFromVector3(Tt),this.autoRotate&&this.state===at.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(i)&&isFinite(r)&&(i<-Math.PI?i+=$t:i>Math.PI&&(i-=$t),r<-Math.PI?r+=$t:r>Math.PI&&(r-=$t),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(Tt.setFromSpherical(this._spherical),Tt.applyQuaternion(this._quatInverse),t.copy(this.target).add(Tt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){let o=Tt.length();a=this._clampDistance(o*this._scale);let l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let o=new U(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new U(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=Tt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(ll.origin.copy(this.object.position),ll.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ll.direction))<uS?this.object.lookAt(this.target):(vm.setFromNormalAndCoplanarPoint(this.object.up,this.target),ll.intersectPlane(vm,this.target))))}else if(this.object.isOrthographicCamera){let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Lh||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Lh||this._lastTargetPosition.distanceToSquared(this.target)>Lh?(this.dispatchEvent(xm),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?$t/60*this.autoRotateSpeed*e:$t/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Tt.setFromMatrixColumn(t,0),Tt.multiplyScalar(-e),this._panOffset.add(Tt)}_panUp(e,t){this.screenSpacePanning===!0?Tt.setFromMatrixColumn(t,1):(Tt.setFromMatrixColumn(t,0),Tt.crossVectors(this.object.up,Tt)),Tt.multiplyScalar(e),this._panOffset.add(Tt)}_pan(e,t){let i=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;Tt.copy(r).sub(this.target);let s=Tt.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*t*s/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let i=this.domElement.getBoundingClientRect(),r=e-i.left,s=t-i.top,a=i.width,o=i.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft($t*this._rotateDelta.x/t.clientHeight),this._rotateUp($t*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp($t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-$t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft($t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-$t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let i=this._getSecondPointerPosition(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft($t*this._rotateDelta.x/t.clientHeight),this._rotateUp($t*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Te,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}};function fS(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function dS(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function pS(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(ym),this.state=at.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function mS(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case ui.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=at.DOLLY;break;case ui.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=at.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=at.ROTATE}break;case ui.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=at.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=at.PAN}break;default:this.state=at.NONE}this.state!==at.NONE&&this.dispatchEvent(Nh)}function gS(n){switch(this.state){case at.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case at.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case at.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function _S(n){this.enabled===!1||this.enableZoom===!1||this.state!==at.NONE||(n.preventDefault(),this.dispatchEvent(Nh),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(ym))}function xS(n){this.enabled!==!1&&this._handleKeyDown(n)}function vS(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case fi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=at.TOUCH_ROTATE;break;case fi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=at.TOUCH_PAN;break;default:this.state=at.NONE}break;case 2:switch(this.touches.TWO){case fi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=at.TOUCH_DOLLY_PAN;break;case fi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=at.TOUCH_DOLLY_ROTATE;break;default:this.state=at.NONE}break;default:this.state=at.NONE}this.state!==at.NONE&&this.dispatchEvent(Nh)}function yS(n){switch(this._trackPointer(n),this.state){case at.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case at.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case at.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case at.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=at.NONE}}function bS(n){this.enabled!==!1&&n.preventDefault()}function MS(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function SS(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var wS={class:"#36e2ee",interface:"#6ea8ff",function:"#3fb950",method:"#2bb673",type:"#f5b042",enum:"#c792ea",variable:"#8b97a8"},TS={"value-call":"#3fb950","type-ref":"#f5b042",heritage:"#6ea8ff"};function Uh(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function bm(n,e){let t=document.getElementById(n);t&&(t.textContent=e)}async function AS(){let n=document.getElementById("graph");if(!n)return;let e;try{let v=await fetch("graph.json");if(!v.ok)throw new Error(`HTTP ${v.status}`);e=await v.json()}catch(v){n.textContent=`could not load the graph (${String(v)})`;return}e.project&&bm("project",e.project),bm("counts",`${e.nodes.length.toLocaleString()} nodes \xB7 ${e.links.length.toLocaleString()} edges`);let t=n.clientWidth||800,i=n.clientHeight||600,r=new kr;r.background=new Xe(658448),r.add(new ns(16777215,2));let s=new ts(16777215,.8);s.position.set(1,1,1),r.add(s);let a=new Nt(50,t/i,.1,1e6);a.position.set(0,0,320);let o=new Vo({antialias:!0});o.setPixelRatio(Math.min(window.devicePixelRatio,2)),o.setSize(t,i),n.appendChild(o.domElement);let l=new cl(a,o.domElement);l.enableDamping=!0,l.dampingFactor=.18;let c=new _m().nodeId("id").nodeRelSize(4).nodeResolution(12).nodeOpacity(.95).nodeVal(v=>1+Math.sqrt(v.degree)).nodeColor(v=>wS[v.kind]??"#8b97a8").linkColor(v=>TS[v.kind]??"#ffffff55").linkOpacity(.4).linkWidth(0).warmupTicks(20).cooldownTicks(160);r.add(c);let h=()=>{let v=c.getGraphBbox();if(!v)return;let M=(v.x[0]+v.x[1])/2,S=(v.y[0]+v.y[1])/2,w=(v.z[0]+v.z[1])/2,A=Math.max((v.x[1]-v.x[0])/2,(v.y[1]-v.y[0])/2,(v.z[1]-v.z[0])/2,10)*2.6;a.position.set(M+A*.5,S+A*.32,w+A*.8),a.near=Math.max(.1,A/200),a.far=A*20,a.updateProjectionMatrix(),l.target.set(M,S,w),l.update()},d=new URLSearchParams(window.location.search).has("static"),u=-1,p=0;c.onEngineStop(()=>{h(),d&&u<0&&(u=p+4)});let m=document.createElement("div");m.className="tooltip",n.appendChild(m);let x=new is,g=new Te;o.domElement.addEventListener("pointermove",v=>{let M=o.domElement.getBoundingClientRect();g.x=(v.clientX-M.left)/M.width*2-1,g.y=-((v.clientY-M.top)/M.height)*2+1,x.setFromCamera(g,a);let S=x.intersectObjects(c.children,!0),w=null;for(let y of S){let A=y.object;for(;A;){let _=A;if(_.__graphObjType==="node"&&_.__data){w=_.__data;break}A=A.parent}if(w)break}if(!w){m.style.display="none";return}m.style.display="block",m.style.left=`${v.clientX-M.left+12}px`,m.style.top=`${v.clientY-M.top+12}px`,m.innerHTML=`${Uh(w.name)}<br/><span class="muted">${Uh(w.kind)} \xB7 ${Uh(w.file)}</span>`}),o.domElement.addEventListener("pointerleave",()=>{m.style.display="none"});let f=()=>{if(u>=0&&p>u){o.render(r,a);return}requestAnimationFrame(f),c.tickFrame(),l.update(),o.render(r,a),p++};f(),window.addEventListener("resize",()=>{let v=n.clientWidth||t,M=n.clientHeight||i;a.aspect=v/M,a.updateProjectionMatrix(),o.setSize(v,M)}),c.graphData({nodes:e.nodes,links:e.links}),window.setTimeout(h,700)}AS();})();
|
|
4605
|
+
is considered to be not a multigraph by default (each edge is unique).`),n.multigraph=n.uniqueLinkId),n.multigraph===void 0&&(n.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,t=new Map,i={},r=0,s=n.multigraph?S:M,a=[],o=k,l=k,c=k,h=k,d={version:20,addNode:x,addLink:v,removeLink:_,removeNode:f,getNode:g,getNodeCount:w,getLinkCount:y,getEdgeCount:y,getLinksCount:y,getNodesCount:w,getLinks:A,forEachNode:he,forEachLinkedNode:I,forEachLink:V,beginUpdate:c,endUpdate:h,clear:N,hasLink:D,hasNode:g,getLink:D,getLinkById:P};return nh(d),u(),d;function u(){var q=d.on;d.on=J;function J(){return d.beginUpdate=c=ee,d.endUpdate=h=ne,o=p,l=m,d.on=q,q.apply(d,arguments)}}function p(q,J){a.push({link:q,changeType:J})}function m(q,J){a.push({node:q,changeType:J})}function x(q,J){if(q===void 0)throw new Error("Invalid node identifier");c();var fe=g(q);return fe?(fe.data=J,l(fe,"update")):(fe=new $y(q,J),l(fe,"add")),e.set(q,fe),h(),fe}function g(q){return e.get(q)}function f(q){var J=g(q);if(!J)return!1;c();var fe=J.links;return fe&&(fe.forEach(C),J.links=null),e.delete(q),l(J,"remove"),h(),!0}function v(q,J,fe){c();var De=g(q)||x(q),Y=g(J)||x(J),z=s(q,J,fe),$=t.has(z.id);return t.set(z.id,z),qd(De,z),q!==J&&qd(Y,z),o(z,$?"update":"add"),h(),z}function M(q,J,fe){var De=Zo(q,J),Y=t.get(De);return Y?(Y.data=fe,Y):new Yd(q,J,fe,De)}function S(q,J,fe){var De=Zo(q,J),Y=i.hasOwnProperty(De);if(Y||D(q,J)){Y||(i[De]=0);var z="@"+ ++i[De];De=Zo(q+z,J+z)}return new Yd(q,J,fe,De)}function w(){return e.size}function y(){return t.size}function A(q){var J=g(q);return J?J.links:null}function _(q,J){return J!==void 0&&(q=D(q,J)),C(q)}function C(q){if(!q||!t.get(q.id))return!1;c(),t.delete(q.id);var J=g(q.fromId),fe=g(q.toId);return J&&J.links.delete(q),fe&&fe.links.delete(q),o(q,"remove"),h(),!0}function D(q,J){if(!(q===void 0||J===void 0))return t.get(Zo(q,J))}function P(q){if(q!==void 0)return t.get(q)}function N(){c(),he(function(q){f(q.id)}),h()}function V(q){if(typeof q=="function")for(var J=t.values(),fe=J.next();!fe.done;){if(q(fe.value))return!0;fe=J.next()}}function I(q,J,fe){var De=g(q);if(De&&De.links&&typeof J=="function")return fe?L(De.links,q,J):R(De.links,q,J)}function R(q,J,fe){for(var De,Y=q.values(),z=Y.next();!z.done;){var $=z.value,te=$.fromId===J?$.toId:$.fromId;if(De=fe(e.get(te),$),De)return!0;z=Y.next()}}function L(q,J,fe){for(var De,Y=q.values(),z=Y.next();!z.done;){var $=z.value;if($.fromId===J&&(De=fe(e.get($.toId),$),De))return!0;z=Y.next()}}function k(){}function ee(){r+=1}function ne(){r-=1,r===0&&a.length>0&&(d.fire("changed",a),a.length=0)}function he(q){if(typeof q!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+q);for(var J=e.values(),fe=J.next();!fe.done;){if(q(fe.value))return!0;fe=J.next()}}}function $y(n,e){this.id=n,this.links=null,this.data=e}function qd(n,e){n.links?n.links.add(e):n.links=new Set([e])}function Yd(n,e,t,i){this.fromId=n,this.toId=e,this.data=t,this.id=i}function Zo(n,e){return n.toString()+"\u{1F449} "+e.toString()}var lm=Gm(Ep(),1);function Ab(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Ts=Ab;var Eb=typeof global=="object"&&global&&global.Object===Object&&global,Cp=Eb;var Cb=typeof self=="object"&&self&&self.Object===Object&&self,Rb=Cp||Cb||Function("return this")(),Ko=Rb;var Pb=function(){return Ko.Date.now()},Qo=Pb;var Ib=/\s/;function Db(n){for(var e=n.length;e--&&Ib.test(n.charAt(e)););return e}var Rp=Db;var Lb=/^\s+/;function Nb(n){return n&&n.slice(0,Rp(n)+1).replace(Lb,"")}var Pp=Nb;var Ub=Ko.Symbol,vr=Ub;var Ip=Object.prototype,Ob=Ip.hasOwnProperty,Fb=Ip.toString,As=vr?vr.toStringTag:void 0;function Bb(n){var e=Ob.call(n,As),t=n[As];try{n[As]=void 0;var i=!0}catch{}var r=Fb.call(n);return i&&(e?n[As]=t:delete n[As]),r}var Dp=Bb;var kb=Object.prototype,zb=kb.toString;function Vb(n){return zb.call(n)}var Lp=Vb;var Gb="[object Null]",Hb="[object Undefined]",Np=vr?vr.toStringTag:void 0;function Wb(n){return n==null?n===void 0?Hb:Gb:Np&&Np in Object(n)?Dp(n):Lp(n)}var Up=Wb;function Xb(n){return n!=null&&typeof n=="object"}var Op=Xb;var qb="[object Symbol]";function Yb(n){return typeof n=="symbol"||Op(n)&&Up(n)==qb}var Fp=Yb;var Bp=NaN,$b=/^[-+]0x[0-9a-f]+$/i,jb=/^0b[01]+$/i,Zb=/^0o[0-7]+$/i,Jb=parseInt;function Kb(n){if(typeof n=="number")return n;if(Fp(n))return Bp;if(Ts(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Ts(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Pp(n);var t=jb.test(n);return t||Zb.test(n)?Jb(n.slice(2),t?2:8):$b.test(n)?Bp:+n}var ph=Kb;var Qb="Expected a function",eM=Math.max,tM=Math.min;function nM(n,e,t){var i,r,s,a,o,l,c=0,h=!1,d=!1,u=!0;if(typeof n!="function")throw new TypeError(Qb);e=ph(e)||0,Ts(t)&&(h=!!t.leading,d="maxWait"in t,s=d?eM(ph(t.maxWait)||0,e):s,u="trailing"in t?!!t.trailing:u);function p(y){var A=i,_=r;return i=r=void 0,c=y,a=n.apply(_,A),a}function m(y){return c=y,o=setTimeout(f,e),h?p(y):a}function x(y){var A=y-l,_=y-c,C=e-A;return d?tM(C,s-_):C}function g(y){var A=y-l,_=y-c;return l===void 0||A>=e||A<0||d&&_>=s}function f(){var y=Qo();if(g(y))return v(y);o=setTimeout(f,x(y))}function v(y){return o=void 0,u&&i?p(y):(i=r=void 0,a)}function M(){o!==void 0&&clearTimeout(o),c=0,i=l=r=o=void 0}function S(){return o===void 0?a:v(Qo())}function w(){var y=Qo(),A=g(y);if(i=arguments,r=this,l=y,A){if(o===void 0)return m(l);if(d)return clearTimeout(o),o=setTimeout(f,e),p(l)}return o===void 0&&(o=setTimeout(f,e)),a}return w.cancel=M,w.flush=S,w}var kp=nM;function zp(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function iM(n){if(Array.isArray(n))return n}function rM(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function sM(n,e,t){return Object.defineProperty(n,"prototype",{writable:!1}),n}function aM(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,r,s,a,o=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(i=s.call(t)).done)&&(o.push(i.value),o.length!==e);l=!0);}catch(h){c=!0,r=h}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}function oM(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4606
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lM(n,e){return iM(n)||aM(n,e)||cM(n,e)||oM()}function cM(n,e){if(n){if(typeof n=="string")return zp(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?zp(n,e):void 0}}var hM=sM(function n(e,t){var i=t.default,r=i===void 0?null:i,s=t.triggerUpdate,a=s===void 0?!0:s,o=t.onChange,l=o===void 0?function(c,h){}:o;rM(this,n),this.name=e,this.defaultVal=r,this.triggerUpdate=a,this.onChange=l});function Vp(n){var e=n.stateInit,t=e===void 0?function(){return{}}:e,i=n.props,r=i===void 0?{}:i,s=n.methods,a=s===void 0?{}:s,o=n.aliases,l=o===void 0?{}:o,c=n.init,h=c===void 0?function(){}:c,d=n.update,u=d===void 0?function(){}:d,p=Object.keys(r).map(function(m){return new hM(m,r[m])});return function m(){for(var x=arguments.length,g=new Array(x),f=0;f<x;f++)g[f]=arguments[f];var v=!!(this instanceof m&&this.constructor),M=v?g.shift():void 0,S=g[0],w=S===void 0?{}:S,y=Object.assign({},t instanceof Function?t(w):t,{initialised:!1}),A={};function _(P){return C(P,w),D(),_}var C=function(N,V){h.call(_,N,y,V),y.initialised=!0},D=kp(function(){y.initialised&&(u.call(_,y,A),A={})},1);return p.forEach(function(P){_[P.name]=N(P);function N(V){var I=V.name,R=V.triggerUpdate,L=R===void 0?!1:R,k=V.onChange,ee=k===void 0?function(q,J){}:k,ne=V.defaultVal,he=ne===void 0?null:ne;return function(q){var J=y[I];if(!arguments.length)return J;var fe=q===void 0?he:q;return y[I]=fe,ee.call(_,fe,y,J),!A.hasOwnProperty(I)&&(A[I]=J),L&&D(),_}}}),Object.keys(a).forEach(function(P){_[P]=function(){for(var N,V=arguments.length,I=new Array(V),R=0;R<V;R++)I[R]=arguments[R];return(N=a[P]).call.apply(N,[_,y].concat(I))}}),Object.entries(l).forEach(function(P){var N=lM(P,2),V=N[0],I=N[1];return _[V]=_[I]}),_.resetProps=function(){return p.forEach(function(P){_[P.name](P.defaultVal)}),_},_.resetProps(),y._rerender=D,v&&M&&_(M),_}}var je=(function(n){return typeof n=="function"?n:typeof n=="string"?function(e){return e[n]}:function(e){return n}});var yr=class extends Map{constructor(e,t=dM){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[i,r]of e)this.set(i,r)}get(e){return super.get(Gp(this,e))}has(e){return super.has(Gp(this,e))}set(e,t){return super.set(uM(this,e),t)}delete(e){return super.delete(fM(this,e))}};function Gp({_intern:n,_key:e},t){let i=e(t);return n.has(i)?n.get(i):t}function uM({_intern:n,_key:e},t){let i=e(t);return n.has(i)?n.get(i):(n.set(i,t),t)}function fM({_intern:n,_key:e},t){let i=e(t);return n.has(i)&&(t=n.get(i),n.delete(i)),t}function dM(n){return n!==null&&typeof n=="object"?n.valueOf():n}function el(n,e){let t;if(e===void 0)for(let i of n)i!=null&&(t<i||t===void 0&&i>=i)&&(t=i);else{let i=-1;for(let r of n)(r=e(r,++i,n))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function tl(n,e){let t;if(e===void 0)for(let i of n)i!=null&&(t>i||t===void 0&&i>=i)&&(t=i);else{let i=-1;for(let r of n)(r=e(r,++i,n))!=null&&(t>r||t===void 0&&r>=r)&&(t=r)}return t}function xh(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function pM(n){if(Array.isArray(n))return n}function mM(n){if(Array.isArray(n))return xh(n)}function Hp(n,e,t){if(typeof n=="function"?n===e:n.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function gM(n,e){if(e.has(n))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _M(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Bt(n,e){return n.get(Hp(n,e))}function br(n,e,t){gM(n,e),e.set(n,t)}function nl(n,e,t){return n.set(Hp(n,e),t),t}function xM(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,EM(i.key),i)}}function vM(n,e,t){return e&&xM(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function yM(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function bM(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,r,s,a,o=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(i=s.call(t)).done)&&(o.push(i.value),o.length!==e);l=!0);}catch(h){c=!0,r=h}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}function MM(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4607
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SM(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4608
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wM(n,e){return pM(n)||bM(n,e)||Wp(n,e)||MM()}function TM(n){return mM(n)||yM(n)||Wp(n)||SM()}function AM(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function EM(n){var e=AM(n,"string");return typeof e=="symbol"?e:e+""}function Wp(n,e){if(n){if(typeof n=="string")return xh(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?xh(n,e):void 0}}var Mr=new WeakMap,Es=new WeakMap,Sr=new WeakMap,mh=new WeakMap,gh=new WeakMap,_h=new WeakMap,Xp=(function(){function n(){_M(this,n),br(this,Mr,new Map),br(this,Es,new Map),br(this,Sr,function(e){return e}),br(this,mh,function(){return{}}),br(this,gh,function(){}),br(this,_h,function(){})}return vM(n,[{key:"getObj",value:function(t){return Bt(Mr,this).get(Bt(Sr,this).call(this,t))}},{key:"getData",value:function(t){return Bt(Es,this).get(t)}},{key:"entries",value:function(){return TM(Bt(Es,this).entries()).map(function(t){var i=wM(t,2),r=i[0],s=i[1];return[s,r]})}},{key:"id",value:function(t){return nl(Sr,this,je(t)),this}},{key:"onCreateObj",value:function(t){return nl(mh,this,t),this}},{key:"onUpdateObj",value:function(t){return nl(gh,this,t),this}},{key:"onRemoveObj",value:function(t){return nl(_h,this,t),this}},{key:"digest",value:function(t){var i=this;t.filter(function(s){return!Bt(Mr,i).has(Bt(Sr,i).call(i,s))}).forEach(function(s){var a=Bt(mh,i).call(i,s);Bt(Mr,i).set(Bt(Sr,i).call(i,s),a),Bt(Es,i).set(a,s)});var r=new Map(t.map(function(s){return[Bt(Sr,i).call(i,s),s]}));return Bt(Mr,this).forEach(function(s,a){r.has(a)?Bt(gh,i).call(i,s,r.get(a)):(Bt(_h,i).call(i,s,a),Bt(Mr,i).delete(a),Bt(Es,i).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();function qp(n,e){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(e).domain(n);break}return this}var vh=Symbol("implicit");function Cs(){var n=new yr,e=[],t=[],i=vh;function r(s){let a=n.get(s);if(a===void 0){if(i!==vh)return i;n.set(s,a=e.push(s)-1)}return t[a%t.length]}return r.domain=function(s){if(!arguments.length)return e.slice();e=[],n=new yr;for(let a of s)n.has(a)||n.set(a,e.push(a)-1);return r},r.range=function(s){return arguments.length?(t=Array.from(s),r):t.slice()},r.unknown=function(s){return arguments.length?(i=s,r):i},r.copy=function(){return Cs(e,t).unknown(i)},qp.apply(r,arguments),r}function Yp(n){for(var e=n.length/6|0,t=new Array(e),i=0;i<e;)t[i]="#"+n.slice(i*6,++i*6);return t}var yh=Yp("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function il(n){"@babel/helpers - typeof";return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},il(n)}var CM=/^\s+/,RM=/\s+$/;function Ee(n,e){if(n=n||"",e=e||{},n instanceof Ee)return n;if(!(this instanceof Ee))return new Ee(n,e);var t=PM(n);this._originalInput=n,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}Ee.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,i,r,s,a,o;return t=e.r/255,i=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*a+.0722*o},setAlpha:function(e){return this._a=em(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=jp(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=jp(this._r,this._g,this._b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+i+"%, "+r+"%)":"hsva("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=$p(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=$p(this._r,this._g,this._b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+i+"%, "+r+"%)":"hsla("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return Zp(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return NM(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(dt(this._r,255)*100)+"%",g:Math.round(dt(this._g,255)*100)+"%",b:Math.round(dt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(dt(this._r,255)*100)+"%, "+Math.round(dt(this._g,255)*100)+"%, "+Math.round(dt(this._b,255)*100)+"%)":"rgba("+Math.round(dt(this._r,255)*100)+"%, "+Math.round(dt(this._g,255)*100)+"%, "+Math.round(dt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:qM[Zp(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+Jp(this._r,this._g,this._b,this._a),i=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=Ee(e);i="#"+Jp(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+i+")"},toString:function(e){var t=!!e;e=e||this._format;var i=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(i=this.toRgbString()),e==="prgb"&&(i=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(i=this.toHexString()),e==="hex3"&&(i=this.toHexString(!0)),e==="hex4"&&(i=this.toHex8String(!0)),e==="hex8"&&(i=this.toHex8String()),e==="name"&&(i=this.toName()),e==="hsl"&&(i=this.toHslString()),e==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return Ee(this.toString())},_applyModification:function(e,t){var i=e.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(BM,arguments)},brighten:function(){return this._applyModification(kM,arguments)},darken:function(){return this._applyModification(zM,arguments)},desaturate:function(){return this._applyModification(UM,arguments)},saturate:function(){return this._applyModification(OM,arguments)},greyscale:function(){return this._applyModification(FM,arguments)},spin:function(){return this._applyModification(VM,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(WM,arguments)},complement:function(){return this._applyCombination(GM,arguments)},monochromatic:function(){return this._applyCombination(XM,arguments)},splitcomplement:function(){return this._applyCombination(HM,arguments)},triad:function(){return this._applyCombination(Kp,[3])},tetrad:function(){return this._applyCombination(Kp,[4])}};Ee.fromRatio=function(n,e){if(il(n)=="object"){var t={};for(var i in n)n.hasOwnProperty(i)&&(i==="a"?t[i]=n[i]:t[i]=Rs(n[i]));n=t}return Ee(n,e)};function PM(n){var e={r:0,g:0,b:0},t=1,i=null,r=null,s=null,a=!1,o=!1;return typeof n=="string"&&(n=ZM(n)),il(n)=="object"&&(jn(n.r)&&jn(n.g)&&jn(n.b)?(e=IM(n.r,n.g,n.b),a=!0,o=String(n.r).substr(-1)==="%"?"prgb":"rgb"):jn(n.h)&&jn(n.s)&&jn(n.v)?(i=Rs(n.s),r=Rs(n.v),e=LM(n.h,i,r),a=!0,o="hsv"):jn(n.h)&&jn(n.s)&&jn(n.l)&&(i=Rs(n.s),s=Rs(n.l),e=DM(n.h,i,s),a=!0,o="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=em(t),{ok:a,format:n.format||o,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function IM(n,e,t){return{r:dt(n,255)*255,g:dt(e,255)*255,b:dt(t,255)*255}}function $p(n,e,t){n=dt(n,255),e=dt(e,255),t=dt(t,255);var i=Math.max(n,e,t),r=Math.min(n,e,t),s,a,o=(i+r)/2;if(i==r)s=a=0;else{var l=i-r;switch(a=o>.5?l/(2-i-r):l/(i+r),i){case n:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-n)/l+2;break;case t:s=(n-e)/l+4;break}s/=6}return{h:s,s:a,l:o}}function DM(n,e,t){var i,r,s;n=dt(n,360),e=dt(e,100),t=dt(t,100);function a(c,h,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?c+(h-c)*6*d:d<1/2?h:d<2/3?c+(h-c)*(2/3-d)*6:c}if(e===0)i=r=s=t;else{var o=t<.5?t*(1+e):t+e-t*e,l=2*t-o;i=a(l,o,n+1/3),r=a(l,o,n),s=a(l,o,n-1/3)}return{r:i*255,g:r*255,b:s*255}}function jp(n,e,t){n=dt(n,255),e=dt(e,255),t=dt(t,255);var i=Math.max(n,e,t),r=Math.min(n,e,t),s,a,o=i,l=i-r;if(a=i===0?0:l/i,i==r)s=0;else{switch(i){case n:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-n)/l+2;break;case t:s=(n-e)/l+4;break}s/=6}return{h:s,s:a,v:o}}function LM(n,e,t){n=dt(n,360)*6,e=dt(e,100),t=dt(t,100);var i=Math.floor(n),r=n-i,s=t*(1-e),a=t*(1-r*e),o=t*(1-(1-r)*e),l=i%6,c=[t,a,s,s,o,t][l],h=[o,t,t,a,s,s][l],d=[s,s,o,t,t,a][l];return{r:c*255,g:h*255,b:d*255}}function Zp(n,e,t,i){var r=[Sn(Math.round(n).toString(16)),Sn(Math.round(e).toString(16)),Sn(Math.round(t).toString(16))];return i&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function NM(n,e,t,i,r){var s=[Sn(Math.round(n).toString(16)),Sn(Math.round(e).toString(16)),Sn(Math.round(t).toString(16)),Sn(tm(i))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function Jp(n,e,t,i){var r=[Sn(tm(i)),Sn(Math.round(n).toString(16)),Sn(Math.round(e).toString(16)),Sn(Math.round(t).toString(16))];return r.join("")}Ee.equals=function(n,e){return!n||!e?!1:Ee(n).toRgbString()==Ee(e).toRgbString()};Ee.random=function(){return Ee.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function UM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.s-=e/100,t.s=rl(t.s),Ee(t)}function OM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.s+=e/100,t.s=rl(t.s),Ee(t)}function FM(n){return Ee(n).desaturate(100)}function BM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.l+=e/100,t.l=rl(t.l),Ee(t)}function kM(n,e){e=e===0?0:e||10;var t=Ee(n).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),Ee(t)}function zM(n,e){e=e===0?0:e||10;var t=Ee(n).toHsl();return t.l-=e/100,t.l=rl(t.l),Ee(t)}function VM(n,e){var t=Ee(n).toHsl(),i=(t.h+e)%360;return t.h=i<0?360+i:i,Ee(t)}function GM(n){var e=Ee(n).toHsl();return e.h=(e.h+180)%360,Ee(e)}function Kp(n,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=Ee(n).toHsl(),i=[Ee(n)],r=360/e,s=1;s<e;s++)i.push(Ee({h:(t.h+s*r)%360,s:t.s,l:t.l}));return i}function HM(n){var e=Ee(n).toHsl(),t=e.h;return[Ee(n),Ee({h:(t+72)%360,s:e.s,l:e.l}),Ee({h:(t+216)%360,s:e.s,l:e.l})]}function WM(n,e,t){e=e||6,t=t||30;var i=Ee(n).toHsl(),r=360/t,s=[Ee(n)];for(i.h=(i.h-(r*e>>1)+720)%360;--e;)i.h=(i.h+r)%360,s.push(Ee(i));return s}function XM(n,e){e=e||6;for(var t=Ee(n).toHsv(),i=t.h,r=t.s,s=t.v,a=[],o=1/e;e--;)a.push(Ee({h:i,s:r,v:s})),s=(s+o)%1;return a}Ee.mix=function(n,e,t){t=t===0?0:t||50;var i=Ee(n).toRgb(),r=Ee(e).toRgb(),s=t/100,a={r:(r.r-i.r)*s+i.r,g:(r.g-i.g)*s+i.g,b:(r.b-i.b)*s+i.b,a:(r.a-i.a)*s+i.a};return Ee(a)};Ee.readability=function(n,e){var t=Ee(n),i=Ee(e);return(Math.max(t.getLuminance(),i.getLuminance())+.05)/(Math.min(t.getLuminance(),i.getLuminance())+.05)};Ee.isReadable=function(n,e,t){var i=Ee.readability(n,e),r,s;switch(s=!1,r=JM(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=i>=4.5;break;case"AAlarge":s=i>=3;break;case"AAAsmall":s=i>=7;break}return s};Ee.mostReadable=function(n,e,t){var i=null,r=0,s,a,o,l;t=t||{},a=t.includeFallbackColors,o=t.level,l=t.size;for(var c=0;c<e.length;c++)s=Ee.readability(n,e[c]),s>r&&(r=s,i=Ee(e[c]));return Ee.isReadable(n,i,{level:o,size:l})||!a?i:(t.includeFallbackColors=!1,Ee.mostReadable(n,["#fff","#000"],t))};var bh=Ee.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},qM=Ee.hexNames=YM(bh);function YM(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function em(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function dt(n,e){$M(n)&&(n="100%");var t=jM(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function rl(n){return Math.min(1,Math.max(0,n))}function sn(n){return parseInt(n,16)}function $M(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function jM(n){return typeof n=="string"&&n.indexOf("%")!=-1}function Sn(n){return n.length==1?"0"+n:""+n}function Rs(n){return n<=1&&(n=n*100+"%"),n}function tm(n){return Math.round(parseFloat(n)*255).toString(16)}function Qp(n){return sn(n)/255}var Mn=(function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function jn(n){return!!Mn.CSS_UNIT.exec(n)}function ZM(n){n=n.replace(CM,"").replace(RM,"").toLowerCase();var e=!1;if(bh[n])n=bh[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Mn.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=Mn.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Mn.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=Mn.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Mn.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=Mn.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Mn.hex8.exec(n))?{r:sn(t[1]),g:sn(t[2]),b:sn(t[3]),a:Qp(t[4]),format:e?"name":"hex8"}:(t=Mn.hex6.exec(n))?{r:sn(t[1]),g:sn(t[2]),b:sn(t[3]),format:e?"name":"hex"}:(t=Mn.hex4.exec(n))?{r:sn(t[1]+""+t[1]),g:sn(t[2]+""+t[2]),b:sn(t[3]+""+t[3]),a:Qp(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Mn.hex3.exec(n))?{r:sn(t[1]+""+t[1]),g:sn(t[2]+""+t[2]),b:sn(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function JM(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function Eh(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function KM(n){if(Array.isArray(n))return n}function QM(n){if(Array.isArray(n))return Eh(n)}function cm(n,e,t){if(typeof n=="function"?n===e:n.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function eS(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function hm(n,e,t){return e=wr(e),lS(n,Ih()?Reflect.construct(e,t||[],wr(n).constructor):e.apply(n,t))}function tS(n,e){if(e.has(n))throw new TypeError("Cannot initialize the same private elements twice on an object")}function um(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Mh(n,e){return n.get(cm(n,e))}function nm(n,e,t){tS(n,e),e.set(n,t)}function im(n,e,t){return n.set(cm(n,e),t),t}function fm(n,e,t){if(Ih())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,e);var r=new(n.bind.apply(n,i));return r}function nS(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,mm(i.key),i)}}function dm(n,e,t){return e&&nS(n.prototype,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function ol(n,e,t){return(e=mm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ch(){return Ch=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(n,e,t){var i=cS(n,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?n:t):r.value}},Ch.apply(null,arguments)}function wr(n){return wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},wr(n)}function pm(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&Rh(n,e)}function Ih(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ih=function(){return!!n})()}function iS(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function rS(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,r,s,a,o=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e!==0)for(;!(l=(i=s.call(t)).done)&&(o.push(i.value),o.length!==e);l=!0);}catch(h){c=!0,r=h}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}function sS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4609
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aS(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4610
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rm(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function oS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rm(Object(t),!0).forEach(function(i){ol(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):rm(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function lS(n,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eS(n)}function Rh(n,e){return Rh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},Rh(n,e)}function Ds(n,e){return KM(n)||rS(n,e)||gm(n,e)||sS()}function cS(n,e){for(;!{}.hasOwnProperty.call(n,e)&&(n=wr(n))!==null;);return n}function Sh(n,e,t,i){var r=Ch(wr(n.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function wn(n){return QM(n)||iS(n)||gm(n)||aS()}function hS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function mm(n){var e=hS(n,"string");return typeof e=="symbol"?e:e+""}function Ph(n){"@babel/helpers - typeof";return Ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ph(n)}function gm(n,e){if(n){if(typeof n=="string")return Eh(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Eh(n,e):void 0}}var _m=function(e){e instanceof Array?e.forEach(_m):(e.map&&e.map.dispose(),e.dispose())},Dh=function(e){e.geometry&&e.geometry.dispose(),e.material&&_m(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Dh)},sm=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Dh(t)}},wh=new WeakMap,sl=new WeakMap,Ps=(function(n){function e(t){var i,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,a=s===void 0?"__data":s,o=r.objBindAttr,l=o===void 0?"__threeObj":o;return um(this,e),i=hm(this,e),ol(i,"scene",void 0),nm(i,wh,void 0),nm(i,sl,void 0),i.scene=t,im(wh,i,a),im(sl,i,l),i.onRemoveObj(function(){}),i}return pm(e,n),dm(e,[{key:"onCreateObj",value:function(i){var r=this;return Sh(e,"onCreateObj",this)([function(s){var a=i(s);return s[Mh(sl,r)]=a,a[Mh(wh,r)]=s,r.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(i){var r=this;return Sh(e,"onRemoveObj",this)([function(s,a){var o=Sh(e,"getData",r)([s]);i(s,a),r.scene.remove(s),Dh(s),delete o[Mh(sl,r)]}]),this}}])})(Xp),Is=function(e){return isNaN(e)?parseInt(Ee(e).toHex(),16):e},Th=function(e){return isNaN(e)?Ee(e).getAlpha():1},uS=Cs(yh);function am(n,e,t){!e||typeof t!="string"||n.filter(function(i){return!i[t]}).forEach(function(i){i[t]=uS(e(i))})}function fS(n,e){var t=n.nodes,i=n.links,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=r.nodeFilter,a=s===void 0?function(){return!0}:s,o=r.onLoopError,l=o===void 0?function(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:o,c={};t.forEach(function(p){return c[e(p)]={data:p,out:[],depth:-1,skip:!a(p)}}),i.forEach(function(p){var m=p.source,x=p.target,g=S(m),f=S(x);if(!c.hasOwnProperty(g))throw"Missing source node with id: ".concat(g);if(!c.hasOwnProperty(f))throw"Missing target node with id: ".concat(f);var v=c[g],M=c[f];v.out.push(M);function S(w){return Ph(w)==="object"?e(w):w}});var h=[];u(Object.values(c));var d=Object.assign.apply(Object,[{}].concat(wn(Object.entries(c).filter(function(p){var m=Ds(p,2),x=m[1];return!x.skip}).map(function(p){var m=Ds(p,2),x=m[0],g=m[1];return ol({},x,g.depth)}))));return d;function u(p){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,g=function(){var S=p[f];if(m.indexOf(S)!==-1){var w=[].concat(wn(m.slice(m.indexOf(S))),[S]).map(function(y){return e(y.data)});return h.some(function(y){return y.length===w.length&&y.every(function(A,_){return A===w[_]})})||(h.push(w),l(w)),1}x>S.depth&&(S.depth=x,u(S.out,[].concat(wn(m),[S]),x+(S.skip?0:1)))},f=0,v=p.length;f<v;f++)g()}}var Ne=window.THREE?window.THREE:{Group:Rn,Mesh:Xt,MeshLambertMaterial:Jr,Color:Xe,BufferGeometry:Ot,BufferAttribute:zt,Matrix4:ct,Vector3:U,SphereGeometry:jr,CylinderGeometry:or,TubeGeometry:Zr,ConeGeometry:qr,Line:Hr,LineBasicMaterial:sr,QuadraticBezierCurve3:Ri,CubicBezierCurve3:lr,Box3:In},om={graph:$d,forcelayout:lm.default},dS=2,Ah=new Ne.BufferGeometry().setAttribute?"setAttribute":"addAttribute",al=new Ne.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",pS=Vp({props:{jsonUrl:{onChange:function(e,t){var i=this;e&&!t.fetchingJson&&(t.fetchingJson=!0,t.onLoading(),fetch(e).then(function(r){return r.json()}).then(function(r){t.fetchingJson=!1,t.onFinishLoading(r),i.graphData(r)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(e,t){t.engineRunning=!1}},numDimensions:{default:3,onChange:function(e,t){var i=t.d3ForceLayout.force("charge");i&&i.strength(e>2?-60:-30),e<3&&r(t.graphData.nodes,"z"),e<2&&r(t.graphData.nodes,"y");function r(s,a){s.forEach(function(o){delete o[a],delete o["v".concat(a)]})}}},dagMode:{onChange:function(e,t){!e&&t.forceEngine==="d3"&&(t.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=i.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(e){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaDecay(e)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaTarget(e)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.velocityDecay(e)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(e){return e._flushObjects=!0,e._rerender(),this},d3Force:function(e,t,i){return i===void 0?e.d3ForceLayout.force(t):(e.d3ForceLayout.force(t,i),this)},d3ReheatSimulation:function(e){return e.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(e){return e.cntTicks=0,e.startTickTime=new Date,e.engineRunning=!0,this},tickFrame:function(e){var t=e.forceEngine!=="ngraph";return e.engineRunning&&i(),r(),s(),this;function i(){++e.cntTicks>e.cooldownTicks||new Date-e.startTickTime>e.cooldownTime||t&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin?(e.engineRunning=!1,e.onEngineStop()):(e.layout[t?"tick":"step"](),e.onEngineTick());var a=je(e.nodeThreeObjectExtend);e.nodeDataMapper.entries().forEach(function(u){var p=Ds(u,2),m=p[0],x=p[1];if(x){var g=t?m:e.layout.getNodePosition(m[e.nodeId]),f=a(m);(!e.nodePositionUpdate||!e.nodePositionUpdate(f?x.children[0]:x,{x:g.x,y:g.y,z:g.z},m)||f)&&(x.position.x=g.x,x.position.y=g.y||0,x.position.z=g.z||0)}});var o=je(e.linkWidth),l=je(e.linkCurvature),c=je(e.linkCurveRotation),h=je(e.linkThreeObjectExtend);e.linkDataMapper.entries().forEach(function(u){var p=Ds(u,2),m=p[0],x=p[1];if(x){var g=t?m:e.layout.getLinkPosition(e.layout.graph.getLink(m.source,m.target).id),f=g[t?"source":"from"],v=g[t?"target":"to"];if(!(!f||!v||!f.hasOwnProperty("x")||!v.hasOwnProperty("x"))){d(m);var M=h(m);if(!(e.linkPositionUpdate&&e.linkPositionUpdate(M?x.children[1]:x,{start:{x:f.x,y:f.y,z:f.z},end:{x:v.x,y:v.y,z:v.z}},m)&&!M)){var S=30,w=m.__curve,y=x.children.length?x.children[0]:x;if(y.type==="Line"){if(w){var _=w.getPoints(S);y.geometry.getAttribute("position").array.length!==_.length*3&&y.geometry[Ah]("position",new Ne.BufferAttribute(new Float32Array(_.length*3),3)),y.geometry.setFromPoints(_)}else{var A=y.geometry.getAttribute("position");(!A||!A.array||A.array.length!==6)&&y.geometry[Ah]("position",A=new Ne.BufferAttribute(new Float32Array(6),3)),A.array[0]=f.x,A.array[1]=f.y||0,A.array[2]=f.z||0,A.array[3]=v.x,A.array[4]=v.y||0,A.array[5]=v.z||0,A.needsUpdate=!0}y.geometry.computeBoundingSphere()}else if(y.type==="Mesh")if(w){y.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(y.position.set(0,0,0),y.rotation.set(0,0,0),y.scale.set(1,1,1));var R=Math.ceil(o(m)*10)/10,L=R/2,k=new Ne.TubeGeometry(w,S,L,e.linkResolution,!1);y.geometry.dispose(),y.geometry=k}else{if(!y.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var C=Math.ceil(o(m)*10)/10,D=C/2,P=new Ne.CylinderGeometry(D,D,1,e.linkResolution,1,!1);P[al](new Ne.Matrix4().makeTranslation(0,1/2,0)),P[al](new Ne.Matrix4().makeRotationX(Math.PI/2)),y.geometry.dispose(),y.geometry=P}var N=new Ne.Vector3(f.x,f.y||0,f.z||0),V=new Ne.Vector3(v.x,v.y||0,v.z||0),I=N.distanceTo(V);y.position.x=N.x,y.position.y=N.y,y.position.z=N.z,y.scale.z=I,y.parent.localToWorld(V),y.lookAt(V)}}}}});function d(u){var p=t?u:e.layout.getLinkPosition(e.layout.graph.getLink(u.source,u.target).id),m=p[t?"source":"from"],x=p[t?"target":"to"];if(!(!m||!x||!m.hasOwnProperty("x")||!x.hasOwnProperty("x"))){var g=l(u);if(!g)u.__curve=null;else{var f=new Ne.Vector3(m.x,m.y||0,m.z||0),v=new Ne.Vector3(x.x,x.y||0,x.z||0),M=f.distanceTo(v),S,w=c(u);if(M>0){var y=x.x-m.x,A=x.y-m.y||0,_=new Ne.Vector3().subVectors(v,f),C=_.clone().multiplyScalar(g).cross(y!==0||A!==0?new Ne.Vector3(0,0,1):new Ne.Vector3(0,1,0)).applyAxisAngle(_.normalize(),w).add(new Ne.Vector3().addVectors(f,v).divideScalar(2));S=new Ne.QuadraticBezierCurve3(f,C,v)}else{var D=g*70,P=-w,N=P+Math.PI/2;S=new Ne.CubicBezierCurve3(f,new Ne.Vector3(D*Math.cos(N),D*Math.sin(N),0).add(f),new Ne.Vector3(D*Math.cos(P),D*Math.sin(P),0).add(f),v)}u.__curve=S}}}}function r(){var a=je(e.linkDirectionalArrowRelPos),o=je(e.linkDirectionalArrowLength),l=je(e.nodeVal);e.arrowDataMapper.entries().forEach(function(c){var h=Ds(c,2),d=h[0],u=h[1];if(u){var p=t?d:e.layout.getLinkPosition(e.layout.graph.getLink(d.source,d.target).id),m=p[t?"source":"from"],x=p[t?"target":"to"];if(!(!m||!x||!m.hasOwnProperty("x")||!x.hasOwnProperty("x"))){var g=Math.cbrt(Math.max(0,l(m)||1))*e.nodeRelSize,f=Math.cbrt(Math.max(0,l(x)||1))*e.nodeRelSize,v=o(d),M=a(d),S=d.__curve?function(D){return d.__curve.getPoint(D)}:function(D){var P=function(V,I,R,L){return I[V]+(R[V]-I[V])*L||0};return{x:P("x",m,x,D),y:P("y",m,x,D),z:P("z",m,x,D)}},w=d.__curve?d.__curve.getLength():Math.sqrt(["x","y","z"].map(function(D){return Math.pow((x[D]||0)-(m[D]||0),2)}).reduce(function(D,P){return D+P},0)),y=g+v+(w-g-f-v)*M,A=S(y/w),_=S((y-v)/w);["x","y","z"].forEach(function(D){return u.position[D]=_[D]});var C=fm(Ne.Vector3,wn(["x","y","z"].map(function(D){return A[D]})));u.parent.localToWorld(C),u.lookAt(C)}}})}function s(){var a=je(e.linkDirectionalParticleSpeed),o=je(e.linkDirectionalParticleOffset);e.graphData.links.forEach(function(l){var c=e.particlesDataMapper.getObj(l),h=c&&c.children,d=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!d||!d.length)&&(!h||!h.length))){var u=t?l:e.layout.getLinkPosition(e.layout.graph.getLink(l.source,l.target).id),p=u[t?"source":"from"],m=u[t?"target":"to"];if(!(!p||!m||!p.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var x=a(l),g=Math.abs(o(l)),f=l.__curve?function(M){return l.__curve.getPoint(M)}:function(M){var S=function(y,A,_,C){return A[y]+(_[y]-A[y])*C||0};return{x:S("x",p,m,M),y:S("y",p,m,M),z:S("z",p,m,M)}},v=[].concat(wn(h||[]),wn(d||[]));v.forEach(function(M,S){var w=M.parent.__linkThreeObjType==="singleHopPhotons";if(M.hasOwnProperty("__progressRatio")||(M.__progressRatio=w?x<0?1:0:(S+g)/h.length),M.__progressRatio+=x,M.__progressRatio>=1||M.__progressRatio<0)if(!w)M.__progressRatio=M.__progressRatio%1,M.__progressRatio<0&&M.__progressRatio++;else{M.parent.remove(M),sm(M);return}var y=M.__progressRatio,A=f(y);M.geometry.type!=="SphereGeometry"&&M.lookAt(A.x,A.y,A.z),["x","y","z"].forEach(function(_){return M.position[_]=A[_]})})}}})}},emitParticle:function(e,t){if(t&&e.graphData.links.includes(t)){if(!t.__singleHopPhotonsObj){var i=new Ne.Group;i.__linkThreeObjType="singleHopPhotons",t.__singleHopPhotonsObj=i,e.graphScene.add(i)}var r=je(e.linkDirectionalParticleThreeObject)(t);if(r&&e.linkDirectionalParticleThreeObject===r&&(r=r.clone()),!r){var s=je(e.linkDirectionalParticleWidth),a=Math.ceil(s(t)*10)/10/2,o=e.linkDirectionalParticleResolution,l=new Ne.SphereGeometry(a,o,o),c=je(e.linkColor),h=je(e.linkDirectionalParticleColor),d=h(t)||c(t)||"#f0f0f0",u=new Ne.Color(Is(d)),p=e.linkOpacity*3,m=new Ne.MeshLambertMaterial({color:u,transparent:!0,opacity:p});r=new Ne.Mesh(l,m)}t.__singleHopPhotonsObj.add(r)}return this},getGraphBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!e.initialised)return null;var i=(function r(s){var a=[];if(s.geometry){s.geometry.computeBoundingBox();var o=new Ne.Box3;o.copy(s.geometry.boundingBox).applyMatrix4(s.matrixWorld),a.push(o)}return a.concat.apply(a,wn((s.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&t(l.__data)}).map(r)))})(e.graphScene);return i.length?Object.assign.apply(Object,wn(["x","y","z"].map(function(r){return ol({},r,[tl(i,function(s){return s.min[r]}),el(i,function(s){return s.max[r]})])}))):null}},stateInit:function(){return{d3ForceLayout:Qc().force("link",Yc()).force("charge",eh()).force("center",Hc()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(e,t){t.graphScene=e,t.nodeDataMapper=new Ps(e,{objBindAttr:"__threeObj"}),t.linkDataMapper=new Ps(e,{objBindAttr:"__lineObj"}),t.arrowDataMapper=new Ps(e,{objBindAttr:"__arrowObj"}),t.particlesDataMapper=new Ps(e,{objBindAttr:"__photonsObj"})},update:function(e,t){var i=function(z){return z.some(function($){return t.hasOwnProperty($)})};if(e.engineRunning=!1,typeof e.onUpdate=="function"&&e.onUpdate(),e.nodeAutoColorBy!==null&&i(["nodeAutoColorBy","graphData","nodeColor"])&&am(e.graphData.nodes,je(e.nodeAutoColorBy),e.nodeColor),e.linkAutoColorBy!==null&&i(["linkAutoColorBy","graphData","linkColor"])&&am(e.graphData.links,je(e.linkAutoColorBy),e.linkColor),e._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var r=je(e.nodeThreeObject),s=je(e.nodeThreeObjectExtend),a=je(e.nodeVal),o=je(e.nodeColor),l=je(e.nodeVisibility),c={},h={};(e._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]))&&e.nodeDataMapper.clear(),e.nodeDataMapper.onCreateObj(function(Y){var z=r(Y),$=s(Y);z&&e.nodeThreeObject===z&&(z=z.clone());var te;return z&&!$?te=z:(te=new Ne.Mesh,te.__graphDefaultObj=!0,z&&$&&te.add(z)),te.__graphObjType="node",te}).onUpdateObj(function(Y,z){if(Y.__graphDefaultObj){var $=a(z)||1,te=Math.cbrt($)*e.nodeRelSize,ve=e.nodeResolution;(!Y.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||Y.geometry.parameters.radius!==te||Y.geometry.parameters.widthSegments!==ve)&&(c.hasOwnProperty($)||(c[$]=new Ne.SphereGeometry(te,ve,ve)),Y.geometry.dispose(),Y.geometry=c[$]);var Me=o(z),xe=new Ne.Color(Is(Me||"#ffffaa")),Ze=e.nodeOpacity*Th(Me);(Y.material.type!=="MeshLambertMaterial"||!Y.material.color.equals(xe)||Y.material.opacity!==Ze)&&(h.hasOwnProperty(Me)||(h[Me]=new Ne.MeshLambertMaterial({color:xe,transparent:!0,opacity:Ze})),Y.material.dispose(),Y.material=h[Me])}}).digest(e.graphData.nodes.filter(l))}if(e._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var d=je(e.linkThreeObject),u=je(e.linkThreeObjectExtend),p=je(e.linkMaterial),m=je(e.linkVisibility),x=je(e.linkColor),g=je(e.linkWidth),f={},v={},M={},S=e.graphData.links.filter(m);if((e._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&e.linkDataMapper.clear(),e.linkDataMapper.onRemoveObj(function(Y){var z=Y.__data&&Y.__data.__singleHopPhotonsObj;z&&(z.parent.remove(z),sm(z),delete Y.__data.__singleHopPhotonsObj)}).onCreateObj(function(Y){var z=d(Y),$=u(Y);z&&e.linkThreeObject===z&&(z=z.clone());var te;if(!z||$){var ve=!!g(Y);if(ve)te=new Ne.Mesh;else{var Me=new Ne.BufferGeometry;Me[Ah]("position",new Ne.BufferAttribute(new Float32Array(6),3)),te=new Ne.Line(Me)}}var xe;return z?$?(xe=new Ne.Group,xe.__graphDefaultObj=!0,xe.add(te),xe.add(z)):xe=z:(xe=te,xe.__graphDefaultObj=!0),xe.renderOrder=10,xe.__graphObjType="link",xe}).onUpdateObj(function(Y,z){if(Y.__graphDefaultObj){var $=Y.children.length?Y.children[0]:Y,te=Math.ceil(g(z)*10)/10,ve=!!te;if(ve){var Me=te/2,xe=e.linkResolution;if(!$.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||$.geometry.parameters.radiusTop!==Me||$.geometry.parameters.radialSegments!==xe){if(!f.hasOwnProperty(te)){var Ze=new Ne.CylinderGeometry(Me,Me,1,xe,1,!1);Ze[al](new Ne.Matrix4().makeTranslation(0,1/2,0)),Ze[al](new Ne.Matrix4().makeRotationX(Math.PI/2)),f[te]=Ze}$.geometry.dispose(),$.geometry=f[te]}}var Ue=p(z);if(Ue)$.material=Ue;else{var qe=x(z),Qe=new Ne.Color(Is(qe||"#f0f0f0")),Oe=e.linkOpacity*Th(qe),it=ve?"MeshLambertMaterial":"LineBasicMaterial";if($.material.type!==it||!$.material.color.equals(Qe)||$.material.opacity!==Oe){var nt=ve?v:M;nt.hasOwnProperty(qe)||(nt[qe]=new Ne[it]({color:Qe,transparent:Oe<1,opacity:Oe,depthWrite:Oe>=1})),$.material.dispose(),$.material=nt[qe]}}}}).digest(S),e.linkDirectionalArrowLength||t.hasOwnProperty("linkDirectionalArrowLength")){var w=je(e.linkDirectionalArrowLength),y=je(e.linkDirectionalArrowColor);e.arrowDataMapper.onCreateObj(function(){var Y=new Ne.Mesh(void 0,new Ne.MeshLambertMaterial({transparent:!0}));return Y.__linkThreeObjType="arrow",Y}).onUpdateObj(function(Y,z){var $=w(z),te=e.linkDirectionalArrowResolution;if(!Y.geometry.type.match(/^Cone(Buffer)?Geometry$/)||Y.geometry.parameters.height!==$||Y.geometry.parameters.radialSegments!==te){var ve=new Ne.ConeGeometry($*.25,$,te);ve.translate(0,$/2,0),ve.rotateX(Math.PI/2),Y.geometry.dispose(),Y.geometry=ve}var Me=y(z)||x(z)||"#f0f0f0";Y.material.color=new Ne.Color(Is(Me)),Y.material.opacity=e.linkOpacity*3*Th(Me)}).digest(S.filter(w))}if(e.linkDirectionalParticles||t.hasOwnProperty("linkDirectionalParticles")){var A=je(e.linkDirectionalParticles),_=je(e.linkDirectionalParticleWidth),C=je(e.linkDirectionalParticleColor),D=je(e.linkDirectionalParticleThreeObject),P={},N={};e.particlesDataMapper.onCreateObj(function(){var Y=new Ne.Group;return Y.__linkThreeObjType="photons",Y.__photonDataMapper=new Ps(Y),Y}).onUpdateObj(function(Y,z){var $=!!Y.children.length&&Y.children[0],te=D(z),ve,Me;if(te)ve=te.geometry,Me=te.material;else{var xe=Math.ceil(_(z)*10)/10/2,Ze=e.linkDirectionalParticleResolution;$&&$.geometry.parameters.radius===xe&&$.geometry.parameters.widthSegments===Ze?ve=$.geometry:(N.hasOwnProperty(xe)||(N[xe]=new Ne.SphereGeometry(xe,Ze,Ze)),ve=N[xe]);var Ue=C(z)||x(z)||"#f0f0f0",qe=new Ne.Color(Is(Ue)),Qe=e.linkOpacity*3;$&&$.material.color.equals(qe)&&$.material.opacity===Qe?Me=$.material:(P.hasOwnProperty(Ue)||(P[Ue]=new Ne.MeshLambertMaterial({color:qe,transparent:!0,opacity:Qe})),Me=P[Ue])}$&&($.geometry!==ve&&$.geometry.dispose(),$.material!==Me&&$.material.dispose());var Oe=Math.round(Math.abs(A(z)));Y.__photonDataMapper.id(function(it){return it.idx}).onCreateObj(function(){return new Ne.Mesh(ve,Me)}).onUpdateObj(function(it){it.geometry=ve,it.material=Me}).digest(wn(new Array(Oe)).map(function(it,nt){return{idx:nt}}))}).digest(S.filter(A))}}if(e._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){e.engineRunning=!1,e.graphData.links.forEach(function(Y){Y.source=Y[e.linkSource],Y.target=Y[e.linkTarget]});var V=e.forceEngine!=="ngraph",I;if(V){(I=e.d3ForceLayout).stop().alpha(1).numDimensions(e.numDimensions).nodes(e.graphData.nodes);var R=e.d3ForceLayout.force("link");R&&R.id(function(Y){return Y[e.nodeId]}).links(e.graphData.links);var L=e.dagMode&&fS(e.graphData,function(Y){return Y[e.nodeId]},{nodeFilter:e.dagNodeFilter,onLoopError:e.onDagError||void 0}),k=Math.max.apply(Math,wn(Object.values(L||[]))),ee=e.dagLevelDistance||e.graphData.nodes.length/(k||1)*dS*(["radialin","radialout"].indexOf(e.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var ne=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(Y){return delete Y[ne]})}if(["lr","rl","td","bu","zin","zout"].includes(e.dagMode)){var he=["rl","td","zout"].includes(e.dagMode),q=function(z){return(L[z[e.nodeId]]-k/2)*ee*(he?-1:1)},J=["lr","rl"].includes(e.dagMode)?"fx":["td","bu"].includes(e.dagMode)?"fy":"fz";e.graphData.nodes.filter(e.dagNodeFilter).forEach(function(Y){return Y[J]=q(Y)})}e.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(e.dagMode)!==-1?th(function(Y){var z=L[Y[e.nodeId]]||-1;return(e.dagMode==="radialin"?k-z:z)*ee}).strength(function(Y){return e.dagNodeFilter(Y)?1:0}):null)}else{var fe=om.graph();e.graphData.nodes.forEach(function(Y){fe.addNode(Y[e.nodeId])}),e.graphData.links.forEach(function(Y){fe.addLink(Y.source,Y.target)}),I=om.forcelayout(fe,oS({dimensions:e.numDimensions},e.ngraphPhysics)),I.graph=fe}for(var De=0;De<e.warmupTicks&&!(V&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()<e.d3AlphaMin);De++)I[V?"tick":"step"]();e.layout=I,this.resetCountdown()}e.engineRunning=!0,e.onFinishUpdate()}});function mS(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=(function(r){function s(){var a;um(this,s);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return a=hm(this,s,[].concat(l)),a.__kapsuleInstance=fm(n,[].concat(wn(t?[a]:[]),l)),a}return pm(s,r),dm(s)})(e);return Object.keys(n()).forEach(function(r){return i.prototype[r]=function(){var s,a=(s=this.__kapsuleInstance)[r].apply(s,arguments);return a===this.__kapsuleInstance?this:a}}),i}var gS=window.THREE?window.THREE:{Group:Rn},xm=mS(pS,gS.Group,!0);var vm={type:"change"},Nh={type:"start"},bm={type:"end"},ll=new oi,ym=new ln,_S=Math.cos(70*_c.DEG2RAD),Tt=new U,$t=2*Math.PI,at={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Lh=1e-6,cl=class extends rs{constructor(e,t=null){super(e,t),this.state=at.NONE,this.target=new U,this.cursor=new U,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:ui.ROTATE,MIDDLE:ui.DOLLY,RIGHT:ui.PAN},this.touches={ONE:fi.ROTATE,TWO:fi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new U,this._lastQuaternion=new en,this._lastTargetPosition=new U,this._quat=new en().setFromUnitVectors(e.up,new U(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new hr,this._sphericalDelta=new hr,this._scale=1,this._panOffset=new U,this._rotateStart=new Te,this._rotateEnd=new Te,this._rotateDelta=new Te,this._panStart=new Te,this._panEnd=new Te,this._panDelta=new Te,this._dollyStart=new Te,this._dollyEnd=new Te,this._dollyDelta=new Te,this._dollyDirection=new U,this._mouse=new Te,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=vS.bind(this),this._onPointerDown=xS.bind(this),this._onPointerUp=yS.bind(this),this._onContextMenu=ES.bind(this),this._onMouseWheel=SS.bind(this),this._onKeyDown=wS.bind(this),this._onTouchStart=TS.bind(this),this._onTouchMove=AS.bind(this),this._onMouseDown=bS.bind(this),this._onMouseMove=MS.bind(this),this._interceptControlDown=CS.bind(this),this._interceptControlUp=RS.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(vm),this.update(),this.state=at.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;Tt.copy(t).sub(this.target),Tt.applyQuaternion(this._quat),this._spherical.setFromVector3(Tt),this.autoRotate&&this.state===at.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(i)&&isFinite(r)&&(i<-Math.PI?i+=$t:i>Math.PI&&(i-=$t),r<-Math.PI?r+=$t:r>Math.PI&&(r-=$t),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(Tt.setFromSpherical(this._spherical),Tt.applyQuaternion(this._quatInverse),t.copy(this.target).add(Tt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let a=null;if(this.object.isPerspectiveCamera){let o=Tt.length();a=this._clampDistance(o*this._scale);let l=o-a;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let o=new U(this._mouse.x,this._mouse.y,0);o.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new U(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),a=Tt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;a!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(a).add(this.object.position):(ll.origin.copy(this.object.position),ll.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ll.direction))<_S?this.object.lookAt(this.target):(ym.setFromNormalAndCoplanarPoint(this.object.up,this.target),ll.intersectPlane(ym,this.target))))}else if(this.object.isOrthographicCamera){let a=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),a!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>Lh||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Lh||this._lastTargetPosition.distanceToSquared(this.target)>Lh?(this.dispatchEvent(vm),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?$t/60*this.autoRotateSpeed*e:$t/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Tt.setFromMatrixColumn(t,0),Tt.multiplyScalar(-e),this._panOffset.add(Tt)}_panUp(e,t){this.screenSpacePanning===!0?Tt.setFromMatrixColumn(t,1):(Tt.setFromMatrixColumn(t,0),Tt.crossVectors(this.object.up,Tt)),Tt.multiplyScalar(e),this._panOffset.add(Tt)}_pan(e,t){let i=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;Tt.copy(r).sub(this.target);let s=Tt.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*t*s/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let i=this.domElement.getBoundingClientRect(),r=e-i.left,s=t-i.top,a=i.width,o=i.height;this._mouse.x=r/a*2-1,this._mouse.y=-(s/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft($t*this._rotateDelta.x/t.clientHeight),this._rotateUp($t*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp($t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-$t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft($t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-$t*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let i=this._getSecondPointerPosition(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft($t*this._rotateDelta.x/t.clientHeight),this._rotateUp($t*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Te,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}};function xS(n){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(n.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(n)&&(this._addPointer(n),n.pointerType==="touch"?this._onTouchStart(n):this._onMouseDown(n),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function vS(n){this.enabled!==!1&&(n.pointerType==="touch"?this._onTouchMove(n):this._onMouseMove(n))}function yS(n){switch(this._removePointer(n),this._pointers.length){case 0:this.domElement.releasePointerCapture(n.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(bm),this.state=at.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function bS(n){let e;switch(n.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case ui.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(n),this.state=at.DOLLY;break;case ui.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=at.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=at.ROTATE}break;case ui.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(n),this.state=at.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(n),this.state=at.PAN}break;default:this.state=at.NONE}this.state!==at.NONE&&this.dispatchEvent(Nh)}function MS(n){switch(this.state){case at.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(n);break;case at.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(n);break;case at.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(n);break}}function SS(n){this.enabled===!1||this.enableZoom===!1||this.state!==at.NONE||(n.preventDefault(),this.dispatchEvent(Nh),this._handleMouseWheel(this._customWheelEvent(n)),this.dispatchEvent(bm))}function wS(n){this.enabled!==!1&&this._handleKeyDown(n)}function TS(n){switch(this._trackPointer(n),this._pointers.length){case 1:switch(this.touches.ONE){case fi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(n),this.state=at.TOUCH_ROTATE;break;case fi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(n),this.state=at.TOUCH_PAN;break;default:this.state=at.NONE}break;case 2:switch(this.touches.TWO){case fi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(n),this.state=at.TOUCH_DOLLY_PAN;break;case fi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(n),this.state=at.TOUCH_DOLLY_ROTATE;break;default:this.state=at.NONE}break;default:this.state=at.NONE}this.state!==at.NONE&&this.dispatchEvent(Nh)}function AS(n){switch(this._trackPointer(n),this.state){case at.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(n),this.update();break;case at.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(n),this.update();break;case at.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(n),this.update();break;case at.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(n),this.update();break;default:this.state=at.NONE}}function ES(n){this.enabled!==!1&&n.preventDefault()}function CS(n){n.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function RS(n){n.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var Sm={markdown_document:"#e8b4b8",markdown_section:"#d99ba0",prisma_model:"#b8a3e8",prisma_column:"#a08fd0",prisma_relation:"#8a76c0",swagger_operation:"#e8d9a0",module:"#d0d7de",class:"#36e2ee",interface:"#6ea8ff",function:"#3fb950",method:"#2bb673",type:"#f5b042",enum:"#c792ea",variable:"#8b97a8"},Uh={"value-call":"#3fb950","type-ref":"#f5b042","doc-ref":"#c07de0",heritage:"#6ea8ff",exports:"#7d8590"},wm="#565f6b",Tm="#ffffff55",Mm=new WeakSet;function Am(n){let e=n.getElementById("legend");e===null||Mm.has(e)||(Mm.add(e),e.prepend(...Object.entries(Uh).map(([t,i])=>{let r=n.createElement("span");r.className="dot";let s=n.createElement("span");return s.className="swatch",s.style.background=i,r.append(s,t),r})))}function Oh(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Em(n,e){let t=document.getElementById(n);t&&(t.textContent=e)}async function PS(){Am(document);let n=document.getElementById("graph");if(!n)return;let e;try{let v=await fetch("graph.json");if(!v.ok)throw new Error(`HTTP ${v.status}`);e=await v.json()}catch(v){n.textContent=`could not load the graph (${String(v)})`;return}e.project&&Em("project",e.project),Em("counts",`${e.nodes.length.toLocaleString()} nodes \xB7 ${e.links.length.toLocaleString()} edges`);let t=n.clientWidth||800,i=n.clientHeight||600,r=new kr;r.background=new Xe(658448),r.add(new ns(16777215,2));let s=new ts(16777215,.8);s.position.set(1,1,1),r.add(s);let a=new Nt(50,t/i,.1,1e6);a.position.set(0,0,320);let o=new Vo({antialias:!0});o.setPixelRatio(Math.min(window.devicePixelRatio,2)),o.setSize(t,i),n.appendChild(o.domElement);let l=new cl(a,o.domElement);l.enableDamping=!0,l.dampingFactor=.18;let c=new xm().nodeId("id").nodeRelSize(4).nodeResolution(12).nodeOpacity(.95).nodeVal(v=>1+Math.sqrt(v.degree)).nodeColor(v=>Sm[v.kind]??wm).linkColor(v=>Uh[v.kind]??Tm).linkOpacity(.4).linkWidth(0).warmupTicks(20).cooldownTicks(160);r.add(c);let h=()=>{let v=c.getGraphBbox();if(!v)return;let M=(v.x[0]+v.x[1])/2,S=(v.y[0]+v.y[1])/2,w=(v.z[0]+v.z[1])/2,A=Math.max((v.x[1]-v.x[0])/2,(v.y[1]-v.y[0])/2,(v.z[1]-v.z[0])/2,10)*2.6;a.position.set(M+A*.5,S+A*.32,w+A*.8),a.near=Math.max(.1,A/200),a.far=A*20,a.updateProjectionMatrix(),l.target.set(M,S,w),l.update()},d=new URLSearchParams(window.location.search).has("static"),u=-1,p=0;c.onEngineStop(()=>{h(),d&&u<0&&(u=p+4)});let m=document.createElement("div");m.className="tooltip",n.appendChild(m);let x=new is,g=new Te;o.domElement.addEventListener("pointermove",v=>{let M=o.domElement.getBoundingClientRect();g.x=(v.clientX-M.left)/M.width*2-1,g.y=-((v.clientY-M.top)/M.height)*2+1,x.setFromCamera(g,a);let S=x.intersectObjects(c.children,!0),w=null;for(let y of S){let A=y.object;for(;A;){let _=A;if(_.__graphObjType==="node"&&_.__data){w=_.__data;break}A=A.parent}if(w)break}if(!w){m.style.display="none";return}m.style.display="block",m.style.left=`${v.clientX-M.left+12}px`,m.style.top=`${v.clientY-M.top+12}px`,m.innerHTML=`${Oh(w.name)}<br/><span class="muted">${Oh(w.kind)} \xB7 ${Oh(w.file)}</span>`}),o.domElement.addEventListener("pointerleave",()=>{m.style.display="none"});let f=()=>{if(u>=0&&p>u){o.render(r,a);return}requestAnimationFrame(f),c.tickFrame(),l.update(),o.render(r,a),p++};f(),window.addEventListener("resize",()=>{let v=n.clientWidth||t,M=n.clientHeight||i;a.aspect=v/M,a.updateProjectionMatrix(),o.setSize(v,M)}),c.graphData({nodes:e.nodes,links:e.links}),window.setTimeout(h,700)}PS();})();
|