plebeiangraphlibrary 2.2.0 → 2.2.2
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/Build/Core/Edge.d.ts +6 -2
- package/Build/Core/Graph.d.ts +31 -13
- package/Build/Core/_Node.d.ts +2 -2
- package/Build/HelperClasses/Point.d.ts +6 -0
- package/Build/SampleData/DataLoader.d.ts +1 -0
- package/Build/dwt_1005-C-ThS_oR.js +2 -0
- package/Build/dwt_1005-C-ThS_oR.js.map +1 -0
- package/Build/dwt_1005-C8KXz1aw.mjs +2621 -0
- package/Build/dwt_1005-C8KXz1aw.mjs.map +1 -0
- package/Build/index.d.ts +2 -1
- package/Build/pgl.js +162 -162
- package/Build/pgl.js.map +1 -1
- package/Build/pgl_module.js +1360 -3939
- package/Build/pgl_module.js.map +1 -1
- package/CHANGELOG.md +30 -0
- package/Examples/4_ToggleActivation.html +1 -1
- package/README.md +3 -3
- package/package.json +8 -1
package/Build/pgl.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class gn{constructor(e,n,i){this.start=e,this.end=n,this.data={...i}}}class jt{constructor(e,n){this.nodes=e,this.edges=n}printData(){const e="This is a graph with "+this.nodes.size+" nodes and "+this.edges.size+" edges";console.log(e)}async initialize(){await this.constructAdjacencyList()}static async create(e,n){const i=new jt(e,n);return await i.initialize(),i}async constructAdjacencyList(){this.edges.forEach(e=>{const n=e.start,i=e.end;this.nodes.get(n)&&this.nodes.get(n).neighbours.push(i),this.nodes.get(i)&&this.nodes.get(i).neighbours.push(n)});for(const e of this.nodes.keys()){const n=this.nodes.get(e).neighbours,i=[...new Set(n)],r=i.indexOf(e);r>-1&&i.splice(r,1),this.nodes.get(e).neighbours=i}}add_node(e,n){this.nodes.set(e,n)}add_edge(e,n,i){const r=new gn(e,n,i);this.edges.set(this.edges.size,r);const s=this.nodes.get(e),a=this.nodes.get(n);s&&s.neighbours.push(n),a&&a.neighbours.push(e)}get_adjacency(){const e=new Map;for(const n of this.nodes.keys())e.set(n,this.nodes.get(n).neighbours);return e}apply_position_map(e){for(let n of e.keys())this.nodes.get(n).data={...this.nodes.get(n).data,pos:e.get(n)}}apply_edge_pos_maps(e){for(let n of e.keys())this.edges.get(n).data={...this.edges.get(n).data,ldata:e.get(n)}}get_edge_map(){const e=new Map;for(const n of this.edges.keys()){const i=this.edges.get(n).data.ldata;i!=null&&e.set(n,i)}return e}apply_drawing_maps(e){e.pmap&&this.apply_position_map(e.pmap),e.emap&&this.apply_edge_pos_maps(e.emap)}get_map(){return{pmap:this.get_position_map(),emap:this.get_edge_map()}}get_position_map(){const e=new Map;for(const n of this.nodes.keys())e.set(n,this.nodes.get(n).data.pos);return e}get_node_ids_order(){return Array.from(this.nodes.keys())}get_adjacency_matrix(){const e=this.get_node_ids_order(),n=e.length,i=new Float32Array(n*n),r=this.get_adjacency(),s=new Map;e.forEach((a,o)=>s.set(a,o));for(let a=0;a<n;a++){const o=e[a],c=r.get(o)??[];for(const l of c){const h=s.get(l);h!==void 0&&(i[a*n+h]=1)}}return{matrix:i,nodeIds:e}}}class In{constructor(e){this.data={...e},this.neighbours=[]}}async function _c(t,e){const n=t.get_adjacency(),i=new Map,r=new Set([e]),s=[e];for(i.set(e,-1);s.length>0;){const a=s.shift(),o=n.get(a);for(let c=0;c<o.length;c++){const l=o[c];r.has(l)||(r.add(l),s.push(l),i.set(l,a))}}return i}async function Rs(t,e){const n=t.get_adjacency(),i=new Map,r=await _c(t,e);for(const s of n.keys()){if(!r.has(s))continue;let a=0,o=r.get(s);for(;o!==void 0&&o!==-1;)o=r.get(o),a+=1;i.set(s,a)}return i}async function Ch(t){const e=[...t.nodes.keys()];if(e.length===0)return{start:0,end:0,distance:0};if(e.length===1)return{start:e[0],end:e[0],distance:0};const n=t.get_adjacency(),i=e.filter(l=>{var h;return(((h=n.get(l))==null?void 0:h.length)??0)>0}),r=i.length>0?i:e;let s=r[Math.floor(Math.random()*r.length)],a=await Rs(t,s),o=-1;for(const l of a.keys()){const h=a.get(l);h>o&&(s=l,o=h)}const c=s;a=await Rs(t,s),o=-1;for(const l of a.keys()){const h=a.get(l);h>o&&(s=l,o=h)}return{start:c,end:s,distance:o}}async function Ph(t,e){const n=new Map,i=new Map;e.forEach(a=>{const o=t.nodes.get(a);n.set(a,o)});let r=0;for(const a of t.edges.keys()){const o=t.edges.get(a);e.includes(o.start)&&e.includes(o.end)&&(i.set(r,o),r+=1)}return await jt.create(n,i)}const Hr={GraphDiameter:Ch,Dijkstra:Rs,BFSSearch:_c,SelectSubgraph:Ph},Dh={nodes:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],edges:[[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,10],[0,11],[0,12],[0,13],[0,17],[0,19],[0,21],[0,31],[1,2],[1,3],[1,7],[1,13],[1,17],[1,19],[1,21],[1,30],[2,3],[2,7],[2,8],[2,9],[2,13],[2,27],[2,28],[2,32],[3,7],[3,12],[3,13],[4,6],[4,10],[5,6],[5,10],[5,16],[6,16],[8,30],[8,32],[8,33],[9,33],[13,33],[14,32],[14,33],[15,32],[15,33],[18,32],[18,33],[19,33],[20,32],[20,33],[22,32],[22,33],[23,25],[23,27],[23,29],[23,32],[23,33],[24,25],[24,27],[24,31],[25,31],[26,29],[26,33],[27,33],[28,31],[28,33],[29,32],[29,33],[30,32],[30,33],[31,32],[31,33],[32,33]]},Lh={nodes:[{id:0,px:.09083423378081436,py:1.164162667707135,member:0},{id:1,px:-.5395391223661004,py:.8787097882002372,member:0},{id:2,px:.25483951690897244,py:-.011894166387290125,member:0},{id:3,px:.5292273814873625,py:.8137715604013231,member:0},{id:4,px:.6759740200024705,py:2.010590015934319,member:3},{id:5,px:.6648725961138767,py:2.3765595730406712,member:3},{id:6,px:-.015476857282255526,py:2.421851366492045,member:3},{id:7,px:.9923183157183725,py:.7358251458599251,member:0},{id:8,px:-.6148021363450372,py:-.03465499210385469,member:1},{id:9,px:.24714516178546894,py:-1.012380550604274,member:0},{id:10,px:1.3293288757439443,py:1.8641805845025743,member:3},{id:11,px:-.6571791278403557,py:2.2163816367270526,member:0},{id:12,px:1.5181044222926994,py:1.3282665066698078,member:0},{id:13,px:-.2979203330003603,py:.18438685313887027,member:0},{id:14,px:-1.7502345807734376,py:-1.0935551887354324,member:1},{id:15,px:-1.630224787934251,py:-1.5015879850995024,member:1},{id:16,px:.5585243394360673,py:3.5,member:3},{id:17,px:-.9776584881745712,py:1.799718659872538,member:0},{id:18,px:-1.385649185975611,py:-1.870388302312794,member:1},{id:19,px:-.9638464461397331,py:.24226946279518707,member:0},{id:20,px:-1.0268125129631975,py:-2.1543990524894148,member:1},{id:21,px:-1.3061680833745626,py:1.527228276383933,member:0},{id:22,px:-.5552461198316926,py:-2.2498070887997685,member:1},{id:23,px:.8262268914348979,py:-1.804253160744954,member:2},{id:24,px:1.9952840970427212,py:-1.0382885070400036,member:2},{id:25,px:1.9207660053211613,py:-.5823795272244723,member:2},{id:26,px:-.1664715343791652,py:-2.6527209168204373,member:1},{id:27,px:.9961959436268844,py:-1.0143754028553023,member:2},{id:28,px:.6488880579857091,py:-1.024671500275854,member:2},{id:29,px:.2398196340697841,py:-2.171491081802323,member:1},{id:30,px:-1.3348117368940753,py:-.31290471156377053,member:1},{id:31,px:.6901260074375327,py:-.2526601933356052,member:2},{id:32,px:-.6030949145287146,py:-1.0927507849665647,member:1},{id:33,px:-.3533395323856202,py:-1.1887389845640028,member:1}],edges:[[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,10],[0,11],[0,12],[0,13],[0,17],[0,19],[0,21],[0,31],[1,2],[1,3],[1,7],[1,13],[1,17],[1,19],[1,21],[1,30],[2,3],[2,7],[2,8],[2,9],[2,13],[2,27],[2,28],[2,32],[3,7],[3,12],[3,13],[4,6],[4,10],[5,6],[5,10],[5,16],[6,16],[8,30],[8,32],[8,33],[9,33],[13,33],[14,32],[14,33],[15,32],[15,33],[18,32],[18,33],[19,33],[20,32],[20,33],[22,32],[22,33],[23,25],[23,27],[23,29],[23,32],[23,33],[24,25],[24,27],[24,31],[25,31],[26,29],[26,33],[27,33],[28,31],[28,33],[29,32],[29,33],[30,32],[30,33],[31,32],[31,33],[32,33]]},Ih={1:[1,2,8,9,397,401,408,851,852],2:[2,3,8,9,10,401,408,416,1],3:[3,4,9,10,11,408,416,424,2],4:[4,5,10,11,12,416,424,432,3],5:[5,6,11,12,13,432,738,4],6:[6,7,12,13,14,432,440,448,5],7:[7,13,14,440,448,6],8:[8,9,15,16,852,853,1,2],9:[9,10,15,16,17,1,2,3,8],10:[10,11,16,17,18,2,3,4,9],11:[11,12,17,18,19,3,4,5,10],12:[12,13,18,19,20,731,732,738,4,5,6,11],13:[13,14,19,20,21,5,6,7,12],14:[14,20,21,6,7,13],15:[15,16,22,23,853,8,9],16:[16,17,22,23,24,8,9,10,15],17:[17,18,23,24,25,9,10,11,16],18:[18,19,24,25,26,10,11,12,17],19:[19,20,25,26,27,732,733,11,12,13,18],20:[20,21,26,27,28,12,13,14,19],21:[21,27,28,13,14,20],22:[22,23,29,30,15,16],23:[23,24,29,30,31,15,16,17,22],24:[24,25,30,31,32,16,17,18,23],25:[25,26,31,32,33,17,18,19,24],26:[26,27,32,33,34,733,734,18,19,20,25],27:[27,28,33,34,35,19,20,21,26],28:[28,34,35,20,21,27],29:[29,30,36,37,22,23],30:[30,31,36,37,38,22,23,24,29],31:[31,32,37,38,39,23,24,25,30],32:[32,33,38,39,40,24,25,26,31],33:[33,34,39,40,41,734,735,25,26,27,32],34:[34,35,40,41,42,26,27,28,33],35:[35,41,42,27,28,34],36:[36,37,43,44,29,30],37:[37,38,43,44,45,29,30,31,36],38:[38,39,44,45,46,30,31,32,37],39:[39,40,45,46,47,31,32,33,38],40:[40,41,46,47,48,735,736,32,33,34,39],41:[41,42,47,48,49,33,34,35,40],42:[42,48,49,34,35,41],43:[43,44,50,51,36,37],44:[44,45,50,51,52,36,37,38,43],45:[45,46,51,52,53,37,38,39,44],46:[46,47,52,53,54,38,39,40,45],47:[47,48,53,54,55,736,39,40,41,46],48:[48,49,54,55,56,40,41,42,47],49:[49,55,56,41,42,48],50:[50,51,57,58,43,44],51:[51,52,57,58,59,43,44,45,50],52:[52,53,58,59,60,44,45,46,51],53:[53,54,59,60,61,45,46,47,52],54:[54,55,60,61,62,736,748,46,47,48,53],55:[55,56,61,62,63,47,48,49,54],56:[56,62,63,48,49,55],57:[57,58,64,65,50,51],58:[58,59,64,65,66,50,51,52,57],59:[59,60,65,66,67,51,52,53,58],60:[60,61,66,67,68,52,53,54,59],61:[61,62,67,68,69,747,748,53,54,55,60],62:[62,63,68,69,70,54,55,56,61],63:[63,69,70,55,56,62],64:[64,65,71,72,57,58],65:[65,66,71,72,73,57,58,59,64],66:[66,67,72,73,74,58,59,60,65],67:[67,68,73,74,75,59,60,61,66],68:[68,69,74,75,76,746,747,60,61,62,67],69:[69,70,75,76,77,61,62,63,68],70:[70,76,77,62,63,69],71:[71,72,78,79,869,64,65],72:[72,73,78,79,80,64,65,66,71],73:[73,74,79,80,81,65,66,67,72],74:[74,75,80,81,82,66,67,68,73],75:[75,76,81,82,83,745,746,67,68,69,74],76:[76,77,82,83,84,68,69,70,75],77:[77,83,84,69,70,76],78:[78,79,85,86,868,869,71,72],79:[79,80,85,86,87,71,72,73,78],80:[80,81,86,87,88,72,73,74,79],81:[81,82,87,88,89,73,74,75,80],82:[82,83,88,89,90,744,745,750,74,75,76,81],83:[83,84,89,90,91,75,76,77,82],84:[84,90,91,76,77,83],85:[85,86,483,487,494,867,868,78,79],86:[86,87,487,494,502,78,79,80,85],87:[87,88,494,502,510,79,80,81,86],88:[88,89,502,510,518,80,81,82,87],89:[89,90,518,750,81,82,83,88],90:[90,91,518,526,534,82,83,84,89],91:[91,526,534,83,84,90],92:[92,93,99,100,483,487,494,887,888],93:[93,94,99,100,101,487,494,502,92],94:[94,95,100,101,102,494,502,510,93],95:[95,96,101,102,103,502,510,518,94],96:[96,97,102,103,104,518,763,95],97:[97,98,103,104,105,518,526,534,96],98:[98,104,105,526,534,97],99:[99,100,106,107,888,889,92,93],100:[100,101,106,107,108,92,93,94,99],101:[101,102,107,108,109,93,94,95,100],102:[102,103,108,109,110,94,95,96,101],103:[103,104,109,110,111,756,757,763,95,96,97,102],104:[104,105,110,111,112,96,97,98,103],105:[105,111,112,97,98,104],106:[106,107,113,114,889,99,100],107:[107,108,113,114,115,99,100,101,106],108:[108,109,114,115,116,100,101,102,107],109:[109,110,115,116,117,101,102,103,108],110:[110,111,116,117,118,757,758,102,103,104,109],111:[111,112,117,118,119,103,104,105,110],112:[112,118,119,104,105,111],113:[113,114,120,121,106,107],114:[114,115,120,121,122,106,107,108,113],115:[115,116,121,122,123,107,108,109,114],116:[116,117,122,123,124,108,109,110,115],117:[117,118,123,124,125,758,759,109,110,111,116],118:[118,119,124,125,126,110,111,112,117],119:[119,125,126,111,112,118],120:[120,121,127,128,113,114],121:[121,122,127,128,129,113,114,115,120],122:[122,123,128,129,130,114,115,116,121],123:[123,124,129,130,131,115,116,117,122],124:[124,125,130,131,132,759,760,116,117,118,123],125:[125,126,131,132,133,117,118,119,124],126:[126,132,133,118,119,125],127:[127,128,134,135,120,121],128:[128,129,134,135,136,120,121,122,127],129:[129,130,135,136,137,121,122,123,128],130:[130,131,136,137,138,122,123,124,129],131:[131,132,137,138,139,760,761,123,124,125,130],132:[132,133,138,139,140,124,125,126,131],133:[133,139,140,125,126,132],134:[134,135,141,142,127,128],135:[135,136,141,142,143,127,128,129,134],136:[136,137,142,143,144,128,129,130,135],137:[137,138,143,144,145,129,130,131,136],138:[138,139,144,145,146,761,130,131,132,137],139:[139,140,145,146,147,131,132,133,138],140:[140,146,147,132,133,139],141:[141,142,148,149,134,135],142:[142,143,148,149,150,134,135,136,141],143:[143,144,149,150,151,135,136,137,142],144:[144,145,150,151,152,136,137,138,143],145:[145,146,151,152,153,761,773,137,138,139,144],146:[146,147,152,153,154,138,139,140,145],147:[147,153,154,139,140,146],148:[148,149,155,156,141,142],149:[149,150,155,156,157,141,142,143,148],150:[150,151,156,157,158,142,143,144,149],151:[151,152,157,158,159,143,144,145,150],152:[152,153,158,159,160,772,773,144,145,146,151],153:[153,154,159,160,161,145,146,147,152],154:[154,160,161,146,147,153],155:[155,156,162,163,148,149],156:[156,157,162,163,164,148,149,150,155],157:[157,158,163,164,165,149,150,151,156],158:[158,159,164,165,166,150,151,152,157],159:[159,160,165,166,167,771,772,151,152,153,158],160:[160,161,166,167,168,152,153,154,159],161:[161,167,168,153,154,160],162:[162,163,169,170,905,155,156],163:[163,164,169,170,171,155,156,157,162],164:[164,165,170,171,172,156,157,158,163],165:[165,166,171,172,173,157,158,159,164],166:[166,167,172,173,174,770,771,158,159,160,165],167:[167,168,173,174,175,159,160,161,166],168:[168,174,175,160,161,167],169:[169,170,176,177,904,905,162,163],170:[170,171,176,177,178,162,163,164,169],171:[171,172,177,178,179,163,164,165,170],172:[172,173,178,179,180,164,165,166,171],173:[173,174,179,180,181,769,770,775,165,166,167,172],174:[174,175,180,181,182,166,167,168,173],175:[175,181,182,167,168,174],176:[176,177,569,573,580,903,904,169,170],177:[177,178,573,580,588,169,170,171,176],178:[178,179,580,588,596,170,171,172,177],179:[179,180,588,596,604,171,172,173,178],180:[180,181,604,775,172,173,174,179],181:[181,182,604,612,620,173,174,175,180],182:[182,612,620,174,175,181],183:[183,184,190,191,569,573,580,923,924],184:[184,185,190,191,192,573,580,588,183],185:[185,186,191,192,193,580,588,596,184],186:[186,187,192,193,194,588,596,604,185],187:[187,188,193,194,195,604,788,186],188:[188,189,194,195,196,604,612,620,187],189:[189,195,196,612,620,188],190:[190,191,197,198,924,925,183,184],191:[191,192,197,198,199,183,184,185,190],192:[192,193,198,199,200,184,185,186,191],193:[193,194,199,200,201,185,186,187,192],194:[194,195,200,201,202,781,782,788,186,187,188,193],195:[195,196,201,202,203,187,188,189,194],196:[196,202,203,188,189,195],197:[197,198,204,205,925,190,191],198:[198,199,204,205,206,190,191,192,197],199:[199,200,205,206,207,191,192,193,198],200:[200,201,206,207,208,192,193,194,199],201:[201,202,207,208,209,782,783,193,194,195,200],202:[202,203,208,209,210,194,195,196,201],203:[203,209,210,195,196,202],204:[204,205,211,212,197,198],205:[205,206,211,212,213,197,198,199,204],206:[206,207,212,213,214,198,199,200,205],207:[207,208,213,214,215,199,200,201,206],208:[208,209,214,215,216,783,784,200,201,202,207],209:[209,210,215,216,217,201,202,203,208],210:[210,216,217,202,203,209],211:[211,212,218,219,204,205],212:[212,213,218,219,220,204,205,206,211],213:[213,214,219,220,221,205,206,207,212],214:[214,215,220,221,222,206,207,208,213],215:[215,216,221,222,223,784,785,207,208,209,214],216:[216,217,222,223,224,208,209,210,215],217:[217,223,224,209,210,216],218:[218,219,225,226,211,212],219:[219,220,225,226,227,211,212,213,218],220:[220,221,226,227,228,212,213,214,219],221:[221,222,227,228,229,213,214,215,220],222:[222,223,228,229,230,785,786,214,215,216,221],223:[223,224,229,230,231,215,216,217,222],224:[224,230,231,216,217,223],225:[225,226,232,233,218,219],226:[226,227,232,233,234,218,219,220,225],227:[227,228,233,234,235,219,220,221,226],228:[228,229,234,235,236,220,221,222,227],229:[229,230,235,236,237,786,221,222,223,228],230:[230,231,236,237,238,222,223,224,229],231:[231,237,238,223,224,230],232:[232,233,239,240,225,226],233:[233,234,239,240,241,225,226,227,232],234:[234,235,240,241,242,226,227,228,233],235:[235,236,241,242,243,227,228,229,234],236:[236,237,242,243,244,786,798,228,229,230,235],237:[237,238,243,244,245,229,230,231,236],238:[238,244,245,230,231,237],239:[239,240,246,247,232,233],240:[240,241,246,247,248,232,233,234,239],241:[241,242,247,248,249,233,234,235,240],242:[242,243,248,249,250,234,235,236,241],243:[243,244,249,250,251,797,798,235,236,237,242],244:[244,245,250,251,252,236,237,238,243],245:[245,251,252,237,238,244],246:[246,247,253,254,239,240],247:[247,248,253,254,255,239,240,241,246],248:[248,249,254,255,256,240,241,242,247],249:[249,250,255,256,257,241,242,243,248],250:[250,251,256,257,258,796,797,242,243,244,249],251:[251,252,257,258,259,243,244,245,250],252:[252,258,259,244,245,251],253:[253,254,260,261,941,246,247],254:[254,255,260,261,262,246,247,248,253],255:[255,256,261,262,263,247,248,249,254],256:[256,257,262,263,264,248,249,250,255],257:[257,258,263,264,265,795,796,249,250,251,256],258:[258,259,264,265,266,250,251,252,257],259:[259,265,266,251,252,258],260:[260,261,267,268,940,941,253,254],261:[261,262,267,268,269,253,254,255,260],262:[262,263,268,269,270,254,255,256,261],263:[263,264,269,270,271,255,256,257,262],264:[264,265,270,271,272,794,795,800,256,257,258,263],265:[265,266,271,272,273,257,258,259,264],266:[266,272,273,258,259,265],267:[267,268,655,659,666,939,940,260,261],268:[268,269,659,666,674,260,261,262,267],269:[269,270,666,674,682,261,262,263,268],270:[270,271,674,682,690,262,263,264,269],271:[271,272,690,800,263,264,265,270],272:[272,273,690,698,706,264,265,266,271],273:[273,698,706,265,266,272],274:[274,275,281,282,655,659,666,954,955],275:[275,276,281,282,283,659,666,674,274],276:[276,277,282,283,284,666,674,682,275],277:[277,278,283,284,285,674,682,690,276],278:[278,279,284,285,286,690,812,277],279:[279,280,285,286,287,690,698,706,278],280:[280,286,287,698,706,279],281:[281,282,288,289,955,956,274,275],282:[282,283,288,289,290,274,275,276,281],283:[283,284,289,290,291,275,276,277,282],284:[284,285,290,291,292,276,277,278,283],285:[285,286,291,292,293,806,807,812,277,278,279,284],286:[286,287,292,293,294,278,279,280,285],287:[287,293,294,279,280,286],288:[288,289,295,296,956,281,282],289:[289,290,295,296,297,281,282,283,288],290:[290,291,296,297,298,282,283,284,289],291:[291,292,297,298,299,283,284,285,290],292:[292,293,298,299,300,807,808,284,285,286,291],293:[293,294,299,300,301,285,286,287,292],294:[294,300,301,286,287,293],295:[295,296,302,303,288,289],296:[296,297,302,303,304,288,289,290,295],297:[297,298,303,304,305,289,290,291,296],298:[298,299,304,305,306,290,291,292,297],299:[299,300,305,306,307,808,809,291,292,293,298],300:[300,301,306,307,308,292,293,294,299],301:[301,307,308,293,294,300],302:[302,303,309,310,295,296],303:[303,304,309,310,311,295,296,297,302],304:[304,305,310,311,312,296,297,298,303],305:[305,306,311,312,313,297,298,299,304],306:[306,307,312,313,314,809,810,298,299,300,305],307:[307,308,313,314,315,299,300,301,306],308:[308,314,315,300,301,307],309:[309,310,316,317,302,303],310:[310,311,316,317,318,302,303,304,309],311:[311,312,317,318,319,303,304,305,310],312:[312,313,318,319,320,304,305,306,311],313:[313,314,319,320,321,723,810,305,306,307,312],314:[314,315,320,321,322,306,307,308,313],315:[315,321,322,307,308,314],316:[316,317,323,324,309,310],317:[317,318,323,324,325,309,310,311,316],318:[318,319,324,325,326,310,311,312,317],319:[319,320,325,326,327,311,312,313,318],320:[320,321,326,327,328,723,312,313,314,319],321:[321,322,327,328,329,313,314,315,320],322:[322,328,329,314,315,321],323:[323,324,330,331,316,317],324:[324,325,330,331,332,316,317,318,323],325:[325,326,331,332,333,317,318,319,324],326:[326,327,332,333,334,318,319,320,325],327:[327,328,333,334,335,722,723,319,320,321,326],328:[328,329,334,335,336,320,321,322,327],329:[329,335,336,321,322,328],330:[330,331,337,338,323,324],331:[331,332,337,338,339,323,324,325,330],332:[332,333,338,339,340,324,325,326,331],333:[333,334,339,340,341,325,326,327,332],334:[334,335,340,341,342,721,722,326,327,328,333],335:[335,336,341,342,343,327,328,329,334],336:[336,342,343,328,329,335],337:[337,338,344,345,330,331],338:[338,339,344,345,346,330,331,332,337],339:[339,340,345,346,347,331,332,333,338],340:[340,341,346,347,348,332,333,334,339],341:[341,342,347,348,349,720,721,333,334,335,340],342:[342,343,348,349,350,334,335,336,341],343:[343,349,350,335,336,342],344:[344,345,351,352,833,337,338],345:[345,346,351,352,353,337,338,339,344],346:[346,347,352,353,354,338,339,340,345],347:[347,348,353,354,355,339,340,341,346],348:[348,349,354,355,356,719,720,340,341,342,347],349:[349,350,355,356,357,341,342,343,348],350:[350,356,357,342,343,349],351:[351,352,358,359,832,833,344,345],352:[352,353,358,359,360,344,345,346,351],353:[353,354,359,360,361,345,346,347,352],354:[354,355,360,361,362,346,347,348,353],355:[355,356,361,362,363,718,719,725,347,348,349,354],356:[356,357,362,363,364,348,349,350,355],357:[357,363,364,349,350,356],358:[358,359,397,401,408,831,832,351,352],359:[359,360,401,408,416,351,352,353,358],360:[360,361,408,416,424,352,353,354,359],361:[361,362,416,424,432,353,354,355,360],362:[362,363,432,725,354,355,356,361],363:[363,364,432,440,448,355,356,357,362],364:[364,440,448,356,357,363],365:[365,366,369,370,455,456,541,542,627,628,813,834,870,906,958,967,979,991],366:[366,367,369,370,371,455,456,457,541,542,543,627,628,629,813,834,870,906,958,959,967,968,979,980,991,992,365],367:[367,368,370,371,372,456,457,458,542,543,544,628,629,630,958,959,960,967,968,969,979,980,981,991,992,993,366],368:[368,371,372,457,458,543,544,629,630,957,959,960,968,969,980,981,992,993,367],369:[369,370,373,374,813,815,834,836,958,961,967,970,365,366],370:[370,371,373,374,375,813,815,834,836,958,959,961,962,967,968,970,971,365,366,367,369],371:[371,372,374,375,376,958,959,960,961,962,967,968,969,970,971,366,367,368,370],372:[372,375,376,957,959,960,962,968,969,971,367,368,371],373:[373,374,377,378,815,817,836,838,961,965,970,974,369,370],374:[374,375,377,378,379,815,817,836,838,961,962,965,970,971,974,369,370,371,373],375:[375,376,378,379,380,961,962,965,970,971,974,370,371,372,374],376:[376,380,371,372,375],377:[377,378,381,382,817,819,820,822,838,840,842,965,974,373,374],378:[378,379,381,382,383,817,822,838,842,961,962,965,970,971,974,373,374,375,377],379:[379,380,383,384,374,375,378],380:[380,384,375,376,379],381:[381,382,385,386,817,822,825,838,842,845,965,974,377,378],382:[382,383,386,387,377,378,381],383:[383,384,387,388,378,379,382],384:[384,388,379,380,383],385:[385,386,389,390,822,825,827,842,845,847,381],386:[386,387,390,391,381,382,385],387:[387,388,391,392,382,383,386],388:[388,392,383,384,387],389:[389,390,393,394,825,827,829,845,847,849,385],390:[390,391,394,395,385,386,389],391:[391,392,395,396,386,387,390],392:[392,396,387,388,391],393:[393,394,397,398,827,829,847,849,389],394:[394,395,398,399,389,390,393],395:[395,396,399,400,390,391,394],396:[396,400,391,392,395],397:[397,398,401,829,831,849,851,1,358,393],398:[398,399,401,402,393,394,397],399:[399,400,402,403,404,394,395,398],400:[400,404,395,396,399],401:[401,402,408,1,2,358,359,397,398],402:[402,403,408,409,410,398,399,401],403:[403,404,410,411,399,402],404:[404,405,411,399,400,403],405:[405,406,411,412,404],406:[406,407,412,413,405],407:[407,413,414,415,406],408:[408,409,416,1,2,3,358,359,360,401,402],409:[409,410,416,417,402,408],410:[410,411,417,418,402,403,409],411:[411,412,418,419,403,404,405,410],412:[412,413,419,420,405,406,411],413:[413,414,420,421,406,407,412],414:[414,415,421,422,407,413],415:[415,422,423,407,414],416:[416,417,424,2,3,4,359,360,361,408,409],417:[417,418,424,425,409,410,416],418:[418,419,425,426,410,411,417],419:[419,420,426,427,411,412,418],420:[420,421,427,428,412,413,419],421:[421,422,428,429,413,414,420],422:[422,423,429,430,414,415,421],423:[423,430,431,415,422],424:[424,425,432,3,4,360,361,416,417],425:[425,426,432,433,417,418,424],426:[426,427,433,434,435,418,419,425],427:[427,428,435,419,420,426],428:[428,429,435,436,420,421,427],429:[429,430,436,437,421,422,428],430:[430,431,437,438,422,423,429],431:[431,438,439,423,430],432:[432,433,440,441,725,738,4,5,6,361,362,363,424,425],433:[433,434,441,442,724,725,737,738,425,426,432],434:[434,435,442,443,724,737,426,433],435:[435,436,443,444,716,724,729,737,426,427,428,434],436:[436,437,444,445,715,716,728,729,428,429,435],437:[437,438,445,446,714,715,727,728,429,430,436],438:[438,439,446,447,713,714,726,727,430,431,437],439:[439,447,713,726,431,438],440:[440,441,448,449,6,7,363,364,432],441:[441,442,449,450,432,433,440],442:[442,443,450,451,433,434,441],443:[443,444,451,452,434,435,442],444:[444,445,452,453,435,436,443],445:[445,446,453,454,436,437,444],446:[446,447,454,437,438,445],447:[447,454,438,439,446],448:[448,449,6,7,363,364,440],449:[449,450,440,441,448],450:[450,451,441,442,449],451:[451,452,442,443,450],452:[452,453,443,444,451],453:[453,454,444,445,452],454:[454,445,446,447,453],455:[455,456,459,460,834,854,870,872,967,976,979,982,365,366],456:[456,457,459,460,461,834,854,870,872,967,968,976,977,979,980,982,983,365,366,367,455],457:[457,458,460,461,462,967,968,969,976,977,979,980,981,982,983,366,367,368,456],458:[458,461,462,957,968,969,977,980,981,983,367,368,457],459:[459,460,463,464,854,855,872,874,976,978,982,986,455,456],460:[460,461,463,464,465,854,855,872,874,976,977,978,982,983,986,455,456,457,459],461:[461,462,464,465,466,976,977,978,982,983,986,456,457,458,460],462:[462,466,457,458,461],463:[463,464,467,468,855,856,857,858,874,876,878,978,986,459,460],464:[464,465,467,468,469,855,858,874,878,976,977,978,982,983,986,459,460,461,463],465:[465,466,469,470,460,461,464],466:[466,470,461,462,465],467:[467,468,471,472,855,858,861,874,878,881,978,986,463,464],468:[468,469,472,473,463,464,467],469:[469,470,473,474,464,465,468],470:[470,474,465,466,469],471:[471,472,475,476,858,861,863,878,881,883,467],472:[472,473,476,477,467,468,471],473:[473,474,477,478,468,469,472],474:[474,478,469,470,473],475:[475,476,479,480,861,863,865,881,883,885,471],476:[476,477,480,481,471,472,475],477:[477,478,481,482,472,473,476],478:[478,482,473,474,477],479:[479,480,483,484,863,865,883,885,475],480:[480,481,484,485,475,476,479],481:[481,482,485,486,476,477,480],482:[482,486,477,478,481],483:[483,484,487,865,867,885,887,85,92,479],484:[484,485,487,488,479,480,483],485:[485,486,488,489,490,480,481,484],486:[486,490,481,482,485],487:[487,488,494,85,86,92,93,483,484],488:[488,489,494,495,496,484,485,487],489:[489,490,496,497,485,488],490:[490,491,497,485,486,489],491:[491,492,497,498,490],492:[492,493,498,499,491],493:[493,499,500,501,492],494:[494,495,502,85,86,87,92,93,94,487,488],495:[495,496,502,503,488,494],496:[496,497,503,504,488,489,495],497:[497,498,504,505,489,490,491,496],498:[498,499,505,506,491,492,497],499:[499,500,506,507,492,493,498],500:[500,501,507,508,493,499],501:[501,508,509,493,500],502:[502,503,510,86,87,88,93,94,95,494,495],503:[503,504,510,511,495,496,502],504:[504,505,511,512,496,497,503],505:[505,506,512,513,497,498,504],506:[506,507,513,514,498,499,505],507:[507,508,514,515,499,500,506],508:[508,509,515,516,500,501,507],509:[509,516,517,501,508],510:[510,511,518,87,88,94,95,502,503],511:[511,512,518,519,503,504,510],512:[512,513,519,520,521,504,505,511],513:[513,514,521,505,506,512],514:[514,515,521,522,506,507,513],515:[515,516,522,523,507,508,514],516:[516,517,523,524,508,509,515],517:[517,524,525,509,516],518:[518,519,526,527,750,763,88,89,90,95,96,97,510,511],519:[519,520,527,528,749,750,762,763,511,512,518],520:[520,521,528,529,749,762,512,519],521:[521,522,529,530,742,749,754,762,512,513,514,520],522:[522,523,530,531,741,742,753,754,514,515,521],523:[523,524,531,532,740,741,752,753,515,516,522],524:[524,525,532,533,739,740,751,752,516,517,523],525:[525,533,739,751,517,524],526:[526,527,534,535,90,91,97,98,518],527:[527,528,535,536,518,519,526],528:[528,529,536,537,519,520,527],529:[529,530,537,538,520,521,528],530:[530,531,538,539,521,522,529],531:[531,532,539,540,522,523,530],532:[532,533,540,523,524,531],533:[533,540,524,525,532],534:[534,535,90,91,97,98,526],535:[535,536,526,527,534],536:[536,537,527,528,535],537:[537,538,528,529,536],538:[538,539,529,530,537],539:[539,540,530,531,538],540:[540,531,532,533,539],541:[541,542,545,546,870,890,906,908,979,988,991,994,365,366],542:[542,543,545,546,547,870,890,906,908,979,980,988,989,991,992,994,995,365,366,367,541],543:[543,544,546,547,548,979,980,981,988,989,991,992,993,994,995,366,367,368,542],544:[544,547,548,957,980,981,989,992,993,995,367,368,543],545:[545,546,549,550,890,891,908,910,988,990,994,998,541,542],546:[546,547,549,550,551,890,891,908,910,988,989,990,994,995,998,541,542,543,545],547:[547,548,550,551,552,988,989,990,994,995,998,542,543,544,546],548:[548,552,543,544,547],549:[549,550,553,554,891,892,893,894,910,912,914,990,998,545,546],550:[550,551,553,554,555,891,894,910,914,988,989,990,994,995,998,545,546,547,549],551:[551,552,555,556,546,547,550],552:[552,556,547,548,551],553:[553,554,557,558,891,894,897,910,914,917,990,998,549,550],554:[554,555,558,559,549,550,553],555:[555,556,559,560,550,551,554],556:[556,560,551,552,555],557:[557,558,561,562,894,897,899,914,917,919,553],558:[558,559,562,563,553,554,557],559:[559,560,563,564,554,555,558],560:[560,564,555,556,559],561:[561,562,565,566,897,899,901,917,919,921,557],562:[562,563,566,567,557,558,561],563:[563,564,567,568,558,559,562],564:[564,568,559,560,563],565:[565,566,569,570,899,901,919,921,561],566:[566,567,570,571,561,562,565],567:[567,568,571,572,562,563,566],568:[568,572,563,564,567],569:[569,570,573,901,903,921,923,176,183,565],570:[570,571,573,574,565,566,569],571:[571,572,574,575,576,566,567,570],572:[572,576,567,568,571],573:[573,574,580,176,177,183,184,569,570],574:[574,575,580,581,582,570,571,573],575:[575,576,582,583,571,574],576:[576,577,583,571,572,575],577:[577,578,583,584,576],578:[578,579,584,585,577],579:[579,585,586,587,578],580:[580,581,588,176,177,178,183,184,185,573,574],581:[581,582,588,589,574,580],582:[582,583,589,590,574,575,581],583:[583,584,590,591,575,576,577,582],584:[584,585,591,592,577,578,583],585:[585,586,592,593,578,579,584],586:[586,587,593,594,579,585],587:[587,594,595,579,586],588:[588,589,596,177,178,179,184,185,186,580,581],589:[589,590,596,597,581,582,588],590:[590,591,597,598,582,583,589],591:[591,592,598,599,583,584,590],592:[592,593,599,600,584,585,591],593:[593,594,600,601,585,586,592],594:[594,595,601,602,586,587,593],595:[595,602,603,587,594],596:[596,597,604,178,179,185,186,588,589],597:[597,598,604,605,589,590,596],598:[598,599,605,606,607,590,591,597],599:[599,600,607,591,592,598],600:[600,601,607,608,592,593,599],601:[601,602,608,609,593,594,600],602:[602,603,609,610,594,595,601],603:[603,610,611,595,602],604:[604,605,612,613,775,788,179,180,181,186,187,188,596,597],605:[605,606,613,614,774,775,787,788,597,598,604],606:[606,607,614,615,774,787,598,605],607:[607,608,615,616,767,774,779,787,598,599,600,606],608:[608,609,616,617,766,767,778,779,600,601,607],609:[609,610,617,618,765,766,777,778,601,602,608],610:[610,611,618,619,764,765,776,777,602,603,609],611:[611,619,764,776,603,610],612:[612,613,620,621,181,182,188,189,604],613:[613,614,621,622,604,605,612],614:[614,615,622,623,605,606,613],615:[615,616,623,624,606,607,614],616:[616,617,624,625,607,608,615],617:[617,618,625,626,608,609,616],618:[618,619,626,609,610,617],619:[619,626,610,611,618],620:[620,621,181,182,188,189,612],621:[621,622,612,613,620],622:[622,623,613,614,621],623:[623,624,614,615,622],624:[624,625,615,616,623],625:[625,626,616,617,624],626:[626,617,618,619,625],627:[627,628,631,632,813,906,926,942,958,991,1e3,1003,365,366],628:[628,629,631,632,633,813,906,926,942,958,959,991,992,1e3,1001,1003,1004,365,366,367,627],629:[629,630,632,633,634,958,959,960,991,992,993,1e3,1001,1003,1004,366,367,368,628],630:[630,633,634,957,959,960,992,993,1001,1004,367,368,629],631:[631,632,635,636,926,927,942,943,1e3,1002,1003,1005,627,628],632:[632,633,635,636,637,926,927,942,943,1e3,1001,1002,1003,1004,1005,627,628,629,631],633:[633,634,636,637,638,1e3,1001,1002,1003,1004,1005,628,629,630,632],634:[634,638,629,630,633],635:[635,636,639,640,927,928,929,930,943,944,945,1002,1005,631,632],636:[636,637,639,640,641,927,930,943,945,1e3,1001,1002,1003,1004,1005,631,632,633,635],637:[637,638,641,642,632,633,636],638:[638,642,633,634,637],639:[639,640,643,644,927,930,933,943,945,948,1002,1005,635,636],640:[640,641,644,645,635,636,639],641:[641,642,645,646,636,637,640],642:[642,646,637,638,641],643:[643,644,647,648,930,933,935,945,948,950,639],644:[644,645,648,649,639,640,643],645:[645,646,649,650,640,641,644],646:[646,650,641,642,645],647:[647,648,651,652,933,935,937,948,950,952,643],648:[648,649,652,653,643,644,647],649:[649,650,653,654,644,645,648],650:[650,654,645,646,649],651:[651,652,655,656,935,937,950,952,647],652:[652,653,656,657,647,648,651],653:[653,654,657,658,648,649,652],654:[654,658,649,650,653],655:[655,656,659,937,939,952,954,267,274,651],656:[656,657,659,660,651,652,655],657:[657,658,660,661,662,652,653,656],658:[658,662,653,654,657],659:[659,660,666,267,268,274,275,655,656],660:[660,661,666,667,668,656,657,659],661:[661,662,668,669,657,660],662:[662,663,669,657,658,661],663:[663,664,669,670,662],664:[664,665,670,671,663],665:[665,671,672,673,664],666:[666,667,674,267,268,269,274,275,276,659,660],667:[667,668,674,675,660,666],668:[668,669,675,676,660,661,667],669:[669,670,676,677,661,662,663,668],670:[670,671,677,678,663,664,669],671:[671,672,678,679,664,665,670],672:[672,673,679,680,665,671],673:[673,680,681,665,672],674:[674,675,682,268,269,270,275,276,277,666,667],675:[675,676,682,683,667,668,674],676:[676,677,683,684,668,669,675],677:[677,678,684,685,669,670,676],678:[678,679,685,686,670,671,677],679:[679,680,686,687,671,672,678],680:[680,681,687,688,672,673,679],681:[681,688,689,673,680],682:[682,683,690,269,270,276,277,674,675],683:[683,684,690,691,675,676,682],684:[684,685,691,692,693,676,677,683],685:[685,686,693,677,678,684],686:[686,687,693,694,678,679,685],687:[687,688,694,695,679,680,686],688:[688,689,695,696,680,681,687],689:[689,696,697,681,688],690:[690,691,698,699,800,812,270,271,272,277,278,279,682,683],691:[691,692,699,700,799,800,811,812,683,684,690],692:[692,693,700,701,799,811,684,691],693:[693,694,701,702,792,799,804,811,684,685,686,692],694:[694,695,702,703,791,792,803,804,686,687,693],695:[695,696,703,704,790,791,802,803,687,688,694],696:[696,697,704,705,789,790,801,802,688,689,695],697:[697,705,789,801,689,696],698:[698,699,706,707,272,273,279,280,690],699:[699,700,707,708,690,691,698],700:[700,701,708,709,691,692,699],701:[701,702,709,710,692,693,700],702:[702,703,710,711,693,694,701],703:[703,704,711,712,694,695,702],704:[704,705,712,695,696,703],705:[705,712,696,697,704],706:[706,707,272,273,279,280,698],707:[707,708,698,699,706],708:[708,709,699,700,707],709:[709,710,700,701,708],710:[710,711,701,702,709],711:[711,712,702,703,710],712:[712,703,704,705,711],713:[713,714,438,439],714:[714,715,437,438,713],715:[715,716,436,437,714],716:[716,717,724,435,436,715],717:[717,718,724,725,716],718:[718,719,725,355,717],719:[719,720,348,355,718],720:[720,721,341,348,719],721:[721,722,334,341,720],722:[722,723,327,334,721],723:[723,810,313,320,327,722],724:[724,725,433,434,435,716,717],725:[725,355,362,432,433,717,718,724],726:[726,727,438,439],727:[727,728,437,438,726],728:[728,729,436,437,727],729:[729,730,737,435,436,728],730:[730,731,737,738,729],731:[731,732,738,12,730],732:[732,733,12,19,731],733:[733,734,19,26,732],734:[734,735,26,33,733],735:[735,736,33,40,734],736:[736,748,40,47,54,735],737:[737,738,433,434,435,729,730],738:[738,5,12,432,433,730,731,737],739:[739,740,524,525],740:[740,741,523,524,739],741:[741,742,522,523,740],742:[742,743,749,521,522,741],743:[743,744,749,750,742],744:[744,745,750,82,743],745:[745,746,75,82,744],746:[746,747,68,75,745],747:[747,748,61,68,746],748:[748,54,61,736,747],749:[749,750,519,520,521,742,743],750:[750,82,89,518,519,743,744,749],751:[751,752,524,525],752:[752,753,523,524,751],753:[753,754,522,523,752],754:[754,755,762,521,522,753],755:[755,756,762,763,754],756:[756,757,763,103,755],757:[757,758,103,110,756],758:[758,759,110,117,757],759:[759,760,117,124,758],760:[760,761,124,131,759],761:[761,773,131,138,145,760],762:[762,763,519,520,521,754,755],763:[763,96,103,518,519,755,756,762],764:[764,765,610,611],765:[765,766,609,610,764],766:[766,767,608,609,765],767:[767,768,774,607,608,766],768:[768,769,774,775,767],769:[769,770,775,173,768],770:[770,771,166,173,769],771:[771,772,159,166,770],772:[772,773,152,159,771],773:[773,145,152,761,772],774:[774,775,605,606,607,767,768],775:[775,173,180,604,605,768,769,774],776:[776,777,610,611],777:[777,778,609,610,776],778:[778,779,608,609,777],779:[779,780,787,607,608,778],780:[780,781,787,788,779],781:[781,782,788,194,780],782:[782,783,194,201,781],783:[783,784,201,208,782],784:[784,785,208,215,783],785:[785,786,215,222,784],786:[786,798,222,229,236,785],787:[787,788,605,606,607,779,780],788:[788,187,194,604,605,780,781,787],789:[789,790,696,697],790:[790,791,695,696,789],791:[791,792,694,695,790],792:[792,793,799,693,694,791],793:[793,794,799,800,792],794:[794,795,800,264,793],795:[795,796,257,264,794],796:[796,797,250,257,795],797:[797,798,243,250,796],798:[798,236,243,786,797],799:[799,800,691,692,693,792,793],800:[800,264,271,690,691,793,794,799],801:[801,802,696,697],802:[802,803,695,696,801],803:[803,804,694,695,802],804:[804,805,811,693,694,803],805:[805,806,811,812,804],806:[806,807,812,285,805],807:[807,808,285,292,806],808:[808,809,292,299,807],809:[809,810,299,306,808],810:[810,306,313,723,809],811:[811,812,691,692,693,804,805],812:[812,278,285,690,691,805,806,811],813:[813,815,816,942,958,961,963,1003,365,366,369,370,627,628],814:[814,817,818,824,943,947,966],815:[815,816,817,958,961,963,965,369,370,373,374,813],816:[816,817,818,942,943,958,961,963,965,966,1003,1005,813,815],817:[817,818,819,820,821,822,823,824,961,963,965,966,373,374,377,378,381,814,815,816],818:[818,820,821,824,943,944,947,963,965,966,1005,814,816,817],819:[819,820,838,840,377,817],820:[820,821,377,817,818,819],821:[821,943,944,817,818,820],822:[822,823,825,826,965,377,378,381,385,817],823:[823,824,825,826,965,817,822],824:[824,965,966,814,817,818,823],825:[825,826,827,828,381,385,389,822,823],826:[826,827,828,822,823,825],827:[827,828,829,830,385,389,393,825,826],828:[828,829,830,825,826,827],829:[829,830,831,832,389,393,397,827,828],830:[830,832,833,827,828,829],831:[831,832,358,397,829],832:[832,833,351,358,829,830,831],833:[833,344,351,830,832],834:[834,836,837,854,967,970,972,976,365,366,369,370,455,456],835:[835,838,839,844,855,860,975],836:[836,837,838,967,970,972,974,369,370,373,374,834],837:[837,838,839,854,855,967,970,972,974,975,976,978,834,836],838:[838,839,840,841,842,843,844,970,972,974,975,373,374,377,378,381,819,835,836,837],839:[839,840,841,844,855,857,860,972,974,975,978,835,837,838],840:[840,841,377,819,838,839],841:[841,855,857,838,839,840],842:[842,843,845,846,974,377,378,381,385,838],843:[843,844,845,846,974,838,842],844:[844,974,975,835,838,839,843],845:[845,846,847,848,381,385,389,842,843],846:[846,847,848,842,843,845],847:[847,848,849,850,385,389,393,845,846],848:[848,849,850,845,846,847],849:[849,850,851,852,389,393,397,847,848],850:[850,852,853,847,848,849],851:[851,852,1,397,849],852:[852,853,1,8,849,850,851],853:[853,8,15,850,852],854:[854,855,967,972,976,978,455,456,459,460,834,837],855:[855,856,857,858,859,860,972,975,976,978,459,460,463,464,467,835,837,839,841,854],856:[856,857,874,876,463,855],857:[857,463,839,841,855,856],858:[858,859,861,862,978,463,464,467,471,855],859:[859,860,861,862,978,855,858],860:[860,975,978,835,839,855,859],861:[861,862,863,864,467,471,475,858,859],862:[862,863,864,858,859,861],863:[863,864,865,866,471,475,479,861,862],864:[864,865,866,861,862,863],865:[865,866,867,868,475,479,483,863,864],866:[866,868,869,863,864,865],867:[867,868,85,483,865],868:[868,869,78,85,865,866,867],869:[869,71,78,866,868],870:[870,872,873,890,979,982,984,988,365,366,455,456,541,542],871:[871,874,875,880,891,896,987],872:[872,873,874,979,982,984,986,455,456,459,460,870],873:[873,874,875,890,891,979,982,984,986,987,988,990,870,872],874:[874,875,876,877,878,879,880,982,984,986,987,459,460,463,464,467,856,871,872,873],875:[875,876,877,880,891,893,896,984,986,987,990,871,873,874],876:[876,877,463,856,874,875],877:[877,891,893,874,875,876],878:[878,879,881,882,986,463,464,467,471,874],879:[879,880,881,882,986,874,878],880:[880,986,987,871,874,875,879],881:[881,882,883,884,467,471,475,878,879],882:[882,883,884,878,879,881],883:[883,884,885,886,471,475,479,881,882],884:[884,885,886,881,882,883],885:[885,886,887,888,475,479,483,883,884],886:[886,888,889,883,884,885],887:[887,888,92,483,885],888:[888,889,92,99,885,886,887],889:[889,99,106,886,888],890:[890,891,979,984,988,990,541,542,545,546,870,873],891:[891,892,893,894,895,896,984,987,988,990,545,546,549,550,553,871,873,875,877,890],892:[892,893,910,912,549,891],893:[893,549,875,877,891,892],894:[894,895,897,898,990,549,550,553,557,891],895:[895,896,897,898,990,891,894],896:[896,987,990,871,875,891,895],897:[897,898,899,900,553,557,561,894,895],898:[898,899,900,894,895,897],899:[899,900,901,902,557,561,565,897,898],900:[900,901,902,897,898,899],901:[901,902,903,904,561,565,569,899,900],902:[902,904,905,899,900,901],903:[903,904,176,569,901],904:[904,905,169,176,901,902,903],905:[905,162,169,902,904],906:[906,908,909,926,991,994,996,1e3,365,366,541,542,627,628],907:[907,910,911,916,927,932,999],908:[908,909,910,991,994,996,998,541,542,545,546,906],909:[909,910,911,926,927,991,994,996,998,999,1e3,1002,906,908],910:[910,911,912,913,914,915,916,994,996,998,999,545,546,549,550,553,892,907,908,909],911:[911,912,913,916,927,929,932,996,998,999,1002,907,909,910],912:[912,913,549,892,910,911],913:[913,927,929,910,911,912],914:[914,915,917,918,998,549,550,553,557,910],915:[915,916,917,918,998,910,914],916:[916,998,999,907,910,911,915],917:[917,918,919,920,553,557,561,914,915],918:[918,919,920,914,915,917],919:[919,920,921,922,557,561,565,917,918],920:[920,921,922,917,918,919],921:[921,922,923,924,561,565,569,919,920],922:[922,924,925,919,920,921],923:[923,924,183,569,921],924:[924,925,183,190,921,922,923],925:[925,190,197,922,924],926:[926,927,991,996,1e3,1002,627,628,631,632,906,909],927:[927,928,929,930,931,932,996,999,1e3,1002,631,632,635,636,639,907,909,911,913,926],928:[928,929,943,944,635,927],929:[929,635,911,913,927,928],930:[930,931,933,934,1002,635,636,639,643,927],931:[931,932,933,934,1002,927,930],932:[932,999,1002,907,911,927,931],933:[933,934,935,936,639,643,647,930,931],934:[934,935,936,930,931,933],935:[935,936,937,938,643,647,651,933,934],936:[936,937,938,933,934,935],937:[937,938,939,940,647,651,655,935,936],938:[938,940,941,935,936,937],939:[939,940,267,655,937],940:[940,941,260,267,937,938,939],941:[941,253,260,938,940],942:[942,943,958,963,1003,1005,627,628,631,632,813,816],943:[943,944,945,946,947,963,966,1003,1005,631,632,635,636,639,814,816,818,821,928,942],944:[944,635,818,821,928,943],945:[945,946,948,949,1005,635,636,639,643,943],946:[946,947,948,949,1005,943,945],947:[947,966,1005,814,818,943,946],948:[948,949,950,951,639,643,647,945,946],949:[949,950,951,945,946,948],950:[950,951,952,953,643,647,651,948,949],951:[951,952,953,948,949,950],952:[952,953,954,955,647,651,655,950,951],953:[953,955,956,950,951,952],954:[954,955,274,655,952],955:[955,956,274,281,952,953,954],956:[956,281,288,953,955],957:[957,960,969,981,993,368,372,458,544,630],958:[958,959,961,962,963,964,1003,1004,365,366,367,369,370,371,627,628,629,813,815,816,942],959:[959,960,961,962,963,964,1003,1004,366,367,368,370,371,372,628,629,630,958],960:[960,962,964,1004,367,368,371,372,629,630,957,959],961:[961,962,963,964,965,966,369,370,371,373,374,375,378,813,815,816,817,958,959],962:[962,963,964,965,966,370,371,372,374,375,378,958,959,960,961],963:[963,964,965,966,1003,1004,1005,813,815,816,817,818,942,943,958,959,961,962],964:[964,965,966,1003,1004,1005,958,959,960,961,962,963],965:[965,966,373,374,375,377,378,381,815,816,817,818,822,823,824,961,962,963,964],966:[966,1003,1004,1005,814,816,817,818,824,943,947,961,962,963,964,965],967:[967,968,970,971,972,973,976,977,365,366,367,369,370,371,455,456,457,834,836,837,854],968:[968,969,970,971,972,973,976,977,366,367,368,370,371,372,456,457,458,967],969:[969,971,973,977,367,368,371,372,457,458,957,968],970:[970,971,972,973,974,975,369,370,371,373,374,375,378,834,836,837,838,967,968],971:[971,972,973,974,975,370,371,372,374,375,378,967,968,969,970],972:[972,973,974,975,976,977,978,834,836,837,838,839,854,855,967,968,970,971],973:[973,974,975,976,977,978,967,968,969,970,971,972],974:[974,975,373,374,375,377,378,381,836,837,838,839,842,843,844,970,971,972,973],975:[975,976,977,978,835,837,838,839,844,855,860,970,971,972,973,974],976:[976,977,978,455,456,457,459,460,461,464,834,837,854,855,967,968,972,973,975],977:[977,978,456,457,458,460,461,464,967,968,969,972,973,975,976],978:[978,459,460,461,463,464,467,837,839,854,855,858,859,860,972,973,975,976,977],979:[979,980,982,983,984,985,988,989,365,366,367,455,456,457,541,542,543,870,872,873,890],980:[980,981,982,983,984,985,988,989,366,367,368,456,457,458,542,543,544,979],981:[981,983,985,989,367,368,457,458,543,544,957,980],982:[982,983,984,985,986,987,455,456,457,459,460,461,464,870,872,873,874,979,980],983:[983,984,985,986,987,456,457,458,460,461,464,979,980,981,982],984:[984,985,986,987,988,989,990,870,872,873,874,875,890,891,979,980,982,983],985:[985,986,987,988,989,990,979,980,981,982,983,984],986:[986,987,459,460,461,463,464,467,872,873,874,875,878,879,880,982,983,984,985],987:[987,988,989,990,871,873,874,875,880,891,896,982,983,984,985,986],988:[988,989,990,541,542,543,545,546,547,550,870,873,890,891,979,980,984,985,987],989:[989,990,542,543,544,546,547,550,979,980,981,984,985,987,988],990:[990,545,546,547,549,550,553,873,875,890,891,894,895,896,984,985,987,988,989],991:[991,992,994,995,996,997,1e3,1001,365,366,367,541,542,543,627,628,629,906,908,909,926],992:[992,993,994,995,996,997,1e3,1001,366,367,368,542,543,544,628,629,630,991],993:[993,995,997,1001,367,368,543,544,629,630,957,992],994:[994,995,996,997,998,999,541,542,543,545,546,547,550,906,908,909,910,991,992],995:[995,996,997,998,999,542,543,544,546,547,550,991,992,993,994],996:[996,997,998,999,1e3,1001,1002,906,908,909,910,911,926,927,991,992,994,995],997:[997,998,999,1e3,1001,1002,991,992,993,994,995,996],998:[998,999,545,546,547,549,550,553,908,909,910,911,914,915,916,994,995,996,997],999:[999,1e3,1001,1002,907,909,910,911,916,927,932,994,995,996,997,998],1e3:[1e3,1001,1002,627,628,629,631,632,633,636,906,909,926,927,991,992,996,997,999],1001:[1001,1002,628,629,630,632,633,636,991,992,993,996,997,999,1e3],1002:[1002,631,632,633,635,636,639,909,911,926,927,930,931,932,996,997,999,1e3,1001],1003:[1003,1004,1005,627,628,629,631,632,633,636,813,816,942,943,958,959,963,964,966],1004:[1004,1005,628,629,630,632,633,636,958,959,960,963,964,966,1003],1005:[1005,631,632,633,635,636,639,816,818,942,943,945,946,947,963,964,966,1003,1004]};async function Uh(t,e){const n=new Map;for(let s=0;s<t.length;s++){const a=new In(t[s].data);n.set(t[s],a)}const i=new Map;for(let s=0;s<e.length;s++){const a=new gn(e[s][0],e[s][1],e[s].data);i.set(s,a)}return await jt.create(n,i)}const vc={ConstructGraphNodeEdgesList:Uh};class mt{constructor(e,n,i){this.x=e,this.y=n,this.z=i}translate(e){this.x=this.x+e.x,this.y=this.y+e.y,this.z=this.z+e.z}}function Nh(t){let e=0;for(let i=0;i<t.length;i++)e=e+t[i];const n=e/t.length;return Number.isNaN(n)?0:n}function Fh(t,e){return Math.pow(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2),.5)}function Oh(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2)}function zh(t,e){var n=new Array(e),i=t.length,r=new Array(i);if(e>i)throw new RangeError("getRandom: more elements taken than available");for(;e--;){var s=Math.floor(Math.random()*i);n[e]=t[s in r?r[s]:s],r[s]=--i in r?r[i]:i}return n}function Bh(t,e){const n=new Map;let i;for(const r of t.keys())i=Math.random(),i<e&&n.set(r,t.get(r));return n}const Et={calculateAverage:Nh,calculateDistance:Fh,calculateSquaredDistance:Oh,getRandomSubset:zh,getRandomSubset_map:Bh};let kr=class{constructor(e){this.points=[],e.forEach(n=>{const i=new mt(n.x,n.y,n.z);this.points.push(i)})}};function xc(t,e,n){const i=new mt(t.x,t.y,t.z),r=new mt(e.x,e.y,e.z),s=[];for(let o=0;o<=n;o++){const c=o/n,l=c*i.x+(1-c)*r.x,h=c*i.y+(1-c)*r.y,f=c*i.z+(1-c)*r.z,d=new mt(l,h,f);s.push(d)}return new kr(s)}function Hh(t,e,n){const i=Et.calculateDistance(t,e),r=Math.round(i/n)+2;return xc(t,e,r)}function kh(t){let e=0,n=0,i=0;return t.forEach(s=>{e+=s.x,n+=s.y,i+=s.z}),e=e/t.length,n=n/t.length,i=i/t.length,new mt(e,n,i)}const wi={line_from_start_end_divisions:xc,line_from_start_end_distance:Hh,centroid:kh};async function Vh(t,e,n=1e3,i=1,r=1){const s=t.get_adjacency(),a=new Map,o=new Map;let c,l;for(const y of s.keys())c=Math.random()*n,l=Math.random()*n,a.set(y,c),o.set(y,l);for(let y=0;y<e;y++){let v,P,b,w,R,S,x,C,L,D,U,X,V,K;for(const G of s.keys()){const te=s.get(G);v=a.get(G),P=o.get(G),b=[],w=[],te.forEach(he=>{const re=a.get(he),Se=o.get(he);b.push(re),w.push(Se)}),U=Et.calculateAverage(b),X=Et.calculateAverage(w),R=[],S=[];let ie,ve,Le,Xe;for(const he of t.nodes.keys())he!=G&&(Le=a.get(he),Xe=o.get(he),ie=Le-v,ve=Xe-P,S.push(ie),R.push(ve));L=r*1/(Et.calculateAverage(S)*Et.calculateAverage(S)),D=r*1/(Et.calculateAverage(R)*Et.calculateAverage(R)),x=i*(U-v),C=i*(X-P),V=i*(0-v),K=i*(0-P);const q=L+V+x+v,Q=D+K+C+P;a.set(G,q),o.set(G,Q)}}let h=new Map;for(const y of a.keys())h.set(y,new mt(a.get(y),0,o.get(y)));const f=[],d=[],u=[];let g;for(const y of h.keys())g=h.get(y),f.push(g.x),d.push(g.y),u.push(g.z);const _=Et.calculateAverage(f),p=Et.calculateAverage(d),m=Et.calculateAverage(u),T=new mt(-_,-p,-m);return h=Sc(h,T),h}function Gh(t){const e=t.get_adjacency(),n=new Map,i=new Map;for(const s of e.keys())n.set(s,Math.random()*200),i.set(s,Math.random()*200);const r=new Map;for(const s of n.keys())r.set(s,new mt(n.get(s),0,i.get(s)));return r}function Mc(t,e){const n=new Map;let i,r,s;for(const a of t.edges.keys()){i=t.edges.get(a),r=t.nodes.get(i.start).data.pos,s=t.nodes.get(i.end).data.pos;const o=wi.line_from_start_end_distance(r,s,e);n.set(a,o)}return n}function Wh(t,e){const n=new Map;let i,r,s;for(const a of t.edges.keys()){i=t.edges.get(a),r=t.nodes.get(i.start).data.pos,s=t.nodes.get(i.end).data.pos;const o=wi.line_from_start_end_divisions(r,s,e);n.set(a,o)}return n}async function yc(t,e,n){const i=new Map;for(let T of t.keys())i.set(T,structuredClone(t.get(T)));let r,s,a,o,c,l,h,f,d,u,g,_,p,m;for(let T=0;T<e;T++)for(let y of i.keys()){r=i.get(y);for(let v=1;v<r.points.length-1;v++){a=[],o=[],c=[],l=r.points[v];for(let b of i.keys())if(b!=y){s=i.get(b);for(let w=1;w<s.points.length-1;w++)h=s.points[w],f=Et.calculateSquaredDistance(l,h),f<=Math.pow(n,2)&&(d=h.x-l.x,u=h.y-l.y,g=h.z-l.z,a.push(d),o.push(u),c.push(g))}_=l.x+.8*(Et.calculateAverage(a)||0),p=l.y+.8*(Et.calculateAverage(o)||0),m=l.z+.8*(Et.calculateAverage(c)||0);const P=new mt(_,p,m);r.points[v]=P}}return i}function Xh(t,e){const n=new Map;for(let i of t.keys())n.set(i,structuredClone(t.get(i)));for(const i of n.keys()){const r=n.get(i);let s,a;for(let o=0;o<r.points.length;o++)s=r.points[o],a=e*Math.sin(Math.PI*o/(r.points.length-1)),s.y=s.y+a}return n}function qh(t,e,n){let i=0,r,s;const a=o=>{const c=o[e];return typeof c=="number"?c:Number(c)||0};for(let o of t.nodes.values())r=a(o.data),r>=i&&(i=r);for(const o of t.nodes.values())r=a(o.data),s=i>0?r/i*n:0,s=Math.max(0,s),s=Math.min(n,s),o.data.pos.y=s}async function $h(t,e,n,i){const r=t.get_adjacency(),s=await Hr.Dijkstra(t,e),a=Math.max(...s.values()),o=new Map;for(let g=0;g<=a;g++){const _=[];for(const p of s.keys())g==s.get(p)&&_.push(p);o.set(g,_)}const c=new Map,l=i.x||0,h=i.y||0,f=i.z||0;for(const g of r.keys()){const _=s.get(g)*n,p=o.get(s.get(g)),m=2*Math.PI*(p.indexOf(g)/p.length),T=Math.sin(m)*_,y=Math.cos(m)*_,v=new mt(T+l,-_+h,y+f);c.set(g,v)}t.apply_position_map(c);const d=Mc(t,1),u=await yc(d,12,5);return{pmap:c,emap:u}}function Yh(t,e){const n=t.get_map(),i=Sc(n.pmap,e),r=jh(n.emap,e);t.apply_drawing_maps({pmap:i,emap:r})}function Sc(t,e){const n=new Map;for(let i of t.keys()){const r=t.get(i);r.translate(e),n.set(i,r)}return n}function jh(t,e){const n=new Map;let i,r,s;for(let a of t.keys()){i=[],r=t.get(a);for(let o of r.points)o.translate(e),i.push(o);s=new kr(i),n.set(a,s)}return n}function Zh(t,e){let n,i,r,s;for(const a of t.edges.keys())n=t.edges.get(a),i=t.nodes.get(n.start).data.pos,r=t.nodes.get(n.end).data.pos,s=wi.line_from_start_end_distance(i,r,e),n.data.ldata=s}function Kh(t,e){let n,i,r,s;for(const a of t.edges.keys())n=t.edges.get(a),i=t.nodes.get(n.start).data.pos,r=t.nodes.get(n.end).data.pos,s=wi.line_from_start_end_divisions(i,r,e),n.data.ldata=s}const Ec={SimulateKamadaKawai:Vh,DrawEdgeLines:Mc,DrawEdgeLinesDivisions:Wh,DrawEdgeBundling:yc,HivePlot:$h,DisplaceEdgeInY:Xh,MoveGraph:Yh,InstanciateRandomPositions:Gh,DisplaceVertices:qh,UpdateEdgeLinesDist:Zh,UpdateEdgeLinesDivs:Kh};async function Jh(t){const e=t.split(/\r?\n/),n=[],i=new Set;for(const c of e){const l=c.trim();if(!l||l.startsWith("#"))continue;const h=l.split(/\s+/);if(h.length<2)continue;const f=parseInt(h[0],10),d=parseInt(h[1],10);Number.isNaN(f)||Number.isNaN(d)||(n.push([f,d]),i.add(f),i.add(d))}const r=new Map,s=new mt(0,0,0);for(const c of i)r.set(c,new In({pos:s}));const a=new Map;return n.forEach(([c,l],h)=>{a.set(h,new gn(c,l,{}))}),await jt.create(r,a)}async function Qh(){const t=Dh;return await vc.ConstructGraphNodeEdgesList(t.nodes,t.edges)}async function ef(){const t=Lh,e=new Map,n=new Map;t.nodes.forEach(s=>{const a=s.id,o=new mt(s.px*50,0,s.py*50),c=s.member,l=new In({pos:o,size:10,info:"Node Info",modularity:c});e.set(a,l)});for(let s=0;s<t.edges.length;s++){const a=t.edges[s],o=a[0],c=a[1],l=new gn(o,c,{});n.set(s,l)}const i=await jt.create(e,n),r=Ec.DrawEdgeLines(i,20);return i.apply_edge_pos_maps(r),i}async function tf(t){const e=t.split(/\r?\n/),n=[],i=new Set;for(const f of e){const d=f.trim();if(!(!d||d.startsWith("#"))){if(d.startsWith("v ")){const u=d.slice(2).trim().split(/\s+/);if(u.length>=3){const g=parseFloat(u[0]),_=parseFloat(u[1]),p=parseFloat(u[2]);!Number.isNaN(g)&&!Number.isNaN(_)&&!Number.isNaN(p)&&n.push(g,_,p)}continue}if(d.startsWith("f ")){const u=d.slice(2).trim().split(/\s+/),g=[];for(const _ of u){const p=parseInt(_.split("/")[0],10);!Number.isNaN(p)&&p>=1&&g.push(p-1)}for(let _=0;_<g.length;_++){const p=g[_],m=g[(_+1)%g.length];if(p===m)continue;const T=p<m?`${p},${m}`:`${m},${p}`;i.add(T)}}}}const r=n.length/3,s=new Map,a=new mt(0,0,0);for(let f=0;f<r;f++)s.set(f,new In({pos:a}));const o=new Map;let c=0;for(const f of i){const[d,u]=f.split(",").map(g=>parseInt(g,10));o.set(c++,new gn(d,u,{}))}const l=await jt.create(s,o),h=new Float32Array(n);return{graph:l,positions:h}}async function nf(){const t=Ih,e=new Set;for(const l of Object.keys(t)){const h=parseInt(l,10);Number.isNaN(h)||e.add(h);for(const f of t[l])e.add(f)}const n=new Set;for(const l of Object.keys(t)){const h=parseInt(l,10);if(!Number.isNaN(h))for(const f of t[l]){const d=Math.min(h,f),u=Math.max(h,f);n.add(`${d},${u}`)}}const i=new Map,r=new mt(0,0,0),s=[...e].sort((l,h)=>l-h);for(const l of s)i.set(l,new In({pos:r}));const a=new Map;let o=0;for(const l of n){const[h,f]=l.split(",").map(d=>parseInt(d,10));a.set(o++,new gn(h,f,{}))}return await jt.create(i,a)}const rf={LoadZKC:Qh,LoadZKCSimulated:ef,LoadGraphFromEdgeListText:Jh,LoadGraphFromObjText:tf,LoadDwt1005:nf};/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class gn{constructor(e,n,i={}){this.start=e,this.end=n,this.data={...i}}}class jt{constructor(e,n){this.nodes=e,this.edges=n,this._nextEdgeId=n.size>0?Math.max(...n.keys())+1:0}printData(){const e="This is a graph with "+this.nodes.size+" nodes and "+this.edges.size+" edges";console.log(e)}async initialize(){await this.constructAdjacencyList()}static async create(e,n){const i=new jt(e,n);return await i.initialize(),i}async constructAdjacencyList(){this.edges.forEach(e=>{const n=e.start,i=e.end;this.nodes.get(n)&&this.nodes.get(n).neighbours.push(i),this.nodes.get(i)&&this.nodes.get(i).neighbours.push(n)}),await Promise.resolve();for(const e of this.nodes.keys()){const n=this.nodes.get(e).neighbours,i=[...new Set(n)],r=i.indexOf(e);r>-1&&i.splice(r,1),this.nodes.get(e).neighbours=i}}add_node(e,n){this.nodes.set(e,n)}add_edge(e,n,i={}){const r=new gn(e,n,i),s=this._nextEdgeId++;this.edges.set(s,r);const a=this.nodes.get(e),o=this.nodes.get(n);a&&a.neighbours.push(n),o&&o.neighbours.push(e)}remove_edge(e){const n=this.edges.get(e);if(!n)return!1;const{start:i,end:r}=n,s=this.nodes.get(i),a=this.nodes.get(r);if(s){const o=s.neighbours.indexOf(r);o>-1&&s.neighbours.splice(o,1)}if(a){const o=a.neighbours.indexOf(i);o>-1&&a.neighbours.splice(o,1)}return this.edges.delete(e),!0}remove_node(e){if(!this.nodes.has(e))return!1;const n=[];for(const[i,r]of this.edges.entries())(r.start===e||r.end===e)&&n.push(i);for(const i of n)this.remove_edge(i);return this.nodes.delete(e),!0}get_adjacency(){const e=new Map;for(const n of this.nodes.keys())e.set(n,this.nodes.get(n).neighbours);return e}apply_position_map(e){for(let n of e.keys())this.nodes.get(n).data={...this.nodes.get(n).data,pos:e.get(n)}}apply_edge_pos_maps(e){for(let n of e.keys())this.edges.get(n).data={...this.edges.get(n).data,ldata:e.get(n)}}get_edge_map(){const e=new Map;for(const n of this.edges.keys()){const i=this.edges.get(n).data.ldata;i!=null&&e.set(n,i)}return e}apply_drawing_maps(e){e.pmap&&this.apply_position_map(e.pmap),e.emap&&this.apply_edge_pos_maps(e.emap)}get_map(){return{pmap:this.get_position_map(),emap:this.get_edge_map()}}get_position_map(){var n,i;const e=new Map;for(const r of this.nodes.keys()){const s=(i=(n=this.nodes.get(r))==null?void 0:n.data)==null?void 0:i.pos;s!=null&&e.set(r,s)}return e}get_node_ids_order(){return Array.from(this.nodes.keys())}get_adjacency_matrix(){const e=this.get_node_ids_order(),n=e.length,i=new Float32Array(n*n),r=this.get_adjacency(),s=new Map;e.forEach((a,o)=>s.set(a,o));for(let a=0;a<n;a++){const o=e[a],c=r.get(o)??[];for(const l of c){const h=s.get(l);h!==void 0&&(i[a*n+h]=1)}}return{matrix:i,nodeIds:e}}}class In{constructor(e={}){this.data={...e},this.neighbours=[]}}async function _c(t,e){const n=t.get_adjacency(),i=new Map,r=new Set([e]),s=[e];for(i.set(e,-1);s.length>0;){const a=s.shift(),o=n.get(a);for(let c=0;c<o.length;c++){const l=o[c];r.has(l)||(r.add(l),s.push(l),i.set(l,a))}}return i}async function Rs(t,e){const n=t.get_adjacency(),i=new Map,r=await _c(t,e);for(const s of n.keys()){if(!r.has(s))continue;let a=0,o=r.get(s);for(;o!==void 0&&o!==-1;)o=r.get(o),a+=1;i.set(s,a)}return i}async function Ch(t){const e=[...t.nodes.keys()];if(e.length===0)return{start:0,end:0,distance:0};if(e.length===1)return{start:e[0],end:e[0],distance:0};const n=t.get_adjacency(),i=e.filter(l=>{var h;return(((h=n.get(l))==null?void 0:h.length)??0)>0}),r=i.length>0?i:e;let s=r[Math.floor(Math.random()*r.length)],a=await Rs(t,s),o=-1;for(const l of a.keys()){const h=a.get(l);h>o&&(s=l,o=h)}const c=s;a=await Rs(t,s),o=-1;for(const l of a.keys()){const h=a.get(l);h>o&&(s=l,o=h)}return{start:c,end:s,distance:o}}async function Ph(t,e){const n=new Map,i=new Map;e.forEach(a=>{const o=t.nodes.get(a);n.set(a,o)});let r=0;for(const a of t.edges.keys()){const o=t.edges.get(a);e.includes(o.start)&&e.includes(o.end)&&(i.set(r,o),r+=1)}return await jt.create(n,i)}const Hr={GraphDiameter:Ch,Dijkstra:Rs,BFSSearch:_c,SelectSubgraph:Ph},Dh={nodes:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],edges:[[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,10],[0,11],[0,12],[0,13],[0,17],[0,19],[0,21],[0,31],[1,2],[1,3],[1,7],[1,13],[1,17],[1,19],[1,21],[1,30],[2,3],[2,7],[2,8],[2,9],[2,13],[2,27],[2,28],[2,32],[3,7],[3,12],[3,13],[4,6],[4,10],[5,6],[5,10],[5,16],[6,16],[8,30],[8,32],[8,33],[9,33],[13,33],[14,32],[14,33],[15,32],[15,33],[18,32],[18,33],[19,33],[20,32],[20,33],[22,32],[22,33],[23,25],[23,27],[23,29],[23,32],[23,33],[24,25],[24,27],[24,31],[25,31],[26,29],[26,33],[27,33],[28,31],[28,33],[29,32],[29,33],[30,32],[30,33],[31,32],[31,33],[32,33]]},Lh={nodes:[{id:0,px:.09083423378081436,py:1.164162667707135,member:0},{id:1,px:-.5395391223661004,py:.8787097882002372,member:0},{id:2,px:.25483951690897244,py:-.011894166387290125,member:0},{id:3,px:.5292273814873625,py:.8137715604013231,member:0},{id:4,px:.6759740200024705,py:2.010590015934319,member:3},{id:5,px:.6648725961138767,py:2.3765595730406712,member:3},{id:6,px:-.015476857282255526,py:2.421851366492045,member:3},{id:7,px:.9923183157183725,py:.7358251458599251,member:0},{id:8,px:-.6148021363450372,py:-.03465499210385469,member:1},{id:9,px:.24714516178546894,py:-1.012380550604274,member:0},{id:10,px:1.3293288757439443,py:1.8641805845025743,member:3},{id:11,px:-.6571791278403557,py:2.2163816367270526,member:0},{id:12,px:1.5181044222926994,py:1.3282665066698078,member:0},{id:13,px:-.2979203330003603,py:.18438685313887027,member:0},{id:14,px:-1.7502345807734376,py:-1.0935551887354324,member:1},{id:15,px:-1.630224787934251,py:-1.5015879850995024,member:1},{id:16,px:.5585243394360673,py:3.5,member:3},{id:17,px:-.9776584881745712,py:1.799718659872538,member:0},{id:18,px:-1.385649185975611,py:-1.870388302312794,member:1},{id:19,px:-.9638464461397331,py:.24226946279518707,member:0},{id:20,px:-1.0268125129631975,py:-2.1543990524894148,member:1},{id:21,px:-1.3061680833745626,py:1.527228276383933,member:0},{id:22,px:-.5552461198316926,py:-2.2498070887997685,member:1},{id:23,px:.8262268914348979,py:-1.804253160744954,member:2},{id:24,px:1.9952840970427212,py:-1.0382885070400036,member:2},{id:25,px:1.9207660053211613,py:-.5823795272244723,member:2},{id:26,px:-.1664715343791652,py:-2.6527209168204373,member:1},{id:27,px:.9961959436268844,py:-1.0143754028553023,member:2},{id:28,px:.6488880579857091,py:-1.024671500275854,member:2},{id:29,px:.2398196340697841,py:-2.171491081802323,member:1},{id:30,px:-1.3348117368940753,py:-.31290471156377053,member:1},{id:31,px:.6901260074375327,py:-.2526601933356052,member:2},{id:32,px:-.6030949145287146,py:-1.0927507849665647,member:1},{id:33,px:-.3533395323856202,py:-1.1887389845640028,member:1}],edges:[[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[0,8],[0,10],[0,11],[0,12],[0,13],[0,17],[0,19],[0,21],[0,31],[1,2],[1,3],[1,7],[1,13],[1,17],[1,19],[1,21],[1,30],[2,3],[2,7],[2,8],[2,9],[2,13],[2,27],[2,28],[2,32],[3,7],[3,12],[3,13],[4,6],[4,10],[5,6],[5,10],[5,16],[6,16],[8,30],[8,32],[8,33],[9,33],[13,33],[14,32],[14,33],[15,32],[15,33],[18,32],[18,33],[19,33],[20,32],[20,33],[22,32],[22,33],[23,25],[23,27],[23,29],[23,32],[23,33],[24,25],[24,27],[24,31],[25,31],[26,29],[26,33],[27,33],[28,31],[28,33],[29,32],[29,33],[30,32],[30,33],[31,32],[31,33],[32,33]]};async function Ih(t,e){const n=new Map;for(let s=0;s<t.length;s++){const a=new In(t[s].data);n.set(t[s],a)}const i=new Map;for(let s=0;s<e.length;s++){const a=new gn(e[s][0],e[s][1],e[s].data);i.set(s,a)}return await jt.create(n,i)}const vc={ConstructGraphNodeEdgesList:Ih};class mt{constructor(e,n,i){this.x=e,this.y=n,this.z=i}translate(e){this.x=this.x+e.x,this.y=this.y+e.y,this.z=this.z+e.z}}function Uh(t){let e=0;for(let i=0;i<t.length;i++)e=e+t[i];const n=e/t.length;return Number.isNaN(n)?0:n}function Nh(t,e){return Math.pow(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2),.5)}function Fh(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2)}function Oh(t,e){var n=new Array(e),i=t.length,r=new Array(i);if(e>i)throw new RangeError("getRandom: more elements taken than available");for(;e--;){var s=Math.floor(Math.random()*i);n[e]=t[s in r?r[s]:s],r[s]=--i in r?r[i]:i}return n}function zh(t,e){const n=new Map;let i;for(const r of t.keys())i=Math.random(),i<e&&n.set(r,t.get(r));return n}const Et={calculateAverage:Uh,calculateDistance:Nh,calculateSquaredDistance:Fh,getRandomSubset:Oh,getRandomSubset_map:zh};let kr=class{constructor(e){this.points=[],e.forEach(n=>{const i=new mt(n.x,n.y,n.z);this.points.push(i)})}};function xc(t,e,n){const i=new mt(t.x,t.y,t.z),r=new mt(e.x,e.y,e.z),s=[];for(let o=0;o<=n;o++){const c=o/n,l=c*i.x+(1-c)*r.x,h=c*i.y+(1-c)*r.y,f=c*i.z+(1-c)*r.z,d=new mt(l,h,f);s.push(d)}return new kr(s)}function Bh(t,e,n){const i=Et.calculateDistance(t,e),r=Math.round(i/n)+2;return xc(t,e,r)}function Hh(t){let e=0,n=0,i=0;return t.forEach(s=>{e+=s.x,n+=s.y,i+=s.z}),e=e/t.length,n=n/t.length,i=i/t.length,new mt(e,n,i)}const wi={line_from_start_end_divisions:xc,line_from_start_end_distance:Bh,centroid:Hh};async function kh(t,e,n=1e3,i=1,r=1){const s=t.get_adjacency(),a=new Map,o=new Map;let c,l;for(const y of s.keys())c=Math.random()*n,l=Math.random()*n,a.set(y,c),o.set(y,l);for(let y=0;y<e;y++){let v,P,b,w,R,S,x,C,L,D,U,X,V,K;for(const G of s.keys()){const te=s.get(G);v=a.get(G),P=o.get(G),b=[],w=[],te.forEach(he=>{const re=a.get(he),Se=o.get(he);b.push(re),w.push(Se)}),U=Et.calculateAverage(b),X=Et.calculateAverage(w),R=[],S=[];let ie,ve,Le,Xe;for(const he of t.nodes.keys())he!=G&&(Le=a.get(he),Xe=o.get(he),ie=Le-v,ve=Xe-P,S.push(ie),R.push(ve));L=r*1/(Et.calculateAverage(S)*Et.calculateAverage(S)),D=r*1/(Et.calculateAverage(R)*Et.calculateAverage(R)),x=i*(U-v),C=i*(X-P),V=i*(0-v),K=i*(0-P);const q=L+V+x+v,Q=D+K+C+P;a.set(G,q),o.set(G,Q)}}let h=new Map;for(const y of a.keys())h.set(y,new mt(a.get(y),0,o.get(y)));const f=[],d=[],u=[];let g;for(const y of h.keys())g=h.get(y),f.push(g.x),d.push(g.y),u.push(g.z);const _=Et.calculateAverage(f),p=Et.calculateAverage(d),m=Et.calculateAverage(u),T=new mt(-_,-p,-m);return h=Sc(h,T),h}function Vh(t){const e=t.get_adjacency(),n=new Map,i=new Map;for(const s of e.keys())n.set(s,Math.random()*200),i.set(s,Math.random()*200);const r=new Map;for(const s of n.keys())r.set(s,new mt(n.get(s),0,i.get(s)));return r}function Mc(t,e){const n=new Map;let i,r,s;for(const a of t.edges.keys()){i=t.edges.get(a),r=t.nodes.get(i.start).data.pos,s=t.nodes.get(i.end).data.pos;const o=wi.line_from_start_end_distance(r,s,e);n.set(a,o)}return n}function Gh(t,e){const n=new Map;let i,r,s;for(const a of t.edges.keys()){i=t.edges.get(a),r=t.nodes.get(i.start).data.pos,s=t.nodes.get(i.end).data.pos;const o=wi.line_from_start_end_divisions(r,s,e);n.set(a,o)}return n}async function yc(t,e,n){const i=new Map;for(let T of t.keys())i.set(T,structuredClone(t.get(T)));let r,s,a,o,c,l,h,f,d,u,g,_,p,m;for(let T=0;T<e;T++)for(let y of i.keys()){r=i.get(y);for(let v=1;v<r.points.length-1;v++){a=[],o=[],c=[],l=r.points[v];for(let b of i.keys())if(b!=y){s=i.get(b);for(let w=1;w<s.points.length-1;w++)h=s.points[w],f=Et.calculateSquaredDistance(l,h),f<=Math.pow(n,2)&&(d=h.x-l.x,u=h.y-l.y,g=h.z-l.z,a.push(d),o.push(u),c.push(g))}_=l.x+.8*(Et.calculateAverage(a)||0),p=l.y+.8*(Et.calculateAverage(o)||0),m=l.z+.8*(Et.calculateAverage(c)||0);const P=new mt(_,p,m);r.points[v]=P}}return i}function Wh(t,e){const n=new Map;for(let i of t.keys())n.set(i,structuredClone(t.get(i)));for(const i of n.keys()){const r=n.get(i);let s,a;for(let o=0;o<r.points.length;o++)s=r.points[o],a=e*Math.sin(Math.PI*o/(r.points.length-1)),s.y=s.y+a}return n}function Xh(t,e,n){let i=0,r,s;const a=o=>{const c=o[e];return typeof c=="number"?c:Number(c)||0};for(let o of t.nodes.values())r=a(o.data),r>=i&&(i=r);for(const o of t.nodes.values())r=a(o.data),s=i>0?r/i*n:0,s=Math.max(0,s),s=Math.min(n,s),o.data.pos.y=s}async function qh(t,e,n,i){const r=t.get_adjacency(),s=await Hr.Dijkstra(t,e),a=Math.max(...s.values()),o=new Map;for(let g=0;g<=a;g++){const _=[];for(const p of s.keys())g==s.get(p)&&_.push(p);o.set(g,_)}const c=new Map,l=i.x||0,h=i.y||0,f=i.z||0;for(const g of r.keys()){const _=s.get(g)*n,p=o.get(s.get(g)),m=2*Math.PI*(p.indexOf(g)/p.length),T=Math.sin(m)*_,y=Math.cos(m)*_,v=new mt(T+l,-_+h,y+f);c.set(g,v)}t.apply_position_map(c);const d=Mc(t,1),u=await yc(d,12,5);return{pmap:c,emap:u}}function $h(t,e){const n=t.get_map(),i=Sc(n.pmap,e),r=Yh(n.emap,e);t.apply_drawing_maps({pmap:i,emap:r})}function Sc(t,e){const n=new Map;for(let i of t.keys()){const r=t.get(i);r.translate(e),n.set(i,r)}return n}function Yh(t,e){const n=new Map;let i,r,s;for(let a of t.keys()){i=[],r=t.get(a);for(let o of r.points)o.translate(e),i.push(o);s=new kr(i),n.set(a,s)}return n}function jh(t,e){let n,i,r,s;for(const a of t.edges.keys())n=t.edges.get(a),i=t.nodes.get(n.start).data.pos,r=t.nodes.get(n.end).data.pos,s=wi.line_from_start_end_distance(i,r,e),n.data.ldata=s}function Zh(t,e){let n,i,r,s;for(const a of t.edges.keys())n=t.edges.get(a),i=t.nodes.get(n.start).data.pos,r=t.nodes.get(n.end).data.pos,s=wi.line_from_start_end_divisions(i,r,e),n.data.ldata=s}const Ec={SimulateKamadaKawai:kh,DrawEdgeLines:Mc,DrawEdgeLinesDivisions:Gh,DrawEdgeBundling:yc,HivePlot:qh,DisplaceEdgeInY:Wh,MoveGraph:$h,InstanciateRandomPositions:Vh,DisplaceVertices:Xh,UpdateEdgeLinesDist:jh,UpdateEdgeLinesDivs:Zh};async function Kh(t){const e=t.split(/\r?\n/),n=[],i=new Set;for(const c of e){const l=c.trim();if(!l||l.startsWith("#"))continue;const h=l.split(/\s+/);if(h.length<2)continue;const f=parseInt(h[0],10),d=parseInt(h[1],10);Number.isNaN(f)||Number.isNaN(d)||(n.push([f,d]),i.add(f),i.add(d))}const r=new Map,s=new mt(0,0,0);for(const c of i)r.set(c,new In({pos:s}));const a=new Map;return n.forEach(([c,l],h)=>{a.set(h,new gn(c,l,{}))}),await jt.create(r,a)}async function Jh(){const t=Dh;return await vc.ConstructGraphNodeEdgesList(t.nodes,t.edges)}async function Qh(){const t=Lh,e=new Map,n=new Map;t.nodes.forEach(s=>{const a=s.id,o=new mt(s.px*50,0,s.py*50),c=s.member,l=new In({pos:o,size:10,info:"Node Info",modularity:c});e.set(a,l)});for(let s=0;s<t.edges.length;s++){const a=t.edges[s],o=a[0],c=a[1],l=new gn(o,c,{});n.set(s,l)}const i=await jt.create(e,n),r=Ec.DrawEdgeLines(i,20);return i.apply_edge_pos_maps(r),i}async function ef(t){const e=t.split(/\r?\n/),n=[],i=new Set;for(const f of e){const d=f.trim();if(!(!d||d.startsWith("#"))){if(d.startsWith("v ")){const u=d.slice(2).trim().split(/\s+/);if(u.length>=3){const g=parseFloat(u[0]),_=parseFloat(u[1]),p=parseFloat(u[2]);!Number.isNaN(g)&&!Number.isNaN(_)&&!Number.isNaN(p)&&n.push(g,_,p)}continue}if(d.startsWith("f ")){const u=d.slice(2).trim().split(/\s+/),g=[];for(const _ of u){const p=parseInt(_.split("/")[0],10);!Number.isNaN(p)&&p>=1&&g.push(p-1)}for(let _=0;_<g.length;_++){const p=g[_],m=g[(_+1)%g.length];if(p===m)continue;const T=p<m?`${p},${m}`:`${m},${p}`;i.add(T)}}}}const r=n.length/3,s=new Map,a=new mt(0,0,0);for(let f=0;f<r;f++)s.set(f,new In({pos:a}));const o=new Map;let c=0;for(const f of i){const[d,u]=f.split(",").map(g=>parseInt(g,10));o.set(c++,new gn(d,u,{}))}const l=await jt.create(s,o),h=new Float32Array(n);return{graph:l,positions:h}}async function tf(){const{dwt_1005:t}=await Promise.resolve().then(()=>require("./dwt_1005-C-ThS_oR.js")),e=t,n=new Set;for(const h of Object.keys(e)){const f=parseInt(h,10);Number.isNaN(f)||n.add(f);for(const d of e[h])n.add(d)}const i=new Set;for(const h of Object.keys(e)){const f=parseInt(h,10);if(!Number.isNaN(f))for(const d of e[h]){const u=Math.min(f,d),g=Math.max(f,d);i.add(`${u},${g}`)}}const r=new Map,s=new mt(0,0,0),a=[...n].sort((h,f)=>h-f);for(const h of a)r.set(h,new In({pos:s}));const o=new Map;let c=0;for(const h of i){const[f,d]=h.split(",").map(u=>parseInt(u,10));o.set(c++,new gn(f,d,{}))}return await jt.create(r,o)}const nf={LoadZKC:Jh,LoadZKCSimulated:Qh,LoadGraphFromEdgeListText:Kh,LoadGraphFromObjText:ef,LoadDwt1005:tf};/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2010-2024 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const Ma="170",_i={ROTATE:0,DOLLY:1,PAN:2},pi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},sf=0,Qa=1,af=2,Tc=1,of=2,hn=3,Dn=0,Ct=1,Jt=2,Cn=0,vi=1,eo=2,to=3,no=4,cf=5,Vn=100,lf=101,hf=102,ff=103,df=104,uf=200,pf=201,mf=202,gf=203,Cs=204,Ps=205,_f=206,vf=207,xf=208,Mf=209,yf=210,Sf=211,Ef=212,Tf=213,bf=214,Ds=0,Ls=1,Is=2,yi=3,Us=4,Ns=5,Fs=6,Os=7,bc=0,Af=1,wf=2,Pn=0,Rf=1,Cf=2,Pf=3,Df=4,Lf=5,If=6,Uf=7,Ac=300,Si=301,Ei=302,zs=303,Bs=304,Vr=306,Hs=1e3,Wn=1001,ks=1002,It=1003,Nf=1004,Ji=1005,Qt=1006,Zr=1007,Xn=1008,pn=1009,wc=1010,Rc=1011,Xi=1012,ya=1013,qn=1014,en=1015,$i=1016,Sa=1017,Ea=1018,Ti=1020,Cc=35902,Pc=1021,Dc=1022,qt=1023,Lc=1024,Ic=1025,xi=1026,bi=1027,Ta=1028,ba=1029,Uc=1030,Aa=1031,wa=1033,Ar=33776,wr=33777,Rr=33778,Cr=33779,Vs=35840,Gs=35841,Ws=35842,Xs=35843,qs=36196,$s=37492,Ys=37496,js=37808,Zs=37809,Ks=37810,Js=37811,Qs=37812,ea=37813,ta=37814,na=37815,ia=37816,ra=37817,sa=37818,aa=37819,oa=37820,ca=37821,Pr=36492,la=36494,ha=36495,Nc=36283,fa=36284,da=36285,ua=36286,Ff=3200,Of=3201,zf=0,Bf=1,Rn="",Ot="srgb",Ri="srgb-linear",Gr="linear",Ze="srgb",Qn=7680,io=519,Hf=512,kf=513,Vf=514,Fc=515,Gf=516,Wf=517,Xf=518,qf=519,ro=35044,so="300 es",dn=2e3,Nr=2001;class Yn{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const _t=["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"],Dr=Math.PI/180,pa=180/Math.PI;function Yi(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(_t[t&255]+_t[t>>8&255]+_t[t>>16&255]+_t[t>>24&255]+"-"+_t[e&255]+_t[e>>8&255]+"-"+_t[e>>16&15|64]+_t[e>>24&255]+"-"+_t[n&63|128]+_t[n>>8&255]+"-"+_t[n>>16&255]+_t[n>>24&255]+_t[i&255]+_t[i>>8&255]+_t[i>>16&255]+_t[i>>24&255]).toLowerCase()}function Tt(t,e,n){return Math.max(e,Math.min(n,t))}function $f(t,e){return(t%e+e)%e}function Kr(t,e,n){return(1-n)*t+n*e}function Ui(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function At(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const Yf={DEG2RAD:Dr};class we{constructor(e=0,n=0){we.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),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}}class De{constructor(e,n,i,r,s,a,o,c,l){De.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,a,o,c,l)}set(e,n,i,r,s,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=n,h[4]=s,h[5]=c,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,a=i[0],o=i[3],c=i[6],l=i[1],h=i[4],f=i[7],d=i[2],u=i[5],g=i[8],_=r[0],p=r[3],m=r[6],T=r[1],y=r[4],v=r[7],P=r[2],b=r[5],w=r[8];return s[0]=a*_+o*T+c*P,s[3]=a*p+o*y+c*b,s[6]=a*m+o*v+c*w,s[1]=l*_+h*T+f*P,s[4]=l*p+h*y+f*b,s[7]=l*m+h*v+f*w,s[2]=d*_+u*T+g*P,s[5]=d*p+u*y+g*b,s[8]=d*m+u*v+g*w,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return n*a*h-n*o*l-i*s*h+i*o*c+r*s*l-r*a*c}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=h*a-o*l,d=o*c-h*s,u=l*s-a*c,g=n*f+i*d+r*u;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=f*_,e[1]=(r*l-h*i)*_,e[2]=(o*i-r*a)*_,e[3]=d*_,e[4]=(h*n-r*c)*_,e[5]=(r*s-o*n)*_,e[6]=u*_,e[7]=(i*c-l*n)*_,e[8]=(a*n-i*s)*_,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(i*c,i*l,-i*(c*a+l*o)+a+e,-r*l,r*c,-r*(-l*a+c*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(Jr.makeScale(e,n)),this}rotate(e){return this.premultiply(Jr.makeRotation(-e)),this}translate(e,n){return this.premultiply(Jr.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Jr=new De;function Oc(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function qi(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function jf(){const t=qi("canvas");return t.style.display="block",t}const ao={};function Vi(t){t in ao||(ao[t]=!0,console.warn(t))}function Zf(t,e,n){return new Promise(function(i,r){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}function Kf(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Jf(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ge={enabled:!0,workingColorSpace:Ri,spaces:{},convert:function(t,e,n){return this.enabled===!1||e===n||!e||!n||(this.spaces[e].transfer===Ze&&(t.r=un(t.r),t.g=un(t.g),t.b=un(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Ze&&(t.r=Mi(t.r),t.g=Mi(t.g),t.b=Mi(t.b))),t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Rn?Gr:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}};function un(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Mi(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const oo=[.64,.33,.3,.6,.15,.06],co=[.2126,.7152,.0722],lo=[.3127,.329],ho=new De().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),fo=new De().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ge.define({[Ri]:{primaries:oo,whitePoint:lo,transfer:Gr,toXYZ:ho,fromXYZ:fo,luminanceCoefficients:co,workingColorSpaceConfig:{unpackColorSpace:Ot},outputColorSpaceConfig:{drawingBufferColorSpace:Ot}},[Ot]:{primaries:oo,whitePoint:lo,transfer:Ze,toXYZ:ho,fromXYZ:fo,luminanceCoefficients:co,outputColorSpaceConfig:{drawingBufferColorSpace:Ot}}});let ei;class Qf{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ei===void 0&&(ei=qi("canvas")),ei.width=e.width,ei.height=e.height;const i=ei.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=ei}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=qi("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=un(s[a]/255)*255;return i.putImageData(r,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(un(n[i]/255)*255):n[i]=un(n[i]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let ed=0;class zc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ed++}),this.uuid=Yi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Qr(r[a].image)):s.push(Qr(r[a]))}else s=Qr(r);i.url=s}return n||(e.images[this.uuid]=i),i}}function Qr(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Qf.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let td=0;class Mt extends Yn{constructor(e=Mt.DEFAULT_IMAGE,n=Mt.DEFAULT_MAPPING,i=Wn,r=Wn,s=Qt,a=Xn,o=qt,c=pn,l=Mt.DEFAULT_ANISOTROPY,h=Rn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:td++}),this.uuid=Yi(),this.name="",this.source=new zc(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new we(0,0),this.repeat=new we(1,1),this.center=new we(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new De,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(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 Hs:e.x=e.x-Math.floor(e.x);break;case Wn:e.x=e.x<0?0:1;break;case ks: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 Hs:e.y=e.y-Math.floor(e.y);break;case Wn:e.y=e.y<0?0:1;break;case ks: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++}}Mt.DEFAULT_IMAGE=null;Mt.DEFAULT_MAPPING=Ac;Mt.DEFAULT_ANISOTROPY=1;class st{constructor(e=0,n=0,i=0,r=1){st.prototype.isVector4=!0,this.x=e,this.y=n,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,n,i,r){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*n+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*n+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*n+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*n+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);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,s;const c=e.elements,l=c[0],h=c[4],f=c[8],d=c[1],u=c[5],g=c[9],_=c[2],p=c[6],m=c[10];if(Math.abs(h-d)<.01&&Math.abs(f-_)<.01&&Math.abs(g-p)<.01){if(Math.abs(h+d)<.1&&Math.abs(f+_)<.1&&Math.abs(g+p)<.1&&Math.abs(l+u+m-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const y=(l+1)/2,v=(u+1)/2,P=(m+1)/2,b=(h+d)/4,w=(f+_)/4,R=(g+p)/4;return y>v&&y>P?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=b/i,s=w/i):v>P?v<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(v),i=b/r,s=R/r):P<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(P),i=w/s,r=R/s),this.set(i,r,s,n),this}let T=Math.sqrt((p-g)*(p-g)+(f-_)*(f-_)+(d-h)*(d-h));return Math.abs(T)<.001&&(T=1),this.x=(p-g)/T,this.y=(f-_)/T,this.z=(d-h)/T,this.w=Math.acos((l+u+m-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class nd extends Yn{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new st(0,0,e,n),this.scissorTest=!1,this.viewport=new st(0,0,e,n);const r={width:e,height:n,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Mt(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,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=n,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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 i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new zc(n),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}dispose(){this.dispatchEvent({type:"dispose"})}}class $n extends nd{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class Bc extends Mt{constructor(e=null,n=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=Wn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class id extends Mt{constructor(e=null,n=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=Wn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ln{constructor(e=0,n=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}static slerpFlat(e,n,i,r,s,a,o){let c=i[r+0],l=i[r+1],h=i[r+2],f=i[r+3];const d=s[a+0],u=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[n+0]=c,e[n+1]=l,e[n+2]=h,e[n+3]=f;return}if(o===1){e[n+0]=d,e[n+1]=u,e[n+2]=g,e[n+3]=_;return}if(f!==_||c!==d||l!==u||h!==g){let p=1-o;const m=c*d+l*u+h*g+f*_,T=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){const P=Math.sqrt(y),b=Math.atan2(P,m*T);p=Math.sin(p*b)/P,o=Math.sin(o*b)/P}const v=o*T;if(c=c*p+d*v,l=l*p+u*v,h=h*p+g*v,f=f*p+_*v,p===1-o){const P=1/Math.sqrt(c*c+l*l+h*h+f*f);c*=P,l*=P,h*=P,f*=P}}e[n]=c,e[n+1]=l,e[n+2]=h,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,r,s,a){const o=i[r],c=i[r+1],l=i[r+2],h=i[r+3],f=s[a],d=s[a+1],u=s[a+2],g=s[a+3];return e[n]=o*g+h*f+c*u-l*d,e[n+1]=c*g+h*d+l*f-o*u,e[n+2]=l*g+h*u+o*d-c*f,e[n+3]=h*g-o*f-c*d-l*u,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,n,i,r){return this._x=e,this._y=n,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,n=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(i/2),h=o(r/2),f=o(s/2),d=c(i/2),u=c(r/2),g=c(s/2);switch(a){case"XYZ":this._x=d*h*f+l*u*g,this._y=l*u*f-d*h*g,this._z=l*h*g+d*u*f,this._w=l*h*f-d*u*g;break;case"YXZ":this._x=d*h*f+l*u*g,this._y=l*u*f-d*h*g,this._z=l*h*g-d*u*f,this._w=l*h*f+d*u*g;break;case"ZXY":this._x=d*h*f-l*u*g,this._y=l*u*f+d*h*g,this._z=l*h*g+d*u*f,this._w=l*h*f-d*u*g;break;case"ZYX":this._x=d*h*f-l*u*g,this._y=l*u*f+d*h*g,this._z=l*h*g-d*u*f,this._w=l*h*f+d*u*g;break;case"YZX":this._x=d*h*f+l*u*g,this._y=l*u*f+d*h*g,this._z=l*h*g-d*u*f,this._w=l*h*f-d*u*g;break;case"XZY":this._x=d*h*f-l*u*g,this._y=l*u*f-d*h*g,this._z=l*h*g+d*u*f,this._w=l*h*f+d*u*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],r=n[4],s=n[8],a=n[1],o=n[5],c=n[9],l=n[2],h=n[6],f=n[10],d=i+o+f;if(d>0){const u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(h-c)*u,this._y=(s-l)*u,this._z=(a-r)*u}else if(i>o&&i>f){const u=2*Math.sqrt(1+i-o-f);this._w=(h-c)/u,this._x=.25*u,this._y=(r+a)/u,this._z=(s+l)/u}else if(o>f){const u=2*Math.sqrt(1+o-i-f);this._w=(s-l)/u,this._x=(r+a)/u,this._y=.25*u,this._z=(c+h)/u}else{const u=2*Math.sqrt(1+f-i-o);this._w=(a-r)/u,this._x=(s+l)/u,this._y=(c+h)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Tt(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/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,n){const i=e._x,r=e._y,s=e._z,a=e._w,o=n._x,c=n._y,l=n._z,h=n._w;return this._x=i*h+a*o+r*l-s*c,this._y=r*h+a*c+s*o-i*l,this._z=s*h+a*l+i*c-r*o,this._w=a*h-i*o-r*c-s*l,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const c=1-o*o;if(c<=Number.EPSILON){const u=1-n;return this._w=u*a+n*this._w,this._x=u*i+n*this._x,this._y=u*r+n*this._y,this._z=u*s+n*this._z,this.normalize(),this}const l=Math.sqrt(c),h=Math.atan2(l,o),f=Math.sin((1-n)*h)/l,d=Math.sin(n*h)/l;return this._w=a*f+this._w*d,this._x=i*f+this._x*d,this._y=r*f+this._y*d,this._z=s*f+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=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(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),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}}class z{constructor(e=0,n=0,i=0){z.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(uo.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(uo.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6]*r,this.y=s[1]*n+s[4]*i+s[7]*r,this.z=s[2]*n+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*n+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*n+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*n+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*n+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*r-o*i),h=2*(o*n-s*r),f=2*(s*i-a*n);return this.x=n+c*l+a*f-o*h,this.y=i+c*h+o*l-s*f,this.z=r+c*f+s*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r,this.y=s[1]*n+s[5]*i+s[9]*r,this.z=s[2]*n+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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,s=e.z,a=n.x,o=n.y,c=n.z;return this.x=r*c-s*o,this.y=s*a-i*c,this.z=i*o-r*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return es.copy(this).projectOnVector(e),this.sub(es)}reflect(e){return this.sub(es.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+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,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const es=new z,uo=new Ln;class jn{constructor(e=new z(1/0,1/0,1/0),n=new z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Vt.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Vt.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Vt.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}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,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Vt):Vt.fromBufferAttribute(s,a),Vt.applyMatrix4(e.matrixWorld),this.expandByPoint(Vt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Qi.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Qi.copy(i.boundingBox)),Qi.applyMatrix4(e.matrixWorld),this.union(Qi)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],n);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,n){return n.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,Vt),Vt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ni),er.subVectors(this.max,Ni),ti.subVectors(e.a,Ni),ni.subVectors(e.b,Ni),ii.subVectors(e.c,Ni),xn.subVectors(ni,ti),Mn.subVectors(ii,ni),Nn.subVectors(ti,ii);let n=[0,-xn.z,xn.y,0,-Mn.z,Mn.y,0,-Nn.z,Nn.y,xn.z,0,-xn.x,Mn.z,0,-Mn.x,Nn.z,0,-Nn.x,-xn.y,xn.x,0,-Mn.y,Mn.x,0,-Nn.y,Nn.x,0];return!ts(n,ti,ni,ii,er)||(n=[1,0,0,0,1,0,0,0,1],!ts(n,ti,ni,ii,er))?!1:(tr.crossVectors(xn,Mn),n=[tr.x,tr.y,tr.z],ts(n,ti,ni,ii,er))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Vt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Vt).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:(sn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),sn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),sn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),sn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),sn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),sn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),sn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),sn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(sn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const sn=[new z,new z,new z,new z,new z,new z,new z,new z],Vt=new z,Qi=new jn,ti=new z,ni=new z,ii=new z,xn=new z,Mn=new z,Nn=new z,Ni=new z,er=new z,tr=new z,Fn=new z;function ts(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){Fn.fromArray(t,s);const o=r.x*Math.abs(Fn.x)+r.y*Math.abs(Fn.y)+r.z*Math.abs(Fn.z),c=e.dot(Fn),l=n.dot(Fn),h=i.dot(Fn);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const rd=new jn,Fi=new z,ns=new z;class Zn{constructor(e=new z,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):rd.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){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;Fi.subVectors(e,this.center);const n=Fi.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(Fi,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):(ns.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fi.copy(e.center).add(ns)),this.expandByPoint(Fi.copy(e.center).sub(ns))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const an=new z,is=new z,nr=new z,yn=new z,rs=new z,ir=new z,ss=new z;class ji{constructor(e=new z,n=new z(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,an)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=an.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(an.copy(this.origin).addScaledVector(this.direction,n),an.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){is.copy(e).add(n).multiplyScalar(.5),nr.copy(n).sub(e).normalize(),yn.copy(this.origin).sub(is);const s=e.distanceTo(n)*.5,a=-this.direction.dot(nr),o=yn.dot(this.direction),c=-yn.dot(nr),l=yn.lengthSq(),h=Math.abs(1-a*a);let f,d,u,g;if(h>0)if(f=a*c-o,d=a*o-c,g=s*h,f>=0)if(d>=-g)if(d<=g){const _=1/h;f*=_,d*=_,u=f*(f+a*d+2*o)+d*(a*f+d+2*c)+l}else d=s,f=Math.max(0,-(a*d+o)),u=-f*f+d*(d+2*c)+l;else d=-s,f=Math.max(0,-(a*d+o)),u=-f*f+d*(d+2*c)+l;else d<=-g?(f=Math.max(0,-(-a*s+o)),d=f>0?-s:Math.min(Math.max(-s,-c),s),u=-f*f+d*(d+2*c)+l):d<=g?(f=0,d=Math.min(Math.max(-s,-c),s),u=d*(d+2*c)+l):(f=Math.max(0,-(a*s+o)),d=f>0?s:Math.min(Math.max(-s,-c),s),u=-f*f+d*(d+2*c)+l);else d=a>0?-s:s,f=Math.max(0,-(a*d+o)),u=-f*f+d*(d+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(is).addScaledVector(nr,d),u}intersectSphere(e,n){an.subVectors(e.center,this.origin);const i=an.dot(this.direction),r=an.dot(an)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,c=i+a;return c<0?null:o<0?this.at(c,n):this.at(o,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,s,a,o,c;const l=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-d.z)*f,c=(e.max.z-d.z)*f):(o=(e.max.z-d.z)*f,c=(e.min.z-d.z)*f),i>c||o>r)||((o>i||i!==i)&&(i=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,an)!==null}intersectTriangle(e,n,i,r,s){rs.subVectors(n,e),ir.subVectors(i,e),ss.crossVectors(rs,ir);let a=this.direction.dot(ss),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;yn.subVectors(this.origin,e);const c=o*this.direction.dot(ir.crossVectors(yn,ir));if(c<0)return null;const l=o*this.direction.dot(rs.cross(yn));if(l<0||c+l>a)return null;const h=-o*yn.dot(ss);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)}}class je{constructor(e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p){je.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p)}set(e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p){const m=this.elements;return m[0]=e,m[4]=n,m[8]=i,m[12]=r,m[1]=s,m[5]=a,m[9]=o,m[13]=c,m[2]=l,m[6]=h,m[10]=f,m[14]=d,m[3]=u,m[7]=g,m[11]=_,m[15]=p,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 je().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,r=1/ri.setFromMatrixColumn(e,0).length(),s=1/ri.setFromMatrixColumn(e,1).length(),a=1/ri.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*s,n[5]=i[5]*s,n[6]=i[6]*s,n[7]=0,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),c=Math.cos(r),l=Math.sin(r),h=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const d=a*h,u=a*f,g=o*h,_=o*f;n[0]=c*h,n[4]=-c*f,n[8]=l,n[1]=u+g*l,n[5]=d-_*l,n[9]=-o*c,n[2]=_-d*l,n[6]=g+u*l,n[10]=a*c}else if(e.order==="YXZ"){const d=c*h,u=c*f,g=l*h,_=l*f;n[0]=d+_*o,n[4]=g*o-u,n[8]=a*l,n[1]=a*f,n[5]=a*h,n[9]=-o,n[2]=u*o-g,n[6]=_+d*o,n[10]=a*c}else if(e.order==="ZXY"){const d=c*h,u=c*f,g=l*h,_=l*f;n[0]=d-_*o,n[4]=-a*f,n[8]=g+u*o,n[1]=u+g*o,n[5]=a*h,n[9]=_-d*o,n[2]=-a*l,n[6]=o,n[10]=a*c}else if(e.order==="ZYX"){const d=a*h,u=a*f,g=o*h,_=o*f;n[0]=c*h,n[4]=g*l-u,n[8]=d*l+_,n[1]=c*f,n[5]=_*l+d,n[9]=u*l-g,n[2]=-l,n[6]=o*c,n[10]=a*c}else if(e.order==="YZX"){const d=a*c,u=a*l,g=o*c,_=o*l;n[0]=c*h,n[4]=_-d*f,n[8]=g*f+u,n[1]=f,n[5]=a*h,n[9]=-o*h,n[2]=-l*h,n[6]=u*f+g,n[10]=d-_*f}else if(e.order==="XZY"){const d=a*c,u=a*l,g=o*c,_=o*l;n[0]=c*h,n[4]=-f,n[8]=l*h,n[1]=d*f+_,n[5]=a*h,n[9]=u*f-g,n[2]=g*f-u,n[6]=o*h,n[10]=_*f+d}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(sd,e,ad)}lookAt(e,n,i){const r=this.elements;return Dt.subVectors(e,n),Dt.lengthSq()===0&&(Dt.z=1),Dt.normalize(),Sn.crossVectors(i,Dt),Sn.lengthSq()===0&&(Math.abs(i.z)===1?Dt.x+=1e-4:Dt.z+=1e-4,Dt.normalize(),Sn.crossVectors(i,Dt)),Sn.normalize(),rr.crossVectors(Dt,Sn),r[0]=Sn.x,r[4]=rr.x,r[8]=Dt.x,r[1]=Sn.y,r[5]=rr.y,r[9]=Dt.y,r[2]=Sn.z,r[6]=rr.z,r[10]=Dt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,a=i[0],o=i[4],c=i[8],l=i[12],h=i[1],f=i[5],d=i[9],u=i[13],g=i[2],_=i[6],p=i[10],m=i[14],T=i[3],y=i[7],v=i[11],P=i[15],b=r[0],w=r[4],R=r[8],S=r[12],x=r[1],C=r[5],L=r[9],D=r[13],U=r[2],X=r[6],V=r[10],K=r[14],G=r[3],te=r[7],ie=r[11],ve=r[15];return s[0]=a*b+o*x+c*U+l*G,s[4]=a*w+o*C+c*X+l*te,s[8]=a*R+o*L+c*V+l*ie,s[12]=a*S+o*D+c*K+l*ve,s[1]=h*b+f*x+d*U+u*G,s[5]=h*w+f*C+d*X+u*te,s[9]=h*R+f*L+d*V+u*ie,s[13]=h*S+f*D+d*K+u*ve,s[2]=g*b+_*x+p*U+m*G,s[6]=g*w+_*C+p*X+m*te,s[10]=g*R+_*L+p*V+m*ie,s[14]=g*S+_*D+p*K+m*ve,s[3]=T*b+y*x+v*U+P*G,s[7]=T*w+y*C+v*X+P*te,s[11]=T*R+y*L+v*V+P*ie,s[15]=T*S+y*D+v*K+P*ve,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],f=e[6],d=e[10],u=e[14],g=e[3],_=e[7],p=e[11],m=e[15];return g*(+s*c*f-r*l*f-s*o*d+i*l*d+r*o*u-i*c*u)+_*(+n*c*u-n*l*d+s*a*d-r*a*u+r*l*h-s*c*h)+p*(+n*l*f-n*o*u-s*a*f+i*a*u+s*o*h-i*l*h)+m*(-r*o*h-n*c*f+n*o*d+r*a*f-i*a*d+i*c*h)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=f*p*l-_*d*l+_*c*u-o*p*u-f*c*m+o*d*m,y=g*d*l-h*p*l-g*c*u+a*p*u+h*c*m-a*d*m,v=h*_*l-g*f*l+g*o*u-a*_*u-h*o*m+a*f*m,P=g*f*c-h*_*c-g*o*d+a*_*d+h*o*p-a*f*p,b=n*T+i*y+r*v+s*P;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=T*w,e[1]=(_*d*s-f*p*s-_*r*u+i*p*u+f*r*m-i*d*m)*w,e[2]=(o*p*s-_*c*s+_*r*l-i*p*l-o*r*m+i*c*m)*w,e[3]=(f*c*s-o*d*s-f*r*l+i*d*l+o*r*u-i*c*u)*w,e[4]=y*w,e[5]=(h*p*s-g*d*s+g*r*u-n*p*u-h*r*m+n*d*m)*w,e[6]=(g*c*s-a*p*s-g*r*l+n*p*l+a*r*m-n*c*m)*w,e[7]=(a*d*s-h*c*s+h*r*l-n*d*l-a*r*u+n*c*u)*w,e[8]=v*w,e[9]=(g*f*s-h*_*s-g*i*u+n*_*u+h*i*m-n*f*m)*w,e[10]=(a*_*s-g*o*s+g*i*l-n*_*l-a*i*m+n*o*m)*w,e[11]=(h*o*s-a*f*s-h*i*l+n*f*l+a*i*u-n*o*u)*w,e[12]=P*w,e[13]=(h*_*r-g*f*r+g*i*d-n*_*d-h*i*p+n*f*p)*w,e[14]=(g*o*r-a*_*r-g*i*c+n*_*c+a*i*p-n*o*p)*w,e[15]=(a*f*r-h*o*r+h*i*c-n*f*c-a*i*d+n*o*d)*w,this}scale(e){const n=this.elements,i=e.x,r=e.y,s=e.z;return n[0]*=i,n[4]*=r,n[8]*=s,n[1]*=i,n[5]*=r,n[9]*=s,n[2]*=i,n[6]*=r,n[10]*=s,n[3]*=i,n[7]*=r,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=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(n,i,r))}makeTranslation(e,n,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,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),s=1-i,a=e.x,o=e.y,c=e.z,l=s*a,h=s*o;return this.set(l*a+i,l*o-r*c,l*c+r*o,0,l*o+r*c,h*o+i,h*c-r*a,0,l*c-r*o,h*c+r*a,s*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,n,r,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,s=n._x,a=n._y,o=n._z,c=n._w,l=s+s,h=a+a,f=o+o,d=s*l,u=s*h,g=s*f,_=a*h,p=a*f,m=o*f,T=c*l,y=c*h,v=c*f,P=i.x,b=i.y,w=i.z;return r[0]=(1-(_+m))*P,r[1]=(u+v)*P,r[2]=(g-y)*P,r[3]=0,r[4]=(u-v)*b,r[5]=(1-(d+m))*b,r[6]=(p+T)*b,r[7]=0,r[8]=(g+y)*w,r[9]=(p-T)*w,r[10]=(1-(d+_))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;let s=ri.set(r[0],r[1],r[2]).length();const a=ri.set(r[4],r[5],r[6]).length(),o=ri.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Gt.copy(this);const l=1/s,h=1/a,f=1/o;return Gt.elements[0]*=l,Gt.elements[1]*=l,Gt.elements[2]*=l,Gt.elements[4]*=h,Gt.elements[5]*=h,Gt.elements[6]*=h,Gt.elements[8]*=f,Gt.elements[9]*=f,Gt.elements[10]*=f,n.setFromRotationMatrix(Gt),i.x=s,i.y=a,i.z=o,this}makePerspective(e,n,i,r,s,a,o=dn){const c=this.elements,l=2*s/(n-e),h=2*s/(i-r),f=(n+e)/(n-e),d=(i+r)/(i-r);let u,g;if(o===dn)u=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Nr)u=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=u,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,i,r,s,a,o=dn){const c=this.elements,l=1/(n-e),h=1/(i-r),f=1/(a-s),d=(n+e)*l,u=(i+r)*h;let g,_;if(o===dn)g=(a+s)*f,_=-2*f;else if(o===Nr)g=s*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-u,c[2]=0,c[6]=0,c[10]=_,c[14]=-g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const ri=new z,Gt=new je,sd=new z(0,0,0),ad=new z(1,1,1),Sn=new z,rr=new z,Dt=new z,po=new je,mo=new Ln;class mn{constructor(e=0,n=0,i=0,r=mn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,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,n,i,r=this._order){return this._x=e,this._y=n,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,n=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],c=r[1],l=r[5],h=r[9],f=r[2],d=r[6],u=r[10];switch(n){case"XYZ":this._y=Math.asin(Tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Tt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Tt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Tt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return po.makeRotationFromQuaternion(e),this.setFromRotationMatrix(po,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return mo.setFromEuler(this),this.setFromQuaternion(mo,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}mn.DEFAULT_ORDER="XYZ";class Ra{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let od=0;const go=new z,si=new Ln,on=new je,sr=new z,Oi=new z,cd=new z,ld=new Ln,_o=new z(1,0,0),vo=new z(0,1,0),xo=new z(0,0,1),Mo={type:"added"},hd={type:"removed"},ai={type:"childadded",child:null},as={type:"childremoved",child:null};class ut extends Yn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:od++}),this.uuid=Yi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ut.DEFAULT_UP.clone();const e=new z,n=new mn,i=new Ln,r=new z(1,1,1);function s(){i.setFromEuler(n,!1)}function a(){n.setFromQuaternion(i,void 0,!1)}n._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new je},normalMatrix:{value:new De}}),this.matrix=new je,this.matrixWorld=new je,this.matrixAutoUpdate=ut.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ra,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return si.setFromAxisAngle(e,n),this.quaternion.multiply(si),this}rotateOnWorldAxis(e,n){return si.setFromAxisAngle(e,n),this.quaternion.premultiply(si),this}rotateX(e){return this.rotateOnAxis(_o,e)}rotateY(e){return this.rotateOnAxis(vo,e)}rotateZ(e){return this.rotateOnAxis(xo,e)}translateOnAxis(e,n){return go.copy(e).applyQuaternion(this.quaternion),this.position.add(go.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(_o,e)}translateY(e){return this.translateOnAxis(vo,e)}translateZ(e){return this.translateOnAxis(xo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(on.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?sr.copy(e):sr.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Oi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?on.lookAt(Oi,sr,this.up):on.lookAt(sr,Oi,this.up),this.quaternion.setFromRotationMatrix(on),r&&(on.extractRotation(r.matrixWorld),si.setFromRotationMatrix(on),this.quaternion.premultiply(si.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Mo),ai.child=e,this.dispatchEvent(ai),ai.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(hd),as.child=e,this.dispatchEvent(as),as.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),on.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),on.multiply(e.parent.matrixWorld)),e.applyMatrix4(on),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Mo),ai.child=e,this.dispatchEvent(ai),ai.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,n);if(a!==void 0)return a}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,e,cd),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,ld,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n){const 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)),n===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const f=c[l];s(e.shapes,f)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));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++){const c=this.animations[o];r.animations.push(s(e.animations,c))}}if(n){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),f=a(e.shapes),d=a(e.skeletons),u=a(e.animations),g=a(e.nodes);o.length>0&&(i.geometries=o),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),f.length>0&&(i.shapes=f),d.length>0&&(i.skeletons=d),u.length>0&&(i.animations=u),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const c=[];for(const l in o){const h=o[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}ut.DEFAULT_UP=new z(0,1,0);ut.DEFAULT_MATRIX_AUTO_UPDATE=!0;ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Wt=new z,cn=new z,os=new z,ln=new z,oi=new z,ci=new z,yo=new z,cs=new z,ls=new z,hs=new z,fs=new st,ds=new st,us=new st;class Xt{constructor(e=new z,n=new z,i=new z){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),Wt.subVectors(e,n),r.cross(Wt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,n,i,r,s){Wt.subVectors(r,n),cn.subVectors(i,n),os.subVectors(e,n);const a=Wt.dot(Wt),o=Wt.dot(cn),c=Wt.dot(os),l=cn.dot(cn),h=cn.dot(os),f=a*l-o*o;if(f===0)return s.set(0,0,0),null;const d=1/f,u=(l*c-o*h)*d,g=(a*h-o*c)*d;return s.set(1-u-g,g,u)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,ln)===null?!1:ln.x>=0&&ln.y>=0&&ln.x+ln.y<=1}static getInterpolation(e,n,i,r,s,a,o,c){return this.getBarycoord(e,n,i,r,ln)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,ln.x),c.addScaledVector(a,ln.y),c.addScaledVector(o,ln.z),c)}static getInterpolatedAttribute(e,n,i,r,s,a){return fs.setScalar(0),ds.setScalar(0),us.setScalar(0),fs.fromBufferAttribute(e,n),ds.fromBufferAttribute(e,i),us.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(fs,s.x),a.addScaledVector(ds,s.y),a.addScaledVector(us,s.z),a}static isFrontFacing(e,n,i,r){return Wt.subVectors(i,n),cn.subVectors(e,n),Wt.cross(cn).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,i,r){return this.a.fromBufferAttribute(e,n),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 Wt.subVectors(this.c,this.b),cn.subVectors(this.a,this.b),Wt.cross(cn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Xt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Xt.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,s){return Xt.getInterpolation(e,this.a,this.b,this.c,n,i,r,s)}containsPoint(e){return Xt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Xt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,r=this.b,s=this.c;let a,o;oi.subVectors(r,i),ci.subVectors(s,i),cs.subVectors(e,i);const c=oi.dot(cs),l=ci.dot(cs);if(c<=0&&l<=0)return n.copy(i);ls.subVectors(e,r);const h=oi.dot(ls),f=ci.dot(ls);if(h>=0&&f<=h)return n.copy(r);const d=c*f-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),n.copy(i).addScaledVector(oi,a);hs.subVectors(e,s);const u=oi.dot(hs),g=ci.dot(hs);if(g>=0&&u<=g)return n.copy(s);const _=u*l-c*g;if(_<=0&&l>=0&&g<=0)return o=l/(l-g),n.copy(i).addScaledVector(ci,o);const p=h*g-u*f;if(p<=0&&f-h>=0&&u-g>=0)return yo.subVectors(s,r),o=(f-h)/(f-h+(u-g)),n.copy(r).addScaledVector(yo,o);const m=1/(p+_+d);return a=_*m,o=d*m,n.copy(i).addScaledVector(oi,a).addScaledVector(ci,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Hc={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},En={h:0,s:0,l:0},ar={h:0,s:0,l:0};function ps(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class Oe{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Ot){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ge.toWorkingColorSpace(this,n),this}setRGB(e,n,i,r=Ge.workingColorSpace){return this.r=e,this.g=n,this.b=i,Ge.toWorkingColorSpace(this,r),this}setHSL(e,n,i,r=Ge.workingColorSpace){if(e=$f(e,1),n=Tt(n,0,1),i=Tt(i,0,1),n===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+n):i+n-i*n,a=2*i-s;this.r=ps(a,s,e+1/3),this.g=ps(a,s,e),this.b=ps(a,s,e-1/3)}return Ge.toWorkingColorSpace(this,r),this}setStyle(e,n=Ot){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const 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,n);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,n);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,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const 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,n);if(a===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Ot){const i=Hc[e.toLowerCase()];return i!==void 0?this.setHex(i,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=un(e.r),this.g=un(e.g),this.b=un(e.b),this}copyLinearToSRGB(e){return this.r=Mi(e.r),this.g=Mi(e.g),this.b=Mi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ot){return Ge.fromWorkingColorSpace(vt.copy(this),e),Math.round(Tt(vt.r*255,0,255))*65536+Math.round(Tt(vt.g*255,0,255))*256+Math.round(Tt(vt.b*255,0,255))}getHexString(e=Ot){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Ge.workingColorSpace){Ge.fromWorkingColorSpace(vt.copy(this),n);const i=vt.r,r=vt.g,s=vt.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const f=a-o;switch(l=h<=.5?f/(a+o):f/(2-a-o),a){case i:c=(r-s)/f+(r<s?6:0);break;case r:c=(s-i)/f+2;break;case s:c=(i-r)/f+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,n=Ge.workingColorSpace){return Ge.fromWorkingColorSpace(vt.copy(this),n),e.r=vt.r,e.g=vt.g,e.b=vt.b,e}getStyle(e=Ot){Ge.fromWorkingColorSpace(vt.copy(this),e);const n=vt.r,i=vt.g,r=vt.b;return e!==Ot?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,n,i){return this.getHSL(En),this.setHSL(En.h+e,En.s+n,En.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.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,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(En),e.getHSL(ar);const i=Kr(En.h,ar.h,n),r=Kr(En.s,ar.s,n),s=Kr(En.l,ar.l,n);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*n+s[3]*i+s[6]*r,this.g=s[1]*n+s[4]*i+s[7]*r,this.b=s[2]*n+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const vt=new Oe;Oe.NAMES=Hc;let fd=0;class Ci extends Yn{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fd++}),this.uuid=Yi(),this.name="",this.blending=vi,this.side=Dn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Cs,this.blendDst=Ps,this.blendEquation=Vn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Oe(0,0,0),this.blendAlpha=0,this.depthFunc=yi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=io,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Qn,this.stencilZFail=Qn,this.stencilZPass=Qn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){console.warn(`THREE.Material: '${n}' 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[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==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.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!==vi&&(i.blending=this.blending),this.side!==Dn&&(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!==Cs&&(i.blendSrc=this.blendSrc),this.blendDst!==Ps&&(i.blendDst=this.blendDst),this.blendEquation!==Vn&&(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!==yi&&(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!==io&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Qn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Qn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Qn&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const c=s[o];delete c.metadata,a.push(c)}return a}if(n){const 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;const n=e.clippingPlanes;let i=null;if(n!==null){const r=n.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=n[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Pi extends Ci{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new Oe(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 mn,this.combine=bc,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}}const ct=new z,or=new we;class Bt{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=ro,this.updateRanges=[],this.gpuType=en,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}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,n,i){e*=this.itemSize,i*=n.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=n.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)or.fromBufferAttribute(this,n),or.applyMatrix3(e),this.setXY(n,or.x,or.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.applyMatrix3(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.applyMatrix4(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.applyNormalMatrix(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.transformDirection(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Ui(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=At(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ui(n,this.array)),n}setX(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ui(n,this.array)),n}setY(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Ui(n,this.array)),n}setZ(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Ui(n,this.array)),n}setW(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=At(n,this.array),i=At(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,r){return e*=this.itemSize,this.normalized&&(n=At(n,this.array),i=At(i,this.array),r=At(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,n,i,r,s){return e*=this.itemSize,this.normalized&&(n=At(n,this.array),i=At(i,this.array),r=At(r,this.array),s=At(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ro&&(e.usage=this.usage),e}}class kc extends Bt{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class Vc extends Bt{constructor(e,n,i){super(new Int32Array(e),n,i)}}class Gc extends Bt{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class ot extends Bt{constructor(e,n,i){super(new Float32Array(e),n,i)}}let dd=0;const Ft=new je,ms=new ut,li=new z,Lt=new jn,zi=new jn,dt=new z;class pt extends Yn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dd++}),this.uuid=Yi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Oc(e)?Gc:kc)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new De().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ft.makeRotationFromQuaternion(e),this.applyMatrix4(Ft),this}rotateX(e){return Ft.makeRotationX(e),this.applyMatrix4(Ft),this}rotateY(e){return Ft.makeRotationY(e),this.applyMatrix4(Ft),this}rotateZ(e){return Ft.makeRotationZ(e),this.applyMatrix4(Ft),this}translate(e,n,i){return Ft.makeTranslation(e,n,i),this.applyMatrix4(Ft),this}scale(e,n,i){return Ft.makeScale(e,n,i),this.applyMatrix4(Ft),this}lookAt(e){return ms.lookAt(e),ms.updateMatrix(),this.applyMatrix4(ms.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(li).negate(),this.translate(li.x,li.y,li.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new ot(i,3))}else{for(let i=0,r=n.count;i<r;i++){const s=e[i];n.setXYZ(i,s.x,s.y,s.z||0)}e.length>n.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jn);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new z(-1/0,-1/0,-1/0),new z(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,r=n.length;i<r;i++){const s=n[i];Lt.setFromBufferAttribute(s),this.morphTargetsRelative?(dt.addVectors(this.boundingBox.min,Lt.min),this.boundingBox.expandByPoint(dt),dt.addVectors(this.boundingBox.max,Lt.max),this.boundingBox.expandByPoint(dt)):(this.boundingBox.expandByPoint(Lt.min),this.boundingBox.expandByPoint(Lt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Zn);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new z,1/0);return}if(e){const i=this.boundingSphere.center;if(Lt.setFromBufferAttribute(e),n)for(let s=0,a=n.length;s<a;s++){const o=n[s];zi.setFromBufferAttribute(o),this.morphTargetsRelative?(dt.addVectors(Lt.min,zi.min),Lt.expandByPoint(dt),dt.addVectors(Lt.max,zi.max),Lt.expandByPoint(dt)):(Lt.expandByPoint(zi.min),Lt.expandByPoint(zi.max))}Lt.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)dt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(dt));if(n)for(let s=0,a=n.length;s<a;s++){const o=n[s],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)dt.fromBufferAttribute(o,l),c&&(li.fromBufferAttribute(e,l),dt.add(li)),r=Math.max(r,i.distanceToSquared(dt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,r=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Bt(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let R=0;R<i.count;R++)o[R]=new z,c[R]=new z;const l=new z,h=new z,f=new z,d=new we,u=new we,g=new we,_=new z,p=new z;function m(R,S,x){l.fromBufferAttribute(i,R),h.fromBufferAttribute(i,S),f.fromBufferAttribute(i,x),d.fromBufferAttribute(s,R),u.fromBufferAttribute(s,S),g.fromBufferAttribute(s,x),h.sub(l),f.sub(l),u.sub(d),g.sub(d);const C=1/(u.x*g.y-g.x*u.y);isFinite(C)&&(_.copy(h).multiplyScalar(g.y).addScaledVector(f,-u.y).multiplyScalar(C),p.copy(f).multiplyScalar(u.x).addScaledVector(h,-g.x).multiplyScalar(C),o[R].add(_),o[S].add(_),o[x].add(_),c[R].add(p),c[S].add(p),c[x].add(p))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let R=0,S=T.length;R<S;++R){const x=T[R],C=x.start,L=x.count;for(let D=C,U=C+L;D<U;D+=3)m(e.getX(D+0),e.getX(D+1),e.getX(D+2))}const y=new z,v=new z,P=new z,b=new z;function w(R){P.fromBufferAttribute(r,R),b.copy(P);const S=o[R];y.copy(S),y.sub(P.multiplyScalar(P.dot(S))).normalize(),v.crossVectors(b,S);const C=v.dot(c[R])<0?-1:1;a.setXYZW(R,y.x,y.y,y.z,C)}for(let R=0,S=T.length;R<S;++R){const x=T[R],C=x.start,L=x.count;for(let D=C,U=C+L;D<U;D+=3)w(e.getX(D+0)),w(e.getX(D+1)),w(e.getX(D+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Bt(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let d=0,u=i.count;d<u;d++)i.setXYZ(d,0,0,0);const r=new z,s=new z,a=new z,o=new z,c=new z,l=new z,h=new z,f=new z;if(e)for(let d=0,u=e.count;d<u;d+=3){const g=e.getX(d+0),_=e.getX(d+1),p=e.getX(d+2);r.fromBufferAttribute(n,g),s.fromBufferAttribute(n,_),a.fromBufferAttribute(n,p),h.subVectors(a,s),f.subVectors(r,s),h.cross(f),o.fromBufferAttribute(i,g),c.fromBufferAttribute(i,_),l.fromBufferAttribute(i,p),o.add(h),c.add(h),l.add(h),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(_,c.x,c.y,c.z),i.setXYZ(p,l.x,l.y,l.z)}else for(let d=0,u=n.count;d<u;d+=3)r.fromBufferAttribute(n,d+0),s.fromBufferAttribute(n,d+1),a.fromBufferAttribute(n,d+2),h.subVectors(a,s),f.subVectors(r,s),h.cross(f),i.setXYZ(d+0,h.x,h.y,h.z),i.setXYZ(d+1,h.x,h.y,h.z),i.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)dt.fromBufferAttribute(e,n),dt.normalize(),e.setXYZ(n,dt.x,dt.y,dt.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,f=o.normalized,d=new l.constructor(c.length*h);let u=0,g=0;for(let _=0,p=c.length;_<p;_++){o.isInterleavedBufferAttribute?u=c[_]*o.data.stride+o.offset:u=c[_]*h;for(let m=0;m<h;m++)d[g++]=l[u++]}return new Bt(d,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new pt,i=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,i);n.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let h=0,f=l.length;h<f;h++){const d=l[h],u=e(d,i);c.push(u)}n.morphAttributes[o]=c}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];n.addGroup(l.start,l.count,l.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let f=0,d=l.length;f<d;f++){const u=l[f];h.push(u.toJSON(e.data))}h.length>0&&(r[c]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(n));const r=e.attributes;for(const l in r){const h=r[l];this.setAttribute(l,h.clone(n))}const s=e.morphAttributes;for(const l in s){const h=[],f=s[l];for(let d=0,u=f.length;d<u;d++)h.push(f[d].clone(n));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const f=a[l];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const So=new je,On=new ji,cr=new Zn,Eo=new z,lr=new z,hr=new z,fr=new z,gs=new z,dr=new z,To=new z,ur=new z;class Rt extends ut{constructor(e=new pt,n=new Pi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){dr.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const h=o[c],f=s[c];h!==0&&(gs.fromBufferAttribute(f,e),a?dr.addScaledVector(gs,h):dr.addScaledVector(gs.sub(n),h))}n.add(dr)}return n}raycast(e,n){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),cr.copy(i.boundingSphere),cr.applyMatrix4(s),On.copy(e.ray).recast(e.near),!(cr.containsPoint(On.origin)===!1&&(On.intersectSphere(cr,Eo)===null||On.origin.distanceToSquared(Eo)>(e.far-e.near)**2))&&(So.copy(s).invert(),On.copy(e.ray).applyMatrix4(So),!(i.boundingBox!==null&&On.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,On)))}_computeIntersections(e,n,i){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,h=s.attributes.uv1,f=s.attributes.normal,d=s.groups,u=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const p=d[g],m=a[p.materialIndex],T=Math.max(p.start,u.start),y=Math.min(o.count,Math.min(p.start+p.count,u.start+u.count));for(let v=T,P=y;v<P;v+=3){const b=o.getX(v),w=o.getX(v+1),R=o.getX(v+2);r=pr(this,m,e,i,l,h,f,b,w,R),r&&(r.faceIndex=Math.floor(v/3),r.face.materialIndex=p.materialIndex,n.push(r))}}else{const g=Math.max(0,u.start),_=Math.min(o.count,u.start+u.count);for(let p=g,m=_;p<m;p+=3){const T=o.getX(p),y=o.getX(p+1),v=o.getX(p+2);r=pr(this,a,e,i,l,h,f,T,y,v),r&&(r.faceIndex=Math.floor(p/3),n.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const p=d[g],m=a[p.materialIndex],T=Math.max(p.start,u.start),y=Math.min(c.count,Math.min(p.start+p.count,u.start+u.count));for(let v=T,P=y;v<P;v+=3){const b=v,w=v+1,R=v+2;r=pr(this,m,e,i,l,h,f,b,w,R),r&&(r.faceIndex=Math.floor(v/3),r.face.materialIndex=p.materialIndex,n.push(r))}}else{const g=Math.max(0,u.start),_=Math.min(c.count,u.start+u.count);for(let p=g,m=_;p<m;p+=3){const T=p,y=p+1,v=p+2;r=pr(this,a,e,i,l,h,f,T,y,v),r&&(r.faceIndex=Math.floor(p/3),n.push(r))}}}}function ud(t,e,n,i,r,s,a,o){let c;if(e.side===Ct?c=i.intersectTriangle(a,s,r,!0,o):c=i.intersectTriangle(r,s,a,e.side===Dn,o),c===null)return null;ur.copy(o),ur.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(ur);return l<n.near||l>n.far?null:{distance:l,point:ur.clone(),object:t}}function pr(t,e,n,i,r,s,a,o,c,l){t.getVertexPosition(o,lr),t.getVertexPosition(c,hr),t.getVertexPosition(l,fr);const h=ud(t,e,n,i,lr,hr,fr,To);if(h){const f=new z;Xt.getBarycoord(To,lr,hr,fr,f),r&&(h.uv=Xt.getInterpolatedAttribute(r,o,c,l,f,new we)),s&&(h.uv1=Xt.getInterpolatedAttribute(s,o,c,l,f,new we)),a&&(h.normal=Xt.getInterpolatedAttribute(a,o,c,l,f,new z),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new z,materialIndex:0};Xt.getNormal(lr,hr,fr,d.normal),h.face=d,h.barycoord=f}return h}class Kn extends pt{constructor(e=1,n=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],h=[],f=[];let d=0,u=0;g("z","y","x",-1,-1,i,n,e,a,s,0),g("z","y","x",1,-1,i,n,-e,a,s,1),g("x","z","y",1,1,e,i,n,r,a,2),g("x","z","y",1,-1,e,i,-n,r,a,3),g("x","y","z",1,-1,e,n,i,r,s,4),g("x","y","z",-1,-1,e,n,-i,r,s,5),this.setIndex(c),this.setAttribute("position",new ot(l,3)),this.setAttribute("normal",new ot(h,3)),this.setAttribute("uv",new ot(f,2));function g(_,p,m,T,y,v,P,b,w,R,S){const x=v/w,C=P/R,L=v/2,D=P/2,U=b/2,X=w+1,V=R+1;let K=0,G=0;const te=new z;for(let ie=0;ie<V;ie++){const ve=ie*C-D;for(let Le=0;Le<X;Le++){const Xe=Le*x-L;te[_]=Xe*T,te[p]=ve*y,te[m]=U,l.push(te.x,te.y,te.z),te[_]=0,te[p]=0,te[m]=b>0?1:-1,h.push(te.x,te.y,te.z),f.push(Le/w),f.push(1-ie/R),K+=1}}for(let ie=0;ie<R;ie++)for(let ve=0;ve<w;ve++){const Le=d+ve+X*ie,Xe=d+ve+X*(ie+1),q=d+(ve+1)+X*(ie+1),Q=d+(ve+1)+X*ie;c.push(Le,Xe,Q),c.push(Xe,q,Q),G+=6}o.addGroup(u,G,S),u+=G,d+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ai(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function St(t){const e={};for(let n=0;n<t.length;n++){const i=Ai(t[n]);for(const r in i)e[r]=i[r]}return e}function pd(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function Wc(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ge.workingColorSpace}const md={clone:Ai,merge:St};var gd=`void main() {
|
|
5
|
+
*/const Ma="170",_i={ROTATE:0,DOLLY:1,PAN:2},pi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},rf=0,Qa=1,sf=2,Tc=1,af=2,hn=3,Dn=0,Ct=1,Jt=2,Cn=0,vi=1,eo=2,to=3,no=4,of=5,Vn=100,cf=101,lf=102,hf=103,ff=104,df=200,uf=201,pf=202,mf=203,Cs=204,Ps=205,gf=206,_f=207,vf=208,xf=209,Mf=210,yf=211,Sf=212,Ef=213,Tf=214,Ds=0,Ls=1,Is=2,yi=3,Us=4,Ns=5,Fs=6,Os=7,bc=0,bf=1,Af=2,Pn=0,wf=1,Rf=2,Cf=3,Pf=4,Df=5,Lf=6,If=7,Ac=300,Si=301,Ei=302,zs=303,Bs=304,Vr=306,Hs=1e3,Wn=1001,ks=1002,It=1003,Uf=1004,Ji=1005,Qt=1006,Zr=1007,Xn=1008,pn=1009,wc=1010,Rc=1011,Xi=1012,ya=1013,qn=1014,en=1015,$i=1016,Sa=1017,Ea=1018,Ti=1020,Cc=35902,Pc=1021,Dc=1022,qt=1023,Lc=1024,Ic=1025,xi=1026,bi=1027,Ta=1028,ba=1029,Uc=1030,Aa=1031,wa=1033,Ar=33776,wr=33777,Rr=33778,Cr=33779,Vs=35840,Gs=35841,Ws=35842,Xs=35843,qs=36196,$s=37492,Ys=37496,js=37808,Zs=37809,Ks=37810,Js=37811,Qs=37812,ea=37813,ta=37814,na=37815,ia=37816,ra=37817,sa=37818,aa=37819,oa=37820,ca=37821,Pr=36492,la=36494,ha=36495,Nc=36283,fa=36284,da=36285,ua=36286,Nf=3200,Ff=3201,Of=0,zf=1,Rn="",Ot="srgb",Ri="srgb-linear",Gr="linear",Ze="srgb",Qn=7680,io=519,Bf=512,Hf=513,kf=514,Fc=515,Vf=516,Gf=517,Wf=518,Xf=519,ro=35044,so="300 es",dn=2e3,Nr=2001;class Yn{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const _t=["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"],Dr=Math.PI/180,pa=180/Math.PI;function Yi(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(_t[t&255]+_t[t>>8&255]+_t[t>>16&255]+_t[t>>24&255]+"-"+_t[e&255]+_t[e>>8&255]+"-"+_t[e>>16&15|64]+_t[e>>24&255]+"-"+_t[n&63|128]+_t[n>>8&255]+"-"+_t[n>>16&255]+_t[n>>24&255]+_t[i&255]+_t[i>>8&255]+_t[i>>16&255]+_t[i>>24&255]).toLowerCase()}function Tt(t,e,n){return Math.max(e,Math.min(n,t))}function qf(t,e){return(t%e+e)%e}function Kr(t,e,n){return(1-n)*t+n*e}function Ui(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function At(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const $f={DEG2RAD:Dr};class we{constructor(e=0,n=0){we.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),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}}class De{constructor(e,n,i,r,s,a,o,c,l){De.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,a,o,c,l)}set(e,n,i,r,s,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=n,h[4]=s,h[5]=c,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,a=i[0],o=i[3],c=i[6],l=i[1],h=i[4],f=i[7],d=i[2],u=i[5],g=i[8],_=r[0],p=r[3],m=r[6],T=r[1],y=r[4],v=r[7],P=r[2],b=r[5],w=r[8];return s[0]=a*_+o*T+c*P,s[3]=a*p+o*y+c*b,s[6]=a*m+o*v+c*w,s[1]=l*_+h*T+f*P,s[4]=l*p+h*y+f*b,s[7]=l*m+h*v+f*w,s[2]=d*_+u*T+g*P,s[5]=d*p+u*y+g*b,s[8]=d*m+u*v+g*w,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return n*a*h-n*o*l-i*s*h+i*o*c+r*s*l-r*a*c}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=h*a-o*l,d=o*c-h*s,u=l*s-a*c,g=n*f+i*d+r*u;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=f*_,e[1]=(r*l-h*i)*_,e[2]=(o*i-r*a)*_,e[3]=d*_,e[4]=(h*n-r*c)*_,e[5]=(r*s-o*n)*_,e[6]=u*_,e[7]=(i*c-l*n)*_,e[8]=(a*n-i*s)*_,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(i*c,i*l,-i*(c*a+l*o)+a+e,-r*l,r*c,-r*(-l*a+c*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(Jr.makeScale(e,n)),this}rotate(e){return this.premultiply(Jr.makeRotation(-e)),this}translate(e,n){return this.premultiply(Jr.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Jr=new De;function Oc(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function qi(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Yf(){const t=qi("canvas");return t.style.display="block",t}const ao={};function Vi(t){t in ao||(ao[t]=!0,console.warn(t))}function jf(t,e,n){return new Promise(function(i,r){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:i()}}setTimeout(s,n)})}function Zf(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Kf(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ge={enabled:!0,workingColorSpace:Ri,spaces:{},convert:function(t,e,n){return this.enabled===!1||e===n||!e||!n||(this.spaces[e].transfer===Ze&&(t.r=un(t.r),t.g=un(t.g),t.b=un(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Ze&&(t.r=Mi(t.r),t.g=Mi(t.g),t.b=Mi(t.b))),t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Rn?Gr:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}};function un(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Mi(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const oo=[.64,.33,.3,.6,.15,.06],co=[.2126,.7152,.0722],lo=[.3127,.329],ho=new De().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),fo=new De().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ge.define({[Ri]:{primaries:oo,whitePoint:lo,transfer:Gr,toXYZ:ho,fromXYZ:fo,luminanceCoefficients:co,workingColorSpaceConfig:{unpackColorSpace:Ot},outputColorSpaceConfig:{drawingBufferColorSpace:Ot}},[Ot]:{primaries:oo,whitePoint:lo,transfer:Ze,toXYZ:ho,fromXYZ:fo,luminanceCoefficients:co,outputColorSpaceConfig:{drawingBufferColorSpace:Ot}}});let ei;class Jf{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{ei===void 0&&(ei=qi("canvas")),ei.width=e.width,ei.height=e.height;const i=ei.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=ei}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=qi("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=un(s[a]/255)*255;return i.putImageData(r,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(un(n[i]/255)*255):n[i]=un(n[i]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Qf=0;class zc{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Qf++}),this.uuid=Yi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Qr(r[a].image)):s.push(Qr(r[a]))}else s=Qr(r);i.url=s}return n||(e.images[this.uuid]=i),i}}function Qr(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Jf.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let ed=0;class Mt extends Yn{constructor(e=Mt.DEFAULT_IMAGE,n=Mt.DEFAULT_MAPPING,i=Wn,r=Wn,s=Qt,a=Xn,o=qt,c=pn,l=Mt.DEFAULT_ANISOTROPY,h=Rn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ed++}),this.uuid=Yi(),this.name="",this.source=new zc(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new we(0,0),this.repeat=new we(1,1),this.center=new we(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new De,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(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 Hs:e.x=e.x-Math.floor(e.x);break;case Wn:e.x=e.x<0?0:1;break;case ks: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 Hs:e.y=e.y-Math.floor(e.y);break;case Wn:e.y=e.y<0?0:1;break;case ks: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++}}Mt.DEFAULT_IMAGE=null;Mt.DEFAULT_MAPPING=Ac;Mt.DEFAULT_ANISOTROPY=1;class st{constructor(e=0,n=0,i=0,r=1){st.prototype.isVector4=!0,this.x=e,this.y=n,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,n,i,r){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*n+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*n+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*n+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*n+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);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,s;const c=e.elements,l=c[0],h=c[4],f=c[8],d=c[1],u=c[5],g=c[9],_=c[2],p=c[6],m=c[10];if(Math.abs(h-d)<.01&&Math.abs(f-_)<.01&&Math.abs(g-p)<.01){if(Math.abs(h+d)<.1&&Math.abs(f+_)<.1&&Math.abs(g+p)<.1&&Math.abs(l+u+m-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const y=(l+1)/2,v=(u+1)/2,P=(m+1)/2,b=(h+d)/4,w=(f+_)/4,R=(g+p)/4;return y>v&&y>P?y<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(y),r=b/i,s=w/i):v>P?v<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(v),i=b/r,s=R/r):P<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(P),i=w/s,r=R/s),this.set(i,r,s,n),this}let T=Math.sqrt((p-g)*(p-g)+(f-_)*(f-_)+(d-h)*(d-h));return Math.abs(T)<.001&&(T=1),this.x=(p-g)/T,this.y=(f-_)/T,this.z=(d-h)/T,this.w=Math.acos((l+u+m-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class td extends Yn{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new st(0,0,e,n),this.scissorTest=!1,this.viewport=new st(0,0,e,n);const r={width:e,height:n,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Qt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Mt(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,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=n,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}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 i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new zc(n),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}dispose(){this.dispatchEvent({type:"dispose"})}}class $n extends td{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class Bc extends Mt{constructor(e=null,n=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=Wn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class nd extends Mt{constructor(e=null,n=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=Wn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ln{constructor(e=0,n=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}static slerpFlat(e,n,i,r,s,a,o){let c=i[r+0],l=i[r+1],h=i[r+2],f=i[r+3];const d=s[a+0],u=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[n+0]=c,e[n+1]=l,e[n+2]=h,e[n+3]=f;return}if(o===1){e[n+0]=d,e[n+1]=u,e[n+2]=g,e[n+3]=_;return}if(f!==_||c!==d||l!==u||h!==g){let p=1-o;const m=c*d+l*u+h*g+f*_,T=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){const P=Math.sqrt(y),b=Math.atan2(P,m*T);p=Math.sin(p*b)/P,o=Math.sin(o*b)/P}const v=o*T;if(c=c*p+d*v,l=l*p+u*v,h=h*p+g*v,f=f*p+_*v,p===1-o){const P=1/Math.sqrt(c*c+l*l+h*h+f*f);c*=P,l*=P,h*=P,f*=P}}e[n]=c,e[n+1]=l,e[n+2]=h,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,r,s,a){const o=i[r],c=i[r+1],l=i[r+2],h=i[r+3],f=s[a],d=s[a+1],u=s[a+2],g=s[a+3];return e[n]=o*g+h*f+c*u-l*d,e[n+1]=c*g+h*d+l*f-o*u,e[n+2]=l*g+h*u+o*d-c*f,e[n+3]=h*g-o*f-c*d-l*u,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,n,i,r){return this._x=e,this._y=n,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,n=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(i/2),h=o(r/2),f=o(s/2),d=c(i/2),u=c(r/2),g=c(s/2);switch(a){case"XYZ":this._x=d*h*f+l*u*g,this._y=l*u*f-d*h*g,this._z=l*h*g+d*u*f,this._w=l*h*f-d*u*g;break;case"YXZ":this._x=d*h*f+l*u*g,this._y=l*u*f-d*h*g,this._z=l*h*g-d*u*f,this._w=l*h*f+d*u*g;break;case"ZXY":this._x=d*h*f-l*u*g,this._y=l*u*f+d*h*g,this._z=l*h*g+d*u*f,this._w=l*h*f-d*u*g;break;case"ZYX":this._x=d*h*f-l*u*g,this._y=l*u*f+d*h*g,this._z=l*h*g-d*u*f,this._w=l*h*f+d*u*g;break;case"YZX":this._x=d*h*f+l*u*g,this._y=l*u*f+d*h*g,this._z=l*h*g-d*u*f,this._w=l*h*f-d*u*g;break;case"XZY":this._x=d*h*f-l*u*g,this._y=l*u*f-d*h*g,this._z=l*h*g+d*u*f,this._w=l*h*f+d*u*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],r=n[4],s=n[8],a=n[1],o=n[5],c=n[9],l=n[2],h=n[6],f=n[10],d=i+o+f;if(d>0){const u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(h-c)*u,this._y=(s-l)*u,this._z=(a-r)*u}else if(i>o&&i>f){const u=2*Math.sqrt(1+i-o-f);this._w=(h-c)/u,this._x=.25*u,this._y=(r+a)/u,this._z=(s+l)/u}else if(o>f){const u=2*Math.sqrt(1+o-i-f);this._w=(s-l)/u,this._x=(r+a)/u,this._y=.25*u,this._z=(c+h)/u}else{const u=2*Math.sqrt(1+f-i-o);this._w=(a-r)/u,this._x=(s+l)/u,this._y=(c+h)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Tt(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/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,n){const i=e._x,r=e._y,s=e._z,a=e._w,o=n._x,c=n._y,l=n._z,h=n._w;return this._x=i*h+a*o+r*l-s*c,this._y=r*h+a*c+s*o-i*l,this._z=s*h+a*l+i*c-r*o,this._w=a*h-i*o-r*c-s*l,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const c=1-o*o;if(c<=Number.EPSILON){const u=1-n;return this._w=u*a+n*this._w,this._x=u*i+n*this._x,this._y=u*r+n*this._y,this._z=u*s+n*this._z,this.normalize(),this}const l=Math.sqrt(c),h=Math.atan2(l,o),f=Math.sin((1-n)*h)/l,d=Math.sin(n*h)/l;return this._w=a*f+this._w*d,this._x=i*f+this._x*d,this._y=r*f+this._y*d,this._z=s*f+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=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(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),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}}class z{constructor(e=0,n=0,i=0){z.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(uo.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(uo.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6]*r,this.y=s[1]*n+s[4]*i+s[7]*r,this.z=s[2]*n+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*n+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*n+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*n+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*n+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*r-o*i),h=2*(o*n-s*r),f=2*(s*i-a*n);return this.x=n+c*l+a*f-o*h,this.y=i+c*h+o*l-s*f,this.z=r+c*f+s*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r,this.y=s[1]*n+s[5]*i+s[9]*r,this.z=s[2]*n+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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,s=e.z,a=n.x,o=n.y,c=n.z;return this.x=r*c-s*o,this.y=s*a-i*c,this.z=i*o-r*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return es.copy(this).projectOnVector(e),this.sub(es)}reflect(e){return this.sub(es.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+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,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const es=new z,uo=new Ln;class jn{constructor(e=new z(1/0,1/0,1/0),n=new z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Vt.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Vt.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Vt.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}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,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Vt):Vt.fromBufferAttribute(s,a),Vt.applyMatrix4(e.matrixWorld),this.expandByPoint(Vt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Qi.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Qi.copy(i.boundingBox)),Qi.applyMatrix4(e.matrixWorld),this.union(Qi)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],n);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,n){return n.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,Vt),Vt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ni),er.subVectors(this.max,Ni),ti.subVectors(e.a,Ni),ni.subVectors(e.b,Ni),ii.subVectors(e.c,Ni),xn.subVectors(ni,ti),Mn.subVectors(ii,ni),Nn.subVectors(ti,ii);let n=[0,-xn.z,xn.y,0,-Mn.z,Mn.y,0,-Nn.z,Nn.y,xn.z,0,-xn.x,Mn.z,0,-Mn.x,Nn.z,0,-Nn.x,-xn.y,xn.x,0,-Mn.y,Mn.x,0,-Nn.y,Nn.x,0];return!ts(n,ti,ni,ii,er)||(n=[1,0,0,0,1,0,0,0,1],!ts(n,ti,ni,ii,er))?!1:(tr.crossVectors(xn,Mn),n=[tr.x,tr.y,tr.z],ts(n,ti,ni,ii,er))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Vt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Vt).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:(sn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),sn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),sn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),sn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),sn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),sn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),sn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),sn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(sn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const sn=[new z,new z,new z,new z,new z,new z,new z,new z],Vt=new z,Qi=new jn,ti=new z,ni=new z,ii=new z,xn=new z,Mn=new z,Nn=new z,Ni=new z,er=new z,tr=new z,Fn=new z;function ts(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){Fn.fromArray(t,s);const o=r.x*Math.abs(Fn.x)+r.y*Math.abs(Fn.y)+r.z*Math.abs(Fn.z),c=e.dot(Fn),l=n.dot(Fn),h=i.dot(Fn);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const id=new jn,Fi=new z,ns=new z;class Zn{constructor(e=new z,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):id.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){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;Fi.subVectors(e,this.center);const n=Fi.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(Fi,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):(ns.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fi.copy(e.center).add(ns)),this.expandByPoint(Fi.copy(e.center).sub(ns))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const an=new z,is=new z,nr=new z,yn=new z,rs=new z,ir=new z,ss=new z;class ji{constructor(e=new z,n=new z(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,an)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=an.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(an.copy(this.origin).addScaledVector(this.direction,n),an.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){is.copy(e).add(n).multiplyScalar(.5),nr.copy(n).sub(e).normalize(),yn.copy(this.origin).sub(is);const s=e.distanceTo(n)*.5,a=-this.direction.dot(nr),o=yn.dot(this.direction),c=-yn.dot(nr),l=yn.lengthSq(),h=Math.abs(1-a*a);let f,d,u,g;if(h>0)if(f=a*c-o,d=a*o-c,g=s*h,f>=0)if(d>=-g)if(d<=g){const _=1/h;f*=_,d*=_,u=f*(f+a*d+2*o)+d*(a*f+d+2*c)+l}else d=s,f=Math.max(0,-(a*d+o)),u=-f*f+d*(d+2*c)+l;else d=-s,f=Math.max(0,-(a*d+o)),u=-f*f+d*(d+2*c)+l;else d<=-g?(f=Math.max(0,-(-a*s+o)),d=f>0?-s:Math.min(Math.max(-s,-c),s),u=-f*f+d*(d+2*c)+l):d<=g?(f=0,d=Math.min(Math.max(-s,-c),s),u=d*(d+2*c)+l):(f=Math.max(0,-(a*s+o)),d=f>0?s:Math.min(Math.max(-s,-c),s),u=-f*f+d*(d+2*c)+l);else d=a>0?-s:s,f=Math.max(0,-(a*d+o)),u=-f*f+d*(d+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(is).addScaledVector(nr,d),u}intersectSphere(e,n){an.subVectors(e.center,this.origin);const i=an.dot(this.direction),r=an.dot(an)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,c=i+a;return c<0?null:o<0?this.at(c,n):this.at(o,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,s,a,o,c;const l=1/this.direction.x,h=1/this.direction.y,f=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),f>=0?(o=(e.min.z-d.z)*f,c=(e.max.z-d.z)*f):(o=(e.max.z-d.z)*f,c=(e.min.z-d.z)*f),i>c||o>r)||((o>i||i!==i)&&(i=o),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,an)!==null}intersectTriangle(e,n,i,r,s){rs.subVectors(n,e),ir.subVectors(i,e),ss.crossVectors(rs,ir);let a=this.direction.dot(ss),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;yn.subVectors(this.origin,e);const c=o*this.direction.dot(ir.crossVectors(yn,ir));if(c<0)return null;const l=o*this.direction.dot(rs.cross(yn));if(l<0||c+l>a)return null;const h=-o*yn.dot(ss);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)}}class je{constructor(e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p){je.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p)}set(e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p){const m=this.elements;return m[0]=e,m[4]=n,m[8]=i,m[12]=r,m[1]=s,m[5]=a,m[9]=o,m[13]=c,m[2]=l,m[6]=h,m[10]=f,m[14]=d,m[3]=u,m[7]=g,m[11]=_,m[15]=p,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 je().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,r=1/ri.setFromMatrixColumn(e,0).length(),s=1/ri.setFromMatrixColumn(e,1).length(),a=1/ri.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*s,n[5]=i[5]*s,n[6]=i[6]*s,n[7]=0,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),c=Math.cos(r),l=Math.sin(r),h=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const d=a*h,u=a*f,g=o*h,_=o*f;n[0]=c*h,n[4]=-c*f,n[8]=l,n[1]=u+g*l,n[5]=d-_*l,n[9]=-o*c,n[2]=_-d*l,n[6]=g+u*l,n[10]=a*c}else if(e.order==="YXZ"){const d=c*h,u=c*f,g=l*h,_=l*f;n[0]=d+_*o,n[4]=g*o-u,n[8]=a*l,n[1]=a*f,n[5]=a*h,n[9]=-o,n[2]=u*o-g,n[6]=_+d*o,n[10]=a*c}else if(e.order==="ZXY"){const d=c*h,u=c*f,g=l*h,_=l*f;n[0]=d-_*o,n[4]=-a*f,n[8]=g+u*o,n[1]=u+g*o,n[5]=a*h,n[9]=_-d*o,n[2]=-a*l,n[6]=o,n[10]=a*c}else if(e.order==="ZYX"){const d=a*h,u=a*f,g=o*h,_=o*f;n[0]=c*h,n[4]=g*l-u,n[8]=d*l+_,n[1]=c*f,n[5]=_*l+d,n[9]=u*l-g,n[2]=-l,n[6]=o*c,n[10]=a*c}else if(e.order==="YZX"){const d=a*c,u=a*l,g=o*c,_=o*l;n[0]=c*h,n[4]=_-d*f,n[8]=g*f+u,n[1]=f,n[5]=a*h,n[9]=-o*h,n[2]=-l*h,n[6]=u*f+g,n[10]=d-_*f}else if(e.order==="XZY"){const d=a*c,u=a*l,g=o*c,_=o*l;n[0]=c*h,n[4]=-f,n[8]=l*h,n[1]=d*f+_,n[5]=a*h,n[9]=u*f-g,n[2]=g*f-u,n[6]=o*h,n[10]=_*f+d}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rd,e,sd)}lookAt(e,n,i){const r=this.elements;return Dt.subVectors(e,n),Dt.lengthSq()===0&&(Dt.z=1),Dt.normalize(),Sn.crossVectors(i,Dt),Sn.lengthSq()===0&&(Math.abs(i.z)===1?Dt.x+=1e-4:Dt.z+=1e-4,Dt.normalize(),Sn.crossVectors(i,Dt)),Sn.normalize(),rr.crossVectors(Dt,Sn),r[0]=Sn.x,r[4]=rr.x,r[8]=Dt.x,r[1]=Sn.y,r[5]=rr.y,r[9]=Dt.y,r[2]=Sn.z,r[6]=rr.z,r[10]=Dt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,a=i[0],o=i[4],c=i[8],l=i[12],h=i[1],f=i[5],d=i[9],u=i[13],g=i[2],_=i[6],p=i[10],m=i[14],T=i[3],y=i[7],v=i[11],P=i[15],b=r[0],w=r[4],R=r[8],S=r[12],x=r[1],C=r[5],L=r[9],D=r[13],U=r[2],X=r[6],V=r[10],K=r[14],G=r[3],te=r[7],ie=r[11],ve=r[15];return s[0]=a*b+o*x+c*U+l*G,s[4]=a*w+o*C+c*X+l*te,s[8]=a*R+o*L+c*V+l*ie,s[12]=a*S+o*D+c*K+l*ve,s[1]=h*b+f*x+d*U+u*G,s[5]=h*w+f*C+d*X+u*te,s[9]=h*R+f*L+d*V+u*ie,s[13]=h*S+f*D+d*K+u*ve,s[2]=g*b+_*x+p*U+m*G,s[6]=g*w+_*C+p*X+m*te,s[10]=g*R+_*L+p*V+m*ie,s[14]=g*S+_*D+p*K+m*ve,s[3]=T*b+y*x+v*U+P*G,s[7]=T*w+y*C+v*X+P*te,s[11]=T*R+y*L+v*V+P*ie,s[15]=T*S+y*D+v*K+P*ve,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],f=e[6],d=e[10],u=e[14],g=e[3],_=e[7],p=e[11],m=e[15];return g*(+s*c*f-r*l*f-s*o*d+i*l*d+r*o*u-i*c*u)+_*(+n*c*u-n*l*d+s*a*d-r*a*u+r*l*h-s*c*h)+p*(+n*l*f-n*o*u-s*a*f+i*a*u+s*o*h-i*l*h)+m*(-r*o*h-n*c*f+n*o*d+r*a*f-i*a*d+i*c*h)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=f*p*l-_*d*l+_*c*u-o*p*u-f*c*m+o*d*m,y=g*d*l-h*p*l-g*c*u+a*p*u+h*c*m-a*d*m,v=h*_*l-g*f*l+g*o*u-a*_*u-h*o*m+a*f*m,P=g*f*c-h*_*c-g*o*d+a*_*d+h*o*p-a*f*p,b=n*T+i*y+r*v+s*P;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=T*w,e[1]=(_*d*s-f*p*s-_*r*u+i*p*u+f*r*m-i*d*m)*w,e[2]=(o*p*s-_*c*s+_*r*l-i*p*l-o*r*m+i*c*m)*w,e[3]=(f*c*s-o*d*s-f*r*l+i*d*l+o*r*u-i*c*u)*w,e[4]=y*w,e[5]=(h*p*s-g*d*s+g*r*u-n*p*u-h*r*m+n*d*m)*w,e[6]=(g*c*s-a*p*s-g*r*l+n*p*l+a*r*m-n*c*m)*w,e[7]=(a*d*s-h*c*s+h*r*l-n*d*l-a*r*u+n*c*u)*w,e[8]=v*w,e[9]=(g*f*s-h*_*s-g*i*u+n*_*u+h*i*m-n*f*m)*w,e[10]=(a*_*s-g*o*s+g*i*l-n*_*l-a*i*m+n*o*m)*w,e[11]=(h*o*s-a*f*s-h*i*l+n*f*l+a*i*u-n*o*u)*w,e[12]=P*w,e[13]=(h*_*r-g*f*r+g*i*d-n*_*d-h*i*p+n*f*p)*w,e[14]=(g*o*r-a*_*r-g*i*c+n*_*c+a*i*p-n*o*p)*w,e[15]=(a*f*r-h*o*r+h*i*c-n*f*c-a*i*d+n*o*d)*w,this}scale(e){const n=this.elements,i=e.x,r=e.y,s=e.z;return n[0]*=i,n[4]*=r,n[8]*=s,n[1]*=i,n[5]*=r,n[9]*=s,n[2]*=i,n[6]*=r,n[10]*=s,n[3]*=i,n[7]*=r,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=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(n,i,r))}makeTranslation(e,n,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,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),s=1-i,a=e.x,o=e.y,c=e.z,l=s*a,h=s*o;return this.set(l*a+i,l*o-r*c,l*c+r*o,0,l*o+r*c,h*o+i,h*c-r*a,0,l*c-r*o,h*c+r*a,s*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,n,r,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,s=n._x,a=n._y,o=n._z,c=n._w,l=s+s,h=a+a,f=o+o,d=s*l,u=s*h,g=s*f,_=a*h,p=a*f,m=o*f,T=c*l,y=c*h,v=c*f,P=i.x,b=i.y,w=i.z;return r[0]=(1-(_+m))*P,r[1]=(u+v)*P,r[2]=(g-y)*P,r[3]=0,r[4]=(u-v)*b,r[5]=(1-(d+m))*b,r[6]=(p+T)*b,r[7]=0,r[8]=(g+y)*w,r[9]=(p-T)*w,r[10]=(1-(d+_))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;let s=ri.set(r[0],r[1],r[2]).length();const a=ri.set(r[4],r[5],r[6]).length(),o=ri.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Gt.copy(this);const l=1/s,h=1/a,f=1/o;return Gt.elements[0]*=l,Gt.elements[1]*=l,Gt.elements[2]*=l,Gt.elements[4]*=h,Gt.elements[5]*=h,Gt.elements[6]*=h,Gt.elements[8]*=f,Gt.elements[9]*=f,Gt.elements[10]*=f,n.setFromRotationMatrix(Gt),i.x=s,i.y=a,i.z=o,this}makePerspective(e,n,i,r,s,a,o=dn){const c=this.elements,l=2*s/(n-e),h=2*s/(i-r),f=(n+e)/(n-e),d=(i+r)/(i-r);let u,g;if(o===dn)u=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Nr)u=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=l,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=h,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=u,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,i,r,s,a,o=dn){const c=this.elements,l=1/(n-e),h=1/(i-r),f=1/(a-s),d=(n+e)*l,u=(i+r)*h;let g,_;if(o===dn)g=(a+s)*f,_=-2*f;else if(o===Nr)g=s*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-d,c[1]=0,c[5]=2*h,c[9]=0,c[13]=-u,c[2]=0,c[6]=0,c[10]=_,c[14]=-g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const ri=new z,Gt=new je,rd=new z(0,0,0),sd=new z(1,1,1),Sn=new z,rr=new z,Dt=new z,po=new je,mo=new Ln;class mn{constructor(e=0,n=0,i=0,r=mn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,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,n,i,r=this._order){return this._x=e,this._y=n,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,n=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],c=r[1],l=r[5],h=r[9],f=r[2],d=r[6],u=r[10];switch(n){case"XYZ":this._y=Math.asin(Tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Tt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Tt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Tt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return po.makeRotationFromQuaternion(e),this.setFromRotationMatrix(po,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return mo.setFromEuler(this),this.setFromQuaternion(mo,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}mn.DEFAULT_ORDER="XYZ";class Ra{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let ad=0;const go=new z,si=new Ln,on=new je,sr=new z,Oi=new z,od=new z,cd=new Ln,_o=new z(1,0,0),vo=new z(0,1,0),xo=new z(0,0,1),Mo={type:"added"},ld={type:"removed"},ai={type:"childadded",child:null},as={type:"childremoved",child:null};class ut extends Yn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ad++}),this.uuid=Yi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ut.DEFAULT_UP.clone();const e=new z,n=new mn,i=new Ln,r=new z(1,1,1);function s(){i.setFromEuler(n,!1)}function a(){n.setFromQuaternion(i,void 0,!1)}n._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new je},normalMatrix:{value:new De}}),this.matrix=new je,this.matrixWorld=new je,this.matrixAutoUpdate=ut.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ra,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return si.setFromAxisAngle(e,n),this.quaternion.multiply(si),this}rotateOnWorldAxis(e,n){return si.setFromAxisAngle(e,n),this.quaternion.premultiply(si),this}rotateX(e){return this.rotateOnAxis(_o,e)}rotateY(e){return this.rotateOnAxis(vo,e)}rotateZ(e){return this.rotateOnAxis(xo,e)}translateOnAxis(e,n){return go.copy(e).applyQuaternion(this.quaternion),this.position.add(go.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(_o,e)}translateY(e){return this.translateOnAxis(vo,e)}translateZ(e){return this.translateOnAxis(xo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(on.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?sr.copy(e):sr.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Oi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?on.lookAt(Oi,sr,this.up):on.lookAt(sr,Oi,this.up),this.quaternion.setFromRotationMatrix(on),r&&(on.extractRotation(r.matrixWorld),si.setFromRotationMatrix(on),this.quaternion.premultiply(si.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Mo),ai.child=e,this.dispatchEvent(ai),ai.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(ld),as.child=e,this.dispatchEvent(as),as.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),on.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),on.multiply(e.parent.matrixWorld)),e.applyMatrix4(on),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Mo),ai.child=e,this.dispatchEvent(ai),ai.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,n);if(a!==void 0)return a}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,e,od),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,cd,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n){const 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)),n===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const f=c[l];s(e.shapes,f)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));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++){const c=this.animations[o];r.animations.push(s(e.animations,c))}}if(n){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),f=a(e.shapes),d=a(e.skeletons),u=a(e.animations),g=a(e.nodes);o.length>0&&(i.geometries=o),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),f.length>0&&(i.shapes=f),d.length>0&&(i.skeletons=d),u.length>0&&(i.animations=u),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const c=[];for(const l in o){const h=o[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}ut.DEFAULT_UP=new z(0,1,0);ut.DEFAULT_MATRIX_AUTO_UPDATE=!0;ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Wt=new z,cn=new z,os=new z,ln=new z,oi=new z,ci=new z,yo=new z,cs=new z,ls=new z,hs=new z,fs=new st,ds=new st,us=new st;class Xt{constructor(e=new z,n=new z,i=new z){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),Wt.subVectors(e,n),r.cross(Wt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,n,i,r,s){Wt.subVectors(r,n),cn.subVectors(i,n),os.subVectors(e,n);const a=Wt.dot(Wt),o=Wt.dot(cn),c=Wt.dot(os),l=cn.dot(cn),h=cn.dot(os),f=a*l-o*o;if(f===0)return s.set(0,0,0),null;const d=1/f,u=(l*c-o*h)*d,g=(a*h-o*c)*d;return s.set(1-u-g,g,u)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,ln)===null?!1:ln.x>=0&&ln.y>=0&&ln.x+ln.y<=1}static getInterpolation(e,n,i,r,s,a,o,c){return this.getBarycoord(e,n,i,r,ln)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,ln.x),c.addScaledVector(a,ln.y),c.addScaledVector(o,ln.z),c)}static getInterpolatedAttribute(e,n,i,r,s,a){return fs.setScalar(0),ds.setScalar(0),us.setScalar(0),fs.fromBufferAttribute(e,n),ds.fromBufferAttribute(e,i),us.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(fs,s.x),a.addScaledVector(ds,s.y),a.addScaledVector(us,s.z),a}static isFrontFacing(e,n,i,r){return Wt.subVectors(i,n),cn.subVectors(e,n),Wt.cross(cn).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,i,r){return this.a.fromBufferAttribute(e,n),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 Wt.subVectors(this.c,this.b),cn.subVectors(this.a,this.b),Wt.cross(cn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Xt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Xt.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,s){return Xt.getInterpolation(e,this.a,this.b,this.c,n,i,r,s)}containsPoint(e){return Xt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Xt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,r=this.b,s=this.c;let a,o;oi.subVectors(r,i),ci.subVectors(s,i),cs.subVectors(e,i);const c=oi.dot(cs),l=ci.dot(cs);if(c<=0&&l<=0)return n.copy(i);ls.subVectors(e,r);const h=oi.dot(ls),f=ci.dot(ls);if(h>=0&&f<=h)return n.copy(r);const d=c*f-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),n.copy(i).addScaledVector(oi,a);hs.subVectors(e,s);const u=oi.dot(hs),g=ci.dot(hs);if(g>=0&&u<=g)return n.copy(s);const _=u*l-c*g;if(_<=0&&l>=0&&g<=0)return o=l/(l-g),n.copy(i).addScaledVector(ci,o);const p=h*g-u*f;if(p<=0&&f-h>=0&&u-g>=0)return yo.subVectors(s,r),o=(f-h)/(f-h+(u-g)),n.copy(r).addScaledVector(yo,o);const m=1/(p+_+d);return a=_*m,o=d*m,n.copy(i).addScaledVector(oi,a).addScaledVector(ci,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Hc={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},En={h:0,s:0,l:0},ar={h:0,s:0,l:0};function ps(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class Oe{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Ot){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ge.toWorkingColorSpace(this,n),this}setRGB(e,n,i,r=Ge.workingColorSpace){return this.r=e,this.g=n,this.b=i,Ge.toWorkingColorSpace(this,r),this}setHSL(e,n,i,r=Ge.workingColorSpace){if(e=qf(e,1),n=Tt(n,0,1),i=Tt(i,0,1),n===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+n):i+n-i*n,a=2*i-s;this.r=ps(a,s,e+1/3),this.g=ps(a,s,e),this.b=ps(a,s,e-1/3)}return Ge.toWorkingColorSpace(this,r),this}setStyle(e,n=Ot){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const 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,n);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,n);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,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const 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,n);if(a===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Ot){const i=Hc[e.toLowerCase()];return i!==void 0?this.setHex(i,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=un(e.r),this.g=un(e.g),this.b=un(e.b),this}copyLinearToSRGB(e){return this.r=Mi(e.r),this.g=Mi(e.g),this.b=Mi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ot){return Ge.fromWorkingColorSpace(vt.copy(this),e),Math.round(Tt(vt.r*255,0,255))*65536+Math.round(Tt(vt.g*255,0,255))*256+Math.round(Tt(vt.b*255,0,255))}getHexString(e=Ot){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Ge.workingColorSpace){Ge.fromWorkingColorSpace(vt.copy(this),n);const i=vt.r,r=vt.g,s=vt.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const f=a-o;switch(l=h<=.5?f/(a+o):f/(2-a-o),a){case i:c=(r-s)/f+(r<s?6:0);break;case r:c=(s-i)/f+2;break;case s:c=(i-r)/f+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,n=Ge.workingColorSpace){return Ge.fromWorkingColorSpace(vt.copy(this),n),e.r=vt.r,e.g=vt.g,e.b=vt.b,e}getStyle(e=Ot){Ge.fromWorkingColorSpace(vt.copy(this),e);const n=vt.r,i=vt.g,r=vt.b;return e!==Ot?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,n,i){return this.getHSL(En),this.setHSL(En.h+e,En.s+n,En.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.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,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(En),e.getHSL(ar);const i=Kr(En.h,ar.h,n),r=Kr(En.s,ar.s,n),s=Kr(En.l,ar.l,n);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*n+s[3]*i+s[6]*r,this.g=s[1]*n+s[4]*i+s[7]*r,this.b=s[2]*n+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const vt=new Oe;Oe.NAMES=Hc;let hd=0;class Ci extends Yn{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hd++}),this.uuid=Yi(),this.name="",this.blending=vi,this.side=Dn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Cs,this.blendDst=Ps,this.blendEquation=Vn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Oe(0,0,0),this.blendAlpha=0,this.depthFunc=yi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=io,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Qn,this.stencilZFail=Qn,this.stencilZPass=Qn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){console.warn(`THREE.Material: '${n}' 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[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==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.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!==vi&&(i.blending=this.blending),this.side!==Dn&&(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!==Cs&&(i.blendSrc=this.blendSrc),this.blendDst!==Ps&&(i.blendDst=this.blendDst),this.blendEquation!==Vn&&(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!==yi&&(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!==io&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Qn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Qn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Qn&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const c=s[o];delete c.metadata,a.push(c)}return a}if(n){const 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;const n=e.clippingPlanes;let i=null;if(n!==null){const r=n.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=n[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Pi extends Ci{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new Oe(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 mn,this.combine=bc,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}}const ct=new z,or=new we;class Bt{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=ro,this.updateRanges=[],this.gpuType=en,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}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,n,i){e*=this.itemSize,i*=n.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=n.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)or.fromBufferAttribute(this,n),or.applyMatrix3(e),this.setXY(n,or.x,or.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.applyMatrix3(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.applyMatrix4(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.applyNormalMatrix(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)ct.fromBufferAttribute(this,n),ct.transformDirection(e),this.setXYZ(n,ct.x,ct.y,ct.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Ui(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=At(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ui(n,this.array)),n}setX(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ui(n,this.array)),n}setY(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Ui(n,this.array)),n}setZ(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Ui(n,this.array)),n}setW(e,n){return this.normalized&&(n=At(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=At(n,this.array),i=At(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,r){return e*=this.itemSize,this.normalized&&(n=At(n,this.array),i=At(i,this.array),r=At(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,n,i,r,s){return e*=this.itemSize,this.normalized&&(n=At(n,this.array),i=At(i,this.array),r=At(r,this.array),s=At(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ro&&(e.usage=this.usage),e}}class kc extends Bt{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class Vc extends Bt{constructor(e,n,i){super(new Int32Array(e),n,i)}}class Gc extends Bt{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class ot extends Bt{constructor(e,n,i){super(new Float32Array(e),n,i)}}let fd=0;const Ft=new je,ms=new ut,li=new z,Lt=new jn,zi=new jn,dt=new z;class pt extends Yn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fd++}),this.uuid=Yi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Oc(e)?Gc:kc)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new De().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ft.makeRotationFromQuaternion(e),this.applyMatrix4(Ft),this}rotateX(e){return Ft.makeRotationX(e),this.applyMatrix4(Ft),this}rotateY(e){return Ft.makeRotationY(e),this.applyMatrix4(Ft),this}rotateZ(e){return Ft.makeRotationZ(e),this.applyMatrix4(Ft),this}translate(e,n,i){return Ft.makeTranslation(e,n,i),this.applyMatrix4(Ft),this}scale(e,n,i){return Ft.makeScale(e,n,i),this.applyMatrix4(Ft),this}lookAt(e){return ms.lookAt(e),ms.updateMatrix(),this.applyMatrix4(ms.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(li).negate(),this.translate(li.x,li.y,li.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new ot(i,3))}else{for(let i=0,r=n.count;i<r;i++){const s=e[i];n.setXYZ(i,s.x,s.y,s.z||0)}e.length>n.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new jn);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new z(-1/0,-1/0,-1/0),new z(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,r=n.length;i<r;i++){const s=n[i];Lt.setFromBufferAttribute(s),this.morphTargetsRelative?(dt.addVectors(this.boundingBox.min,Lt.min),this.boundingBox.expandByPoint(dt),dt.addVectors(this.boundingBox.max,Lt.max),this.boundingBox.expandByPoint(dt)):(this.boundingBox.expandByPoint(Lt.min),this.boundingBox.expandByPoint(Lt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Zn);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new z,1/0);return}if(e){const i=this.boundingSphere.center;if(Lt.setFromBufferAttribute(e),n)for(let s=0,a=n.length;s<a;s++){const o=n[s];zi.setFromBufferAttribute(o),this.morphTargetsRelative?(dt.addVectors(Lt.min,zi.min),Lt.expandByPoint(dt),dt.addVectors(Lt.max,zi.max),Lt.expandByPoint(dt)):(Lt.expandByPoint(zi.min),Lt.expandByPoint(zi.max))}Lt.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)dt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(dt));if(n)for(let s=0,a=n.length;s<a;s++){const o=n[s],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)dt.fromBufferAttribute(o,l),c&&(li.fromBufferAttribute(e,l),dt.add(li)),r=Math.max(r,i.distanceToSquared(dt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,r=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Bt(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let R=0;R<i.count;R++)o[R]=new z,c[R]=new z;const l=new z,h=new z,f=new z,d=new we,u=new we,g=new we,_=new z,p=new z;function m(R,S,x){l.fromBufferAttribute(i,R),h.fromBufferAttribute(i,S),f.fromBufferAttribute(i,x),d.fromBufferAttribute(s,R),u.fromBufferAttribute(s,S),g.fromBufferAttribute(s,x),h.sub(l),f.sub(l),u.sub(d),g.sub(d);const C=1/(u.x*g.y-g.x*u.y);isFinite(C)&&(_.copy(h).multiplyScalar(g.y).addScaledVector(f,-u.y).multiplyScalar(C),p.copy(f).multiplyScalar(u.x).addScaledVector(h,-g.x).multiplyScalar(C),o[R].add(_),o[S].add(_),o[x].add(_),c[R].add(p),c[S].add(p),c[x].add(p))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let R=0,S=T.length;R<S;++R){const x=T[R],C=x.start,L=x.count;for(let D=C,U=C+L;D<U;D+=3)m(e.getX(D+0),e.getX(D+1),e.getX(D+2))}const y=new z,v=new z,P=new z,b=new z;function w(R){P.fromBufferAttribute(r,R),b.copy(P);const S=o[R];y.copy(S),y.sub(P.multiplyScalar(P.dot(S))).normalize(),v.crossVectors(b,S);const C=v.dot(c[R])<0?-1:1;a.setXYZW(R,y.x,y.y,y.z,C)}for(let R=0,S=T.length;R<S;++R){const x=T[R],C=x.start,L=x.count;for(let D=C,U=C+L;D<U;D+=3)w(e.getX(D+0)),w(e.getX(D+1)),w(e.getX(D+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Bt(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let d=0,u=i.count;d<u;d++)i.setXYZ(d,0,0,0);const r=new z,s=new z,a=new z,o=new z,c=new z,l=new z,h=new z,f=new z;if(e)for(let d=0,u=e.count;d<u;d+=3){const g=e.getX(d+0),_=e.getX(d+1),p=e.getX(d+2);r.fromBufferAttribute(n,g),s.fromBufferAttribute(n,_),a.fromBufferAttribute(n,p),h.subVectors(a,s),f.subVectors(r,s),h.cross(f),o.fromBufferAttribute(i,g),c.fromBufferAttribute(i,_),l.fromBufferAttribute(i,p),o.add(h),c.add(h),l.add(h),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(_,c.x,c.y,c.z),i.setXYZ(p,l.x,l.y,l.z)}else for(let d=0,u=n.count;d<u;d+=3)r.fromBufferAttribute(n,d+0),s.fromBufferAttribute(n,d+1),a.fromBufferAttribute(n,d+2),h.subVectors(a,s),f.subVectors(r,s),h.cross(f),i.setXYZ(d+0,h.x,h.y,h.z),i.setXYZ(d+1,h.x,h.y,h.z),i.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)dt.fromBufferAttribute(e,n),dt.normalize(),e.setXYZ(n,dt.x,dt.y,dt.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,f=o.normalized,d=new l.constructor(c.length*h);let u=0,g=0;for(let _=0,p=c.length;_<p;_++){o.isInterleavedBufferAttribute?u=c[_]*o.data.stride+o.offset:u=c[_]*h;for(let m=0;m<h;m++)d[g++]=l[u++]}return new Bt(d,h,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new pt,i=this.index.array,r=this.attributes;for(const o in r){const c=r[o],l=e(c,i);n.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let h=0,f=l.length;h<f;h++){const d=l[h],u=e(d,i);c.push(u)}n.morphAttributes[o]=c}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];n.addGroup(l.start,l.count,l.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let f=0,d=l.length;f<d;f++){const u=l[f];h.push(u.toJSON(e.data))}h.length>0&&(r[c]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(n));const r=e.attributes;for(const l in r){const h=r[l];this.setAttribute(l,h.clone(n))}const s=e.morphAttributes;for(const l in s){const h=[],f=s[l];for(let d=0,u=f.length;d<u;d++)h.push(f[d].clone(n));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const f=a[l];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const So=new je,On=new ji,cr=new Zn,Eo=new z,lr=new z,hr=new z,fr=new z,gs=new z,dr=new z,To=new z,ur=new z;class Rt extends ut{constructor(e=new pt,n=new Pi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){dr.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const h=o[c],f=s[c];h!==0&&(gs.fromBufferAttribute(f,e),a?dr.addScaledVector(gs,h):dr.addScaledVector(gs.sub(n),h))}n.add(dr)}return n}raycast(e,n){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),cr.copy(i.boundingSphere),cr.applyMatrix4(s),On.copy(e.ray).recast(e.near),!(cr.containsPoint(On.origin)===!1&&(On.intersectSphere(cr,Eo)===null||On.origin.distanceToSquared(Eo)>(e.far-e.near)**2))&&(So.copy(s).invert(),On.copy(e.ray).applyMatrix4(So),!(i.boundingBox!==null&&On.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,On)))}_computeIntersections(e,n,i){let r;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,h=s.attributes.uv1,f=s.attributes.normal,d=s.groups,u=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const p=d[g],m=a[p.materialIndex],T=Math.max(p.start,u.start),y=Math.min(o.count,Math.min(p.start+p.count,u.start+u.count));for(let v=T,P=y;v<P;v+=3){const b=o.getX(v),w=o.getX(v+1),R=o.getX(v+2);r=pr(this,m,e,i,l,h,f,b,w,R),r&&(r.faceIndex=Math.floor(v/3),r.face.materialIndex=p.materialIndex,n.push(r))}}else{const g=Math.max(0,u.start),_=Math.min(o.count,u.start+u.count);for(let p=g,m=_;p<m;p+=3){const T=o.getX(p),y=o.getX(p+1),v=o.getX(p+2);r=pr(this,a,e,i,l,h,f,T,y,v),r&&(r.faceIndex=Math.floor(p/3),n.push(r))}}else if(c!==void 0)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const p=d[g],m=a[p.materialIndex],T=Math.max(p.start,u.start),y=Math.min(c.count,Math.min(p.start+p.count,u.start+u.count));for(let v=T,P=y;v<P;v+=3){const b=v,w=v+1,R=v+2;r=pr(this,m,e,i,l,h,f,b,w,R),r&&(r.faceIndex=Math.floor(v/3),r.face.materialIndex=p.materialIndex,n.push(r))}}else{const g=Math.max(0,u.start),_=Math.min(c.count,u.start+u.count);for(let p=g,m=_;p<m;p+=3){const T=p,y=p+1,v=p+2;r=pr(this,a,e,i,l,h,f,T,y,v),r&&(r.faceIndex=Math.floor(p/3),n.push(r))}}}}function dd(t,e,n,i,r,s,a,o){let c;if(e.side===Ct?c=i.intersectTriangle(a,s,r,!0,o):c=i.intersectTriangle(r,s,a,e.side===Dn,o),c===null)return null;ur.copy(o),ur.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(ur);return l<n.near||l>n.far?null:{distance:l,point:ur.clone(),object:t}}function pr(t,e,n,i,r,s,a,o,c,l){t.getVertexPosition(o,lr),t.getVertexPosition(c,hr),t.getVertexPosition(l,fr);const h=dd(t,e,n,i,lr,hr,fr,To);if(h){const f=new z;Xt.getBarycoord(To,lr,hr,fr,f),r&&(h.uv=Xt.getInterpolatedAttribute(r,o,c,l,f,new we)),s&&(h.uv1=Xt.getInterpolatedAttribute(s,o,c,l,f,new we)),a&&(h.normal=Xt.getInterpolatedAttribute(a,o,c,l,f,new z),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new z,materialIndex:0};Xt.getNormal(lr,hr,fr,d.normal),h.face=d,h.barycoord=f}return h}class Kn extends pt{constructor(e=1,n=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],h=[],f=[];let d=0,u=0;g("z","y","x",-1,-1,i,n,e,a,s,0),g("z","y","x",1,-1,i,n,-e,a,s,1),g("x","z","y",1,1,e,i,n,r,a,2),g("x","z","y",1,-1,e,i,-n,r,a,3),g("x","y","z",1,-1,e,n,i,r,s,4),g("x","y","z",-1,-1,e,n,-i,r,s,5),this.setIndex(c),this.setAttribute("position",new ot(l,3)),this.setAttribute("normal",new ot(h,3)),this.setAttribute("uv",new ot(f,2));function g(_,p,m,T,y,v,P,b,w,R,S){const x=v/w,C=P/R,L=v/2,D=P/2,U=b/2,X=w+1,V=R+1;let K=0,G=0;const te=new z;for(let ie=0;ie<V;ie++){const ve=ie*C-D;for(let Le=0;Le<X;Le++){const Xe=Le*x-L;te[_]=Xe*T,te[p]=ve*y,te[m]=U,l.push(te.x,te.y,te.z),te[_]=0,te[p]=0,te[m]=b>0?1:-1,h.push(te.x,te.y,te.z),f.push(Le/w),f.push(1-ie/R),K+=1}}for(let ie=0;ie<R;ie++)for(let ve=0;ve<w;ve++){const Le=d+ve+X*ie,Xe=d+ve+X*(ie+1),q=d+(ve+1)+X*(ie+1),Q=d+(ve+1)+X*ie;c.push(Le,Xe,Q),c.push(Xe,q,Q),G+=6}o.addGroup(u,G,S),u+=G,d+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ai(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function St(t){const e={};for(let n=0;n<t.length;n++){const i=Ai(t[n]);for(const r in i)e[r]=i[r]}return e}function ud(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function Wc(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ge.workingColorSpace}const pd={clone:Ai,merge:St};var md=`void main() {
|
|
6
6
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
-
}`,
|
|
7
|
+
}`,gd=`void main() {
|
|
8
8
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
-
}`;class Yt extends Ci{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=
|
|
9
|
+
}`;class Yt extends Ci{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=md,this.fragmentShader=gd,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=Ai(e.uniforms),this.uniformsGroups=ud(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?n.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?n.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?n.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?n.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?n.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?n.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?n.uniforms[r]={type:"m4",value:a.toArray()}:n.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}}class Xc extends ut{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new je,this.projectionMatrix=new je,this.projectionMatrixInverse=new je,this.coordinateSystem=dn}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Tn=new z,bo=new we,Ao=new we;class zt extends Xc{constructor(e=50,n=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=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=pa*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Dr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return pa*2*Math.atan(Math.tan(Dr*.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,n,i){Tn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Tn.x,Tn.y).multiplyScalar(-e/Tn.z),Tn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Tn.x,Tn.y).multiplyScalar(-e/Tn.z)}getViewSize(e,n){return this.getViewBounds(e,bo,Ao),n.subVectors(Ao,bo)}setViewOffset(e,n,i,r,s,a){this.aspect=e/n,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=n,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(){const e=this.near;let n=e*Math.tan(Dr*.5*this.fov)/this.zoom,i=2*n,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/c,n-=a.offsetY*i/l,r*=a.width/c,i*=a.height/l}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,n,n-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const hi=-90,fi=1;class _d extends ut{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new zt(hi,fi,e,n);r.layers=this.layers,this.add(r);const s=new zt(hi,fi,e,n);s.layers=this.layers,this.add(s);const a=new zt(hi,fi,e,n);a.layers=this.layers,this.add(a);const o=new zt(hi,fi,e,n);o.layers=this.layers,this.add(o);const c=new zt(hi,fi,e,n);c.layers=this.layers,this.add(c);const l=new zt(hi,fi,e,n);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,r,s,a,o,c]=n;for(const l of n)this.remove(l);if(e===dn)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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Nr)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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of n)this.add(l),l.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,h]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(n,s),e.setRenderTarget(i,1,r),e.render(n,a),e.setRenderTarget(i,2,r),e.render(n,o),e.setRenderTarget(i,3,r),e.render(n,c),e.setRenderTarget(i,4,r),e.render(n,l),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(n,h),e.setRenderTarget(f,d,u),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}}class qc extends Mt{constructor(e,n,i,r,s,a,o,c,l,h){e=e!==void 0?e:[],n=n!==void 0?n:Si,super(e,n,i,r,s,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class vd extends $n{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new qc(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Qt}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
10
10
|
|
|
11
11
|
varying vec3 vWorldDirection;
|
|
12
12
|
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
42
42
|
|
|
43
43
|
}
|
|
44
|
-
`},r=new Kn(5,5,5),s=new Yt({name:"CubemapFromEquirect",uniforms:Ai(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ct,blending:Cn});s.uniforms.tEquirect.value=n;const a=new Rt(r,s),o=n.minFilter;return n.minFilter===Xn&&(n.minFilter=Qt),new
|
|
44
|
+
`},r=new Kn(5,5,5),s=new Yt({name:"CubemapFromEquirect",uniforms:Ai(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ct,blending:Cn});s.uniforms.tEquirect.value=n;const a=new Rt(r,s),o=n.minFilter;return n.minFilter===Xn&&(n.minFilter=Qt),new _d(1,10,this).update(e,a),n.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,n,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(n,i,r);e.setRenderTarget(s)}}const _s=new z,xd=new z,Md=new De;class fn{constructor(e=new z(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=_s.subVectors(i,n).cross(xd.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(_s),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:n.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>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,n){const i=n||Md.getNormalMatrix(e),r=this.coplanarPoint(_s).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const zn=new Zn,mr=new z;class Ca{constructor(e=new fn,n=new fn,i=new fn,r=new fn,s=new fn,a=new fn){this.planes=[e,n,i,r,s,a]}set(e,n,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=dn){const i=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],c=r[3],l=r[4],h=r[5],f=r[6],d=r[7],u=r[8],g=r[9],_=r[10],p=r[11],m=r[12],T=r[13],y=r[14],v=r[15];if(i[0].setComponents(c-s,d-l,p-u,v-m).normalize(),i[1].setComponents(c+s,d+l,p+u,v+m).normalize(),i[2].setComponents(c+a,d+h,p+g,v+T).normalize(),i[3].setComponents(c-a,d-h,p-g,v-T).normalize(),i[4].setComponents(c-o,d-f,p-_,v-y).normalize(),n===dn)i[5].setComponents(c+o,d+f,p+_,v+y).normalize();else if(n===Nr)i[5].setComponents(o,f,_,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),zn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),zn.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(zn)}intersectsSprite(e){return zn.center.set(0,0,0),zn.radius=.7071067811865476,zn.applyMatrix4(e.matrixWorld),this.intersectsSphere(zn)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const r=n[i];if(mr.x=r.normal.x>0?e.max.x:e.min.x,mr.y=r.normal.y>0?e.max.y:e.min.y,mr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(mr)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function $c(){let t=null,e=!1,n=null,i=null;function r(s,a){n(s,a),i=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function yd(t){const e=new WeakMap;function n(o,c){const l=o.array,h=o.usage,f=l.byteLength,d=t.createBuffer();t.bindBuffer(c,d),t.bufferData(c,l,h),o.onUploadCallback();let u;if(l instanceof Float32Array)u=t.FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?u=t.HALF_FLOAT:u=t.UNSIGNED_SHORT;else if(l instanceof Int16Array)u=t.SHORT;else if(l instanceof Uint32Array)u=t.UNSIGNED_INT;else if(l instanceof Int32Array)u=t.INT;else if(l instanceof Int8Array)u=t.BYTE;else if(l instanceof Uint8Array)u=t.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)u=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:u,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:f}}function i(o,c,l){const h=c.array,f=c.updateRanges;if(t.bindBuffer(l,o),f.length===0)t.bufferSubData(l,0,h);else{f.sort((u,g)=>u.start-g.start);let d=0;for(let u=1;u<f.length;u++){const g=f[d],_=f[u];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++d,f[d]=_)}f.length=d+1;for(let u=0,g=f.length;u<g;u++){const _=f[u];t.bufferSubData(l,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(t.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const 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}const l=e.get(o);if(l===void 0)e.set(o,n(o,c));else if(l.version<o.version){if(l.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(l.buffer,o,c),l.version=o.version}}return{get:r,remove:s,update:a}}class Wr extends pt{constructor(e=1,n=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:r};const s=e/2,a=n/2,o=Math.floor(i),c=Math.floor(r),l=o+1,h=c+1,f=e/o,d=n/c,u=[],g=[],_=[],p=[];for(let m=0;m<h;m++){const T=m*d-a;for(let y=0;y<l;y++){const v=y*f-s;g.push(v,-T,0),_.push(0,0,1),p.push(y/o),p.push(1-m/c)}}for(let m=0;m<c;m++)for(let T=0;T<o;T++){const y=T+l*m,v=T+l*(m+1),P=T+1+l*(m+1),b=T+1+l*m;u.push(y,v,b),u.push(v,P,b)}this.setIndex(u),this.setAttribute("position",new ot(g,3)),this.setAttribute("normal",new ot(_,3)),this.setAttribute("uv",new ot(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wr(e.width,e.height,e.widthSegments,e.heightSegments)}}var Sd=`#ifdef USE_ALPHAHASH
|
|
45
45
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
46
|
-
#endif`,
|
|
46
|
+
#endif`,Ed=`#ifdef USE_ALPHAHASH
|
|
47
47
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
48
48
|
float hash2D( vec2 value ) {
|
|
49
49
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -78,20 +78,20 @@
|
|
|
78
78
|
: cases.z;
|
|
79
79
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
80
80
|
}
|
|
81
|
-
#endif`,
|
|
81
|
+
#endif`,Td=`#ifdef USE_ALPHAMAP
|
|
82
82
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
83
|
-
#endif`,
|
|
83
|
+
#endif`,bd=`#ifdef USE_ALPHAMAP
|
|
84
84
|
uniform sampler2D alphaMap;
|
|
85
|
-
#endif`,
|
|
85
|
+
#endif`,Ad=`#ifdef USE_ALPHATEST
|
|
86
86
|
#ifdef ALPHA_TO_COVERAGE
|
|
87
87
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
88
88
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
89
89
|
#else
|
|
90
90
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
91
91
|
#endif
|
|
92
|
-
#endif`,
|
|
92
|
+
#endif`,wd=`#ifdef USE_ALPHATEST
|
|
93
93
|
uniform float alphaTest;
|
|
94
|
-
#endif`,
|
|
94
|
+
#endif`,Rd=`#ifdef USE_AOMAP
|
|
95
95
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
96
96
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
97
97
|
#if defined( USE_CLEARCOAT )
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
105
105
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
106
106
|
#endif
|
|
107
|
-
#endif`,
|
|
107
|
+
#endif`,Cd=`#ifdef USE_AOMAP
|
|
108
108
|
uniform sampler2D aoMap;
|
|
109
109
|
uniform float aoMapIntensity;
|
|
110
|
-
#endif`,
|
|
110
|
+
#endif`,Pd=`#ifdef USE_BATCHING
|
|
111
111
|
#if ! defined( GL_ANGLE_multi_draw )
|
|
112
112
|
#define gl_DrawID _gl_DrawID
|
|
113
113
|
uniform int _gl_DrawID;
|
|
@@ -141,15 +141,15 @@
|
|
|
141
141
|
int y = j / size;
|
|
142
142
|
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
|
|
143
143
|
}
|
|
144
|
-
#endif`,
|
|
144
|
+
#endif`,Dd=`#ifdef USE_BATCHING
|
|
145
145
|
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
146
|
-
#endif`,
|
|
146
|
+
#endif`,Ld=`vec3 transformed = vec3( position );
|
|
147
147
|
#ifdef USE_ALPHAHASH
|
|
148
148
|
vPosition = vec3( position );
|
|
149
|
-
#endif`,
|
|
149
|
+
#endif`,Id=`vec3 objectNormal = vec3( normal );
|
|
150
150
|
#ifdef USE_TANGENT
|
|
151
151
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
152
|
-
#endif`,
|
|
152
|
+
#endif`,Ud=`float G_BlinnPhong_Implicit( ) {
|
|
153
153
|
return 0.25;
|
|
154
154
|
}
|
|
155
155
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -163,7 +163,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
163
163
|
float G = G_BlinnPhong_Implicit( );
|
|
164
164
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
165
165
|
return F * ( G * D );
|
|
166
|
-
} // validated`,
|
|
166
|
+
} // validated`,Nd=`#ifdef USE_IRIDESCENCE
|
|
167
167
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
168
168
|
3.2404542, -0.9692660, 0.0556434,
|
|
169
169
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -226,7 +226,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
226
226
|
}
|
|
227
227
|
return max( I, vec3( 0.0 ) );
|
|
228
228
|
}
|
|
229
|
-
#endif`,
|
|
229
|
+
#endif`,Fd=`#ifdef USE_BUMPMAP
|
|
230
230
|
uniform sampler2D bumpMap;
|
|
231
231
|
uniform float bumpScale;
|
|
232
232
|
vec2 dHdxy_fwd() {
|
|
@@ -247,7 +247,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
247
247
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
248
248
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
249
249
|
}
|
|
250
|
-
#endif`,
|
|
250
|
+
#endif`,Od=`#if NUM_CLIPPING_PLANES > 0
|
|
251
251
|
vec4 plane;
|
|
252
252
|
#ifdef ALPHA_TO_COVERAGE
|
|
253
253
|
float distanceToPlane, distanceGradient;
|
|
@@ -293,26 +293,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
293
293
|
if ( clipped ) discard;
|
|
294
294
|
#endif
|
|
295
295
|
#endif
|
|
296
|
-
#endif`,
|
|
296
|
+
#endif`,zd=`#if NUM_CLIPPING_PLANES > 0
|
|
297
297
|
varying vec3 vClipPosition;
|
|
298
298
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
299
|
-
#endif`,
|
|
299
|
+
#endif`,Bd=`#if NUM_CLIPPING_PLANES > 0
|
|
300
300
|
varying vec3 vClipPosition;
|
|
301
|
-
#endif`,
|
|
301
|
+
#endif`,Hd=`#if NUM_CLIPPING_PLANES > 0
|
|
302
302
|
vClipPosition = - mvPosition.xyz;
|
|
303
|
-
#endif`,
|
|
303
|
+
#endif`,kd=`#if defined( USE_COLOR_ALPHA )
|
|
304
304
|
diffuseColor *= vColor;
|
|
305
305
|
#elif defined( USE_COLOR )
|
|
306
306
|
diffuseColor.rgb *= vColor;
|
|
307
|
-
#endif`,
|
|
307
|
+
#endif`,Vd=`#if defined( USE_COLOR_ALPHA )
|
|
308
308
|
varying vec4 vColor;
|
|
309
309
|
#elif defined( USE_COLOR )
|
|
310
310
|
varying vec3 vColor;
|
|
311
|
-
#endif`,
|
|
311
|
+
#endif`,Gd=`#if defined( USE_COLOR_ALPHA )
|
|
312
312
|
varying vec4 vColor;
|
|
313
313
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
314
314
|
varying vec3 vColor;
|
|
315
|
-
#endif`,
|
|
315
|
+
#endif`,Wd=`#if defined( USE_COLOR_ALPHA )
|
|
316
316
|
vColor = vec4( 1.0 );
|
|
317
317
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
318
318
|
vColor = vec3( 1.0 );
|
|
@@ -326,7 +326,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
326
326
|
#ifdef USE_BATCHING_COLOR
|
|
327
327
|
vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
328
328
|
vColor.xyz *= batchingColor.xyz;
|
|
329
|
-
#endif`,
|
|
329
|
+
#endif`,Xd=`#define PI 3.141592653589793
|
|
330
330
|
#define PI2 6.283185307179586
|
|
331
331
|
#define PI_HALF 1.5707963267948966
|
|
332
332
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -400,7 +400,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
400
400
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
401
401
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
402
402
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
403
|
-
} // validated
|
|
403
|
+
} // validated`,qd=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
404
404
|
#define cubeUV_minMipLevel 4.0
|
|
405
405
|
#define cubeUV_minTileSize 16.0
|
|
406
406
|
float getFace( vec3 direction ) {
|
|
@@ -493,7 +493,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
493
493
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
#endif
|
|
496
|
+
#endif`,$d=`vec3 transformedNormal = objectNormal;
|
|
497
497
|
#ifdef USE_TANGENT
|
|
498
498
|
vec3 transformedTangent = objectTangent;
|
|
499
499
|
#endif
|
|
@@ -522,21 +522,21 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
522
522
|
#ifdef FLIP_SIDED
|
|
523
523
|
transformedTangent = - transformedTangent;
|
|
524
524
|
#endif
|
|
525
|
-
#endif`,
|
|
525
|
+
#endif`,Yd=`#ifdef USE_DISPLACEMENTMAP
|
|
526
526
|
uniform sampler2D displacementMap;
|
|
527
527
|
uniform float displacementScale;
|
|
528
528
|
uniform float displacementBias;
|
|
529
|
-
#endif`,
|
|
529
|
+
#endif`,jd=`#ifdef USE_DISPLACEMENTMAP
|
|
530
530
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
531
|
-
#endif`,
|
|
531
|
+
#endif`,Zd=`#ifdef USE_EMISSIVEMAP
|
|
532
532
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
533
533
|
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
534
534
|
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
535
535
|
#endif
|
|
536
536
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
537
|
-
#endif`,
|
|
537
|
+
#endif`,Kd=`#ifdef USE_EMISSIVEMAP
|
|
538
538
|
uniform sampler2D emissiveMap;
|
|
539
|
-
#endif`,
|
|
539
|
+
#endif`,Jd="gl_FragColor = linearToOutputTexel( gl_FragColor );",Qd=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
540
540
|
return value;
|
|
541
541
|
}
|
|
542
542
|
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
@@ -544,7 +544,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
|
544
544
|
}
|
|
545
545
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
546
546
|
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 );
|
|
547
|
-
}`,
|
|
547
|
+
}`,eu=`#ifdef USE_ENVMAP
|
|
548
548
|
#ifdef ENV_WORLDPOS
|
|
549
549
|
vec3 cameraToFrag;
|
|
550
550
|
if ( isOrthographic ) {
|
|
@@ -573,7 +573,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
573
573
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|
574
574
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
575
575
|
#endif
|
|
576
|
-
#endif`,
|
|
576
|
+
#endif`,tu=`#ifdef USE_ENVMAP
|
|
577
577
|
uniform float envMapIntensity;
|
|
578
578
|
uniform float flipEnvMap;
|
|
579
579
|
uniform mat3 envMapRotation;
|
|
@@ -583,7 +583,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
583
583
|
uniform sampler2D envMap;
|
|
584
584
|
#endif
|
|
585
585
|
|
|
586
|
-
#endif`,
|
|
586
|
+
#endif`,nu=`#ifdef USE_ENVMAP
|
|
587
587
|
uniform float reflectivity;
|
|
588
588
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
589
589
|
#define ENV_WORLDPOS
|
|
@@ -594,7 +594,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
594
594
|
#else
|
|
595
595
|
varying vec3 vReflect;
|
|
596
596
|
#endif
|
|
597
|
-
#endif`,
|
|
597
|
+
#endif`,iu=`#ifdef USE_ENVMAP
|
|
598
598
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
599
599
|
#define ENV_WORLDPOS
|
|
600
600
|
#endif
|
|
@@ -605,7 +605,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
605
605
|
varying vec3 vReflect;
|
|
606
606
|
uniform float refractionRatio;
|
|
607
607
|
#endif
|
|
608
|
-
#endif`,
|
|
608
|
+
#endif`,ru=`#ifdef USE_ENVMAP
|
|
609
609
|
#ifdef ENV_WORLDPOS
|
|
610
610
|
vWorldPosition = worldPosition.xyz;
|
|
611
611
|
#else
|
|
@@ -622,18 +622,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
622
622
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
623
623
|
#endif
|
|
624
624
|
#endif
|
|
625
|
-
#endif`,
|
|
625
|
+
#endif`,su=`#ifdef USE_FOG
|
|
626
626
|
vFogDepth = - mvPosition.z;
|
|
627
|
-
#endif`,
|
|
627
|
+
#endif`,au=`#ifdef USE_FOG
|
|
628
628
|
varying float vFogDepth;
|
|
629
|
-
#endif`,
|
|
629
|
+
#endif`,ou=`#ifdef USE_FOG
|
|
630
630
|
#ifdef FOG_EXP2
|
|
631
631
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
632
632
|
#else
|
|
633
633
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
634
634
|
#endif
|
|
635
635
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
636
|
-
#endif`,
|
|
636
|
+
#endif`,cu=`#ifdef USE_FOG
|
|
637
637
|
uniform vec3 fogColor;
|
|
638
638
|
varying float vFogDepth;
|
|
639
639
|
#ifdef FOG_EXP2
|
|
@@ -642,7 +642,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
|
|
|
642
642
|
uniform float fogNear;
|
|
643
643
|
uniform float fogFar;
|
|
644
644
|
#endif
|
|
645
|
-
#endif`,
|
|
645
|
+
#endif`,lu=`#ifdef USE_GRADIENTMAP
|
|
646
646
|
uniform sampler2D gradientMap;
|
|
647
647
|
#endif
|
|
648
648
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -654,12 +654,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
654
654
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
655
655
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
656
656
|
#endif
|
|
657
|
-
}`,
|
|
657
|
+
}`,hu=`#ifdef USE_LIGHTMAP
|
|
658
658
|
uniform sampler2D lightMap;
|
|
659
659
|
uniform float lightMapIntensity;
|
|
660
|
-
#endif`,
|
|
660
|
+
#endif`,fu=`LambertMaterial material;
|
|
661
661
|
material.diffuseColor = diffuseColor.rgb;
|
|
662
|
-
material.specularStrength = specularStrength;`,
|
|
662
|
+
material.specularStrength = specularStrength;`,du=`varying vec3 vViewPosition;
|
|
663
663
|
struct LambertMaterial {
|
|
664
664
|
vec3 diffuseColor;
|
|
665
665
|
float specularStrength;
|
|
@@ -673,7 +673,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
673
673
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
674
674
|
}
|
|
675
675
|
#define RE_Direct RE_Direct_Lambert
|
|
676
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
676
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,uu=`uniform bool receiveShadow;
|
|
677
677
|
uniform vec3 ambientLightColor;
|
|
678
678
|
#if defined( USE_LIGHT_PROBES )
|
|
679
679
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -789,7 +789,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
789
789
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
790
790
|
return irradiance;
|
|
791
791
|
}
|
|
792
|
-
#endif`,
|
|
792
|
+
#endif`,pu=`#ifdef USE_ENVMAP
|
|
793
793
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
794
794
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
795
795
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
@@ -822,8 +822,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
822
822
|
#endif
|
|
823
823
|
}
|
|
824
824
|
#endif
|
|
825
|
-
#endif`,
|
|
826
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
825
|
+
#endif`,mu=`ToonMaterial material;
|
|
826
|
+
material.diffuseColor = diffuseColor.rgb;`,gu=`varying vec3 vViewPosition;
|
|
827
827
|
struct ToonMaterial {
|
|
828
828
|
vec3 diffuseColor;
|
|
829
829
|
};
|
|
@@ -835,11 +835,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
835
835
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
836
836
|
}
|
|
837
837
|
#define RE_Direct RE_Direct_Toon
|
|
838
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
838
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,_u=`BlinnPhongMaterial material;
|
|
839
839
|
material.diffuseColor = diffuseColor.rgb;
|
|
840
840
|
material.specularColor = specular;
|
|
841
841
|
material.specularShininess = shininess;
|
|
842
|
-
material.specularStrength = specularStrength;`,
|
|
842
|
+
material.specularStrength = specularStrength;`,vu=`varying vec3 vViewPosition;
|
|
843
843
|
struct BlinnPhongMaterial {
|
|
844
844
|
vec3 diffuseColor;
|
|
845
845
|
vec3 specularColor;
|
|
@@ -856,7 +856,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
856
856
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
857
857
|
}
|
|
858
858
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
859
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,
|
|
859
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,xu=`PhysicalMaterial material;
|
|
860
860
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
861
861
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
862
862
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
@@ -942,7 +942,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
942
942
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
943
943
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
944
944
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
945
|
-
#endif`,
|
|
945
|
+
#endif`,Mu=`struct PhysicalMaterial {
|
|
946
946
|
vec3 diffuseColor;
|
|
947
947
|
float roughness;
|
|
948
948
|
vec3 specularColor;
|
|
@@ -1243,7 +1243,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1243
1243
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1244
1244
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1245
1245
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1246
|
-
}`,
|
|
1246
|
+
}`,yu=`
|
|
1247
1247
|
vec3 geometryPosition = - vViewPosition;
|
|
1248
1248
|
vec3 geometryNormal = normal;
|
|
1249
1249
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1358,7 +1358,7 @@ IncidentLight directLight;
|
|
|
1358
1358
|
#if defined( RE_IndirectSpecular )
|
|
1359
1359
|
vec3 radiance = vec3( 0.0 );
|
|
1360
1360
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1361
|
-
#endif`,
|
|
1361
|
+
#endif`,Su=`#if defined( RE_IndirectDiffuse )
|
|
1362
1362
|
#ifdef USE_LIGHTMAP
|
|
1363
1363
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1364
1364
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1377,32 +1377,32 @@ IncidentLight directLight;
|
|
|
1377
1377
|
#ifdef USE_CLEARCOAT
|
|
1378
1378
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1379
1379
|
#endif
|
|
1380
|
-
#endif`,
|
|
1380
|
+
#endif`,Eu=`#if defined( RE_IndirectDiffuse )
|
|
1381
1381
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1382
1382
|
#endif
|
|
1383
1383
|
#if defined( RE_IndirectSpecular )
|
|
1384
1384
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1385
|
-
#endif`,
|
|
1385
|
+
#endif`,Tu=`#if defined( USE_LOGDEPTHBUF )
|
|
1386
1386
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1387
|
-
#endif`,
|
|
1387
|
+
#endif`,bu=`#if defined( USE_LOGDEPTHBUF )
|
|
1388
1388
|
uniform float logDepthBufFC;
|
|
1389
1389
|
varying float vFragDepth;
|
|
1390
1390
|
varying float vIsPerspective;
|
|
1391
|
-
#endif`,
|
|
1391
|
+
#endif`,Au=`#ifdef USE_LOGDEPTHBUF
|
|
1392
1392
|
varying float vFragDepth;
|
|
1393
1393
|
varying float vIsPerspective;
|
|
1394
|
-
#endif`,
|
|
1394
|
+
#endif`,wu=`#ifdef USE_LOGDEPTHBUF
|
|
1395
1395
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1396
1396
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1397
|
-
#endif`,
|
|
1397
|
+
#endif`,Ru=`#ifdef USE_MAP
|
|
1398
1398
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1399
1399
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1400
1400
|
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1401
1401
|
#endif
|
|
1402
1402
|
diffuseColor *= sampledDiffuseColor;
|
|
1403
|
-
#endif`,
|
|
1403
|
+
#endif`,Cu=`#ifdef USE_MAP
|
|
1404
1404
|
uniform sampler2D map;
|
|
1405
|
-
#endif`,
|
|
1405
|
+
#endif`,Pu=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1406
1406
|
#if defined( USE_POINTS_UV )
|
|
1407
1407
|
vec2 uv = vUv;
|
|
1408
1408
|
#else
|
|
@@ -1414,7 +1414,7 @@ IncidentLight directLight;
|
|
|
1414
1414
|
#endif
|
|
1415
1415
|
#ifdef USE_ALPHAMAP
|
|
1416
1416
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1417
|
-
#endif`,
|
|
1417
|
+
#endif`,Du=`#if defined( USE_POINTS_UV )
|
|
1418
1418
|
varying vec2 vUv;
|
|
1419
1419
|
#else
|
|
1420
1420
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1426,19 +1426,19 @@ IncidentLight directLight;
|
|
|
1426
1426
|
#endif
|
|
1427
1427
|
#ifdef USE_ALPHAMAP
|
|
1428
1428
|
uniform sampler2D alphaMap;
|
|
1429
|
-
#endif`,
|
|
1429
|
+
#endif`,Lu=`float metalnessFactor = metalness;
|
|
1430
1430
|
#ifdef USE_METALNESSMAP
|
|
1431
1431
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1432
1432
|
metalnessFactor *= texelMetalness.b;
|
|
1433
|
-
#endif`,
|
|
1433
|
+
#endif`,Iu=`#ifdef USE_METALNESSMAP
|
|
1434
1434
|
uniform sampler2D metalnessMap;
|
|
1435
|
-
#endif`,
|
|
1435
|
+
#endif`,Uu=`#ifdef USE_INSTANCING_MORPH
|
|
1436
1436
|
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1437
1437
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1438
1438
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1439
1439
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1440
1440
|
}
|
|
1441
|
-
#endif`,
|
|
1441
|
+
#endif`,Nu=`#if defined( USE_MORPHCOLORS )
|
|
1442
1442
|
vColor *= morphTargetBaseInfluence;
|
|
1443
1443
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1444
1444
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1447,12 +1447,12 @@ IncidentLight directLight;
|
|
|
1447
1447
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1448
1448
|
#endif
|
|
1449
1449
|
}
|
|
1450
|
-
#endif`,
|
|
1450
|
+
#endif`,Fu=`#ifdef USE_MORPHNORMALS
|
|
1451
1451
|
objectNormal *= morphTargetBaseInfluence;
|
|
1452
1452
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1453
1453
|
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1454
1454
|
}
|
|
1455
|
-
#endif`,
|
|
1455
|
+
#endif`,Ou=`#ifdef USE_MORPHTARGETS
|
|
1456
1456
|
#ifndef USE_INSTANCING_MORPH
|
|
1457
1457
|
uniform float morphTargetBaseInfluence;
|
|
1458
1458
|
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
@@ -1466,12 +1466,12 @@ IncidentLight directLight;
|
|
|
1466
1466
|
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1467
1467
|
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1468
1468
|
}
|
|
1469
|
-
#endif`,
|
|
1469
|
+
#endif`,zu=`#ifdef USE_MORPHTARGETS
|
|
1470
1470
|
transformed *= morphTargetBaseInfluence;
|
|
1471
1471
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1472
1472
|
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1473
1473
|
}
|
|
1474
|
-
#endif`,
|
|
1474
|
+
#endif`,Bu=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1475
1475
|
#ifdef FLAT_SHADED
|
|
1476
1476
|
vec3 fdx = dFdx( vViewPosition );
|
|
1477
1477
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1512,7 +1512,7 @@ IncidentLight directLight;
|
|
|
1512
1512
|
tbn2[1] *= faceDirection;
|
|
1513
1513
|
#endif
|
|
1514
1514
|
#endif
|
|
1515
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1515
|
+
vec3 nonPerturbedNormal = normal;`,Hu=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1516
1516
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1517
1517
|
#ifdef FLIP_SIDED
|
|
1518
1518
|
normal = - normal;
|
|
@@ -1527,25 +1527,25 @@ vec3 nonPerturbedNormal = normal;`,ku=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1527
1527
|
normal = normalize( tbn * mapN );
|
|
1528
1528
|
#elif defined( USE_BUMPMAP )
|
|
1529
1529
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1530
|
-
#endif`,
|
|
1530
|
+
#endif`,ku=`#ifndef FLAT_SHADED
|
|
1531
1531
|
varying vec3 vNormal;
|
|
1532
1532
|
#ifdef USE_TANGENT
|
|
1533
1533
|
varying vec3 vTangent;
|
|
1534
1534
|
varying vec3 vBitangent;
|
|
1535
1535
|
#endif
|
|
1536
|
-
#endif`,
|
|
1536
|
+
#endif`,Vu=`#ifndef FLAT_SHADED
|
|
1537
1537
|
varying vec3 vNormal;
|
|
1538
1538
|
#ifdef USE_TANGENT
|
|
1539
1539
|
varying vec3 vTangent;
|
|
1540
1540
|
varying vec3 vBitangent;
|
|
1541
1541
|
#endif
|
|
1542
|
-
#endif`,
|
|
1542
|
+
#endif`,Gu=`#ifndef FLAT_SHADED
|
|
1543
1543
|
vNormal = normalize( transformedNormal );
|
|
1544
1544
|
#ifdef USE_TANGENT
|
|
1545
1545
|
vTangent = normalize( transformedTangent );
|
|
1546
1546
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1547
1547
|
#endif
|
|
1548
|
-
#endif`,
|
|
1548
|
+
#endif`,Wu=`#ifdef USE_NORMALMAP
|
|
1549
1549
|
uniform sampler2D normalMap;
|
|
1550
1550
|
uniform vec2 normalScale;
|
|
1551
1551
|
#endif
|
|
@@ -1567,13 +1567,13 @@ vec3 nonPerturbedNormal = normal;`,ku=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1567
1567
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1568
1568
|
return mat3( T * scale, B * scale, N );
|
|
1569
1569
|
}
|
|
1570
|
-
#endif`,
|
|
1570
|
+
#endif`,Xu=`#ifdef USE_CLEARCOAT
|
|
1571
1571
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1572
|
-
#endif
|
|
1572
|
+
#endif`,qu=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1573
1573
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1574
1574
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1575
1575
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1576
|
-
#endif
|
|
1576
|
+
#endif`,$u=`#ifdef USE_CLEARCOATMAP
|
|
1577
1577
|
uniform sampler2D clearcoatMap;
|
|
1578
1578
|
#endif
|
|
1579
1579
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1582,18 +1582,18 @@ vec3 nonPerturbedNormal = normal;`,ku=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1582
1582
|
#endif
|
|
1583
1583
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1584
1584
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1585
|
-
#endif`,
|
|
1585
|
+
#endif`,Yu=`#ifdef USE_IRIDESCENCEMAP
|
|
1586
1586
|
uniform sampler2D iridescenceMap;
|
|
1587
1587
|
#endif
|
|
1588
1588
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1589
1589
|
uniform sampler2D iridescenceThicknessMap;
|
|
1590
|
-
#endif`,
|
|
1590
|
+
#endif`,ju=`#ifdef OPAQUE
|
|
1591
1591
|
diffuseColor.a = 1.0;
|
|
1592
1592
|
#endif
|
|
1593
1593
|
#ifdef USE_TRANSMISSION
|
|
1594
1594
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1595
1595
|
#endif
|
|
1596
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1596
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Zu=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1597
1597
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1598
1598
|
}
|
|
1599
1599
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1662,9 +1662,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
|
|
|
1662
1662
|
}
|
|
1663
1663
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1664
1664
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1665
|
-
}`,
|
|
1665
|
+
}`,Ku=`#ifdef PREMULTIPLIED_ALPHA
|
|
1666
1666
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1667
|
-
#endif`,
|
|
1667
|
+
#endif`,Ju=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1668
1668
|
#ifdef USE_BATCHING
|
|
1669
1669
|
mvPosition = batchingMatrix * mvPosition;
|
|
1670
1670
|
#endif
|
|
@@ -1672,22 +1672,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1672
1672
|
mvPosition = instanceMatrix * mvPosition;
|
|
1673
1673
|
#endif
|
|
1674
1674
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1675
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1675
|
+
gl_Position = projectionMatrix * mvPosition;`,Qu=`#ifdef DITHERING
|
|
1676
1676
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1677
|
-
#endif`,
|
|
1677
|
+
#endif`,ep=`#ifdef DITHERING
|
|
1678
1678
|
vec3 dithering( vec3 color ) {
|
|
1679
1679
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1680
1680
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1681
1681
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1682
1682
|
return color + dither_shift_RGB;
|
|
1683
1683
|
}
|
|
1684
|
-
#endif`,
|
|
1684
|
+
#endif`,tp=`float roughnessFactor = roughness;
|
|
1685
1685
|
#ifdef USE_ROUGHNESSMAP
|
|
1686
1686
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1687
1687
|
roughnessFactor *= texelRoughness.g;
|
|
1688
|
-
#endif`,
|
|
1688
|
+
#endif`,np=`#ifdef USE_ROUGHNESSMAP
|
|
1689
1689
|
uniform sampler2D roughnessMap;
|
|
1690
|
-
#endif`,
|
|
1690
|
+
#endif`,ip=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1691
1691
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1692
1692
|
#endif
|
|
1693
1693
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -1873,7 +1873,7 @@ gl_Position = projectionMatrix * mvPosition;`,ep=`#ifdef DITHERING
|
|
|
1873
1873
|
}
|
|
1874
1874
|
return mix( 1.0, shadow, shadowIntensity );
|
|
1875
1875
|
}
|
|
1876
|
-
#endif`,
|
|
1876
|
+
#endif`,rp=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1877
1877
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1878
1878
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1879
1879
|
#endif
|
|
@@ -1914,7 +1914,7 @@ gl_Position = projectionMatrix * mvPosition;`,ep=`#ifdef DITHERING
|
|
|
1914
1914
|
};
|
|
1915
1915
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1916
1916
|
#endif
|
|
1917
|
-
#endif`,
|
|
1917
|
+
#endif`,sp=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
1918
1918
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1919
1919
|
vec4 shadowWorldPosition;
|
|
1920
1920
|
#endif
|
|
@@ -1946,7 +1946,7 @@ gl_Position = projectionMatrix * mvPosition;`,ep=`#ifdef DITHERING
|
|
|
1946
1946
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1947
1947
|
}
|
|
1948
1948
|
#pragma unroll_loop_end
|
|
1949
|
-
#endif`,
|
|
1949
|
+
#endif`,ap=`float getShadowMask() {
|
|
1950
1950
|
float shadow = 1.0;
|
|
1951
1951
|
#ifdef USE_SHADOWMAP
|
|
1952
1952
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -1978,12 +1978,12 @@ gl_Position = projectionMatrix * mvPosition;`,ep=`#ifdef DITHERING
|
|
|
1978
1978
|
#endif
|
|
1979
1979
|
#endif
|
|
1980
1980
|
return shadow;
|
|
1981
|
-
}`,
|
|
1981
|
+
}`,op=`#ifdef USE_SKINNING
|
|
1982
1982
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1983
1983
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1984
1984
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1985
1985
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1986
|
-
#endif`,
|
|
1986
|
+
#endif`,cp=`#ifdef USE_SKINNING
|
|
1987
1987
|
uniform mat4 bindMatrix;
|
|
1988
1988
|
uniform mat4 bindMatrixInverse;
|
|
1989
1989
|
uniform highp sampler2D boneTexture;
|
|
@@ -1998,7 +1998,7 @@ gl_Position = projectionMatrix * mvPosition;`,ep=`#ifdef DITHERING
|
|
|
1998
1998
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
1999
1999
|
return mat4( v1, v2, v3, v4 );
|
|
2000
2000
|
}
|
|
2001
|
-
#endif`,
|
|
2001
|
+
#endif`,lp=`#ifdef USE_SKINNING
|
|
2002
2002
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2003
2003
|
vec4 skinned = vec4( 0.0 );
|
|
2004
2004
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2006,7 +2006,7 @@ gl_Position = projectionMatrix * mvPosition;`,ep=`#ifdef DITHERING
|
|
|
2006
2006
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2007
2007
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2008
2008
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2009
|
-
#endif`,
|
|
2009
|
+
#endif`,hp=`#ifdef USE_SKINNING
|
|
2010
2010
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2011
2011
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2012
2012
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2017,17 +2017,17 @@ gl_Position = projectionMatrix * mvPosition;`,ep=`#ifdef DITHERING
|
|
|
2017
2017
|
#ifdef USE_TANGENT
|
|
2018
2018
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2019
2019
|
#endif
|
|
2020
|
-
#endif`,
|
|
2020
|
+
#endif`,fp=`float specularStrength;
|
|
2021
2021
|
#ifdef USE_SPECULARMAP
|
|
2022
2022
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2023
2023
|
specularStrength = texelSpecular.r;
|
|
2024
2024
|
#else
|
|
2025
2025
|
specularStrength = 1.0;
|
|
2026
|
-
#endif`,
|
|
2026
|
+
#endif`,dp=`#ifdef USE_SPECULARMAP
|
|
2027
2027
|
uniform sampler2D specularMap;
|
|
2028
|
-
#endif`,
|
|
2028
|
+
#endif`,up=`#if defined( TONE_MAPPING )
|
|
2029
2029
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2030
|
-
#endif`,
|
|
2030
|
+
#endif`,pp=`#ifndef saturate
|
|
2031
2031
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2032
2032
|
#endif
|
|
2033
2033
|
uniform float toneMappingExposure;
|
|
@@ -2124,7 +2124,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2124
2124
|
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2125
2125
|
return mix( color, vec3( newPeak ), g );
|
|
2126
2126
|
}
|
|
2127
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2127
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,mp=`#ifdef USE_TRANSMISSION
|
|
2128
2128
|
material.transmission = transmission;
|
|
2129
2129
|
material.transmissionAlpha = 1.0;
|
|
2130
2130
|
material.thickness = thickness;
|
|
@@ -2145,7 +2145,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gp=`#ifdef USE_TRANSMISS
|
|
|
2145
2145
|
material.attenuationColor, material.attenuationDistance );
|
|
2146
2146
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2147
2147
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2148
|
-
#endif`,
|
|
2148
|
+
#endif`,gp=`#ifdef USE_TRANSMISSION
|
|
2149
2149
|
uniform float transmission;
|
|
2150
2150
|
uniform float thickness;
|
|
2151
2151
|
uniform float attenuationDistance;
|
|
@@ -2276,7 +2276,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gp=`#ifdef USE_TRANSMISS
|
|
|
2276
2276
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2277
2277
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2278
2278
|
}
|
|
2279
|
-
#endif`,
|
|
2279
|
+
#endif`,_p=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2280
2280
|
varying vec2 vUv;
|
|
2281
2281
|
#endif
|
|
2282
2282
|
#ifdef USE_MAP
|
|
@@ -2346,7 +2346,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gp=`#ifdef USE_TRANSMISS
|
|
|
2346
2346
|
#ifdef USE_THICKNESSMAP
|
|
2347
2347
|
uniform mat3 thicknessMapTransform;
|
|
2348
2348
|
varying vec2 vThicknessMapUv;
|
|
2349
|
-
#endif`,
|
|
2349
|
+
#endif`,vp=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2350
2350
|
varying vec2 vUv;
|
|
2351
2351
|
#endif
|
|
2352
2352
|
#ifdef USE_MAP
|
|
@@ -2440,7 +2440,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gp=`#ifdef USE_TRANSMISS
|
|
|
2440
2440
|
#ifdef USE_THICKNESSMAP
|
|
2441
2441
|
uniform mat3 thicknessMapTransform;
|
|
2442
2442
|
varying vec2 vThicknessMapUv;
|
|
2443
|
-
#endif`,
|
|
2443
|
+
#endif`,xp=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2444
2444
|
vUv = vec3( uv, 1 ).xy;
|
|
2445
2445
|
#endif
|
|
2446
2446
|
#ifdef USE_MAP
|
|
@@ -2511,7 +2511,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gp=`#ifdef USE_TRANSMISS
|
|
|
2511
2511
|
#endif
|
|
2512
2512
|
#ifdef USE_THICKNESSMAP
|
|
2513
2513
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2514
|
-
#endif`,
|
|
2514
|
+
#endif`,Mp=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2515
2515
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2516
2516
|
#ifdef USE_BATCHING
|
|
2517
2517
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2520,12 +2520,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gp=`#ifdef USE_TRANSMISS
|
|
|
2520
2520
|
worldPosition = instanceMatrix * worldPosition;
|
|
2521
2521
|
#endif
|
|
2522
2522
|
worldPosition = modelMatrix * worldPosition;
|
|
2523
|
-
#endif`;const
|
|
2523
|
+
#endif`;const yp=`varying vec2 vUv;
|
|
2524
2524
|
uniform mat3 uvTransform;
|
|
2525
2525
|
void main() {
|
|
2526
2526
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2527
2527
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2528
|
-
}`,
|
|
2528
|
+
}`,Sp=`uniform sampler2D t2D;
|
|
2529
2529
|
uniform float backgroundIntensity;
|
|
2530
2530
|
varying vec2 vUv;
|
|
2531
2531
|
void main() {
|
|
@@ -2537,14 +2537,14 @@ void main() {
|
|
|
2537
2537
|
gl_FragColor = texColor;
|
|
2538
2538
|
#include <tonemapping_fragment>
|
|
2539
2539
|
#include <colorspace_fragment>
|
|
2540
|
-
}`,
|
|
2540
|
+
}`,Ep=`varying vec3 vWorldDirection;
|
|
2541
2541
|
#include <common>
|
|
2542
2542
|
void main() {
|
|
2543
2543
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2544
2544
|
#include <begin_vertex>
|
|
2545
2545
|
#include <project_vertex>
|
|
2546
2546
|
gl_Position.z = gl_Position.w;
|
|
2547
|
-
}`,
|
|
2547
|
+
}`,Tp=`#ifdef ENVMAP_TYPE_CUBE
|
|
2548
2548
|
uniform samplerCube envMap;
|
|
2549
2549
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2550
2550
|
uniform sampler2D envMap;
|
|
@@ -2567,14 +2567,14 @@ void main() {
|
|
|
2567
2567
|
gl_FragColor = texColor;
|
|
2568
2568
|
#include <tonemapping_fragment>
|
|
2569
2569
|
#include <colorspace_fragment>
|
|
2570
|
-
}`,
|
|
2570
|
+
}`,bp=`varying vec3 vWorldDirection;
|
|
2571
2571
|
#include <common>
|
|
2572
2572
|
void main() {
|
|
2573
2573
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2574
2574
|
#include <begin_vertex>
|
|
2575
2575
|
#include <project_vertex>
|
|
2576
2576
|
gl_Position.z = gl_Position.w;
|
|
2577
|
-
}`,
|
|
2577
|
+
}`,Ap=`uniform samplerCube tCube;
|
|
2578
2578
|
uniform float tFlip;
|
|
2579
2579
|
uniform float opacity;
|
|
2580
2580
|
varying vec3 vWorldDirection;
|
|
@@ -2584,7 +2584,7 @@ void main() {
|
|
|
2584
2584
|
gl_FragColor.a *= opacity;
|
|
2585
2585
|
#include <tonemapping_fragment>
|
|
2586
2586
|
#include <colorspace_fragment>
|
|
2587
|
-
}`,
|
|
2587
|
+
}`,wp=`#include <common>
|
|
2588
2588
|
#include <batching_pars_vertex>
|
|
2589
2589
|
#include <uv_pars_vertex>
|
|
2590
2590
|
#include <displacementmap_pars_vertex>
|
|
@@ -2611,7 +2611,7 @@ void main() {
|
|
|
2611
2611
|
#include <logdepthbuf_vertex>
|
|
2612
2612
|
#include <clipping_planes_vertex>
|
|
2613
2613
|
vHighPrecisionZW = gl_Position.zw;
|
|
2614
|
-
}`,
|
|
2614
|
+
}`,Rp=`#if DEPTH_PACKING == 3200
|
|
2615
2615
|
uniform float opacity;
|
|
2616
2616
|
#endif
|
|
2617
2617
|
#include <common>
|
|
@@ -2645,7 +2645,7 @@ void main() {
|
|
|
2645
2645
|
#elif DEPTH_PACKING == 3203
|
|
2646
2646
|
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
2647
2647
|
#endif
|
|
2648
|
-
}`,
|
|
2648
|
+
}`,Cp=`#define DISTANCE
|
|
2649
2649
|
varying vec3 vWorldPosition;
|
|
2650
2650
|
#include <common>
|
|
2651
2651
|
#include <batching_pars_vertex>
|
|
@@ -2672,7 +2672,7 @@ void main() {
|
|
|
2672
2672
|
#include <worldpos_vertex>
|
|
2673
2673
|
#include <clipping_planes_vertex>
|
|
2674
2674
|
vWorldPosition = worldPosition.xyz;
|
|
2675
|
-
}`,
|
|
2675
|
+
}`,Pp=`#define DISTANCE
|
|
2676
2676
|
uniform vec3 referencePosition;
|
|
2677
2677
|
uniform float nearDistance;
|
|
2678
2678
|
uniform float farDistance;
|
|
@@ -2696,13 +2696,13 @@ void main () {
|
|
|
2696
2696
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2697
2697
|
dist = saturate( dist );
|
|
2698
2698
|
gl_FragColor = packDepthToRGBA( dist );
|
|
2699
|
-
}`,
|
|
2699
|
+
}`,Dp=`varying vec3 vWorldDirection;
|
|
2700
2700
|
#include <common>
|
|
2701
2701
|
void main() {
|
|
2702
2702
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2703
2703
|
#include <begin_vertex>
|
|
2704
2704
|
#include <project_vertex>
|
|
2705
|
-
}`,
|
|
2705
|
+
}`,Lp=`uniform sampler2D tEquirect;
|
|
2706
2706
|
varying vec3 vWorldDirection;
|
|
2707
2707
|
#include <common>
|
|
2708
2708
|
void main() {
|
|
@@ -2711,7 +2711,7 @@ void main() {
|
|
|
2711
2711
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2712
2712
|
#include <tonemapping_fragment>
|
|
2713
2713
|
#include <colorspace_fragment>
|
|
2714
|
-
}`,
|
|
2714
|
+
}`,Ip=`uniform float scale;
|
|
2715
2715
|
attribute float lineDistance;
|
|
2716
2716
|
varying float vLineDistance;
|
|
2717
2717
|
#include <common>
|
|
@@ -2733,7 +2733,7 @@ void main() {
|
|
|
2733
2733
|
#include <logdepthbuf_vertex>
|
|
2734
2734
|
#include <clipping_planes_vertex>
|
|
2735
2735
|
#include <fog_vertex>
|
|
2736
|
-
}`,
|
|
2736
|
+
}`,Up=`uniform vec3 diffuse;
|
|
2737
2737
|
uniform float opacity;
|
|
2738
2738
|
uniform float dashSize;
|
|
2739
2739
|
uniform float totalSize;
|
|
@@ -2761,7 +2761,7 @@ void main() {
|
|
|
2761
2761
|
#include <colorspace_fragment>
|
|
2762
2762
|
#include <fog_fragment>
|
|
2763
2763
|
#include <premultiplied_alpha_fragment>
|
|
2764
|
-
}`,
|
|
2764
|
+
}`,Np=`#include <common>
|
|
2765
2765
|
#include <batching_pars_vertex>
|
|
2766
2766
|
#include <uv_pars_vertex>
|
|
2767
2767
|
#include <envmap_pars_vertex>
|
|
@@ -2793,7 +2793,7 @@ void main() {
|
|
|
2793
2793
|
#include <worldpos_vertex>
|
|
2794
2794
|
#include <envmap_vertex>
|
|
2795
2795
|
#include <fog_vertex>
|
|
2796
|
-
}`,
|
|
2796
|
+
}`,Fp=`uniform vec3 diffuse;
|
|
2797
2797
|
uniform float opacity;
|
|
2798
2798
|
#ifndef FLAT_SHADED
|
|
2799
2799
|
varying vec3 vNormal;
|
|
@@ -2841,7 +2841,7 @@ void main() {
|
|
|
2841
2841
|
#include <fog_fragment>
|
|
2842
2842
|
#include <premultiplied_alpha_fragment>
|
|
2843
2843
|
#include <dithering_fragment>
|
|
2844
|
-
}`,
|
|
2844
|
+
}`,Op=`#define LAMBERT
|
|
2845
2845
|
varying vec3 vViewPosition;
|
|
2846
2846
|
#include <common>
|
|
2847
2847
|
#include <batching_pars_vertex>
|
|
@@ -2880,7 +2880,7 @@ void main() {
|
|
|
2880
2880
|
#include <envmap_vertex>
|
|
2881
2881
|
#include <shadowmap_vertex>
|
|
2882
2882
|
#include <fog_vertex>
|
|
2883
|
-
}`,
|
|
2883
|
+
}`,zp=`#define LAMBERT
|
|
2884
2884
|
uniform vec3 diffuse;
|
|
2885
2885
|
uniform vec3 emissive;
|
|
2886
2886
|
uniform float opacity;
|
|
@@ -2937,7 +2937,7 @@ void main() {
|
|
|
2937
2937
|
#include <fog_fragment>
|
|
2938
2938
|
#include <premultiplied_alpha_fragment>
|
|
2939
2939
|
#include <dithering_fragment>
|
|
2940
|
-
}`,
|
|
2940
|
+
}`,Bp=`#define MATCAP
|
|
2941
2941
|
varying vec3 vViewPosition;
|
|
2942
2942
|
#include <common>
|
|
2943
2943
|
#include <batching_pars_vertex>
|
|
@@ -2971,7 +2971,7 @@ void main() {
|
|
|
2971
2971
|
#include <clipping_planes_vertex>
|
|
2972
2972
|
#include <fog_vertex>
|
|
2973
2973
|
vViewPosition = - mvPosition.xyz;
|
|
2974
|
-
}`,
|
|
2974
|
+
}`,Hp=`#define MATCAP
|
|
2975
2975
|
uniform vec3 diffuse;
|
|
2976
2976
|
uniform float opacity;
|
|
2977
2977
|
uniform sampler2D matcap;
|
|
@@ -3017,7 +3017,7 @@ void main() {
|
|
|
3017
3017
|
#include <fog_fragment>
|
|
3018
3018
|
#include <premultiplied_alpha_fragment>
|
|
3019
3019
|
#include <dithering_fragment>
|
|
3020
|
-
}`,
|
|
3020
|
+
}`,kp=`#define NORMAL
|
|
3021
3021
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3022
3022
|
varying vec3 vViewPosition;
|
|
3023
3023
|
#endif
|
|
@@ -3050,7 +3050,7 @@ void main() {
|
|
|
3050
3050
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3051
3051
|
vViewPosition = - mvPosition.xyz;
|
|
3052
3052
|
#endif
|
|
3053
|
-
}`,
|
|
3053
|
+
}`,Vp=`#define NORMAL
|
|
3054
3054
|
uniform float opacity;
|
|
3055
3055
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3056
3056
|
varying vec3 vViewPosition;
|
|
@@ -3072,7 +3072,7 @@ void main() {
|
|
|
3072
3072
|
#ifdef OPAQUE
|
|
3073
3073
|
gl_FragColor.a = 1.0;
|
|
3074
3074
|
#endif
|
|
3075
|
-
}`,
|
|
3075
|
+
}`,Gp=`#define PHONG
|
|
3076
3076
|
varying vec3 vViewPosition;
|
|
3077
3077
|
#include <common>
|
|
3078
3078
|
#include <batching_pars_vertex>
|
|
@@ -3111,7 +3111,7 @@ void main() {
|
|
|
3111
3111
|
#include <envmap_vertex>
|
|
3112
3112
|
#include <shadowmap_vertex>
|
|
3113
3113
|
#include <fog_vertex>
|
|
3114
|
-
}`,
|
|
3114
|
+
}`,Wp=`#define PHONG
|
|
3115
3115
|
uniform vec3 diffuse;
|
|
3116
3116
|
uniform vec3 emissive;
|
|
3117
3117
|
uniform vec3 specular;
|
|
@@ -3170,7 +3170,7 @@ void main() {
|
|
|
3170
3170
|
#include <fog_fragment>
|
|
3171
3171
|
#include <premultiplied_alpha_fragment>
|
|
3172
3172
|
#include <dithering_fragment>
|
|
3173
|
-
}`,
|
|
3173
|
+
}`,Xp=`#define STANDARD
|
|
3174
3174
|
varying vec3 vViewPosition;
|
|
3175
3175
|
#ifdef USE_TRANSMISSION
|
|
3176
3176
|
varying vec3 vWorldPosition;
|
|
@@ -3213,7 +3213,7 @@ void main() {
|
|
|
3213
3213
|
#ifdef USE_TRANSMISSION
|
|
3214
3214
|
vWorldPosition = worldPosition.xyz;
|
|
3215
3215
|
#endif
|
|
3216
|
-
}
|
|
3216
|
+
}`,qp=`#define STANDARD
|
|
3217
3217
|
#ifdef PHYSICAL
|
|
3218
3218
|
#define IOR
|
|
3219
3219
|
#define USE_SPECULAR
|
|
@@ -3338,7 +3338,7 @@ void main() {
|
|
|
3338
3338
|
#include <fog_fragment>
|
|
3339
3339
|
#include <premultiplied_alpha_fragment>
|
|
3340
3340
|
#include <dithering_fragment>
|
|
3341
|
-
}
|
|
3341
|
+
}`,$p=`#define TOON
|
|
3342
3342
|
varying vec3 vViewPosition;
|
|
3343
3343
|
#include <common>
|
|
3344
3344
|
#include <batching_pars_vertex>
|
|
@@ -3375,7 +3375,7 @@ void main() {
|
|
|
3375
3375
|
#include <worldpos_vertex>
|
|
3376
3376
|
#include <shadowmap_vertex>
|
|
3377
3377
|
#include <fog_vertex>
|
|
3378
|
-
}`,
|
|
3378
|
+
}`,Yp=`#define TOON
|
|
3379
3379
|
uniform vec3 diffuse;
|
|
3380
3380
|
uniform vec3 emissive;
|
|
3381
3381
|
uniform float opacity;
|
|
@@ -3428,7 +3428,7 @@ void main() {
|
|
|
3428
3428
|
#include <fog_fragment>
|
|
3429
3429
|
#include <premultiplied_alpha_fragment>
|
|
3430
3430
|
#include <dithering_fragment>
|
|
3431
|
-
}`,
|
|
3431
|
+
}`,jp=`uniform float size;
|
|
3432
3432
|
uniform float scale;
|
|
3433
3433
|
#include <common>
|
|
3434
3434
|
#include <color_pars_vertex>
|
|
@@ -3459,7 +3459,7 @@ void main() {
|
|
|
3459
3459
|
#include <clipping_planes_vertex>
|
|
3460
3460
|
#include <worldpos_vertex>
|
|
3461
3461
|
#include <fog_vertex>
|
|
3462
|
-
}`,
|
|
3462
|
+
}`,Zp=`uniform vec3 diffuse;
|
|
3463
3463
|
uniform float opacity;
|
|
3464
3464
|
#include <common>
|
|
3465
3465
|
#include <color_pars_fragment>
|
|
@@ -3484,7 +3484,7 @@ void main() {
|
|
|
3484
3484
|
#include <colorspace_fragment>
|
|
3485
3485
|
#include <fog_fragment>
|
|
3486
3486
|
#include <premultiplied_alpha_fragment>
|
|
3487
|
-
}`,
|
|
3487
|
+
}`,Kp=`#include <common>
|
|
3488
3488
|
#include <batching_pars_vertex>
|
|
3489
3489
|
#include <fog_pars_vertex>
|
|
3490
3490
|
#include <morphtarget_pars_vertex>
|
|
@@ -3507,7 +3507,7 @@ void main() {
|
|
|
3507
3507
|
#include <worldpos_vertex>
|
|
3508
3508
|
#include <shadowmap_vertex>
|
|
3509
3509
|
#include <fog_vertex>
|
|
3510
|
-
}`,
|
|
3510
|
+
}`,Jp=`uniform vec3 color;
|
|
3511
3511
|
uniform float opacity;
|
|
3512
3512
|
#include <common>
|
|
3513
3513
|
#include <packing>
|
|
@@ -3523,7 +3523,7 @@ void main() {
|
|
|
3523
3523
|
#include <tonemapping_fragment>
|
|
3524
3524
|
#include <colorspace_fragment>
|
|
3525
3525
|
#include <fog_fragment>
|
|
3526
|
-
}`,
|
|
3526
|
+
}`,Qp=`uniform float rotation;
|
|
3527
3527
|
uniform vec2 center;
|
|
3528
3528
|
#include <common>
|
|
3529
3529
|
#include <uv_pars_vertex>
|
|
@@ -3547,7 +3547,7 @@ void main() {
|
|
|
3547
3547
|
#include <logdepthbuf_vertex>
|
|
3548
3548
|
#include <clipping_planes_vertex>
|
|
3549
3549
|
#include <fog_vertex>
|
|
3550
|
-
}`,
|
|
3550
|
+
}`,em=`uniform vec3 diffuse;
|
|
3551
3551
|
uniform float opacity;
|
|
3552
3552
|
#include <common>
|
|
3553
3553
|
#include <uv_pars_fragment>
|
|
@@ -3572,7 +3572,7 @@ void main() {
|
|
|
3572
3572
|
#include <tonemapping_fragment>
|
|
3573
3573
|
#include <colorspace_fragment>
|
|
3574
3574
|
#include <fog_fragment>
|
|
3575
|
-
}`,Ue={alphahash_fragment:Ed,alphahash_pars_fragment:Td,alphamap_fragment:bd,alphamap_pars_fragment:Ad,alphatest_fragment:wd,alphatest_pars_fragment:Rd,aomap_fragment:Cd,aomap_pars_fragment:Pd,batching_pars_vertex:Dd,batching_vertex:Ld,begin_vertex:Id,beginnormal_vertex:Ud,bsdfs:Nd,iridescence_fragment:Fd,bumpmap_pars_fragment:Od,clipping_planes_fragment:zd,clipping_planes_pars_fragment:Bd,clipping_planes_pars_vertex:Hd,clipping_planes_vertex:kd,color_fragment:Vd,color_pars_fragment:Gd,color_pars_vertex:Wd,color_vertex:Xd,common:qd,cube_uv_reflection_fragment:$d,defaultnormal_vertex:Yd,displacementmap_pars_vertex:jd,displacementmap_vertex:Zd,emissivemap_fragment:Kd,emissivemap_pars_fragment:Jd,colorspace_fragment:Qd,colorspace_pars_fragment:eu,envmap_fragment:tu,envmap_common_pars_fragment:nu,envmap_pars_fragment:iu,envmap_pars_vertex:ru,envmap_physical_pars_fragment:mu,envmap_vertex:su,fog_vertex:au,fog_pars_vertex:ou,fog_fragment:cu,fog_pars_fragment:lu,gradientmap_pars_fragment:hu,lightmap_pars_fragment:fu,lights_lambert_fragment:du,lights_lambert_pars_fragment:uu,lights_pars_begin:pu,lights_toon_fragment:gu,lights_toon_pars_fragment:_u,lights_phong_fragment:vu,lights_phong_pars_fragment:xu,lights_physical_fragment:Mu,lights_physical_pars_fragment:yu,lights_fragment_begin:Su,lights_fragment_maps:Eu,lights_fragment_end:Tu,logdepthbuf_fragment:bu,logdepthbuf_pars_fragment:Au,logdepthbuf_pars_vertex:wu,logdepthbuf_vertex:Ru,map_fragment:Cu,map_pars_fragment:Pu,map_particle_fragment:Du,map_particle_pars_fragment:Lu,metalnessmap_fragment:Iu,metalnessmap_pars_fragment:Uu,morphinstance_vertex:Nu,morphcolor_vertex:Fu,morphnormal_vertex:Ou,morphtarget_pars_vertex:zu,morphtarget_vertex:Bu,normal_fragment_begin:Hu,normal_fragment_maps:ku,normal_pars_fragment:Vu,normal_pars_vertex:Gu,normal_vertex:Wu,normalmap_pars_fragment:Xu,clearcoat_normal_fragment_begin:qu,clearcoat_normal_fragment_maps:$u,clearcoat_pars_fragment:Yu,iridescence_pars_fragment:ju,opaque_fragment:Zu,packing:Ku,premultiplied_alpha_fragment:Ju,project_vertex:Qu,dithering_fragment:ep,dithering_pars_fragment:tp,roughnessmap_fragment:np,roughnessmap_pars_fragment:ip,shadowmap_pars_fragment:rp,shadowmap_pars_vertex:sp,shadowmap_vertex:ap,shadowmask_pars_fragment:op,skinbase_vertex:cp,skinning_pars_vertex:lp,skinning_vertex:hp,skinnormal_vertex:fp,specularmap_fragment:dp,specularmap_pars_fragment:up,tonemapping_fragment:pp,tonemapping_pars_fragment:mp,transmission_fragment:gp,transmission_pars_fragment:_p,uv_pars_fragment:vp,uv_pars_vertex:xp,uv_vertex:Mp,worldpos_vertex:yp,background_vert:Sp,background_frag:Ep,backgroundCube_vert:Tp,backgroundCube_frag:bp,cube_vert:Ap,cube_frag:wp,depth_vert:Rp,depth_frag:Cp,distanceRGBA_vert:Pp,distanceRGBA_frag:Dp,equirect_vert:Lp,equirect_frag:Ip,linedashed_vert:Up,linedashed_frag:Np,meshbasic_vert:Fp,meshbasic_frag:Op,meshlambert_vert:zp,meshlambert_frag:Bp,meshmatcap_vert:Hp,meshmatcap_frag:kp,meshnormal_vert:Vp,meshnormal_frag:Gp,meshphong_vert:Wp,meshphong_frag:Xp,meshphysical_vert:qp,meshphysical_frag:$p,meshtoon_vert:Yp,meshtoon_frag:jp,points_vert:Zp,points_frag:Kp,shadow_vert:Jp,shadow_frag:Qp,sprite_vert:e0,sprite_frag:t0},ne={common:{diffuse:{value:new Oe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new De}},envmap:{envMap:{value:null},envMapRotation:{value:new De},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new De}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new De}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new De},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new De},normalScale:{value:new we(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new De},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new De}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new De}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new De}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Oe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Oe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0},uvTransform:{value:new De}},sprite:{diffuse:{value:new Oe(16777215)},opacity:{value:1},center:{value:new we(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}}},Kt={basic:{uniforms:St([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.fog]),vertexShader:Ue.meshbasic_vert,fragmentShader:Ue.meshbasic_frag},lambert:{uniforms:St([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)}}]),vertexShader:Ue.meshlambert_vert,fragmentShader:Ue.meshlambert_frag},phong:{uniforms:St([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)},specular:{value:new Oe(1118481)},shininess:{value:30}}]),vertexShader:Ue.meshphong_vert,fragmentShader:Ue.meshphong_frag},standard:{uniforms:St([ne.common,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.roughnessmap,ne.metalnessmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag},toon:{uniforms:St([ne.common,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.gradientmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)}}]),vertexShader:Ue.meshtoon_vert,fragmentShader:Ue.meshtoon_frag},matcap:{uniforms:St([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,{matcap:{value:null}}]),vertexShader:Ue.meshmatcap_vert,fragmentShader:Ue.meshmatcap_frag},points:{uniforms:St([ne.points,ne.fog]),vertexShader:Ue.points_vert,fragmentShader:Ue.points_frag},dashed:{uniforms:St([ne.common,ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ue.linedashed_vert,fragmentShader:Ue.linedashed_frag},depth:{uniforms:St([ne.common,ne.displacementmap]),vertexShader:Ue.depth_vert,fragmentShader:Ue.depth_frag},normal:{uniforms:St([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,{opacity:{value:1}}]),vertexShader:Ue.meshnormal_vert,fragmentShader:Ue.meshnormal_frag},sprite:{uniforms:St([ne.sprite,ne.fog]),vertexShader:Ue.sprite_vert,fragmentShader:Ue.sprite_frag},background:{uniforms:{uvTransform:{value:new De},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ue.background_vert,fragmentShader:Ue.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new De}},vertexShader:Ue.backgroundCube_vert,fragmentShader:Ue.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ue.cube_vert,fragmentShader:Ue.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ue.equirect_vert,fragmentShader:Ue.equirect_frag},distanceRGBA:{uniforms:St([ne.common,ne.displacementmap,{referencePosition:{value:new z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ue.distanceRGBA_vert,fragmentShader:Ue.distanceRGBA_frag},shadow:{uniforms:St([ne.lights,ne.fog,{color:{value:new Oe(0)},opacity:{value:1}}]),vertexShader:Ue.shadow_vert,fragmentShader:Ue.shadow_frag}};Kt.physical={uniforms:St([Kt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new De},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new De},clearcoatNormalScale:{value:new we(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new De},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new De},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new De},sheen:{value:0},sheenColor:{value:new Oe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new De},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new De},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new De},transmissionSamplerSize:{value:new we},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new De},attenuationDistance:{value:0},attenuationColor:{value:new Oe(0)},specularColor:{value:new Oe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new De},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new De},anisotropyVector:{value:new we},anisotropyMap:{value:null},anisotropyMapTransform:{value:new De}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag};const gr={r:0,b:0,g:0},Bn=new mn,n0=new je;function i0(t,e,n,i,r,s,a){const o=new Oe(0);let c=s===!0?0:1,l,h,f=null,d=0,u=null;function g(T){let y=T.isScene===!0?T.background:null;return y&&y.isTexture&&(y=(T.backgroundBlurriness>0?n:e).get(y)),y}function _(T){let y=!1;const v=g(T);v===null?m(o,c):v&&v.isColor&&(m(v,1),y=!0);const P=t.xr.getEnvironmentBlendMode();P==="additive"?i.buffers.color.setClear(0,0,0,1,a):P==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(t.autoClear||y)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function p(T,y){const v=g(y);v&&(v.isCubeTexture||v.mapping===Vr)?(h===void 0&&(h=new Rt(new Kn(1,1,1),new Yt({name:"BackgroundCubeMaterial",uniforms:Ai(Kt.backgroundCube.uniforms),vertexShader:Kt.backgroundCube.vertexShader,fragmentShader:Kt.backgroundCube.fragmentShader,side:Ct,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,b,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Bn.copy(y.backgroundRotation),Bn.x*=-1,Bn.y*=-1,Bn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Bn.y*=-1,Bn.z*=-1),h.material.uniforms.envMap.value=v,h.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(n0.makeRotationFromEuler(Bn)),h.material.toneMapped=Ge.getTransfer(v.colorSpace)!==Ze,(f!==v||d!==v.version||u!==t.toneMapping)&&(h.material.needsUpdate=!0,f=v,d=v.version,u=t.toneMapping),h.layers.enableAll(),T.unshift(h,h.geometry,h.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new Rt(new Wr(2,2),new Yt({name:"BackgroundMaterial",uniforms:Ai(Kt.background.uniforms),vertexShader:Kt.background.vertexShader,fragmentShader:Kt.background.fragmentShader,side:Dn,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=v,l.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,l.material.toneMapped=Ge.getTransfer(v.colorSpace)!==Ze,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(f!==v||d!==v.version||u!==t.toneMapping)&&(l.material.needsUpdate=!0,f=v,d=v.version,u=t.toneMapping),l.layers.enableAll(),T.unshift(l,l.geometry,l.material,0,0,null))}function m(T,y){T.getRGB(gr,Wc(t)),i.buffers.color.setClear(gr.r,gr.g,gr.b,y,a)}return{getClearColor:function(){return o},setClearColor:function(T,y=1){o.set(T),c=y,m(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(T){c=T,m(o,c)},render:_,addToRenderList:p}}function r0(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=d(null);let s=r,a=!1;function o(x,C,L,D,U){let X=!1;const V=f(D,L,C);s!==V&&(s=V,l(s.object)),X=u(x,D,L,U),X&&g(x,D,L,U),U!==null&&e.update(U,t.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,v(x,C,L,D),U!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(U).buffer))}function c(){return t.createVertexArray()}function l(x){return t.bindVertexArray(x)}function h(x){return t.deleteVertexArray(x)}function f(x,C,L){const D=L.wireframe===!0;let U=i[x.id];U===void 0&&(U={},i[x.id]=U);let X=U[C.id];X===void 0&&(X={},U[C.id]=X);let V=X[D];return V===void 0&&(V=d(c()),X[D]=V),V}function d(x){const C=[],L=[],D=[];for(let U=0;U<n;U++)C[U]=0,L[U]=0,D[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:C,enabledAttributes:L,attributeDivisors:D,object:x,attributes:{},index:null}}function u(x,C,L,D){const U=s.attributes,X=C.attributes;let V=0;const K=L.getAttributes();for(const G in K)if(K[G].location>=0){const ie=U[G];let ve=X[G];if(ve===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(ve=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(ve=x.instanceColor)),ie===void 0||ie.attribute!==ve||ve&&ie.data!==ve.data)return!0;V++}return s.attributesNum!==V||s.index!==D}function g(x,C,L,D){const U={},X=C.attributes;let V=0;const K=L.getAttributes();for(const G in K)if(K[G].location>=0){let ie=X[G];ie===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(ie=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(ie=x.instanceColor));const ve={};ve.attribute=ie,ie&&ie.data&&(ve.data=ie.data),U[G]=ve,V++}s.attributes=U,s.attributesNum=V,s.index=D}function _(){const x=s.newAttributes;for(let C=0,L=x.length;C<L;C++)x[C]=0}function p(x){m(x,0)}function m(x,C){const L=s.newAttributes,D=s.enabledAttributes,U=s.attributeDivisors;L[x]=1,D[x]===0&&(t.enableVertexAttribArray(x),D[x]=1),U[x]!==C&&(t.vertexAttribDivisor(x,C),U[x]=C)}function T(){const x=s.newAttributes,C=s.enabledAttributes;for(let L=0,D=C.length;L<D;L++)C[L]!==x[L]&&(t.disableVertexAttribArray(L),C[L]=0)}function y(x,C,L,D,U,X,V){V===!0?t.vertexAttribIPointer(x,C,L,U,X):t.vertexAttribPointer(x,C,L,D,U,X)}function v(x,C,L,D){_();const U=D.attributes,X=L.getAttributes(),V=C.defaultAttributeValues;for(const K in X){const G=X[K];if(G.location>=0){let te=U[K];if(te===void 0&&(K==="instanceMatrix"&&x.instanceMatrix&&(te=x.instanceMatrix),K==="instanceColor"&&x.instanceColor&&(te=x.instanceColor)),te!==void 0){const ie=te.normalized,ve=te.itemSize,Le=e.get(te);if(Le===void 0)continue;const Xe=Le.buffer,q=Le.type,Q=Le.bytesPerElement,he=q===t.INT||q===t.UNSIGNED_INT||te.gpuType===ya;if(te.isInterleavedBufferAttribute){const re=te.data,Se=re.stride,Re=te.offset;if(re.isInstancedInterleavedBuffer){for(let Fe=0;Fe<G.locationSize;Fe++)m(G.location+Fe,re.meshPerAttribute);x.isInstancedMesh!==!0&&D._maxInstanceCount===void 0&&(D._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Fe=0;Fe<G.locationSize;Fe++)p(G.location+Fe);t.bindBuffer(t.ARRAY_BUFFER,Xe);for(let Fe=0;Fe<G.locationSize;Fe++)y(G.location+Fe,ve/G.locationSize,q,ie,Se*Q,(Re+ve/G.locationSize*Fe)*Q,he)}else{if(te.isInstancedBufferAttribute){for(let re=0;re<G.locationSize;re++)m(G.location+re,te.meshPerAttribute);x.isInstancedMesh!==!0&&D._maxInstanceCount===void 0&&(D._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let re=0;re<G.locationSize;re++)p(G.location+re);t.bindBuffer(t.ARRAY_BUFFER,Xe);for(let re=0;re<G.locationSize;re++)y(G.location+re,ve/G.locationSize,q,ie,ve*Q,ve/G.locationSize*re*Q,he)}}else if(V!==void 0){const ie=V[K];if(ie!==void 0)switch(ie.length){case 2:t.vertexAttrib2fv(G.location,ie);break;case 3:t.vertexAttrib3fv(G.location,ie);break;case 4:t.vertexAttrib4fv(G.location,ie);break;default:t.vertexAttrib1fv(G.location,ie)}}}}T()}function P(){R();for(const x in i){const C=i[x];for(const L in C){const D=C[L];for(const U in D)h(D[U].object),delete D[U];delete C[L]}delete i[x]}}function b(x){if(i[x.id]===void 0)return;const C=i[x.id];for(const L in C){const D=C[L];for(const U in D)h(D[U].object),delete D[U];delete C[L]}delete i[x.id]}function w(x){for(const C in i){const L=i[C];if(L[x.id]===void 0)continue;const D=L[x.id];for(const U in D)h(D[U].object),delete D[U];delete L[x.id]}}function R(){S(),a=!0,s!==r&&(s=r,l(s.object))}function S(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:R,resetDefaultState:S,dispose:P,releaseStatesOfGeometry:b,releaseStatesOfProgram:w,initAttributes:_,enableAttribute:p,disableUnusedAttributes:T}}function s0(t,e,n){let i;function r(l){i=l}function s(l,h){t.drawArrays(i,l,h),n.update(h,i,1)}function a(l,h,f){f!==0&&(t.drawArraysInstanced(i,l,h,f),n.update(h,i,f))}function o(l,h,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,h,0,f);let u=0;for(let g=0;g<f;g++)u+=h[g];n.update(u,i,1)}function c(l,h,f,d){if(f===0)return;const u=e.get("WEBGL_multi_draw");if(u===null)for(let g=0;g<l.length;g++)a(l[g],h[g],d[g]);else{u.multiDrawArraysInstancedWEBGL(i,l,0,h,0,d,0,f);let g=0;for(let _=0;_<f;_++)g+=h[_]*d[_];n.update(g,i,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function a0(t,e,n,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(w){return!(w!==qt&&i.convert(w)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const R=w===$i&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==pn&&i.convert(w)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==en&&!R)}function c(w){if(w==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=n.precision!==void 0?n.precision:"highp";const h=c(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const f=n.logarithmicDepthBuffer===!0,d=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),g=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),y=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),P=g>0,b=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:f,reverseDepthBuffer:d,maxTextures:u,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:T,maxVaryings:y,maxFragmentUniforms:v,vertexTextures:P,maxSamples:b}}function o0(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new fn,o=new De,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){const u=f.length!==0||d||i!==0||r;return r=d,i=f.length,u},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){n=h(f,d,0)},this.setState=function(f,d,u){const g=f.clippingPlanes,_=f.clipIntersection,p=f.clipShadows,m=t.get(f);if(!r||g===null||g.length===0||s&&!p)s?h(null):l();else{const T=s?0:i,y=T*4;let v=m.clippingState||null;c.value=v,v=h(g,d,y,u);for(let P=0;P!==y;++P)v[P]=n[P];m.clippingState=v,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=T}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(f,d,u,g){const _=f!==null?f.length:0;let p=null;if(_!==0){if(p=c.value,g!==!0||p===null){const m=u+_*4,T=d.matrixWorldInverse;o.getNormalMatrix(T),(p===null||p.length<m)&&(p=new Float32Array(m));for(let y=0,v=u;y!==_;++y,v+=4)a.copy(f[y]).applyMatrix4(T,o),a.normal.toArray(p,v),p[v+3]=a.constant}c.value=p,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,p}}function c0(t){let e=new WeakMap;function n(a,o){return o===zs?a.mapping=Si:o===Bs&&(a.mapping=Ei),a}function i(a){if(a&&a.isTexture){const o=a.mapping;if(o===zs||o===Bs)if(e.has(a)){const c=e.get(a).texture;return n(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new xd(c.height);return l.fromEquirectangularTexture(t,a),e.set(a,l),a.addEventListener("dispose",r),n(l.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Yc extends Xc{constructor(e=-1,n=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=n,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,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=n,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(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+n,c=r-n;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const mi=4,wo=[.125,.215,.35,.446,.526,.582],Gn=20,vs=new Yc,Ro=new Oe;let xs=null,Ms=0,ys=0,Ss=!1;const kn=(1+Math.sqrt(5))/2,di=1/kn,Co=[new z(-kn,di,0),new z(kn,di,0),new z(-di,0,kn),new z(di,0,kn),new z(0,kn,-di),new z(0,kn,di),new z(-1,1,-1),new z(1,1,-1),new z(-1,1,1),new z(1,1,1)];class Po{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,i=.1,r=100){xs=this._renderer.getRenderTarget(),Ms=this._renderer.getActiveCubeFace(),ys=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Io(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Lo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(xs,Ms,ys),this._renderer.xr.enabled=Ss,e.scissorTest=!1,_r(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Si||e.mapping===Ei?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),xs=this._renderer.getRenderTarget(),Ms=this._renderer.getActiveCubeFace(),ys=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:Qt,minFilter:Qt,generateMipmaps:!1,type:$i,format:qt,colorSpace:Ri,depthBuffer:!1},r=Do(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Do(e,n,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=l0(s)),this._blurMaterial=h0(s,e,n)}return r}_compileMaterial(e){const n=new Rt(this._lodPlanes[0],e);this._renderer.compile(n,vs)}_sceneToCubeUV(e,n,i,r){const o=new zt(90,1,n,i),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,d=h.toneMapping;h.getClearColor(Ro),h.toneMapping=Pn,h.autoClear=!1;const u=new Pi({name:"PMREM.Background",side:Ct,depthWrite:!1,depthTest:!1}),g=new Rt(new Kn,u);let _=!1;const p=e.background;p?p.isColor&&(u.color.copy(p),e.background=null,_=!0):(u.color.copy(Ro),_=!0);for(let m=0;m<6;m++){const T=m%3;T===0?(o.up.set(0,c[m],0),o.lookAt(l[m],0,0)):T===1?(o.up.set(0,0,c[m]),o.lookAt(0,l[m],0)):(o.up.set(0,c[m],0),o.lookAt(0,0,l[m]));const y=this._cubeSize;_r(r,T*y,m>2?y:0,y,y),h.setRenderTarget(r),_&&h.render(g,o),h.render(e,o)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=d,h.autoClear=f,e.background=p}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===Si||e.mapping===Ei;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Io()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Lo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Rt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;_r(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(a,vs)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Co[(r-s-1)%Co.length];this._blur(e,s-1,s,a,o)}n.autoClear=i}_blur(e,n,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,n,i,r,s,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,f=new Rt(this._lodPlanes[r],l),d=l.uniforms,u=this._sizeLods[i]-1,g=isFinite(s)?Math.PI/(2*u):2*Math.PI/(2*Gn-1),_=s/g,p=isFinite(s)?1+Math.floor(h*_):Gn;p>Gn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Gn}`);const m=[];let T=0;for(let w=0;w<Gn;++w){const R=w/_,S=Math.exp(-R*R/2);m.push(S),w===0?T+=S:w<p&&(T+=2*S)}for(let w=0;w<m.length;w++)m[w]=m[w]/T;d.envMap.value=e.texture,d.samples.value=p,d.weights.value=m,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:y}=this;d.dTheta.value=g,d.mipInt.value=y-i;const v=this._sizeLods[r],P=3*v*(r>y-mi?r-y+mi:0),b=4*(this._cubeSize-v);_r(n,P,b,3*v,2*v),c.setRenderTarget(n),c.render(f,vs)}}function l0(t){const e=[],n=[],i=[];let r=t;const s=t-mi+1+wo.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);n.push(o);let c=1/o;a>t-mi?c=wo[a-t+mi-1]:a===0&&(c=0),i.push(c);const l=1/(o-2),h=-l,f=1+l,d=[h,h,f,h,f,f,h,h,f,f,h,f],u=6,g=6,_=3,p=2,m=1,T=new Float32Array(_*g*u),y=new Float32Array(p*g*u),v=new Float32Array(m*g*u);for(let b=0;b<u;b++){const w=b%3*2/3-1,R=b>2?0:-1,S=[w,R,0,w+2/3,R,0,w+2/3,R+1,0,w,R,0,w+2/3,R+1,0,w,R+1,0];T.set(S,_*g*b),y.set(d,p*g*b);const x=[b,b,b,b,b,b];v.set(x,m*g*b)}const P=new pt;P.setAttribute("position",new Bt(T,_)),P.setAttribute("uv",new Bt(y,p)),P.setAttribute("faceIndex",new Bt(v,m)),e.push(P),r>mi&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function Do(t,e,n){const i=new $n(t,e,n);return i.texture.mapping=Vr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function _r(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function h0(t,e,n){const i=new Float32Array(Gn),r=new z(0,1,0);return new Yt({name:"SphericalGaussianBlur",defines:{n:Gn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Pa(),fragmentShader:`
|
|
3575
|
+
}`,Ue={alphahash_fragment:Sd,alphahash_pars_fragment:Ed,alphamap_fragment:Td,alphamap_pars_fragment:bd,alphatest_fragment:Ad,alphatest_pars_fragment:wd,aomap_fragment:Rd,aomap_pars_fragment:Cd,batching_pars_vertex:Pd,batching_vertex:Dd,begin_vertex:Ld,beginnormal_vertex:Id,bsdfs:Ud,iridescence_fragment:Nd,bumpmap_pars_fragment:Fd,clipping_planes_fragment:Od,clipping_planes_pars_fragment:zd,clipping_planes_pars_vertex:Bd,clipping_planes_vertex:Hd,color_fragment:kd,color_pars_fragment:Vd,color_pars_vertex:Gd,color_vertex:Wd,common:Xd,cube_uv_reflection_fragment:qd,defaultnormal_vertex:$d,displacementmap_pars_vertex:Yd,displacementmap_vertex:jd,emissivemap_fragment:Zd,emissivemap_pars_fragment:Kd,colorspace_fragment:Jd,colorspace_pars_fragment:Qd,envmap_fragment:eu,envmap_common_pars_fragment:tu,envmap_pars_fragment:nu,envmap_pars_vertex:iu,envmap_physical_pars_fragment:pu,envmap_vertex:ru,fog_vertex:su,fog_pars_vertex:au,fog_fragment:ou,fog_pars_fragment:cu,gradientmap_pars_fragment:lu,lightmap_pars_fragment:hu,lights_lambert_fragment:fu,lights_lambert_pars_fragment:du,lights_pars_begin:uu,lights_toon_fragment:mu,lights_toon_pars_fragment:gu,lights_phong_fragment:_u,lights_phong_pars_fragment:vu,lights_physical_fragment:xu,lights_physical_pars_fragment:Mu,lights_fragment_begin:yu,lights_fragment_maps:Su,lights_fragment_end:Eu,logdepthbuf_fragment:Tu,logdepthbuf_pars_fragment:bu,logdepthbuf_pars_vertex:Au,logdepthbuf_vertex:wu,map_fragment:Ru,map_pars_fragment:Cu,map_particle_fragment:Pu,map_particle_pars_fragment:Du,metalnessmap_fragment:Lu,metalnessmap_pars_fragment:Iu,morphinstance_vertex:Uu,morphcolor_vertex:Nu,morphnormal_vertex:Fu,morphtarget_pars_vertex:Ou,morphtarget_vertex:zu,normal_fragment_begin:Bu,normal_fragment_maps:Hu,normal_pars_fragment:ku,normal_pars_vertex:Vu,normal_vertex:Gu,normalmap_pars_fragment:Wu,clearcoat_normal_fragment_begin:Xu,clearcoat_normal_fragment_maps:qu,clearcoat_pars_fragment:$u,iridescence_pars_fragment:Yu,opaque_fragment:ju,packing:Zu,premultiplied_alpha_fragment:Ku,project_vertex:Ju,dithering_fragment:Qu,dithering_pars_fragment:ep,roughnessmap_fragment:tp,roughnessmap_pars_fragment:np,shadowmap_pars_fragment:ip,shadowmap_pars_vertex:rp,shadowmap_vertex:sp,shadowmask_pars_fragment:ap,skinbase_vertex:op,skinning_pars_vertex:cp,skinning_vertex:lp,skinnormal_vertex:hp,specularmap_fragment:fp,specularmap_pars_fragment:dp,tonemapping_fragment:up,tonemapping_pars_fragment:pp,transmission_fragment:mp,transmission_pars_fragment:gp,uv_pars_fragment:_p,uv_pars_vertex:vp,uv_vertex:xp,worldpos_vertex:Mp,background_vert:yp,background_frag:Sp,backgroundCube_vert:Ep,backgroundCube_frag:Tp,cube_vert:bp,cube_frag:Ap,depth_vert:wp,depth_frag:Rp,distanceRGBA_vert:Cp,distanceRGBA_frag:Pp,equirect_vert:Dp,equirect_frag:Lp,linedashed_vert:Ip,linedashed_frag:Up,meshbasic_vert:Np,meshbasic_frag:Fp,meshlambert_vert:Op,meshlambert_frag:zp,meshmatcap_vert:Bp,meshmatcap_frag:Hp,meshnormal_vert:kp,meshnormal_frag:Vp,meshphong_vert:Gp,meshphong_frag:Wp,meshphysical_vert:Xp,meshphysical_frag:qp,meshtoon_vert:$p,meshtoon_frag:Yp,points_vert:jp,points_frag:Zp,shadow_vert:Kp,shadow_frag:Jp,sprite_vert:Qp,sprite_frag:em},ne={common:{diffuse:{value:new Oe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new De}},envmap:{envMap:{value:null},envMapRotation:{value:new De},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new De}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new De}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new De},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new De},normalScale:{value:new we(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new De},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new De}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new De}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new De}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Oe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Oe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0},uvTransform:{value:new De}},sprite:{diffuse:{value:new Oe(16777215)},opacity:{value:1},center:{value:new we(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new De},alphaMap:{value:null},alphaMapTransform:{value:new De},alphaTest:{value:0}}},Kt={basic:{uniforms:St([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.fog]),vertexShader:Ue.meshbasic_vert,fragmentShader:Ue.meshbasic_frag},lambert:{uniforms:St([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)}}]),vertexShader:Ue.meshlambert_vert,fragmentShader:Ue.meshlambert_frag},phong:{uniforms:St([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)},specular:{value:new Oe(1118481)},shininess:{value:30}}]),vertexShader:Ue.meshphong_vert,fragmentShader:Ue.meshphong_frag},standard:{uniforms:St([ne.common,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.roughnessmap,ne.metalnessmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag},toon:{uniforms:St([ne.common,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.gradientmap,ne.fog,ne.lights,{emissive:{value:new Oe(0)}}]),vertexShader:Ue.meshtoon_vert,fragmentShader:Ue.meshtoon_frag},matcap:{uniforms:St([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,{matcap:{value:null}}]),vertexShader:Ue.meshmatcap_vert,fragmentShader:Ue.meshmatcap_frag},points:{uniforms:St([ne.points,ne.fog]),vertexShader:Ue.points_vert,fragmentShader:Ue.points_frag},dashed:{uniforms:St([ne.common,ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ue.linedashed_vert,fragmentShader:Ue.linedashed_frag},depth:{uniforms:St([ne.common,ne.displacementmap]),vertexShader:Ue.depth_vert,fragmentShader:Ue.depth_frag},normal:{uniforms:St([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,{opacity:{value:1}}]),vertexShader:Ue.meshnormal_vert,fragmentShader:Ue.meshnormal_frag},sprite:{uniforms:St([ne.sprite,ne.fog]),vertexShader:Ue.sprite_vert,fragmentShader:Ue.sprite_frag},background:{uniforms:{uvTransform:{value:new De},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ue.background_vert,fragmentShader:Ue.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new De}},vertexShader:Ue.backgroundCube_vert,fragmentShader:Ue.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ue.cube_vert,fragmentShader:Ue.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ue.equirect_vert,fragmentShader:Ue.equirect_frag},distanceRGBA:{uniforms:St([ne.common,ne.displacementmap,{referencePosition:{value:new z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ue.distanceRGBA_vert,fragmentShader:Ue.distanceRGBA_frag},shadow:{uniforms:St([ne.lights,ne.fog,{color:{value:new Oe(0)},opacity:{value:1}}]),vertexShader:Ue.shadow_vert,fragmentShader:Ue.shadow_frag}};Kt.physical={uniforms:St([Kt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new De},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new De},clearcoatNormalScale:{value:new we(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new De},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new De},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new De},sheen:{value:0},sheenColor:{value:new Oe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new De},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new De},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new De},transmissionSamplerSize:{value:new we},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new De},attenuationDistance:{value:0},attenuationColor:{value:new Oe(0)},specularColor:{value:new Oe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new De},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new De},anisotropyVector:{value:new we},anisotropyMap:{value:null},anisotropyMapTransform:{value:new De}}]),vertexShader:Ue.meshphysical_vert,fragmentShader:Ue.meshphysical_frag};const gr={r:0,b:0,g:0},Bn=new mn,tm=new je;function nm(t,e,n,i,r,s,a){const o=new Oe(0);let c=s===!0?0:1,l,h,f=null,d=0,u=null;function g(T){let y=T.isScene===!0?T.background:null;return y&&y.isTexture&&(y=(T.backgroundBlurriness>0?n:e).get(y)),y}function _(T){let y=!1;const v=g(T);v===null?m(o,c):v&&v.isColor&&(m(v,1),y=!0);const P=t.xr.getEnvironmentBlendMode();P==="additive"?i.buffers.color.setClear(0,0,0,1,a):P==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(t.autoClear||y)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function p(T,y){const v=g(y);v&&(v.isCubeTexture||v.mapping===Vr)?(h===void 0&&(h=new Rt(new Kn(1,1,1),new Yt({name:"BackgroundCubeMaterial",uniforms:Ai(Kt.backgroundCube.uniforms),vertexShader:Kt.backgroundCube.vertexShader,fragmentShader:Kt.backgroundCube.fragmentShader,side:Ct,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,b,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Bn.copy(y.backgroundRotation),Bn.x*=-1,Bn.y*=-1,Bn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Bn.y*=-1,Bn.z*=-1),h.material.uniforms.envMap.value=v,h.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(tm.makeRotationFromEuler(Bn)),h.material.toneMapped=Ge.getTransfer(v.colorSpace)!==Ze,(f!==v||d!==v.version||u!==t.toneMapping)&&(h.material.needsUpdate=!0,f=v,d=v.version,u=t.toneMapping),h.layers.enableAll(),T.unshift(h,h.geometry,h.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new Rt(new Wr(2,2),new Yt({name:"BackgroundMaterial",uniforms:Ai(Kt.background.uniforms),vertexShader:Kt.background.vertexShader,fragmentShader:Kt.background.fragmentShader,side:Dn,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=v,l.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,l.material.toneMapped=Ge.getTransfer(v.colorSpace)!==Ze,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(f!==v||d!==v.version||u!==t.toneMapping)&&(l.material.needsUpdate=!0,f=v,d=v.version,u=t.toneMapping),l.layers.enableAll(),T.unshift(l,l.geometry,l.material,0,0,null))}function m(T,y){T.getRGB(gr,Wc(t)),i.buffers.color.setClear(gr.r,gr.g,gr.b,y,a)}return{getClearColor:function(){return o},setClearColor:function(T,y=1){o.set(T),c=y,m(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(T){c=T,m(o,c)},render:_,addToRenderList:p}}function im(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=d(null);let s=r,a=!1;function o(x,C,L,D,U){let X=!1;const V=f(D,L,C);s!==V&&(s=V,l(s.object)),X=u(x,D,L,U),X&&g(x,D,L,U),U!==null&&e.update(U,t.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,v(x,C,L,D),U!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(U).buffer))}function c(){return t.createVertexArray()}function l(x){return t.bindVertexArray(x)}function h(x){return t.deleteVertexArray(x)}function f(x,C,L){const D=L.wireframe===!0;let U=i[x.id];U===void 0&&(U={},i[x.id]=U);let X=U[C.id];X===void 0&&(X={},U[C.id]=X);let V=X[D];return V===void 0&&(V=d(c()),X[D]=V),V}function d(x){const C=[],L=[],D=[];for(let U=0;U<n;U++)C[U]=0,L[U]=0,D[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:C,enabledAttributes:L,attributeDivisors:D,object:x,attributes:{},index:null}}function u(x,C,L,D){const U=s.attributes,X=C.attributes;let V=0;const K=L.getAttributes();for(const G in K)if(K[G].location>=0){const ie=U[G];let ve=X[G];if(ve===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(ve=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(ve=x.instanceColor)),ie===void 0||ie.attribute!==ve||ve&&ie.data!==ve.data)return!0;V++}return s.attributesNum!==V||s.index!==D}function g(x,C,L,D){const U={},X=C.attributes;let V=0;const K=L.getAttributes();for(const G in K)if(K[G].location>=0){let ie=X[G];ie===void 0&&(G==="instanceMatrix"&&x.instanceMatrix&&(ie=x.instanceMatrix),G==="instanceColor"&&x.instanceColor&&(ie=x.instanceColor));const ve={};ve.attribute=ie,ie&&ie.data&&(ve.data=ie.data),U[G]=ve,V++}s.attributes=U,s.attributesNum=V,s.index=D}function _(){const x=s.newAttributes;for(let C=0,L=x.length;C<L;C++)x[C]=0}function p(x){m(x,0)}function m(x,C){const L=s.newAttributes,D=s.enabledAttributes,U=s.attributeDivisors;L[x]=1,D[x]===0&&(t.enableVertexAttribArray(x),D[x]=1),U[x]!==C&&(t.vertexAttribDivisor(x,C),U[x]=C)}function T(){const x=s.newAttributes,C=s.enabledAttributes;for(let L=0,D=C.length;L<D;L++)C[L]!==x[L]&&(t.disableVertexAttribArray(L),C[L]=0)}function y(x,C,L,D,U,X,V){V===!0?t.vertexAttribIPointer(x,C,L,U,X):t.vertexAttribPointer(x,C,L,D,U,X)}function v(x,C,L,D){_();const U=D.attributes,X=L.getAttributes(),V=C.defaultAttributeValues;for(const K in X){const G=X[K];if(G.location>=0){let te=U[K];if(te===void 0&&(K==="instanceMatrix"&&x.instanceMatrix&&(te=x.instanceMatrix),K==="instanceColor"&&x.instanceColor&&(te=x.instanceColor)),te!==void 0){const ie=te.normalized,ve=te.itemSize,Le=e.get(te);if(Le===void 0)continue;const Xe=Le.buffer,q=Le.type,Q=Le.bytesPerElement,he=q===t.INT||q===t.UNSIGNED_INT||te.gpuType===ya;if(te.isInterleavedBufferAttribute){const re=te.data,Se=re.stride,Re=te.offset;if(re.isInstancedInterleavedBuffer){for(let Fe=0;Fe<G.locationSize;Fe++)m(G.location+Fe,re.meshPerAttribute);x.isInstancedMesh!==!0&&D._maxInstanceCount===void 0&&(D._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Fe=0;Fe<G.locationSize;Fe++)p(G.location+Fe);t.bindBuffer(t.ARRAY_BUFFER,Xe);for(let Fe=0;Fe<G.locationSize;Fe++)y(G.location+Fe,ve/G.locationSize,q,ie,Se*Q,(Re+ve/G.locationSize*Fe)*Q,he)}else{if(te.isInstancedBufferAttribute){for(let re=0;re<G.locationSize;re++)m(G.location+re,te.meshPerAttribute);x.isInstancedMesh!==!0&&D._maxInstanceCount===void 0&&(D._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let re=0;re<G.locationSize;re++)p(G.location+re);t.bindBuffer(t.ARRAY_BUFFER,Xe);for(let re=0;re<G.locationSize;re++)y(G.location+re,ve/G.locationSize,q,ie,ve*Q,ve/G.locationSize*re*Q,he)}}else if(V!==void 0){const ie=V[K];if(ie!==void 0)switch(ie.length){case 2:t.vertexAttrib2fv(G.location,ie);break;case 3:t.vertexAttrib3fv(G.location,ie);break;case 4:t.vertexAttrib4fv(G.location,ie);break;default:t.vertexAttrib1fv(G.location,ie)}}}}T()}function P(){R();for(const x in i){const C=i[x];for(const L in C){const D=C[L];for(const U in D)h(D[U].object),delete D[U];delete C[L]}delete i[x]}}function b(x){if(i[x.id]===void 0)return;const C=i[x.id];for(const L in C){const D=C[L];for(const U in D)h(D[U].object),delete D[U];delete C[L]}delete i[x.id]}function w(x){for(const C in i){const L=i[C];if(L[x.id]===void 0)continue;const D=L[x.id];for(const U in D)h(D[U].object),delete D[U];delete L[x.id]}}function R(){S(),a=!0,s!==r&&(s=r,l(s.object))}function S(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:R,resetDefaultState:S,dispose:P,releaseStatesOfGeometry:b,releaseStatesOfProgram:w,initAttributes:_,enableAttribute:p,disableUnusedAttributes:T}}function rm(t,e,n){let i;function r(l){i=l}function s(l,h){t.drawArrays(i,l,h),n.update(h,i,1)}function a(l,h,f){f!==0&&(t.drawArraysInstanced(i,l,h,f),n.update(h,i,f))}function o(l,h,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,h,0,f);let u=0;for(let g=0;g<f;g++)u+=h[g];n.update(u,i,1)}function c(l,h,f,d){if(f===0)return;const u=e.get("WEBGL_multi_draw");if(u===null)for(let g=0;g<l.length;g++)a(l[g],h[g],d[g]);else{u.multiDrawArraysInstancedWEBGL(i,l,0,h,0,d,0,f);let g=0;for(let _=0;_<f;_++)g+=h[_]*d[_];n.update(g,i,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function sm(t,e,n,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const w=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(w.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(w){return!(w!==qt&&i.convert(w)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(w){const R=w===$i&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(w!==pn&&i.convert(w)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&w!==en&&!R)}function c(w){if(w==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=n.precision!==void 0?n.precision:"highp";const h=c(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const f=n.logarithmicDepthBuffer===!0,d=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),g=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),y=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),P=g>0,b=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:f,reverseDepthBuffer:d,maxTextures:u,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:T,maxVaryings:y,maxFragmentUniforms:v,vertexTextures:P,maxSamples:b}}function am(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new fn,o=new De,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){const u=f.length!==0||d||i!==0||r;return r=d,i=f.length,u},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){n=h(f,d,0)},this.setState=function(f,d,u){const g=f.clippingPlanes,_=f.clipIntersection,p=f.clipShadows,m=t.get(f);if(!r||g===null||g.length===0||s&&!p)s?h(null):l();else{const T=s?0:i,y=T*4;let v=m.clippingState||null;c.value=v,v=h(g,d,y,u);for(let P=0;P!==y;++P)v[P]=n[P];m.clippingState=v,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=T}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(f,d,u,g){const _=f!==null?f.length:0;let p=null;if(_!==0){if(p=c.value,g!==!0||p===null){const m=u+_*4,T=d.matrixWorldInverse;o.getNormalMatrix(T),(p===null||p.length<m)&&(p=new Float32Array(m));for(let y=0,v=u;y!==_;++y,v+=4)a.copy(f[y]).applyMatrix4(T,o),a.normal.toArray(p,v),p[v+3]=a.constant}c.value=p,c.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,p}}function om(t){let e=new WeakMap;function n(a,o){return o===zs?a.mapping=Si:o===Bs&&(a.mapping=Ei),a}function i(a){if(a&&a.isTexture){const o=a.mapping;if(o===zs||o===Bs)if(e.has(a)){const c=e.get(a).texture;return n(c,a.mapping)}else{const c=a.image;if(c&&c.height>0){const l=new vd(c.height);return l.fromEquirectangularTexture(t,a),e.set(a,l),a.addEventListener("dispose",r),n(l.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Yc extends Xc{constructor(e=-1,n=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=n,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,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=n,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(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+n,c=r-n;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const mi=4,wo=[.125,.215,.35,.446,.526,.582],Gn=20,vs=new Yc,Ro=new Oe;let xs=null,Ms=0,ys=0,Ss=!1;const kn=(1+Math.sqrt(5))/2,di=1/kn,Co=[new z(-kn,di,0),new z(kn,di,0),new z(-di,0,kn),new z(di,0,kn),new z(0,kn,-di),new z(0,kn,di),new z(-1,1,-1),new z(1,1,-1),new z(-1,1,1),new z(1,1,1)];class Po{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,i=.1,r=100){xs=this._renderer.getRenderTarget(),Ms=this._renderer.getActiveCubeFace(),ys=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Io(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Lo(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(xs,Ms,ys),this._renderer.xr.enabled=Ss,e.scissorTest=!1,_r(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Si||e.mapping===Ei?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),xs=this._renderer.getRenderTarget(),Ms=this._renderer.getActiveCubeFace(),ys=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:Qt,minFilter:Qt,generateMipmaps:!1,type:$i,format:qt,colorSpace:Ri,depthBuffer:!1},r=Do(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Do(e,n,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=cm(s)),this._blurMaterial=lm(s,e,n)}return r}_compileMaterial(e){const n=new Rt(this._lodPlanes[0],e);this._renderer.compile(n,vs)}_sceneToCubeUV(e,n,i,r){const o=new zt(90,1,n,i),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,f=h.autoClear,d=h.toneMapping;h.getClearColor(Ro),h.toneMapping=Pn,h.autoClear=!1;const u=new Pi({name:"PMREM.Background",side:Ct,depthWrite:!1,depthTest:!1}),g=new Rt(new Kn,u);let _=!1;const p=e.background;p?p.isColor&&(u.color.copy(p),e.background=null,_=!0):(u.color.copy(Ro),_=!0);for(let m=0;m<6;m++){const T=m%3;T===0?(o.up.set(0,c[m],0),o.lookAt(l[m],0,0)):T===1?(o.up.set(0,0,c[m]),o.lookAt(0,l[m],0)):(o.up.set(0,c[m],0),o.lookAt(0,0,l[m]));const y=this._cubeSize;_r(r,T*y,m>2?y:0,y,y),h.setRenderTarget(r),_&&h.render(g,o),h.render(e,o)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=d,h.autoClear=f,e.background=p}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===Si||e.mapping===Ei;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Io()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Lo());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Rt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;_r(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(a,vs)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s<r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Co[(r-s-1)%Co.length];this._blur(e,s-1,s,a,o)}n.autoClear=i}_blur(e,n,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,n,i,r,s,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,f=new Rt(this._lodPlanes[r],l),d=l.uniforms,u=this._sizeLods[i]-1,g=isFinite(s)?Math.PI/(2*u):2*Math.PI/(2*Gn-1),_=s/g,p=isFinite(s)?1+Math.floor(h*_):Gn;p>Gn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Gn}`);const m=[];let T=0;for(let w=0;w<Gn;++w){const R=w/_,S=Math.exp(-R*R/2);m.push(S),w===0?T+=S:w<p&&(T+=2*S)}for(let w=0;w<m.length;w++)m[w]=m[w]/T;d.envMap.value=e.texture,d.samples.value=p,d.weights.value=m,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:y}=this;d.dTheta.value=g,d.mipInt.value=y-i;const v=this._sizeLods[r],P=3*v*(r>y-mi?r-y+mi:0),b=4*(this._cubeSize-v);_r(n,P,b,3*v,2*v),c.setRenderTarget(n),c.render(f,vs)}}function cm(t){const e=[],n=[],i=[];let r=t;const s=t-mi+1+wo.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);n.push(o);let c=1/o;a>t-mi?c=wo[a-t+mi-1]:a===0&&(c=0),i.push(c);const l=1/(o-2),h=-l,f=1+l,d=[h,h,f,h,f,f,h,h,f,f,h,f],u=6,g=6,_=3,p=2,m=1,T=new Float32Array(_*g*u),y=new Float32Array(p*g*u),v=new Float32Array(m*g*u);for(let b=0;b<u;b++){const w=b%3*2/3-1,R=b>2?0:-1,S=[w,R,0,w+2/3,R,0,w+2/3,R+1,0,w,R,0,w+2/3,R+1,0,w,R+1,0];T.set(S,_*g*b),y.set(d,p*g*b);const x=[b,b,b,b,b,b];v.set(x,m*g*b)}const P=new pt;P.setAttribute("position",new Bt(T,_)),P.setAttribute("uv",new Bt(y,p)),P.setAttribute("faceIndex",new Bt(v,m)),e.push(P),r>mi&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function Do(t,e,n){const i=new $n(t,e,n);return i.texture.mapping=Vr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function _r(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function lm(t,e,n){const i=new Float32Array(Gn),r=new z(0,1,0);return new Yt({name:"SphericalGaussianBlur",defines:{n:Gn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Pa(),fragmentShader:`
|
|
3576
3576
|
|
|
3577
3577
|
precision mediump float;
|
|
3578
3578
|
precision mediump int;
|
|
@@ -3722,17 +3722,17 @@ void main() {
|
|
|
3722
3722
|
gl_Position = vec4( position, 1.0 );
|
|
3723
3723
|
|
|
3724
3724
|
}
|
|
3725
|
-
`}function f0(t){let e=new WeakMap,n=null;function i(o){if(o&&o.isTexture){const c=o.mapping,l=c===zs||c===Bs,h=c===Si||c===Ei;if(l||h){let f=e.get(o);const d=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return n===null&&(n=new Po(t)),f=l?n.fromEquirectangular(o,f):n.fromCubemap(o,f),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),f.texture;if(f!==void 0)return f.texture;{const u=o.image;return l&&u&&u.height>0||h&&u&&r(u)?(n===null&&(n=new Po(t)),f=l?n.fromEquirectangular(o):n.fromCubemap(o),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),o.addEventListener("dispose",s),f.texture):null}}}return o}function r(o){let c=0;const l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function s(o){const c=o.target;c.removeEventListener("dispose",s);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:a}}function d0(t){const e={};function n(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(i)}return e[i]=r,r}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const r=n(i);return r===null&&Vi("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function u0(t,e,n,i){const r={},s=new WeakMap;function a(f){const d=f.target;d.index!==null&&e.remove(d.index);for(const g in d.attributes)e.remove(d.attributes[g]);for(const g in d.morphAttributes){const _=d.morphAttributes[g];for(let p=0,m=_.length;p<m;p++)e.remove(_[p])}d.removeEventListener("dispose",a),delete r[d.id];const u=s.get(d);u&&(e.remove(u),s.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,n.memory.geometries--}function o(f,d){return r[d.id]===!0||(d.addEventListener("dispose",a),r[d.id]=!0,n.memory.geometries++),d}function c(f){const d=f.attributes;for(const g in d)e.update(d[g],t.ARRAY_BUFFER);const u=f.morphAttributes;for(const g in u){const _=u[g];for(let p=0,m=_.length;p<m;p++)e.update(_[p],t.ARRAY_BUFFER)}}function l(f){const d=[],u=f.index,g=f.attributes.position;let _=0;if(u!==null){const T=u.array;_=u.version;for(let y=0,v=T.length;y<v;y+=3){const P=T[y+0],b=T[y+1],w=T[y+2];d.push(P,b,b,w,w,P)}}else if(g!==void 0){const T=g.array;_=g.version;for(let y=0,v=T.length/3-1;y<v;y+=3){const P=y+0,b=y+1,w=y+2;d.push(P,b,b,w,w,P)}}else return;const p=new(Oc(d)?Gc:kc)(d,1);p.version=_;const m=s.get(f);m&&e.remove(m),s.set(f,p)}function h(f){const d=s.get(f);if(d){const u=f.index;u!==null&&d.version<u.version&&l(f)}else l(f);return s.get(f)}return{get:o,update:c,getWireframeAttribute:h}}function p0(t,e,n){let i;function r(d){i=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function c(d,u){t.drawElements(i,u,s,d*a),n.update(u,i,1)}function l(d,u,g){g!==0&&(t.drawElementsInstanced(i,u,s,d*a,g),n.update(u,i,g))}function h(d,u,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,u,0,s,d,0,g);let p=0;for(let m=0;m<g;m++)p+=u[m];n.update(p,i,1)}function f(d,u,g,_){if(g===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<d.length;m++)l(d[m]/a,u[m],_[m]);else{p.multiDrawElementsInstancedWEBGL(i,u,0,s,d,0,_,0,g);let m=0;for(let T=0;T<g;T++)m+=u[T]*_[T];n.update(m,i,1)}}this.setMode=r,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=f}function m0(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(n.calls++,a){case t.TRIANGLES:n.triangles+=o*(s/3);break;case t.LINES:n.lines+=o*(s/2);break;case t.LINE_STRIP:n.lines+=o*(s-1);break;case t.LINE_LOOP:n.lines+=o*s;break;case t.POINTS:n.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:r,update:i}}function g0(t,e,n){const i=new WeakMap,r=new st;function s(a,o,c){const l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=h!==void 0?h.length:0;let d=i.get(o);if(d===void 0||d.count!==f){let S=function(){w.dispose(),i.delete(o),o.removeEventListener("dispose",S)};d!==void 0&&d.texture.dispose();const u=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],T=o.morphAttributes.color||[];let y=0;u===!0&&(y=1),g===!0&&(y=2),_===!0&&(y=3);let v=o.attributes.position.count*y,P=1;v>e.maxTextureSize&&(P=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const b=new Float32Array(v*P*4*f),w=new Bc(b,v,P,f);w.type=en,w.needsUpdate=!0;const R=y*4;for(let x=0;x<f;x++){const C=p[x],L=m[x],D=T[x],U=v*P*4*x;for(let X=0;X<C.count;X++){const V=X*R;u===!0&&(r.fromBufferAttribute(C,X),b[U+V+0]=r.x,b[U+V+1]=r.y,b[U+V+2]=r.z,b[U+V+3]=0),g===!0&&(r.fromBufferAttribute(L,X),b[U+V+4]=r.x,b[U+V+5]=r.y,b[U+V+6]=r.z,b[U+V+7]=0),_===!0&&(r.fromBufferAttribute(D,X),b[U+V+8]=r.x,b[U+V+9]=r.y,b[U+V+10]=r.z,b[U+V+11]=D.itemSize===4?r.w:1)}}d={count:f,texture:w,size:new we(v,P)},i.set(o,d),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let u=0;for(let _=0;_<l.length;_++)u+=l[_];const g=o.morphTargetsRelative?1:1-u;c.getUniforms().setValue(t,"morphTargetBaseInfluence",g),c.getUniforms().setValue(t,"morphTargetInfluences",l)}c.getUniforms().setValue(t,"morphTargetsTexture",d.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",d.size)}return{update:s}}function _0(t,e,n,i){let r=new WeakMap;function s(c){const l=i.render.frame,h=c.geometry,f=e.get(c,h);if(r.get(f)!==l&&(e.update(f),r.set(f,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),r.get(c)!==l&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),r.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;r.get(d)!==l&&(d.update(),r.set(d,l))}return f}function a(){r=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),n.remove(l.instanceMatrix),l.instanceColor!==null&&n.remove(l.instanceColor)}return{update:s,dispose:a}}class jc extends Mt{constructor(e,n,i,r,s,a,o,c,l,h=xi){if(h!==xi&&h!==bi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===xi&&(i=qn),i===void 0&&h===bi&&(i=Ti),super(null,r,s,a,o,c,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=o!==void 0?o:It,this.minFilter=c!==void 0?c:It,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}const Zc=new Mt,Uo=new jc(1,1),Kc=new Bc,Jc=new id,Qc=new qc,No=[],Fo=[],Oo=new Float32Array(16),zo=new Float32Array(9),Bo=new Float32Array(4);function Di(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=No[r];if(s===void 0&&(s=new Float32Array(r),No[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function ht(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function ft(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Xr(t,e){let n=Fo[e];n===void 0&&(n=new Int32Array(e),Fo[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function v0(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function x0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ht(n,e))return;t.uniform2fv(this.addr,e),ft(n,e)}}function M0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ht(n,e))return;t.uniform3fv(this.addr,e),ft(n,e)}}function y0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ht(n,e))return;t.uniform4fv(this.addr,e),ft(n,e)}}function S0(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ht(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ft(n,e)}else{if(ht(n,i))return;Bo.set(i),t.uniformMatrix2fv(this.addr,!1,Bo),ft(n,i)}}function E0(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ht(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ft(n,e)}else{if(ht(n,i))return;zo.set(i),t.uniformMatrix3fv(this.addr,!1,zo),ft(n,i)}}function T0(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ht(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ft(n,e)}else{if(ht(n,i))return;Oo.set(i),t.uniformMatrix4fv(this.addr,!1,Oo),ft(n,i)}}function b0(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function A0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ht(n,e))return;t.uniform2iv(this.addr,e),ft(n,e)}}function w0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ht(n,e))return;t.uniform3iv(this.addr,e),ft(n,e)}}function R0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ht(n,e))return;t.uniform4iv(this.addr,e),ft(n,e)}}function C0(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function P0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ht(n,e))return;t.uniform2uiv(this.addr,e),ft(n,e)}}function D0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ht(n,e))return;t.uniform3uiv(this.addr,e),ft(n,e)}}function L0(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ht(n,e))return;t.uniform4uiv(this.addr,e),ft(n,e)}}function I0(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r);let s;this.type===t.SAMPLER_2D_SHADOW?(Uo.compareFunction=Fc,s=Uo):s=Zc,n.setTexture2D(e||s,r)}function U0(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||Jc,r)}function N0(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||Qc,r)}function F0(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Kc,r)}function O0(t){switch(t){case 5126:return v0;case 35664:return x0;case 35665:return M0;case 35666:return y0;case 35674:return S0;case 35675:return E0;case 35676:return T0;case 5124:case 35670:return b0;case 35667:case 35671:return A0;case 35668:case 35672:return w0;case 35669:case 35673:return R0;case 5125:return C0;case 36294:return P0;case 36295:return D0;case 36296:return L0;case 35678:case 36198:case 36298:case 36306:case 35682:return I0;case 35679:case 36299:case 36307:return U0;case 35680:case 36300:case 36308:case 36293:return N0;case 36289:case 36303:case 36311:case 36292:return F0}}function z0(t,e){t.uniform1fv(this.addr,e)}function B0(t,e){const n=Di(e,this.size,2);t.uniform2fv(this.addr,n)}function H0(t,e){const n=Di(e,this.size,3);t.uniform3fv(this.addr,n)}function k0(t,e){const n=Di(e,this.size,4);t.uniform4fv(this.addr,n)}function V0(t,e){const n=Di(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function G0(t,e){const n=Di(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function W0(t,e){const n=Di(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function X0(t,e){t.uniform1iv(this.addr,e)}function q0(t,e){t.uniform2iv(this.addr,e)}function $0(t,e){t.uniform3iv(this.addr,e)}function Y0(t,e){t.uniform4iv(this.addr,e)}function j0(t,e){t.uniform1uiv(this.addr,e)}function Z0(t,e){t.uniform2uiv(this.addr,e)}function K0(t,e){t.uniform3uiv(this.addr,e)}function J0(t,e){t.uniform4uiv(this.addr,e)}function Q0(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTexture2D(e[a]||Zc,s[a])}function em(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTexture3D(e[a]||Jc,s[a])}function tm(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTextureCube(e[a]||Qc,s[a])}function nm(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTexture2DArray(e[a]||Kc,s[a])}function im(t){switch(t){case 5126:return z0;case 35664:return B0;case 35665:return H0;case 35666:return k0;case 35674:return V0;case 35675:return G0;case 35676:return W0;case 5124:case 35670:return X0;case 35667:case 35671:return q0;case 35668:case 35672:return $0;case 35669:case 35673:return Y0;case 5125:return j0;case 36294:return Z0;case 36295:return K0;case 36296:return J0;case 35678:case 36198:case 36298:case 36306:case 35682:return Q0;case 35679:case 36299:case 36307:return em;case 35680:case 36300:case 36308:case 36293:return tm;case 36289:case 36303:case 36311:case 36292:return nm}}class rm{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=O0(n.type)}}class sm{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=im(n.type)}}class am{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,n[o.id],i)}}}const Es=/(\w+)(\])?(\[|\.)?/g;function Ho(t,e){t.seq.push(e),t.map[e.id]=e}function om(t,e,n){const i=t.name,r=i.length;for(Es.lastIndex=0;;){const s=Es.exec(i),a=Es.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===r){Ho(n,l===void 0?new rm(o,t,e):new sm(o,t,e));break}else{let f=n.map[o];f===void 0&&(f=new am(o),Ho(n,f)),n=f}}}class Lr{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(n,r),a=e.getUniformLocation(n,s.name);om(s,a,this)}}setValue(e,n,i,r){const s=this.map[n];s!==void 0&&s.setValue(e,i,r)}setOptional(e,n,i){const r=n[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,n,i,r){for(let s=0,a=n.length;s!==a;++s){const o=n[s],c=i[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,r)}}static seqWithValue(e,n){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in n&&i.push(a)}return i}}function ko(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const cm=37297;let lm=0;function hm(t,e){const n=t.split(`
|
|
3725
|
+
`}function hm(t){let e=new WeakMap,n=null;function i(o){if(o&&o.isTexture){const c=o.mapping,l=c===zs||c===Bs,h=c===Si||c===Ei;if(l||h){let f=e.get(o);const d=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return n===null&&(n=new Po(t)),f=l?n.fromEquirectangular(o,f):n.fromCubemap(o,f),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),f.texture;if(f!==void 0)return f.texture;{const u=o.image;return l&&u&&u.height>0||h&&u&&r(u)?(n===null&&(n=new Po(t)),f=l?n.fromEquirectangular(o):n.fromCubemap(o),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),o.addEventListener("dispose",s),f.texture):null}}}return o}function r(o){let c=0;const l=6;for(let h=0;h<l;h++)o[h]!==void 0&&c++;return c===l}function s(o){const c=o.target;c.removeEventListener("dispose",s);const l=e.get(c);l!==void 0&&(e.delete(c),l.dispose())}function a(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:a}}function fm(t){const e={};function n(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(i)}return e[i]=r,r}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const r=n(i);return r===null&&Vi("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function dm(t,e,n,i){const r={},s=new WeakMap;function a(f){const d=f.target;d.index!==null&&e.remove(d.index);for(const g in d.attributes)e.remove(d.attributes[g]);for(const g in d.morphAttributes){const _=d.morphAttributes[g];for(let p=0,m=_.length;p<m;p++)e.remove(_[p])}d.removeEventListener("dispose",a),delete r[d.id];const u=s.get(d);u&&(e.remove(u),s.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,n.memory.geometries--}function o(f,d){return r[d.id]===!0||(d.addEventListener("dispose",a),r[d.id]=!0,n.memory.geometries++),d}function c(f){const d=f.attributes;for(const g in d)e.update(d[g],t.ARRAY_BUFFER);const u=f.morphAttributes;for(const g in u){const _=u[g];for(let p=0,m=_.length;p<m;p++)e.update(_[p],t.ARRAY_BUFFER)}}function l(f){const d=[],u=f.index,g=f.attributes.position;let _=0;if(u!==null){const T=u.array;_=u.version;for(let y=0,v=T.length;y<v;y+=3){const P=T[y+0],b=T[y+1],w=T[y+2];d.push(P,b,b,w,w,P)}}else if(g!==void 0){const T=g.array;_=g.version;for(let y=0,v=T.length/3-1;y<v;y+=3){const P=y+0,b=y+1,w=y+2;d.push(P,b,b,w,w,P)}}else return;const p=new(Oc(d)?Gc:kc)(d,1);p.version=_;const m=s.get(f);m&&e.remove(m),s.set(f,p)}function h(f){const d=s.get(f);if(d){const u=f.index;u!==null&&d.version<u.version&&l(f)}else l(f);return s.get(f)}return{get:o,update:c,getWireframeAttribute:h}}function um(t,e,n){let i;function r(d){i=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function c(d,u){t.drawElements(i,u,s,d*a),n.update(u,i,1)}function l(d,u,g){g!==0&&(t.drawElementsInstanced(i,u,s,d*a,g),n.update(u,i,g))}function h(d,u,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,u,0,s,d,0,g);let p=0;for(let m=0;m<g;m++)p+=u[m];n.update(p,i,1)}function f(d,u,g,_){if(g===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<d.length;m++)l(d[m]/a,u[m],_[m]);else{p.multiDrawElementsInstancedWEBGL(i,u,0,s,d,0,_,0,g);let m=0;for(let T=0;T<g;T++)m+=u[T]*_[T];n.update(m,i,1)}}this.setMode=r,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=f}function pm(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(n.calls++,a){case t.TRIANGLES:n.triangles+=o*(s/3);break;case t.LINES:n.lines+=o*(s/2);break;case t.LINE_STRIP:n.lines+=o*(s-1);break;case t.LINE_LOOP:n.lines+=o*s;break;case t.POINTS:n.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:r,update:i}}function mm(t,e,n){const i=new WeakMap,r=new st;function s(a,o,c){const l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=h!==void 0?h.length:0;let d=i.get(o);if(d===void 0||d.count!==f){let S=function(){w.dispose(),i.delete(o),o.removeEventListener("dispose",S)};d!==void 0&&d.texture.dispose();const u=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,p=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],T=o.morphAttributes.color||[];let y=0;u===!0&&(y=1),g===!0&&(y=2),_===!0&&(y=3);let v=o.attributes.position.count*y,P=1;v>e.maxTextureSize&&(P=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const b=new Float32Array(v*P*4*f),w=new Bc(b,v,P,f);w.type=en,w.needsUpdate=!0;const R=y*4;for(let x=0;x<f;x++){const C=p[x],L=m[x],D=T[x],U=v*P*4*x;for(let X=0;X<C.count;X++){const V=X*R;u===!0&&(r.fromBufferAttribute(C,X),b[U+V+0]=r.x,b[U+V+1]=r.y,b[U+V+2]=r.z,b[U+V+3]=0),g===!0&&(r.fromBufferAttribute(L,X),b[U+V+4]=r.x,b[U+V+5]=r.y,b[U+V+6]=r.z,b[U+V+7]=0),_===!0&&(r.fromBufferAttribute(D,X),b[U+V+8]=r.x,b[U+V+9]=r.y,b[U+V+10]=r.z,b[U+V+11]=D.itemSize===4?r.w:1)}}d={count:f,texture:w,size:new we(v,P)},i.set(o,d),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let u=0;for(let _=0;_<l.length;_++)u+=l[_];const g=o.morphTargetsRelative?1:1-u;c.getUniforms().setValue(t,"morphTargetBaseInfluence",g),c.getUniforms().setValue(t,"morphTargetInfluences",l)}c.getUniforms().setValue(t,"morphTargetsTexture",d.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",d.size)}return{update:s}}function gm(t,e,n,i){let r=new WeakMap;function s(c){const l=i.render.frame,h=c.geometry,f=e.get(c,h);if(r.get(f)!==l&&(e.update(f),r.set(f,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",o)===!1&&c.addEventListener("dispose",o),r.get(c)!==l&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),r.set(c,l))),c.isSkinnedMesh){const d=c.skeleton;r.get(d)!==l&&(d.update(),r.set(d,l))}return f}function a(){r=new WeakMap}function o(c){const l=c.target;l.removeEventListener("dispose",o),n.remove(l.instanceMatrix),l.instanceColor!==null&&n.remove(l.instanceColor)}return{update:s,dispose:a}}class jc extends Mt{constructor(e,n,i,r,s,a,o,c,l,h=xi){if(h!==xi&&h!==bi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===xi&&(i=qn),i===void 0&&h===bi&&(i=Ti),super(null,r,s,a,o,c,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=o!==void 0?o:It,this.minFilter=c!==void 0?c:It,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}const Zc=new Mt,Uo=new jc(1,1),Kc=new Bc,Jc=new nd,Qc=new qc,No=[],Fo=[],Oo=new Float32Array(16),zo=new Float32Array(9),Bo=new Float32Array(4);function Di(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=No[r];if(s===void 0&&(s=new Float32Array(r),No[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function ht(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function ft(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Xr(t,e){let n=Fo[e];n===void 0&&(n=new Int32Array(e),Fo[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function _m(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function vm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ht(n,e))return;t.uniform2fv(this.addr,e),ft(n,e)}}function xm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ht(n,e))return;t.uniform3fv(this.addr,e),ft(n,e)}}function Mm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ht(n,e))return;t.uniform4fv(this.addr,e),ft(n,e)}}function ym(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ht(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ft(n,e)}else{if(ht(n,i))return;Bo.set(i),t.uniformMatrix2fv(this.addr,!1,Bo),ft(n,i)}}function Sm(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ht(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ft(n,e)}else{if(ht(n,i))return;zo.set(i),t.uniformMatrix3fv(this.addr,!1,zo),ft(n,i)}}function Em(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ht(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ft(n,e)}else{if(ht(n,i))return;Oo.set(i),t.uniformMatrix4fv(this.addr,!1,Oo),ft(n,i)}}function Tm(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function bm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ht(n,e))return;t.uniform2iv(this.addr,e),ft(n,e)}}function Am(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ht(n,e))return;t.uniform3iv(this.addr,e),ft(n,e)}}function wm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ht(n,e))return;t.uniform4iv(this.addr,e),ft(n,e)}}function Rm(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Cm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ht(n,e))return;t.uniform2uiv(this.addr,e),ft(n,e)}}function Pm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ht(n,e))return;t.uniform3uiv(this.addr,e),ft(n,e)}}function Dm(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ht(n,e))return;t.uniform4uiv(this.addr,e),ft(n,e)}}function Lm(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r);let s;this.type===t.SAMPLER_2D_SHADOW?(Uo.compareFunction=Fc,s=Uo):s=Zc,n.setTexture2D(e||s,r)}function Im(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||Jc,r)}function Um(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||Qc,r)}function Nm(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Kc,r)}function Fm(t){switch(t){case 5126:return _m;case 35664:return vm;case 35665:return xm;case 35666:return Mm;case 35674:return ym;case 35675:return Sm;case 35676:return Em;case 5124:case 35670:return Tm;case 35667:case 35671:return bm;case 35668:case 35672:return Am;case 35669:case 35673:return wm;case 5125:return Rm;case 36294:return Cm;case 36295:return Pm;case 36296:return Dm;case 35678:case 36198:case 36298:case 36306:case 35682:return Lm;case 35679:case 36299:case 36307:return Im;case 35680:case 36300:case 36308:case 36293:return Um;case 36289:case 36303:case 36311:case 36292:return Nm}}function Om(t,e){t.uniform1fv(this.addr,e)}function zm(t,e){const n=Di(e,this.size,2);t.uniform2fv(this.addr,n)}function Bm(t,e){const n=Di(e,this.size,3);t.uniform3fv(this.addr,n)}function Hm(t,e){const n=Di(e,this.size,4);t.uniform4fv(this.addr,n)}function km(t,e){const n=Di(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Vm(t,e){const n=Di(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Gm(t,e){const n=Di(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Wm(t,e){t.uniform1iv(this.addr,e)}function Xm(t,e){t.uniform2iv(this.addr,e)}function qm(t,e){t.uniform3iv(this.addr,e)}function $m(t,e){t.uniform4iv(this.addr,e)}function Ym(t,e){t.uniform1uiv(this.addr,e)}function jm(t,e){t.uniform2uiv(this.addr,e)}function Zm(t,e){t.uniform3uiv(this.addr,e)}function Km(t,e){t.uniform4uiv(this.addr,e)}function Jm(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTexture2D(e[a]||Zc,s[a])}function Qm(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTexture3D(e[a]||Jc,s[a])}function e0(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTextureCube(e[a]||Qc,s[a])}function t0(t,e,n){const i=this.cache,r=e.length,s=Xr(n,r);ht(i,s)||(t.uniform1iv(this.addr,s),ft(i,s));for(let a=0;a!==r;++a)n.setTexture2DArray(e[a]||Kc,s[a])}function n0(t){switch(t){case 5126:return Om;case 35664:return zm;case 35665:return Bm;case 35666:return Hm;case 35674:return km;case 35675:return Vm;case 35676:return Gm;case 5124:case 35670:return Wm;case 35667:case 35671:return Xm;case 35668:case 35672:return qm;case 35669:case 35673:return $m;case 5125:return Ym;case 36294:return jm;case 36295:return Zm;case 36296:return Km;case 35678:case 36198:case 36298:case 36306:case 35682:return Jm;case 35679:case 36299:case 36307:return Qm;case 35680:case 36300:case 36308:case 36293:return e0;case 36289:case 36303:case 36311:case 36292:return t0}}class i0{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=Fm(n.type)}}class r0{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=n0(n.type)}}class s0{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,n[o.id],i)}}}const Es=/(\w+)(\])?(\[|\.)?/g;function Ho(t,e){t.seq.push(e),t.map[e.id]=e}function a0(t,e,n){const i=t.name,r=i.length;for(Es.lastIndex=0;;){const s=Es.exec(i),a=Es.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===r){Ho(n,l===void 0?new i0(o,t,e):new r0(o,t,e));break}else{let f=n.map[o];f===void 0&&(f=new s0(o),Ho(n,f)),n=f}}}class Lr{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(n,r),a=e.getUniformLocation(n,s.name);a0(s,a,this)}}setValue(e,n,i,r){const s=this.map[n];s!==void 0&&s.setValue(e,i,r)}setOptional(e,n,i){const r=n[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,n,i,r){for(let s=0,a=n.length;s!==a;++s){const o=n[s],c=i[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,r)}}static seqWithValue(e,n){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in n&&i.push(a)}return i}}function ko(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const o0=37297;let c0=0;function l0(t,e){const n=t.split(`
|
|
3726
3726
|
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let a=r;a<s;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${n[a]}`)}return i.join(`
|
|
3727
|
-
`)}const Vo=new De;function
|
|
3727
|
+
`)}const Vo=new De;function h0(t){Ge._getMatrix(Vo,Ge.workingColorSpace,t);const e=`mat3( ${Vo.elements.map(n=>n.toFixed(4))} )`;switch(Ge.getTransfer(t)){case Gr:return[e,"LinearTransferOETF"];case Ze:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Go(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return n.toUpperCase()+`
|
|
3728
3728
|
|
|
3729
3729
|
`+r+`
|
|
3730
3730
|
|
|
3731
|
-
`+
|
|
3732
|
-
`)}function
|
|
3733
|
-
`)}function
|
|
3734
|
-
`)}function
|
|
3735
|
-
`)}function
|
|
3731
|
+
`+l0(t.getShaderSource(e),a)}else return r}function f0(t,e){const n=h0(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
|
|
3732
|
+
`)}function d0(t,e){let n;switch(e){case wf:n="Linear";break;case Rf:n="Reinhard";break;case Cf:n="Cineon";break;case Pf:n="ACESFilmic";break;case Lf:n="AgX";break;case If:n="Neutral";break;case Df:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const vr=new z;function u0(){Ge.getLuminanceCoefficients(vr);const t=vr.x.toFixed(4),e=vr.y.toFixed(4),n=vr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
|
|
3733
|
+
`)}function p0(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Gi).join(`
|
|
3734
|
+
`)}function m0(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
|
|
3735
|
+
`)}function g0(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=t.getActiveAttrib(e,r),a=s.name;let o=1;s.type===t.FLOAT_MAT2&&(o=2),s.type===t.FLOAT_MAT3&&(o=3),s.type===t.FLOAT_MAT4&&(o=4),n[a]={type:s.type,location:t.getAttribLocation(e,a),locationSize:o}}return n}function Gi(t){return t!==""}function Wo(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.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,n).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 Xo(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const _0=/^[ \t]*#include +<([\w\d./]+)>/gm;function ma(t){return t.replace(_0,x0)}const v0=new Map;function x0(t,e){let n=Ue[e];if(n===void 0){const i=v0.get(e);if(i!==void 0)n=Ue[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return ma(n)}const M0=/#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 qo(t){return t.replace(M0,y0)}function y0(t,e,n,i){let r="";for(let s=parseInt(e);s<parseInt(n);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function $o(t){let e=`precision ${t.precision} float;
|
|
3736
3736
|
precision ${t.precision} int;
|
|
3737
3737
|
precision ${t.precision} sampler2D;
|
|
3738
3738
|
precision ${t.precision} samplerCube;
|
|
@@ -3752,14 +3752,14 @@ void main() {
|
|
|
3752
3752
|
`;return t.precision==="highp"?e+=`
|
|
3753
3753
|
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
|
|
3754
3754
|
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
|
|
3755
|
-
#define LOW_PRECISION`),e}function
|
|
3755
|
+
#define LOW_PRECISION`),e}function S0(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Tc?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===af?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===hn&&(e="SHADOWMAP_TYPE_VSM"),e}function E0(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Si:case Ei:e="ENVMAP_TYPE_CUBE";break;case Vr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function T0(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Ei:e="ENVMAP_MODE_REFRACTION";break}return e}function b0(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case bc:e="ENVMAP_BLENDING_MULTIPLY";break;case bf:e="ENVMAP_BLENDING_MIX";break;case Af:e="ENVMAP_BLENDING_ADD";break}return e}function A0(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function w0(t,e,n,i){const r=t.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const c=S0(n),l=E0(n),h=T0(n),f=b0(n),d=A0(n),u=p0(n),g=m0(s),_=r.createProgram();let p,m,T=n.glslVersion?"#version "+n.glslVersion+`
|
|
3756
3756
|
`:"";n.isRawShaderMaterial?(p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(Gi).join(`
|
|
3757
3757
|
`),p.length>0&&(p+=`
|
|
3758
3758
|
`),m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(Gi).join(`
|
|
3759
3759
|
`),m.length>0&&(m+=`
|
|
3760
3760
|
`)):(p=[$o(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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",`
|
|
3761
3761
|
`].filter(Gi).join(`
|
|
3762
|
-
`),m=[$o(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+h:"",n.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pn?"#define TONE_MAPPING":"",n.toneMapping!==Pn?Ue.tonemapping_pars_fragment:"",n.toneMapping!==Pn?
|
|
3762
|
+
`),m=[$o(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.envMap?"#define "+h:"",n.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pn?"#define TONE_MAPPING":"",n.toneMapping!==Pn?Ue.tonemapping_pars_fragment:"",n.toneMapping!==Pn?d0("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ue.colorspace_pars_fragment,f0("linearToOutputTexel",n.outputColorSpace),u0(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
|
|
3763
3763
|
`].filter(Gi).join(`
|
|
3764
3764
|
`)),a=ma(a),a=Wo(a,n),a=Xo(a,n),o=ma(o),o=Wo(o,n),o=Xo(o,n),a=qo(a),o=qo(o),n.isRawShaderMaterial!==!0&&(T=`#version 300 es
|
|
3765
3765
|
`,p=[u,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
@@ -3773,9 +3773,9 @@ Material Type: `+C.type+`
|
|
|
3773
3773
|
|
|
3774
3774
|
Program Info Log: `+L+`
|
|
3775
3775
|
`+K+`
|
|
3776
|
-
`+G)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(D===""||U==="")&&(V=!1);V&&(C.diagnostics={runnable:X,programLog:L,vertexShader:{log:D,prefix:p},fragmentShader:{log:U,prefix:m}})}r.deleteShader(P),r.deleteShader(b),R=new Lr(r,_),S=_m(r,_)}let R;this.getUniforms=function(){return R===void 0&&w(this),R};let S;this.getAttributes=function(){return S===void 0&&w(this),S};let x=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(_,cm)),x},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=lm++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=P,this.fragmentShader=b,this}let Cm=0;class Pm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(n),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){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new Dm(e),n.set(e,i)),i}}class Dm{constructor(e){this.id=Cm++,this.code=e,this.usedTimes=0}}function Lm(t,e,n,i,r,s,a){const o=new Ra,c=new Pm,l=new Set,h=[],f=r.logarithmicDepthBuffer,d=r.vertexTextures;let u=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(S){return l.add(S),S===0?"uv":`uv${S}`}function p(S,x,C,L,D){const U=L.fog,X=D.geometry,V=S.isMeshStandardMaterial?L.environment:null,K=(S.isMeshStandardMaterial?n:e).get(S.envMap||V),G=K&&K.mapping===Vr?K.image.height:null,te=g[S.type];S.precision!==null&&(u=r.getMaxPrecision(S.precision),u!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",u,"instead."));const ie=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,ve=ie!==void 0?ie.length:0;let Le=0;X.morphAttributes.position!==void 0&&(Le=1),X.morphAttributes.normal!==void 0&&(Le=2),X.morphAttributes.color!==void 0&&(Le=3);let Xe,q,Q,he;if(te){const Ye=Kt[te];Xe=Ye.vertexShader,q=Ye.fragmentShader}else Xe=S.vertexShader,q=S.fragmentShader,c.update(S),Q=c.getVertexShaderID(S),he=c.getFragmentShaderID(S);const re=t.getRenderTarget(),Se=t.state.buffers.depth.getReversed(),Re=D.isInstancedMesh===!0,Fe=D.isBatchedMesh===!0,it=!!S.map,ke=!!S.matcap,at=!!K,O=!!S.aoMap,Ut=!!S.lightMap,ze=!!S.bumpMap,Be=!!S.normalMap,Ee=!!S.displacementMap,et=!!S.emissiveMap,ye=!!S.metalnessMap,A=!!S.roughnessMap,M=S.anisotropy>0,B=S.clearcoat>0,Y=S.dispersion>0,Z=S.iridescence>0,$=S.sheen>0,xe=S.transmission>0,ae=M&&!!S.anisotropyMap,fe=B&&!!S.clearcoatMap,Ve=B&&!!S.clearcoatNormalMap,J=B&&!!S.clearcoatRoughnessMap,de=Z&&!!S.iridescenceMap,Te=Z&&!!S.iridescenceThicknessMap,be=$&&!!S.sheenColorMap,ue=$&&!!S.sheenRoughnessMap,He=!!S.specularMap,Ie=!!S.specularColorMap,Je=!!S.specularIntensityMap,I=xe&&!!S.transmissionMap,se=xe&&!!S.thicknessMap,W=!!S.gradientMap,j=!!S.alphaMap,le=S.alphaTest>0,oe=!!S.alphaHash,Ce=!!S.extensions;let rt=Pn;S.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(rt=t.toneMapping);const gt={shaderID:te,shaderType:S.type,shaderName:S.name,vertexShader:Xe,fragmentShader:q,defines:S.defines,customVertexShaderID:Q,customFragmentShaderID:he,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:u,batching:Fe,batchingColor:Fe&&D._colorsTexture!==null,instancing:Re,instancingColor:Re&&D.instanceColor!==null,instancingMorph:Re&&D.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:re===null?t.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:Ri,alphaToCoverage:!!S.alphaToCoverage,map:it,matcap:ke,envMap:at,envMapMode:at&&K.mapping,envMapCubeUVHeight:G,aoMap:O,lightMap:Ut,bumpMap:ze,normalMap:Be,displacementMap:d&&Ee,emissiveMap:et,normalMapObjectSpace:Be&&S.normalMapType===Bf,normalMapTangentSpace:Be&&S.normalMapType===zf,metalnessMap:ye,roughnessMap:A,anisotropy:M,anisotropyMap:ae,clearcoat:B,clearcoatMap:fe,clearcoatNormalMap:Ve,clearcoatRoughnessMap:J,dispersion:Y,iridescence:Z,iridescenceMap:de,iridescenceThicknessMap:Te,sheen:$,sheenColorMap:be,sheenRoughnessMap:ue,specularMap:He,specularColorMap:Ie,specularIntensityMap:Je,transmission:xe,transmissionMap:I,thicknessMap:se,gradientMap:W,opaque:S.transparent===!1&&S.blending===vi&&S.alphaToCoverage===!1,alphaMap:j,alphaTest:le,alphaHash:oe,combine:S.combine,mapUv:it&&_(S.map.channel),aoMapUv:O&&_(S.aoMap.channel),lightMapUv:Ut&&_(S.lightMap.channel),bumpMapUv:ze&&_(S.bumpMap.channel),normalMapUv:Be&&_(S.normalMap.channel),displacementMapUv:Ee&&_(S.displacementMap.channel),emissiveMapUv:et&&_(S.emissiveMap.channel),metalnessMapUv:ye&&_(S.metalnessMap.channel),roughnessMapUv:A&&_(S.roughnessMap.channel),anisotropyMapUv:ae&&_(S.anisotropyMap.channel),clearcoatMapUv:fe&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:Ve&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:J&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:de&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:be&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:ue&&_(S.sheenRoughnessMap.channel),specularMapUv:He&&_(S.specularMap.channel),specularColorMapUv:Ie&&_(S.specularColorMap.channel),specularIntensityMapUv:Je&&_(S.specularIntensityMap.channel),transmissionMapUv:I&&_(S.transmissionMap.channel),thicknessMapUv:se&&_(S.thicknessMap.channel),alphaMapUv:j&&_(S.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Be||M),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:D.isPoints===!0&&!!X.attributes.uv&&(it||j),fog:!!U,useFog:S.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:Se,skinning:D.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:ve,morphTextureStride:Le,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:t.shadowMap.enabled&&C.length>0,shadowMapType:t.shadowMap.type,toneMapping:rt,decodeVideoTexture:it&&S.map.isVideoTexture===!0&&Ge.getTransfer(S.map.colorSpace)===Ze,decodeVideoTextureEmissive:et&&S.emissiveMap.isVideoTexture===!0&&Ge.getTransfer(S.emissiveMap.colorSpace)===Ze,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Jt,flipSided:S.side===Ct,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:Ce&&S.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ce&&S.extensions.multiDraw===!0||Fe)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return gt.vertexUv1s=l.has(1),gt.vertexUv2s=l.has(2),gt.vertexUv3s=l.has(3),l.clear(),gt}function m(S){const x=[];if(S.shaderID?x.push(S.shaderID):(x.push(S.customVertexShaderID),x.push(S.customFragmentShaderID)),S.defines!==void 0)for(const C in S.defines)x.push(C),x.push(S.defines[C]);return S.isRawShaderMaterial===!1&&(T(x,S),y(x,S),x.push(t.outputColorSpace)),x.push(S.customProgramCacheKey),x.join()}function T(S,x){S.push(x.precision),S.push(x.outputColorSpace),S.push(x.envMapMode),S.push(x.envMapCubeUVHeight),S.push(x.mapUv),S.push(x.alphaMapUv),S.push(x.lightMapUv),S.push(x.aoMapUv),S.push(x.bumpMapUv),S.push(x.normalMapUv),S.push(x.displacementMapUv),S.push(x.emissiveMapUv),S.push(x.metalnessMapUv),S.push(x.roughnessMapUv),S.push(x.anisotropyMapUv),S.push(x.clearcoatMapUv),S.push(x.clearcoatNormalMapUv),S.push(x.clearcoatRoughnessMapUv),S.push(x.iridescenceMapUv),S.push(x.iridescenceThicknessMapUv),S.push(x.sheenColorMapUv),S.push(x.sheenRoughnessMapUv),S.push(x.specularMapUv),S.push(x.specularColorMapUv),S.push(x.specularIntensityMapUv),S.push(x.transmissionMapUv),S.push(x.thicknessMapUv),S.push(x.combine),S.push(x.fogExp2),S.push(x.sizeAttenuation),S.push(x.morphTargetsCount),S.push(x.morphAttributeCount),S.push(x.numDirLights),S.push(x.numPointLights),S.push(x.numSpotLights),S.push(x.numSpotLightMaps),S.push(x.numHemiLights),S.push(x.numRectAreaLights),S.push(x.numDirLightShadows),S.push(x.numPointLightShadows),S.push(x.numSpotLightShadows),S.push(x.numSpotLightShadowsWithMaps),S.push(x.numLightProbes),S.push(x.shadowMapType),S.push(x.toneMapping),S.push(x.numClippingPlanes),S.push(x.numClipIntersection),S.push(x.depthPacking)}function y(S,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),S.push(o.mask)}function v(S){const x=g[S.type];let C;if(x){const L=Kt[x];C=md.clone(L.uniforms)}else C=S.uniforms;return C}function P(S,x){let C;for(let L=0,D=h.length;L<D;L++){const U=h[L];if(U.cacheKey===x){C=U,++C.usedTimes;break}}return C===void 0&&(C=new Rm(t,x,S,s),h.push(C)),C}function b(S){if(--S.usedTimes===0){const x=h.indexOf(S);h[x]=h[h.length-1],h.pop(),S.destroy()}}function w(S){c.remove(S)}function R(){c.dispose()}return{getParameters:p,getProgramCacheKey:m,getUniforms:v,acquireProgram:P,releaseProgram:b,releaseShaderCache:w,programs:h,dispose:R}}function Im(){let t=new WeakMap;function e(a){return t.has(a)}function n(a){let o=t.get(a);return o===void 0&&(o={},t.set(a,o)),o}function i(a){t.delete(a)}function r(a,o,c){t.get(a)[o]=c}function s(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:s}}function Um(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Yo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function jo(){const t=[];let e=0;const n=[],i=[],r=[];function s(){e=0,n.length=0,i.length=0,r.length=0}function a(f,d,u,g,_,p){let m=t[e];return m===void 0?(m={id:f.id,object:f,geometry:d,material:u,groupOrder:g,renderOrder:f.renderOrder,z:_,group:p},t[e]=m):(m.id=f.id,m.object=f,m.geometry=d,m.material=u,m.groupOrder=g,m.renderOrder=f.renderOrder,m.z=_,m.group=p),e++,m}function o(f,d,u,g,_,p){const m=a(f,d,u,g,_,p);u.transmission>0?i.push(m):u.transparent===!0?r.push(m):n.push(m)}function c(f,d,u,g,_,p){const m=a(f,d,u,g,_,p);u.transmission>0?i.unshift(m):u.transparent===!0?r.unshift(m):n.unshift(m)}function l(f,d){n.length>1&&n.sort(f||Um),i.length>1&&i.sort(d||Yo),r.length>1&&r.sort(d||Yo)}function h(){for(let f=e,d=t.length;f<d;f++){const u=t[f];if(u.id===null)break;u.id=null,u.object=null,u.geometry=null,u.material=null,u.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:o,unshift:c,finish:h,sort:l}}function Nm(){let t=new WeakMap;function e(i,r){const s=t.get(i);let a;return s===void 0?(a=new jo,t.set(i,[a])):r>=s.length?(a=new jo,s.push(a)):a=s[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function Fm(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new z,color:new Oe};break;case"SpotLight":n={position:new z,direction:new z,color:new Oe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new z,color:new Oe,distance:0,decay:0};break;case"HemisphereLight":n={direction:new z,skyColor:new Oe,groundColor:new Oe};break;case"RectAreaLight":n={color:new Oe,position:new z,halfWidth:new z,halfHeight:new z};break}return t[e.id]=n,n}}}function Om(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let zm=0;function Bm(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Hm(t){const e=new Fm,n=Om(),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 l=0;l<9;l++)i.probe.push(new z);const r=new z,s=new je,a=new je;function o(l){let h=0,f=0,d=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let u=0,g=0,_=0,p=0,m=0,T=0,y=0,v=0,P=0,b=0,w=0;l.sort(Bm);for(let S=0,x=l.length;S<x;S++){const C=l[S],L=C.color,D=C.intensity,U=C.distance,X=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)h+=L.r*D,f+=L.g*D,d+=L.b*D;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],D);w++}else if(C.isDirectionalLight){const V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){const K=C.shadow,G=n.get(C);G.shadowIntensity=K.intensity,G.shadowBias=K.bias,G.shadowNormalBias=K.normalBias,G.shadowRadius=K.radius,G.shadowMapSize=K.mapSize,i.directionalShadow[u]=G,i.directionalShadowMap[u]=X,i.directionalShadowMatrix[u]=C.shadow.matrix,T++}i.directional[u]=V,u++}else if(C.isSpotLight){const V=e.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(L).multiplyScalar(D),V.distance=U,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[_]=V;const K=C.shadow;if(C.map&&(i.spotLightMap[P]=C.map,P++,K.updateMatrices(C),C.castShadow&&b++),i.spotLightMatrix[_]=K.matrix,C.castShadow){const G=n.get(C);G.shadowIntensity=K.intensity,G.shadowBias=K.bias,G.shadowNormalBias=K.normalBias,G.shadowRadius=K.radius,G.shadowMapSize=K.mapSize,i.spotShadow[_]=G,i.spotShadowMap[_]=X,v++}_++}else if(C.isRectAreaLight){const V=e.get(C);V.color.copy(L).multiplyScalar(D),V.halfWidth.set(C.width*.5,0,0),V.halfHeight.set(0,C.height*.5,0),i.rectArea[p]=V,p++}else if(C.isPointLight){const V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){const K=C.shadow,G=n.get(C);G.shadowIntensity=K.intensity,G.shadowBias=K.bias,G.shadowNormalBias=K.normalBias,G.shadowRadius=K.radius,G.shadowMapSize=K.mapSize,G.shadowCameraNear=K.camera.near,G.shadowCameraFar=K.camera.far,i.pointShadow[g]=G,i.pointShadowMap[g]=X,i.pointShadowMatrix[g]=C.shadow.matrix,y++}i.point[g]=V,g++}else if(C.isHemisphereLight){const V=e.get(C);V.skyColor.copy(C.color).multiplyScalar(D),V.groundColor.copy(C.groundColor).multiplyScalar(D),i.hemi[m]=V,m++}}p>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ne.LTC_FLOAT_1,i.rectAreaLTC2=ne.LTC_FLOAT_2):(i.rectAreaLTC1=ne.LTC_HALF_1,i.rectAreaLTC2=ne.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=f,i.ambient[2]=d;const R=i.hash;(R.directionalLength!==u||R.pointLength!==g||R.spotLength!==_||R.rectAreaLength!==p||R.hemiLength!==m||R.numDirectionalShadows!==T||R.numPointShadows!==y||R.numSpotShadows!==v||R.numSpotMaps!==P||R.numLightProbes!==w)&&(i.directional.length=u,i.spot.length=_,i.rectArea.length=p,i.point.length=g,i.hemi.length=m,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=v+P-b,i.spotLightMap.length=P,i.numSpotLightShadowsWithMaps=b,i.numLightProbes=w,R.directionalLength=u,R.pointLength=g,R.spotLength=_,R.rectAreaLength=p,R.hemiLength=m,R.numDirectionalShadows=T,R.numPointShadows=y,R.numSpotShadows=v,R.numSpotMaps=P,R.numLightProbes=w,i.version=zm++)}function c(l,h){let f=0,d=0,u=0,g=0,_=0;const p=h.matrixWorldInverse;for(let m=0,T=l.length;m<T;m++){const y=l[m];if(y.isDirectionalLight){const v=i.directional[f];v.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),f++}else if(y.isSpotLight){const v=i.spot[u];v.position.setFromMatrixPosition(y.matrixWorld),v.position.applyMatrix4(p),v.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),u++}else if(y.isRectAreaLight){const v=i.rectArea[g];v.position.setFromMatrixPosition(y.matrixWorld),v.position.applyMatrix4(p),a.identity(),s.copy(y.matrixWorld),s.premultiply(p),a.extractRotation(s),v.halfWidth.set(y.width*.5,0,0),v.halfHeight.set(0,y.height*.5,0),v.halfWidth.applyMatrix4(a),v.halfHeight.applyMatrix4(a),g++}else if(y.isPointLight){const v=i.point[d];v.position.setFromMatrixPosition(y.matrixWorld),v.position.applyMatrix4(p),d++}else if(y.isHemisphereLight){const v=i.hemi[_];v.direction.setFromMatrixPosition(y.matrixWorld),v.direction.transformDirection(p),_++}}}return{setup:o,setupView:c,state:i}}function Zo(t){const e=new Hm(t),n=[],i=[];function r(h){l.camera=h,n.length=0,i.length=0}function s(h){n.push(h)}function a(h){i.push(h)}function o(){e.setup(n)}function c(h){e.setupView(n,h)}const l={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:l,setupLights:o,setupLightsView:c,pushLight:s,pushShadow:a}}function km(t){let e=new WeakMap;function n(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Zo(t),e.set(r,[o])):s>=a.length?(o=new Zo(t),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:n,dispose:i}}class Vm extends Ci{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=Ff,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Gm extends Ci{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Wm=`void main() {
|
|
3776
|
+
`+G)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(D===""||U==="")&&(V=!1);V&&(C.diagnostics={runnable:X,programLog:L,vertexShader:{log:D,prefix:p},fragmentShader:{log:U,prefix:m}})}r.deleteShader(P),r.deleteShader(b),R=new Lr(r,_),S=g0(r,_)}let R;this.getUniforms=function(){return R===void 0&&w(this),R};let S;this.getAttributes=function(){return S===void 0&&w(this),S};let x=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return x===!1&&(x=r.getProgramParameter(_,o0)),x},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=c0++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=P,this.fragmentShader=b,this}let R0=0;class C0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(n),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){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new P0(e),n.set(e,i)),i}}class P0{constructor(e){this.id=R0++,this.code=e,this.usedTimes=0}}function D0(t,e,n,i,r,s,a){const o=new Ra,c=new C0,l=new Set,h=[],f=r.logarithmicDepthBuffer,d=r.vertexTextures;let u=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(S){return l.add(S),S===0?"uv":`uv${S}`}function p(S,x,C,L,D){const U=L.fog,X=D.geometry,V=S.isMeshStandardMaterial?L.environment:null,K=(S.isMeshStandardMaterial?n:e).get(S.envMap||V),G=K&&K.mapping===Vr?K.image.height:null,te=g[S.type];S.precision!==null&&(u=r.getMaxPrecision(S.precision),u!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",u,"instead."));const ie=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,ve=ie!==void 0?ie.length:0;let Le=0;X.morphAttributes.position!==void 0&&(Le=1),X.morphAttributes.normal!==void 0&&(Le=2),X.morphAttributes.color!==void 0&&(Le=3);let Xe,q,Q,he;if(te){const Ye=Kt[te];Xe=Ye.vertexShader,q=Ye.fragmentShader}else Xe=S.vertexShader,q=S.fragmentShader,c.update(S),Q=c.getVertexShaderID(S),he=c.getFragmentShaderID(S);const re=t.getRenderTarget(),Se=t.state.buffers.depth.getReversed(),Re=D.isInstancedMesh===!0,Fe=D.isBatchedMesh===!0,it=!!S.map,ke=!!S.matcap,at=!!K,O=!!S.aoMap,Ut=!!S.lightMap,ze=!!S.bumpMap,Be=!!S.normalMap,Ee=!!S.displacementMap,et=!!S.emissiveMap,ye=!!S.metalnessMap,A=!!S.roughnessMap,M=S.anisotropy>0,B=S.clearcoat>0,Y=S.dispersion>0,Z=S.iridescence>0,$=S.sheen>0,xe=S.transmission>0,ae=M&&!!S.anisotropyMap,fe=B&&!!S.clearcoatMap,Ve=B&&!!S.clearcoatNormalMap,J=B&&!!S.clearcoatRoughnessMap,de=Z&&!!S.iridescenceMap,Te=Z&&!!S.iridescenceThicknessMap,be=$&&!!S.sheenColorMap,ue=$&&!!S.sheenRoughnessMap,He=!!S.specularMap,Ie=!!S.specularColorMap,Je=!!S.specularIntensityMap,I=xe&&!!S.transmissionMap,se=xe&&!!S.thicknessMap,W=!!S.gradientMap,j=!!S.alphaMap,le=S.alphaTest>0,oe=!!S.alphaHash,Ce=!!S.extensions;let rt=Pn;S.toneMapped&&(re===null||re.isXRRenderTarget===!0)&&(rt=t.toneMapping);const gt={shaderID:te,shaderType:S.type,shaderName:S.name,vertexShader:Xe,fragmentShader:q,defines:S.defines,customVertexShaderID:Q,customFragmentShaderID:he,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:u,batching:Fe,batchingColor:Fe&&D._colorsTexture!==null,instancing:Re,instancingColor:Re&&D.instanceColor!==null,instancingMorph:Re&&D.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:re===null?t.outputColorSpace:re.isXRRenderTarget===!0?re.texture.colorSpace:Ri,alphaToCoverage:!!S.alphaToCoverage,map:it,matcap:ke,envMap:at,envMapMode:at&&K.mapping,envMapCubeUVHeight:G,aoMap:O,lightMap:Ut,bumpMap:ze,normalMap:Be,displacementMap:d&&Ee,emissiveMap:et,normalMapObjectSpace:Be&&S.normalMapType===zf,normalMapTangentSpace:Be&&S.normalMapType===Of,metalnessMap:ye,roughnessMap:A,anisotropy:M,anisotropyMap:ae,clearcoat:B,clearcoatMap:fe,clearcoatNormalMap:Ve,clearcoatRoughnessMap:J,dispersion:Y,iridescence:Z,iridescenceMap:de,iridescenceThicknessMap:Te,sheen:$,sheenColorMap:be,sheenRoughnessMap:ue,specularMap:He,specularColorMap:Ie,specularIntensityMap:Je,transmission:xe,transmissionMap:I,thicknessMap:se,gradientMap:W,opaque:S.transparent===!1&&S.blending===vi&&S.alphaToCoverage===!1,alphaMap:j,alphaTest:le,alphaHash:oe,combine:S.combine,mapUv:it&&_(S.map.channel),aoMapUv:O&&_(S.aoMap.channel),lightMapUv:Ut&&_(S.lightMap.channel),bumpMapUv:ze&&_(S.bumpMap.channel),normalMapUv:Be&&_(S.normalMap.channel),displacementMapUv:Ee&&_(S.displacementMap.channel),emissiveMapUv:et&&_(S.emissiveMap.channel),metalnessMapUv:ye&&_(S.metalnessMap.channel),roughnessMapUv:A&&_(S.roughnessMap.channel),anisotropyMapUv:ae&&_(S.anisotropyMap.channel),clearcoatMapUv:fe&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:Ve&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:J&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:de&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:Te&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:be&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:ue&&_(S.sheenRoughnessMap.channel),specularMapUv:He&&_(S.specularMap.channel),specularColorMapUv:Ie&&_(S.specularColorMap.channel),specularIntensityMapUv:Je&&_(S.specularIntensityMap.channel),transmissionMapUv:I&&_(S.transmissionMap.channel),thicknessMapUv:se&&_(S.thicknessMap.channel),alphaMapUv:j&&_(S.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Be||M),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:D.isPoints===!0&&!!X.attributes.uv&&(it||j),fog:!!U,useFog:S.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:Se,skinning:D.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:ve,morphTextureStride:Le,numDirLights:x.directional.length,numPointLights:x.point.length,numSpotLights:x.spot.length,numSpotLightMaps:x.spotLightMap.length,numRectAreaLights:x.rectArea.length,numHemiLights:x.hemi.length,numDirLightShadows:x.directionalShadowMap.length,numPointLightShadows:x.pointShadowMap.length,numSpotLightShadows:x.spotShadowMap.length,numSpotLightShadowsWithMaps:x.numSpotLightShadowsWithMaps,numLightProbes:x.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:t.shadowMap.enabled&&C.length>0,shadowMapType:t.shadowMap.type,toneMapping:rt,decodeVideoTexture:it&&S.map.isVideoTexture===!0&&Ge.getTransfer(S.map.colorSpace)===Ze,decodeVideoTextureEmissive:et&&S.emissiveMap.isVideoTexture===!0&&Ge.getTransfer(S.emissiveMap.colorSpace)===Ze,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Jt,flipSided:S.side===Ct,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:Ce&&S.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ce&&S.extensions.multiDraw===!0||Fe)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return gt.vertexUv1s=l.has(1),gt.vertexUv2s=l.has(2),gt.vertexUv3s=l.has(3),l.clear(),gt}function m(S){const x=[];if(S.shaderID?x.push(S.shaderID):(x.push(S.customVertexShaderID),x.push(S.customFragmentShaderID)),S.defines!==void 0)for(const C in S.defines)x.push(C),x.push(S.defines[C]);return S.isRawShaderMaterial===!1&&(T(x,S),y(x,S),x.push(t.outputColorSpace)),x.push(S.customProgramCacheKey),x.join()}function T(S,x){S.push(x.precision),S.push(x.outputColorSpace),S.push(x.envMapMode),S.push(x.envMapCubeUVHeight),S.push(x.mapUv),S.push(x.alphaMapUv),S.push(x.lightMapUv),S.push(x.aoMapUv),S.push(x.bumpMapUv),S.push(x.normalMapUv),S.push(x.displacementMapUv),S.push(x.emissiveMapUv),S.push(x.metalnessMapUv),S.push(x.roughnessMapUv),S.push(x.anisotropyMapUv),S.push(x.clearcoatMapUv),S.push(x.clearcoatNormalMapUv),S.push(x.clearcoatRoughnessMapUv),S.push(x.iridescenceMapUv),S.push(x.iridescenceThicknessMapUv),S.push(x.sheenColorMapUv),S.push(x.sheenRoughnessMapUv),S.push(x.specularMapUv),S.push(x.specularColorMapUv),S.push(x.specularIntensityMapUv),S.push(x.transmissionMapUv),S.push(x.thicknessMapUv),S.push(x.combine),S.push(x.fogExp2),S.push(x.sizeAttenuation),S.push(x.morphTargetsCount),S.push(x.morphAttributeCount),S.push(x.numDirLights),S.push(x.numPointLights),S.push(x.numSpotLights),S.push(x.numSpotLightMaps),S.push(x.numHemiLights),S.push(x.numRectAreaLights),S.push(x.numDirLightShadows),S.push(x.numPointLightShadows),S.push(x.numSpotLightShadows),S.push(x.numSpotLightShadowsWithMaps),S.push(x.numLightProbes),S.push(x.shadowMapType),S.push(x.toneMapping),S.push(x.numClippingPlanes),S.push(x.numClipIntersection),S.push(x.depthPacking)}function y(S,x){o.disableAll(),x.supportsVertexTextures&&o.enable(0),x.instancing&&o.enable(1),x.instancingColor&&o.enable(2),x.instancingMorph&&o.enable(3),x.matcap&&o.enable(4),x.envMap&&o.enable(5),x.normalMapObjectSpace&&o.enable(6),x.normalMapTangentSpace&&o.enable(7),x.clearcoat&&o.enable(8),x.iridescence&&o.enable(9),x.alphaTest&&o.enable(10),x.vertexColors&&o.enable(11),x.vertexAlphas&&o.enable(12),x.vertexUv1s&&o.enable(13),x.vertexUv2s&&o.enable(14),x.vertexUv3s&&o.enable(15),x.vertexTangents&&o.enable(16),x.anisotropy&&o.enable(17),x.alphaHash&&o.enable(18),x.batching&&o.enable(19),x.dispersion&&o.enable(20),x.batchingColor&&o.enable(21),S.push(o.mask),o.disableAll(),x.fog&&o.enable(0),x.useFog&&o.enable(1),x.flatShading&&o.enable(2),x.logarithmicDepthBuffer&&o.enable(3),x.reverseDepthBuffer&&o.enable(4),x.skinning&&o.enable(5),x.morphTargets&&o.enable(6),x.morphNormals&&o.enable(7),x.morphColors&&o.enable(8),x.premultipliedAlpha&&o.enable(9),x.shadowMapEnabled&&o.enable(10),x.doubleSided&&o.enable(11),x.flipSided&&o.enable(12),x.useDepthPacking&&o.enable(13),x.dithering&&o.enable(14),x.transmission&&o.enable(15),x.sheen&&o.enable(16),x.opaque&&o.enable(17),x.pointsUvs&&o.enable(18),x.decodeVideoTexture&&o.enable(19),x.decodeVideoTextureEmissive&&o.enable(20),x.alphaToCoverage&&o.enable(21),S.push(o.mask)}function v(S){const x=g[S.type];let C;if(x){const L=Kt[x];C=pd.clone(L.uniforms)}else C=S.uniforms;return C}function P(S,x){let C;for(let L=0,D=h.length;L<D;L++){const U=h[L];if(U.cacheKey===x){C=U,++C.usedTimes;break}}return C===void 0&&(C=new w0(t,x,S,s),h.push(C)),C}function b(S){if(--S.usedTimes===0){const x=h.indexOf(S);h[x]=h[h.length-1],h.pop(),S.destroy()}}function w(S){c.remove(S)}function R(){c.dispose()}return{getParameters:p,getProgramCacheKey:m,getUniforms:v,acquireProgram:P,releaseProgram:b,releaseShaderCache:w,programs:h,dispose:R}}function L0(){let t=new WeakMap;function e(a){return t.has(a)}function n(a){let o=t.get(a);return o===void 0&&(o={},t.set(a,o)),o}function i(a){t.delete(a)}function r(a,o,c){t.get(a)[o]=c}function s(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:s}}function I0(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Yo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function jo(){const t=[];let e=0;const n=[],i=[],r=[];function s(){e=0,n.length=0,i.length=0,r.length=0}function a(f,d,u,g,_,p){let m=t[e];return m===void 0?(m={id:f.id,object:f,geometry:d,material:u,groupOrder:g,renderOrder:f.renderOrder,z:_,group:p},t[e]=m):(m.id=f.id,m.object=f,m.geometry=d,m.material=u,m.groupOrder=g,m.renderOrder=f.renderOrder,m.z=_,m.group=p),e++,m}function o(f,d,u,g,_,p){const m=a(f,d,u,g,_,p);u.transmission>0?i.push(m):u.transparent===!0?r.push(m):n.push(m)}function c(f,d,u,g,_,p){const m=a(f,d,u,g,_,p);u.transmission>0?i.unshift(m):u.transparent===!0?r.unshift(m):n.unshift(m)}function l(f,d){n.length>1&&n.sort(f||I0),i.length>1&&i.sort(d||Yo),r.length>1&&r.sort(d||Yo)}function h(){for(let f=e,d=t.length;f<d;f++){const u=t[f];if(u.id===null)break;u.id=null,u.object=null,u.geometry=null,u.material=null,u.group=null}}return{opaque:n,transmissive:i,transparent:r,init:s,push:o,unshift:c,finish:h,sort:l}}function U0(){let t=new WeakMap;function e(i,r){const s=t.get(i);let a;return s===void 0?(a=new jo,t.set(i,[a])):r>=s.length?(a=new jo,s.push(a)):a=s[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function N0(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new z,color:new Oe};break;case"SpotLight":n={position:new z,direction:new z,color:new Oe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new z,color:new Oe,distance:0,decay:0};break;case"HemisphereLight":n={direction:new z,skyColor:new Oe,groundColor:new Oe};break;case"RectAreaLight":n={color:new Oe,position:new z,halfWidth:new z,halfHeight:new z};break}return t[e.id]=n,n}}}function F0(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let O0=0;function z0(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function B0(t){const e=new N0,n=F0(),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 l=0;l<9;l++)i.probe.push(new z);const r=new z,s=new je,a=new je;function o(l){let h=0,f=0,d=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let u=0,g=0,_=0,p=0,m=0,T=0,y=0,v=0,P=0,b=0,w=0;l.sort(z0);for(let S=0,x=l.length;S<x;S++){const C=l[S],L=C.color,D=C.intensity,U=C.distance,X=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)h+=L.r*D,f+=L.g*D,d+=L.b*D;else if(C.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],D);w++}else if(C.isDirectionalLight){const V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),C.castShadow){const K=C.shadow,G=n.get(C);G.shadowIntensity=K.intensity,G.shadowBias=K.bias,G.shadowNormalBias=K.normalBias,G.shadowRadius=K.radius,G.shadowMapSize=K.mapSize,i.directionalShadow[u]=G,i.directionalShadowMap[u]=X,i.directionalShadowMatrix[u]=C.shadow.matrix,T++}i.directional[u]=V,u++}else if(C.isSpotLight){const V=e.get(C);V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(L).multiplyScalar(D),V.distance=U,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,i.spot[_]=V;const K=C.shadow;if(C.map&&(i.spotLightMap[P]=C.map,P++,K.updateMatrices(C),C.castShadow&&b++),i.spotLightMatrix[_]=K.matrix,C.castShadow){const G=n.get(C);G.shadowIntensity=K.intensity,G.shadowBias=K.bias,G.shadowNormalBias=K.normalBias,G.shadowRadius=K.radius,G.shadowMapSize=K.mapSize,i.spotShadow[_]=G,i.spotShadowMap[_]=X,v++}_++}else if(C.isRectAreaLight){const V=e.get(C);V.color.copy(L).multiplyScalar(D),V.halfWidth.set(C.width*.5,0,0),V.halfHeight.set(0,C.height*.5,0),i.rectArea[p]=V,p++}else if(C.isPointLight){const V=e.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity),V.distance=C.distance,V.decay=C.decay,C.castShadow){const K=C.shadow,G=n.get(C);G.shadowIntensity=K.intensity,G.shadowBias=K.bias,G.shadowNormalBias=K.normalBias,G.shadowRadius=K.radius,G.shadowMapSize=K.mapSize,G.shadowCameraNear=K.camera.near,G.shadowCameraFar=K.camera.far,i.pointShadow[g]=G,i.pointShadowMap[g]=X,i.pointShadowMatrix[g]=C.shadow.matrix,y++}i.point[g]=V,g++}else if(C.isHemisphereLight){const V=e.get(C);V.skyColor.copy(C.color).multiplyScalar(D),V.groundColor.copy(C.groundColor).multiplyScalar(D),i.hemi[m]=V,m++}}p>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ne.LTC_FLOAT_1,i.rectAreaLTC2=ne.LTC_FLOAT_2):(i.rectAreaLTC1=ne.LTC_HALF_1,i.rectAreaLTC2=ne.LTC_HALF_2)),i.ambient[0]=h,i.ambient[1]=f,i.ambient[2]=d;const R=i.hash;(R.directionalLength!==u||R.pointLength!==g||R.spotLength!==_||R.rectAreaLength!==p||R.hemiLength!==m||R.numDirectionalShadows!==T||R.numPointShadows!==y||R.numSpotShadows!==v||R.numSpotMaps!==P||R.numLightProbes!==w)&&(i.directional.length=u,i.spot.length=_,i.rectArea.length=p,i.point.length=g,i.hemi.length=m,i.directionalShadow.length=T,i.directionalShadowMap.length=T,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=T,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=v+P-b,i.spotLightMap.length=P,i.numSpotLightShadowsWithMaps=b,i.numLightProbes=w,R.directionalLength=u,R.pointLength=g,R.spotLength=_,R.rectAreaLength=p,R.hemiLength=m,R.numDirectionalShadows=T,R.numPointShadows=y,R.numSpotShadows=v,R.numSpotMaps=P,R.numLightProbes=w,i.version=O0++)}function c(l,h){let f=0,d=0,u=0,g=0,_=0;const p=h.matrixWorldInverse;for(let m=0,T=l.length;m<T;m++){const y=l[m];if(y.isDirectionalLight){const v=i.directional[f];v.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),f++}else if(y.isSpotLight){const v=i.spot[u];v.position.setFromMatrixPosition(y.matrixWorld),v.position.applyMatrix4(p),v.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),v.direction.sub(r),v.direction.transformDirection(p),u++}else if(y.isRectAreaLight){const v=i.rectArea[g];v.position.setFromMatrixPosition(y.matrixWorld),v.position.applyMatrix4(p),a.identity(),s.copy(y.matrixWorld),s.premultiply(p),a.extractRotation(s),v.halfWidth.set(y.width*.5,0,0),v.halfHeight.set(0,y.height*.5,0),v.halfWidth.applyMatrix4(a),v.halfHeight.applyMatrix4(a),g++}else if(y.isPointLight){const v=i.point[d];v.position.setFromMatrixPosition(y.matrixWorld),v.position.applyMatrix4(p),d++}else if(y.isHemisphereLight){const v=i.hemi[_];v.direction.setFromMatrixPosition(y.matrixWorld),v.direction.transformDirection(p),_++}}}return{setup:o,setupView:c,state:i}}function Zo(t){const e=new B0(t),n=[],i=[];function r(h){l.camera=h,n.length=0,i.length=0}function s(h){n.push(h)}function a(h){i.push(h)}function o(){e.setup(n)}function c(h){e.setupView(n,h)}const l={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:l,setupLights:o,setupLightsView:c,pushLight:s,pushShadow:a}}function H0(t){let e=new WeakMap;function n(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Zo(t),e.set(r,[o])):s>=a.length?(o=new Zo(t),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:n,dispose:i}}class k0 extends Ci{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=Nf,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class V0 extends Ci{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const G0=`void main() {
|
|
3777
3777
|
gl_Position = vec4( position, 1.0 );
|
|
3778
|
-
}`,
|
|
3778
|
+
}`,W0=`uniform sampler2D shadow_pass;
|
|
3779
3779
|
uniform vec2 resolution;
|
|
3780
3780
|
uniform float radius;
|
|
3781
3781
|
#include <packing>
|
|
@@ -3801,12 +3801,12 @@ void main() {
|
|
|
3801
3801
|
squared_mean = squared_mean / samples;
|
|
3802
3802
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3803
3803
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3804
|
-
}`;function qm(t,e,n){let i=new Ca;const r=new we,s=new we,a=new st,o=new Vm({depthPacking:Of}),c=new Gm,l={},h=n.maxTextureSize,f={[Dn]:Ct,[Ct]:Dn,[Jt]:Jt},d=new Yt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new we},radius:{value:4}},vertexShader:Wm,fragmentShader:Xm}),u=d.clone();u.defines.HORIZONTAL_PASS=1;const g=new pt;g.setAttribute("position",new Bt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Rt(g,d),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Tc;let m=this.type;this.render=function(b,w,R){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||b.length===0)return;const S=t.getRenderTarget(),x=t.getActiveCubeFace(),C=t.getActiveMipmapLevel(),L=t.state;L.setBlending(Cn),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const D=m!==hn&&this.type===hn,U=m===hn&&this.type!==hn;for(let X=0,V=b.length;X<V;X++){const K=b[X],G=K.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",K,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const te=G.getFrameExtents();if(r.multiply(te),s.copy(G.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/te.x),r.x=s.x*te.x,G.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/te.y),r.y=s.y*te.y,G.mapSize.y=s.y)),G.map===null||D===!0||U===!0){const ve=this.type!==hn?{minFilter:It,magFilter:It}:{};G.map!==null&&G.map.dispose(),G.map=new $n(r.x,r.y,ve),G.map.texture.name=K.name+".shadowMap",G.camera.updateProjectionMatrix()}t.setRenderTarget(G.map),t.clear();const ie=G.getViewportCount();for(let ve=0;ve<ie;ve++){const Le=G.getViewport(ve);a.set(s.x*Le.x,s.y*Le.y,s.x*Le.z,s.y*Le.w),L.viewport(a),G.updateMatrices(K,ve),i=G.getFrustum(),v(w,R,G.camera,K,this.type)}G.isPointLightShadow!==!0&&this.type===hn&&T(G,R),G.needsUpdate=!1}m=this.type,p.needsUpdate=!1,t.setRenderTarget(S,x,C)};function T(b,w){const R=e.update(_);d.defines.VSM_SAMPLES!==b.blurSamples&&(d.defines.VSM_SAMPLES=b.blurSamples,u.defines.VSM_SAMPLES=b.blurSamples,d.needsUpdate=!0,u.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new $n(r.x,r.y)),d.uniforms.shadow_pass.value=b.map.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,t.setRenderTarget(b.mapPass),t.clear(),t.renderBufferDirect(w,null,R,d,_,null),u.uniforms.shadow_pass.value=b.mapPass.texture,u.uniforms.resolution.value=b.mapSize,u.uniforms.radius.value=b.radius,t.setRenderTarget(b.map),t.clear(),t.renderBufferDirect(w,null,R,u,_,null)}function y(b,w,R,S){let x=null;const C=R.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0)x=C;else if(x=R.isPointLight===!0?c:o,t.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const L=x.uuid,D=w.uuid;let U=l[L];U===void 0&&(U={},l[L]=U);let X=U[D];X===void 0&&(X=x.clone(),U[D]=X,w.addEventListener("dispose",P)),x=X}if(x.visible=w.visible,x.wireframe=w.wireframe,S===hn?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:f[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,R.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const L=t.properties.get(x);L.light=R}return x}function v(b,w,R,S,x){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&x===hn)&&(!b.frustumCulled||i.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,b.matrixWorld);const D=e.update(b),U=b.material;if(Array.isArray(U)){const X=D.groups;for(let V=0,K=X.length;V<K;V++){const G=X[V],te=U[G.materialIndex];if(te&&te.visible){const ie=y(b,te,S,x);b.onBeforeShadow(t,b,w,R,D,ie,G),t.renderBufferDirect(R,null,D,ie,b,G),b.onAfterShadow(t,b,w,R,D,ie,G)}}}else if(U.visible){const X=y(b,U,S,x);b.onBeforeShadow(t,b,w,R,D,X,null),t.renderBufferDirect(R,null,D,X,b,null),b.onAfterShadow(t,b,w,R,D,X,null)}}const L=b.children;for(let D=0,U=L.length;D<U;D++)v(L[D],w,R,S,x)}function P(b){b.target.removeEventListener("dispose",P);for(const R in l){const S=l[R],x=b.target.uuid;x in S&&(S[x].dispose(),delete S[x])}}}const $m={[Ds]:Ls,[Is]:Fs,[Us]:Os,[yi]:Ns,[Ls]:Ds,[Fs]:Is,[Os]:Us,[Ns]:yi};function Ym(t,e){function n(){let I=!1;const se=new st;let W=null;const j=new st(0,0,0,0);return{setMask:function(le){W!==le&&!I&&(t.colorMask(le,le,le,le),W=le)},setLocked:function(le){I=le},setClear:function(le,oe,Ce,rt,gt){gt===!0&&(le*=rt,oe*=rt,Ce*=rt),se.set(le,oe,Ce,rt),j.equals(se)===!1&&(t.clearColor(le,oe,Ce,rt),j.copy(se))},reset:function(){I=!1,W=null,j.set(-1,0,0,0)}}}function i(){let I=!1,se=!1,W=null,j=null,le=null;return{setReversed:function(oe){if(se!==oe){const Ce=e.get("EXT_clip_control");se?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT);const rt=le;le=null,this.setClear(rt)}se=oe},getReversed:function(){return se},setTest:function(oe){oe?re(t.DEPTH_TEST):Se(t.DEPTH_TEST)},setMask:function(oe){W!==oe&&!I&&(t.depthMask(oe),W=oe)},setFunc:function(oe){if(se&&(oe=$m[oe]),j!==oe){switch(oe){case Ds:t.depthFunc(t.NEVER);break;case Ls:t.depthFunc(t.ALWAYS);break;case Is:t.depthFunc(t.LESS);break;case yi:t.depthFunc(t.LEQUAL);break;case Us:t.depthFunc(t.EQUAL);break;case Ns:t.depthFunc(t.GEQUAL);break;case Fs:t.depthFunc(t.GREATER);break;case Os:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}j=oe}},setLocked:function(oe){I=oe},setClear:function(oe){le!==oe&&(se&&(oe=1-oe),t.clearDepth(oe),le=oe)},reset:function(){I=!1,W=null,j=null,le=null,se=!1}}}function r(){let I=!1,se=null,W=null,j=null,le=null,oe=null,Ce=null,rt=null,gt=null;return{setTest:function(Ye){I||(Ye?re(t.STENCIL_TEST):Se(t.STENCIL_TEST))},setMask:function(Ye){se!==Ye&&!I&&(t.stencilMask(Ye),se=Ye)},setFunc:function(Ye,Ht,nn){(W!==Ye||j!==Ht||le!==nn)&&(t.stencilFunc(Ye,Ht,nn),W=Ye,j=Ht,le=nn)},setOp:function(Ye,Ht,nn){(oe!==Ye||Ce!==Ht||rt!==nn)&&(t.stencilOp(Ye,Ht,nn),oe=Ye,Ce=Ht,rt=nn)},setLocked:function(Ye){I=Ye},setClear:function(Ye){gt!==Ye&&(t.clearStencil(Ye),gt=Ye)},reset:function(){I=!1,se=null,W=null,j=null,le=null,oe=null,Ce=null,rt=null,gt=null}}}const s=new n,a=new i,o=new r,c=new WeakMap,l=new WeakMap;let h={},f={},d=new WeakMap,u=[],g=null,_=!1,p=null,m=null,T=null,y=null,v=null,P=null,b=null,w=new Oe(0,0,0),R=0,S=!1,x=null,C=null,L=null,D=null,U=null;const X=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,K=0;const G=t.getParameter(t.VERSION);G.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(G)[1]),V=K>=1):G.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),V=K>=2);let te=null,ie={};const ve=t.getParameter(t.SCISSOR_BOX),Le=t.getParameter(t.VIEWPORT),Xe=new st().fromArray(ve),q=new st().fromArray(Le);function Q(I,se,W,j){const le=new Uint8Array(4),oe=t.createTexture();t.bindTexture(I,oe),t.texParameteri(I,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(I,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ce=0;Ce<W;Ce++)I===t.TEXTURE_3D||I===t.TEXTURE_2D_ARRAY?t.texImage3D(se,0,t.RGBA,1,1,j,0,t.RGBA,t.UNSIGNED_BYTE,le):t.texImage2D(se+Ce,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,le);return oe}const he={};he[t.TEXTURE_2D]=Q(t.TEXTURE_2D,t.TEXTURE_2D,1),he[t.TEXTURE_CUBE_MAP]=Q(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),he[t.TEXTURE_2D_ARRAY]=Q(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),he[t.TEXTURE_3D]=Q(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),re(t.DEPTH_TEST),a.setFunc(yi),ze(!1),Be(Qa),re(t.CULL_FACE),O(Cn);function re(I){h[I]!==!0&&(t.enable(I),h[I]=!0)}function Se(I){h[I]!==!1&&(t.disable(I),h[I]=!1)}function Re(I,se){return f[I]!==se?(t.bindFramebuffer(I,se),f[I]=se,I===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=se),I===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=se),!0):!1}function Fe(I,se){let W=u,j=!1;if(I){W=d.get(se),W===void 0&&(W=[],d.set(se,W));const le=I.textures;if(W.length!==le.length||W[0]!==t.COLOR_ATTACHMENT0){for(let oe=0,Ce=le.length;oe<Ce;oe++)W[oe]=t.COLOR_ATTACHMENT0+oe;W.length=le.length,j=!0}}else W[0]!==t.BACK&&(W[0]=t.BACK,j=!0);j&&t.drawBuffers(W)}function it(I){return g!==I?(t.useProgram(I),g=I,!0):!1}const ke={[Vn]:t.FUNC_ADD,[lf]:t.FUNC_SUBTRACT,[hf]:t.FUNC_REVERSE_SUBTRACT};ke[ff]=t.MIN,ke[df]=t.MAX;const at={[uf]:t.ZERO,[pf]:t.ONE,[mf]:t.SRC_COLOR,[Cs]:t.SRC_ALPHA,[yf]:t.SRC_ALPHA_SATURATE,[xf]:t.DST_COLOR,[_f]:t.DST_ALPHA,[gf]:t.ONE_MINUS_SRC_COLOR,[Ps]:t.ONE_MINUS_SRC_ALPHA,[Mf]:t.ONE_MINUS_DST_COLOR,[vf]:t.ONE_MINUS_DST_ALPHA,[Sf]:t.CONSTANT_COLOR,[Ef]:t.ONE_MINUS_CONSTANT_COLOR,[Tf]:t.CONSTANT_ALPHA,[bf]:t.ONE_MINUS_CONSTANT_ALPHA};function O(I,se,W,j,le,oe,Ce,rt,gt,Ye){if(I===Cn){_===!0&&(Se(t.BLEND),_=!1);return}if(_===!1&&(re(t.BLEND),_=!0),I!==cf){if(I!==p||Ye!==S){if((m!==Vn||v!==Vn)&&(t.blendEquation(t.FUNC_ADD),m=Vn,v=Vn),Ye)switch(I){case vi:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case eo:t.blendFunc(t.ONE,t.ONE);break;case to:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case no:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}else switch(I){case vi:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case eo:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case to:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case no:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}T=null,y=null,P=null,b=null,w.set(0,0,0),R=0,p=I,S=Ye}return}le=le||se,oe=oe||W,Ce=Ce||j,(se!==m||le!==v)&&(t.blendEquationSeparate(ke[se],ke[le]),m=se,v=le),(W!==T||j!==y||oe!==P||Ce!==b)&&(t.blendFuncSeparate(at[W],at[j],at[oe],at[Ce]),T=W,y=j,P=oe,b=Ce),(rt.equals(w)===!1||gt!==R)&&(t.blendColor(rt.r,rt.g,rt.b,gt),w.copy(rt),R=gt),p=I,S=!1}function Ut(I,se){I.side===Jt?Se(t.CULL_FACE):re(t.CULL_FACE);let W=I.side===Ct;se&&(W=!W),ze(W),I.blending===vi&&I.transparent===!1?O(Cn):O(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.blendColor,I.blendAlpha,I.premultipliedAlpha),a.setFunc(I.depthFunc),a.setTest(I.depthTest),a.setMask(I.depthWrite),s.setMask(I.colorWrite);const j=I.stencilWrite;o.setTest(j),j&&(o.setMask(I.stencilWriteMask),o.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),o.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),et(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),I.alphaToCoverage===!0?re(t.SAMPLE_ALPHA_TO_COVERAGE):Se(t.SAMPLE_ALPHA_TO_COVERAGE)}function ze(I){x!==I&&(I?t.frontFace(t.CW):t.frontFace(t.CCW),x=I)}function Be(I){I!==sf?(re(t.CULL_FACE),I!==C&&(I===Qa?t.cullFace(t.BACK):I===af?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Se(t.CULL_FACE),C=I}function Ee(I){I!==L&&(V&&t.lineWidth(I),L=I)}function et(I,se,W){I?(re(t.POLYGON_OFFSET_FILL),(D!==se||U!==W)&&(t.polygonOffset(se,W),D=se,U=W)):Se(t.POLYGON_OFFSET_FILL)}function ye(I){I?re(t.SCISSOR_TEST):Se(t.SCISSOR_TEST)}function A(I){I===void 0&&(I=t.TEXTURE0+X-1),te!==I&&(t.activeTexture(I),te=I)}function M(I,se,W){W===void 0&&(te===null?W=t.TEXTURE0+X-1:W=te);let j=ie[W];j===void 0&&(j={type:void 0,texture:void 0},ie[W]=j),(j.type!==I||j.texture!==se)&&(te!==W&&(t.activeTexture(W),te=W),t.bindTexture(I,se||he[I]),j.type=I,j.texture=se)}function B(){const I=ie[te];I!==void 0&&I.type!==void 0&&(t.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function Y(){try{t.compressedTexImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Z(){try{t.compressedTexImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function $(){try{t.texSubImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function xe(){try{t.texSubImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ae(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function fe(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Ve(){try{t.texStorage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function J(){try{t.texStorage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function de(){try{t.texImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Te(){try{t.texImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function be(I){Xe.equals(I)===!1&&(t.scissor(I.x,I.y,I.z,I.w),Xe.copy(I))}function ue(I){q.equals(I)===!1&&(t.viewport(I.x,I.y,I.z,I.w),q.copy(I))}function He(I,se){let W=l.get(se);W===void 0&&(W=new WeakMap,l.set(se,W));let j=W.get(I);j===void 0&&(j=t.getUniformBlockIndex(se,I.name),W.set(I,j))}function Ie(I,se){const j=l.get(se).get(I);c.get(se)!==j&&(t.uniformBlockBinding(se,j,I.__bindingPointIndex),c.set(se,j))}function Je(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),a.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),h={},te=null,ie={},f={},d=new WeakMap,u=[],g=null,_=!1,p=null,m=null,T=null,y=null,v=null,P=null,b=null,w=new Oe(0,0,0),R=0,S=!1,x=null,C=null,L=null,D=null,U=null,Xe.set(0,0,t.canvas.width,t.canvas.height),q.set(0,0,t.canvas.width,t.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:re,disable:Se,bindFramebuffer:Re,drawBuffers:Fe,useProgram:it,setBlending:O,setMaterial:Ut,setFlipSided:ze,setCullFace:Be,setLineWidth:Ee,setPolygonOffset:et,setScissorTest:ye,activeTexture:A,bindTexture:M,unbindTexture:B,compressedTexImage2D:Y,compressedTexImage3D:Z,texImage2D:de,texImage3D:Te,updateUBOMapping:He,uniformBlockBinding:Ie,texStorage2D:Ve,texStorage3D:J,texSubImage2D:$,texSubImage3D:xe,compressedTexSubImage2D:ae,compressedTexSubImage3D:fe,scissor:be,viewport:ue,reset:Je}}function Ko(t,e,n,i){const r=jm(i);switch(n){case Pc:return t*e;case Lc:return t*e;case Ic:return t*e*2;case Ta:return t*e/r.components*r.byteLength;case ba:return t*e/r.components*r.byteLength;case Uc:return t*e*2/r.components*r.byteLength;case Aa:return t*e*2/r.components*r.byteLength;case Dc:return t*e*3/r.components*r.byteLength;case qt:return t*e*4/r.components*r.byteLength;case wa:return t*e*4/r.components*r.byteLength;case Ar:case wr:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Rr:case Cr:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Gs:case Xs:return Math.max(t,16)*Math.max(e,8)/4;case Vs:case Ws:return Math.max(t,8)*Math.max(e,8)/2;case qs:case $s:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ys:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case js:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Zs:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Ks:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Js:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Qs:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case ea:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case ta:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case na:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case ia:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case ra:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case sa:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case aa:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case oa:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case ca:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Pr:case la:case ha:return Math.ceil(t/4)*Math.ceil(e/4)*16;case Nc:case fa:return Math.ceil(t/4)*Math.ceil(e/4)*8;case da:case ua:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function jm(t){switch(t){case pn:case wc:return{byteLength:1,components:1};case Xi:case Rc:case $i:return{byteLength:2,components:1};case Sa:case Ea:return{byteLength:2,components:4};case qn:case ya:case en:return{byteLength:4,components:1};case Cc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}function Zm(t,e,n,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new we,h=new WeakMap;let f;const d=new WeakMap;let u=!1;try{u=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(A,M){return u?new OffscreenCanvas(A,M):qi("canvas")}function _(A,M,B){let Y=1;const Z=ye(A);if((Z.width>B||Z.height>B)&&(Y=B/Math.max(Z.width,Z.height)),Y<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const $=Math.floor(Y*Z.width),xe=Math.floor(Y*Z.height);f===void 0&&(f=g($,xe));const ae=M?g($,xe):f;return ae.width=$,ae.height=xe,ae.getContext("2d").drawImage(A,0,0,$,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+$+"x"+xe+")."),ae}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),A;return A}function p(A){return A.generateMipmaps}function m(A){t.generateMipmap(A)}function T(A){return A.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?t.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function y(A,M,B,Y,Z=!1){if(A!==null){if(t[A]!==void 0)return t[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let $=M;if(M===t.RED&&(B===t.FLOAT&&($=t.R32F),B===t.HALF_FLOAT&&($=t.R16F),B===t.UNSIGNED_BYTE&&($=t.R8)),M===t.RED_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.R8UI),B===t.UNSIGNED_SHORT&&($=t.R16UI),B===t.UNSIGNED_INT&&($=t.R32UI),B===t.BYTE&&($=t.R8I),B===t.SHORT&&($=t.R16I),B===t.INT&&($=t.R32I)),M===t.RG&&(B===t.FLOAT&&($=t.RG32F),B===t.HALF_FLOAT&&($=t.RG16F),B===t.UNSIGNED_BYTE&&($=t.RG8)),M===t.RG_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.RG8UI),B===t.UNSIGNED_SHORT&&($=t.RG16UI),B===t.UNSIGNED_INT&&($=t.RG32UI),B===t.BYTE&&($=t.RG8I),B===t.SHORT&&($=t.RG16I),B===t.INT&&($=t.RG32I)),M===t.RGB_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.RGB8UI),B===t.UNSIGNED_SHORT&&($=t.RGB16UI),B===t.UNSIGNED_INT&&($=t.RGB32UI),B===t.BYTE&&($=t.RGB8I),B===t.SHORT&&($=t.RGB16I),B===t.INT&&($=t.RGB32I)),M===t.RGBA_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.RGBA8UI),B===t.UNSIGNED_SHORT&&($=t.RGBA16UI),B===t.UNSIGNED_INT&&($=t.RGBA32UI),B===t.BYTE&&($=t.RGBA8I),B===t.SHORT&&($=t.RGBA16I),B===t.INT&&($=t.RGBA32I)),M===t.RGB&&B===t.UNSIGNED_INT_5_9_9_9_REV&&($=t.RGB9_E5),M===t.RGBA){const xe=Z?Gr:Ge.getTransfer(Y);B===t.FLOAT&&($=t.RGBA32F),B===t.HALF_FLOAT&&($=t.RGBA16F),B===t.UNSIGNED_BYTE&&($=xe===Ze?t.SRGB8_ALPHA8:t.RGBA8),B===t.UNSIGNED_SHORT_4_4_4_4&&($=t.RGBA4),B===t.UNSIGNED_SHORT_5_5_5_1&&($=t.RGB5_A1)}return($===t.R16F||$===t.R32F||$===t.RG16F||$===t.RG32F||$===t.RGBA16F||$===t.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function v(A,M){let B;return A?M===null||M===qn||M===Ti?B=t.DEPTH24_STENCIL8:M===en?B=t.DEPTH32F_STENCIL8:M===Xi&&(B=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===qn||M===Ti?B=t.DEPTH_COMPONENT24:M===en?B=t.DEPTH_COMPONENT32F:M===Xi&&(B=t.DEPTH_COMPONENT16),B}function P(A,M){return p(A)===!0||A.isFramebufferTexture&&A.minFilter!==It&&A.minFilter!==Qt?Math.log2(Math.max(M.width,M.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?M.mipmaps.length:1}function b(A){const M=A.target;M.removeEventListener("dispose",b),R(M),M.isVideoTexture&&h.delete(M)}function w(A){const M=A.target;M.removeEventListener("dispose",w),x(M)}function R(A){const M=i.get(A);if(M.__webglInit===void 0)return;const B=A.source,Y=d.get(B);if(Y){const Z=Y[M.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&S(A),Object.keys(Y).length===0&&d.delete(B)}i.remove(A)}function S(A){const M=i.get(A);t.deleteTexture(M.__webglTexture);const B=A.source,Y=d.get(B);delete Y[M.__cacheKey],a.memory.textures--}function x(A){const M=i.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),i.remove(A.depthTexture)),A.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(M.__webglFramebuffer[Y]))for(let Z=0;Z<M.__webglFramebuffer[Y].length;Z++)t.deleteFramebuffer(M.__webglFramebuffer[Y][Z]);else t.deleteFramebuffer(M.__webglFramebuffer[Y]);M.__webglDepthbuffer&&t.deleteRenderbuffer(M.__webglDepthbuffer[Y])}else{if(Array.isArray(M.__webglFramebuffer))for(let Y=0;Y<M.__webglFramebuffer.length;Y++)t.deleteFramebuffer(M.__webglFramebuffer[Y]);else t.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&t.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&t.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let Y=0;Y<M.__webglColorRenderbuffer.length;Y++)M.__webglColorRenderbuffer[Y]&&t.deleteRenderbuffer(M.__webglColorRenderbuffer[Y]);M.__webglDepthRenderbuffer&&t.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const B=A.textures;for(let Y=0,Z=B.length;Y<Z;Y++){const $=i.get(B[Y]);$.__webglTexture&&(t.deleteTexture($.__webglTexture),a.memory.textures--),i.remove(B[Y])}i.remove(A)}let C=0;function L(){C=0}function D(){const A=C;return A>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+r.maxTextures),C+=1,A}function U(A){const M=[];return M.push(A.wrapS),M.push(A.wrapT),M.push(A.wrapR||0),M.push(A.magFilter),M.push(A.minFilter),M.push(A.anisotropy),M.push(A.internalFormat),M.push(A.format),M.push(A.type),M.push(A.generateMipmaps),M.push(A.premultiplyAlpha),M.push(A.flipY),M.push(A.unpackAlignment),M.push(A.colorSpace),M.join()}function X(A,M){const B=i.get(A);if(A.isVideoTexture&&Ee(A),A.isRenderTargetTexture===!1&&A.version>0&&B.__version!==A.version){const Y=A.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{q(B,A,M);return}}n.bindTexture(t.TEXTURE_2D,B.__webglTexture,t.TEXTURE0+M)}function V(A,M){const B=i.get(A);if(A.version>0&&B.__version!==A.version){q(B,A,M);return}n.bindTexture(t.TEXTURE_2D_ARRAY,B.__webglTexture,t.TEXTURE0+M)}function K(A,M){const B=i.get(A);if(A.version>0&&B.__version!==A.version){q(B,A,M);return}n.bindTexture(t.TEXTURE_3D,B.__webglTexture,t.TEXTURE0+M)}function G(A,M){const B=i.get(A);if(A.version>0&&B.__version!==A.version){Q(B,A,M);return}n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture,t.TEXTURE0+M)}const te={[Hs]:t.REPEAT,[Wn]:t.CLAMP_TO_EDGE,[ks]:t.MIRRORED_REPEAT},ie={[It]:t.NEAREST,[Nf]:t.NEAREST_MIPMAP_NEAREST,[Ji]:t.NEAREST_MIPMAP_LINEAR,[Qt]:t.LINEAR,[Zr]:t.LINEAR_MIPMAP_NEAREST,[Xn]:t.LINEAR_MIPMAP_LINEAR},ve={[Hf]:t.NEVER,[qf]:t.ALWAYS,[kf]:t.LESS,[Fc]:t.LEQUAL,[Vf]:t.EQUAL,[Xf]:t.GEQUAL,[Gf]:t.GREATER,[Wf]:t.NOTEQUAL};function Le(A,M){if(M.type===en&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===Qt||M.magFilter===Zr||M.magFilter===Ji||M.magFilter===Xn||M.minFilter===Qt||M.minFilter===Zr||M.minFilter===Ji||M.minFilter===Xn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(A,t.TEXTURE_WRAP_S,te[M.wrapS]),t.texParameteri(A,t.TEXTURE_WRAP_T,te[M.wrapT]),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,te[M.wrapR]),t.texParameteri(A,t.TEXTURE_MAG_FILTER,ie[M.magFilter]),t.texParameteri(A,t.TEXTURE_MIN_FILTER,ie[M.minFilter]),M.compareFunction&&(t.texParameteri(A,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(A,t.TEXTURE_COMPARE_FUNC,ve[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===It||M.minFilter!==Ji&&M.minFilter!==Xn||M.type===en&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||i.get(M).__currentAnisotropy){const B=e.get("EXT_texture_filter_anisotropic");t.texParameterf(A,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy}}}function Xe(A,M){let B=!1;A.__webglInit===void 0&&(A.__webglInit=!0,M.addEventListener("dispose",b));const Y=M.source;let Z=d.get(Y);Z===void 0&&(Z={},d.set(Y,Z));const $=U(M);if($!==A.__cacheKey){Z[$]===void 0&&(Z[$]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,B=!0),Z[$].usedTimes++;const xe=Z[A.__cacheKey];xe!==void 0&&(Z[A.__cacheKey].usedTimes--,xe.usedTimes===0&&S(M)),A.__cacheKey=$,A.__webglTexture=Z[$].texture}return B}function q(A,M,B){let Y=t.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(Y=t.TEXTURE_2D_ARRAY),M.isData3DTexture&&(Y=t.TEXTURE_3D);const Z=Xe(A,M),$=M.source;n.bindTexture(Y,A.__webglTexture,t.TEXTURE0+B);const xe=i.get($);if($.version!==xe.__version||Z===!0){n.activeTexture(t.TEXTURE0+B);const ae=Ge.getPrimaries(Ge.workingColorSpace),fe=M.colorSpace===Rn?null:Ge.getPrimaries(M.colorSpace),Ve=M.colorSpace===Rn||ae===fe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ve);let J=_(M.image,!1,r.maxTextureSize);J=et(M,J);const de=s.convert(M.format,M.colorSpace),Te=s.convert(M.type);let be=y(M.internalFormat,de,Te,M.colorSpace,M.isVideoTexture);Le(Y,M);let ue;const He=M.mipmaps,Ie=M.isVideoTexture!==!0,Je=xe.__version===void 0||Z===!0,I=$.dataReady,se=P(M,J);if(M.isDepthTexture)be=v(M.format===bi,M.type),Je&&(Ie?n.texStorage2D(t.TEXTURE_2D,1,be,J.width,J.height):n.texImage2D(t.TEXTURE_2D,0,be,J.width,J.height,0,de,Te,null));else if(M.isDataTexture)if(He.length>0){Ie&&Je&&n.texStorage2D(t.TEXTURE_2D,se,be,He[0].width,He[0].height);for(let W=0,j=He.length;W<j;W++)ue=He[W],Ie?I&&n.texSubImage2D(t.TEXTURE_2D,W,0,0,ue.width,ue.height,de,Te,ue.data):n.texImage2D(t.TEXTURE_2D,W,be,ue.width,ue.height,0,de,Te,ue.data);M.generateMipmaps=!1}else Ie?(Je&&n.texStorage2D(t.TEXTURE_2D,se,be,J.width,J.height),I&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,J.width,J.height,de,Te,J.data)):n.texImage2D(t.TEXTURE_2D,0,be,J.width,J.height,0,de,Te,J.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){Ie&&Je&&n.texStorage3D(t.TEXTURE_2D_ARRAY,se,be,He[0].width,He[0].height,J.depth);for(let W=0,j=He.length;W<j;W++)if(ue=He[W],M.format!==qt)if(de!==null)if(Ie){if(I)if(M.layerUpdates.size>0){const le=Ko(ue.width,ue.height,M.format,M.type);for(const oe of M.layerUpdates){const Ce=ue.data.subarray(oe*le/ue.data.BYTES_PER_ELEMENT,(oe+1)*le/ue.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,W,0,0,oe,ue.width,ue.height,1,de,Ce)}M.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,W,0,0,0,ue.width,ue.height,J.depth,de,ue.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,W,be,ue.width,ue.height,J.depth,0,ue.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ie?I&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,W,0,0,0,ue.width,ue.height,J.depth,de,Te,ue.data):n.texImage3D(t.TEXTURE_2D_ARRAY,W,be,ue.width,ue.height,J.depth,0,de,Te,ue.data)}else{Ie&&Je&&n.texStorage2D(t.TEXTURE_2D,se,be,He[0].width,He[0].height);for(let W=0,j=He.length;W<j;W++)ue=He[W],M.format!==qt?de!==null?Ie?I&&n.compressedTexSubImage2D(t.TEXTURE_2D,W,0,0,ue.width,ue.height,de,ue.data):n.compressedTexImage2D(t.TEXTURE_2D,W,be,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ie?I&&n.texSubImage2D(t.TEXTURE_2D,W,0,0,ue.width,ue.height,de,Te,ue.data):n.texImage2D(t.TEXTURE_2D,W,be,ue.width,ue.height,0,de,Te,ue.data)}else if(M.isDataArrayTexture)if(Ie){if(Je&&n.texStorage3D(t.TEXTURE_2D_ARRAY,se,be,J.width,J.height,J.depth),I)if(M.layerUpdates.size>0){const W=Ko(J.width,J.height,M.format,M.type);for(const j of M.layerUpdates){const le=J.data.subarray(j*W/J.data.BYTES_PER_ELEMENT,(j+1)*W/J.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,j,J.width,J.height,1,de,Te,le)}M.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,de,Te,J.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,be,J.width,J.height,J.depth,0,de,Te,J.data);else if(M.isData3DTexture)Ie?(Je&&n.texStorage3D(t.TEXTURE_3D,se,be,J.width,J.height,J.depth),I&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,de,Te,J.data)):n.texImage3D(t.TEXTURE_3D,0,be,J.width,J.height,J.depth,0,de,Te,J.data);else if(M.isFramebufferTexture){if(Je)if(Ie)n.texStorage2D(t.TEXTURE_2D,se,be,J.width,J.height);else{let W=J.width,j=J.height;for(let le=0;le<se;le++)n.texImage2D(t.TEXTURE_2D,le,be,W,j,0,de,Te,null),W>>=1,j>>=1}}else if(He.length>0){if(Ie&&Je){const W=ye(He[0]);n.texStorage2D(t.TEXTURE_2D,se,be,W.width,W.height)}for(let W=0,j=He.length;W<j;W++)ue=He[W],Ie?I&&n.texSubImage2D(t.TEXTURE_2D,W,0,0,de,Te,ue):n.texImage2D(t.TEXTURE_2D,W,be,de,Te,ue);M.generateMipmaps=!1}else if(Ie){if(Je){const W=ye(J);n.texStorage2D(t.TEXTURE_2D,se,be,W.width,W.height)}I&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,de,Te,J)}else n.texImage2D(t.TEXTURE_2D,0,be,de,Te,J);p(M)&&m(Y),xe.__version=$.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function Q(A,M,B){if(M.image.length!==6)return;const Y=Xe(A,M),Z=M.source;n.bindTexture(t.TEXTURE_CUBE_MAP,A.__webglTexture,t.TEXTURE0+B);const $=i.get(Z);if(Z.version!==$.__version||Y===!0){n.activeTexture(t.TEXTURE0+B);const xe=Ge.getPrimaries(Ge.workingColorSpace),ae=M.colorSpace===Rn?null:Ge.getPrimaries(M.colorSpace),fe=M.colorSpace===Rn||xe===ae?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,fe);const Ve=M.isCompressedTexture||M.image[0].isCompressedTexture,J=M.image[0]&&M.image[0].isDataTexture,de=[];for(let j=0;j<6;j++)!Ve&&!J?de[j]=_(M.image[j],!0,r.maxCubemapSize):de[j]=J?M.image[j].image:M.image[j],de[j]=et(M,de[j]);const Te=de[0],be=s.convert(M.format,M.colorSpace),ue=s.convert(M.type),He=y(M.internalFormat,be,ue,M.colorSpace),Ie=M.isVideoTexture!==!0,Je=$.__version===void 0||Y===!0,I=Z.dataReady;let se=P(M,Te);Le(t.TEXTURE_CUBE_MAP,M);let W;if(Ve){Ie&&Je&&n.texStorage2D(t.TEXTURE_CUBE_MAP,se,He,Te.width,Te.height);for(let j=0;j<6;j++){W=de[j].mipmaps;for(let le=0;le<W.length;le++){const oe=W[le];M.format!==qt?be!==null?Ie?I&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,0,0,oe.width,oe.height,be,oe.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,He,oe.width,oe.height,0,oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,0,0,oe.width,oe.height,be,ue,oe.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,He,oe.width,oe.height,0,be,ue,oe.data)}}}else{if(W=M.mipmaps,Ie&&Je){W.length>0&&se++;const j=ye(de[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,se,He,j.width,j.height)}for(let j=0;j<6;j++)if(J){Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,de[j].width,de[j].height,be,ue,de[j].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,He,de[j].width,de[j].height,0,be,ue,de[j].data);for(let le=0;le<W.length;le++){const Ce=W[le].image[j].image;Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,0,0,Ce.width,Ce.height,be,ue,Ce.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,He,Ce.width,Ce.height,0,be,ue,Ce.data)}}else{Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,be,ue,de[j]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,He,be,ue,de[j]);for(let le=0;le<W.length;le++){const oe=W[le];Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,0,0,be,ue,oe.image[j]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,He,be,ue,oe.image[j])}}}p(M)&&m(t.TEXTURE_CUBE_MAP),$.__version=Z.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function he(A,M,B,Y,Z,$){const xe=s.convert(B.format,B.colorSpace),ae=s.convert(B.type),fe=y(B.internalFormat,xe,ae,B.colorSpace),Ve=i.get(M),J=i.get(B);if(J.__renderTarget=M,!Ve.__hasExternalTextures){const de=Math.max(1,M.width>>$),Te=Math.max(1,M.height>>$);Z===t.TEXTURE_3D||Z===t.TEXTURE_2D_ARRAY?n.texImage3D(Z,$,fe,de,Te,M.depth,0,xe,ae,null):n.texImage2D(Z,$,fe,de,Te,0,xe,ae,null)}n.bindFramebuffer(t.FRAMEBUFFER,A),Be(M)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Y,Z,J.__webglTexture,0,ze(M)):(Z===t.TEXTURE_2D||Z>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Y,Z,J.__webglTexture,$),n.bindFramebuffer(t.FRAMEBUFFER,null)}function re(A,M,B){if(t.bindRenderbuffer(t.RENDERBUFFER,A),M.depthBuffer){const Y=M.depthTexture,Z=Y&&Y.isDepthTexture?Y.type:null,$=v(M.stencilBuffer,Z),xe=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ae=ze(M);Be(M)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ae,$,M.width,M.height):B?t.renderbufferStorageMultisample(t.RENDERBUFFER,ae,$,M.width,M.height):t.renderbufferStorage(t.RENDERBUFFER,$,M.width,M.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,xe,t.RENDERBUFFER,A)}else{const Y=M.textures;for(let Z=0;Z<Y.length;Z++){const $=Y[Z],xe=s.convert($.format,$.colorSpace),ae=s.convert($.type),fe=y($.internalFormat,xe,ae,$.colorSpace),Ve=ze(M);B&&Be(M)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Ve,fe,M.width,M.height):Be(M)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Ve,fe,M.width,M.height):t.renderbufferStorage(t.RENDERBUFFER,fe,M.width,M.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Se(A,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,A),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Y=i.get(M.depthTexture);Y.__renderTarget=M,(!Y.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),X(M.depthTexture,0);const Z=Y.__webglTexture,$=ze(M);if(M.depthTexture.format===xi)Be(M)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Z,0,$):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Z,0);else if(M.depthTexture.format===bi)Be(M)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Z,0,$):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Z,0);else throw new Error("Unknown depthTexture format")}function Re(A){const M=i.get(A),B=A.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==A.depthTexture){const Y=A.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),Y){const Z=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,Y.removeEventListener("dispose",Z)};Y.addEventListener("dispose",Z),M.__depthDisposeCallback=Z}M.__boundDepthTexture=Y}if(A.depthTexture&&!M.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");Se(M.__webglFramebuffer,A)}else if(B){M.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(n.bindFramebuffer(t.FRAMEBUFFER,M.__webglFramebuffer[Y]),M.__webglDepthbuffer[Y]===void 0)M.__webglDepthbuffer[Y]=t.createRenderbuffer(),re(M.__webglDepthbuffer[Y],A,!1);else{const Z=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,$=M.__webglDepthbuffer[Y];t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,Z,t.RENDERBUFFER,$)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=t.createRenderbuffer(),re(M.__webglDepthbuffer,A,!1);else{const Y=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Z=M.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,Z),t.framebufferRenderbuffer(t.FRAMEBUFFER,Y,t.RENDERBUFFER,Z)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Fe(A,M,B){const Y=i.get(A);M!==void 0&&he(Y.__webglFramebuffer,A,A.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),B!==void 0&&Re(A)}function it(A){const M=A.texture,B=i.get(A),Y=i.get(M);A.addEventListener("dispose",w);const Z=A.textures,$=A.isWebGLCubeRenderTarget===!0,xe=Z.length>1;if(xe||(Y.__webglTexture===void 0&&(Y.__webglTexture=t.createTexture()),Y.__version=M.version,a.memory.textures++),$){B.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0){B.__webglFramebuffer[ae]=[];for(let fe=0;fe<M.mipmaps.length;fe++)B.__webglFramebuffer[ae][fe]=t.createFramebuffer()}else B.__webglFramebuffer[ae]=t.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){B.__webglFramebuffer=[];for(let ae=0;ae<M.mipmaps.length;ae++)B.__webglFramebuffer[ae]=t.createFramebuffer()}else B.__webglFramebuffer=t.createFramebuffer();if(xe)for(let ae=0,fe=Z.length;ae<fe;ae++){const Ve=i.get(Z[ae]);Ve.__webglTexture===void 0&&(Ve.__webglTexture=t.createTexture(),a.memory.textures++)}if(A.samples>0&&Be(A)===!1){B.__webglMultisampledFramebuffer=t.createFramebuffer(),B.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let ae=0;ae<Z.length;ae++){const fe=Z[ae];B.__webglColorRenderbuffer[ae]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,B.__webglColorRenderbuffer[ae]);const Ve=s.convert(fe.format,fe.colorSpace),J=s.convert(fe.type),de=y(fe.internalFormat,Ve,J,fe.colorSpace,A.isXRRenderTarget===!0),Te=ze(A);t.renderbufferStorageMultisample(t.RENDERBUFFER,Te,de,A.width,A.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ae,t.RENDERBUFFER,B.__webglColorRenderbuffer[ae])}t.bindRenderbuffer(t.RENDERBUFFER,null),A.depthBuffer&&(B.__webglDepthRenderbuffer=t.createRenderbuffer(),re(B.__webglDepthRenderbuffer,A,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if($){n.bindTexture(t.TEXTURE_CUBE_MAP,Y.__webglTexture),Le(t.TEXTURE_CUBE_MAP,M);for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0)for(let fe=0;fe<M.mipmaps.length;fe++)he(B.__webglFramebuffer[ae][fe],A,M,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ae,fe);else he(B.__webglFramebuffer[ae],A,M,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);p(M)&&m(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(xe){for(let ae=0,fe=Z.length;ae<fe;ae++){const Ve=Z[ae],J=i.get(Ve);n.bindTexture(t.TEXTURE_2D,J.__webglTexture),Le(t.TEXTURE_2D,Ve),he(B.__webglFramebuffer,A,Ve,t.COLOR_ATTACHMENT0+ae,t.TEXTURE_2D,0),p(Ve)&&m(t.TEXTURE_2D)}n.unbindTexture()}else{let ae=t.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(ae=A.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ae,Y.__webglTexture),Le(ae,M),M.mipmaps&&M.mipmaps.length>0)for(let fe=0;fe<M.mipmaps.length;fe++)he(B.__webglFramebuffer[fe],A,M,t.COLOR_ATTACHMENT0,ae,fe);else he(B.__webglFramebuffer,A,M,t.COLOR_ATTACHMENT0,ae,0);p(M)&&m(ae),n.unbindTexture()}A.depthBuffer&&Re(A)}function ke(A){const M=A.textures;for(let B=0,Y=M.length;B<Y;B++){const Z=M[B];if(p(Z)){const $=T(A),xe=i.get(Z).__webglTexture;n.bindTexture($,xe),m($),n.unbindTexture()}}}const at=[],O=[];function Ut(A){if(A.samples>0){if(Be(A)===!1){const M=A.textures,B=A.width,Y=A.height;let Z=t.COLOR_BUFFER_BIT;const $=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,xe=i.get(A),ae=M.length>1;if(ae)for(let fe=0;fe<M.length;fe++)n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,xe.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,xe.__webglFramebuffer);for(let fe=0;fe<M.length;fe++){if(A.resolveDepthBuffer&&(A.depthBuffer&&(Z|=t.DEPTH_BUFFER_BIT),A.stencilBuffer&&A.resolveStencilBuffer&&(Z|=t.STENCIL_BUFFER_BIT)),ae){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,xe.__webglColorRenderbuffer[fe]);const Ve=i.get(M[fe]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ve,0)}t.blitFramebuffer(0,0,B,Y,0,0,B,Y,Z,t.NEAREST),c===!0&&(at.length=0,O.length=0,at.push(t.COLOR_ATTACHMENT0+fe),A.depthBuffer&&A.resolveDepthBuffer===!1&&(at.push($),O.push($),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,O)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,at))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),ae)for(let fe=0;fe<M.length;fe++){n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.RENDERBUFFER,xe.__webglColorRenderbuffer[fe]);const Ve=i.get(M[fe]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.TEXTURE_2D,Ve,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,xe.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.resolveDepthBuffer===!1&&c){const M=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[M])}}}function ze(A){return Math.min(r.maxSamples,A.samples)}function Be(A){const M=i.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Ee(A){const M=a.render.frame;h.get(A)!==M&&(h.set(A,M),A.update())}function et(A,M){const B=A.colorSpace,Y=A.format,Z=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||B!==Ri&&B!==Rn&&(Ge.getTransfer(B)===Ze?(Y!==qt||Z!==pn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),M}function ye(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(l.width=A.naturalWidth||A.width,l.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(l.width=A.displayWidth,l.height=A.displayHeight):(l.width=A.width,l.height=A.height),l}this.allocateTextureUnit=D,this.resetTextureUnits=L,this.setTexture2D=X,this.setTexture2DArray=V,this.setTexture3D=K,this.setTextureCube=G,this.rebindTextures=Fe,this.setupRenderTarget=it,this.updateRenderTargetMipmap=ke,this.updateMultisampleRenderTarget=Ut,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=he,this.useMultisampledRTT=Be}function Km(t,e){function n(i,r=Rn){let s;const a=Ge.getTransfer(r);if(i===pn)return t.UNSIGNED_BYTE;if(i===Sa)return t.UNSIGNED_SHORT_4_4_4_4;if(i===Ea)return t.UNSIGNED_SHORT_5_5_5_1;if(i===Cc)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===wc)return t.BYTE;if(i===Rc)return t.SHORT;if(i===Xi)return t.UNSIGNED_SHORT;if(i===ya)return t.INT;if(i===qn)return t.UNSIGNED_INT;if(i===en)return t.FLOAT;if(i===$i)return t.HALF_FLOAT;if(i===Pc)return t.ALPHA;if(i===Dc)return t.RGB;if(i===qt)return t.RGBA;if(i===Lc)return t.LUMINANCE;if(i===Ic)return t.LUMINANCE_ALPHA;if(i===xi)return t.DEPTH_COMPONENT;if(i===bi)return t.DEPTH_STENCIL;if(i===Ta)return t.RED;if(i===ba)return t.RED_INTEGER;if(i===Uc)return t.RG;if(i===Aa)return t.RG_INTEGER;if(i===wa)return t.RGBA_INTEGER;if(i===Ar||i===wr||i===Rr||i===Cr)if(a===Ze)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ar)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===wr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Rr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ar)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===wr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Rr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Cr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Vs||i===Gs||i===Ws||i===Xs)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Vs)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Gs)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ws)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Xs)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===qs||i===$s||i===Ys)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===qs||i===$s)return a===Ze?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Ys)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===js||i===Zs||i===Ks||i===Js||i===Qs||i===ea||i===ta||i===na||i===ia||i===ra||i===sa||i===aa||i===oa||i===ca)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===js)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Zs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Ks)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Js)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Qs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ea)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===ta)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===na)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ia)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===ra)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===sa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===aa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===oa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===ca)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Pr||i===la||i===ha)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Pr)return a===Ze?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===la)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ha)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Nc||i===fa||i===da||i===ua)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Pr)return s.COMPRESSED_RED_RGTC1_EXT;if(i===fa)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===da)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===ua)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ti?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}class Jm extends zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class xt extends ut{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Qm={type:"move"};class Ts{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xt,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 xt,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xt,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new z),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,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,n,i){let r=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const _ of e.hand.values()){const p=n.getJointPose(_,i),m=this._getHandJoint(l,_);p!==null&&(m.matrix.fromArray(p.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=p.radius),m.visible=p!==null}const h=l.joints["index-finger-tip"],f=l.joints["thumb-tip"],d=h.position.distanceTo(f.position),u=.02,g=.005;l.inputState.pinching&&d>u+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=u-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(r=n.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(Qm)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new xt;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}const e1=`
|
|
3804
|
+
}`;function X0(t,e,n){let i=new Ca;const r=new we,s=new we,a=new st,o=new k0({depthPacking:Ff}),c=new V0,l={},h=n.maxTextureSize,f={[Dn]:Ct,[Ct]:Dn,[Jt]:Jt},d=new Yt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new we},radius:{value:4}},vertexShader:G0,fragmentShader:W0}),u=d.clone();u.defines.HORIZONTAL_PASS=1;const g=new pt;g.setAttribute("position",new Bt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Rt(g,d),p=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Tc;let m=this.type;this.render=function(b,w,R){if(p.enabled===!1||p.autoUpdate===!1&&p.needsUpdate===!1||b.length===0)return;const S=t.getRenderTarget(),x=t.getActiveCubeFace(),C=t.getActiveMipmapLevel(),L=t.state;L.setBlending(Cn),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const D=m!==hn&&this.type===hn,U=m===hn&&this.type!==hn;for(let X=0,V=b.length;X<V;X++){const K=b[X],G=K.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",K,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const te=G.getFrameExtents();if(r.multiply(te),s.copy(G.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/te.x),r.x=s.x*te.x,G.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/te.y),r.y=s.y*te.y,G.mapSize.y=s.y)),G.map===null||D===!0||U===!0){const ve=this.type!==hn?{minFilter:It,magFilter:It}:{};G.map!==null&&G.map.dispose(),G.map=new $n(r.x,r.y,ve),G.map.texture.name=K.name+".shadowMap",G.camera.updateProjectionMatrix()}t.setRenderTarget(G.map),t.clear();const ie=G.getViewportCount();for(let ve=0;ve<ie;ve++){const Le=G.getViewport(ve);a.set(s.x*Le.x,s.y*Le.y,s.x*Le.z,s.y*Le.w),L.viewport(a),G.updateMatrices(K,ve),i=G.getFrustum(),v(w,R,G.camera,K,this.type)}G.isPointLightShadow!==!0&&this.type===hn&&T(G,R),G.needsUpdate=!1}m=this.type,p.needsUpdate=!1,t.setRenderTarget(S,x,C)};function T(b,w){const R=e.update(_);d.defines.VSM_SAMPLES!==b.blurSamples&&(d.defines.VSM_SAMPLES=b.blurSamples,u.defines.VSM_SAMPLES=b.blurSamples,d.needsUpdate=!0,u.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new $n(r.x,r.y)),d.uniforms.shadow_pass.value=b.map.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,t.setRenderTarget(b.mapPass),t.clear(),t.renderBufferDirect(w,null,R,d,_,null),u.uniforms.shadow_pass.value=b.mapPass.texture,u.uniforms.resolution.value=b.mapSize,u.uniforms.radius.value=b.radius,t.setRenderTarget(b.map),t.clear(),t.renderBufferDirect(w,null,R,u,_,null)}function y(b,w,R,S){let x=null;const C=R.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0)x=C;else if(x=R.isPointLight===!0?c:o,t.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const L=x.uuid,D=w.uuid;let U=l[L];U===void 0&&(U={},l[L]=U);let X=U[D];X===void 0&&(X=x.clone(),U[D]=X,w.addEventListener("dispose",P)),x=X}if(x.visible=w.visible,x.wireframe=w.wireframe,S===hn?x.side=w.shadowSide!==null?w.shadowSide:w.side:x.side=w.shadowSide!==null?w.shadowSide:f[w.side],x.alphaMap=w.alphaMap,x.alphaTest=w.alphaTest,x.map=w.map,x.clipShadows=w.clipShadows,x.clippingPlanes=w.clippingPlanes,x.clipIntersection=w.clipIntersection,x.displacementMap=w.displacementMap,x.displacementScale=w.displacementScale,x.displacementBias=w.displacementBias,x.wireframeLinewidth=w.wireframeLinewidth,x.linewidth=w.linewidth,R.isPointLight===!0&&x.isMeshDistanceMaterial===!0){const L=t.properties.get(x);L.light=R}return x}function v(b,w,R,S,x){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&x===hn)&&(!b.frustumCulled||i.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,b.matrixWorld);const D=e.update(b),U=b.material;if(Array.isArray(U)){const X=D.groups;for(let V=0,K=X.length;V<K;V++){const G=X[V],te=U[G.materialIndex];if(te&&te.visible){const ie=y(b,te,S,x);b.onBeforeShadow(t,b,w,R,D,ie,G),t.renderBufferDirect(R,null,D,ie,b,G),b.onAfterShadow(t,b,w,R,D,ie,G)}}}else if(U.visible){const X=y(b,U,S,x);b.onBeforeShadow(t,b,w,R,D,X,null),t.renderBufferDirect(R,null,D,X,b,null),b.onAfterShadow(t,b,w,R,D,X,null)}}const L=b.children;for(let D=0,U=L.length;D<U;D++)v(L[D],w,R,S,x)}function P(b){b.target.removeEventListener("dispose",P);for(const R in l){const S=l[R],x=b.target.uuid;x in S&&(S[x].dispose(),delete S[x])}}}const q0={[Ds]:Ls,[Is]:Fs,[Us]:Os,[yi]:Ns,[Ls]:Ds,[Fs]:Is,[Os]:Us,[Ns]:yi};function $0(t,e){function n(){let I=!1;const se=new st;let W=null;const j=new st(0,0,0,0);return{setMask:function(le){W!==le&&!I&&(t.colorMask(le,le,le,le),W=le)},setLocked:function(le){I=le},setClear:function(le,oe,Ce,rt,gt){gt===!0&&(le*=rt,oe*=rt,Ce*=rt),se.set(le,oe,Ce,rt),j.equals(se)===!1&&(t.clearColor(le,oe,Ce,rt),j.copy(se))},reset:function(){I=!1,W=null,j.set(-1,0,0,0)}}}function i(){let I=!1,se=!1,W=null,j=null,le=null;return{setReversed:function(oe){if(se!==oe){const Ce=e.get("EXT_clip_control");se?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT);const rt=le;le=null,this.setClear(rt)}se=oe},getReversed:function(){return se},setTest:function(oe){oe?re(t.DEPTH_TEST):Se(t.DEPTH_TEST)},setMask:function(oe){W!==oe&&!I&&(t.depthMask(oe),W=oe)},setFunc:function(oe){if(se&&(oe=q0[oe]),j!==oe){switch(oe){case Ds:t.depthFunc(t.NEVER);break;case Ls:t.depthFunc(t.ALWAYS);break;case Is:t.depthFunc(t.LESS);break;case yi:t.depthFunc(t.LEQUAL);break;case Us:t.depthFunc(t.EQUAL);break;case Ns:t.depthFunc(t.GEQUAL);break;case Fs:t.depthFunc(t.GREATER);break;case Os:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}j=oe}},setLocked:function(oe){I=oe},setClear:function(oe){le!==oe&&(se&&(oe=1-oe),t.clearDepth(oe),le=oe)},reset:function(){I=!1,W=null,j=null,le=null,se=!1}}}function r(){let I=!1,se=null,W=null,j=null,le=null,oe=null,Ce=null,rt=null,gt=null;return{setTest:function(Ye){I||(Ye?re(t.STENCIL_TEST):Se(t.STENCIL_TEST))},setMask:function(Ye){se!==Ye&&!I&&(t.stencilMask(Ye),se=Ye)},setFunc:function(Ye,Ht,nn){(W!==Ye||j!==Ht||le!==nn)&&(t.stencilFunc(Ye,Ht,nn),W=Ye,j=Ht,le=nn)},setOp:function(Ye,Ht,nn){(oe!==Ye||Ce!==Ht||rt!==nn)&&(t.stencilOp(Ye,Ht,nn),oe=Ye,Ce=Ht,rt=nn)},setLocked:function(Ye){I=Ye},setClear:function(Ye){gt!==Ye&&(t.clearStencil(Ye),gt=Ye)},reset:function(){I=!1,se=null,W=null,j=null,le=null,oe=null,Ce=null,rt=null,gt=null}}}const s=new n,a=new i,o=new r,c=new WeakMap,l=new WeakMap;let h={},f={},d=new WeakMap,u=[],g=null,_=!1,p=null,m=null,T=null,y=null,v=null,P=null,b=null,w=new Oe(0,0,0),R=0,S=!1,x=null,C=null,L=null,D=null,U=null;const X=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,K=0;const G=t.getParameter(t.VERSION);G.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(G)[1]),V=K>=1):G.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),V=K>=2);let te=null,ie={};const ve=t.getParameter(t.SCISSOR_BOX),Le=t.getParameter(t.VIEWPORT),Xe=new st().fromArray(ve),q=new st().fromArray(Le);function Q(I,se,W,j){const le=new Uint8Array(4),oe=t.createTexture();t.bindTexture(I,oe),t.texParameteri(I,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(I,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ce=0;Ce<W;Ce++)I===t.TEXTURE_3D||I===t.TEXTURE_2D_ARRAY?t.texImage3D(se,0,t.RGBA,1,1,j,0,t.RGBA,t.UNSIGNED_BYTE,le):t.texImage2D(se+Ce,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,le);return oe}const he={};he[t.TEXTURE_2D]=Q(t.TEXTURE_2D,t.TEXTURE_2D,1),he[t.TEXTURE_CUBE_MAP]=Q(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),he[t.TEXTURE_2D_ARRAY]=Q(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),he[t.TEXTURE_3D]=Q(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),re(t.DEPTH_TEST),a.setFunc(yi),ze(!1),Be(Qa),re(t.CULL_FACE),O(Cn);function re(I){h[I]!==!0&&(t.enable(I),h[I]=!0)}function Se(I){h[I]!==!1&&(t.disable(I),h[I]=!1)}function Re(I,se){return f[I]!==se?(t.bindFramebuffer(I,se),f[I]=se,I===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=se),I===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=se),!0):!1}function Fe(I,se){let W=u,j=!1;if(I){W=d.get(se),W===void 0&&(W=[],d.set(se,W));const le=I.textures;if(W.length!==le.length||W[0]!==t.COLOR_ATTACHMENT0){for(let oe=0,Ce=le.length;oe<Ce;oe++)W[oe]=t.COLOR_ATTACHMENT0+oe;W.length=le.length,j=!0}}else W[0]!==t.BACK&&(W[0]=t.BACK,j=!0);j&&t.drawBuffers(W)}function it(I){return g!==I?(t.useProgram(I),g=I,!0):!1}const ke={[Vn]:t.FUNC_ADD,[cf]:t.FUNC_SUBTRACT,[lf]:t.FUNC_REVERSE_SUBTRACT};ke[hf]=t.MIN,ke[ff]=t.MAX;const at={[df]:t.ZERO,[uf]:t.ONE,[pf]:t.SRC_COLOR,[Cs]:t.SRC_ALPHA,[Mf]:t.SRC_ALPHA_SATURATE,[vf]:t.DST_COLOR,[gf]:t.DST_ALPHA,[mf]:t.ONE_MINUS_SRC_COLOR,[Ps]:t.ONE_MINUS_SRC_ALPHA,[xf]:t.ONE_MINUS_DST_COLOR,[_f]:t.ONE_MINUS_DST_ALPHA,[yf]:t.CONSTANT_COLOR,[Sf]:t.ONE_MINUS_CONSTANT_COLOR,[Ef]:t.CONSTANT_ALPHA,[Tf]:t.ONE_MINUS_CONSTANT_ALPHA};function O(I,se,W,j,le,oe,Ce,rt,gt,Ye){if(I===Cn){_===!0&&(Se(t.BLEND),_=!1);return}if(_===!1&&(re(t.BLEND),_=!0),I!==of){if(I!==p||Ye!==S){if((m!==Vn||v!==Vn)&&(t.blendEquation(t.FUNC_ADD),m=Vn,v=Vn),Ye)switch(I){case vi:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case eo:t.blendFunc(t.ONE,t.ONE);break;case to:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case no:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}else switch(I){case vi:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case eo:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case to:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case no:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}T=null,y=null,P=null,b=null,w.set(0,0,0),R=0,p=I,S=Ye}return}le=le||se,oe=oe||W,Ce=Ce||j,(se!==m||le!==v)&&(t.blendEquationSeparate(ke[se],ke[le]),m=se,v=le),(W!==T||j!==y||oe!==P||Ce!==b)&&(t.blendFuncSeparate(at[W],at[j],at[oe],at[Ce]),T=W,y=j,P=oe,b=Ce),(rt.equals(w)===!1||gt!==R)&&(t.blendColor(rt.r,rt.g,rt.b,gt),w.copy(rt),R=gt),p=I,S=!1}function Ut(I,se){I.side===Jt?Se(t.CULL_FACE):re(t.CULL_FACE);let W=I.side===Ct;se&&(W=!W),ze(W),I.blending===vi&&I.transparent===!1?O(Cn):O(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.blendColor,I.blendAlpha,I.premultipliedAlpha),a.setFunc(I.depthFunc),a.setTest(I.depthTest),a.setMask(I.depthWrite),s.setMask(I.colorWrite);const j=I.stencilWrite;o.setTest(j),j&&(o.setMask(I.stencilWriteMask),o.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),o.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),et(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),I.alphaToCoverage===!0?re(t.SAMPLE_ALPHA_TO_COVERAGE):Se(t.SAMPLE_ALPHA_TO_COVERAGE)}function ze(I){x!==I&&(I?t.frontFace(t.CW):t.frontFace(t.CCW),x=I)}function Be(I){I!==rf?(re(t.CULL_FACE),I!==C&&(I===Qa?t.cullFace(t.BACK):I===sf?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Se(t.CULL_FACE),C=I}function Ee(I){I!==L&&(V&&t.lineWidth(I),L=I)}function et(I,se,W){I?(re(t.POLYGON_OFFSET_FILL),(D!==se||U!==W)&&(t.polygonOffset(se,W),D=se,U=W)):Se(t.POLYGON_OFFSET_FILL)}function ye(I){I?re(t.SCISSOR_TEST):Se(t.SCISSOR_TEST)}function A(I){I===void 0&&(I=t.TEXTURE0+X-1),te!==I&&(t.activeTexture(I),te=I)}function M(I,se,W){W===void 0&&(te===null?W=t.TEXTURE0+X-1:W=te);let j=ie[W];j===void 0&&(j={type:void 0,texture:void 0},ie[W]=j),(j.type!==I||j.texture!==se)&&(te!==W&&(t.activeTexture(W),te=W),t.bindTexture(I,se||he[I]),j.type=I,j.texture=se)}function B(){const I=ie[te];I!==void 0&&I.type!==void 0&&(t.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function Y(){try{t.compressedTexImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Z(){try{t.compressedTexImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function $(){try{t.texSubImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function xe(){try{t.texSubImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ae(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function fe(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Ve(){try{t.texStorage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function J(){try{t.texStorage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function de(){try{t.texImage2D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Te(){try{t.texImage3D.apply(t,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function be(I){Xe.equals(I)===!1&&(t.scissor(I.x,I.y,I.z,I.w),Xe.copy(I))}function ue(I){q.equals(I)===!1&&(t.viewport(I.x,I.y,I.z,I.w),q.copy(I))}function He(I,se){let W=l.get(se);W===void 0&&(W=new WeakMap,l.set(se,W));let j=W.get(I);j===void 0&&(j=t.getUniformBlockIndex(se,I.name),W.set(I,j))}function Ie(I,se){const j=l.get(se).get(I);c.get(se)!==j&&(t.uniformBlockBinding(se,j,I.__bindingPointIndex),c.set(se,j))}function Je(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),a.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),h={},te=null,ie={},f={},d=new WeakMap,u=[],g=null,_=!1,p=null,m=null,T=null,y=null,v=null,P=null,b=null,w=new Oe(0,0,0),R=0,S=!1,x=null,C=null,L=null,D=null,U=null,Xe.set(0,0,t.canvas.width,t.canvas.height),q.set(0,0,t.canvas.width,t.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:re,disable:Se,bindFramebuffer:Re,drawBuffers:Fe,useProgram:it,setBlending:O,setMaterial:Ut,setFlipSided:ze,setCullFace:Be,setLineWidth:Ee,setPolygonOffset:et,setScissorTest:ye,activeTexture:A,bindTexture:M,unbindTexture:B,compressedTexImage2D:Y,compressedTexImage3D:Z,texImage2D:de,texImage3D:Te,updateUBOMapping:He,uniformBlockBinding:Ie,texStorage2D:Ve,texStorage3D:J,texSubImage2D:$,texSubImage3D:xe,compressedTexSubImage2D:ae,compressedTexSubImage3D:fe,scissor:be,viewport:ue,reset:Je}}function Ko(t,e,n,i){const r=Y0(i);switch(n){case Pc:return t*e;case Lc:return t*e;case Ic:return t*e*2;case Ta:return t*e/r.components*r.byteLength;case ba:return t*e/r.components*r.byteLength;case Uc:return t*e*2/r.components*r.byteLength;case Aa:return t*e*2/r.components*r.byteLength;case Dc:return t*e*3/r.components*r.byteLength;case qt:return t*e*4/r.components*r.byteLength;case wa:return t*e*4/r.components*r.byteLength;case Ar:case wr:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Rr:case Cr:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Gs:case Xs:return Math.max(t,16)*Math.max(e,8)/4;case Vs:case Ws:return Math.max(t,8)*Math.max(e,8)/2;case qs:case $s:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ys:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case js:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Zs:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Ks:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Js:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Qs:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case ea:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case ta:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case na:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case ia:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case ra:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case sa:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case aa:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case oa:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case ca:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Pr:case la:case ha:return Math.ceil(t/4)*Math.ceil(e/4)*16;case Nc:case fa:return Math.ceil(t/4)*Math.ceil(e/4)*8;case da:case ua:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Y0(t){switch(t){case pn:case wc:return{byteLength:1,components:1};case Xi:case Rc:case $i:return{byteLength:2,components:1};case Sa:case Ea:return{byteLength:2,components:4};case qn:case ya:case en:return{byteLength:4,components:1};case Cc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}function j0(t,e,n,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new we,h=new WeakMap;let f;const d=new WeakMap;let u=!1;try{u=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(A,M){return u?new OffscreenCanvas(A,M):qi("canvas")}function _(A,M,B){let Y=1;const Z=ye(A);if((Z.width>B||Z.height>B)&&(Y=B/Math.max(Z.width,Z.height)),Y<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const $=Math.floor(Y*Z.width),xe=Math.floor(Y*Z.height);f===void 0&&(f=g($,xe));const ae=M?g($,xe):f;return ae.width=$,ae.height=xe,ae.getContext("2d").drawImage(A,0,0,$,xe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Z.width+"x"+Z.height+") to ("+$+"x"+xe+")."),ae}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Z.width+"x"+Z.height+")."),A;return A}function p(A){return A.generateMipmaps}function m(A){t.generateMipmap(A)}function T(A){return A.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?t.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function y(A,M,B,Y,Z=!1){if(A!==null){if(t[A]!==void 0)return t[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let $=M;if(M===t.RED&&(B===t.FLOAT&&($=t.R32F),B===t.HALF_FLOAT&&($=t.R16F),B===t.UNSIGNED_BYTE&&($=t.R8)),M===t.RED_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.R8UI),B===t.UNSIGNED_SHORT&&($=t.R16UI),B===t.UNSIGNED_INT&&($=t.R32UI),B===t.BYTE&&($=t.R8I),B===t.SHORT&&($=t.R16I),B===t.INT&&($=t.R32I)),M===t.RG&&(B===t.FLOAT&&($=t.RG32F),B===t.HALF_FLOAT&&($=t.RG16F),B===t.UNSIGNED_BYTE&&($=t.RG8)),M===t.RG_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.RG8UI),B===t.UNSIGNED_SHORT&&($=t.RG16UI),B===t.UNSIGNED_INT&&($=t.RG32UI),B===t.BYTE&&($=t.RG8I),B===t.SHORT&&($=t.RG16I),B===t.INT&&($=t.RG32I)),M===t.RGB_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.RGB8UI),B===t.UNSIGNED_SHORT&&($=t.RGB16UI),B===t.UNSIGNED_INT&&($=t.RGB32UI),B===t.BYTE&&($=t.RGB8I),B===t.SHORT&&($=t.RGB16I),B===t.INT&&($=t.RGB32I)),M===t.RGBA_INTEGER&&(B===t.UNSIGNED_BYTE&&($=t.RGBA8UI),B===t.UNSIGNED_SHORT&&($=t.RGBA16UI),B===t.UNSIGNED_INT&&($=t.RGBA32UI),B===t.BYTE&&($=t.RGBA8I),B===t.SHORT&&($=t.RGBA16I),B===t.INT&&($=t.RGBA32I)),M===t.RGB&&B===t.UNSIGNED_INT_5_9_9_9_REV&&($=t.RGB9_E5),M===t.RGBA){const xe=Z?Gr:Ge.getTransfer(Y);B===t.FLOAT&&($=t.RGBA32F),B===t.HALF_FLOAT&&($=t.RGBA16F),B===t.UNSIGNED_BYTE&&($=xe===Ze?t.SRGB8_ALPHA8:t.RGBA8),B===t.UNSIGNED_SHORT_4_4_4_4&&($=t.RGBA4),B===t.UNSIGNED_SHORT_5_5_5_1&&($=t.RGB5_A1)}return($===t.R16F||$===t.R32F||$===t.RG16F||$===t.RG32F||$===t.RGBA16F||$===t.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function v(A,M){let B;return A?M===null||M===qn||M===Ti?B=t.DEPTH24_STENCIL8:M===en?B=t.DEPTH32F_STENCIL8:M===Xi&&(B=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===qn||M===Ti?B=t.DEPTH_COMPONENT24:M===en?B=t.DEPTH_COMPONENT32F:M===Xi&&(B=t.DEPTH_COMPONENT16),B}function P(A,M){return p(A)===!0||A.isFramebufferTexture&&A.minFilter!==It&&A.minFilter!==Qt?Math.log2(Math.max(M.width,M.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?M.mipmaps.length:1}function b(A){const M=A.target;M.removeEventListener("dispose",b),R(M),M.isVideoTexture&&h.delete(M)}function w(A){const M=A.target;M.removeEventListener("dispose",w),x(M)}function R(A){const M=i.get(A);if(M.__webglInit===void 0)return;const B=A.source,Y=d.get(B);if(Y){const Z=Y[M.__cacheKey];Z.usedTimes--,Z.usedTimes===0&&S(A),Object.keys(Y).length===0&&d.delete(B)}i.remove(A)}function S(A){const M=i.get(A);t.deleteTexture(M.__webglTexture);const B=A.source,Y=d.get(B);delete Y[M.__cacheKey],a.memory.textures--}function x(A){const M=i.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),i.remove(A.depthTexture)),A.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(M.__webglFramebuffer[Y]))for(let Z=0;Z<M.__webglFramebuffer[Y].length;Z++)t.deleteFramebuffer(M.__webglFramebuffer[Y][Z]);else t.deleteFramebuffer(M.__webglFramebuffer[Y]);M.__webglDepthbuffer&&t.deleteRenderbuffer(M.__webglDepthbuffer[Y])}else{if(Array.isArray(M.__webglFramebuffer))for(let Y=0;Y<M.__webglFramebuffer.length;Y++)t.deleteFramebuffer(M.__webglFramebuffer[Y]);else t.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&t.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&t.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let Y=0;Y<M.__webglColorRenderbuffer.length;Y++)M.__webglColorRenderbuffer[Y]&&t.deleteRenderbuffer(M.__webglColorRenderbuffer[Y]);M.__webglDepthRenderbuffer&&t.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const B=A.textures;for(let Y=0,Z=B.length;Y<Z;Y++){const $=i.get(B[Y]);$.__webglTexture&&(t.deleteTexture($.__webglTexture),a.memory.textures--),i.remove(B[Y])}i.remove(A)}let C=0;function L(){C=0}function D(){const A=C;return A>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+r.maxTextures),C+=1,A}function U(A){const M=[];return M.push(A.wrapS),M.push(A.wrapT),M.push(A.wrapR||0),M.push(A.magFilter),M.push(A.minFilter),M.push(A.anisotropy),M.push(A.internalFormat),M.push(A.format),M.push(A.type),M.push(A.generateMipmaps),M.push(A.premultiplyAlpha),M.push(A.flipY),M.push(A.unpackAlignment),M.push(A.colorSpace),M.join()}function X(A,M){const B=i.get(A);if(A.isVideoTexture&&Ee(A),A.isRenderTargetTexture===!1&&A.version>0&&B.__version!==A.version){const Y=A.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{q(B,A,M);return}}n.bindTexture(t.TEXTURE_2D,B.__webglTexture,t.TEXTURE0+M)}function V(A,M){const B=i.get(A);if(A.version>0&&B.__version!==A.version){q(B,A,M);return}n.bindTexture(t.TEXTURE_2D_ARRAY,B.__webglTexture,t.TEXTURE0+M)}function K(A,M){const B=i.get(A);if(A.version>0&&B.__version!==A.version){q(B,A,M);return}n.bindTexture(t.TEXTURE_3D,B.__webglTexture,t.TEXTURE0+M)}function G(A,M){const B=i.get(A);if(A.version>0&&B.__version!==A.version){Q(B,A,M);return}n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture,t.TEXTURE0+M)}const te={[Hs]:t.REPEAT,[Wn]:t.CLAMP_TO_EDGE,[ks]:t.MIRRORED_REPEAT},ie={[It]:t.NEAREST,[Uf]:t.NEAREST_MIPMAP_NEAREST,[Ji]:t.NEAREST_MIPMAP_LINEAR,[Qt]:t.LINEAR,[Zr]:t.LINEAR_MIPMAP_NEAREST,[Xn]:t.LINEAR_MIPMAP_LINEAR},ve={[Bf]:t.NEVER,[Xf]:t.ALWAYS,[Hf]:t.LESS,[Fc]:t.LEQUAL,[kf]:t.EQUAL,[Wf]:t.GEQUAL,[Vf]:t.GREATER,[Gf]:t.NOTEQUAL};function Le(A,M){if(M.type===en&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===Qt||M.magFilter===Zr||M.magFilter===Ji||M.magFilter===Xn||M.minFilter===Qt||M.minFilter===Zr||M.minFilter===Ji||M.minFilter===Xn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(A,t.TEXTURE_WRAP_S,te[M.wrapS]),t.texParameteri(A,t.TEXTURE_WRAP_T,te[M.wrapT]),(A===t.TEXTURE_3D||A===t.TEXTURE_2D_ARRAY)&&t.texParameteri(A,t.TEXTURE_WRAP_R,te[M.wrapR]),t.texParameteri(A,t.TEXTURE_MAG_FILTER,ie[M.magFilter]),t.texParameteri(A,t.TEXTURE_MIN_FILTER,ie[M.minFilter]),M.compareFunction&&(t.texParameteri(A,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(A,t.TEXTURE_COMPARE_FUNC,ve[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===It||M.minFilter!==Ji&&M.minFilter!==Xn||M.type===en&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||i.get(M).__currentAnisotropy){const B=e.get("EXT_texture_filter_anisotropic");t.texParameterf(A,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy}}}function Xe(A,M){let B=!1;A.__webglInit===void 0&&(A.__webglInit=!0,M.addEventListener("dispose",b));const Y=M.source;let Z=d.get(Y);Z===void 0&&(Z={},d.set(Y,Z));const $=U(M);if($!==A.__cacheKey){Z[$]===void 0&&(Z[$]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,B=!0),Z[$].usedTimes++;const xe=Z[A.__cacheKey];xe!==void 0&&(Z[A.__cacheKey].usedTimes--,xe.usedTimes===0&&S(M)),A.__cacheKey=$,A.__webglTexture=Z[$].texture}return B}function q(A,M,B){let Y=t.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(Y=t.TEXTURE_2D_ARRAY),M.isData3DTexture&&(Y=t.TEXTURE_3D);const Z=Xe(A,M),$=M.source;n.bindTexture(Y,A.__webglTexture,t.TEXTURE0+B);const xe=i.get($);if($.version!==xe.__version||Z===!0){n.activeTexture(t.TEXTURE0+B);const ae=Ge.getPrimaries(Ge.workingColorSpace),fe=M.colorSpace===Rn?null:Ge.getPrimaries(M.colorSpace),Ve=M.colorSpace===Rn||ae===fe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ve);let J=_(M.image,!1,r.maxTextureSize);J=et(M,J);const de=s.convert(M.format,M.colorSpace),Te=s.convert(M.type);let be=y(M.internalFormat,de,Te,M.colorSpace,M.isVideoTexture);Le(Y,M);let ue;const He=M.mipmaps,Ie=M.isVideoTexture!==!0,Je=xe.__version===void 0||Z===!0,I=$.dataReady,se=P(M,J);if(M.isDepthTexture)be=v(M.format===bi,M.type),Je&&(Ie?n.texStorage2D(t.TEXTURE_2D,1,be,J.width,J.height):n.texImage2D(t.TEXTURE_2D,0,be,J.width,J.height,0,de,Te,null));else if(M.isDataTexture)if(He.length>0){Ie&&Je&&n.texStorage2D(t.TEXTURE_2D,se,be,He[0].width,He[0].height);for(let W=0,j=He.length;W<j;W++)ue=He[W],Ie?I&&n.texSubImage2D(t.TEXTURE_2D,W,0,0,ue.width,ue.height,de,Te,ue.data):n.texImage2D(t.TEXTURE_2D,W,be,ue.width,ue.height,0,de,Te,ue.data);M.generateMipmaps=!1}else Ie?(Je&&n.texStorage2D(t.TEXTURE_2D,se,be,J.width,J.height),I&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,J.width,J.height,de,Te,J.data)):n.texImage2D(t.TEXTURE_2D,0,be,J.width,J.height,0,de,Te,J.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){Ie&&Je&&n.texStorage3D(t.TEXTURE_2D_ARRAY,se,be,He[0].width,He[0].height,J.depth);for(let W=0,j=He.length;W<j;W++)if(ue=He[W],M.format!==qt)if(de!==null)if(Ie){if(I)if(M.layerUpdates.size>0){const le=Ko(ue.width,ue.height,M.format,M.type);for(const oe of M.layerUpdates){const Ce=ue.data.subarray(oe*le/ue.data.BYTES_PER_ELEMENT,(oe+1)*le/ue.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,W,0,0,oe,ue.width,ue.height,1,de,Ce)}M.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,W,0,0,0,ue.width,ue.height,J.depth,de,ue.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,W,be,ue.width,ue.height,J.depth,0,ue.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ie?I&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,W,0,0,0,ue.width,ue.height,J.depth,de,Te,ue.data):n.texImage3D(t.TEXTURE_2D_ARRAY,W,be,ue.width,ue.height,J.depth,0,de,Te,ue.data)}else{Ie&&Je&&n.texStorage2D(t.TEXTURE_2D,se,be,He[0].width,He[0].height);for(let W=0,j=He.length;W<j;W++)ue=He[W],M.format!==qt?de!==null?Ie?I&&n.compressedTexSubImage2D(t.TEXTURE_2D,W,0,0,ue.width,ue.height,de,ue.data):n.compressedTexImage2D(t.TEXTURE_2D,W,be,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ie?I&&n.texSubImage2D(t.TEXTURE_2D,W,0,0,ue.width,ue.height,de,Te,ue.data):n.texImage2D(t.TEXTURE_2D,W,be,ue.width,ue.height,0,de,Te,ue.data)}else if(M.isDataArrayTexture)if(Ie){if(Je&&n.texStorage3D(t.TEXTURE_2D_ARRAY,se,be,J.width,J.height,J.depth),I)if(M.layerUpdates.size>0){const W=Ko(J.width,J.height,M.format,M.type);for(const j of M.layerUpdates){const le=J.data.subarray(j*W/J.data.BYTES_PER_ELEMENT,(j+1)*W/J.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,j,J.width,J.height,1,de,Te,le)}M.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,de,Te,J.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,be,J.width,J.height,J.depth,0,de,Te,J.data);else if(M.isData3DTexture)Ie?(Je&&n.texStorage3D(t.TEXTURE_3D,se,be,J.width,J.height,J.depth),I&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,de,Te,J.data)):n.texImage3D(t.TEXTURE_3D,0,be,J.width,J.height,J.depth,0,de,Te,J.data);else if(M.isFramebufferTexture){if(Je)if(Ie)n.texStorage2D(t.TEXTURE_2D,se,be,J.width,J.height);else{let W=J.width,j=J.height;for(let le=0;le<se;le++)n.texImage2D(t.TEXTURE_2D,le,be,W,j,0,de,Te,null),W>>=1,j>>=1}}else if(He.length>0){if(Ie&&Je){const W=ye(He[0]);n.texStorage2D(t.TEXTURE_2D,se,be,W.width,W.height)}for(let W=0,j=He.length;W<j;W++)ue=He[W],Ie?I&&n.texSubImage2D(t.TEXTURE_2D,W,0,0,de,Te,ue):n.texImage2D(t.TEXTURE_2D,W,be,de,Te,ue);M.generateMipmaps=!1}else if(Ie){if(Je){const W=ye(J);n.texStorage2D(t.TEXTURE_2D,se,be,W.width,W.height)}I&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,de,Te,J)}else n.texImage2D(t.TEXTURE_2D,0,be,de,Te,J);p(M)&&m(Y),xe.__version=$.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function Q(A,M,B){if(M.image.length!==6)return;const Y=Xe(A,M),Z=M.source;n.bindTexture(t.TEXTURE_CUBE_MAP,A.__webglTexture,t.TEXTURE0+B);const $=i.get(Z);if(Z.version!==$.__version||Y===!0){n.activeTexture(t.TEXTURE0+B);const xe=Ge.getPrimaries(Ge.workingColorSpace),ae=M.colorSpace===Rn?null:Ge.getPrimaries(M.colorSpace),fe=M.colorSpace===Rn||xe===ae?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,fe);const Ve=M.isCompressedTexture||M.image[0].isCompressedTexture,J=M.image[0]&&M.image[0].isDataTexture,de=[];for(let j=0;j<6;j++)!Ve&&!J?de[j]=_(M.image[j],!0,r.maxCubemapSize):de[j]=J?M.image[j].image:M.image[j],de[j]=et(M,de[j]);const Te=de[0],be=s.convert(M.format,M.colorSpace),ue=s.convert(M.type),He=y(M.internalFormat,be,ue,M.colorSpace),Ie=M.isVideoTexture!==!0,Je=$.__version===void 0||Y===!0,I=Z.dataReady;let se=P(M,Te);Le(t.TEXTURE_CUBE_MAP,M);let W;if(Ve){Ie&&Je&&n.texStorage2D(t.TEXTURE_CUBE_MAP,se,He,Te.width,Te.height);for(let j=0;j<6;j++){W=de[j].mipmaps;for(let le=0;le<W.length;le++){const oe=W[le];M.format!==qt?be!==null?Ie?I&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,0,0,oe.width,oe.height,be,oe.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,He,oe.width,oe.height,0,oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,0,0,oe.width,oe.height,be,ue,oe.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le,He,oe.width,oe.height,0,be,ue,oe.data)}}}else{if(W=M.mipmaps,Ie&&Je){W.length>0&&se++;const j=ye(de[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,se,He,j.width,j.height)}for(let j=0;j<6;j++)if(J){Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,de[j].width,de[j].height,be,ue,de[j].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,He,de[j].width,de[j].height,0,be,ue,de[j].data);for(let le=0;le<W.length;le++){const Ce=W[le].image[j].image;Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,0,0,Ce.width,Ce.height,be,ue,Ce.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,He,Ce.width,Ce.height,0,be,ue,Ce.data)}}else{Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,be,ue,de[j]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,He,be,ue,de[j]);for(let le=0;le<W.length;le++){const oe=W[le];Ie?I&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,0,0,be,ue,oe.image[j]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+j,le+1,He,be,ue,oe.image[j])}}}p(M)&&m(t.TEXTURE_CUBE_MAP),$.__version=Z.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function he(A,M,B,Y,Z,$){const xe=s.convert(B.format,B.colorSpace),ae=s.convert(B.type),fe=y(B.internalFormat,xe,ae,B.colorSpace),Ve=i.get(M),J=i.get(B);if(J.__renderTarget=M,!Ve.__hasExternalTextures){const de=Math.max(1,M.width>>$),Te=Math.max(1,M.height>>$);Z===t.TEXTURE_3D||Z===t.TEXTURE_2D_ARRAY?n.texImage3D(Z,$,fe,de,Te,M.depth,0,xe,ae,null):n.texImage2D(Z,$,fe,de,Te,0,xe,ae,null)}n.bindFramebuffer(t.FRAMEBUFFER,A),Be(M)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Y,Z,J.__webglTexture,0,ze(M)):(Z===t.TEXTURE_2D||Z>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Z<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Y,Z,J.__webglTexture,$),n.bindFramebuffer(t.FRAMEBUFFER,null)}function re(A,M,B){if(t.bindRenderbuffer(t.RENDERBUFFER,A),M.depthBuffer){const Y=M.depthTexture,Z=Y&&Y.isDepthTexture?Y.type:null,$=v(M.stencilBuffer,Z),xe=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ae=ze(M);Be(M)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ae,$,M.width,M.height):B?t.renderbufferStorageMultisample(t.RENDERBUFFER,ae,$,M.width,M.height):t.renderbufferStorage(t.RENDERBUFFER,$,M.width,M.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,xe,t.RENDERBUFFER,A)}else{const Y=M.textures;for(let Z=0;Z<Y.length;Z++){const $=Y[Z],xe=s.convert($.format,$.colorSpace),ae=s.convert($.type),fe=y($.internalFormat,xe,ae,$.colorSpace),Ve=ze(M);B&&Be(M)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Ve,fe,M.width,M.height):Be(M)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Ve,fe,M.width,M.height):t.renderbufferStorage(t.RENDERBUFFER,fe,M.width,M.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Se(A,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,A),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Y=i.get(M.depthTexture);Y.__renderTarget=M,(!Y.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),X(M.depthTexture,0);const Z=Y.__webglTexture,$=ze(M);if(M.depthTexture.format===xi)Be(M)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Z,0,$):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Z,0);else if(M.depthTexture.format===bi)Be(M)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Z,0,$):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Z,0);else throw new Error("Unknown depthTexture format")}function Re(A){const M=i.get(A),B=A.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==A.depthTexture){const Y=A.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),Y){const Z=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,Y.removeEventListener("dispose",Z)};Y.addEventListener("dispose",Z),M.__depthDisposeCallback=Z}M.__boundDepthTexture=Y}if(A.depthTexture&&!M.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");Se(M.__webglFramebuffer,A)}else if(B){M.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(n.bindFramebuffer(t.FRAMEBUFFER,M.__webglFramebuffer[Y]),M.__webglDepthbuffer[Y]===void 0)M.__webglDepthbuffer[Y]=t.createRenderbuffer(),re(M.__webglDepthbuffer[Y],A,!1);else{const Z=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,$=M.__webglDepthbuffer[Y];t.bindRenderbuffer(t.RENDERBUFFER,$),t.framebufferRenderbuffer(t.FRAMEBUFFER,Z,t.RENDERBUFFER,$)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=t.createRenderbuffer(),re(M.__webglDepthbuffer,A,!1);else{const Y=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Z=M.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,Z),t.framebufferRenderbuffer(t.FRAMEBUFFER,Y,t.RENDERBUFFER,Z)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Fe(A,M,B){const Y=i.get(A);M!==void 0&&he(Y.__webglFramebuffer,A,A.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),B!==void 0&&Re(A)}function it(A){const M=A.texture,B=i.get(A),Y=i.get(M);A.addEventListener("dispose",w);const Z=A.textures,$=A.isWebGLCubeRenderTarget===!0,xe=Z.length>1;if(xe||(Y.__webglTexture===void 0&&(Y.__webglTexture=t.createTexture()),Y.__version=M.version,a.memory.textures++),$){B.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0){B.__webglFramebuffer[ae]=[];for(let fe=0;fe<M.mipmaps.length;fe++)B.__webglFramebuffer[ae][fe]=t.createFramebuffer()}else B.__webglFramebuffer[ae]=t.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){B.__webglFramebuffer=[];for(let ae=0;ae<M.mipmaps.length;ae++)B.__webglFramebuffer[ae]=t.createFramebuffer()}else B.__webglFramebuffer=t.createFramebuffer();if(xe)for(let ae=0,fe=Z.length;ae<fe;ae++){const Ve=i.get(Z[ae]);Ve.__webglTexture===void 0&&(Ve.__webglTexture=t.createTexture(),a.memory.textures++)}if(A.samples>0&&Be(A)===!1){B.__webglMultisampledFramebuffer=t.createFramebuffer(),B.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let ae=0;ae<Z.length;ae++){const fe=Z[ae];B.__webglColorRenderbuffer[ae]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,B.__webglColorRenderbuffer[ae]);const Ve=s.convert(fe.format,fe.colorSpace),J=s.convert(fe.type),de=y(fe.internalFormat,Ve,J,fe.colorSpace,A.isXRRenderTarget===!0),Te=ze(A);t.renderbufferStorageMultisample(t.RENDERBUFFER,Te,de,A.width,A.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ae,t.RENDERBUFFER,B.__webglColorRenderbuffer[ae])}t.bindRenderbuffer(t.RENDERBUFFER,null),A.depthBuffer&&(B.__webglDepthRenderbuffer=t.createRenderbuffer(),re(B.__webglDepthRenderbuffer,A,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if($){n.bindTexture(t.TEXTURE_CUBE_MAP,Y.__webglTexture),Le(t.TEXTURE_CUBE_MAP,M);for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0)for(let fe=0;fe<M.mipmaps.length;fe++)he(B.__webglFramebuffer[ae][fe],A,M,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ae,fe);else he(B.__webglFramebuffer[ae],A,M,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);p(M)&&m(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(xe){for(let ae=0,fe=Z.length;ae<fe;ae++){const Ve=Z[ae],J=i.get(Ve);n.bindTexture(t.TEXTURE_2D,J.__webglTexture),Le(t.TEXTURE_2D,Ve),he(B.__webglFramebuffer,A,Ve,t.COLOR_ATTACHMENT0+ae,t.TEXTURE_2D,0),p(Ve)&&m(t.TEXTURE_2D)}n.unbindTexture()}else{let ae=t.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(ae=A.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ae,Y.__webglTexture),Le(ae,M),M.mipmaps&&M.mipmaps.length>0)for(let fe=0;fe<M.mipmaps.length;fe++)he(B.__webglFramebuffer[fe],A,M,t.COLOR_ATTACHMENT0,ae,fe);else he(B.__webglFramebuffer,A,M,t.COLOR_ATTACHMENT0,ae,0);p(M)&&m(ae),n.unbindTexture()}A.depthBuffer&&Re(A)}function ke(A){const M=A.textures;for(let B=0,Y=M.length;B<Y;B++){const Z=M[B];if(p(Z)){const $=T(A),xe=i.get(Z).__webglTexture;n.bindTexture($,xe),m($),n.unbindTexture()}}}const at=[],O=[];function Ut(A){if(A.samples>0){if(Be(A)===!1){const M=A.textures,B=A.width,Y=A.height;let Z=t.COLOR_BUFFER_BIT;const $=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,xe=i.get(A),ae=M.length>1;if(ae)for(let fe=0;fe<M.length;fe++)n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,xe.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,xe.__webglFramebuffer);for(let fe=0;fe<M.length;fe++){if(A.resolveDepthBuffer&&(A.depthBuffer&&(Z|=t.DEPTH_BUFFER_BIT),A.stencilBuffer&&A.resolveStencilBuffer&&(Z|=t.STENCIL_BUFFER_BIT)),ae){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,xe.__webglColorRenderbuffer[fe]);const Ve=i.get(M[fe]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ve,0)}t.blitFramebuffer(0,0,B,Y,0,0,B,Y,Z,t.NEAREST),c===!0&&(at.length=0,O.length=0,at.push(t.COLOR_ATTACHMENT0+fe),A.depthBuffer&&A.resolveDepthBuffer===!1&&(at.push($),O.push($),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,O)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,at))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),ae)for(let fe=0;fe<M.length;fe++){n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.RENDERBUFFER,xe.__webglColorRenderbuffer[fe]);const Ve=i.get(M[fe]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+fe,t.TEXTURE_2D,Ve,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,xe.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.resolveDepthBuffer===!1&&c){const M=A.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[M])}}}function ze(A){return Math.min(r.maxSamples,A.samples)}function Be(A){const M=i.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Ee(A){const M=a.render.frame;h.get(A)!==M&&(h.set(A,M),A.update())}function et(A,M){const B=A.colorSpace,Y=A.format,Z=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||B!==Ri&&B!==Rn&&(Ge.getTransfer(B)===Ze?(Y!==qt||Z!==pn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),M}function ye(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(l.width=A.naturalWidth||A.width,l.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(l.width=A.displayWidth,l.height=A.displayHeight):(l.width=A.width,l.height=A.height),l}this.allocateTextureUnit=D,this.resetTextureUnits=L,this.setTexture2D=X,this.setTexture2DArray=V,this.setTexture3D=K,this.setTextureCube=G,this.rebindTextures=Fe,this.setupRenderTarget=it,this.updateRenderTargetMipmap=ke,this.updateMultisampleRenderTarget=Ut,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=he,this.useMultisampledRTT=Be}function Z0(t,e){function n(i,r=Rn){let s;const a=Ge.getTransfer(r);if(i===pn)return t.UNSIGNED_BYTE;if(i===Sa)return t.UNSIGNED_SHORT_4_4_4_4;if(i===Ea)return t.UNSIGNED_SHORT_5_5_5_1;if(i===Cc)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===wc)return t.BYTE;if(i===Rc)return t.SHORT;if(i===Xi)return t.UNSIGNED_SHORT;if(i===ya)return t.INT;if(i===qn)return t.UNSIGNED_INT;if(i===en)return t.FLOAT;if(i===$i)return t.HALF_FLOAT;if(i===Pc)return t.ALPHA;if(i===Dc)return t.RGB;if(i===qt)return t.RGBA;if(i===Lc)return t.LUMINANCE;if(i===Ic)return t.LUMINANCE_ALPHA;if(i===xi)return t.DEPTH_COMPONENT;if(i===bi)return t.DEPTH_STENCIL;if(i===Ta)return t.RED;if(i===ba)return t.RED_INTEGER;if(i===Uc)return t.RG;if(i===Aa)return t.RG_INTEGER;if(i===wa)return t.RGBA_INTEGER;if(i===Ar||i===wr||i===Rr||i===Cr)if(a===Ze)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Ar)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===wr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Rr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Ar)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===wr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Rr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Cr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Vs||i===Gs||i===Ws||i===Xs)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Vs)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Gs)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ws)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Xs)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===qs||i===$s||i===Ys)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===qs||i===$s)return a===Ze?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Ys)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===js||i===Zs||i===Ks||i===Js||i===Qs||i===ea||i===ta||i===na||i===ia||i===ra||i===sa||i===aa||i===oa||i===ca)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===js)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Zs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Ks)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Js)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Qs)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ea)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===ta)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===na)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ia)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===ra)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===sa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===aa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===oa)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===ca)return a===Ze?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Pr||i===la||i===ha)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Pr)return a===Ze?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===la)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ha)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Nc||i===fa||i===da||i===ua)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Pr)return s.COMPRESSED_RED_RGTC1_EXT;if(i===fa)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===da)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===ua)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ti?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}class K0 extends zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class xt extends ut{constructor(){super(),this.isGroup=!0,this.type="Group"}}const J0={type:"move"};class Ts{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xt,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 xt,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xt,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new z),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,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,n,i){let r=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const _ of e.hand.values()){const p=n.getJointPose(_,i),m=this._getHandJoint(l,_);p!==null&&(m.matrix.fromArray(p.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=p.radius),m.visible=p!==null}const h=l.joints["index-finger-tip"],f=l.joints["thumb-tip"],d=h.position.distanceTo(f.position),u=.02,g=.005;l.inputState.pinching&&d>u+g?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=u-g&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(r=n.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(J0)))}return o!==null&&(o.visible=r!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new xt;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}const Q0=`
|
|
3805
3805
|
void main() {
|
|
3806
3806
|
|
|
3807
3807
|
gl_Position = vec4( position, 1.0 );
|
|
3808
3808
|
|
|
3809
|
-
}`,
|
|
3809
|
+
}`,eg=`
|
|
3810
3810
|
uniform sampler2DArray depthColor;
|
|
3811
3811
|
uniform float depthWidth;
|
|
3812
3812
|
uniform float depthHeight;
|
|
@@ -3825,7 +3825,7 @@ void main() {
|
|
|
3825
3825
|
|
|
3826
3826
|
}
|
|
3827
3827
|
|
|
3828
|
-
}`;class n1{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const r=new Mt,s=e.properties.get(r);s.__webglTexture=n.texture,(n.depthNear!=i.depthNear||n.depthFar!=i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new Yt({vertexShader:e1,fragmentShader:t1,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Rt(new Wr(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class i1 extends Yn{constructor(e,n){super();const i=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,h=null,f=null,d=null,u=null,g=null;const _=new n1,p=n.getContextAttributes();let m=null,T=null;const y=[],v=[],P=new we;let b=null;const w=new zt;w.viewport=new st;const R=new zt;R.viewport=new st;const S=[w,R],x=new Jm;let C=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let Q=y[q];return Q===void 0&&(Q=new Ts,y[q]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(q){let Q=y[q];return Q===void 0&&(Q=new Ts,y[q]=Q),Q.getGripSpace()},this.getHand=function(q){let Q=y[q];return Q===void 0&&(Q=new Ts,y[q]=Q),Q.getHandSpace()};function D(q){const Q=v.indexOf(q.inputSource);if(Q===-1)return;const he=y[Q];he!==void 0&&(he.update(q.inputSource,q.frame,l||a),he.dispatchEvent({type:q.type,data:q.inputSource}))}function U(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",U),r.removeEventListener("inputsourceschange",X);for(let q=0;q<y.length;q++){const Q=v[q];Q!==null&&(v[q]=null,y[q].disconnect(Q))}C=null,L=null,_.reset(),e.setRenderTarget(m),u=null,d=null,f=null,r=null,T=null,Xe.stop(),i.isPresenting=!1,e.setPixelRatio(b),e.setSize(P.width,P.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(q){l=q},this.getBaseLayer=function(){return d!==null?d:u},this.getBinding=function(){return f},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(q){if(r=q,r!==null){if(m=e.getRenderTarget(),r.addEventListener("select",D),r.addEventListener("selectstart",D),r.addEventListener("selectend",D),r.addEventListener("squeeze",D),r.addEventListener("squeezestart",D),r.addEventListener("squeezeend",D),r.addEventListener("end",U),r.addEventListener("inputsourceschange",X),p.xrCompatible!==!0&&await n.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(P),r.renderState.layers===void 0){const Q={antialias:p.antialias,alpha:!0,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(r,n,Q),r.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),T=new $n(u.framebufferWidth,u.framebufferHeight,{format:qt,type:pn,colorSpace:e.outputColorSpace,stencilBuffer:p.stencil})}else{let Q=null,he=null,re=null;p.depth&&(re=p.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Q=p.stencil?bi:xi,he=p.stencil?Ti:qn);const Se={colorFormat:n.RGBA8,depthFormat:re,scaleFactor:s};f=new XRWebGLBinding(r,n),d=f.createProjectionLayer(Se),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new $n(d.textureWidth,d.textureHeight,{format:qt,type:pn,depthTexture:new jc(d.textureWidth,d.textureHeight,he,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:p.stencil,colorSpace:e.outputColorSpace,samples:p.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),Xe.setContext(r),Xe.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function X(q){for(let Q=0;Q<q.removed.length;Q++){const he=q.removed[Q],re=v.indexOf(he);re>=0&&(v[re]=null,y[re].disconnect(he))}for(let Q=0;Q<q.added.length;Q++){const he=q.added[Q];let re=v.indexOf(he);if(re===-1){for(let Re=0;Re<y.length;Re++)if(Re>=v.length){v.push(he),re=Re;break}else if(v[Re]===null){v[Re]=he,re=Re;break}if(re===-1)break}const Se=y[re];Se&&Se.connect(he)}}const V=new z,K=new z;function G(q,Q,he){V.setFromMatrixPosition(Q.matrixWorld),K.setFromMatrixPosition(he.matrixWorld);const re=V.distanceTo(K),Se=Q.projectionMatrix.elements,Re=he.projectionMatrix.elements,Fe=Se[14]/(Se[10]-1),it=Se[14]/(Se[10]+1),ke=(Se[9]+1)/Se[5],at=(Se[9]-1)/Se[5],O=(Se[8]-1)/Se[0],Ut=(Re[8]+1)/Re[0],ze=Fe*O,Be=Fe*Ut,Ee=re/(-O+Ut),et=Ee*-O;if(Q.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(et),q.translateZ(Ee),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),Se[10]===-1)q.projectionMatrix.copy(Q.projectionMatrix),q.projectionMatrixInverse.copy(Q.projectionMatrixInverse);else{const ye=Fe+Ee,A=it+Ee,M=ze-et,B=Be+(re-et),Y=ke*it/A*ye,Z=at*it/A*ye;q.projectionMatrix.makePerspective(M,B,Y,Z,ye,A),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function te(q,Q){Q===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(Q.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(r===null)return;let Q=q.near,he=q.far;_.texture!==null&&(_.depthNear>0&&(Q=_.depthNear),_.depthFar>0&&(he=_.depthFar)),x.near=R.near=w.near=Q,x.far=R.far=w.far=he,(C!==x.near||L!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),C=x.near,L=x.far),w.layers.mask=q.layers.mask|2,R.layers.mask=q.layers.mask|4,x.layers.mask=w.layers.mask|R.layers.mask;const re=q.parent,Se=x.cameras;te(x,re);for(let Re=0;Re<Se.length;Re++)te(Se[Re],re);Se.length===2?G(x,w,R):x.projectionMatrix.copy(w.projectionMatrix),ie(q,x,re)};function ie(q,Q,he){he===null?q.matrix.copy(Q.matrixWorld):(q.matrix.copy(he.matrixWorld),q.matrix.invert(),q.matrix.multiply(Q.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(Q.projectionMatrix),q.projectionMatrixInverse.copy(Q.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=pa*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(d===null&&u===null))return c},this.setFoveation=function(q){c=q,d!==null&&(d.fixedFoveation=q),u!==null&&u.fixedFoveation!==void 0&&(u.fixedFoveation=q)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(x)};let ve=null;function Le(q,Q){if(h=Q.getViewerPose(l||a),g=Q,h!==null){const he=h.views;u!==null&&(e.setRenderTargetFramebuffer(T,u.framebuffer),e.setRenderTarget(T));let re=!1;he.length!==x.cameras.length&&(x.cameras.length=0,re=!0);for(let Re=0;Re<he.length;Re++){const Fe=he[Re];let it=null;if(u!==null)it=u.getViewport(Fe);else{const at=f.getViewSubImage(d,Fe);it=at.viewport,Re===0&&(e.setRenderTargetTextures(T,at.colorTexture,d.ignoreDepthValues?void 0:at.depthStencilTexture),e.setRenderTarget(T))}let ke=S[Re];ke===void 0&&(ke=new zt,ke.layers.enable(Re),ke.viewport=new st,S[Re]=ke),ke.matrix.fromArray(Fe.transform.matrix),ke.matrix.decompose(ke.position,ke.quaternion,ke.scale),ke.projectionMatrix.fromArray(Fe.projectionMatrix),ke.projectionMatrixInverse.copy(ke.projectionMatrix).invert(),ke.viewport.set(it.x,it.y,it.width,it.height),Re===0&&(x.matrix.copy(ke.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),re===!0&&x.cameras.push(ke)}const Se=r.enabledFeatures;if(Se&&Se.includes("depth-sensing")){const Re=f.getDepthInformation(he[0]);Re&&Re.isValid&&Re.texture&&_.init(e,Re,r.renderState)}}for(let he=0;he<y.length;he++){const re=v[he],Se=y[he];re!==null&&Se!==void 0&&Se.update(re,Q,l||a)}ve&&ve(q,Q),Q.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Q}),g=null}const Xe=new $c;Xe.setAnimationLoop(Le),this.setAnimationLoop=function(q){ve=q},this.dispose=function(){}}}const Hn=new mn,r1=new je;function s1(t,e){function n(p,m){p.matrixAutoUpdate===!0&&p.updateMatrix(),m.value.copy(p.matrix)}function i(p,m){m.color.getRGB(p.fogColor.value,Wc(t)),m.isFog?(p.fogNear.value=m.near,p.fogFar.value=m.far):m.isFogExp2&&(p.fogDensity.value=m.density)}function r(p,m,T,y,v){m.isMeshBasicMaterial||m.isMeshLambertMaterial?s(p,m):m.isMeshToonMaterial?(s(p,m),f(p,m)):m.isMeshPhongMaterial?(s(p,m),h(p,m)):m.isMeshStandardMaterial?(s(p,m),d(p,m),m.isMeshPhysicalMaterial&&u(p,m,v)):m.isMeshMatcapMaterial?(s(p,m),g(p,m)):m.isMeshDepthMaterial?s(p,m):m.isMeshDistanceMaterial?(s(p,m),_(p,m)):m.isMeshNormalMaterial?s(p,m):m.isLineBasicMaterial?(a(p,m),m.isLineDashedMaterial&&o(p,m)):m.isPointsMaterial?c(p,m,T,y):m.isSpriteMaterial?l(p,m):m.isShadowMaterial?(p.color.value.copy(m.color),p.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(p,m){p.opacity.value=m.opacity,m.color&&p.diffuse.value.copy(m.color),m.emissive&&p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(p.map.value=m.map,n(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform)),m.bumpMap&&(p.bumpMap.value=m.bumpMap,n(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Ct&&(p.bumpScale.value*=-1)),m.normalMap&&(p.normalMap.value=m.normalMap,n(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Ct&&p.normalScale.value.negate()),m.displacementMap&&(p.displacementMap.value=m.displacementMap,n(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias),m.emissiveMap&&(p.emissiveMap.value=m.emissiveMap,n(m.emissiveMap,p.emissiveMapTransform)),m.specularMap&&(p.specularMap.value=m.specularMap,n(m.specularMap,p.specularMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest);const T=e.get(m),y=T.envMap,v=T.envMapRotation;y&&(p.envMap.value=y,Hn.copy(v),Hn.x*=-1,Hn.y*=-1,Hn.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Hn.y*=-1,Hn.z*=-1),p.envMapRotation.value.setFromMatrix4(r1.makeRotationFromEuler(Hn)),p.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio),m.lightMap&&(p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,n(m.lightMap,p.lightMapTransform)),m.aoMap&&(p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,p.aoMapTransform))}function a(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map&&(p.map.value=m.map,n(m.map,p.mapTransform))}function o(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function c(p,m,T,y){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*T,p.scale.value=y*.5,m.map&&(p.map.value=m.map,n(m.map,p.uvTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function l(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map&&(p.map.value=m.map,n(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function h(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,1e-4)}function f(p,m){m.gradientMap&&(p.gradientMap.value=m.gradientMap)}function d(p,m){p.metalness.value=m.metalness,m.metalnessMap&&(p.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,p.metalnessMapTransform)),p.roughness.value=m.roughness,m.roughnessMap&&(p.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,p.roughnessMapTransform)),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)}function u(p,m,T){p.ior.value=m.ior,m.sheen>0&&(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(p.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,p.sheenColorMapTransform)),m.sheenRoughnessMap&&(p.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,p.sheenRoughnessMapTransform))),m.clearcoat>0&&(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(p.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,p.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(p.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Ct&&p.clearcoatNormalScale.value.negate())),m.dispersion>0&&(p.dispersion.value=m.dispersion),m.iridescence>0&&(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(p.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,p.iridescenceMapTransform)),m.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),m.transmission>0&&(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=T.texture,p.transmissionSamplerSize.value.set(T.width,T.height),m.transmissionMap&&(p.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,p.transmissionMapTransform)),p.thickness.value=m.thickness,m.thicknessMap&&(p.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(p.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap&&(p.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,p.specularColorMapTransform)),m.specularIntensityMap&&(p.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,p.specularIntensityMapTransform))}function g(p,m){m.matcap&&(p.matcap.value=m.matcap)}function _(p,m){const T=e.get(m).light;p.referencePosition.value.setFromMatrixPosition(T.matrixWorld),p.nearDistance.value=T.shadow.camera.near,p.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function a1(t,e,n,i){let r={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(T,y){const v=y.program;i.uniformBlockBinding(T,v)}function l(T,y){let v=r[T.id];v===void 0&&(g(T),v=h(T),r[T.id]=v,T.addEventListener("dispose",p));const P=y.program;i.updateUBOMapping(T,P);const b=e.render.frame;s[T.id]!==b&&(d(T),s[T.id]=b)}function h(T){const y=f();T.__bindingPointIndex=y;const v=t.createBuffer(),P=T.__size,b=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,v),t.bufferData(t.UNIFORM_BUFFER,P,b),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,y,v),v}function f(){for(let T=0;T<o;T++)if(a.indexOf(T)===-1)return a.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(T){const y=r[T.id],v=T.uniforms,P=T.__cache;t.bindBuffer(t.UNIFORM_BUFFER,y);for(let b=0,w=v.length;b<w;b++){const R=Array.isArray(v[b])?v[b]:[v[b]];for(let S=0,x=R.length;S<x;S++){const C=R[S];if(u(C,b,S,P)===!0){const L=C.__offset,D=Array.isArray(C.value)?C.value:[C.value];let U=0;for(let X=0;X<D.length;X++){const V=D[X],K=_(V);typeof V=="number"||typeof V=="boolean"?(C.__data[0]=V,t.bufferSubData(t.UNIFORM_BUFFER,L+U,C.__data)):V.isMatrix3?(C.__data[0]=V.elements[0],C.__data[1]=V.elements[1],C.__data[2]=V.elements[2],C.__data[3]=0,C.__data[4]=V.elements[3],C.__data[5]=V.elements[4],C.__data[6]=V.elements[5],C.__data[7]=0,C.__data[8]=V.elements[6],C.__data[9]=V.elements[7],C.__data[10]=V.elements[8],C.__data[11]=0):(V.toArray(C.__data,U),U+=K.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,L,C.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function u(T,y,v,P){const b=T.value,w=y+"_"+v;if(P[w]===void 0)return typeof b=="number"||typeof b=="boolean"?P[w]=b:P[w]=b.clone(),!0;{const R=P[w];if(typeof b=="number"||typeof b=="boolean"){if(R!==b)return P[w]=b,!0}else if(R.equals(b)===!1)return R.copy(b),!0}return!1}function g(T){const y=T.uniforms;let v=0;const P=16;for(let w=0,R=y.length;w<R;w++){const S=Array.isArray(y[w])?y[w]:[y[w]];for(let x=0,C=S.length;x<C;x++){const L=S[x],D=Array.isArray(L.value)?L.value:[L.value];for(let U=0,X=D.length;U<X;U++){const V=D[U],K=_(V),G=v%P,te=G%K.boundary,ie=G+te;v+=te,ie!==0&&P-ie<K.storage&&(v+=P-ie),L.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=v,v+=K.storage}}}const b=v%P;return b>0&&(v+=P-b),T.__size=v,T.__cache={},this}function _(T){const y={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(y.boundary=4,y.storage=4):T.isVector2?(y.boundary=8,y.storage=8):T.isVector3||T.isColor?(y.boundary=16,y.storage=12):T.isVector4?(y.boundary=16,y.storage=16):T.isMatrix3?(y.boundary=48,y.storage=48):T.isMatrix4?(y.boundary=64,y.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),y}function p(T){const y=T.target;y.removeEventListener("dispose",p);const v=a.indexOf(y.__bindingPointIndex);a.splice(v,1),t.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function m(){for(const T in r)t.deleteBuffer(r[T]);a=[],r={},s={}}return{bind:c,update:l,dispose:m}}class o1{constructor(e={}){const{canvas:n=jf(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let u;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=i.getContextAttributes().alpha}else u=a;const g=new Uint32Array(4),_=new Int32Array(4);let p=null,m=null;const T=[],y=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ot,this.toneMapping=Pn,this.toneMappingExposure=1;const v=this;let P=!1,b=0,w=0,R=null,S=-1,x=null;const C=new st,L=new st;let D=null;const U=new Oe(0);let X=0,V=n.width,K=n.height,G=1,te=null,ie=null;const ve=new st(0,0,V,K),Le=new st(0,0,V,K);let Xe=!1;const q=new Ca;let Q=!1,he=!1;const re=new je,Se=new je,Re=new z,Fe=new st,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ke=!1;function at(){return R===null?G:1}let O=i;function Ut(E,N){return n.getContext(E,N)}try{const E={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Ma}`),n.addEventListener("webglcontextlost",j,!1),n.addEventListener("webglcontextrestored",le,!1),n.addEventListener("webglcontextcreationerror",oe,!1),O===null){const N="webgl2";if(O=Ut(N,E),O===null)throw Ut(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let ze,Be,Ee,et,ye,A,M,B,Y,Z,$,xe,ae,fe,Ve,J,de,Te,be,ue,He,Ie,Je,I;function se(){ze=new d0(O),ze.init(),Ie=new Km(O,ze),Be=new a0(O,ze,e,Ie),Ee=new Ym(O,ze),Be.reverseDepthBuffer&&d&&Ee.buffers.depth.setReversed(!0),et=new m0(O),ye=new Im,A=new Zm(O,ze,Ee,ye,Be,Ie,et),M=new c0(v),B=new f0(v),Y=new Sd(O),Je=new r0(O,Y),Z=new u0(O,Y,et,Je),$=new _0(O,Z,Y,et),be=new g0(O,Be,A),J=new o0(ye),xe=new Lm(v,M,B,ze,Be,Je,J),ae=new s1(v,ye),fe=new Nm,Ve=new km(ze),Te=new i0(v,M,B,Ee,$,u,c),de=new qm(v,$,Be),I=new a1(O,et,Be,Ee),ue=new s0(O,ze,et),He=new p0(O,ze,et),et.programs=xe.programs,v.capabilities=Be,v.extensions=ze,v.properties=ye,v.renderLists=fe,v.shadowMap=de,v.state=Ee,v.info=et}se();const W=new i1(v,O);this.xr=W,this.getContext=function(){return O},this.getContextAttributes=function(){return O.getContextAttributes()},this.forceContextLoss=function(){const E=ze.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=ze.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(E){E!==void 0&&(G=E,this.setSize(V,K,!1))},this.getSize=function(E){return E.set(V,K)},this.setSize=function(E,N,H=!0){if(W.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=E,K=N,n.width=Math.floor(E*G),n.height=Math.floor(N*G),H===!0&&(n.style.width=E+"px",n.style.height=N+"px"),this.setViewport(0,0,E,N)},this.getDrawingBufferSize=function(E){return E.set(V*G,K*G).floor()},this.setDrawingBufferSize=function(E,N,H){V=E,K=N,G=H,n.width=Math.floor(E*H),n.height=Math.floor(N*H),this.setViewport(0,0,E,N)},this.getCurrentViewport=function(E){return E.copy(C)},this.getViewport=function(E){return E.copy(ve)},this.setViewport=function(E,N,H,k){E.isVector4?ve.set(E.x,E.y,E.z,E.w):ve.set(E,N,H,k),Ee.viewport(C.copy(ve).multiplyScalar(G).round())},this.getScissor=function(E){return E.copy(Le)},this.setScissor=function(E,N,H,k){E.isVector4?Le.set(E.x,E.y,E.z,E.w):Le.set(E,N,H,k),Ee.scissor(L.copy(Le).multiplyScalar(G).round())},this.getScissorTest=function(){return Xe},this.setScissorTest=function(E){Ee.setScissorTest(Xe=E)},this.setOpaqueSort=function(E){te=E},this.setTransparentSort=function(E){ie=E},this.getClearColor=function(E){return E.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor.apply(Te,arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha.apply(Te,arguments)},this.clear=function(E=!0,N=!0,H=!0){let k=0;if(E){let F=!1;if(R!==null){const ee=R.texture.format;F=ee===wa||ee===Aa||ee===ba}if(F){const ee=R.texture.type,ce=ee===pn||ee===qn||ee===Xi||ee===Ti||ee===Sa||ee===Ea,me=Te.getClearColor(),ge=Te.getClearAlpha(),Ae=me.r,Pe=me.g,_e=me.b;ce?(g[0]=Ae,g[1]=Pe,g[2]=_e,g[3]=ge,O.clearBufferuiv(O.COLOR,0,g)):(_[0]=Ae,_[1]=Pe,_[2]=_e,_[3]=ge,O.clearBufferiv(O.COLOR,0,_))}else k|=O.COLOR_BUFFER_BIT}N&&(k|=O.DEPTH_BUFFER_BIT),H&&(k|=O.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),O.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",j,!1),n.removeEventListener("webglcontextrestored",le,!1),n.removeEventListener("webglcontextcreationerror",oe,!1),fe.dispose(),Ve.dispose(),ye.dispose(),M.dispose(),B.dispose(),$.dispose(),Je.dispose(),I.dispose(),xe.dispose(),W.dispose(),W.removeEventListener("sessionstart",Xa),W.removeEventListener("sessionend",qa),Un.stop()};function j(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const E=et.autoReset,N=de.enabled,H=de.autoUpdate,k=de.needsUpdate,F=de.type;se(),et.autoReset=E,de.enabled=N,de.autoUpdate=H,de.needsUpdate=k,de.type=F}function oe(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function Ce(E){const N=E.target;N.removeEventListener("dispose",Ce),rt(N)}function rt(E){gt(E),ye.remove(E)}function gt(E){const N=ye.get(E).programs;N!==void 0&&(N.forEach(function(H){xe.releaseProgram(H)}),E.isShaderMaterial&&xe.releaseShaderCache(E))}this.renderBufferDirect=function(E,N,H,k,F,ee){N===null&&(N=it);const ce=F.isMesh&&F.matrixWorld.determinant()<0,me=Ah(E,N,H,k,F);Ee.setMaterial(k,ce);let ge=H.index,Ae=1;if(k.wireframe===!0){if(ge=Z.getWireframeAttribute(H),ge===void 0)return;Ae=2}const Pe=H.drawRange,_e=H.attributes.position;let We=Pe.start*Ae,Qe=(Pe.start+Pe.count)*Ae;ee!==null&&(We=Math.max(We,ee.start*Ae),Qe=Math.min(Qe,(ee.start+ee.count)*Ae)),ge!==null?(We=Math.max(We,0),Qe=Math.min(Qe,ge.count)):_e!=null&&(We=Math.max(We,0),Qe=Math.min(Qe,_e.count));const tt=Qe-We;if(tt<0||tt===1/0)return;Je.setup(F,k,me,H,ge);let bt,qe=ue;if(ge!==null&&(bt=Y.get(ge),qe=He,qe.setIndex(bt)),F.isMesh)k.wireframe===!0?(Ee.setLineWidth(k.wireframeLinewidth*at()),qe.setMode(O.LINES)):qe.setMode(O.TRIANGLES);else if(F.isLine){let Me=k.linewidth;Me===void 0&&(Me=1),Ee.setLineWidth(Me*at()),F.isLineSegments?qe.setMode(O.LINES):F.isLineLoop?qe.setMode(O.LINE_LOOP):qe.setMode(O.LINE_STRIP)}else F.isPoints?qe.setMode(O.POINTS):F.isSprite&&qe.setMode(O.TRIANGLES);if(F.isBatchedMesh)if(F._multiDrawInstances!==null)qe.renderMultiDrawInstances(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount,F._multiDrawInstances);else if(ze.get("WEBGL_multi_draw"))qe.renderMultiDraw(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount);else{const Me=F._multiDrawStarts,rn=F._multiDrawCounts,$e=F._multiDrawCount,kt=ge?Y.get(ge).bytesPerElement:1,Jn=ye.get(k).currentProgram.getUniforms();for(let Pt=0;Pt<$e;Pt++)Jn.setValue(O,"_gl_DrawID",Pt),qe.render(Me[Pt]/kt,rn[Pt])}else if(F.isInstancedMesh)qe.renderInstances(We,tt,F.count);else if(H.isInstancedBufferGeometry){const Me=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,rn=Math.min(H.instanceCount,Me);qe.renderInstances(We,tt,rn)}else qe.render(We,tt)};function Ye(E,N,H){E.transparent===!0&&E.side===Jt&&E.forceSinglePass===!1?(E.side=Ct,E.needsUpdate=!0,Ki(E,N,H),E.side=Dn,E.needsUpdate=!0,Ki(E,N,H),E.side=Jt):Ki(E,N,H)}this.compile=function(E,N,H=null){H===null&&(H=E),m=Ve.get(H),m.init(N),y.push(m),H.traverseVisible(function(F){F.isLight&&F.layers.test(N.layers)&&(m.pushLight(F),F.castShadow&&m.pushShadow(F))}),E!==H&&E.traverseVisible(function(F){F.isLight&&F.layers.test(N.layers)&&(m.pushLight(F),F.castShadow&&m.pushShadow(F))}),m.setupLights();const k=new Set;return E.traverse(function(F){if(!(F.isMesh||F.isPoints||F.isLine||F.isSprite))return;const ee=F.material;if(ee)if(Array.isArray(ee))for(let ce=0;ce<ee.length;ce++){const me=ee[ce];Ye(me,H,F),k.add(me)}else Ye(ee,H,F),k.add(ee)}),y.pop(),m=null,k},this.compileAsync=function(E,N,H=null){const k=this.compile(E,N,H);return new Promise(F=>{function ee(){if(k.forEach(function(ce){ye.get(ce).currentProgram.isReady()&&k.delete(ce)}),k.size===0){F(E);return}setTimeout(ee,10)}ze.get("KHR_parallel_shader_compile")!==null?ee():setTimeout(ee,10)})};let Ht=null;function nn(E){Ht&&Ht(E)}function Xa(){Un.stop()}function qa(){Un.start()}const Un=new $c;Un.setAnimationLoop(nn),typeof self<"u"&&Un.setContext(self),this.setAnimationLoop=function(E){Ht=E,W.setAnimationLoop(E),E===null?Un.stop():Un.start()},W.addEventListener("sessionstart",Xa),W.addEventListener("sessionend",qa),this.render=function(E,N){if(N!==void 0&&N.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(W.cameraAutoUpdate===!0&&W.updateCamera(N),N=W.getCamera()),E.isScene===!0&&E.onBeforeRender(v,E,N,R),m=Ve.get(E,y.length),m.init(N),y.push(m),Se.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),q.setFromProjectionMatrix(Se),he=this.localClippingEnabled,Q=J.init(this.clippingPlanes,he),p=fe.get(E,T.length),p.init(),T.push(p),W.enabled===!0&&W.isPresenting===!0){const ee=v.xr.getDepthSensingMesh();ee!==null&&jr(ee,N,-1/0,v.sortObjects)}jr(E,N,0,v.sortObjects),p.finish(),v.sortObjects===!0&&p.sort(te,ie),ke=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,ke&&Te.addToRenderList(p,E),this.info.render.frame++,Q===!0&&J.beginShadows();const H=m.state.shadowsArray;de.render(H,E,N),Q===!0&&J.endShadows(),this.info.autoReset===!0&&this.info.reset();const k=p.opaque,F=p.transmissive;if(m.setupLights(),N.isArrayCamera){const ee=N.cameras;if(F.length>0)for(let ce=0,me=ee.length;ce<me;ce++){const ge=ee[ce];Ya(k,F,E,ge)}ke&&Te.render(E);for(let ce=0,me=ee.length;ce<me;ce++){const ge=ee[ce];$a(p,E,ge,ge.viewport)}}else F.length>0&&Ya(k,F,E,N),ke&&Te.render(E),$a(p,E,N);R!==null&&(A.updateMultisampleRenderTarget(R),A.updateRenderTargetMipmap(R)),E.isScene===!0&&E.onAfterRender(v,E,N),Je.resetDefaultState(),S=-1,x=null,y.pop(),y.length>0?(m=y[y.length-1],Q===!0&&J.setGlobalState(v.clippingPlanes,m.state.camera)):m=null,T.pop(),T.length>0?p=T[T.length-1]:p=null};function jr(E,N,H,k){if(E.visible===!1)return;if(E.layers.test(N.layers)){if(E.isGroup)H=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(N);else if(E.isLight)m.pushLight(E),E.castShadow&&m.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||q.intersectsSprite(E)){k&&Fe.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Se);const ce=$.update(E),me=E.material;me.visible&&p.push(E,ce,me,H,Fe.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||q.intersectsObject(E))){const ce=$.update(E),me=E.material;if(k&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Fe.copy(E.boundingSphere.center)):(ce.boundingSphere===null&&ce.computeBoundingSphere(),Fe.copy(ce.boundingSphere.center)),Fe.applyMatrix4(E.matrixWorld).applyMatrix4(Se)),Array.isArray(me)){const ge=ce.groups;for(let Ae=0,Pe=ge.length;Ae<Pe;Ae++){const _e=ge[Ae],We=me[_e.materialIndex];We&&We.visible&&p.push(E,ce,We,H,Fe.z,_e)}}else me.visible&&p.push(E,ce,me,H,Fe.z,null)}}const ee=E.children;for(let ce=0,me=ee.length;ce<me;ce++)jr(ee[ce],N,H,k)}function $a(E,N,H,k){const F=E.opaque,ee=E.transmissive,ce=E.transparent;m.setupLightsView(H),Q===!0&&J.setGlobalState(v.clippingPlanes,H),k&&Ee.viewport(C.copy(k)),F.length>0&&Zi(F,N,H),ee.length>0&&Zi(ee,N,H),ce.length>0&&Zi(ce,N,H),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function Ya(E,N,H,k){if((H.isScene===!0?H.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[k.id]===void 0&&(m.state.transmissionRenderTarget[k.id]=new $n(1,1,{generateMipmaps:!0,type:ze.has("EXT_color_buffer_half_float")||ze.has("EXT_color_buffer_float")?$i:pn,minFilter:Xn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ge.workingColorSpace}));const ee=m.state.transmissionRenderTarget[k.id],ce=k.viewport||C;ee.setSize(ce.z,ce.w);const me=v.getRenderTarget();v.setRenderTarget(ee),v.getClearColor(U),X=v.getClearAlpha(),X<1&&v.setClearColor(16777215,.5),v.clear(),ke&&Te.render(H);const ge=v.toneMapping;v.toneMapping=Pn;const Ae=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),m.setupLightsView(k),Q===!0&&J.setGlobalState(v.clippingPlanes,k),Zi(E,H,k),A.updateMultisampleRenderTarget(ee),A.updateRenderTargetMipmap(ee),ze.has("WEBGL_multisampled_render_to_texture")===!1){let Pe=!1;for(let _e=0,We=N.length;_e<We;_e++){const Qe=N[_e],tt=Qe.object,bt=Qe.geometry,qe=Qe.material,Me=Qe.group;if(qe.side===Jt&&tt.layers.test(k.layers)){const rn=qe.side;qe.side=Ct,qe.needsUpdate=!0,ja(tt,H,k,bt,qe,Me),qe.side=rn,qe.needsUpdate=!0,Pe=!0}}Pe===!0&&(A.updateMultisampleRenderTarget(ee),A.updateRenderTargetMipmap(ee))}v.setRenderTarget(me),v.setClearColor(U,X),Ae!==void 0&&(k.viewport=Ae),v.toneMapping=ge}function Zi(E,N,H){const k=N.isScene===!0?N.overrideMaterial:null;for(let F=0,ee=E.length;F<ee;F++){const ce=E[F],me=ce.object,ge=ce.geometry,Ae=k===null?ce.material:k,Pe=ce.group;me.layers.test(H.layers)&&ja(me,N,H,ge,Ae,Pe)}}function ja(E,N,H,k,F,ee){E.onBeforeRender(v,N,H,k,F,ee),E.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),F.onBeforeRender(v,N,H,k,E,ee),F.transparent===!0&&F.side===Jt&&F.forceSinglePass===!1?(F.side=Ct,F.needsUpdate=!0,v.renderBufferDirect(H,N,k,F,E,ee),F.side=Dn,F.needsUpdate=!0,v.renderBufferDirect(H,N,k,F,E,ee),F.side=Jt):v.renderBufferDirect(H,N,k,F,E,ee),E.onAfterRender(v,N,H,k,F,ee)}function Ki(E,N,H){N.isScene!==!0&&(N=it);const k=ye.get(E),F=m.state.lights,ee=m.state.shadowsArray,ce=F.state.version,me=xe.getParameters(E,F.state,ee,N,H),ge=xe.getProgramCacheKey(me);let Ae=k.programs;k.environment=E.isMeshStandardMaterial?N.environment:null,k.fog=N.fog,k.envMap=(E.isMeshStandardMaterial?B:M).get(E.envMap||k.environment),k.envMapRotation=k.environment!==null&&E.envMap===null?N.environmentRotation:E.envMapRotation,Ae===void 0&&(E.addEventListener("dispose",Ce),Ae=new Map,k.programs=Ae);let Pe=Ae.get(ge);if(Pe!==void 0){if(k.currentProgram===Pe&&k.lightsStateVersion===ce)return Ka(E,me),Pe}else me.uniforms=xe.getUniforms(E),E.onBeforeCompile(me,v),Pe=xe.acquireProgram(me,ge),Ae.set(ge,Pe),k.uniforms=me.uniforms;const _e=k.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(_e.clippingPlanes=J.uniform),Ka(E,me),k.needsLights=Rh(E),k.lightsStateVersion=ce,k.needsLights&&(_e.ambientLightColor.value=F.state.ambient,_e.lightProbe.value=F.state.probe,_e.directionalLights.value=F.state.directional,_e.directionalLightShadows.value=F.state.directionalShadow,_e.spotLights.value=F.state.spot,_e.spotLightShadows.value=F.state.spotShadow,_e.rectAreaLights.value=F.state.rectArea,_e.ltc_1.value=F.state.rectAreaLTC1,_e.ltc_2.value=F.state.rectAreaLTC2,_e.pointLights.value=F.state.point,_e.pointLightShadows.value=F.state.pointShadow,_e.hemisphereLights.value=F.state.hemi,_e.directionalShadowMap.value=F.state.directionalShadowMap,_e.directionalShadowMatrix.value=F.state.directionalShadowMatrix,_e.spotShadowMap.value=F.state.spotShadowMap,_e.spotLightMatrix.value=F.state.spotLightMatrix,_e.spotLightMap.value=F.state.spotLightMap,_e.pointShadowMap.value=F.state.pointShadowMap,_e.pointShadowMatrix.value=F.state.pointShadowMatrix),k.currentProgram=Pe,k.uniformsList=null,Pe}function Za(E){if(E.uniformsList===null){const N=E.currentProgram.getUniforms();E.uniformsList=Lr.seqWithValue(N.seq,E.uniforms)}return E.uniformsList}function Ka(E,N){const H=ye.get(E);H.outputColorSpace=N.outputColorSpace,H.batching=N.batching,H.batchingColor=N.batchingColor,H.instancing=N.instancing,H.instancingColor=N.instancingColor,H.instancingMorph=N.instancingMorph,H.skinning=N.skinning,H.morphTargets=N.morphTargets,H.morphNormals=N.morphNormals,H.morphColors=N.morphColors,H.morphTargetsCount=N.morphTargetsCount,H.numClippingPlanes=N.numClippingPlanes,H.numIntersection=N.numClipIntersection,H.vertexAlphas=N.vertexAlphas,H.vertexTangents=N.vertexTangents,H.toneMapping=N.toneMapping}function Ah(E,N,H,k,F){N.isScene!==!0&&(N=it),A.resetTextureUnits();const ee=N.fog,ce=k.isMeshStandardMaterial?N.environment:null,me=R===null?v.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:Ri,ge=(k.isMeshStandardMaterial?B:M).get(k.envMap||ce),Ae=k.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Pe=!!H.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),_e=!!H.morphAttributes.position,We=!!H.morphAttributes.normal,Qe=!!H.morphAttributes.color;let tt=Pn;k.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(tt=v.toneMapping);const bt=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,qe=bt!==void 0?bt.length:0,Me=ye.get(k),rn=m.state.lights;if(Q===!0&&(he===!0||E!==x)){const Nt=E===x&&k.id===S;J.setState(k,E,Nt)}let $e=!1;k.version===Me.__version?(Me.needsLights&&Me.lightsStateVersion!==rn.state.version||Me.outputColorSpace!==me||F.isBatchedMesh&&Me.batching===!1||!F.isBatchedMesh&&Me.batching===!0||F.isBatchedMesh&&Me.batchingColor===!0&&F.colorTexture===null||F.isBatchedMesh&&Me.batchingColor===!1&&F.colorTexture!==null||F.isInstancedMesh&&Me.instancing===!1||!F.isInstancedMesh&&Me.instancing===!0||F.isSkinnedMesh&&Me.skinning===!1||!F.isSkinnedMesh&&Me.skinning===!0||F.isInstancedMesh&&Me.instancingColor===!0&&F.instanceColor===null||F.isInstancedMesh&&Me.instancingColor===!1&&F.instanceColor!==null||F.isInstancedMesh&&Me.instancingMorph===!0&&F.morphTexture===null||F.isInstancedMesh&&Me.instancingMorph===!1&&F.morphTexture!==null||Me.envMap!==ge||k.fog===!0&&Me.fog!==ee||Me.numClippingPlanes!==void 0&&(Me.numClippingPlanes!==J.numPlanes||Me.numIntersection!==J.numIntersection)||Me.vertexAlphas!==Ae||Me.vertexTangents!==Pe||Me.morphTargets!==_e||Me.morphNormals!==We||Me.morphColors!==Qe||Me.toneMapping!==tt||Me.morphTargetsCount!==qe)&&($e=!0):($e=!0,Me.__version=k.version);let kt=Me.currentProgram;$e===!0&&(kt=Ki(k,N,F));let Jn=!1,Pt=!1,Li=!1;const nt=kt.getUniforms(),Zt=Me.uniforms;if(Ee.useProgram(kt.program)&&(Jn=!0,Pt=!0,Li=!0),k.id!==S&&(S=k.id,Pt=!0),Jn||x!==E){Ee.buffers.depth.getReversed()?(re.copy(E.projectionMatrix),Kf(re),Jf(re),nt.setValue(O,"projectionMatrix",re)):nt.setValue(O,"projectionMatrix",E.projectionMatrix),nt.setValue(O,"viewMatrix",E.matrixWorldInverse);const _n=nt.map.cameraPosition;_n!==void 0&&_n.setValue(O,Re.setFromMatrixPosition(E.matrixWorld)),Be.logarithmicDepthBuffer&&nt.setValue(O,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&nt.setValue(O,"isOrthographic",E.isOrthographicCamera===!0),x!==E&&(x=E,Pt=!0,Li=!0)}if(F.isSkinnedMesh){nt.setOptional(O,F,"bindMatrix"),nt.setOptional(O,F,"bindMatrixInverse");const Nt=F.skeleton;Nt&&(Nt.boneTexture===null&&Nt.computeBoneTexture(),nt.setValue(O,"boneTexture",Nt.boneTexture,A))}F.isBatchedMesh&&(nt.setOptional(O,F,"batchingTexture"),nt.setValue(O,"batchingTexture",F._matricesTexture,A),nt.setOptional(O,F,"batchingIdTexture"),nt.setValue(O,"batchingIdTexture",F._indirectTexture,A),nt.setOptional(O,F,"batchingColorTexture"),F._colorsTexture!==null&&nt.setValue(O,"batchingColorTexture",F._colorsTexture,A));const Ii=H.morphAttributes;if((Ii.position!==void 0||Ii.normal!==void 0||Ii.color!==void 0)&&be.update(F,H,kt),(Pt||Me.receiveShadow!==F.receiveShadow)&&(Me.receiveShadow=F.receiveShadow,nt.setValue(O,"receiveShadow",F.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(Zt.envMap.value=ge,Zt.flipEnvMap.value=ge.isCubeTexture&&ge.isRenderTargetTexture===!1?-1:1),k.isMeshStandardMaterial&&k.envMap===null&&N.environment!==null&&(Zt.envMapIntensity.value=N.environmentIntensity),Pt&&(nt.setValue(O,"toneMappingExposure",v.toneMappingExposure),Me.needsLights&&wh(Zt,Li),ee&&k.fog===!0&&ae.refreshFogUniforms(Zt,ee),ae.refreshMaterialUniforms(Zt,k,G,K,m.state.transmissionRenderTarget[E.id]),Lr.upload(O,Za(Me),Zt,A)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(Lr.upload(O,Za(Me),Zt,A),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&nt.setValue(O,"center",F.center),nt.setValue(O,"modelViewMatrix",F.modelViewMatrix),nt.setValue(O,"normalMatrix",F.normalMatrix),nt.setValue(O,"modelMatrix",F.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const Nt=k.uniformsGroups;for(let _n=0,vn=Nt.length;_n<vn;_n++){const Ja=Nt[_n];I.update(Ja,kt),I.bind(Ja,kt)}}return kt}function wh(E,N){E.ambientLightColor.needsUpdate=N,E.lightProbe.needsUpdate=N,E.directionalLights.needsUpdate=N,E.directionalLightShadows.needsUpdate=N,E.pointLights.needsUpdate=N,E.pointLightShadows.needsUpdate=N,E.spotLights.needsUpdate=N,E.spotLightShadows.needsUpdate=N,E.rectAreaLights.needsUpdate=N,E.hemisphereLights.needsUpdate=N}function Rh(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(E,N,H){ye.get(E.texture).__webglTexture=N,ye.get(E.depthTexture).__webglTexture=H;const k=ye.get(E);k.__hasExternalTextures=!0,k.__autoAllocateDepthBuffer=H===void 0,k.__autoAllocateDepthBuffer||ze.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),k.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(E,N){const H=ye.get(E);H.__webglFramebuffer=N,H.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(E,N=0,H=0){R=E,b=N,w=H;let k=!0,F=null,ee=!1,ce=!1;if(E){const ge=ye.get(E);if(ge.__useDefaultFramebuffer!==void 0)Ee.bindFramebuffer(O.FRAMEBUFFER,null),k=!1;else if(ge.__webglFramebuffer===void 0)A.setupRenderTarget(E);else if(ge.__hasExternalTextures)A.rebindTextures(E,ye.get(E.texture).__webglTexture,ye.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const _e=E.depthTexture;if(ge.__boundDepthTexture!==_e){if(_e!==null&&ye.has(_e)&&(E.width!==_e.image.width||E.height!==_e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");A.setupDepthRenderbuffer(E)}}const Ae=E.texture;(Ae.isData3DTexture||Ae.isDataArrayTexture||Ae.isCompressedArrayTexture)&&(ce=!0);const Pe=ye.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Pe[N])?F=Pe[N][H]:F=Pe[N],ee=!0):E.samples>0&&A.useMultisampledRTT(E)===!1?F=ye.get(E).__webglMultisampledFramebuffer:Array.isArray(Pe)?F=Pe[H]:F=Pe,C.copy(E.viewport),L.copy(E.scissor),D=E.scissorTest}else C.copy(ve).multiplyScalar(G).floor(),L.copy(Le).multiplyScalar(G).floor(),D=Xe;if(Ee.bindFramebuffer(O.FRAMEBUFFER,F)&&k&&Ee.drawBuffers(E,F),Ee.viewport(C),Ee.scissor(L),Ee.setScissorTest(D),ee){const ge=ye.get(E.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+N,ge.__webglTexture,H)}else if(ce){const ge=ye.get(E.texture),Ae=N||0;O.framebufferTextureLayer(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,ge.__webglTexture,H||0,Ae)}S=-1},this.readRenderTargetPixels=function(E,N,H,k,F,ee,ce){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let me=ye.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&ce!==void 0&&(me=me[ce]),me){Ee.bindFramebuffer(O.FRAMEBUFFER,me);try{const ge=E.texture,Ae=ge.format,Pe=ge.type;if(!Be.textureFormatReadable(Ae)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Be.textureTypeReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=E.width-k&&H>=0&&H<=E.height-F&&O.readPixels(N,H,k,F,Ie.convert(Ae),Ie.convert(Pe),ee)}finally{const ge=R!==null?ye.get(R).__webglFramebuffer:null;Ee.bindFramebuffer(O.FRAMEBUFFER,ge)}}},this.readRenderTargetPixelsAsync=async function(E,N,H,k,F,ee,ce){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let me=ye.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&ce!==void 0&&(me=me[ce]),me){const ge=E.texture,Ae=ge.format,Pe=ge.type;if(!Be.textureFormatReadable(Ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Be.textureTypeReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(N>=0&&N<=E.width-k&&H>=0&&H<=E.height-F){Ee.bindFramebuffer(O.FRAMEBUFFER,me);const _e=O.createBuffer();O.bindBuffer(O.PIXEL_PACK_BUFFER,_e),O.bufferData(O.PIXEL_PACK_BUFFER,ee.byteLength,O.STREAM_READ),O.readPixels(N,H,k,F,Ie.convert(Ae),Ie.convert(Pe),0);const We=R!==null?ye.get(R).__webglFramebuffer:null;Ee.bindFramebuffer(O.FRAMEBUFFER,We);const Qe=O.fenceSync(O.SYNC_GPU_COMMANDS_COMPLETE,0);return O.flush(),await Zf(O,Qe,4),O.bindBuffer(O.PIXEL_PACK_BUFFER,_e),O.getBufferSubData(O.PIXEL_PACK_BUFFER,0,ee),O.deleteBuffer(_e),O.deleteSync(Qe),ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(E,N=null,H=0){E.isTexture!==!0&&(Vi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),N=arguments[0]||null,E=arguments[1]);const k=Math.pow(2,-H),F=Math.floor(E.image.width*k),ee=Math.floor(E.image.height*k),ce=N!==null?N.x:0,me=N!==null?N.y:0;A.setTexture2D(E,0),O.copyTexSubImage2D(O.TEXTURE_2D,H,0,0,ce,me,F,ee),Ee.unbindTexture()},this.copyTextureToTexture=function(E,N,H=null,k=null,F=0){E.isTexture!==!0&&(Vi("WebGLRenderer: copyTextureToTexture function signature has changed."),k=arguments[0]||null,E=arguments[1],N=arguments[2],F=arguments[3]||0,H=null);let ee,ce,me,ge,Ae,Pe,_e,We,Qe;const tt=E.isCompressedTexture?E.mipmaps[F]:E.image;H!==null?(ee=H.max.x-H.min.x,ce=H.max.y-H.min.y,me=H.isBox3?H.max.z-H.min.z:1,ge=H.min.x,Ae=H.min.y,Pe=H.isBox3?H.min.z:0):(ee=tt.width,ce=tt.height,me=tt.depth||1,ge=0,Ae=0,Pe=0),k!==null?(_e=k.x,We=k.y,Qe=k.z):(_e=0,We=0,Qe=0);const bt=Ie.convert(N.format),qe=Ie.convert(N.type);let Me;N.isData3DTexture?(A.setTexture3D(N,0),Me=O.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(A.setTexture2DArray(N,0),Me=O.TEXTURE_2D_ARRAY):(A.setTexture2D(N,0),Me=O.TEXTURE_2D),O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,N.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,N.unpackAlignment);const rn=O.getParameter(O.UNPACK_ROW_LENGTH),$e=O.getParameter(O.UNPACK_IMAGE_HEIGHT),kt=O.getParameter(O.UNPACK_SKIP_PIXELS),Jn=O.getParameter(O.UNPACK_SKIP_ROWS),Pt=O.getParameter(O.UNPACK_SKIP_IMAGES);O.pixelStorei(O.UNPACK_ROW_LENGTH,tt.width),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,tt.height),O.pixelStorei(O.UNPACK_SKIP_PIXELS,ge),O.pixelStorei(O.UNPACK_SKIP_ROWS,Ae),O.pixelStorei(O.UNPACK_SKIP_IMAGES,Pe);const Li=E.isDataArrayTexture||E.isData3DTexture,nt=N.isDataArrayTexture||N.isData3DTexture;if(E.isRenderTargetTexture||E.isDepthTexture){const Zt=ye.get(E),Ii=ye.get(N),Nt=ye.get(Zt.__renderTarget),_n=ye.get(Ii.__renderTarget);Ee.bindFramebuffer(O.READ_FRAMEBUFFER,Nt.__webglFramebuffer),Ee.bindFramebuffer(O.DRAW_FRAMEBUFFER,_n.__webglFramebuffer);for(let vn=0;vn<me;vn++)Li&&O.framebufferTextureLayer(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,ye.get(E).__webglTexture,F,Pe+vn),E.isDepthTexture?(nt&&O.framebufferTextureLayer(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,ye.get(N).__webglTexture,F,Qe+vn),O.blitFramebuffer(ge,Ae,ee,ce,_e,We,ee,ce,O.DEPTH_BUFFER_BIT,O.NEAREST)):nt?O.copyTexSubImage3D(Me,F,_e,We,Qe+vn,ge,Ae,ee,ce):O.copyTexSubImage2D(Me,F,_e,We,Qe+vn,ge,Ae,ee,ce);Ee.bindFramebuffer(O.READ_FRAMEBUFFER,null),Ee.bindFramebuffer(O.DRAW_FRAMEBUFFER,null)}else nt?E.isDataTexture||E.isData3DTexture?O.texSubImage3D(Me,F,_e,We,Qe,ee,ce,me,bt,qe,tt.data):N.isCompressedArrayTexture?O.compressedTexSubImage3D(Me,F,_e,We,Qe,ee,ce,me,bt,tt.data):O.texSubImage3D(Me,F,_e,We,Qe,ee,ce,me,bt,qe,tt):E.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,F,_e,We,ee,ce,bt,qe,tt.data):E.isCompressedTexture?O.compressedTexSubImage2D(O.TEXTURE_2D,F,_e,We,tt.width,tt.height,bt,tt.data):O.texSubImage2D(O.TEXTURE_2D,F,_e,We,ee,ce,bt,qe,tt);O.pixelStorei(O.UNPACK_ROW_LENGTH,rn),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,$e),O.pixelStorei(O.UNPACK_SKIP_PIXELS,kt),O.pixelStorei(O.UNPACK_SKIP_ROWS,Jn),O.pixelStorei(O.UNPACK_SKIP_IMAGES,Pt),F===0&&N.generateMipmaps&&O.generateMipmap(Me),Ee.unbindTexture()},this.copyTextureToTexture3D=function(E,N,H=null,k=null,F=0){return E.isTexture!==!0&&(Vi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),H=arguments[0]||null,k=arguments[1]||null,E=arguments[2],N=arguments[3],F=arguments[4]||0),Vi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(E,N,H,k,F)},this.initRenderTarget=function(E){ye.get(E).__webglFramebuffer===void 0&&A.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?A.setTextureCube(E,0):E.isData3DTexture?A.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?A.setTexture2DArray(E,0):A.setTexture2D(E,0),Ee.unbindTexture()},this.resetState=function(){b=0,w=0,R=null,Ee.reset(),Je.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return dn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorspace=Ge._getDrawingBufferColorSpace(e),n.unpackColorSpace=Ge._getUnpackColorSpace()}}class c1 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 mn,this.environmentIntensity=1,this.environmentRotation=new mn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class l1 extends Mt{constructor(e=null,n=1,i=1,r,s,a,o,c,l=It,h=It,f,d){super(null,a,o,c,l,h,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Jo extends Bt{constructor(e,n,i,r=1){super(e,n,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ui=new je,Qo=new je,xr=[],ec=new jn,h1=new je,Bi=new Rt,Hi=new Zn;class Da extends Rt{constructor(e,n,i){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Jo(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,h1)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new jn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<n;i++)this.getMatrixAt(i,ui),ec.copy(e.boundingBox).applyMatrix4(ui),this.boundingBox.union(ec)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Zn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<n;i++)this.getMatrixAt(i,ui),Hi.copy(e.boundingSphere).applyMatrix4(ui),this.boundingSphere.union(Hi)}copy(e,n){return super.copy(e,n),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,n){n.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,n){n.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,n){const i=n.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,a=e*s+1;for(let o=0;o<i.length;o++)i[o]=r[a+o]}raycast(e,n){const i=this.matrixWorld,r=this.count;if(Bi.geometry=this.geometry,Bi.material=this.material,Bi.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Hi.copy(this.boundingSphere),Hi.applyMatrix4(i),e.ray.intersectsSphere(Hi)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,ui),Qo.multiplyMatrices(i,ui),Bi.matrixWorld=Qo,Bi.raycast(e,xr);for(let a=0,o=xr.length;a<o;a++){const c=xr[a];c.instanceId=s,c.object=this,n.push(c)}xr.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new Jo(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),n.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,n){n.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,n){const i=n.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new l1(new Float32Array(r*this.count),r,this.count,Ta,en));const s=this.morphTexture.source.data.data;let a=0;for(let l=0;l<i.length;l++)a+=i[l];const o=this.geometry.morphTargetsRelative?1:1-a,c=r*e;s[c]=o,s.set(i,c+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class qr extends Ci{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new Oe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Fr=new z,Or=new z,tc=new je,ki=new ji,Mr=new Zn,bs=new z,nc=new z;class zr extends ut{constructor(e=new pt,n=new qr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let r=1,s=n.count;r<s;r++)Fr.fromBufferAttribute(n,r-1),Or.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=Fr.distanceTo(Or);e.setAttribute("lineDistance",new ot(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Mr.copy(i.boundingSphere),Mr.applyMatrix4(r),Mr.radius+=s,e.ray.intersectsSphere(Mr)===!1)return;tc.copy(r).invert(),ki.copy(e.ray).applyMatrix4(tc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=i.index,d=i.attributes.position;if(h!==null){const u=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let _=u,p=g-1;_<p;_+=l){const m=h.getX(_),T=h.getX(_+1),y=yr(this,e,ki,c,m,T);y&&n.push(y)}if(this.isLineLoop){const _=h.getX(g-1),p=h.getX(u),m=yr(this,e,ki,c,_,p);m&&n.push(m)}}else{const u=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let _=u,p=g-1;_<p;_+=l){const m=yr(this,e,ki,c,_,_+1);m&&n.push(m)}if(this.isLineLoop){const _=yr(this,e,ki,c,g-1,u);_&&n.push(_)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function yr(t,e,n,i,r,s){const a=t.geometry.attributes.position;if(Fr.fromBufferAttribute(a,r),Or.fromBufferAttribute(a,s),n.distanceSqToSegment(Fr,Or,bs,nc)>i)return;bs.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(bs);if(!(c<e.near||c>e.far))return{distance:c,point:nc.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:t}}class f1 extends Ci{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new Oe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const ic=new je,ga=new ji,Sr=new Zn,Er=new z;class La extends ut{constructor(e=new pt,n=new f1){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,n){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Sr.copy(i.boundingSphere),Sr.applyMatrix4(r),Sr.radius+=s,e.ray.intersectsSphere(Sr)===!1)return;ic.copy(r).invert(),ga.copy(e.ray).applyMatrix4(ic);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=i.index,f=i.attributes.position;if(l!==null){const d=Math.max(0,a.start),u=Math.min(l.count,a.start+a.count);for(let g=d,_=u;g<_;g++){const p=l.getX(g);Er.fromBufferAttribute(f,p),rc(Er,p,c,r,e,n,this)}}else{const d=Math.max(0,a.start),u=Math.min(f.count,a.start+a.count);for(let g=d,_=u;g<_;g++)Er.fromBufferAttribute(f,g),rc(Er,g,c,r,e,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function rc(t,e,n,i,r,s,a){const o=ga.distanceSqToPoint(t);if(o<n){const c=new z;ga.closestPointToPoint(t,c),c.applyMatrix4(i);const l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Ia extends pt{constructor(e=1,n=1,i=1,r=32,s=1,a=!1,o=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:c};const l=this;r=Math.floor(r),s=Math.floor(s);const h=[],f=[],d=[],u=[];let g=0;const _=[],p=i/2;let m=0;T(),a===!1&&(e>0&&y(!0),n>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new ot(f,3)),this.setAttribute("normal",new ot(d,3)),this.setAttribute("uv",new ot(u,2));function T(){const v=new z,P=new z;let b=0;const w=(n-e)/i;for(let R=0;R<=s;R++){const S=[],x=R/s,C=x*(n-e)+e;for(let L=0;L<=r;L++){const D=L/r,U=D*c+o,X=Math.sin(U),V=Math.cos(U);P.x=C*X,P.y=-x*i+p,P.z=C*V,f.push(P.x,P.y,P.z),v.set(X,w,V).normalize(),d.push(v.x,v.y,v.z),u.push(D,1-x),S.push(g++)}_.push(S)}for(let R=0;R<r;R++)for(let S=0;S<s;S++){const x=_[S][R],C=_[S+1][R],L=_[S+1][R+1],D=_[S][R+1];(e>0||S!==0)&&(h.push(x,C,D),b+=3),(n>0||S!==s-1)&&(h.push(C,L,D),b+=3)}l.addGroup(m,b,0),m+=b}function y(v){const P=g,b=new we,w=new z;let R=0;const S=v===!0?e:n,x=v===!0?1:-1;for(let L=1;L<=r;L++)f.push(0,p*x,0),d.push(0,x,0),u.push(.5,.5),g++;const C=g;for(let L=0;L<=r;L++){const U=L/r*c+o,X=Math.cos(U),V=Math.sin(U);w.x=S*V,w.y=p*x,w.z=S*X,f.push(w.x,w.y,w.z),d.push(0,x,0),b.x=X*.5+.5,b.y=V*.5*x+.5,u.push(b.x,b.y),g++}for(let L=0;L<r;L++){const D=P+L,U=C+L;v===!0?h.push(U,U+1,D):h.push(U+1,U,D),R+=3}l.addGroup(m,R,v===!0?1:2),m+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ia(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}const sc={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class d1{constructor(e,n,i){const r=this;let s=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=i,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 c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,f){return l.push(h,f),this},this.removeHandler=function(h){const f=l.indexOf(h);return f!==-1&&l.splice(f,2),this},this.getHandler=function(h){for(let f=0,d=l.length;f<d;f+=2){const u=l[f],g=l[f+1];if(u.global&&(u.lastIndex=0),u.test(h))return g}return null}}}const u1=new d1;class Ua{constructor(e){this.manager=e!==void 0?e:u1,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const i=this;return new Promise(function(r,s){i.load(e,r,n,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}}Ua.DEFAULT_MATERIAL_NAME="__DEFAULT";class p1 extends Ua{constructor(e){super(e)}load(e,n,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=sc.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a;const o=qi("img");function c(){h(),sc.add(e,this),n&&n(this),s.manager.itemEnd(e)}function l(f){h(),r&&r(f),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class el extends Ua{constructor(e){super(e)}load(e,n,i,r){const s=new Mt,a=new p1(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,n!==void 0&&n(s)},i,r),s}}class tl extends ut{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Oe(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}const As=new je,ac=new z,oc=new z;class m1{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new we(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ca,this._frameExtents=new we(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;ac.setFromMatrixPosition(e.matrixWorld),n.position.copy(ac),oc.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(oc),n.updateMatrixWorld(),As.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(As),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(As)}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.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const 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}}class g1 extends m1{constructor(){super(new Yc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class _1 extends tl{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ut.DEFAULT_UP),this.updateMatrix(),this.target=new ut,this.shadow=new g1}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class v1 extends tl{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}const cc=new je;class x1{constructor(e,n,i=0,r=1/0){this.ray=new ji(e,n),this.near=i,this.far=r,this.camera=null,this.layers=new Ra,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return cc.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(cc),this}intersectObject(e,n=!0,i=[]){return _a(e,this,i,n),i.sort(lc),i}intersectObjects(e,n=!0,i=[]){for(let r=0,s=e.length;r<s;r++)_a(e[r],this,i,n);return i.sort(lc),i}}function lc(t,e){return t.distance-e.distance}function _a(t,e,n,i){let r=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(r=!1),r===!0&&i===!0){const s=t.children;for(let a=0,o=s.length;a<o;a++)_a(s[a],e,n,!0)}}class hc{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Tt(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class M1 extends Yn{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ma}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ma);function y1(t){const e=t.length;if(e<2)return new pt;const n=[],i=[],r=[],s=[];for(let c=0;c<e;c++){const l=t[c],h=c>0?t[c-1]:l,f=c<e-1?t[c+1]:l;n.push(l.x,l.y,l.z),i.push(h.x,h.y,h.z),r.push(f.x,f.y,f.z),s.push(-1),n.push(l.x,l.y,l.z),i.push(h.x,h.y,h.z),r.push(f.x,f.y,f.z),s.push(1)}const a=new pt;a.setAttribute("position",new ot(n,3)),a.setAttribute("positionPrev",new ot(i,3)),a.setAttribute("positionNext",new ot(r,3)),a.setAttribute("side",new ot(s,1));const o=[];for(let c=0;c<e-1;c++){const l=c*2;o.push(l,l+1,l+2,l+2,l+1,l+3)}return a.setIndex(o),a.computeBoundingSphere(),a}const S1=`
|
|
3828
|
+
}`;class tg{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const r=new Mt,s=e.properties.get(r);s.__webglTexture=n.texture,(n.depthNear!=i.depthNear||n.depthFar!=i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new Yt({vertexShader:Q0,fragmentShader:eg,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Rt(new Wr(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ng extends Yn{constructor(e,n){super();const i=this;let r=null,s=1,a=null,o="local-floor",c=1,l=null,h=null,f=null,d=null,u=null,g=null;const _=new tg,p=n.getContextAttributes();let m=null,T=null;const y=[],v=[],P=new we;let b=null;const w=new zt;w.viewport=new st;const R=new zt;R.viewport=new st;const S=[w,R],x=new K0;let C=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let Q=y[q];return Q===void 0&&(Q=new Ts,y[q]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(q){let Q=y[q];return Q===void 0&&(Q=new Ts,y[q]=Q),Q.getGripSpace()},this.getHand=function(q){let Q=y[q];return Q===void 0&&(Q=new Ts,y[q]=Q),Q.getHandSpace()};function D(q){const Q=v.indexOf(q.inputSource);if(Q===-1)return;const he=y[Q];he!==void 0&&(he.update(q.inputSource,q.frame,l||a),he.dispatchEvent({type:q.type,data:q.inputSource}))}function U(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",U),r.removeEventListener("inputsourceschange",X);for(let q=0;q<y.length;q++){const Q=v[q];Q!==null&&(v[q]=null,y[q].disconnect(Q))}C=null,L=null,_.reset(),e.setRenderTarget(m),u=null,d=null,f=null,r=null,T=null,Xe.stop(),i.isPresenting=!1,e.setPixelRatio(b),e.setSize(P.width,P.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){s=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){o=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(q){l=q},this.getBaseLayer=function(){return d!==null?d:u},this.getBinding=function(){return f},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(q){if(r=q,r!==null){if(m=e.getRenderTarget(),r.addEventListener("select",D),r.addEventListener("selectstart",D),r.addEventListener("selectend",D),r.addEventListener("squeeze",D),r.addEventListener("squeezestart",D),r.addEventListener("squeezeend",D),r.addEventListener("end",U),r.addEventListener("inputsourceschange",X),p.xrCompatible!==!0&&await n.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(P),r.renderState.layers===void 0){const Q={antialias:p.antialias,alpha:!0,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(r,n,Q),r.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),T=new $n(u.framebufferWidth,u.framebufferHeight,{format:qt,type:pn,colorSpace:e.outputColorSpace,stencilBuffer:p.stencil})}else{let Q=null,he=null,re=null;p.depth&&(re=p.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Q=p.stencil?bi:xi,he=p.stencil?Ti:qn);const Se={colorFormat:n.RGBA8,depthFormat:re,scaleFactor:s};f=new XRWebGLBinding(r,n),d=f.createProjectionLayer(Se),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),T=new $n(d.textureWidth,d.textureHeight,{format:qt,type:pn,depthTexture:new jc(d.textureWidth,d.textureHeight,he,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:p.stencil,colorSpace:e.outputColorSpace,samples:p.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await r.requestReferenceSpace(o),Xe.setContext(r),Xe.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function X(q){for(let Q=0;Q<q.removed.length;Q++){const he=q.removed[Q],re=v.indexOf(he);re>=0&&(v[re]=null,y[re].disconnect(he))}for(let Q=0;Q<q.added.length;Q++){const he=q.added[Q];let re=v.indexOf(he);if(re===-1){for(let Re=0;Re<y.length;Re++)if(Re>=v.length){v.push(he),re=Re;break}else if(v[Re]===null){v[Re]=he,re=Re;break}if(re===-1)break}const Se=y[re];Se&&Se.connect(he)}}const V=new z,K=new z;function G(q,Q,he){V.setFromMatrixPosition(Q.matrixWorld),K.setFromMatrixPosition(he.matrixWorld);const re=V.distanceTo(K),Se=Q.projectionMatrix.elements,Re=he.projectionMatrix.elements,Fe=Se[14]/(Se[10]-1),it=Se[14]/(Se[10]+1),ke=(Se[9]+1)/Se[5],at=(Se[9]-1)/Se[5],O=(Se[8]-1)/Se[0],Ut=(Re[8]+1)/Re[0],ze=Fe*O,Be=Fe*Ut,Ee=re/(-O+Ut),et=Ee*-O;if(Q.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(et),q.translateZ(Ee),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert(),Se[10]===-1)q.projectionMatrix.copy(Q.projectionMatrix),q.projectionMatrixInverse.copy(Q.projectionMatrixInverse);else{const ye=Fe+Ee,A=it+Ee,M=ze-et,B=Be+(re-et),Y=ke*it/A*ye,Z=at*it/A*ye;q.projectionMatrix.makePerspective(M,B,Y,Z,ye,A),q.projectionMatrixInverse.copy(q.projectionMatrix).invert()}}function te(q,Q){Q===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(Q.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.updateCamera=function(q){if(r===null)return;let Q=q.near,he=q.far;_.texture!==null&&(_.depthNear>0&&(Q=_.depthNear),_.depthFar>0&&(he=_.depthFar)),x.near=R.near=w.near=Q,x.far=R.far=w.far=he,(C!==x.near||L!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),C=x.near,L=x.far),w.layers.mask=q.layers.mask|2,R.layers.mask=q.layers.mask|4,x.layers.mask=w.layers.mask|R.layers.mask;const re=q.parent,Se=x.cameras;te(x,re);for(let Re=0;Re<Se.length;Re++)te(Se[Re],re);Se.length===2?G(x,w,R):x.projectionMatrix.copy(w.projectionMatrix),ie(q,x,re)};function ie(q,Q,he){he===null?q.matrix.copy(Q.matrixWorld):(q.matrix.copy(he.matrixWorld),q.matrix.invert(),q.matrix.multiply(Q.matrixWorld)),q.matrix.decompose(q.position,q.quaternion,q.scale),q.updateMatrixWorld(!0),q.projectionMatrix.copy(Q.projectionMatrix),q.projectionMatrixInverse.copy(Q.projectionMatrixInverse),q.isPerspectiveCamera&&(q.fov=pa*2*Math.atan(1/q.projectionMatrix.elements[5]),q.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(d===null&&u===null))return c},this.setFoveation=function(q){c=q,d!==null&&(d.fixedFoveation=q),u!==null&&u.fixedFoveation!==void 0&&(u.fixedFoveation=q)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(x)};let ve=null;function Le(q,Q){if(h=Q.getViewerPose(l||a),g=Q,h!==null){const he=h.views;u!==null&&(e.setRenderTargetFramebuffer(T,u.framebuffer),e.setRenderTarget(T));let re=!1;he.length!==x.cameras.length&&(x.cameras.length=0,re=!0);for(let Re=0;Re<he.length;Re++){const Fe=he[Re];let it=null;if(u!==null)it=u.getViewport(Fe);else{const at=f.getViewSubImage(d,Fe);it=at.viewport,Re===0&&(e.setRenderTargetTextures(T,at.colorTexture,d.ignoreDepthValues?void 0:at.depthStencilTexture),e.setRenderTarget(T))}let ke=S[Re];ke===void 0&&(ke=new zt,ke.layers.enable(Re),ke.viewport=new st,S[Re]=ke),ke.matrix.fromArray(Fe.transform.matrix),ke.matrix.decompose(ke.position,ke.quaternion,ke.scale),ke.projectionMatrix.fromArray(Fe.projectionMatrix),ke.projectionMatrixInverse.copy(ke.projectionMatrix).invert(),ke.viewport.set(it.x,it.y,it.width,it.height),Re===0&&(x.matrix.copy(ke.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),re===!0&&x.cameras.push(ke)}const Se=r.enabledFeatures;if(Se&&Se.includes("depth-sensing")){const Re=f.getDepthInformation(he[0]);Re&&Re.isValid&&Re.texture&&_.init(e,Re,r.renderState)}}for(let he=0;he<y.length;he++){const re=v[he],Se=y[he];re!==null&&Se!==void 0&&Se.update(re,Q,l||a)}ve&&ve(q,Q),Q.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Q}),g=null}const Xe=new $c;Xe.setAnimationLoop(Le),this.setAnimationLoop=function(q){ve=q},this.dispose=function(){}}}const Hn=new mn,ig=new je;function rg(t,e){function n(p,m){p.matrixAutoUpdate===!0&&p.updateMatrix(),m.value.copy(p.matrix)}function i(p,m){m.color.getRGB(p.fogColor.value,Wc(t)),m.isFog?(p.fogNear.value=m.near,p.fogFar.value=m.far):m.isFogExp2&&(p.fogDensity.value=m.density)}function r(p,m,T,y,v){m.isMeshBasicMaterial||m.isMeshLambertMaterial?s(p,m):m.isMeshToonMaterial?(s(p,m),f(p,m)):m.isMeshPhongMaterial?(s(p,m),h(p,m)):m.isMeshStandardMaterial?(s(p,m),d(p,m),m.isMeshPhysicalMaterial&&u(p,m,v)):m.isMeshMatcapMaterial?(s(p,m),g(p,m)):m.isMeshDepthMaterial?s(p,m):m.isMeshDistanceMaterial?(s(p,m),_(p,m)):m.isMeshNormalMaterial?s(p,m):m.isLineBasicMaterial?(a(p,m),m.isLineDashedMaterial&&o(p,m)):m.isPointsMaterial?c(p,m,T,y):m.isSpriteMaterial?l(p,m):m.isShadowMaterial?(p.color.value.copy(m.color),p.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(p,m){p.opacity.value=m.opacity,m.color&&p.diffuse.value.copy(m.color),m.emissive&&p.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(p.map.value=m.map,n(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform)),m.bumpMap&&(p.bumpMap.value=m.bumpMap,n(m.bumpMap,p.bumpMapTransform),p.bumpScale.value=m.bumpScale,m.side===Ct&&(p.bumpScale.value*=-1)),m.normalMap&&(p.normalMap.value=m.normalMap,n(m.normalMap,p.normalMapTransform),p.normalScale.value.copy(m.normalScale),m.side===Ct&&p.normalScale.value.negate()),m.displacementMap&&(p.displacementMap.value=m.displacementMap,n(m.displacementMap,p.displacementMapTransform),p.displacementScale.value=m.displacementScale,p.displacementBias.value=m.displacementBias),m.emissiveMap&&(p.emissiveMap.value=m.emissiveMap,n(m.emissiveMap,p.emissiveMapTransform)),m.specularMap&&(p.specularMap.value=m.specularMap,n(m.specularMap,p.specularMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest);const T=e.get(m),y=T.envMap,v=T.envMapRotation;y&&(p.envMap.value=y,Hn.copy(v),Hn.x*=-1,Hn.y*=-1,Hn.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Hn.y*=-1,Hn.z*=-1),p.envMapRotation.value.setFromMatrix4(ig.makeRotationFromEuler(Hn)),p.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=m.reflectivity,p.ior.value=m.ior,p.refractionRatio.value=m.refractionRatio),m.lightMap&&(p.lightMap.value=m.lightMap,p.lightMapIntensity.value=m.lightMapIntensity,n(m.lightMap,p.lightMapTransform)),m.aoMap&&(p.aoMap.value=m.aoMap,p.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,p.aoMapTransform))}function a(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,m.map&&(p.map.value=m.map,n(m.map,p.mapTransform))}function o(p,m){p.dashSize.value=m.dashSize,p.totalSize.value=m.dashSize+m.gapSize,p.scale.value=m.scale}function c(p,m,T,y){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.size.value=m.size*T,p.scale.value=y*.5,m.map&&(p.map.value=m.map,n(m.map,p.uvTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function l(p,m){p.diffuse.value.copy(m.color),p.opacity.value=m.opacity,p.rotation.value=m.rotation,m.map&&(p.map.value=m.map,n(m.map,p.mapTransform)),m.alphaMap&&(p.alphaMap.value=m.alphaMap,n(m.alphaMap,p.alphaMapTransform)),m.alphaTest>0&&(p.alphaTest.value=m.alphaTest)}function h(p,m){p.specular.value.copy(m.specular),p.shininess.value=Math.max(m.shininess,1e-4)}function f(p,m){m.gradientMap&&(p.gradientMap.value=m.gradientMap)}function d(p,m){p.metalness.value=m.metalness,m.metalnessMap&&(p.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,p.metalnessMapTransform)),p.roughness.value=m.roughness,m.roughnessMap&&(p.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,p.roughnessMapTransform)),m.envMap&&(p.envMapIntensity.value=m.envMapIntensity)}function u(p,m,T){p.ior.value=m.ior,m.sheen>0&&(p.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),p.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(p.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,p.sheenColorMapTransform)),m.sheenRoughnessMap&&(p.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,p.sheenRoughnessMapTransform))),m.clearcoat>0&&(p.clearcoat.value=m.clearcoat,p.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(p.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,p.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(p.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Ct&&p.clearcoatNormalScale.value.negate())),m.dispersion>0&&(p.dispersion.value=m.dispersion),m.iridescence>0&&(p.iridescence.value=m.iridescence,p.iridescenceIOR.value=m.iridescenceIOR,p.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(p.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,p.iridescenceMapTransform)),m.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),m.transmission>0&&(p.transmission.value=m.transmission,p.transmissionSamplerMap.value=T.texture,p.transmissionSamplerSize.value.set(T.width,T.height),m.transmissionMap&&(p.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,p.transmissionMapTransform)),p.thickness.value=m.thickness,m.thicknessMap&&(p.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=m.attenuationDistance,p.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(p.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(p.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=m.specularIntensity,p.specularColor.value.copy(m.specularColor),m.specularColorMap&&(p.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,p.specularColorMapTransform)),m.specularIntensityMap&&(p.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,p.specularIntensityMapTransform))}function g(p,m){m.matcap&&(p.matcap.value=m.matcap)}function _(p,m){const T=e.get(m).light;p.referencePosition.value.setFromMatrixPosition(T.matrixWorld),p.nearDistance.value=T.shadow.camera.near,p.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function sg(t,e,n,i){let r={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(T,y){const v=y.program;i.uniformBlockBinding(T,v)}function l(T,y){let v=r[T.id];v===void 0&&(g(T),v=h(T),r[T.id]=v,T.addEventListener("dispose",p));const P=y.program;i.updateUBOMapping(T,P);const b=e.render.frame;s[T.id]!==b&&(d(T),s[T.id]=b)}function h(T){const y=f();T.__bindingPointIndex=y;const v=t.createBuffer(),P=T.__size,b=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,v),t.bufferData(t.UNIFORM_BUFFER,P,b),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,y,v),v}function f(){for(let T=0;T<o;T++)if(a.indexOf(T)===-1)return a.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(T){const y=r[T.id],v=T.uniforms,P=T.__cache;t.bindBuffer(t.UNIFORM_BUFFER,y);for(let b=0,w=v.length;b<w;b++){const R=Array.isArray(v[b])?v[b]:[v[b]];for(let S=0,x=R.length;S<x;S++){const C=R[S];if(u(C,b,S,P)===!0){const L=C.__offset,D=Array.isArray(C.value)?C.value:[C.value];let U=0;for(let X=0;X<D.length;X++){const V=D[X],K=_(V);typeof V=="number"||typeof V=="boolean"?(C.__data[0]=V,t.bufferSubData(t.UNIFORM_BUFFER,L+U,C.__data)):V.isMatrix3?(C.__data[0]=V.elements[0],C.__data[1]=V.elements[1],C.__data[2]=V.elements[2],C.__data[3]=0,C.__data[4]=V.elements[3],C.__data[5]=V.elements[4],C.__data[6]=V.elements[5],C.__data[7]=0,C.__data[8]=V.elements[6],C.__data[9]=V.elements[7],C.__data[10]=V.elements[8],C.__data[11]=0):(V.toArray(C.__data,U),U+=K.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,L,C.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function u(T,y,v,P){const b=T.value,w=y+"_"+v;if(P[w]===void 0)return typeof b=="number"||typeof b=="boolean"?P[w]=b:P[w]=b.clone(),!0;{const R=P[w];if(typeof b=="number"||typeof b=="boolean"){if(R!==b)return P[w]=b,!0}else if(R.equals(b)===!1)return R.copy(b),!0}return!1}function g(T){const y=T.uniforms;let v=0;const P=16;for(let w=0,R=y.length;w<R;w++){const S=Array.isArray(y[w])?y[w]:[y[w]];for(let x=0,C=S.length;x<C;x++){const L=S[x],D=Array.isArray(L.value)?L.value:[L.value];for(let U=0,X=D.length;U<X;U++){const V=D[U],K=_(V),G=v%P,te=G%K.boundary,ie=G+te;v+=te,ie!==0&&P-ie<K.storage&&(v+=P-ie),L.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=v,v+=K.storage}}}const b=v%P;return b>0&&(v+=P-b),T.__size=v,T.__cache={},this}function _(T){const y={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(y.boundary=4,y.storage=4):T.isVector2?(y.boundary=8,y.storage=8):T.isVector3||T.isColor?(y.boundary=16,y.storage=12):T.isVector4?(y.boundary=16,y.storage=16):T.isMatrix3?(y.boundary=48,y.storage=48):T.isMatrix4?(y.boundary=64,y.storage=64):T.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",T),y}function p(T){const y=T.target;y.removeEventListener("dispose",p);const v=a.indexOf(y.__bindingPointIndex);a.splice(v,1),t.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function m(){for(const T in r)t.deleteBuffer(r[T]);a=[],r={},s={}}return{bind:c,update:l,dispose:m}}class ag{constructor(e={}){const{canvas:n=Yf(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let u;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=i.getContextAttributes().alpha}else u=a;const g=new Uint32Array(4),_=new Int32Array(4);let p=null,m=null;const T=[],y=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ot,this.toneMapping=Pn,this.toneMappingExposure=1;const v=this;let P=!1,b=0,w=0,R=null,S=-1,x=null;const C=new st,L=new st;let D=null;const U=new Oe(0);let X=0,V=n.width,K=n.height,G=1,te=null,ie=null;const ve=new st(0,0,V,K),Le=new st(0,0,V,K);let Xe=!1;const q=new Ca;let Q=!1,he=!1;const re=new je,Se=new je,Re=new z,Fe=new st,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ke=!1;function at(){return R===null?G:1}let O=i;function Ut(E,N){return n.getContext(E,N)}try{const E={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Ma}`),n.addEventListener("webglcontextlost",j,!1),n.addEventListener("webglcontextrestored",le,!1),n.addEventListener("webglcontextcreationerror",oe,!1),O===null){const N="webgl2";if(O=Ut(N,E),O===null)throw Ut(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let ze,Be,Ee,et,ye,A,M,B,Y,Z,$,xe,ae,fe,Ve,J,de,Te,be,ue,He,Ie,Je,I;function se(){ze=new fm(O),ze.init(),Ie=new Z0(O,ze),Be=new sm(O,ze,e,Ie),Ee=new $0(O,ze),Be.reverseDepthBuffer&&d&&Ee.buffers.depth.setReversed(!0),et=new pm(O),ye=new L0,A=new j0(O,ze,Ee,ye,Be,Ie,et),M=new om(v),B=new hm(v),Y=new yd(O),Je=new im(O,Y),Z=new dm(O,Y,et,Je),$=new gm(O,Z,Y,et),be=new mm(O,Be,A),J=new am(ye),xe=new D0(v,M,B,ze,Be,Je,J),ae=new rg(v,ye),fe=new U0,Ve=new H0(ze),Te=new nm(v,M,B,Ee,$,u,c),de=new X0(v,$,Be),I=new sg(O,et,Be,Ee),ue=new rm(O,ze,et),He=new um(O,ze,et),et.programs=xe.programs,v.capabilities=Be,v.extensions=ze,v.properties=ye,v.renderLists=fe,v.shadowMap=de,v.state=Ee,v.info=et}se();const W=new ng(v,O);this.xr=W,this.getContext=function(){return O},this.getContextAttributes=function(){return O.getContextAttributes()},this.forceContextLoss=function(){const E=ze.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=ze.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(E){E!==void 0&&(G=E,this.setSize(V,K,!1))},this.getSize=function(E){return E.set(V,K)},this.setSize=function(E,N,H=!0){if(W.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=E,K=N,n.width=Math.floor(E*G),n.height=Math.floor(N*G),H===!0&&(n.style.width=E+"px",n.style.height=N+"px"),this.setViewport(0,0,E,N)},this.getDrawingBufferSize=function(E){return E.set(V*G,K*G).floor()},this.setDrawingBufferSize=function(E,N,H){V=E,K=N,G=H,n.width=Math.floor(E*H),n.height=Math.floor(N*H),this.setViewport(0,0,E,N)},this.getCurrentViewport=function(E){return E.copy(C)},this.getViewport=function(E){return E.copy(ve)},this.setViewport=function(E,N,H,k){E.isVector4?ve.set(E.x,E.y,E.z,E.w):ve.set(E,N,H,k),Ee.viewport(C.copy(ve).multiplyScalar(G).round())},this.getScissor=function(E){return E.copy(Le)},this.setScissor=function(E,N,H,k){E.isVector4?Le.set(E.x,E.y,E.z,E.w):Le.set(E,N,H,k),Ee.scissor(L.copy(Le).multiplyScalar(G).round())},this.getScissorTest=function(){return Xe},this.setScissorTest=function(E){Ee.setScissorTest(Xe=E)},this.setOpaqueSort=function(E){te=E},this.setTransparentSort=function(E){ie=E},this.getClearColor=function(E){return E.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor.apply(Te,arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha.apply(Te,arguments)},this.clear=function(E=!0,N=!0,H=!0){let k=0;if(E){let F=!1;if(R!==null){const ee=R.texture.format;F=ee===wa||ee===Aa||ee===ba}if(F){const ee=R.texture.type,ce=ee===pn||ee===qn||ee===Xi||ee===Ti||ee===Sa||ee===Ea,me=Te.getClearColor(),ge=Te.getClearAlpha(),Ae=me.r,Pe=me.g,_e=me.b;ce?(g[0]=Ae,g[1]=Pe,g[2]=_e,g[3]=ge,O.clearBufferuiv(O.COLOR,0,g)):(_[0]=Ae,_[1]=Pe,_[2]=_e,_[3]=ge,O.clearBufferiv(O.COLOR,0,_))}else k|=O.COLOR_BUFFER_BIT}N&&(k|=O.DEPTH_BUFFER_BIT),H&&(k|=O.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),O.clear(k)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",j,!1),n.removeEventListener("webglcontextrestored",le,!1),n.removeEventListener("webglcontextcreationerror",oe,!1),fe.dispose(),Ve.dispose(),ye.dispose(),M.dispose(),B.dispose(),$.dispose(),Je.dispose(),I.dispose(),xe.dispose(),W.dispose(),W.removeEventListener("sessionstart",Xa),W.removeEventListener("sessionend",qa),Un.stop()};function j(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const E=et.autoReset,N=de.enabled,H=de.autoUpdate,k=de.needsUpdate,F=de.type;se(),et.autoReset=E,de.enabled=N,de.autoUpdate=H,de.needsUpdate=k,de.type=F}function oe(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function Ce(E){const N=E.target;N.removeEventListener("dispose",Ce),rt(N)}function rt(E){gt(E),ye.remove(E)}function gt(E){const N=ye.get(E).programs;N!==void 0&&(N.forEach(function(H){xe.releaseProgram(H)}),E.isShaderMaterial&&xe.releaseShaderCache(E))}this.renderBufferDirect=function(E,N,H,k,F,ee){N===null&&(N=it);const ce=F.isMesh&&F.matrixWorld.determinant()<0,me=Ah(E,N,H,k,F);Ee.setMaterial(k,ce);let ge=H.index,Ae=1;if(k.wireframe===!0){if(ge=Z.getWireframeAttribute(H),ge===void 0)return;Ae=2}const Pe=H.drawRange,_e=H.attributes.position;let We=Pe.start*Ae,Qe=(Pe.start+Pe.count)*Ae;ee!==null&&(We=Math.max(We,ee.start*Ae),Qe=Math.min(Qe,(ee.start+ee.count)*Ae)),ge!==null?(We=Math.max(We,0),Qe=Math.min(Qe,ge.count)):_e!=null&&(We=Math.max(We,0),Qe=Math.min(Qe,_e.count));const tt=Qe-We;if(tt<0||tt===1/0)return;Je.setup(F,k,me,H,ge);let bt,qe=ue;if(ge!==null&&(bt=Y.get(ge),qe=He,qe.setIndex(bt)),F.isMesh)k.wireframe===!0?(Ee.setLineWidth(k.wireframeLinewidth*at()),qe.setMode(O.LINES)):qe.setMode(O.TRIANGLES);else if(F.isLine){let Me=k.linewidth;Me===void 0&&(Me=1),Ee.setLineWidth(Me*at()),F.isLineSegments?qe.setMode(O.LINES):F.isLineLoop?qe.setMode(O.LINE_LOOP):qe.setMode(O.LINE_STRIP)}else F.isPoints?qe.setMode(O.POINTS):F.isSprite&&qe.setMode(O.TRIANGLES);if(F.isBatchedMesh)if(F._multiDrawInstances!==null)qe.renderMultiDrawInstances(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount,F._multiDrawInstances);else if(ze.get("WEBGL_multi_draw"))qe.renderMultiDraw(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount);else{const Me=F._multiDrawStarts,rn=F._multiDrawCounts,$e=F._multiDrawCount,kt=ge?Y.get(ge).bytesPerElement:1,Jn=ye.get(k).currentProgram.getUniforms();for(let Pt=0;Pt<$e;Pt++)Jn.setValue(O,"_gl_DrawID",Pt),qe.render(Me[Pt]/kt,rn[Pt])}else if(F.isInstancedMesh)qe.renderInstances(We,tt,F.count);else if(H.isInstancedBufferGeometry){const Me=H._maxInstanceCount!==void 0?H._maxInstanceCount:1/0,rn=Math.min(H.instanceCount,Me);qe.renderInstances(We,tt,rn)}else qe.render(We,tt)};function Ye(E,N,H){E.transparent===!0&&E.side===Jt&&E.forceSinglePass===!1?(E.side=Ct,E.needsUpdate=!0,Ki(E,N,H),E.side=Dn,E.needsUpdate=!0,Ki(E,N,H),E.side=Jt):Ki(E,N,H)}this.compile=function(E,N,H=null){H===null&&(H=E),m=Ve.get(H),m.init(N),y.push(m),H.traverseVisible(function(F){F.isLight&&F.layers.test(N.layers)&&(m.pushLight(F),F.castShadow&&m.pushShadow(F))}),E!==H&&E.traverseVisible(function(F){F.isLight&&F.layers.test(N.layers)&&(m.pushLight(F),F.castShadow&&m.pushShadow(F))}),m.setupLights();const k=new Set;return E.traverse(function(F){if(!(F.isMesh||F.isPoints||F.isLine||F.isSprite))return;const ee=F.material;if(ee)if(Array.isArray(ee))for(let ce=0;ce<ee.length;ce++){const me=ee[ce];Ye(me,H,F),k.add(me)}else Ye(ee,H,F),k.add(ee)}),y.pop(),m=null,k},this.compileAsync=function(E,N,H=null){const k=this.compile(E,N,H);return new Promise(F=>{function ee(){if(k.forEach(function(ce){ye.get(ce).currentProgram.isReady()&&k.delete(ce)}),k.size===0){F(E);return}setTimeout(ee,10)}ze.get("KHR_parallel_shader_compile")!==null?ee():setTimeout(ee,10)})};let Ht=null;function nn(E){Ht&&Ht(E)}function Xa(){Un.stop()}function qa(){Un.start()}const Un=new $c;Un.setAnimationLoop(nn),typeof self<"u"&&Un.setContext(self),this.setAnimationLoop=function(E){Ht=E,W.setAnimationLoop(E),E===null?Un.stop():Un.start()},W.addEventListener("sessionstart",Xa),W.addEventListener("sessionend",qa),this.render=function(E,N){if(N!==void 0&&N.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(W.cameraAutoUpdate===!0&&W.updateCamera(N),N=W.getCamera()),E.isScene===!0&&E.onBeforeRender(v,E,N,R),m=Ve.get(E,y.length),m.init(N),y.push(m),Se.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),q.setFromProjectionMatrix(Se),he=this.localClippingEnabled,Q=J.init(this.clippingPlanes,he),p=fe.get(E,T.length),p.init(),T.push(p),W.enabled===!0&&W.isPresenting===!0){const ee=v.xr.getDepthSensingMesh();ee!==null&&jr(ee,N,-1/0,v.sortObjects)}jr(E,N,0,v.sortObjects),p.finish(),v.sortObjects===!0&&p.sort(te,ie),ke=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,ke&&Te.addToRenderList(p,E),this.info.render.frame++,Q===!0&&J.beginShadows();const H=m.state.shadowsArray;de.render(H,E,N),Q===!0&&J.endShadows(),this.info.autoReset===!0&&this.info.reset();const k=p.opaque,F=p.transmissive;if(m.setupLights(),N.isArrayCamera){const ee=N.cameras;if(F.length>0)for(let ce=0,me=ee.length;ce<me;ce++){const ge=ee[ce];Ya(k,F,E,ge)}ke&&Te.render(E);for(let ce=0,me=ee.length;ce<me;ce++){const ge=ee[ce];$a(p,E,ge,ge.viewport)}}else F.length>0&&Ya(k,F,E,N),ke&&Te.render(E),$a(p,E,N);R!==null&&(A.updateMultisampleRenderTarget(R),A.updateRenderTargetMipmap(R)),E.isScene===!0&&E.onAfterRender(v,E,N),Je.resetDefaultState(),S=-1,x=null,y.pop(),y.length>0?(m=y[y.length-1],Q===!0&&J.setGlobalState(v.clippingPlanes,m.state.camera)):m=null,T.pop(),T.length>0?p=T[T.length-1]:p=null};function jr(E,N,H,k){if(E.visible===!1)return;if(E.layers.test(N.layers)){if(E.isGroup)H=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(N);else if(E.isLight)m.pushLight(E),E.castShadow&&m.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||q.intersectsSprite(E)){k&&Fe.setFromMatrixPosition(E.matrixWorld).applyMatrix4(Se);const ce=$.update(E),me=E.material;me.visible&&p.push(E,ce,me,H,Fe.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||q.intersectsObject(E))){const ce=$.update(E),me=E.material;if(k&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Fe.copy(E.boundingSphere.center)):(ce.boundingSphere===null&&ce.computeBoundingSphere(),Fe.copy(ce.boundingSphere.center)),Fe.applyMatrix4(E.matrixWorld).applyMatrix4(Se)),Array.isArray(me)){const ge=ce.groups;for(let Ae=0,Pe=ge.length;Ae<Pe;Ae++){const _e=ge[Ae],We=me[_e.materialIndex];We&&We.visible&&p.push(E,ce,We,H,Fe.z,_e)}}else me.visible&&p.push(E,ce,me,H,Fe.z,null)}}const ee=E.children;for(let ce=0,me=ee.length;ce<me;ce++)jr(ee[ce],N,H,k)}function $a(E,N,H,k){const F=E.opaque,ee=E.transmissive,ce=E.transparent;m.setupLightsView(H),Q===!0&&J.setGlobalState(v.clippingPlanes,H),k&&Ee.viewport(C.copy(k)),F.length>0&&Zi(F,N,H),ee.length>0&&Zi(ee,N,H),ce.length>0&&Zi(ce,N,H),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function Ya(E,N,H,k){if((H.isScene===!0?H.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[k.id]===void 0&&(m.state.transmissionRenderTarget[k.id]=new $n(1,1,{generateMipmaps:!0,type:ze.has("EXT_color_buffer_half_float")||ze.has("EXT_color_buffer_float")?$i:pn,minFilter:Xn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ge.workingColorSpace}));const ee=m.state.transmissionRenderTarget[k.id],ce=k.viewport||C;ee.setSize(ce.z,ce.w);const me=v.getRenderTarget();v.setRenderTarget(ee),v.getClearColor(U),X=v.getClearAlpha(),X<1&&v.setClearColor(16777215,.5),v.clear(),ke&&Te.render(H);const ge=v.toneMapping;v.toneMapping=Pn;const Ae=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),m.setupLightsView(k),Q===!0&&J.setGlobalState(v.clippingPlanes,k),Zi(E,H,k),A.updateMultisampleRenderTarget(ee),A.updateRenderTargetMipmap(ee),ze.has("WEBGL_multisampled_render_to_texture")===!1){let Pe=!1;for(let _e=0,We=N.length;_e<We;_e++){const Qe=N[_e],tt=Qe.object,bt=Qe.geometry,qe=Qe.material,Me=Qe.group;if(qe.side===Jt&&tt.layers.test(k.layers)){const rn=qe.side;qe.side=Ct,qe.needsUpdate=!0,ja(tt,H,k,bt,qe,Me),qe.side=rn,qe.needsUpdate=!0,Pe=!0}}Pe===!0&&(A.updateMultisampleRenderTarget(ee),A.updateRenderTargetMipmap(ee))}v.setRenderTarget(me),v.setClearColor(U,X),Ae!==void 0&&(k.viewport=Ae),v.toneMapping=ge}function Zi(E,N,H){const k=N.isScene===!0?N.overrideMaterial:null;for(let F=0,ee=E.length;F<ee;F++){const ce=E[F],me=ce.object,ge=ce.geometry,Ae=k===null?ce.material:k,Pe=ce.group;me.layers.test(H.layers)&&ja(me,N,H,ge,Ae,Pe)}}function ja(E,N,H,k,F,ee){E.onBeforeRender(v,N,H,k,F,ee),E.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),F.onBeforeRender(v,N,H,k,E,ee),F.transparent===!0&&F.side===Jt&&F.forceSinglePass===!1?(F.side=Ct,F.needsUpdate=!0,v.renderBufferDirect(H,N,k,F,E,ee),F.side=Dn,F.needsUpdate=!0,v.renderBufferDirect(H,N,k,F,E,ee),F.side=Jt):v.renderBufferDirect(H,N,k,F,E,ee),E.onAfterRender(v,N,H,k,F,ee)}function Ki(E,N,H){N.isScene!==!0&&(N=it);const k=ye.get(E),F=m.state.lights,ee=m.state.shadowsArray,ce=F.state.version,me=xe.getParameters(E,F.state,ee,N,H),ge=xe.getProgramCacheKey(me);let Ae=k.programs;k.environment=E.isMeshStandardMaterial?N.environment:null,k.fog=N.fog,k.envMap=(E.isMeshStandardMaterial?B:M).get(E.envMap||k.environment),k.envMapRotation=k.environment!==null&&E.envMap===null?N.environmentRotation:E.envMapRotation,Ae===void 0&&(E.addEventListener("dispose",Ce),Ae=new Map,k.programs=Ae);let Pe=Ae.get(ge);if(Pe!==void 0){if(k.currentProgram===Pe&&k.lightsStateVersion===ce)return Ka(E,me),Pe}else me.uniforms=xe.getUniforms(E),E.onBeforeCompile(me,v),Pe=xe.acquireProgram(me,ge),Ae.set(ge,Pe),k.uniforms=me.uniforms;const _e=k.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(_e.clippingPlanes=J.uniform),Ka(E,me),k.needsLights=Rh(E),k.lightsStateVersion=ce,k.needsLights&&(_e.ambientLightColor.value=F.state.ambient,_e.lightProbe.value=F.state.probe,_e.directionalLights.value=F.state.directional,_e.directionalLightShadows.value=F.state.directionalShadow,_e.spotLights.value=F.state.spot,_e.spotLightShadows.value=F.state.spotShadow,_e.rectAreaLights.value=F.state.rectArea,_e.ltc_1.value=F.state.rectAreaLTC1,_e.ltc_2.value=F.state.rectAreaLTC2,_e.pointLights.value=F.state.point,_e.pointLightShadows.value=F.state.pointShadow,_e.hemisphereLights.value=F.state.hemi,_e.directionalShadowMap.value=F.state.directionalShadowMap,_e.directionalShadowMatrix.value=F.state.directionalShadowMatrix,_e.spotShadowMap.value=F.state.spotShadowMap,_e.spotLightMatrix.value=F.state.spotLightMatrix,_e.spotLightMap.value=F.state.spotLightMap,_e.pointShadowMap.value=F.state.pointShadowMap,_e.pointShadowMatrix.value=F.state.pointShadowMatrix),k.currentProgram=Pe,k.uniformsList=null,Pe}function Za(E){if(E.uniformsList===null){const N=E.currentProgram.getUniforms();E.uniformsList=Lr.seqWithValue(N.seq,E.uniforms)}return E.uniformsList}function Ka(E,N){const H=ye.get(E);H.outputColorSpace=N.outputColorSpace,H.batching=N.batching,H.batchingColor=N.batchingColor,H.instancing=N.instancing,H.instancingColor=N.instancingColor,H.instancingMorph=N.instancingMorph,H.skinning=N.skinning,H.morphTargets=N.morphTargets,H.morphNormals=N.morphNormals,H.morphColors=N.morphColors,H.morphTargetsCount=N.morphTargetsCount,H.numClippingPlanes=N.numClippingPlanes,H.numIntersection=N.numClipIntersection,H.vertexAlphas=N.vertexAlphas,H.vertexTangents=N.vertexTangents,H.toneMapping=N.toneMapping}function Ah(E,N,H,k,F){N.isScene!==!0&&(N=it),A.resetTextureUnits();const ee=N.fog,ce=k.isMeshStandardMaterial?N.environment:null,me=R===null?v.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:Ri,ge=(k.isMeshStandardMaterial?B:M).get(k.envMap||ce),Ae=k.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,Pe=!!H.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),_e=!!H.morphAttributes.position,We=!!H.morphAttributes.normal,Qe=!!H.morphAttributes.color;let tt=Pn;k.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(tt=v.toneMapping);const bt=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,qe=bt!==void 0?bt.length:0,Me=ye.get(k),rn=m.state.lights;if(Q===!0&&(he===!0||E!==x)){const Nt=E===x&&k.id===S;J.setState(k,E,Nt)}let $e=!1;k.version===Me.__version?(Me.needsLights&&Me.lightsStateVersion!==rn.state.version||Me.outputColorSpace!==me||F.isBatchedMesh&&Me.batching===!1||!F.isBatchedMesh&&Me.batching===!0||F.isBatchedMesh&&Me.batchingColor===!0&&F.colorTexture===null||F.isBatchedMesh&&Me.batchingColor===!1&&F.colorTexture!==null||F.isInstancedMesh&&Me.instancing===!1||!F.isInstancedMesh&&Me.instancing===!0||F.isSkinnedMesh&&Me.skinning===!1||!F.isSkinnedMesh&&Me.skinning===!0||F.isInstancedMesh&&Me.instancingColor===!0&&F.instanceColor===null||F.isInstancedMesh&&Me.instancingColor===!1&&F.instanceColor!==null||F.isInstancedMesh&&Me.instancingMorph===!0&&F.morphTexture===null||F.isInstancedMesh&&Me.instancingMorph===!1&&F.morphTexture!==null||Me.envMap!==ge||k.fog===!0&&Me.fog!==ee||Me.numClippingPlanes!==void 0&&(Me.numClippingPlanes!==J.numPlanes||Me.numIntersection!==J.numIntersection)||Me.vertexAlphas!==Ae||Me.vertexTangents!==Pe||Me.morphTargets!==_e||Me.morphNormals!==We||Me.morphColors!==Qe||Me.toneMapping!==tt||Me.morphTargetsCount!==qe)&&($e=!0):($e=!0,Me.__version=k.version);let kt=Me.currentProgram;$e===!0&&(kt=Ki(k,N,F));let Jn=!1,Pt=!1,Li=!1;const nt=kt.getUniforms(),Zt=Me.uniforms;if(Ee.useProgram(kt.program)&&(Jn=!0,Pt=!0,Li=!0),k.id!==S&&(S=k.id,Pt=!0),Jn||x!==E){Ee.buffers.depth.getReversed()?(re.copy(E.projectionMatrix),Zf(re),Kf(re),nt.setValue(O,"projectionMatrix",re)):nt.setValue(O,"projectionMatrix",E.projectionMatrix),nt.setValue(O,"viewMatrix",E.matrixWorldInverse);const _n=nt.map.cameraPosition;_n!==void 0&&_n.setValue(O,Re.setFromMatrixPosition(E.matrixWorld)),Be.logarithmicDepthBuffer&&nt.setValue(O,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&nt.setValue(O,"isOrthographic",E.isOrthographicCamera===!0),x!==E&&(x=E,Pt=!0,Li=!0)}if(F.isSkinnedMesh){nt.setOptional(O,F,"bindMatrix"),nt.setOptional(O,F,"bindMatrixInverse");const Nt=F.skeleton;Nt&&(Nt.boneTexture===null&&Nt.computeBoneTexture(),nt.setValue(O,"boneTexture",Nt.boneTexture,A))}F.isBatchedMesh&&(nt.setOptional(O,F,"batchingTexture"),nt.setValue(O,"batchingTexture",F._matricesTexture,A),nt.setOptional(O,F,"batchingIdTexture"),nt.setValue(O,"batchingIdTexture",F._indirectTexture,A),nt.setOptional(O,F,"batchingColorTexture"),F._colorsTexture!==null&&nt.setValue(O,"batchingColorTexture",F._colorsTexture,A));const Ii=H.morphAttributes;if((Ii.position!==void 0||Ii.normal!==void 0||Ii.color!==void 0)&&be.update(F,H,kt),(Pt||Me.receiveShadow!==F.receiveShadow)&&(Me.receiveShadow=F.receiveShadow,nt.setValue(O,"receiveShadow",F.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(Zt.envMap.value=ge,Zt.flipEnvMap.value=ge.isCubeTexture&&ge.isRenderTargetTexture===!1?-1:1),k.isMeshStandardMaterial&&k.envMap===null&&N.environment!==null&&(Zt.envMapIntensity.value=N.environmentIntensity),Pt&&(nt.setValue(O,"toneMappingExposure",v.toneMappingExposure),Me.needsLights&&wh(Zt,Li),ee&&k.fog===!0&&ae.refreshFogUniforms(Zt,ee),ae.refreshMaterialUniforms(Zt,k,G,K,m.state.transmissionRenderTarget[E.id]),Lr.upload(O,Za(Me),Zt,A)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(Lr.upload(O,Za(Me),Zt,A),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&nt.setValue(O,"center",F.center),nt.setValue(O,"modelViewMatrix",F.modelViewMatrix),nt.setValue(O,"normalMatrix",F.normalMatrix),nt.setValue(O,"modelMatrix",F.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const Nt=k.uniformsGroups;for(let _n=0,vn=Nt.length;_n<vn;_n++){const Ja=Nt[_n];I.update(Ja,kt),I.bind(Ja,kt)}}return kt}function wh(E,N){E.ambientLightColor.needsUpdate=N,E.lightProbe.needsUpdate=N,E.directionalLights.needsUpdate=N,E.directionalLightShadows.needsUpdate=N,E.pointLights.needsUpdate=N,E.pointLightShadows.needsUpdate=N,E.spotLights.needsUpdate=N,E.spotLightShadows.needsUpdate=N,E.rectAreaLights.needsUpdate=N,E.hemisphereLights.needsUpdate=N}function Rh(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(E,N,H){ye.get(E.texture).__webglTexture=N,ye.get(E.depthTexture).__webglTexture=H;const k=ye.get(E);k.__hasExternalTextures=!0,k.__autoAllocateDepthBuffer=H===void 0,k.__autoAllocateDepthBuffer||ze.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),k.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(E,N){const H=ye.get(E);H.__webglFramebuffer=N,H.__useDefaultFramebuffer=N===void 0},this.setRenderTarget=function(E,N=0,H=0){R=E,b=N,w=H;let k=!0,F=null,ee=!1,ce=!1;if(E){const ge=ye.get(E);if(ge.__useDefaultFramebuffer!==void 0)Ee.bindFramebuffer(O.FRAMEBUFFER,null),k=!1;else if(ge.__webglFramebuffer===void 0)A.setupRenderTarget(E);else if(ge.__hasExternalTextures)A.rebindTextures(E,ye.get(E.texture).__webglTexture,ye.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const _e=E.depthTexture;if(ge.__boundDepthTexture!==_e){if(_e!==null&&ye.has(_e)&&(E.width!==_e.image.width||E.height!==_e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");A.setupDepthRenderbuffer(E)}}const Ae=E.texture;(Ae.isData3DTexture||Ae.isDataArrayTexture||Ae.isCompressedArrayTexture)&&(ce=!0);const Pe=ye.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Pe[N])?F=Pe[N][H]:F=Pe[N],ee=!0):E.samples>0&&A.useMultisampledRTT(E)===!1?F=ye.get(E).__webglMultisampledFramebuffer:Array.isArray(Pe)?F=Pe[H]:F=Pe,C.copy(E.viewport),L.copy(E.scissor),D=E.scissorTest}else C.copy(ve).multiplyScalar(G).floor(),L.copy(Le).multiplyScalar(G).floor(),D=Xe;if(Ee.bindFramebuffer(O.FRAMEBUFFER,F)&&k&&Ee.drawBuffers(E,F),Ee.viewport(C),Ee.scissor(L),Ee.setScissorTest(D),ee){const ge=ye.get(E.texture);O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_CUBE_MAP_POSITIVE_X+N,ge.__webglTexture,H)}else if(ce){const ge=ye.get(E.texture),Ae=N||0;O.framebufferTextureLayer(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,ge.__webglTexture,H||0,Ae)}S=-1},this.readRenderTargetPixels=function(E,N,H,k,F,ee,ce){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let me=ye.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&ce!==void 0&&(me=me[ce]),me){Ee.bindFramebuffer(O.FRAMEBUFFER,me);try{const ge=E.texture,Ae=ge.format,Pe=ge.type;if(!Be.textureFormatReadable(Ae)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Be.textureTypeReadable(Pe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=E.width-k&&H>=0&&H<=E.height-F&&O.readPixels(N,H,k,F,Ie.convert(Ae),Ie.convert(Pe),ee)}finally{const ge=R!==null?ye.get(R).__webglFramebuffer:null;Ee.bindFramebuffer(O.FRAMEBUFFER,ge)}}},this.readRenderTargetPixelsAsync=async function(E,N,H,k,F,ee,ce){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let me=ye.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&ce!==void 0&&(me=me[ce]),me){const ge=E.texture,Ae=ge.format,Pe=ge.type;if(!Be.textureFormatReadable(Ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Be.textureTypeReadable(Pe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(N>=0&&N<=E.width-k&&H>=0&&H<=E.height-F){Ee.bindFramebuffer(O.FRAMEBUFFER,me);const _e=O.createBuffer();O.bindBuffer(O.PIXEL_PACK_BUFFER,_e),O.bufferData(O.PIXEL_PACK_BUFFER,ee.byteLength,O.STREAM_READ),O.readPixels(N,H,k,F,Ie.convert(Ae),Ie.convert(Pe),0);const We=R!==null?ye.get(R).__webglFramebuffer:null;Ee.bindFramebuffer(O.FRAMEBUFFER,We);const Qe=O.fenceSync(O.SYNC_GPU_COMMANDS_COMPLETE,0);return O.flush(),await jf(O,Qe,4),O.bindBuffer(O.PIXEL_PACK_BUFFER,_e),O.getBufferSubData(O.PIXEL_PACK_BUFFER,0,ee),O.deleteBuffer(_e),O.deleteSync(Qe),ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(E,N=null,H=0){E.isTexture!==!0&&(Vi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),N=arguments[0]||null,E=arguments[1]);const k=Math.pow(2,-H),F=Math.floor(E.image.width*k),ee=Math.floor(E.image.height*k),ce=N!==null?N.x:0,me=N!==null?N.y:0;A.setTexture2D(E,0),O.copyTexSubImage2D(O.TEXTURE_2D,H,0,0,ce,me,F,ee),Ee.unbindTexture()},this.copyTextureToTexture=function(E,N,H=null,k=null,F=0){E.isTexture!==!0&&(Vi("WebGLRenderer: copyTextureToTexture function signature has changed."),k=arguments[0]||null,E=arguments[1],N=arguments[2],F=arguments[3]||0,H=null);let ee,ce,me,ge,Ae,Pe,_e,We,Qe;const tt=E.isCompressedTexture?E.mipmaps[F]:E.image;H!==null?(ee=H.max.x-H.min.x,ce=H.max.y-H.min.y,me=H.isBox3?H.max.z-H.min.z:1,ge=H.min.x,Ae=H.min.y,Pe=H.isBox3?H.min.z:0):(ee=tt.width,ce=tt.height,me=tt.depth||1,ge=0,Ae=0,Pe=0),k!==null?(_e=k.x,We=k.y,Qe=k.z):(_e=0,We=0,Qe=0);const bt=Ie.convert(N.format),qe=Ie.convert(N.type);let Me;N.isData3DTexture?(A.setTexture3D(N,0),Me=O.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(A.setTexture2DArray(N,0),Me=O.TEXTURE_2D_ARRAY):(A.setTexture2D(N,0),Me=O.TEXTURE_2D),O.pixelStorei(O.UNPACK_FLIP_Y_WEBGL,N.flipY),O.pixelStorei(O.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),O.pixelStorei(O.UNPACK_ALIGNMENT,N.unpackAlignment);const rn=O.getParameter(O.UNPACK_ROW_LENGTH),$e=O.getParameter(O.UNPACK_IMAGE_HEIGHT),kt=O.getParameter(O.UNPACK_SKIP_PIXELS),Jn=O.getParameter(O.UNPACK_SKIP_ROWS),Pt=O.getParameter(O.UNPACK_SKIP_IMAGES);O.pixelStorei(O.UNPACK_ROW_LENGTH,tt.width),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,tt.height),O.pixelStorei(O.UNPACK_SKIP_PIXELS,ge),O.pixelStorei(O.UNPACK_SKIP_ROWS,Ae),O.pixelStorei(O.UNPACK_SKIP_IMAGES,Pe);const Li=E.isDataArrayTexture||E.isData3DTexture,nt=N.isDataArrayTexture||N.isData3DTexture;if(E.isRenderTargetTexture||E.isDepthTexture){const Zt=ye.get(E),Ii=ye.get(N),Nt=ye.get(Zt.__renderTarget),_n=ye.get(Ii.__renderTarget);Ee.bindFramebuffer(O.READ_FRAMEBUFFER,Nt.__webglFramebuffer),Ee.bindFramebuffer(O.DRAW_FRAMEBUFFER,_n.__webglFramebuffer);for(let vn=0;vn<me;vn++)Li&&O.framebufferTextureLayer(O.READ_FRAMEBUFFER,O.COLOR_ATTACHMENT0,ye.get(E).__webglTexture,F,Pe+vn),E.isDepthTexture?(nt&&O.framebufferTextureLayer(O.DRAW_FRAMEBUFFER,O.COLOR_ATTACHMENT0,ye.get(N).__webglTexture,F,Qe+vn),O.blitFramebuffer(ge,Ae,ee,ce,_e,We,ee,ce,O.DEPTH_BUFFER_BIT,O.NEAREST)):nt?O.copyTexSubImage3D(Me,F,_e,We,Qe+vn,ge,Ae,ee,ce):O.copyTexSubImage2D(Me,F,_e,We,Qe+vn,ge,Ae,ee,ce);Ee.bindFramebuffer(O.READ_FRAMEBUFFER,null),Ee.bindFramebuffer(O.DRAW_FRAMEBUFFER,null)}else nt?E.isDataTexture||E.isData3DTexture?O.texSubImage3D(Me,F,_e,We,Qe,ee,ce,me,bt,qe,tt.data):N.isCompressedArrayTexture?O.compressedTexSubImage3D(Me,F,_e,We,Qe,ee,ce,me,bt,tt.data):O.texSubImage3D(Me,F,_e,We,Qe,ee,ce,me,bt,qe,tt):E.isDataTexture?O.texSubImage2D(O.TEXTURE_2D,F,_e,We,ee,ce,bt,qe,tt.data):E.isCompressedTexture?O.compressedTexSubImage2D(O.TEXTURE_2D,F,_e,We,tt.width,tt.height,bt,tt.data):O.texSubImage2D(O.TEXTURE_2D,F,_e,We,ee,ce,bt,qe,tt);O.pixelStorei(O.UNPACK_ROW_LENGTH,rn),O.pixelStorei(O.UNPACK_IMAGE_HEIGHT,$e),O.pixelStorei(O.UNPACK_SKIP_PIXELS,kt),O.pixelStorei(O.UNPACK_SKIP_ROWS,Jn),O.pixelStorei(O.UNPACK_SKIP_IMAGES,Pt),F===0&&N.generateMipmaps&&O.generateMipmap(Me),Ee.unbindTexture()},this.copyTextureToTexture3D=function(E,N,H=null,k=null,F=0){return E.isTexture!==!0&&(Vi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),H=arguments[0]||null,k=arguments[1]||null,E=arguments[2],N=arguments[3],F=arguments[4]||0),Vi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(E,N,H,k,F)},this.initRenderTarget=function(E){ye.get(E).__webglFramebuffer===void 0&&A.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?A.setTextureCube(E,0):E.isData3DTexture?A.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?A.setTexture2DArray(E,0):A.setTexture2D(E,0),Ee.unbindTexture()},this.resetState=function(){b=0,w=0,R=null,Ee.reset(),Je.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return dn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorspace=Ge._getDrawingBufferColorSpace(e),n.unpackColorSpace=Ge._getUnpackColorSpace()}}class og 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 mn,this.environmentIntensity=1,this.environmentRotation=new mn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class cg extends Mt{constructor(e=null,n=1,i=1,r,s,a,o,c,l=It,h=It,f,d){super(null,a,o,c,l,h,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Jo extends Bt{constructor(e,n,i,r=1){super(e,n,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ui=new je,Qo=new je,xr=[],ec=new jn,lg=new je,Bi=new Rt,Hi=new Zn;class Da extends Rt{constructor(e,n,i){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Jo(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,lg)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new jn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<n;i++)this.getMatrixAt(i,ui),ec.copy(e.boundingBox).applyMatrix4(ui),this.boundingBox.union(ec)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Zn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<n;i++)this.getMatrixAt(i,ui),Hi.copy(e.boundingSphere).applyMatrix4(ui),this.boundingSphere.union(Hi)}copy(e,n){return super.copy(e,n),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,n){n.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,n){n.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,n){const i=n.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,a=e*s+1;for(let o=0;o<i.length;o++)i[o]=r[a+o]}raycast(e,n){const i=this.matrixWorld,r=this.count;if(Bi.geometry=this.geometry,Bi.material=this.material,Bi.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Hi.copy(this.boundingSphere),Hi.applyMatrix4(i),e.ray.intersectsSphere(Hi)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,ui),Qo.multiplyMatrices(i,ui),Bi.matrixWorld=Qo,Bi.raycast(e,xr);for(let a=0,o=xr.length;a<o;a++){const c=xr[a];c.instanceId=s,c.object=this,n.push(c)}xr.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new Jo(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),n.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,n){n.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,n){const i=n.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new cg(new Float32Array(r*this.count),r,this.count,Ta,en));const s=this.morphTexture.source.data.data;let a=0;for(let l=0;l<i.length;l++)a+=i[l];const o=this.geometry.morphTargetsRelative?1:1-a,c=r*e;s[c]=o,s.set(i,c+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class qr extends Ci{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new Oe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Fr=new z,Or=new z,tc=new je,ki=new ji,Mr=new Zn,bs=new z,nc=new z;class zr extends ut{constructor(e=new pt,n=new qr){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let r=1,s=n.count;r<s;r++)Fr.fromBufferAttribute(n,r-1),Or.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=Fr.distanceTo(Or);e.setAttribute("lineDistance",new ot(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Mr.copy(i.boundingSphere),Mr.applyMatrix4(r),Mr.radius+=s,e.ray.intersectsSphere(Mr)===!1)return;tc.copy(r).invert(),ki.copy(e.ray).applyMatrix4(tc);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=i.index,d=i.attributes.position;if(h!==null){const u=Math.max(0,a.start),g=Math.min(h.count,a.start+a.count);for(let _=u,p=g-1;_<p;_+=l){const m=h.getX(_),T=h.getX(_+1),y=yr(this,e,ki,c,m,T);y&&n.push(y)}if(this.isLineLoop){const _=h.getX(g-1),p=h.getX(u),m=yr(this,e,ki,c,_,p);m&&n.push(m)}}else{const u=Math.max(0,a.start),g=Math.min(d.count,a.start+a.count);for(let _=u,p=g-1;_<p;_+=l){const m=yr(this,e,ki,c,_,_+1);m&&n.push(m)}if(this.isLineLoop){const _=yr(this,e,ki,c,g-1,u);_&&n.push(_)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function yr(t,e,n,i,r,s){const a=t.geometry.attributes.position;if(Fr.fromBufferAttribute(a,r),Or.fromBufferAttribute(a,s),n.distanceSqToSegment(Fr,Or,bs,nc)>i)return;bs.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(bs);if(!(c<e.near||c>e.far))return{distance:c,point:nc.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:t}}class hg extends Ci{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new Oe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const ic=new je,ga=new ji,Sr=new Zn,Er=new z;class La extends ut{constructor(e=new pt,n=new hg){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,n){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Sr.copy(i.boundingSphere),Sr.applyMatrix4(r),Sr.radius+=s,e.ray.intersectsSphere(Sr)===!1)return;ic.copy(r).invert(),ga.copy(e.ray).applyMatrix4(ic);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=i.index,f=i.attributes.position;if(l!==null){const d=Math.max(0,a.start),u=Math.min(l.count,a.start+a.count);for(let g=d,_=u;g<_;g++){const p=l.getX(g);Er.fromBufferAttribute(f,p),rc(Er,p,c,r,e,n,this)}}else{const d=Math.max(0,a.start),u=Math.min(f.count,a.start+a.count);for(let g=d,_=u;g<_;g++)Er.fromBufferAttribute(f,g),rc(Er,g,c,r,e,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function rc(t,e,n,i,r,s,a){const o=ga.distanceSqToPoint(t);if(o<n){const c=new z;ga.closestPointToPoint(t,c),c.applyMatrix4(i);const l=r.ray.origin.distanceTo(c);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Ia extends pt{constructor(e=1,n=1,i=1,r=32,s=1,a=!1,o=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:c};const l=this;r=Math.floor(r),s=Math.floor(s);const h=[],f=[],d=[],u=[];let g=0;const _=[],p=i/2;let m=0;T(),a===!1&&(e>0&&y(!0),n>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new ot(f,3)),this.setAttribute("normal",new ot(d,3)),this.setAttribute("uv",new ot(u,2));function T(){const v=new z,P=new z;let b=0;const w=(n-e)/i;for(let R=0;R<=s;R++){const S=[],x=R/s,C=x*(n-e)+e;for(let L=0;L<=r;L++){const D=L/r,U=D*c+o,X=Math.sin(U),V=Math.cos(U);P.x=C*X,P.y=-x*i+p,P.z=C*V,f.push(P.x,P.y,P.z),v.set(X,w,V).normalize(),d.push(v.x,v.y,v.z),u.push(D,1-x),S.push(g++)}_.push(S)}for(let R=0;R<r;R++)for(let S=0;S<s;S++){const x=_[S][R],C=_[S+1][R],L=_[S+1][R+1],D=_[S][R+1];(e>0||S!==0)&&(h.push(x,C,D),b+=3),(n>0||S!==s-1)&&(h.push(C,L,D),b+=3)}l.addGroup(m,b,0),m+=b}function y(v){const P=g,b=new we,w=new z;let R=0;const S=v===!0?e:n,x=v===!0?1:-1;for(let L=1;L<=r;L++)f.push(0,p*x,0),d.push(0,x,0),u.push(.5,.5),g++;const C=g;for(let L=0;L<=r;L++){const U=L/r*c+o,X=Math.cos(U),V=Math.sin(U);w.x=S*V,w.y=p*x,w.z=S*X,f.push(w.x,w.y,w.z),d.push(0,x,0),b.x=X*.5+.5,b.y=V*.5*x+.5,u.push(b.x,b.y),g++}for(let L=0;L<r;L++){const D=P+L,U=C+L;v===!0?h.push(U,U+1,D):h.push(U+1,U,D),R+=3}l.addGroup(m,R,v===!0?1:2),m+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ia(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}const sc={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class fg{constructor(e,n,i){const r=this;let s=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=i,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 c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,f){return l.push(h,f),this},this.removeHandler=function(h){const f=l.indexOf(h);return f!==-1&&l.splice(f,2),this},this.getHandler=function(h){for(let f=0,d=l.length;f<d;f+=2){const u=l[f],g=l[f+1];if(u.global&&(u.lastIndex=0),u.test(h))return g}return null}}}const dg=new fg;class Ua{constructor(e){this.manager=e!==void 0?e:dg,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,n){const i=this;return new Promise(function(r,s){i.load(e,r,n,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}}Ua.DEFAULT_MATERIAL_NAME="__DEFAULT";class ug extends Ua{constructor(e){super(e)}load(e,n,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=sc.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a;const o=qi("img");function c(){h(),sc.add(e,this),n&&n(this),s.manager.itemEnd(e)}function l(f){h(),r&&r(f),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class el extends Ua{constructor(e){super(e)}load(e,n,i,r){const s=new Mt,a=new ug(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,n!==void 0&&n(s)},i,r),s}}class tl extends ut{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Oe(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}const As=new je,ac=new z,oc=new z;class pg{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new we(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ca,this._frameExtents=new we(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;ac.setFromMatrixPosition(e.matrixWorld),n.position.copy(ac),oc.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(oc),n.updateMatrixWorld(),As.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(As),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(As)}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.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const 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}}class mg extends pg{constructor(){super(new Yc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class gg extends tl{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ut.DEFAULT_UP),this.updateMatrix(),this.target=new ut,this.shadow=new mg}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class _g extends tl{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}const cc=new je;class vg{constructor(e,n,i=0,r=1/0){this.ray=new ji(e,n),this.near=i,this.far=r,this.camera=null,this.layers=new Ra,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return cc.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(cc),this}intersectObject(e,n=!0,i=[]){return _a(e,this,i,n),i.sort(lc),i}intersectObjects(e,n=!0,i=[]){for(let r=0,s=e.length;r<s;r++)_a(e[r],this,i,n);return i.sort(lc),i}}function lc(t,e){return t.distance-e.distance}function _a(t,e,n,i){let r=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(r=!1),r===!0&&i===!0){const s=t.children;for(let a=0,o=s.length;a<o;a++)_a(s[a],e,n,!0)}}class hc{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Tt(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class xg extends Yn{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ma}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ma);function Mg(t){const e=t.length;if(e<2)return new pt;const n=[],i=[],r=[],s=[];for(let c=0;c<e;c++){const l=t[c],h=c>0?t[c-1]:l,f=c<e-1?t[c+1]:l;n.push(l.x,l.y,l.z),i.push(h.x,h.y,h.z),r.push(f.x,f.y,f.z),s.push(-1),n.push(l.x,l.y,l.z),i.push(h.x,h.y,h.z),r.push(f.x,f.y,f.z),s.push(1)}const a=new pt;a.setAttribute("position",new ot(n,3)),a.setAttribute("positionPrev",new ot(i,3)),a.setAttribute("positionNext",new ot(r,3)),a.setAttribute("side",new ot(s,1));const o=[];for(let c=0;c<e-1;c++){const l=c*2;o.push(l,l+1,l+2,l+2,l+1,l+3)}return a.setIndex(o),a.computeBoundingSphere(),a}const yg=`
|
|
3829
3829
|
attribute vec3 positionPrev;
|
|
3830
3830
|
attribute vec3 positionNext;
|
|
3831
3831
|
attribute float side;
|
|
@@ -3853,13 +3853,13 @@ void main() {
|
|
|
3853
3853
|
|
|
3854
3854
|
gl_Position = clipPos;
|
|
3855
3855
|
}
|
|
3856
|
-
`,
|
|
3856
|
+
`,Sg=`
|
|
3857
3857
|
uniform vec3 color;
|
|
3858
3858
|
|
|
3859
3859
|
void main() {
|
|
3860
3860
|
gl_FragColor = vec4(color, 1.0);
|
|
3861
3861
|
}
|
|
3862
|
-
`;function
|
|
3862
|
+
`;function Eg(t={}){const e=t.color??16777215,n=t.lineWidth??2,i=t.resolution??new we(800,700),r=new Oe(e);return new Yt({uniforms:{resolution:{value:i},lineWidth:{value:n},color:{value:new z(r.r,r.g,r.b)}},vertexShader:yg,fragmentShader:Sg,transparent:!1,depthTest:!0,side:Jt})}const nl=2,Tg=new we(800,700);function bg(t,e,n,i=nl,r){if(t.points.length<2){const c=new pt;return new Rt(c,new Pi({color:n}))}const s=t.points.map(c=>new z(c.x*e,c.y*e,c.z*e)),a=Mg(s),o=Eg({color:n,lineWidth:i,resolution:Tg});return new Rt(a,o)}function Ag(t){return t>=1?Math.max(1,Math.round(t)):Math.max(1,Math.round(t*100))}function il(t,e,n,i=nl,r){const s=Ag(i),a=new xt;for(const[o,c]of t.entries()){if(!(c!=null&&c.points)||c.points.length<2)continue;const l=bg(c,e,n,s);l.userData={edgeId:o},a.add(l)}return a}const rl=`
|
|
3863
3863
|
attribute float size;
|
|
3864
3864
|
attribute vec3 customColor;
|
|
3865
3865
|
|
|
@@ -3883,5 +3883,5 @@ void main() {
|
|
|
3883
3883
|
gl_FragColor = gl_FragColor * texture2D( pointTexture, gl_PointCoord );
|
|
3884
3884
|
if ( gl_FragColor.a < alphaTest ) discard;
|
|
3885
3885
|
}
|
|
3886
|
-
`;function al(t,e=1,n=1,i=16777215,r=1){const s=[],a=t.get_position_map();let o,c;typeof n=="number"?o=Array(t.nodes.size).fill(n):o=n,c=Array(t.nodes.size).fill(i);const l=[],h=new Oe;h.setRGB(255,255,255);let f=0,d;for(let p of t.nodes.keys())d=a.get(p),s.push(d.x*e,d.y*e,d.z*e),h.toArray(c,f*3),l.push(p),f+=1;const u=new pt;u.setAttribute("position",new ot(s,3)),u.setAttribute("customColor",new ot(c,3)),u.setAttribute("size",new ot(o,1)),u.setAttribute("label",new Vc(l,1)),u.name="nodes";const g=new Yt({uniforms:{color:{value:new Oe(16777215)},pointTexture:{value:new el().load("./Textures/Square.png")},alphaTest:{value:r}},vertexShader:rl,fragmentShader:sl}),_=new xt;return _.add(new La(u,g)),_}function R1(t,e=1,n=1,i=16777215,r=1){const s=t.get_node_ids_order(),a=s.length,o=t.get_position_map(),c=[];let l;const h=Array(a).fill(i),f=s.slice(),d=new Oe;d.setRGB(255,255,255);for(let T=0;T<a;T++){const y=o.get(s[T]);c.push(y.x*e,y.y*e,y.z*e),d.toArray(h,T*3)}typeof n=="number"?l=Array(a).fill(n):l=n;const u=new pt;u.setAttribute("position",new ot(c,3)),u.setAttribute("customColor",new ot(h,3)),u.setAttribute("size",new ot(l,1)),u.setAttribute("label",new Vc(f,1)),u.name="nodes";const g=new Yt({uniforms:{color:{value:new Oe(16777215)},pointTexture:{value:new el().load("./Textures/Square.png")},alphaTest:{value:r}},vertexShader:rl,fragmentShader:sl}),_=new xt;_.add(new La(u,g));const p=u.getAttribute("position");function m(T){const y=p.array;if(T instanceof Float32Array)for(let v=0;v<a*3;v++)y[v]=T[v]*e;else for(let v=0;v<a;v++){const P=T.get(s[v]);y[v*3]=P.x*e,y[v*3+1]=P.y*e,y[v*3+2]=P.z*e}p.needsUpdate=!0}return{group:_,updatePositions:m}}function C1(t,e=1,n=16777215,i=.4){const r=t.get_edge_map();return ol(r,e,n,i)}function ol(t,e,n=16777215,i=.4){return il(t,e,n,i)}function P1(t,e=1,n=16777215){const i=t.get_edge_map();return cl(i,e,n)}function D1(t,e=1,n=16777215){const i=new qr({color:n}),r=new xt;function s(){for(;r.children.length>0;){const o=r.children[0];r.remove(o),o instanceof zr&&o.geometry&&o.geometry.dispose()}const a=t.get_edge_map();for(const[o,c]of a.entries()){const l=[];c.points.forEach(d=>{l.push(new z(d.x*e,d.y*e,d.z*e))});const h=new pt().setFromPoints(l),f=new zr(h,i);f.userData={edgeId:o},r.add(f)}}return s(),{group:r,updateEdges:s}}function L1(t,e,n,i=16777215,r=5){const s=t.get_position_map(),a=n.map(c=>s.get(c)).filter(c=>c!=null);if(a.length<2)return new xt;const o=new kr(a);return il(new Map([[0,o]]),e,i,r)}function cl(t,e=1,n=16777215){const i=new qr({color:n}),r=new xt;let s;for(const[a,o]of t.entries()){s=[],o.points.forEach(f=>{s.push(new z(f.x*e,f.y*e,f.z*e))});const l=new pt().setFromPoints(s),h=new zr(l,i);h.userData={edgeId:a},r.add(h)}return r}const bn=new je,An=new z,gi=new Ln,wn=new z;function ll(t,e=1,n=16777215,i=10){const r=t.size,s=Array.from(t.entries()),a=typeof i=="number"?Array(r).fill(i):i,o=new Kn(1,1,1),c=new Pi({color:n}),l=new Da(o,c,r);l.name="boxVertices",gi.identity();for(let f=0;f<r;f++){const d=s[f][1],u=a[f];An.set(d.x*e,d.y*e,d.z*e),wn.set(u,u,u),bn.compose(An,gi,wn),l.setMatrixAt(f,bn)}l.instanceMatrix.needsUpdate=!0,l.userData={nodeIds:s.map(f=>f[0])};const h=new xt;return h.add(l),h}function I1(t,e=1,n=16777215,i=10){const r=t.get_node_ids_order(),s=r.length,a=t.get_position_map(),o=typeof i=="number"?Array(s).fill(i):i,c=new Kn(1,1,1),l=new Pi({color:n}),h=new Da(c,l,s);h.name="boxVertices",gi.identity();for(let u=0;u<s;u++){const g=a.get(r[u]),_=o[u];An.set(g.x*e,g.y*e,g.z*e),wn.set(_,_,_),bn.compose(An,gi,wn),h.setMatrixAt(u,bn)}h.instanceMatrix.needsUpdate=!0,h.userData={nodeIds:r.slice()};const f=new xt;f.add(h);function d(u){if(u instanceof Float32Array)for(let g=0;g<s;g++)An.set(u[g*3]*e,u[g*3+1]*e,u[g*3+2]*e),wn.set(o[g],o[g],o[g]),bn.compose(An,gi,wn),h.setMatrixAt(g,bn);else for(let g=0;g<s;g++){const _=u.get(r[g]);An.set(_.x*e,_.y*e,_.z*e),wn.set(o[g],o[g],o[g]),bn.compose(An,gi,wn),h.setMatrixAt(g,bn)}h.instanceMatrix.needsUpdate=!0}return{group:f,updatePositions:d}}function U1(t,e=1,n=16777215,i=10){const r=t.get_position_map();return ll(r,e,n,i)}function N1(t,e=16,n=16777215,i=10){let r;typeof i=="number"?r=Array(t.size).fill(i):r=i;const s=new xt,a=new Pi({color:n});let o=0;for(const[c,l]of t){const h=typeof r=="number"?r:r[o],f=2*h*Math.PI,d=Math.ceil(f/e),u=new Ia(h,h,10,d);u.name=String(c);const g=new Rt(u,a);g.position.set(l.x,l.y,l.z),s.add(g),o+=1}return s}async function F1(t,e){const n=new Map;let i,r;for(let d of t.nodes.keys()){i=t.nodes.get(d);const u=i.data[e];r=typeof u=="number"?u:u!=null?Number(u):void 0,r!==void 0&&(n.has(r)?n.get(r).push(d):n.set(r,[d]))}const s=new Map,a=new Map;let o,c,l,h;for(let d of n.keys())o=n.get(d),c=await Hr.SelectSubgraph(t,o),l=al(c,1),s.set(d,l),h=hl(c,.03),a.set(d,h);return{nodeGroups:s,EdgeGroups:a}}function hl(t,e,n=16777215){const i=new xt,r=new qr({color:n});let s,a,o;for(let c of t.edges.values())if(Math.random()<=e){s=t.nodes.get(c.start).data.pos,a=t.nodes.get(c.end).data.pos,o=[],o.push(new z(s.x,s.y,s.z)),o.push(new z(a.x,a.y,a.z));const l=new pt().setFromPoints(o),h=new zr(l,r);i.add(h)}return i}function O1(t,e,n){try{const i=t instanceof xt?t.children[0]:t,r=i==null?void 0:i.geometry;if(!(r!=null&&r.attributes))return;const s=r.attributes.customColor,a=s==null?void 0:s.array;if(!a||a.length===0)return;const o=new Oe(n),c=r.attributes.label,l=c==null?void 0:c.array;l&&l.length>0?e.forEach(h=>{for(let f=0;f<l.length;f++)if(l[f]===h){const d=f*3;d+2<a.length&&(a[d]=o.r,a[d+1]=o.g,a[d+2]=o.b);break}}):e.forEach(h=>{const f=h*3;f+2<a.length&&(a[f]=o.r,a[f+1]=o.g,a[f+2]=o.b)}),s&&(s.needsUpdate=!0)}catch{}}function z1(t){var e,n;try{const i=t instanceof xt?t.children[0]:t,r=(n=(e=i==null?void 0:i.geometry)==null?void 0:e.attributes)==null?void 0:n.customColor,s=r==null?void 0:r.array;if(!s||s.length===0)return;const a=(r==null?void 0:r.count)??Math.floor(s.length/3);for(let o=0;o<a;o++){const c=o*3;s[c]=1,s[c+1]=1,s[c+2]=1}r&&(r.needsUpdate=!0)}catch{}}const B1={DrawTHREEGraphVertices:al,DrawTHREEGraphVerticesMutable:R1,DrawTHREEGraphEdgesThick:C1,DrawTHREEGraphEdgesThin:P1,DrawTHREEGraphEdgesThinMutable:D1,DrawThickPathFromNodeIds:L1,AddBoxBasedImaging:ll,AddInModularityBasedPointGroups:F1,DrawThinEdgesFromEdgeMap:cl,DrawThickEdgesFromEdgeMap:ol,AddCylinderBasedImaging:N1,DrawSimplifiedEdges:hl,ChangeTheVertexColours:O1,ResetVertexColors:z1,DrawTHREEBoxBasedVertices:U1,DrawTHREEBoxBasedVerticesMutable:I1},fc={type:"change"},Na={type:"start"},fl={type:"end"},Tr=new ji,dc=new fn,H1=Math.cos(70*Yf.DEG2RAD),lt=new z,wt=2*Math.PI,Ke={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ws=1e-6;class k1 extends M1{constructor(e,n=null){super(e,n),this.state=Ke.NONE,this.enabled=!0,this.target=new z,this.cursor=new z,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.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:_i.ROTATE,MIDDLE:_i.DOLLY,RIGHT:_i.PAN},this.touches={ONE:pi.ROTATE,TWO:pi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new z,this._lastQuaternion=new Ln,this._lastTargetPosition=new z,this._quat=new Ln().setFromUnitVectors(e.up,new z(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new hc,this._sphericalDelta=new hc,this._scale=1,this._panOffset=new z,this._rotateStart=new we,this._rotateEnd=new we,this._rotateDelta=new we,this._panStart=new we,this._panEnd=new we,this._panDelta=new we,this._dollyStart=new we,this._dollyEnd=new we,this._dollyDelta=new we,this._dollyDirection=new z,this._mouse=new we,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=G1.bind(this),this._onPointerDown=V1.bind(this),this._onPointerUp=W1.bind(this),this._onContextMenu=K1.bind(this),this._onMouseWheel=$1.bind(this),this._onKeyDown=Y1.bind(this),this._onTouchStart=j1.bind(this),this._onTouchMove=Z1.bind(this),this._onMouseDown=X1.bind(this),this._onMouseMove=q1.bind(this),this._interceptControlDown=J1.bind(this),this._interceptControlUp=Q1.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){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.removeEventListener("pointermove",this._onPointerMove),this.domElement.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="auto"}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(fc),this.update(),this.state=Ke.NONE}update(e=null){const n=this.object.position;lt.copy(n).sub(this.target),lt.applyQuaternion(this._quat),this._spherical.setFromVector3(lt),this.autoRotate&&this.state===Ke.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+=wt:i>Math.PI&&(i-=wt),r<-Math.PI?r+=wt:r>Math.PI&&(r-=wt),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{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(lt.setFromSpherical(this._spherical),lt.applyQuaternion(this._quatInverse),n.copy(this.target).add(lt),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){const o=lt.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const o=new z(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const l=new z(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=lt.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):(Tr.origin.copy(this.object.position),Tr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Tr.direction))<H1?this.object.lookAt(this.target):(dc.setFromNormalAndCoplanarPoint(this.object.up,this.target),Tr.intersectPlane(dc,this.target))))}else if(this.object.isOrthographicCamera){const 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)>ws||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ws||this._lastTargetPosition.distanceToSquared(this.target)>ws?(this.dispatchEvent(fc),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?wt/60*this.autoRotateSpeed*e:wt/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){lt.setFromMatrixColumn(n,0),lt.multiplyScalar(-e),this._panOffset.add(lt)}_panUp(e,n){this.screenSpacePanning===!0?lt.setFromMatrixColumn(n,1):(lt.setFromMatrixColumn(n,0),lt.crossVectors(this.object.up,lt)),lt.multiplyScalar(e),this._panOffset.add(lt)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;lt.copy(r).sub(this.target);let s=lt.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*n*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(n*(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,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=e-i.left,s=n-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);const n=this.domElement;this._rotateLeft(wt*this._rotateDelta.x/n.clientHeight),this._rotateUp(wt*this._rotateDelta.y/n.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 n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,r=e.pageY-n.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{const 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);const n=this.domElement;this._rotateLeft(wt*this._rotateDelta.x/n.clientHeight),this._rotateUp(wt*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.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){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,r=e.pageY-n.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);const a=(e.pageX+n.x)*.5,o=(e.pageY+n.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 n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new we,this._pointerPositions[e.pointerId]=n),n.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const n=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[n]}_customWheelEvent(e){const n=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function V1(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function G1(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function W1(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(fl),this.state=Ke.NONE;break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y});break}}function X1(t){let e;switch(t.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 _i.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=Ke.DOLLY;break;case _i.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Ke.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Ke.ROTATE}break;case _i.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Ke.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Ke.PAN}break;default:this.state=Ke.NONE}this.state!==Ke.NONE&&this.dispatchEvent(Na)}function q1(t){switch(this.state){case Ke.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case Ke.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case Ke.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function $1(t){this.enabled===!1||this.enableZoom===!1||this.state!==Ke.NONE||(t.preventDefault(),this.dispatchEvent(Na),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(fl))}function Y1(t){this.enabled===!1||this.enablePan===!1||this._handleKeyDown(t)}function j1(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case pi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=Ke.TOUCH_ROTATE;break;case pi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=Ke.TOUCH_PAN;break;default:this.state=Ke.NONE}break;case 2:switch(this.touches.TWO){case pi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=Ke.TOUCH_DOLLY_PAN;break;case pi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=Ke.TOUCH_DOLLY_ROTATE;break;default:this.state=Ke.NONE}break;default:this.state=Ke.NONE}this.state!==Ke.NONE&&this.dispatchEvent(Na)}function Z1(t){switch(this._trackPointer(t),this.state){case Ke.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case Ke.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case Ke.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case Ke.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=Ke.NONE}}function K1(t){this.enabled!==!1&&t.preventDefault()}function J1(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Q1(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function e2(t){var n;const e=t.object;if(e instanceof La){const i=e.geometry,r=(n=i==null?void 0:i.attributes)==null?void 0:n.label;return r&&t.index!=null?r.array[t.index]??null:null}if(e instanceof Da&&t.instanceId!=null){const i=e.userData.nodeIds;return i&&t.instanceId<i.length?i[t.instanceId]:null}return null}function t2(t){const n=t.object.userData.edgeId;return n??null}function uc(t,e){var r;const n=t.nodes.get(e),i=t.get_position_map();return{nodeId:e,data:(n==null?void 0:n.data)??{},neighbours:((r=n==null?void 0:n.neighbours)==null?void 0:r.slice())??[],position:i.get(e)}}function pc(t,e){const n=t.edges.get(e);return n?{edgeId:e,start:n.start,end:n.end,data:n.data??{}}:null}const br=new z,mc=new fn,gc=new z;class n2{constructor(e,n,i,r,s){this.lastHoverNodeId=null,this.lastHoverEdgeId=null,this.dragNodeId=null,this.wasDragging=!1,this.scene=e,this.camera=n,this.domElement=i,this.graph=r,this.options=s,this.raycaster=new x1,this.mouse=new we,this.hoverEnabled=s.hoverEnabled!==!1,this.controls=s.controls,this.raycaster.params.Line={threshold:5},this.raycaster.params.Points={threshold:10},this.boundOnClick=this.onClick.bind(this),this.boundOnPointerMove=this.onPointerMove.bind(this),this.boundOnPointerDown=this.onPointerDown.bind(this),this.boundOnPointerUp=this.onPointerUp.bind(this),i.addEventListener("click",this.boundOnClick),this.hoverEnabled&&i.addEventListener("pointermove",this.boundOnPointerMove),s.enableNodeDrag&&s.onNodeDrag&&(i.addEventListener("pointerdown",this.boundOnPointerDown),i.addEventListener("pointerup",this.boundOnPointerUp),i.addEventListener("pointerleave",this.boundOnPointerUp))}dispose(){this.domElement.removeEventListener("click",this.boundOnClick),this.domElement.removeEventListener("pointermove",this.boundOnPointerMove),this.domElement.removeEventListener("pointerdown",this.boundOnPointerDown),this.domElement.removeEventListener("pointerup",this.boundOnPointerUp),this.domElement.removeEventListener("pointerleave",this.boundOnPointerUp)}getMouseNDC(e){const n=this.domElement;if(e.target===n)this.mouse.x=e.offsetX/n.offsetWidth*2-1,this.mouse.y=-(e.offsetY/n.offsetHeight)*2+1;else{const r=n.getBoundingClientRect();this.mouse.x=(e.clientX-r.left)/r.width*2-1,this.mouse.y=-((e.clientY-r.top)/r.height)*2+1}}pick(){this.raycaster.setFromCamera(this.mouse,this.camera);const e=this.raycaster.intersectObject(this.scene,!0);let n=null,i=null,r=1/0,s=1/0;for(const a of e){const o=e2(a),c=t2(a);o!=null&&a.distance<r&&(n=o,r=a.distance),c!=null&&a.distance<s&&(i=c,s=a.distance)}return n!=null&&i!=null&&r<=s?i=null:n!=null&&i!=null&&(n=null),{nodeId:n,edgeId:i}}onClick(e){if(this.wasDragging){this.wasDragging=!1;return}this.getMouseNDC(e);const{nodeId:n,edgeId:i}=this.pick();if(n!=null&&this.options.onNodeClick&&this.options.onNodeClick(uc(this.graph,n)),i!=null&&this.options.onEdgeClick){const r=pc(this.graph,i);r&&this.options.onEdgeClick(r)}}onPointerDown(e){if(this.wasDragging=!1,e.button!==0)return;this.getMouseNDC(e);const{nodeId:n}=this.pick();n!=null&&this.options.enableNodeDrag&&this.options.onNodeDrag&&(this.dragNodeId=n,this.controls&&(this.controls.enabled=!1))}onPointerUp(e){this.dragNodeId!=null&&(this.wasDragging=!0,this.dragNodeId=null,this.controls&&(this.controls.enabled=!0))}getDragPosition(){if(this.dragNodeId==null)return null;const e=this.graph.get_position_map().get(this.dragNodeId);return e?(gc.set(0,0,-1).applyQuaternion(this.camera.quaternion),mc.setFromNormalAndCoplanarPoint(gc,new z(e.x,e.y,e.z)),this.raycaster.setFromCamera(this.mouse,this.camera),this.raycaster.ray.intersectPlane(mc,br)?{x:br.x,y:br.y,z:br.z}:null):null}onPointerMove(e){if(this.getMouseNDC(e),this.dragNodeId!=null&&this.options.onNodeDrag){const r=this.getDragPosition();r&&this.options.onNodeDrag(this.dragNodeId,r);return}const{nodeId:n,edgeId:i}=this.pick();this.fireHoverCallbacks(n,i)}fireHoverCallbacks(e,n){if(this.options.onNodeHover&&(e!=null?e!==this.lastHoverNodeId&&(this.lastHoverNodeId=e,this.options.onNodeHover(uc(this.graph,e))):this.lastHoverNodeId!=null&&(this.lastHoverNodeId=null,this.options.onNodeHover(null))),this.options.onEdgeHover)if(n!=null){if(n!==this.lastHoverEdgeId){this.lastHoverEdgeId=n;const i=pc(this.graph,n);i&&this.options.onEdgeHover(i)}}else this.lastHoverEdgeId!=null&&(this.lastHoverEdgeId=null,this.options.onEdgeHover(null))}}class i2{constructor(e){this.canvas=e.canvas,this.width=e.width,this.height=e.height,this.geometryMap=new Map,this.materialMap=new Map,this.meshMap=new Map,this.controls,this.renderer,this.camera,this.scene,this.graphs=new Map}async init(){const e=performance.now();this.camera=new zt,this.scene=new c1,this.renderer=new o1({canvas:this.canvas,antialias:!0}),this.renderer.setSize(this.width,this.height),this.renderer.setClearColor(16711935,0),this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix(),this.scene.add(new v1(16777215));const n=new _1(16777215,1);n.position.set(0,10,0),this.scene.add(n),this.controls=new k1(this.camera,this.renderer.domElement),this.camera.position.set(0,100,100),this.controls.autoRotate=!0,this.controls.maxPolarAngle=Math.PI*.5,this.controls.maxDistance=1e4,this.controls.minDistance=10,this.controls.update();const i=performance.now();console.log("initialization has finished"),console.log(`Time to initialize ${i-e} milliseconds`)}addVisElement(e){this.scene.add(e)}rendercall(){this.renderer.render(this.scene,this.camera),this.controls.update()}enableInteraction(e){this.disableInteraction();const n={...e,controls:e.controls??this.controls};this.interactionLayer=new n2(this.scene,this.camera,this.renderer.domElement,e.graph,n)}disableInteraction(){this.interactionLayer&&(this.interactionLayer.dispose(),this.interactionLayer=void 0)}}const r2={GraphDrawer3d:i2};async function s2(t,e){const n=new Map,i=new Map;let r;for(let l=0;l<t;l++)r=new In({}),n.set(l,r);let s,a,o=0;for(let l=0;l<t;l++)for(let h=0;h<t;h++)l!=h&&(s=Math.random(),e>s&&(a=new gn(l,h,{}),i.set(o,a),o+=1));return new jt(n,i)}const a2={GenerateErdosReyni_n_p:s2};function o2(t,e){const n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return n*n+i*i+r*r}function dl(t){return["x","y","z"][t%3]}function va(t,e){if(t.length===0)return null;if(t.length===1)return{item:t[0]};const n=dl(e),i=[...t].sort((c,l)=>c.point[n]-l.point[n]),r=Math.floor(i.length/2),s=i[r],a=r>0?va(i.slice(0,r),e+1):null,o=r+1<i.length?va(i.slice(r+1),e+1):null;return{left:a??void 0,right:o??void 0,item:s}}function Wi(t,e,n,i,r){if(t===null)return;const s=dl(i);o2(e,t.item.point)<=n&&r.push(t.item.nodeId);const o=e[s]-t.item.point[s],c=o*o;o<=0?(t.left&&Wi(t.left,e,n,i+1,r),t.right&&c<=n&&Wi(t.right,e,n,i+1,r)):(t.right&&Wi(t.right,e,n,i+1,r),t.left&&c<=n&&Wi(t.left,e,n,i+1,r))}function c2(t,e){const n=va(t,0),i=e*e,r=new Map;for(const{point:s,nodeId:a}of t){const o=[];n&&Wi(n,s,i,0,o),r.set(a,o)}return r}class l2{constructor(){this.parent=new Map}find(e){return this.parent.has(e)||this.parent.set(e,e),this.parent.get(e)!==e&&this.parent.set(e,this.find(this.parent.get(e))),this.parent.get(e)}union(e,n){const i=this.find(e),r=this.find(n);i!==r&&this.parent.set(i,r)}}function h2(){return{cluster(t,e){const{distanceThreshold:n}=e,i=t.get_position_map(),r=[];for(const[u,g]of i)r.push({point:g,nodeId:u});if(r.length===0)return{nodeToCluster:new Map,clusterCentroids:new Map,clusterIds:[]};const s=c2(r,n),a=new l2;for(const[u,g]of s)for(const _ of g)a.union(u,_);const o=new Map;let c=0;const l=new Map,h=new Map;for(const{nodeId:u}of r){const g=a.find(u);o.has(g)||o.set(g,c++);const _=o.get(g);l.set(u,_),h.has(_)||h.set(_,[]),h.get(_).push(u)}const f=new Map;for(const[u,g]of h){const _=g.map(p=>i.get(p));f.set(u,wi.centroid(_))}const d=[...h.keys()];return{nodeToCluster:l,clusterCentroids:f,clusterIds:d}}}}async function ul(t,e){const{nodeToCluster:n,clusterCentroids:i,clusterIds:r}=e,s=new Map,a=new Map;for(const f of r){const d=i.get(f),u=new In({pos:d});s.set(f,u)}const o=new Map,c=(f,d)=>f<=d?`${f},${d}`:`${d},${f}`;for(const[,f]of t.edges){const d=n.get(f.start),u=n.get(f.end);if(d===void 0||u===void 0||d===u)continue;const g=c(d,u);o.set(g,(o.get(g)??0)+1)}let l=0;for(const[f,d]of o){const[u,g]=f.split(",").map(Number);a.set(l++,new gn(u,g,{count:d}))}const h=new jt(s,a);return await h.initialize(),h}async function f2(t,e){const i=h2().cluster(t,e);return ul(t,i)}async function d2(t,e,n){const i=e.cluster(t,n);return ul(t,i)}const u2={clusterByDistance:f2,clusterByStrategy:d2};function p2(t,e,n,i){for(let r=0;r<e;r++){let s=0;for(let a=0;a<e;a++)s+=t[r*e+a]*n[a];i[r]=s}}function m2(t){let e=0;for(let i=0;i<t.length;i++)e+=t[i]*t[i];const n=Math.sqrt(e);if(n>0)for(let i=0;i<t.length;i++)t[i]/=n}var pe=1e-6,Ne=typeof Float32Array<"u"?Float32Array:Array,$t=Math.random,pl="zyx";function tn(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}function g2(t){Ne=t}var _2=Math.PI/180,v2=180/Math.PI;function x2(t){return t*_2}function M2(t){return t*v2}function y2(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pe;return Math.abs(t-e)<=n*Math.max(1,Math.abs(t),Math.abs(e))}const S2=Object.freeze(Object.defineProperty({__proto__:null,ANGLE_ORDER:pl,get ARRAY_TYPE(){return Ne},EPSILON:pe,RANDOM:$t,equals:y2,round:tn,setMatrixArrayType:g2,toDegree:M2,toRadian:x2},Symbol.toStringTag,{value:"Module"}));function E2(){var t=new Ne(4);return Ne!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function T2(t){var e=new Ne(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function b2(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function A2(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function w2(t,e,n,i){var r=new Ne(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function R2(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function C2(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function P2(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n*s-r*i;return a?(a=1/a,t[0]=s*a,t[1]=-i*a,t[2]=-r*a,t[3]=n*a,t):null}function D2(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t}function L2(t){return t[0]*t[3]-t[2]*t[1]}function ml(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1],l=n[2],h=n[3];return t[0]=i*o+s*c,t[1]=r*o+a*c,t[2]=i*l+s*h,t[3]=r*l+a*h,t}function I2(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c+s*o,t[1]=r*c+a*o,t[2]=i*-o+s*c,t[3]=r*-o+a*c,t}function U2(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1];return t[0]=i*o,t[1]=r*o,t[2]=s*c,t[3]=a*c,t}function N2(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=-n,t[3]=i,t}function F2(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function O2(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function z2(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3])}function B2(t,e,n,i){return t[2]=i[2]/i[0],n[0]=i[0],n[1]=i[1],n[3]=i[3]-t[2]*n[1],[t,e,n]}function H2(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function gl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function k2(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function V2(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=e[0],o=e[1],c=e[2],l=e[3];return Math.abs(n-a)<=pe*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=pe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-c)<=pe*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-l)<=pe*Math.max(1,Math.abs(s),Math.abs(l))}function G2(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function W2(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t}var X2=ml,q2=gl;const $2=Object.freeze(Object.defineProperty({__proto__:null,LDU:B2,add:H2,adjoint:D2,clone:T2,copy:b2,create:E2,determinant:L2,equals:V2,exactEquals:k2,frob:z2,fromRotation:N2,fromScaling:F2,fromValues:w2,identity:A2,invert:P2,mul:X2,multiply:ml,multiplyScalar:G2,multiplyScalarAndAdd:W2,rotate:I2,scale:U2,set:R2,str:O2,sub:q2,subtract:gl,transpose:C2},Symbol.toStringTag,{value:"Module"}));function Y2(){var t=new Ne(6);return Ne!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function j2(t){var e=new Ne(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Z2(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function K2(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function J2(t,e,n,i,r,s){var a=new Ne(6);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a[4]=r,a[5]=s,a}function Q2(t,e,n,i,r,s,a){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t}function e3(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=n*s-i*r;return c?(c=1/c,t[0]=s*c,t[1]=-i*c,t[2]=-r*c,t[3]=n*c,t[4]=(r*o-s*a)*c,t[5]=(i*a-n*o)*c,t):null}function t3(t){return t[0]*t[3]-t[1]*t[2]}function _l(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=n[0],h=n[1],f=n[2],d=n[3],u=n[4],g=n[5];return t[0]=i*l+s*h,t[1]=r*l+a*h,t[2]=i*f+s*d,t[3]=r*f+a*d,t[4]=i*u+s*g+o,t[5]=r*u+a*g+c,t}function n3(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=Math.sin(n),h=Math.cos(n);return t[0]=i*h+s*l,t[1]=r*h+a*l,t[2]=i*-l+s*h,t[3]=r*-l+a*h,t[4]=o,t[5]=c,t}function i3(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=n[0],h=n[1];return t[0]=i*l,t[1]=r*l,t[2]=s*h,t[3]=a*h,t[4]=o,t[5]=c,t}function r3(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=n[0],h=n[1];return t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=i*l+s*h+o,t[5]=r*l+a*h+c,t}function s3(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=-n,t[3]=i,t[4]=0,t[5]=0,t}function a3(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function o3(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function c3(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function l3(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+1)}function h3(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t}function vl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}function f3(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t}function d3(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t[4]=e[4]+n[4]*i,t[5]=e[5]+n[5]*i,t}function u3(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function p3(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=e[0],l=e[1],h=e[2],f=e[3],d=e[4],u=e[5];return Math.abs(n-c)<=pe*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-l)<=pe*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(r-h)<=pe*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(s-f)<=pe*Math.max(1,Math.abs(s),Math.abs(f))&&Math.abs(a-d)<=pe*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-u)<=pe*Math.max(1,Math.abs(o),Math.abs(u))}var m3=_l,g3=vl;const _3=Object.freeze(Object.defineProperty({__proto__:null,add:h3,clone:j2,copy:Z2,create:Y2,determinant:t3,equals:p3,exactEquals:u3,frob:l3,fromRotation:s3,fromScaling:a3,fromTranslation:o3,fromValues:J2,identity:K2,invert:e3,mul:m3,multiply:_l,multiplyScalar:f3,multiplyScalarAndAdd:d3,rotate:n3,scale:i3,set:Q2,str:c3,sub:g3,subtract:vl,translate:r3},Symbol.toStringTag,{value:"Module"}));function xl(){var t=new Ne(9);return Ne!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function v3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function x3(t){var e=new Ne(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function M3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function y3(t,e,n,i,r,s,a,o,c){var l=new Ne(9);return l[0]=t,l[1]=e,l[2]=n,l[3]=i,l[4]=r,l[5]=s,l[6]=a,l[7]=o,l[8]=c,l}function S3(t,e,n,i,r,s,a,o,c,l){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t}function E3(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function T3(t,e){if(t===e){var n=e[1],i=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=i,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function b3(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=h*a-o*l,d=-h*s+o*c,u=l*s-a*c,g=n*f+i*d+r*u;return g?(g=1/g,t[0]=f*g,t[1]=(-h*i+r*l)*g,t[2]=(o*i-r*a)*g,t[3]=d*g,t[4]=(h*n-r*c)*g,t[5]=(-o*n+r*s)*g,t[6]=u*g,t[7]=(-l*n+i*c)*g,t[8]=(a*n-i*s)*g,t):null}function A3(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t[0]=a*h-o*l,t[1]=r*l-i*h,t[2]=i*o-r*a,t[3]=o*c-s*h,t[4]=n*h-r*c,t[5]=r*s-n*o,t[6]=s*l-a*c,t[7]=i*c-n*l,t[8]=n*a-i*s,t}function w3(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],c=t[7],l=t[8];return e*(l*s-a*c)+n*(-l*r+a*o)+i*(c*r-s*o)}function Ml(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=n[0],u=n[1],g=n[2],_=n[3],p=n[4],m=n[5],T=n[6],y=n[7],v=n[8];return t[0]=d*i+u*a+g*l,t[1]=d*r+u*o+g*h,t[2]=d*s+u*c+g*f,t[3]=_*i+p*a+m*l,t[4]=_*r+p*o+m*h,t[5]=_*s+p*c+m*f,t[6]=T*i+y*a+v*l,t[7]=T*r+y*o+v*h,t[8]=T*s+y*c+v*f,t}function R3(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=n[0],u=n[1];return t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=o,t[5]=c,t[6]=d*i+u*a+l,t[7]=d*r+u*o+h,t[8]=d*s+u*c+f,t}function C3(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=Math.sin(n),u=Math.cos(n);return t[0]=u*i+d*a,t[1]=u*r+d*o,t[2]=u*s+d*c,t[3]=u*a-d*i,t[4]=u*o-d*r,t[5]=u*c-d*s,t[6]=l,t[7]=h,t[8]=f,t}function P3(t,e,n){var i=n[0],r=n[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=r*e[3],t[4]=r*e[4],t[5]=r*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function D3(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function L3(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=0,t[3]=-n,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function I3(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function U3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function N3(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n+n,o=i+i,c=r+r,l=n*a,h=i*a,f=i*o,d=r*a,u=r*o,g=r*c,_=s*a,p=s*o,m=s*c;return t[0]=1-f-g,t[3]=h-m,t[6]=d+p,t[1]=h+m,t[4]=1-l-g,t[7]=u-_,t[2]=d-p,t[5]=u+_,t[8]=1-l-f,t}function F3(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=n*o-i*a,y=n*c-r*a,v=n*l-s*a,P=i*c-r*o,b=i*l-s*o,w=r*l-s*c,R=h*_-f*g,S=h*p-d*g,x=h*m-u*g,C=f*p-d*_,L=f*m-u*_,D=d*m-u*p,U=T*D-y*L+v*C+P*x-b*S+w*R;return U?(U=1/U,t[0]=(o*D-c*L+l*C)*U,t[1]=(c*x-a*D-l*S)*U,t[2]=(a*L-o*x+l*R)*U,t[3]=(r*L-i*D-s*C)*U,t[4]=(n*D-r*x+s*S)*U,t[5]=(i*x-n*L-s*R)*U,t[6]=(_*w-p*b+m*P)*U,t[7]=(p*v-g*w-m*y)*U,t[8]=(g*b-_*v+m*T)*U,t):null}function O3(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function z3(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function B3(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8])}function H3(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t}function yl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}function k3(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t}function V3(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t[4]=e[4]+n[4]*i,t[5]=e[5]+n[5]*i,t[6]=e[6]+n[6]*i,t[7]=e[7]+n[7]*i,t[8]=e[8]+n[8]*i,t}function G3(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function W3(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8],f=e[0],d=e[1],u=e[2],g=e[3],_=e[4],p=e[5],m=e[6],T=e[7],y=e[8];return Math.abs(n-f)<=pe*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-d)<=pe*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(r-u)<=pe*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(s-g)<=pe*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(a-_)<=pe*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(o-p)<=pe*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(c-m)<=pe*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(l-T)<=pe*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(h-y)<=pe*Math.max(1,Math.abs(h),Math.abs(y))}var X3=Ml,q3=yl;const $3=Object.freeze(Object.defineProperty({__proto__:null,add:H3,adjoint:A3,clone:x3,copy:M3,create:xl,determinant:w3,equals:W3,exactEquals:G3,frob:B3,fromMat2d:U3,fromMat4:v3,fromQuat:N3,fromRotation:L3,fromScaling:I3,fromTranslation:D3,fromValues:y3,identity:E3,invert:b3,mul:X3,multiply:Ml,multiplyScalar:k3,multiplyScalarAndAdd:V3,normalFromMat4:F3,projection:O3,rotate:C3,scale:P3,set:S3,str:z3,sub:q3,subtract:yl,translate:R3,transpose:T3},Symbol.toStringTag,{value:"Module"}));function Y3(){var t=new Ne(16);return Ne!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function j3(t){var e=new Ne(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Z3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function K3(t,e,n,i,r,s,a,o,c,l,h,f,d,u,g,_){var p=new Ne(16);return p[0]=t,p[1]=e,p[2]=n,p[3]=i,p[4]=r,p[5]=s,p[6]=a,p[7]=o,p[8]=c,p[9]=l,p[10]=h,p[11]=f,p[12]=d,p[13]=u,p[14]=g,p[15]=_,p}function J3(t,e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=h,t[10]=f,t[11]=d,t[12]=u,t[13]=g,t[14]=_,t[15]=p,t}function Sl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Q3(t,e){if(t===e){var n=e[1],i=e[2],r=e[3],s=e[6],a=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=s,t[11]=e[14],t[12]=r,t[13]=a,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function eg(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=n*o-i*a,y=n*c-r*a,v=n*l-s*a,P=i*c-r*o,b=i*l-s*o,w=r*l-s*c,R=h*_-f*g,S=h*p-d*g,x=h*m-u*g,C=f*p-d*_,L=f*m-u*_,D=d*m-u*p,U=T*D-y*L+v*C+P*x-b*S+w*R;return U?(U=1/U,t[0]=(o*D-c*L+l*C)*U,t[1]=(r*L-i*D-s*C)*U,t[2]=(_*w-p*b+m*P)*U,t[3]=(d*b-f*w-u*P)*U,t[4]=(c*x-a*D-l*S)*U,t[5]=(n*D-r*x+s*S)*U,t[6]=(p*v-g*w-m*y)*U,t[7]=(h*w-d*v+u*y)*U,t[8]=(a*L-o*x+l*R)*U,t[9]=(i*x-n*L-s*R)*U,t[10]=(g*b-_*v+m*T)*U,t[11]=(f*v-h*b-u*T)*U,t[12]=(o*S-a*C-c*R)*U,t[13]=(n*C-i*S+r*R)*U,t[14]=(_*y-g*P-p*T)*U,t[15]=(h*P-f*y+d*T)*U,t):null}function tg(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=n*o-i*a,y=n*c-r*a,v=n*l-s*a,P=i*c-r*o,b=i*l-s*o,w=r*l-s*c,R=h*_-f*g,S=h*p-d*g,x=h*m-u*g,C=f*p-d*_,L=f*m-u*_,D=d*m-u*p;return t[0]=o*D-c*L+l*C,t[1]=r*L-i*D-s*C,t[2]=_*w-p*b+m*P,t[3]=d*b-f*w-u*P,t[4]=c*x-a*D-l*S,t[5]=n*D-r*x+s*S,t[6]=p*v-g*w-m*y,t[7]=h*w-d*v+u*y,t[8]=a*L-o*x+l*R,t[9]=i*x-n*L-s*R,t[10]=g*b-_*v+m*T,t[11]=f*v-h*b-u*T,t[12]=o*S-a*C-c*R,t[13]=n*C-i*S+r*R,t[14]=_*y-g*P-p*T,t[15]=h*P-f*y+d*T,t}function ng(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],c=t[7],l=t[8],h=t[9],f=t[10],d=t[11],u=t[12],g=t[13],_=t[14],p=t[15],m=e*a-n*s,T=e*o-i*s,y=n*o-i*a,v=l*g-h*u,P=l*_-f*u,b=h*_-f*g,w=e*b-n*P+i*v,R=s*b-a*P+o*v,S=l*y-h*T+f*m,x=u*y-g*T+_*m;return c*w-r*R+p*S-d*x}function El(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=e[9],u=e[10],g=e[11],_=e[12],p=e[13],m=e[14],T=e[15],y=n[0],v=n[1],P=n[2],b=n[3];return t[0]=y*i+v*o+P*f+b*_,t[1]=y*r+v*c+P*d+b*p,t[2]=y*s+v*l+P*u+b*m,t[3]=y*a+v*h+P*g+b*T,y=n[4],v=n[5],P=n[6],b=n[7],t[4]=y*i+v*o+P*f+b*_,t[5]=y*r+v*c+P*d+b*p,t[6]=y*s+v*l+P*u+b*m,t[7]=y*a+v*h+P*g+b*T,y=n[8],v=n[9],P=n[10],b=n[11],t[8]=y*i+v*o+P*f+b*_,t[9]=y*r+v*c+P*d+b*p,t[10]=y*s+v*l+P*u+b*m,t[11]=y*a+v*h+P*g+b*T,y=n[12],v=n[13],P=n[14],b=n[15],t[12]=y*i+v*o+P*f+b*_,t[13]=y*r+v*c+P*d+b*p,t[14]=y*s+v*l+P*u+b*m,t[15]=y*a+v*h+P*g+b*T,t}function ig(t,e,n){var i=n[0],r=n[1],s=n[2],a,o,c,l,h,f,d,u,g,_,p,m;return e===t?(t[12]=e[0]*i+e[4]*r+e[8]*s+e[12],t[13]=e[1]*i+e[5]*r+e[9]*s+e[13],t[14]=e[2]*i+e[6]*r+e[10]*s+e[14],t[15]=e[3]*i+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],c=e[2],l=e[3],h=e[4],f=e[5],d=e[6],u=e[7],g=e[8],_=e[9],p=e[10],m=e[11],t[0]=a,t[1]=o,t[2]=c,t[3]=l,t[4]=h,t[5]=f,t[6]=d,t[7]=u,t[8]=g,t[9]=_,t[10]=p,t[11]=m,t[12]=a*i+h*r+g*s+e[12],t[13]=o*i+f*r+_*s+e[13],t[14]=c*i+d*r+p*s+e[14],t[15]=l*i+u*r+m*s+e[15]),t}function rg(t,e,n){var i=n[0],r=n[1],s=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function sg(t,e,n,i){var r=i[0],s=i[1],a=i[2],o=Math.sqrt(r*r+s*s+a*a),c,l,h,f,d,u,g,_,p,m,T,y,v,P,b,w,R,S,x,C,L,D,U,X;return o<pe?null:(o=1/o,r*=o,s*=o,a*=o,c=Math.sin(n),l=Math.cos(n),h=1-l,f=e[0],d=e[1],u=e[2],g=e[3],_=e[4],p=e[5],m=e[6],T=e[7],y=e[8],v=e[9],P=e[10],b=e[11],w=r*r*h+l,R=s*r*h+a*c,S=a*r*h-s*c,x=r*s*h-a*c,C=s*s*h+l,L=a*s*h+r*c,D=r*a*h+s*c,U=s*a*h-r*c,X=a*a*h+l,t[0]=f*w+_*R+y*S,t[1]=d*w+p*R+v*S,t[2]=u*w+m*R+P*S,t[3]=g*w+T*R+b*S,t[4]=f*x+_*C+y*L,t[5]=d*x+p*C+v*L,t[6]=u*x+m*C+P*L,t[7]=g*x+T*C+b*L,t[8]=f*D+_*U+y*X,t[9]=d*D+p*U+v*X,t[10]=u*D+m*U+P*X,t[11]=g*D+T*U+b*X,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function ag(t,e,n){var i=Math.sin(n),r=Math.cos(n),s=e[4],a=e[5],o=e[6],c=e[7],l=e[8],h=e[9],f=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*r+l*i,t[5]=a*r+h*i,t[6]=o*r+f*i,t[7]=c*r+d*i,t[8]=l*r-s*i,t[9]=h*r-a*i,t[10]=f*r-o*i,t[11]=d*r-c*i,t}function og(t,e,n){var i=Math.sin(n),r=Math.cos(n),s=e[0],a=e[1],o=e[2],c=e[3],l=e[8],h=e[9],f=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r-l*i,t[1]=a*r-h*i,t[2]=o*r-f*i,t[3]=c*r-d*i,t[8]=s*i+l*r,t[9]=a*i+h*r,t[10]=o*i+f*r,t[11]=c*i+d*r,t}function cg(t,e,n){var i=Math.sin(n),r=Math.cos(n),s=e[0],a=e[1],o=e[2],c=e[3],l=e[4],h=e[5],f=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r+l*i,t[1]=a*r+h*i,t[2]=o*r+f*i,t[3]=c*r+d*i,t[4]=l*r-s*i,t[5]=h*r-a*i,t[6]=f*r-o*i,t[7]=d*r-c*i,t}function lg(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function hg(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function fg(t,e,n){var i=n[0],r=n[1],s=n[2],a=Math.sqrt(i*i+r*r+s*s),o,c,l;return a<pe?null:(a=1/a,i*=a,r*=a,s*=a,o=Math.sin(e),c=Math.cos(e),l=1-c,t[0]=i*i*l+c,t[1]=r*i*l+s*o,t[2]=s*i*l-r*o,t[3]=0,t[4]=i*r*l-s*o,t[5]=r*r*l+c,t[6]=s*r*l+i*o,t[7]=0,t[8]=i*s*l+r*o,t[9]=r*s*l-i*o,t[10]=s*s*l+c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function dg(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ug(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function pg(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Tl(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=i+i,c=r+r,l=s+s,h=i*o,f=i*c,d=i*l,u=r*c,g=r*l,_=s*l,p=a*o,m=a*c,T=a*l;return t[0]=1-(u+_),t[1]=f+T,t[2]=d-m,t[3]=0,t[4]=f-T,t[5]=1-(h+_),t[6]=g+p,t[7]=0,t[8]=d+m,t[9]=g-p,t[10]=1-(h+u),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function mg(t,e){var n=new Ne(3),i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=i*i+r*r+s*s+a*a;return f>0?(n[0]=(o*a+h*i+c*s-l*r)*2/f,n[1]=(c*a+h*r+l*i-o*s)*2/f,n[2]=(l*a+h*s+o*r-c*i)*2/f):(n[0]=(o*a+h*i+c*s-l*r)*2,n[1]=(c*a+h*r+l*i-o*s)*2,n[2]=(l*a+h*s+o*r-c*i)*2),Tl(t,e,n),t}function bl(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Al(t,e){var n=e[0],i=e[1],r=e[2],s=e[4],a=e[5],o=e[6],c=e[8],l=e[9],h=e[10];return t[0]=Math.sqrt(n*n+i*i+r*r),t[1]=Math.sqrt(s*s+a*a+o*o),t[2]=Math.sqrt(c*c+l*l+h*h),t}function wl(t,e){var n=new Ne(3);Al(n,e);var i=1/n[0],r=1/n[1],s=1/n[2],a=e[0]*i,o=e[1]*r,c=e[2]*s,l=e[4]*i,h=e[5]*r,f=e[6]*s,d=e[8]*i,u=e[9]*r,g=e[10]*s,_=a+h+g,p=0;return _>0?(p=Math.sqrt(_+1)*2,t[3]=.25*p,t[0]=(f-u)/p,t[1]=(d-c)/p,t[2]=(o-l)/p):a>h&&a>g?(p=Math.sqrt(1+a-h-g)*2,t[3]=(f-u)/p,t[0]=.25*p,t[1]=(o+l)/p,t[2]=(d+c)/p):h>g?(p=Math.sqrt(1+h-a-g)*2,t[3]=(d-c)/p,t[0]=(o+l)/p,t[1]=.25*p,t[2]=(f+u)/p):(p=Math.sqrt(1+g-a-h)*2,t[3]=(o-l)/p,t[0]=(d+c)/p,t[1]=(f+u)/p,t[2]=.25*p),t}function gg(t,e,n,i){e[0]=i[12],e[1]=i[13],e[2]=i[14];var r=i[0],s=i[1],a=i[2],o=i[4],c=i[5],l=i[6],h=i[8],f=i[9],d=i[10];n[0]=Math.sqrt(r*r+s*s+a*a),n[1]=Math.sqrt(o*o+c*c+l*l),n[2]=Math.sqrt(h*h+f*f+d*d);var u=1/n[0],g=1/n[1],_=1/n[2],p=r*u,m=s*g,T=a*_,y=o*u,v=c*g,P=l*_,b=h*u,w=f*g,R=d*_,S=p+v+R,x=0;return S>0?(x=Math.sqrt(S+1)*2,t[3]=.25*x,t[0]=(P-w)/x,t[1]=(b-T)/x,t[2]=(m-y)/x):p>v&&p>R?(x=Math.sqrt(1+p-v-R)*2,t[3]=(P-w)/x,t[0]=.25*x,t[1]=(m+y)/x,t[2]=(b+T)/x):v>R?(x=Math.sqrt(1+v-p-R)*2,t[3]=(b-T)/x,t[0]=(m+y)/x,t[1]=.25*x,t[2]=(P+w)/x):(x=Math.sqrt(1+R-p-v)*2,t[3]=(m-y)/x,t[0]=(b+T)/x,t[1]=(P+w)/x,t[2]=.25*x),t}function _g(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=e[3],c=r+r,l=s+s,h=a+a,f=r*c,d=r*l,u=r*h,g=s*l,_=s*h,p=a*h,m=o*c,T=o*l,y=o*h,v=i[0],P=i[1],b=i[2];return t[0]=(1-(g+p))*v,t[1]=(d+y)*v,t[2]=(u-T)*v,t[3]=0,t[4]=(d-y)*P,t[5]=(1-(f+p))*P,t[6]=(_+m)*P,t[7]=0,t[8]=(u+T)*b,t[9]=(_-m)*b,t[10]=(1-(f+g))*b,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function vg(t,e,n,i,r){var s=e[0],a=e[1],o=e[2],c=e[3],l=s+s,h=a+a,f=o+o,d=s*l,u=s*h,g=s*f,_=a*h,p=a*f,m=o*f,T=c*l,y=c*h,v=c*f,P=i[0],b=i[1],w=i[2],R=r[0],S=r[1],x=r[2],C=(1-(_+m))*P,L=(u+v)*P,D=(g-y)*P,U=(u-v)*b,X=(1-(d+m))*b,V=(p+T)*b,K=(g+y)*w,G=(p-T)*w,te=(1-(d+_))*w;return t[0]=C,t[1]=L,t[2]=D,t[3]=0,t[4]=U,t[5]=X,t[6]=V,t[7]=0,t[8]=K,t[9]=G,t[10]=te,t[11]=0,t[12]=n[0]+R-(C*R+U*S+K*x),t[13]=n[1]+S-(L*R+X*S+G*x),t[14]=n[2]+x-(D*R+V*S+te*x),t[15]=1,t}function xg(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n+n,o=i+i,c=r+r,l=n*a,h=i*a,f=i*o,d=r*a,u=r*o,g=r*c,_=s*a,p=s*o,m=s*c;return t[0]=1-f-g,t[1]=h+m,t[2]=d-p,t[3]=0,t[4]=h-m,t[5]=1-l-g,t[6]=u+_,t[7]=0,t[8]=d+p,t[9]=u-_,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Mg(t,e,n,i,r,s,a){var o=1/(n-e),c=1/(r-i),l=1/(s-a);return t[0]=s*2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s*2*c,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(r+i)*c,t[10]=(a+s)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*s*2*l,t[15]=0,t}function Rl(t,e,n,i,r){var s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,r!=null&&r!==1/0){var a=1/(i-r);t[10]=(r+i)*a,t[14]=2*r*i*a}else t[10]=-1,t[14]=-2*i;return t}var yg=Rl;function Sg(t,e,n,i,r){var s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,r!=null&&r!==1/0){var a=1/(i-r);t[10]=r*a,t[14]=r*i*a}else t[10]=-1,t[14]=-i;return t}function Eg(t,e,n,i){var r=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),c=2/(a+o),l=2/(r+s);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-((a-o)*c*.5),t[9]=(r-s)*l*.5,t[10]=i/(n-i),t[11]=-1,t[12]=0,t[13]=0,t[14]=i*n/(n-i),t[15]=0,t}function Cl(t,e,n,i,r,s,a){var o=1/(e-n),c=1/(i-r),l=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+n)*o,t[13]=(r+i)*c,t[14]=(a+s)*l,t[15]=1,t}var Tg=Cl;function bg(t,e,n,i,r,s,a){var o=1/(e-n),c=1/(i-r),l=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+n)*o,t[13]=(r+i)*c,t[14]=s*l,t[15]=1,t}function Ag(t,e,n,i){var r,s,a,o,c,l,h,f,d,u,g=e[0],_=e[1],p=e[2],m=i[0],T=i[1],y=i[2],v=n[0],P=n[1],b=n[2];return Math.abs(g-v)<pe&&Math.abs(_-P)<pe&&Math.abs(p-b)<pe?Sl(t):(h=g-v,f=_-P,d=p-b,u=1/Math.sqrt(h*h+f*f+d*d),h*=u,f*=u,d*=u,r=T*d-y*f,s=y*h-m*d,a=m*f-T*h,u=Math.sqrt(r*r+s*s+a*a),u?(u=1/u,r*=u,s*=u,a*=u):(r=0,s=0,a=0),o=f*a-d*s,c=d*r-h*a,l=h*s-f*r,u=Math.sqrt(o*o+c*c+l*l),u?(u=1/u,o*=u,c*=u,l*=u):(o=0,c=0,l=0),t[0]=r,t[1]=o,t[2]=h,t[3]=0,t[4]=s,t[5]=c,t[6]=f,t[7]=0,t[8]=a,t[9]=l,t[10]=d,t[11]=0,t[12]=-(r*g+s*_+a*p),t[13]=-(o*g+c*_+l*p),t[14]=-(h*g+f*_+d*p),t[15]=1,t)}function wg(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=i[0],c=i[1],l=i[2],h=r-n[0],f=s-n[1],d=a-n[2],u=h*h+f*f+d*d;u>0&&(u=1/Math.sqrt(u),h*=u,f*=u,d*=u);var g=c*d-l*f,_=l*h-o*d,p=o*f-c*h;return u=g*g+_*_+p*p,u>0&&(u=1/Math.sqrt(u),g*=u,_*=u,p*=u),t[0]=g,t[1]=_,t[2]=p,t[3]=0,t[4]=f*p-d*_,t[5]=d*g-h*p,t[6]=h*_-f*g,t[7]=0,t[8]=h,t[9]=f,t[10]=d,t[11]=0,t[12]=r,t[13]=s,t[14]=a,t[15]=1,t}function Rg(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function Cg(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function Pg(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function Pl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function Dg(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function Lg(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t[4]=e[4]+n[4]*i,t[5]=e[5]+n[5]*i,t[6]=e[6]+n[6]*i,t[7]=e[7]+n[7]*i,t[8]=e[8]+n[8]*i,t[9]=e[9]+n[9]*i,t[10]=e[10]+n[10]*i,t[11]=e[11]+n[11]*i,t[12]=e[12]+n[12]*i,t[13]=e[13]+n[13]*i,t[14]=e[14]+n[14]*i,t[15]=e[15]+n[15]*i,t}function Ig(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function Ug(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8],f=t[9],d=t[10],u=t[11],g=t[12],_=t[13],p=t[14],m=t[15],T=e[0],y=e[1],v=e[2],P=e[3],b=e[4],w=e[5],R=e[6],S=e[7],x=e[8],C=e[9],L=e[10],D=e[11],U=e[12],X=e[13],V=e[14],K=e[15];return Math.abs(n-T)<=pe*Math.max(1,Math.abs(n),Math.abs(T))&&Math.abs(i-y)<=pe*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-v)<=pe*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(s-P)<=pe*Math.max(1,Math.abs(s),Math.abs(P))&&Math.abs(a-b)<=pe*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(o-w)<=pe*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(c-R)<=pe*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(l-S)<=pe*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(h-x)<=pe*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(f-C)<=pe*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(d-L)<=pe*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(u-D)<=pe*Math.max(1,Math.abs(u),Math.abs(D))&&Math.abs(g-U)<=pe*Math.max(1,Math.abs(g),Math.abs(U))&&Math.abs(_-X)<=pe*Math.max(1,Math.abs(_),Math.abs(X))&&Math.abs(p-V)<=pe*Math.max(1,Math.abs(p),Math.abs(V))&&Math.abs(m-K)<=pe*Math.max(1,Math.abs(m),Math.abs(K))}var Ng=El,Fg=Pl;const Og=Object.freeze(Object.defineProperty({__proto__:null,add:Pg,adjoint:tg,clone:j3,copy:Z3,create:Y3,decompose:gg,determinant:ng,equals:Ug,exactEquals:Ig,frob:Cg,fromQuat:xg,fromQuat2:mg,fromRotation:fg,fromRotationTranslation:Tl,fromRotationTranslationScale:_g,fromRotationTranslationScaleOrigin:vg,fromScaling:hg,fromTranslation:lg,fromValues:K3,fromXRotation:dg,fromYRotation:ug,fromZRotation:pg,frustum:Mg,getRotation:wl,getScaling:Al,getTranslation:bl,identity:Sl,invert:eg,lookAt:Ag,mul:Ng,multiply:El,multiplyScalar:Dg,multiplyScalarAndAdd:Lg,ortho:Tg,orthoNO:Cl,orthoZO:bg,perspective:yg,perspectiveFromFieldOfView:Eg,perspectiveNO:Rl,perspectiveZO:Sg,rotate:sg,rotateX:ag,rotateY:og,rotateZ:cg,scale:rg,set:J3,str:Rg,sub:Fg,subtract:Pl,targetTo:wg,translate:ig,transpose:Q3},Symbol.toStringTag,{value:"Module"}));function Fa(){var t=new Ne(3);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function zg(t){var e=new Ne(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Dl(t){var e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)}function xa(t,e,n){var i=new Ne(3);return i[0]=t,i[1]=e,i[2]=n,i}function Bg(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Hg(t,e,n,i){return t[0]=e,t[1]=n,t[2]=i,t}function kg(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function Ll(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Il(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function Ul(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function Vg(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function Gg(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function Wg(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function Xg(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function qg(t,e){return t[0]=tn(e[0]),t[1]=tn(e[1]),t[2]=tn(e[2]),t}function $g(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function Yg(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t}function Nl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return Math.sqrt(n*n+i*i+r*r)}function Fl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return n*n+i*i+r*r}function Ol(t){var e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i}function jg(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function Zg(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function zl(t,e){var n=e[0],i=e[1],r=e[2],s=n*n+i*i+r*r;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function $r(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ir(t,e,n){var i=e[0],r=e[1],s=e[2],a=n[0],o=n[1],c=n[2];return t[0]=r*c-s*o,t[1]=s*a-i*c,t[2]=i*o-r*a,t}function Kg(t,e,n,i){var r=e[0],s=e[1],a=e[2];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=a+i*(n[2]-a),t}function Jg(t,e,n,i){var r=Math.acos(Math.min(Math.max($r(e,n),-1),1)),s=Math.sin(r),a=Math.sin((1-i)*r)/s,o=Math.sin(i*r)/s;return t[0]=a*e[0]+o*n[0],t[1]=a*e[1]+o*n[1],t[2]=a*e[2]+o*n[2],t}function Qg(t,e,n,i,r,s){var a=s*s,o=a*(2*s-3)+1,c=a*(s-2)+s,l=a*(s-1),h=a*(3-2*s);return t[0]=e[0]*o+n[0]*c+i[0]*l+r[0]*h,t[1]=e[1]*o+n[1]*c+i[1]*l+r[1]*h,t[2]=e[2]*o+n[2]*c+i[2]*l+r[2]*h,t}function e_(t,e,n,i,r,s){var a=1-s,o=a*a,c=s*s,l=o*a,h=3*s*o,f=3*c*a,d=c*s;return t[0]=e[0]*l+n[0]*h+i[0]*f+r[0]*d,t[1]=e[1]*l+n[1]*h+i[1]*f+r[1]*d,t[2]=e[2]*l+n[2]*h+i[2]*f+r[2]*d,t}function t_(t,e){e=e===void 0?1:e;var n=$t()*2*Math.PI,i=$t()*2-1,r=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*r,t[1]=Math.sin(n)*r,t[2]=i*e,t}function n_(t,e,n){var i=e[0],r=e[1],s=e[2],a=n[3]*i+n[7]*r+n[11]*s+n[15];return a=a||1,t[0]=(n[0]*i+n[4]*r+n[8]*s+n[12])/a,t[1]=(n[1]*i+n[5]*r+n[9]*s+n[13])/a,t[2]=(n[2]*i+n[6]*r+n[10]*s+n[14])/a,t}function i_(t,e,n){var i=e[0],r=e[1],s=e[2];return t[0]=i*n[0]+r*n[3]+s*n[6],t[1]=i*n[1]+r*n[4]+s*n[7],t[2]=i*n[2]+r*n[5]+s*n[8],t}function r_(t,e,n){var i=n[0],r=n[1],s=n[2],a=n[3],o=e[0],c=e[1],l=e[2],h=r*l-s*c,f=s*o-i*l,d=i*c-r*o;return h=h+h,f=f+f,d=d+d,t[0]=o+a*h+r*d-s*f,t[1]=c+a*f+s*h-i*d,t[2]=l+a*d+i*f-r*h,t}function s_(t,e,n,i){var r=[],s=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[0],s[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),s[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t}function a_(t,e,n,i){var r=[],s=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),s[1]=r[1],s[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t}function o_(t,e,n,i){var r=[],s=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),s[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),s[2]=r[2],t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t}function c_(t,e){var n=t[0],i=t[1],r=t[2],s=e[0],a=e[1],o=e[2],c=Math.sqrt((n*n+i*i+r*r)*(s*s+a*a+o*o)),l=c&&$r(t,e)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function l_(t){return t[0]=0,t[1]=0,t[2]=0,t}function h_(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function f_(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function d_(t,e){var n=t[0],i=t[1],r=t[2],s=e[0],a=e[1],o=e[2];return Math.abs(n-s)<=pe*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-a)<=pe*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=pe*Math.max(1,Math.abs(r),Math.abs(o))}var u_=Ll,p_=Il,m_=Ul,g_=Nl,__=Fl,Bl=Dl,v_=Ol,x_=(function(){var t=Fa();return function(e,n,i,r,s,a){var o,c;for(n||(n=3),i||(i=0),r?c=Math.min(r*n+i,e.length):c=e.length,o=i;o<c;o+=n)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],s(t,t,a),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2];return e}})();const M_=Object.freeze(Object.defineProperty({__proto__:null,add:kg,angle:c_,bezier:e_,ceil:Vg,clone:zg,copy:Bg,create:Fa,cross:Ir,dist:g_,distance:Nl,div:m_,divide:Ul,dot:$r,equals:d_,exactEquals:f_,floor:Gg,forEach:x_,fromValues:xa,hermite:Qg,inverse:Zg,len:Bl,length:Dl,lerp:Kg,max:Xg,min:Wg,mul:p_,multiply:Il,negate:jg,normalize:zl,random:t_,rotateX:s_,rotateY:a_,rotateZ:o_,round:qg,scale:$g,scaleAndAdd:Yg,set:Hg,slerp:Jg,sqrDist:__,sqrLen:v_,squaredDistance:Fl,squaredLength:Ol,str:h_,sub:u_,subtract:Ll,transformMat3:i_,transformMat4:n_,transformQuat:r_,zero:l_},Symbol.toStringTag,{value:"Module"}));function Hl(){var t=new Ne(4);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function kl(t){var e=new Ne(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Vl(t,e,n,i){var r=new Ne(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function Gl(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Wl(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function Xl(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function ql(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function $l(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function Yl(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function y_(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function S_(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function E_(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t}function T_(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function b_(t,e){return t[0]=tn(e[0]),t[1]=tn(e[1]),t[2]=tn(e[2]),t[3]=tn(e[3]),t}function jl(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function A_(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t}function Zl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],s=e[3]-t[3];return Math.sqrt(n*n+i*i+r*r+s*s)}function Kl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],s=e[3]-t[3];return n*n+i*i+r*r+s*s}function Oa(t){var e=t[0],n=t[1],i=t[2],r=t[3];return Math.sqrt(e*e+n*n+i*i+r*r)}function za(t){var e=t[0],n=t[1],i=t[2],r=t[3];return e*e+n*n+i*i+r*r}function w_(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function R_(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function Jl(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n*n+i*i+r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=i*a,t[2]=r*a,t[3]=s*a,t}function Ba(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function C_(t,e,n,i){var r=n[0]*i[1]-n[1]*i[0],s=n[0]*i[2]-n[2]*i[0],a=n[0]*i[3]-n[3]*i[0],o=n[1]*i[2]-n[2]*i[1],c=n[1]*i[3]-n[3]*i[1],l=n[2]*i[3]-n[3]*i[2],h=e[0],f=e[1],d=e[2],u=e[3];return t[0]=f*l-d*c+u*o,t[1]=-(h*l)+d*a-u*s,t[2]=h*c-f*a+u*r,t[3]=-(h*o)+f*s-d*r,t}function Ql(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=e[3];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=a+i*(n[2]-a),t[3]=o+i*(n[3]-o),t}function P_(t,e){e=e===void 0?1:e;var n,i,r,s,a,o,c;c=$t(),n=c*2-1,i=(4*$t()-2)*Math.sqrt(c*-c+c),a=n*n+i*i,c=$t(),r=c*2-1,s=(4*$t()-2)*Math.sqrt(c*-c+c),o=r*r+s*s;var l=Math.sqrt((1-a)/o);return t[0]=e*n,t[1]=e*i,t[2]=e*r*l,t[3]=e*s*l,t}function D_(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*s+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*s+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*s+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*s+n[15]*a,t}function L_(t,e,n){var i=n[0],r=n[1],s=n[2],a=n[3],o=e[0],c=e[1],l=e[2],h=r*l-s*c,f=s*o-i*l,d=i*c-r*o;return h=h+h,f=f+f,d=d+d,t[0]=o+a*h+r*d-s*f,t[1]=c+a*f+s*h-i*d,t[2]=l+a*d+i*f-r*h,t[3]=e[3],t}function I_(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function U_(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function eh(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function N_(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=e[0],o=e[1],c=e[2],l=e[3];return Math.abs(n-a)<=pe*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=pe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-c)<=pe*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-l)<=pe*Math.max(1,Math.abs(s),Math.abs(l))}var F_=ql,O_=$l,z_=Yl,B_=Zl,H_=Kl,k_=Oa,V_=za,G_=(function(){var t=Hl();return function(e,n,i,r,s,a){var o,c;for(n||(n=4),i||(i=0),r?c=Math.min(r*n+i,e.length):c=e.length,o=i;o<c;o+=n)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],t[3]=e[o+3],s(t,t,a),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2],e[o+3]=t[3];return e}})();const W_=Object.freeze(Object.defineProperty({__proto__:null,add:Xl,ceil:y_,clone:kl,copy:Gl,create:Hl,cross:C_,dist:B_,distance:Zl,div:z_,divide:Yl,dot:Ba,equals:N_,exactEquals:eh,floor:S_,forEach:G_,fromValues:Vl,inverse:R_,len:k_,length:Oa,lerp:Ql,max:T_,min:E_,mul:O_,multiply:$l,negate:w_,normalize:Jl,random:P_,round:b_,scale:jl,scaleAndAdd:A_,set:Wl,sqrDist:H_,sqrLen:V_,squaredDistance:Kl,squaredLength:za,str:U_,sub:F_,subtract:ql,transformMat4:D_,transformQuat:L_,zero:I_},Symbol.toStringTag,{value:"Module"}));function Br(){var t=new Ne(4);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function X_(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function th(t,e,n){n=n*.5;var i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t}function q_(t,e){var n=Math.acos(e[3])*2,i=Math.sin(n/2);return i>pe?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n}function $_(t,e){var n=ka(t,e);return Math.acos(2*n*n-1)}function nh(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1],l=n[2],h=n[3];return t[0]=i*h+a*o+r*l-s*c,t[1]=r*h+a*c+s*o-i*l,t[2]=s*h+a*l+i*c-r*o,t[3]=a*h-i*o-r*c-s*l,t}function ih(t,e,n){n*=.5;var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c+a*o,t[1]=r*c+s*o,t[2]=s*c-r*o,t[3]=a*c-i*o,t}function rh(t,e,n){n*=.5;var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c-s*o,t[1]=r*c+a*o,t[2]=s*c+i*o,t[3]=a*c-r*o,t}function sh(t,e,n){n*=.5;var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c+r*o,t[1]=r*c-i*o,t[2]=s*c+a*o,t[3]=a*c-s*o,t}function Y_(t,e){var n=e[0],i=e[1],r=e[2];return t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r)),t}function ah(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=Math.sqrt(n*n+i*i+r*r),o=Math.exp(s),c=a>0?o*Math.sin(a)/a:0;return t[0]=n*c,t[1]=i*c,t[2]=r*c,t[3]=o*Math.cos(a),t}function oh(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=Math.sqrt(n*n+i*i+r*r),o=a>0?Math.atan2(a,s)/a:0;return t[0]=n*o,t[1]=i*o,t[2]=r*o,t[3]=.5*Math.log(n*n+i*i+r*r+s*s),t}function j_(t,e,n){return oh(t,e),lh(t,t,n),ah(t,t),t}function Ur(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=e[3],c=n[0],l=n[1],h=n[2],f=n[3],d,u,g,_,p;return u=r*c+s*l+a*h+o*f,u<0&&(u=-u,c=-c,l=-l,h=-h,f=-f),1-u>pe?(d=Math.acos(u),g=Math.sin(d),_=Math.sin((1-i)*d)/g,p=Math.sin(i*d)/g):(_=1-i,p=i),t[0]=_*r+p*c,t[1]=_*s+p*l,t[2]=_*a+p*h,t[3]=_*o+p*f,t}function Z_(t){var e=$t(),n=$t(),i=$t(),r=Math.sqrt(1-e),s=Math.sqrt(e);return t[0]=r*Math.sin(2*Math.PI*n),t[1]=r*Math.cos(2*Math.PI*n),t[2]=s*Math.sin(2*Math.PI*i),t[3]=s*Math.cos(2*Math.PI*i),t}function K_(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n*n+i*i+r*r+s*s,o=a?1/a:0;return t[0]=-n*o,t[1]=-i*o,t[2]=-r*o,t[3]=s*o,t}function J_(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function ch(t,e){var n=e[0]+e[4]+e[8],i;if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);var s=(r+1)%3,a=(r+2)%3;i=Math.sqrt(e[r*3+r]-e[s*3+s]-e[a*3+a]+1),t[r]=.5*i,i=.5/i,t[3]=(e[s*3+a]-e[a*3+s])*i,t[s]=(e[s*3+r]+e[r*3+s])*i,t[a]=(e[a*3+r]+e[r*3+a])*i}return t}function Q_(t,e,n,i){var r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:pl,s=Math.PI/360;e*=s,i*=s,n*=s;var a=Math.sin(e),o=Math.cos(e),c=Math.sin(n),l=Math.cos(n),h=Math.sin(i),f=Math.cos(i);switch(r){case"xyz":t[0]=a*l*f+o*c*h,t[1]=o*c*f-a*l*h,t[2]=o*l*h+a*c*f,t[3]=o*l*f-a*c*h;break;case"xzy":t[0]=a*l*f-o*c*h,t[1]=o*c*f-a*l*h,t[2]=o*l*h+a*c*f,t[3]=o*l*f+a*c*h;break;case"yxz":t[0]=a*l*f+o*c*h,t[1]=o*c*f-a*l*h,t[2]=o*l*h-a*c*f,t[3]=o*l*f+a*c*h;break;case"yzx":t[0]=a*l*f+o*c*h,t[1]=o*c*f+a*l*h,t[2]=o*l*h-a*c*f,t[3]=o*l*f-a*c*h;break;case"zxy":t[0]=a*l*f-o*c*h,t[1]=o*c*f+a*l*h,t[2]=o*l*h+a*c*f,t[3]=o*l*f-a*c*h;break;case"zyx":t[0]=a*l*f-o*c*h,t[1]=o*c*f+a*l*h,t[2]=o*l*h-a*c*f,t[3]=o*l*f+a*c*h;break;default:throw new Error("Unknown angle order "+r)}return t}function ev(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var tv=kl,nv=Vl,Ha=Gl,iv=Wl,rv=Xl,sv=nh,lh=jl,ka=Ba,av=Ql,Va=Oa,ov=Va,Ga=za,cv=Ga,Wa=Jl,lv=eh;function hv(t,e){return Math.abs(Ba(t,e))>=1-pe}var fv=(function(){var t=Fa(),e=xa(1,0,0),n=xa(0,1,0);return function(i,r,s){var a=$r(r,s);return a<-.999999?(Ir(t,e,r),Bl(t)<1e-6&&Ir(t,n,r),zl(t,t),th(i,t,Math.PI),i):a>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Ir(t,r,s),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+a,Wa(i,i))}})(),dv=(function(){var t=Br(),e=Br();return function(n,i,r,s,a,o){return Ur(t,i,a,o),Ur(e,r,s,o),Ur(n,t,e,2*o*(1-o)),n}})(),uv=(function(){var t=xl();return function(e,n,i,r){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=r[0],t[4]=r[1],t[7]=r[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],Wa(e,ch(e,t))}})();const pv=Object.freeze(Object.defineProperty({__proto__:null,add:rv,calculateW:Y_,clone:tv,conjugate:J_,copy:Ha,create:Br,dot:ka,equals:hv,exactEquals:lv,exp:ah,fromEuler:Q_,fromMat3:ch,fromValues:nv,getAngle:$_,getAxisAngle:q_,identity:X_,invert:K_,len:ov,length:Va,lerp:av,ln:oh,mul:sv,multiply:nh,normalize:Wa,pow:j_,random:Z_,rotateX:ih,rotateY:rh,rotateZ:sh,rotationTo:fv,scale:lh,set:iv,setAxes:uv,setAxisAngle:th,slerp:Ur,sqlerp:dv,sqrLen:cv,squaredLength:Ga,str:ev},Symbol.toStringTag,{value:"Module"}));function mv(){var t=new Ne(8);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function gv(t){var e=new Ne(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function _v(t,e,n,i,r,s,a,o){var c=new Ne(8);return c[0]=t,c[1]=e,c[2]=n,c[3]=i,c[4]=r,c[5]=s,c[6]=a,c[7]=o,c}function vv(t,e,n,i,r,s,a){var o=new Ne(8);o[0]=t,o[1]=e,o[2]=n,o[3]=i;var c=r*.5,l=s*.5,h=a*.5;return o[4]=c*i+l*n-h*e,o[5]=l*i+h*t-c*n,o[6]=h*i+c*e-l*t,o[7]=-c*t-l*e-h*n,o}function hh(t,e,n){var i=n[0]*.5,r=n[1]*.5,s=n[2]*.5,a=e[0],o=e[1],c=e[2],l=e[3];return t[0]=a,t[1]=o,t[2]=c,t[3]=l,t[4]=i*l+r*c-s*o,t[5]=r*l+s*a-i*c,t[6]=s*l+i*o-r*a,t[7]=-i*a-r*o-s*c,t}function xv(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0]*.5,t[5]=e[1]*.5,t[6]=e[2]*.5,t[7]=0,t}function Mv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function yv(t,e){var n=Br();wl(n,e);var i=new Ne(3);return bl(i,e),hh(t,n,i),t}function fh(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function Sv(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function Ev(t,e,n,i,r,s,a,o,c){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t[6]=o,t[7]=c,t}var Tv=Ha;function bv(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var Av=Ha;function wv(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function Rv(t,e){var n=e[4],i=e[5],r=e[6],s=e[7],a=-e[0],o=-e[1],c=-e[2],l=e[3];return t[0]=(n*l+s*a+i*c-r*o)*2,t[1]=(i*l+s*o+r*a-n*c)*2,t[2]=(r*l+s*c+n*o-i*a)*2,t}function Cv(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0]*.5,c=n[1]*.5,l=n[2]*.5,h=e[4],f=e[5],d=e[6],u=e[7];return t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=a*o+r*l-s*c+h,t[5]=a*c+s*o-i*l+f,t[6]=a*l+i*c-r*o+d,t[7]=-i*o-r*c-s*l+u,t}function Pv(t,e,n){var i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=o*a+h*i+c*s-l*r,d=c*a+h*r+l*i-o*s,u=l*a+h*s+o*r-c*i,g=h*a-o*i-c*r-l*s;return ih(t,e,n),i=t[0],r=t[1],s=t[2],a=t[3],t[4]=f*a+g*i+d*s-u*r,t[5]=d*a+g*r+u*i-f*s,t[6]=u*a+g*s+f*r-d*i,t[7]=g*a-f*i-d*r-u*s,t}function Dv(t,e,n){var i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=o*a+h*i+c*s-l*r,d=c*a+h*r+l*i-o*s,u=l*a+h*s+o*r-c*i,g=h*a-o*i-c*r-l*s;return rh(t,e,n),i=t[0],r=t[1],s=t[2],a=t[3],t[4]=f*a+g*i+d*s-u*r,t[5]=d*a+g*r+u*i-f*s,t[6]=u*a+g*s+f*r-d*i,t[7]=g*a-f*i-d*r-u*s,t}function Lv(t,e,n){var i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=o*a+h*i+c*s-l*r,d=c*a+h*r+l*i-o*s,u=l*a+h*s+o*r-c*i,g=h*a-o*i-c*r-l*s;return sh(t,e,n),i=t[0],r=t[1],s=t[2],a=t[3],t[4]=f*a+g*i+d*s-u*r,t[5]=d*a+g*r+u*i-f*s,t[6]=u*a+g*s+f*r-d*i,t[7]=g*a-f*i-d*r-u*s,t}function Iv(t,e,n){var i=n[0],r=n[1],s=n[2],a=n[3],o=e[0],c=e[1],l=e[2],h=e[3];return t[0]=o*a+h*i+c*s-l*r,t[1]=c*a+h*r+l*i-o*s,t[2]=l*a+h*s+o*r-c*i,t[3]=h*a-o*i-c*r-l*s,o=e[4],c=e[5],l=e[6],h=e[7],t[4]=o*a+h*i+c*s-l*r,t[5]=c*a+h*r+l*i-o*s,t[6]=l*a+h*s+o*r-c*i,t[7]=h*a-o*i-c*r-l*s,t}function Uv(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1],l=n[2],h=n[3];return t[0]=i*h+a*o+r*l-s*c,t[1]=r*h+a*c+s*o-i*l,t[2]=s*h+a*l+i*c-r*o,t[3]=a*h-i*o-r*c-s*l,o=n[4],c=n[5],l=n[6],h=n[7],t[4]=i*h+a*o+r*l-s*c,t[5]=r*h+a*c+s*o-i*l,t[6]=s*h+a*l+i*c-r*o,t[7]=a*h-i*o-r*c-s*l,t}function Nv(t,e,n,i){if(Math.abs(i)<pe)return fh(t,e);var r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);i=i*.5;var s=Math.sin(i),a=s*n[0]/r,o=s*n[1]/r,c=s*n[2]/r,l=Math.cos(i),h=e[0],f=e[1],d=e[2],u=e[3];t[0]=h*l+u*a+f*c-d*o,t[1]=f*l+u*o+d*a-h*c,t[2]=d*l+u*c+h*o-f*a,t[3]=u*l-h*a-f*o-d*c;var g=e[4],_=e[5],p=e[6],m=e[7];return t[4]=g*l+m*a+_*c-p*o,t[5]=_*l+m*o+p*a-g*c,t[6]=p*l+m*c+g*o-_*a,t[7]=m*l-g*a-_*o-p*c,t}function Fv(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t}function dh(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[4],c=n[5],l=n[6],h=n[7],f=e[4],d=e[5],u=e[6],g=e[7],_=n[0],p=n[1],m=n[2],T=n[3];return t[0]=i*T+a*_+r*m-s*p,t[1]=r*T+a*p+s*_-i*m,t[2]=s*T+a*m+i*p-r*_,t[3]=a*T-i*_-r*p-s*m,t[4]=i*h+a*o+r*l-s*c+f*T+g*_+d*m-u*p,t[5]=r*h+a*c+s*o-i*l+d*T+g*p+u*_-f*m,t[6]=s*h+a*l+i*c-r*o+u*T+g*m+f*p-d*_,t[7]=a*h-i*o-r*c-s*l+g*T-f*_-d*p-u*m,t}var Ov=dh;function zv(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t}var uh=ka;function Bv(t,e,n,i){var r=1-i;return uh(e,n)<0&&(i=-i),t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i,t[3]=e[3]*r+n[3]*i,t[4]=e[4]*r+n[4]*i,t[5]=e[5]*r+n[5]*i,t[6]=e[6]*r+n[6]*i,t[7]=e[7]*r+n[7]*i,t}function Hv(t,e){var n=Yr(e);return t[0]=-e[0]/n,t[1]=-e[1]/n,t[2]=-e[2]/n,t[3]=e[3]/n,t[4]=-e[4]/n,t[5]=-e[5]/n,t[6]=-e[6]/n,t[7]=e[7]/n,t}function kv(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t}var ph=Va,Vv=ph,Yr=Ga,Gv=Yr;function Wv(t,e){var n=Yr(e);if(n>0){n=Math.sqrt(n);var i=e[0]/n,r=e[1]/n,s=e[2]/n,a=e[3]/n,o=e[4],c=e[5],l=e[6],h=e[7],f=i*o+r*c+s*l+a*h;t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=(o-i*f)/n,t[5]=(c-r*f)/n,t[6]=(l-s*f)/n,t[7]=(h-a*f)/n}return t}function Xv(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function qv(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function $v(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=e[0],f=e[1],d=e[2],u=e[3],g=e[4],_=e[5],p=e[6],m=e[7];return Math.abs(n-h)<=pe*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-f)<=pe*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(r-d)<=pe*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(s-u)<=pe*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(a-g)<=pe*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(o-_)<=pe*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-p)<=pe*Math.max(1,Math.abs(c),Math.abs(p))&&Math.abs(l-m)<=pe*Math.max(1,Math.abs(l),Math.abs(m))}const Yv=Object.freeze(Object.defineProperty({__proto__:null,add:Fv,clone:gv,conjugate:kv,copy:fh,create:mv,dot:uh,equals:$v,exactEquals:qv,fromMat4:yv,fromRotation:Mv,fromRotationTranslation:hh,fromRotationTranslationValues:vv,fromTranslation:xv,fromValues:_v,getDual:bv,getReal:Tv,getTranslation:Rv,identity:Sv,invert:Hv,len:Vv,length:ph,lerp:Bv,mul:Ov,multiply:dh,normalize:Wv,rotateAroundAxis:Nv,rotateByQuatAppend:Iv,rotateByQuatPrepend:Uv,rotateX:Pv,rotateY:Dv,rotateZ:Lv,scale:zv,set:Ev,setDual:wv,setReal:Av,sqrLen:Gv,squaredLength:Yr,str:Xv,translate:Cv},Symbol.toStringTag,{value:"Module"}));function mh(){var t=new Ne(2);return Ne!=Float32Array&&(t[0]=0,t[1]=0),t}function jv(t){var e=new Ne(2);return e[0]=t[0],e[1]=t[1],e}function Zv(t,e){var n=new Ne(2);return n[0]=t,n[1]=e,n}function Kv(t,e){return t[0]=e[0],t[1]=e[1],t}function Jv(t,e,n){return t[0]=e,t[1]=n,t}function Qv(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function gh(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function _h(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function vh(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function ex(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function tx(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function nx(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function ix(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}function rx(t,e){return t[0]=tn(e[0]),t[1]=tn(e[1]),t}function sx(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function ax(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t}function xh(t,e){var n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)}function Mh(t,e){var n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i}function yh(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function Sh(t){var e=t[0],n=t[1];return e*e+n*n}function ox(t,e){return t[0]=-e[0],t[1]=-e[1],t}function cx(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function lx(t,e){var n=e[0],i=e[1],r=n*n+i*i;return r>0&&(r=1/Math.sqrt(r)),t[0]=e[0]*r,t[1]=e[1]*r,t}function hx(t,e){return t[0]*e[0]+t[1]*e[1]}function fx(t,e,n){var i=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=i,t}function dx(t,e,n,i){var r=e[0],s=e[1];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t}function ux(t,e){e=e===void 0?1:e;var n=$t()*2*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}function px(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t}function mx(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t}function gx(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t}function _x(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t}function vx(t,e,n,i){var r=e[0]-n[0],s=e[1]-n[1],a=Math.sin(i),o=Math.cos(i);return t[0]=r*o-s*a+n[0],t[1]=r*a+s*o+n[1],t}function xx(t,e){var n=t[0],i=t[1],r=e[0],s=e[1];return Math.abs(Math.atan2(i*r-n*s,n*r+i*s))}function Mx(t,e){var n=t[0],i=t[1],r=e[0],s=e[1];return Math.atan2(n*s-i*r,n*r+i*s)}function yx(t){return t[0]=0,t[1]=0,t}function Sx(t){return"vec2("+t[0]+", "+t[1]+")"}function Ex(t,e){return t[0]===e[0]&&t[1]===e[1]}function Tx(t,e){var n=t[0],i=t[1],r=e[0],s=e[1];return Math.abs(n-r)<=pe*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(i-s)<=pe*Math.max(1,Math.abs(i),Math.abs(s))}var bx=yh,Ax=gh,wx=_h,Rx=vh,Cx=xh,Px=Mh,Dx=Sh,Lx=(function(){var t=mh();return function(e,n,i,r,s,a){var o,c;for(n||(n=2),i||(i=0),r?c=Math.min(r*n+i,e.length):c=e.length,o=i;o<c;o+=n)t[0]=e[o],t[1]=e[o+1],s(t,t,a),e[o]=t[0],e[o+1]=t[1];return e}})();const Ix=Object.freeze(Object.defineProperty({__proto__:null,add:Qv,angle:xx,ceil:ex,clone:jv,copy:Kv,create:mh,cross:fx,dist:Cx,distance:xh,div:Rx,divide:vh,dot:hx,equals:Tx,exactEquals:Ex,floor:tx,forEach:Lx,fromValues:Zv,inverse:cx,len:bx,length:yh,lerp:dx,max:ix,min:nx,mul:wx,multiply:_h,negate:ox,normalize:lx,random:ux,rotate:vx,round:rx,scale:sx,scaleAndAdd:ax,set:Jv,signedAngle:Mx,sqrDist:Px,sqrLen:Dx,squaredDistance:Mh,squaredLength:Sh,str:Sx,sub:Ax,subtract:gh,transformMat2:px,transformMat2d:mx,transformMat3:gx,transformMat4:_x,zero:yx},Symbol.toStringTag,{value:"Module"})),Eh=Object.freeze(Object.defineProperty({__proto__:null,glMatrix:S2,mat2:$2,mat2d:_3,mat3:$3,mat4:Og,quat:pv,quat2:Yv,vec2:Ix,vec3:M_,vec4:W_},Symbol.toStringTag,{value:"Module"}));function Th(t,e,n,i,r){if(t.length===0)return null;if(t.length===1){const p=t[0];return{cx:p.x,cy:p.y,cz:p.z,count:1,size:r,children:null,point:p}}const s=e+r,a=n+r,o=i+r,c=r/2,l=[[],[],[],[],[],[],[],[]];for(const p of t){let m=0;p.x>=s&&(m|=1),p.y>=a&&(m|=2),p.z>=o&&(m|=4),l[m].push(p)}let h=0,f=0,d=0,u=0;const g=[],_=[[0,0,0],[1,0,0],[0,1,0],[1,1,0],[0,0,1],[1,0,1],[0,1,1],[1,1,1]];for(let p=0;p<8;p++){const m=l[p];if(m.length===0)continue;const[T,y,v]=_[p],P=e+T*r,b=n+y*r,w=i+v*r,R=Th(m,P,b,w,c);R&&(g.push(R),h+=R.cx*R.count,f+=R.cy*R.count,d+=R.cz*R.count,u+=R.count)}return u===0?null:{cx:h/u,cy:f/u,cz:d/u,count:u,size:r,children:g,point:null}}function bh(t,e,n,i,r,s,a,o){if(t===null)return;const c=t.cx-e,l=t.cy-n,h=t.cz-i,f=c*c+l*l+h*h;if(f<1e-20)return;const d=Math.sqrt(f);if(t.point!==null){if(t.point.index===r)return;const g=s/f;o.fx-=c*g,o.fy-=l*g,o.fz-=h*g;return}if(t.size/d<a&&t.count>0){const g=s*t.count/f;o.fx-=c*g,o.fy-=l*g,o.fz-=h*g;return}if(t.children)for(const g of t.children)bh(g,e,n,i,r,s,a,o)}const{vec3:yt}=Eh,Ux={simulationBound:1e3,cohesionValue:1,repulsionValue:1,centerPull:.1,iterationsPerStep:1,useOctree:!0,octreeThreshold:64,octreeTheta:.8};function Nx(t,e={}){const n={...Ux,...e},i=t.get_node_ids_order(),r=i.length,s=t.get_adjacency(),a=new Map;i.forEach((g,_)=>a.set(g,_));const o=new Float32Array(r*3);for(let g=0;g<r;g++)o[g*3]=Math.random()*n.simulationBound,o[g*3+1]=Math.random()*n.simulationBound,o[g*3+2]=Math.random()*n.simulationBound;const c={force:yt.create(),diff:yt.create(),neighborAvg:yt.create(),posI:yt.create(),posJ:yt.create()},l=n.useOctree&&r>=n.octreeThreshold,h=l?Array.from({length:r},(g,_)=>({x:0,y:0,z:0,index:_})):[];function f(g){const _=Math.max(1,n.iterationsPerStep);for(let p=0;p<_;p++){let m=null;if(l){let T=1/0,y=1/0,v=1/0,P=-1/0,b=-1/0,w=-1/0;for(let D=0;D<r;D++){const U=o[D*3],X=o[D*3+1],V=o[D*3+2];h[D].x=U,h[D].y=X,h[D].z=V,U<T&&(T=U),U>P&&(P=U),X<y&&(y=X),X>b&&(b=X),V<v&&(v=V),V>w&&(w=V)}const R=1e-6,S=Math.max(P-T,b-y,w-v,R)/2+R,x=(T+P)/2,C=(y+b)/2,L=(v+w)/2;m=Th(h,x-S,C-S,L-S,S)}for(let T=0;T<r;T++){yt.set(c.posI,o[T*3],o[T*3+1],o[T*3+2]),yt.set(c.force,0,0,0);const y=s.get(i[T])??[];if(y.length>0){c.neighborAvg[0]=0,c.neighborAvg[1]=0,c.neighborAvg[2]=0;for(const v of y){const P=a.get(v);P!==void 0&&(c.neighborAvg[0]+=o[P*3],c.neighborAvg[1]+=o[P*3+1],c.neighborAvg[2]+=o[P*3+2])}c.neighborAvg[0]/=y.length,c.neighborAvg[1]/=y.length,c.neighborAvg[2]/=y.length,yt.subtract(c.diff,c.neighborAvg,c.posI),yt.scale(c.diff,c.diff,n.cohesionValue),yt.add(c.force,c.force,c.diff)}if(l&&m){const v={fx:0,fy:0,fz:0};bh(m,c.posI[0],c.posI[1],c.posI[2],T,n.repulsionValue,n.octreeTheta,v),c.force[0]+=v.fx,c.force[1]+=v.fy,c.force[2]+=v.fz}else for(let v=0;v<r;v++){if(v===T)continue;yt.set(c.posJ,o[v*3],o[v*3+1],o[v*3+2]),yt.subtract(c.diff,c.posJ,c.posI);const P=yt.squaredLength(c.diff);P<1e-10||(yt.scale(c.diff,c.diff,n.repulsionValue/P),yt.subtract(c.force,c.force,c.diff))}c.force[0]-=n.centerPull*c.posI[0],c.force[1]-=n.centerPull*c.posI[1],c.force[2]-=n.centerPull*c.posI[2],o[T*3]+=c.force[0],o[T*3+1]+=c.force[1],o[T*3+2]+=c.force[2]}}}function d(){return o}function u(){const g=new Map;for(let _=0;_<r;_++)g.set(i[_],new mt(o[_*3],o[_*3+1],o[_*3+2]));return g}return{step:f,getPositions:d,getPositionMap:u}}const Fx={dimensions:2,simulationBound:1,epochsPerStep:1,centerPull:0,scaleBound:0,useSchedule:!0,learningRate:.08,tMax:80,eps:.01,initialPreservation:0};function Ox(t,e){for(let n=t.length-1;n>=1;n--){const i=Math.floor(e()*(n+1));[t[n],t[i]]=[t[i],t[n]]}}function zx(t){let e=t;return()=>(e=e*1103515245+12345&2147483647,e/2147483647)}async function Bx(t,e,n){const i=e.length,r=new Map;for(let a=0;a<i;a++){const o=e[a],c=await Hr.Dijkstra(t,o);r.set(o,c)}const s=[];for(let a=0;a<i;a++)for(let o=a+1;o<i;o++){const c=r.get(e[a]);if(!c)continue;const l=c.get(e[o]);if(l===void 0||l<=0)continue;const h=1/(l*l);s.push({i:a,j:o,d:l,w:h})}return s}async function Hx(t,e={}){const n={...Fx,...e,seed:e.seed??Math.floor(Math.random()*2147483647)},i=t.get_node_ids_order(),r=i.length,s=new Map;i.forEach((b,w)=>s.set(b,w));const a=await Bx(t,i);a.length;let o=1/0,c=-1/0;for(const b of a)b.w<o&&(o=b.w),b.w>c&&(c=b.w);(o<=0||c<=0)&&(o=1),c<=0&&(c=1);const l=1/o,h=n.eps/c,f=n.tMax>1?Math.log(l/h)/(n.tMax-1):0,d=b=>b>=n.tMax?h:l*Math.exp(-f*b),u=n.dimensions,g=zx(n.seed),_=new Float32Array(r*3);let p=null;if(n.initialPositions&&n.initialPositions.length>=r*3){if(_.set(n.initialPositions.subarray(0,r*3)),n.initialPreservation>0&&(p=new Float32Array(n.initialPositions.subarray(0,r*3))),u===2)for(let b=0;b<r;b++)_[b*3+2]=0}else{const b=n.simulationBound;for(let w=0;w<r;w++)_[w*3]=g()*b,_[w*3+1]=g()*b,_[w*3+2]=u===2?0:g()*b}let m=0;const T=1e-12;function y(b){const w=Math.max(1,n.epochsPerStep);for(let R=0;R<w&&m<n.tMax;R++){const S=n.useSchedule?d(m):n.learningRate;m++,Ox(a,g);for(const x of a){const{i:C,j:L,d:D,w:U}=x;let X=S*U;X>1&&(X=1);const V=_[C*3]-_[L*3],K=_[C*3+1]-_[L*3+1],G=u===3?_[C*3+2]-_[L*3+2]:0,te=Math.max(Math.sqrt(V*V+K*K+G*G),T),ie=X*(te-D)/(2*te);_[C*3]-=ie*V,_[C*3+1]-=ie*K,u===3&&(_[C*3+2]-=ie*G),_[L*3]+=ie*V,_[L*3+1]+=ie*K,u===3&&(_[L*3+2]+=ie*G)}}if(n.initialPreservation>0&&p){const R=n.initialPreservation;for(let S=0;S<r*3;S++)_[S]=(1-R)*_[S]+R*p[S]}if(n.centerPull>0)for(let R=0;R<r;R++)_[R*3]-=n.centerPull*_[R*3],_[R*3+1]-=n.centerPull*_[R*3+1],u===3&&(_[R*3+2]-=n.centerPull*_[R*3+2]);if(n.scaleBound>0&&r>0){let R=0,S=0,x=0;for(let L=0;L<r;L++)R+=_[L*3],S+=_[L*3+1],x+=_[L*3+2];R/=r,S/=r,x/=r;let C=0;for(let L=0;L<r;L++){_[L*3]-=R,_[L*3+1]-=S,_[L*3+2]-=x;const D=Math.sqrt(_[L*3]**2+_[L*3+1]**2+(u===3?_[L*3+2]**2:0));D>C&&(C=D)}if(C>0){const L=n.scaleBound/C;for(let D=0;D<r*3;D++)_[D]*=L}}if(u===2)for(let R=0;R<r;R++)_[R*3+2]=0}function v(){return _}function P(){const b=new Map;for(let w=0;w<r;w++)b.set(i[w],new mt(_[w*3],_[w*3+1],_[w*3+2]));return b}return{step:y,getPositions:v,getPositionMap:P}}exports.Constructors=vc;exports.Drawing=Ec;exports.Edge=gn;exports.Geometry=wi;exports.Graph=jt;exports.GraphDrawer=r2;exports.GraphMethods=Hr;exports.Hierarchy=u2;exports.Line=kr;exports.Models=a2;exports.Point=mt;exports.SampleData=rf;exports.ThreeWrapper=B1;exports.Utilities=Et;exports._Node=In;exports.createKamadaKawai3D=Nx;exports.createStressSGD3D=Hx;exports.glMatrix=Eh;exports.matrixVectorMultiply=p2;exports.normalizeVector=m2;
|
|
3886
|
+
`;function al(t,e=1,n=1,i=16777215,r=1){const s=[],a=t.get_position_map();let o,c;typeof n=="number"?o=Array(t.nodes.size).fill(n):o=n,c=Array(t.nodes.size).fill(i);const l=[],h=new Oe;h.setRGB(255,255,255);let f=0,d;for(let p of t.nodes.keys())d=a.get(p),s.push(d.x*e,d.y*e,d.z*e),h.toArray(c,f*3),l.push(p),f+=1;const u=new pt;u.setAttribute("position",new ot(s,3)),u.setAttribute("customColor",new ot(c,3)),u.setAttribute("size",new ot(o,1)),u.setAttribute("label",new Vc(l,1)),u.name="nodes";const g=new Yt({uniforms:{color:{value:new Oe(16777215)},pointTexture:{value:new el().load("./Textures/Square.png")},alphaTest:{value:r}},vertexShader:rl,fragmentShader:sl}),_=new xt;return _.add(new La(u,g)),_}function wg(t,e=1,n=1,i=16777215,r=1){const s=t.get_node_ids_order(),a=s.length,o=t.get_position_map(),c=[];let l;const h=Array(a).fill(i),f=s.slice(),d=new Oe;d.setRGB(255,255,255);for(let T=0;T<a;T++){const y=o.get(s[T]);c.push(y.x*e,y.y*e,y.z*e),d.toArray(h,T*3)}typeof n=="number"?l=Array(a).fill(n):l=n;const u=new pt;u.setAttribute("position",new ot(c,3)),u.setAttribute("customColor",new ot(h,3)),u.setAttribute("size",new ot(l,1)),u.setAttribute("label",new Vc(f,1)),u.name="nodes";const g=new Yt({uniforms:{color:{value:new Oe(16777215)},pointTexture:{value:new el().load("./Textures/Square.png")},alphaTest:{value:r}},vertexShader:rl,fragmentShader:sl}),_=new xt;_.add(new La(u,g));const p=u.getAttribute("position");function m(T){const y=p.array;if(T instanceof Float32Array)for(let v=0;v<a*3;v++)y[v]=T[v]*e;else for(let v=0;v<a;v++){const P=T.get(s[v]);y[v*3]=P.x*e,y[v*3+1]=P.y*e,y[v*3+2]=P.z*e}p.needsUpdate=!0}return{group:_,updatePositions:m}}function Rg(t,e=1,n=16777215,i=.4){const r=t.get_edge_map();return ol(r,e,n,i)}function ol(t,e,n=16777215,i=.4){return il(t,e,n,i)}function Cg(t,e=1,n=16777215){const i=t.get_edge_map();return cl(i,e,n)}function Pg(t,e=1,n=16777215){const i=new qr({color:n}),r=new xt;function s(){for(;r.children.length>0;){const o=r.children[0];r.remove(o),o instanceof zr&&o.geometry&&o.geometry.dispose()}const a=t.get_edge_map();for(const[o,c]of a.entries()){const l=[];c.points.forEach(d=>{l.push(new z(d.x*e,d.y*e,d.z*e))});const h=new pt().setFromPoints(l),f=new zr(h,i);f.userData={edgeId:o},r.add(f)}}return s(),{group:r,updateEdges:s}}function Dg(t,e,n,i=16777215,r=5){const s=t.get_position_map(),a=n.map(c=>s.get(c)).filter(c=>c!=null);if(a.length<2)return new xt;const o=new kr(a);return il(new Map([[0,o]]),e,i,r)}function cl(t,e=1,n=16777215){const i=new qr({color:n}),r=new xt;let s;for(const[a,o]of t.entries()){s=[],o.points.forEach(f=>{s.push(new z(f.x*e,f.y*e,f.z*e))});const l=new pt().setFromPoints(s),h=new zr(l,i);h.userData={edgeId:a},r.add(h)}return r}const bn=new je,An=new z,gi=new Ln,wn=new z;function ll(t,e=1,n=16777215,i=10){const r=t.size,s=Array.from(t.entries()),a=typeof i=="number"?Array(r).fill(i):i,o=new Kn(1,1,1),c=new Pi({color:n}),l=new Da(o,c,r);l.name="boxVertices",gi.identity();for(let f=0;f<r;f++){const d=s[f][1],u=a[f];An.set(d.x*e,d.y*e,d.z*e),wn.set(u,u,u),bn.compose(An,gi,wn),l.setMatrixAt(f,bn)}l.instanceMatrix.needsUpdate=!0,l.userData={nodeIds:s.map(f=>f[0])};const h=new xt;return h.add(l),h}function Lg(t,e=1,n=16777215,i=10){const r=t.get_node_ids_order(),s=r.length,a=t.get_position_map(),o=typeof i=="number"?Array(s).fill(i):i,c=new Kn(1,1,1),l=new Pi({color:n}),h=new Da(c,l,s);h.name="boxVertices",gi.identity();for(let u=0;u<s;u++){const g=a.get(r[u]),_=o[u];An.set(g.x*e,g.y*e,g.z*e),wn.set(_,_,_),bn.compose(An,gi,wn),h.setMatrixAt(u,bn)}h.instanceMatrix.needsUpdate=!0,h.userData={nodeIds:r.slice()};const f=new xt;f.add(h);function d(u){if(u instanceof Float32Array)for(let g=0;g<s;g++)An.set(u[g*3]*e,u[g*3+1]*e,u[g*3+2]*e),wn.set(o[g],o[g],o[g]),bn.compose(An,gi,wn),h.setMatrixAt(g,bn);else for(let g=0;g<s;g++){const _=u.get(r[g]);An.set(_.x*e,_.y*e,_.z*e),wn.set(o[g],o[g],o[g]),bn.compose(An,gi,wn),h.setMatrixAt(g,bn)}h.instanceMatrix.needsUpdate=!0}return{group:f,updatePositions:d}}function Ig(t,e=1,n=16777215,i=10){const r=t.get_position_map();return ll(r,e,n,i)}function Ug(t,e=16,n=16777215,i=10){let r;typeof i=="number"?r=Array(t.size).fill(i):r=i;const s=new xt,a=new Pi({color:n});let o=0;for(const[c,l]of t){const h=typeof r=="number"?r:r[o],f=2*h*Math.PI,d=Math.ceil(f/e),u=new Ia(h,h,10,d);u.name=String(c);const g=new Rt(u,a);g.position.set(l.x,l.y,l.z),s.add(g),o+=1}return s}async function Ng(t,e){const n=new Map;let i,r;for(let d of t.nodes.keys()){i=t.nodes.get(d);const u=i.data[e];r=typeof u=="number"?u:u!=null?Number(u):void 0,r!==void 0&&(n.has(r)?n.get(r).push(d):n.set(r,[d]))}const s=new Map,a=new Map;let o,c,l,h;for(let d of n.keys())o=n.get(d),c=await Hr.SelectSubgraph(t,o),l=al(c,1),s.set(d,l),h=hl(c,.03),a.set(d,h);return{nodeGroups:s,EdgeGroups:a}}function hl(t,e,n=16777215){const i=new xt,r=new qr({color:n});let s,a,o;for(let c of t.edges.values())if(Math.random()<=e){s=t.nodes.get(c.start).data.pos,a=t.nodes.get(c.end).data.pos,o=[],o.push(new z(s.x,s.y,s.z)),o.push(new z(a.x,a.y,a.z));const l=new pt().setFromPoints(o),h=new zr(l,r);i.add(h)}return i}function Fg(t,e,n){try{const i=t instanceof xt?t.children[0]:t,r=i==null?void 0:i.geometry;if(!(r!=null&&r.attributes))return;const s=r.attributes.customColor,a=s==null?void 0:s.array;if(!a||a.length===0)return;const o=new Oe(n),c=r.attributes.label,l=c==null?void 0:c.array;l&&l.length>0?e.forEach(h=>{for(let f=0;f<l.length;f++)if(l[f]===h){const d=f*3;d+2<a.length&&(a[d]=o.r,a[d+1]=o.g,a[d+2]=o.b);break}}):e.forEach(h=>{const f=h*3;f+2<a.length&&(a[f]=o.r,a[f+1]=o.g,a[f+2]=o.b)}),s&&(s.needsUpdate=!0)}catch{}}function Og(t){var e,n;try{const i=t instanceof xt?t.children[0]:t,r=(n=(e=i==null?void 0:i.geometry)==null?void 0:e.attributes)==null?void 0:n.customColor,s=r==null?void 0:r.array;if(!s||s.length===0)return;const a=(r==null?void 0:r.count)??Math.floor(s.length/3);for(let o=0;o<a;o++){const c=o*3;s[c]=1,s[c+1]=1,s[c+2]=1}r&&(r.needsUpdate=!0)}catch{}}const zg={DrawTHREEGraphVertices:al,DrawTHREEGraphVerticesMutable:wg,DrawTHREEGraphEdgesThick:Rg,DrawTHREEGraphEdgesThin:Cg,DrawTHREEGraphEdgesThinMutable:Pg,DrawThickPathFromNodeIds:Dg,AddBoxBasedImaging:ll,AddInModularityBasedPointGroups:Ng,DrawThinEdgesFromEdgeMap:cl,DrawThickEdgesFromEdgeMap:ol,AddCylinderBasedImaging:Ug,DrawSimplifiedEdges:hl,ChangeTheVertexColours:Fg,ResetVertexColors:Og,DrawTHREEBoxBasedVertices:Ig,DrawTHREEBoxBasedVerticesMutable:Lg},fc={type:"change"},Na={type:"start"},fl={type:"end"},Tr=new ji,dc=new fn,Bg=Math.cos(70*$f.DEG2RAD),lt=new z,wt=2*Math.PI,Ke={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ws=1e-6;class Hg extends xg{constructor(e,n=null){super(e,n),this.state=Ke.NONE,this.enabled=!0,this.target=new z,this.cursor=new z,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.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:_i.ROTATE,MIDDLE:_i.DOLLY,RIGHT:_i.PAN},this.touches={ONE:pi.ROTATE,TWO:pi.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new z,this._lastQuaternion=new Ln,this._lastTargetPosition=new z,this._quat=new Ln().setFromUnitVectors(e.up,new z(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new hc,this._sphericalDelta=new hc,this._scale=1,this._panOffset=new z,this._rotateStart=new we,this._rotateEnd=new we,this._rotateDelta=new we,this._panStart=new we,this._panEnd=new we,this._panDelta=new we,this._dollyStart=new we,this._dollyEnd=new we,this._dollyDelta=new we,this._dollyDirection=new z,this._mouse=new we,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Vg.bind(this),this._onPointerDown=kg.bind(this),this._onPointerUp=Gg.bind(this),this._onContextMenu=Zg.bind(this),this._onMouseWheel=qg.bind(this),this._onKeyDown=$g.bind(this),this._onTouchStart=Yg.bind(this),this._onTouchMove=jg.bind(this),this._onMouseDown=Wg.bind(this),this._onMouseMove=Xg.bind(this),this._interceptControlDown=Kg.bind(this),this._interceptControlUp=Jg.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){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.removeEventListener("pointermove",this._onPointerMove),this.domElement.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="auto"}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(fc),this.update(),this.state=Ke.NONE}update(e=null){const n=this.object.position;lt.copy(n).sub(this.target),lt.applyQuaternion(this._quat),this._spherical.setFromVector3(lt),this.autoRotate&&this.state===Ke.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+=wt:i>Math.PI&&(i-=wt),r<-Math.PI?r+=wt:r>Math.PI&&(r-=wt),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{const a=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=a!=this._spherical.radius}if(lt.setFromSpherical(this._spherical),lt.applyQuaternion(this._quatInverse),n.copy(this.target).add(lt),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){const o=lt.length();a=this._clampDistance(o*this._scale);const c=o-a;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),s=!!c}else if(this.object.isOrthographicCamera){const o=new z(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=c!==this.object.zoom;const l=new z(this._mouse.x,this._mouse.y,0);l.unproject(this.object),this.object.position.sub(l).add(o),this.object.updateMatrixWorld(),a=lt.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):(Tr.origin.copy(this.object.position),Tr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Tr.direction))<Bg?this.object.lookAt(this.target):(dc.setFromNormalAndCoplanarPoint(this.object.up,this.target),Tr.intersectPlane(dc,this.target))))}else if(this.object.isOrthographicCamera){const 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)>ws||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ws||this._lastTargetPosition.distanceToSquared(this.target)>ws?(this.dispatchEvent(fc),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?wt/60*this.autoRotateSpeed*e:wt/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){lt.setFromMatrixColumn(n,0),lt.multiplyScalar(-e),this._panOffset.add(lt)}_panUp(e,n){this.screenSpacePanning===!0?lt.setFromMatrixColumn(n,1):(lt.setFromMatrixColumn(n,0),lt.crossVectors(this.object.up,lt)),lt.multiplyScalar(e),this._panOffset.add(lt)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;lt.copy(r).sub(this.target);let s=lt.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*n*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(n*(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,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=e-i.left,s=n-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);const n=this.domElement;this._rotateLeft(wt*this._rotateDelta.x/n.clientHeight),this._rotateUp(wt*this._rotateDelta.y/n.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 n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-wt*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,r=e.pageY-n.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{const 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);const n=this.domElement;this._rotateLeft(wt*this._rotateDelta.x/n.clientHeight),this._rotateUp(wt*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.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){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,r=e.pageY-n.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);const a=(e.pageX+n.x)*.5,o=(e.pageY+n.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 n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new we,this._pointerPositions[e.pointerId]=n),n.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const n=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[n]}_customWheelEvent(e){const n=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function kg(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Vg(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function Gg(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(fl),this.state=Ke.NONE;break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y});break}}function Wg(t){let e;switch(t.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 _i.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=Ke.DOLLY;break;case _i.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Ke.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Ke.ROTATE}break;case _i.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Ke.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Ke.PAN}break;default:this.state=Ke.NONE}this.state!==Ke.NONE&&this.dispatchEvent(Na)}function Xg(t){switch(this.state){case Ke.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case Ke.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case Ke.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function qg(t){this.enabled===!1||this.enableZoom===!1||this.state!==Ke.NONE||(t.preventDefault(),this.dispatchEvent(Na),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(fl))}function $g(t){this.enabled===!1||this.enablePan===!1||this._handleKeyDown(t)}function Yg(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case pi.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=Ke.TOUCH_ROTATE;break;case pi.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=Ke.TOUCH_PAN;break;default:this.state=Ke.NONE}break;case 2:switch(this.touches.TWO){case pi.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=Ke.TOUCH_DOLLY_PAN;break;case pi.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=Ke.TOUCH_DOLLY_ROTATE;break;default:this.state=Ke.NONE}break;default:this.state=Ke.NONE}this.state!==Ke.NONE&&this.dispatchEvent(Na)}function jg(t){switch(this._trackPointer(t),this.state){case Ke.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case Ke.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case Ke.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case Ke.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=Ke.NONE}}function Zg(t){this.enabled!==!1&&t.preventDefault()}function Kg(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Jg(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Qg(t){var n;const e=t.object;if(e instanceof La){const i=e.geometry,r=(n=i==null?void 0:i.attributes)==null?void 0:n.label;return r&&t.index!=null?r.array[t.index]??null:null}if(e instanceof Da&&t.instanceId!=null){const i=e.userData.nodeIds;return i&&t.instanceId<i.length?i[t.instanceId]:null}return null}function e_(t){const n=t.object.userData.edgeId;return n??null}function uc(t,e){var r;const n=t.nodes.get(e),i=t.get_position_map();return{nodeId:e,data:(n==null?void 0:n.data)??{},neighbours:((r=n==null?void 0:n.neighbours)==null?void 0:r.slice())??[],position:i.get(e)}}function pc(t,e){const n=t.edges.get(e);return n?{edgeId:e,start:n.start,end:n.end,data:n.data??{}}:null}const br=new z,mc=new fn,gc=new z;class t_{constructor(e,n,i,r,s){this.lastHoverNodeId=null,this.lastHoverEdgeId=null,this.dragNodeId=null,this.wasDragging=!1,this.scene=e,this.camera=n,this.domElement=i,this.graph=r,this.options=s,this.raycaster=new vg,this.mouse=new we,this.hoverEnabled=s.hoverEnabled!==!1,this.controls=s.controls,this.raycaster.params.Line={threshold:5},this.raycaster.params.Points={threshold:10},this.boundOnClick=this.onClick.bind(this),this.boundOnPointerMove=this.onPointerMove.bind(this),this.boundOnPointerDown=this.onPointerDown.bind(this),this.boundOnPointerUp=this.onPointerUp.bind(this),i.addEventListener("click",this.boundOnClick),this.hoverEnabled&&i.addEventListener("pointermove",this.boundOnPointerMove),s.enableNodeDrag&&s.onNodeDrag&&(i.addEventListener("pointerdown",this.boundOnPointerDown),i.addEventListener("pointerup",this.boundOnPointerUp),i.addEventListener("pointerleave",this.boundOnPointerUp))}dispose(){this.domElement.removeEventListener("click",this.boundOnClick),this.domElement.removeEventListener("pointermove",this.boundOnPointerMove),this.domElement.removeEventListener("pointerdown",this.boundOnPointerDown),this.domElement.removeEventListener("pointerup",this.boundOnPointerUp),this.domElement.removeEventListener("pointerleave",this.boundOnPointerUp)}getMouseNDC(e){const n=this.domElement;if(e.target===n)this.mouse.x=e.offsetX/n.offsetWidth*2-1,this.mouse.y=-(e.offsetY/n.offsetHeight)*2+1;else{const r=n.getBoundingClientRect();this.mouse.x=(e.clientX-r.left)/r.width*2-1,this.mouse.y=-((e.clientY-r.top)/r.height)*2+1}}pick(){this.raycaster.setFromCamera(this.mouse,this.camera);const e=this.raycaster.intersectObject(this.scene,!0);let n=null,i=null,r=1/0,s=1/0;for(const a of e){const o=Qg(a),c=e_(a);o!=null&&a.distance<r&&(n=o,r=a.distance),c!=null&&a.distance<s&&(i=c,s=a.distance)}return n!=null&&i!=null&&r<=s?i=null:n!=null&&i!=null&&(n=null),{nodeId:n,edgeId:i}}onClick(e){if(this.wasDragging){this.wasDragging=!1;return}this.getMouseNDC(e);const{nodeId:n,edgeId:i}=this.pick();if(n!=null&&this.options.onNodeClick&&this.options.onNodeClick(uc(this.graph,n)),i!=null&&this.options.onEdgeClick){const r=pc(this.graph,i);r&&this.options.onEdgeClick(r)}}onPointerDown(e){if(this.wasDragging=!1,e.button!==0)return;this.getMouseNDC(e);const{nodeId:n}=this.pick();n!=null&&this.options.enableNodeDrag&&this.options.onNodeDrag&&(this.dragNodeId=n,this.controls&&(this.controls.enabled=!1))}onPointerUp(e){this.dragNodeId!=null&&(this.wasDragging=!0,this.dragNodeId=null,this.controls&&(this.controls.enabled=!0))}getDragPosition(){if(this.dragNodeId==null)return null;const e=this.graph.get_position_map().get(this.dragNodeId);return e?(gc.set(0,0,-1).applyQuaternion(this.camera.quaternion),mc.setFromNormalAndCoplanarPoint(gc,new z(e.x,e.y,e.z)),this.raycaster.setFromCamera(this.mouse,this.camera),this.raycaster.ray.intersectPlane(mc,br)?{x:br.x,y:br.y,z:br.z}:null):null}onPointerMove(e){if(this.getMouseNDC(e),this.dragNodeId!=null&&this.options.onNodeDrag){const r=this.getDragPosition();r&&this.options.onNodeDrag(this.dragNodeId,r);return}const{nodeId:n,edgeId:i}=this.pick();this.fireHoverCallbacks(n,i)}fireHoverCallbacks(e,n){if(this.options.onNodeHover&&(e!=null?e!==this.lastHoverNodeId&&(this.lastHoverNodeId=e,this.options.onNodeHover(uc(this.graph,e))):this.lastHoverNodeId!=null&&(this.lastHoverNodeId=null,this.options.onNodeHover(null))),this.options.onEdgeHover)if(n!=null){if(n!==this.lastHoverEdgeId){this.lastHoverEdgeId=n;const i=pc(this.graph,n);i&&this.options.onEdgeHover(i)}}else this.lastHoverEdgeId!=null&&(this.lastHoverEdgeId=null,this.options.onEdgeHover(null))}}class n_{constructor(e){this.canvas=e.canvas,this.width=e.width,this.height=e.height,this.geometryMap=new Map,this.materialMap=new Map,this.meshMap=new Map,this.controls,this.renderer,this.camera,this.scene,this.graphs=new Map}async init(){const e=performance.now();this.camera=new zt,this.scene=new og,this.renderer=new ag({canvas:this.canvas,antialias:!0}),this.renderer.setSize(this.width,this.height),this.renderer.setClearColor(16711935,0),this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix(),this.scene.add(new _g(16777215));const n=new gg(16777215,1);n.position.set(0,10,0),this.scene.add(n),this.controls=new Hg(this.camera,this.renderer.domElement),this.camera.position.set(0,100,100),this.controls.autoRotate=!0,this.controls.maxPolarAngle=Math.PI*.5,this.controls.maxDistance=1e4,this.controls.minDistance=10,this.controls.update();const i=performance.now();console.log("initialization has finished"),console.log(`Time to initialize ${i-e} milliseconds`)}addVisElement(e){this.scene.add(e)}rendercall(){this.renderer.render(this.scene,this.camera),this.controls.update()}enableInteraction(e){this.disableInteraction();const n={...e,controls:e.controls??this.controls};this.interactionLayer=new t_(this.scene,this.camera,this.renderer.domElement,e.graph,n)}disableInteraction(){this.interactionLayer&&(this.interactionLayer.dispose(),this.interactionLayer=void 0)}}const i_={GraphDrawer3d:n_};async function r_(t,e){const n=new Map,i=new Map;let r;for(let l=0;l<t;l++)r=new In({}),n.set(l,r);let s,a,o=0;for(let l=0;l<t;l++)for(let h=0;h<t;h++)l!=h&&(s=Math.random(),e>s&&(a=new gn(l,h,{}),i.set(o,a),o+=1));return new jt(n,i)}const s_={GenerateErdosReyni_n_p:r_};function a_(t,e){const n=t.x-e.x,i=t.y-e.y,r=t.z-e.z;return n*n+i*i+r*r}function dl(t){return["x","y","z"][t%3]}function va(t,e){if(t.length===0)return null;if(t.length===1)return{item:t[0]};const n=dl(e),i=[...t].sort((c,l)=>c.point[n]-l.point[n]),r=Math.floor(i.length/2),s=i[r],a=r>0?va(i.slice(0,r),e+1):null,o=r+1<i.length?va(i.slice(r+1),e+1):null;return{left:a??void 0,right:o??void 0,item:s}}function Wi(t,e,n,i,r){if(t===null)return;const s=dl(i);a_(e,t.item.point)<=n&&r.push(t.item.nodeId);const o=e[s]-t.item.point[s],c=o*o;o<=0?(t.left&&Wi(t.left,e,n,i+1,r),t.right&&c<=n&&Wi(t.right,e,n,i+1,r)):(t.right&&Wi(t.right,e,n,i+1,r),t.left&&c<=n&&Wi(t.left,e,n,i+1,r))}function o_(t,e){const n=va(t,0),i=e*e,r=new Map;for(const{point:s,nodeId:a}of t){const o=[];n&&Wi(n,s,i,0,o),r.set(a,o)}return r}class c_{constructor(){this.parent=new Map}find(e){return this.parent.has(e)||this.parent.set(e,e),this.parent.get(e)!==e&&this.parent.set(e,this.find(this.parent.get(e))),this.parent.get(e)}union(e,n){const i=this.find(e),r=this.find(n);i!==r&&this.parent.set(i,r)}}function l_(){return{cluster(t,e){const{distanceThreshold:n}=e,i=t.get_position_map(),r=[];for(const[u,g]of i)r.push({point:g,nodeId:u});if(r.length===0)return{nodeToCluster:new Map,clusterCentroids:new Map,clusterIds:[]};const s=o_(r,n),a=new c_;for(const[u,g]of s)for(const _ of g)a.union(u,_);const o=new Map;let c=0;const l=new Map,h=new Map;for(const{nodeId:u}of r){const g=a.find(u);o.has(g)||o.set(g,c++);const _=o.get(g);l.set(u,_),h.has(_)||h.set(_,[]),h.get(_).push(u)}const f=new Map;for(const[u,g]of h){const _=g.map(p=>i.get(p));f.set(u,wi.centroid(_))}const d=[...h.keys()];return{nodeToCluster:l,clusterCentroids:f,clusterIds:d}}}}async function ul(t,e){const{nodeToCluster:n,clusterCentroids:i,clusterIds:r}=e,s=new Map,a=new Map;for(const f of r){const d=i.get(f),u=new In({pos:d});s.set(f,u)}const o=new Map,c=(f,d)=>f<=d?`${f},${d}`:`${d},${f}`;for(const[,f]of t.edges){const d=n.get(f.start),u=n.get(f.end);if(d===void 0||u===void 0||d===u)continue;const g=c(d,u);o.set(g,(o.get(g)??0)+1)}let l=0;for(const[f,d]of o){const[u,g]=f.split(",").map(Number);a.set(l++,new gn(u,g,{count:d}))}const h=new jt(s,a);return await h.initialize(),h}async function h_(t,e){const i=l_().cluster(t,e);return ul(t,i)}async function f_(t,e,n){const i=e.cluster(t,n);return ul(t,i)}const d_={clusterByDistance:h_,clusterByStrategy:f_};function u_(t,e,n,i){for(let r=0;r<e;r++){let s=0;for(let a=0;a<e;a++)s+=t[r*e+a]*n[a];i[r]=s}}function p_(t){let e=0;for(let i=0;i<t.length;i++)e+=t[i]*t[i];const n=Math.sqrt(e);if(n>0)for(let i=0;i<t.length;i++)t[i]/=n}var pe=1e-6,Ne=typeof Float32Array<"u"?Float32Array:Array,$t=Math.random,pl="zyx";function tn(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}function m_(t){Ne=t}var g_=Math.PI/180,__=180/Math.PI;function v_(t){return t*g_}function x_(t){return t*__}function M_(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pe;return Math.abs(t-e)<=n*Math.max(1,Math.abs(t),Math.abs(e))}const y_=Object.freeze(Object.defineProperty({__proto__:null,ANGLE_ORDER:pl,get ARRAY_TYPE(){return Ne},EPSILON:pe,RANDOM:$t,equals:M_,round:tn,setMatrixArrayType:m_,toDegree:x_,toRadian:v_},Symbol.toStringTag,{value:"Module"}));function S_(){var t=new Ne(4);return Ne!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function E_(t){var e=new Ne(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function T_(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function b_(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function A_(t,e,n,i){var r=new Ne(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function w_(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function R_(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function C_(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n*s-r*i;return a?(a=1/a,t[0]=s*a,t[1]=-i*a,t[2]=-r*a,t[3]=n*a,t):null}function P_(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t}function D_(t){return t[0]*t[3]-t[2]*t[1]}function ml(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1],l=n[2],h=n[3];return t[0]=i*o+s*c,t[1]=r*o+a*c,t[2]=i*l+s*h,t[3]=r*l+a*h,t}function L_(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c+s*o,t[1]=r*c+a*o,t[2]=i*-o+s*c,t[3]=r*-o+a*c,t}function I_(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1];return t[0]=i*o,t[1]=r*o,t[2]=s*c,t[3]=a*c,t}function U_(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=-n,t[3]=i,t}function N_(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function F_(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function O_(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3])}function z_(t,e,n,i){return t[2]=i[2]/i[0],n[0]=i[0],n[1]=i[1],n[3]=i[3]-t[2]*n[1],[t,e,n]}function B_(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function gl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function H_(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function k_(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=e[0],o=e[1],c=e[2],l=e[3];return Math.abs(n-a)<=pe*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=pe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-c)<=pe*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-l)<=pe*Math.max(1,Math.abs(s),Math.abs(l))}function V_(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function G_(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t}var W_=ml,X_=gl;const q_=Object.freeze(Object.defineProperty({__proto__:null,LDU:z_,add:B_,adjoint:P_,clone:E_,copy:T_,create:S_,determinant:D_,equals:k_,exactEquals:H_,frob:O_,fromRotation:U_,fromScaling:N_,fromValues:A_,identity:b_,invert:C_,mul:W_,multiply:ml,multiplyScalar:V_,multiplyScalarAndAdd:G_,rotate:L_,scale:I_,set:w_,str:F_,sub:X_,subtract:gl,transpose:R_},Symbol.toStringTag,{value:"Module"}));function $_(){var t=new Ne(6);return Ne!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function Y_(t){var e=new Ne(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function j_(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Z_(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function K_(t,e,n,i,r,s){var a=new Ne(6);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a[4]=r,a[5]=s,a}function J_(t,e,n,i,r,s,a){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t}function Q_(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=n*s-i*r;return c?(c=1/c,t[0]=s*c,t[1]=-i*c,t[2]=-r*c,t[3]=n*c,t[4]=(r*o-s*a)*c,t[5]=(i*a-n*o)*c,t):null}function ev(t){return t[0]*t[3]-t[1]*t[2]}function _l(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=n[0],h=n[1],f=n[2],d=n[3],u=n[4],g=n[5];return t[0]=i*l+s*h,t[1]=r*l+a*h,t[2]=i*f+s*d,t[3]=r*f+a*d,t[4]=i*u+s*g+o,t[5]=r*u+a*g+c,t}function tv(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=Math.sin(n),h=Math.cos(n);return t[0]=i*h+s*l,t[1]=r*h+a*l,t[2]=i*-l+s*h,t[3]=r*-l+a*h,t[4]=o,t[5]=c,t}function nv(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=n[0],h=n[1];return t[0]=i*l,t[1]=r*l,t[2]=s*h,t[3]=a*h,t[4]=o,t[5]=c,t}function iv(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=n[0],h=n[1];return t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=i*l+s*h+o,t[5]=r*l+a*h+c,t}function rv(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=-n,t[3]=i,t[4]=0,t[5]=0,t}function sv(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function av(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function ov(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function cv(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+1)}function lv(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t}function vl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}function hv(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t}function fv(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t[4]=e[4]+n[4]*i,t[5]=e[5]+n[5]*i,t}function dv(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function uv(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=e[0],l=e[1],h=e[2],f=e[3],d=e[4],u=e[5];return Math.abs(n-c)<=pe*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-l)<=pe*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(r-h)<=pe*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(s-f)<=pe*Math.max(1,Math.abs(s),Math.abs(f))&&Math.abs(a-d)<=pe*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-u)<=pe*Math.max(1,Math.abs(o),Math.abs(u))}var pv=_l,mv=vl;const gv=Object.freeze(Object.defineProperty({__proto__:null,add:lv,clone:Y_,copy:j_,create:$_,determinant:ev,equals:uv,exactEquals:dv,frob:cv,fromRotation:rv,fromScaling:sv,fromTranslation:av,fromValues:K_,identity:Z_,invert:Q_,mul:pv,multiply:_l,multiplyScalar:hv,multiplyScalarAndAdd:fv,rotate:tv,scale:nv,set:J_,str:ov,sub:mv,subtract:vl,translate:iv},Symbol.toStringTag,{value:"Module"}));function xl(){var t=new Ne(9);return Ne!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function _v(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function vv(t){var e=new Ne(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function xv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Mv(t,e,n,i,r,s,a,o,c){var l=new Ne(9);return l[0]=t,l[1]=e,l[2]=n,l[3]=i,l[4]=r,l[5]=s,l[6]=a,l[7]=o,l[8]=c,l}function yv(t,e,n,i,r,s,a,o,c,l){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t}function Sv(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Ev(t,e){if(t===e){var n=e[1],i=e[2],r=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=i,t[7]=r}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function Tv(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=h*a-o*l,d=-h*s+o*c,u=l*s-a*c,g=n*f+i*d+r*u;return g?(g=1/g,t[0]=f*g,t[1]=(-h*i+r*l)*g,t[2]=(o*i-r*a)*g,t[3]=d*g,t[4]=(h*n-r*c)*g,t[5]=(-o*n+r*s)*g,t[6]=u*g,t[7]=(-l*n+i*c)*g,t[8]=(a*n-i*s)*g,t):null}function bv(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t[0]=a*h-o*l,t[1]=r*l-i*h,t[2]=i*o-r*a,t[3]=o*c-s*h,t[4]=n*h-r*c,t[5]=r*s-n*o,t[6]=s*l-a*c,t[7]=i*c-n*l,t[8]=n*a-i*s,t}function Av(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],c=t[7],l=t[8];return e*(l*s-a*c)+n*(-l*r+a*o)+i*(c*r-s*o)}function Ml(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=n[0],u=n[1],g=n[2],_=n[3],p=n[4],m=n[5],T=n[6],y=n[7],v=n[8];return t[0]=d*i+u*a+g*l,t[1]=d*r+u*o+g*h,t[2]=d*s+u*c+g*f,t[3]=_*i+p*a+m*l,t[4]=_*r+p*o+m*h,t[5]=_*s+p*c+m*f,t[6]=T*i+y*a+v*l,t[7]=T*r+y*o+v*h,t[8]=T*s+y*c+v*f,t}function wv(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=n[0],u=n[1];return t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=o,t[5]=c,t[6]=d*i+u*a+l,t[7]=d*r+u*o+h,t[8]=d*s+u*c+f,t}function Rv(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=Math.sin(n),u=Math.cos(n);return t[0]=u*i+d*a,t[1]=u*r+d*o,t[2]=u*s+d*c,t[3]=u*a-d*i,t[4]=u*o-d*r,t[5]=u*c-d*s,t[6]=l,t[7]=h,t[8]=f,t}function Cv(t,e,n){var i=n[0],r=n[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=r*e[3],t[4]=r*e[4],t[5]=r*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Pv(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function Dv(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=0,t[3]=-n,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Lv(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Iv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function Uv(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n+n,o=i+i,c=r+r,l=n*a,h=i*a,f=i*o,d=r*a,u=r*o,g=r*c,_=s*a,p=s*o,m=s*c;return t[0]=1-f-g,t[3]=h-m,t[6]=d+p,t[1]=h+m,t[4]=1-l-g,t[7]=u-_,t[2]=d-p,t[5]=u+_,t[8]=1-l-f,t}function Nv(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=n*o-i*a,y=n*c-r*a,v=n*l-s*a,P=i*c-r*o,b=i*l-s*o,w=r*l-s*c,R=h*_-f*g,S=h*p-d*g,x=h*m-u*g,C=f*p-d*_,L=f*m-u*_,D=d*m-u*p,U=T*D-y*L+v*C+P*x-b*S+w*R;return U?(U=1/U,t[0]=(o*D-c*L+l*C)*U,t[1]=(c*x-a*D-l*S)*U,t[2]=(a*L-o*x+l*R)*U,t[3]=(r*L-i*D-s*C)*U,t[4]=(n*D-r*x+s*S)*U,t[5]=(i*x-n*L-s*R)*U,t[6]=(_*w-p*b+m*P)*U,t[7]=(p*v-g*w-m*y)*U,t[8]=(g*b-_*v+m*T)*U,t):null}function Fv(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function Ov(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function zv(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8])}function Bv(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t}function yl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}function Hv(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t}function kv(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t[4]=e[4]+n[4]*i,t[5]=e[5]+n[5]*i,t[6]=e[6]+n[6]*i,t[7]=e[7]+n[7]*i,t[8]=e[8]+n[8]*i,t}function Vv(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function Gv(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8],f=e[0],d=e[1],u=e[2],g=e[3],_=e[4],p=e[5],m=e[6],T=e[7],y=e[8];return Math.abs(n-f)<=pe*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-d)<=pe*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(r-u)<=pe*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(s-g)<=pe*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(a-_)<=pe*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(o-p)<=pe*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(c-m)<=pe*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(l-T)<=pe*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(h-y)<=pe*Math.max(1,Math.abs(h),Math.abs(y))}var Wv=Ml,Xv=yl;const qv=Object.freeze(Object.defineProperty({__proto__:null,add:Bv,adjoint:bv,clone:vv,copy:xv,create:xl,determinant:Av,equals:Gv,exactEquals:Vv,frob:zv,fromMat2d:Iv,fromMat4:_v,fromQuat:Uv,fromRotation:Dv,fromScaling:Lv,fromTranslation:Pv,fromValues:Mv,identity:Sv,invert:Tv,mul:Wv,multiply:Ml,multiplyScalar:Hv,multiplyScalarAndAdd:kv,normalFromMat4:Nv,projection:Fv,rotate:Rv,scale:Cv,set:yv,str:Ov,sub:Xv,subtract:yl,translate:wv,transpose:Ev},Symbol.toStringTag,{value:"Module"}));function $v(){var t=new Ne(16);return Ne!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function Yv(t){var e=new Ne(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function jv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Zv(t,e,n,i,r,s,a,o,c,l,h,f,d,u,g,_){var p=new Ne(16);return p[0]=t,p[1]=e,p[2]=n,p[3]=i,p[4]=r,p[5]=s,p[6]=a,p[7]=o,p[8]=c,p[9]=l,p[10]=h,p[11]=f,p[12]=d,p[13]=u,p[14]=g,p[15]=_,p}function Kv(t,e,n,i,r,s,a,o,c,l,h,f,d,u,g,_,p){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=h,t[10]=f,t[11]=d,t[12]=u,t[13]=g,t[14]=_,t[15]=p,t}function Sl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jv(t,e){if(t===e){var n=e[1],i=e[2],r=e[3],s=e[6],a=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=s,t[11]=e[14],t[12]=r,t[13]=a,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Qv(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=n*o-i*a,y=n*c-r*a,v=n*l-s*a,P=i*c-r*o,b=i*l-s*o,w=r*l-s*c,R=h*_-f*g,S=h*p-d*g,x=h*m-u*g,C=f*p-d*_,L=f*m-u*_,D=d*m-u*p,U=T*D-y*L+v*C+P*x-b*S+w*R;return U?(U=1/U,t[0]=(o*D-c*L+l*C)*U,t[1]=(r*L-i*D-s*C)*U,t[2]=(_*w-p*b+m*P)*U,t[3]=(d*b-f*w-u*P)*U,t[4]=(c*x-a*D-l*S)*U,t[5]=(n*D-r*x+s*S)*U,t[6]=(p*v-g*w-m*y)*U,t[7]=(h*w-d*v+u*y)*U,t[8]=(a*L-o*x+l*R)*U,t[9]=(i*x-n*L-s*R)*U,t[10]=(g*b-_*v+m*T)*U,t[11]=(f*v-h*b-u*T)*U,t[12]=(o*S-a*C-c*R)*U,t[13]=(n*C-i*S+r*R)*U,t[14]=(_*y-g*P-p*T)*U,t[15]=(h*P-f*y+d*T)*U,t):null}function ex(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],u=e[11],g=e[12],_=e[13],p=e[14],m=e[15],T=n*o-i*a,y=n*c-r*a,v=n*l-s*a,P=i*c-r*o,b=i*l-s*o,w=r*l-s*c,R=h*_-f*g,S=h*p-d*g,x=h*m-u*g,C=f*p-d*_,L=f*m-u*_,D=d*m-u*p;return t[0]=o*D-c*L+l*C,t[1]=r*L-i*D-s*C,t[2]=_*w-p*b+m*P,t[3]=d*b-f*w-u*P,t[4]=c*x-a*D-l*S,t[5]=n*D-r*x+s*S,t[6]=p*v-g*w-m*y,t[7]=h*w-d*v+u*y,t[8]=a*L-o*x+l*R,t[9]=i*x-n*L-s*R,t[10]=g*b-_*v+m*T,t[11]=f*v-h*b-u*T,t[12]=o*S-a*C-c*R,t[13]=n*C-i*S+r*R,t[14]=_*y-g*P-p*T,t[15]=h*P-f*y+d*T,t}function tx(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],c=t[7],l=t[8],h=t[9],f=t[10],d=t[11],u=t[12],g=t[13],_=t[14],p=t[15],m=e*a-n*s,T=e*o-i*s,y=n*o-i*a,v=l*g-h*u,P=l*_-f*u,b=h*_-f*g,w=e*b-n*P+i*v,R=s*b-a*P+o*v,S=l*y-h*T+f*m,x=u*y-g*T+_*m;return c*w-r*R+p*S-d*x}function El(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=e[8],d=e[9],u=e[10],g=e[11],_=e[12],p=e[13],m=e[14],T=e[15],y=n[0],v=n[1],P=n[2],b=n[3];return t[0]=y*i+v*o+P*f+b*_,t[1]=y*r+v*c+P*d+b*p,t[2]=y*s+v*l+P*u+b*m,t[3]=y*a+v*h+P*g+b*T,y=n[4],v=n[5],P=n[6],b=n[7],t[4]=y*i+v*o+P*f+b*_,t[5]=y*r+v*c+P*d+b*p,t[6]=y*s+v*l+P*u+b*m,t[7]=y*a+v*h+P*g+b*T,y=n[8],v=n[9],P=n[10],b=n[11],t[8]=y*i+v*o+P*f+b*_,t[9]=y*r+v*c+P*d+b*p,t[10]=y*s+v*l+P*u+b*m,t[11]=y*a+v*h+P*g+b*T,y=n[12],v=n[13],P=n[14],b=n[15],t[12]=y*i+v*o+P*f+b*_,t[13]=y*r+v*c+P*d+b*p,t[14]=y*s+v*l+P*u+b*m,t[15]=y*a+v*h+P*g+b*T,t}function nx(t,e,n){var i=n[0],r=n[1],s=n[2],a,o,c,l,h,f,d,u,g,_,p,m;return e===t?(t[12]=e[0]*i+e[4]*r+e[8]*s+e[12],t[13]=e[1]*i+e[5]*r+e[9]*s+e[13],t[14]=e[2]*i+e[6]*r+e[10]*s+e[14],t[15]=e[3]*i+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],c=e[2],l=e[3],h=e[4],f=e[5],d=e[6],u=e[7],g=e[8],_=e[9],p=e[10],m=e[11],t[0]=a,t[1]=o,t[2]=c,t[3]=l,t[4]=h,t[5]=f,t[6]=d,t[7]=u,t[8]=g,t[9]=_,t[10]=p,t[11]=m,t[12]=a*i+h*r+g*s+e[12],t[13]=o*i+f*r+_*s+e[13],t[14]=c*i+d*r+p*s+e[14],t[15]=l*i+u*r+m*s+e[15]),t}function ix(t,e,n){var i=n[0],r=n[1],s=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function rx(t,e,n,i){var r=i[0],s=i[1],a=i[2],o=Math.sqrt(r*r+s*s+a*a),c,l,h,f,d,u,g,_,p,m,T,y,v,P,b,w,R,S,x,C,L,D,U,X;return o<pe?null:(o=1/o,r*=o,s*=o,a*=o,c=Math.sin(n),l=Math.cos(n),h=1-l,f=e[0],d=e[1],u=e[2],g=e[3],_=e[4],p=e[5],m=e[6],T=e[7],y=e[8],v=e[9],P=e[10],b=e[11],w=r*r*h+l,R=s*r*h+a*c,S=a*r*h-s*c,x=r*s*h-a*c,C=s*s*h+l,L=a*s*h+r*c,D=r*a*h+s*c,U=s*a*h-r*c,X=a*a*h+l,t[0]=f*w+_*R+y*S,t[1]=d*w+p*R+v*S,t[2]=u*w+m*R+P*S,t[3]=g*w+T*R+b*S,t[4]=f*x+_*C+y*L,t[5]=d*x+p*C+v*L,t[6]=u*x+m*C+P*L,t[7]=g*x+T*C+b*L,t[8]=f*D+_*U+y*X,t[9]=d*D+p*U+v*X,t[10]=u*D+m*U+P*X,t[11]=g*D+T*U+b*X,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function sx(t,e,n){var i=Math.sin(n),r=Math.cos(n),s=e[4],a=e[5],o=e[6],c=e[7],l=e[8],h=e[9],f=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*r+l*i,t[5]=a*r+h*i,t[6]=o*r+f*i,t[7]=c*r+d*i,t[8]=l*r-s*i,t[9]=h*r-a*i,t[10]=f*r-o*i,t[11]=d*r-c*i,t}function ax(t,e,n){var i=Math.sin(n),r=Math.cos(n),s=e[0],a=e[1],o=e[2],c=e[3],l=e[8],h=e[9],f=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r-l*i,t[1]=a*r-h*i,t[2]=o*r-f*i,t[3]=c*r-d*i,t[8]=s*i+l*r,t[9]=a*i+h*r,t[10]=o*i+f*r,t[11]=c*i+d*r,t}function ox(t,e,n){var i=Math.sin(n),r=Math.cos(n),s=e[0],a=e[1],o=e[2],c=e[3],l=e[4],h=e[5],f=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*r+l*i,t[1]=a*r+h*i,t[2]=o*r+f*i,t[3]=c*r+d*i,t[4]=l*r-s*i,t[5]=h*r-a*i,t[6]=f*r-o*i,t[7]=d*r-c*i,t}function cx(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function lx(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function hx(t,e,n){var i=n[0],r=n[1],s=n[2],a=Math.sqrt(i*i+r*r+s*s),o,c,l;return a<pe?null:(a=1/a,i*=a,r*=a,s*=a,o=Math.sin(e),c=Math.cos(e),l=1-c,t[0]=i*i*l+c,t[1]=r*i*l+s*o,t[2]=s*i*l-r*o,t[3]=0,t[4]=i*r*l-s*o,t[5]=r*r*l+c,t[6]=s*r*l+i*o,t[7]=0,t[8]=i*s*l+r*o,t[9]=r*s*l-i*o,t[10]=s*s*l+c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function fx(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function dx(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ux(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Tl(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=i+i,c=r+r,l=s+s,h=i*o,f=i*c,d=i*l,u=r*c,g=r*l,_=s*l,p=a*o,m=a*c,T=a*l;return t[0]=1-(u+_),t[1]=f+T,t[2]=d-m,t[3]=0,t[4]=f-T,t[5]=1-(h+_),t[6]=g+p,t[7]=0,t[8]=d+m,t[9]=g-p,t[10]=1-(h+u),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function px(t,e){var n=new Ne(3),i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=i*i+r*r+s*s+a*a;return f>0?(n[0]=(o*a+h*i+c*s-l*r)*2/f,n[1]=(c*a+h*r+l*i-o*s)*2/f,n[2]=(l*a+h*s+o*r-c*i)*2/f):(n[0]=(o*a+h*i+c*s-l*r)*2,n[1]=(c*a+h*r+l*i-o*s)*2,n[2]=(l*a+h*s+o*r-c*i)*2),Tl(t,e,n),t}function bl(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Al(t,e){var n=e[0],i=e[1],r=e[2],s=e[4],a=e[5],o=e[6],c=e[8],l=e[9],h=e[10];return t[0]=Math.sqrt(n*n+i*i+r*r),t[1]=Math.sqrt(s*s+a*a+o*o),t[2]=Math.sqrt(c*c+l*l+h*h),t}function wl(t,e){var n=new Ne(3);Al(n,e);var i=1/n[0],r=1/n[1],s=1/n[2],a=e[0]*i,o=e[1]*r,c=e[2]*s,l=e[4]*i,h=e[5]*r,f=e[6]*s,d=e[8]*i,u=e[9]*r,g=e[10]*s,_=a+h+g,p=0;return _>0?(p=Math.sqrt(_+1)*2,t[3]=.25*p,t[0]=(f-u)/p,t[1]=(d-c)/p,t[2]=(o-l)/p):a>h&&a>g?(p=Math.sqrt(1+a-h-g)*2,t[3]=(f-u)/p,t[0]=.25*p,t[1]=(o+l)/p,t[2]=(d+c)/p):h>g?(p=Math.sqrt(1+h-a-g)*2,t[3]=(d-c)/p,t[0]=(o+l)/p,t[1]=.25*p,t[2]=(f+u)/p):(p=Math.sqrt(1+g-a-h)*2,t[3]=(o-l)/p,t[0]=(d+c)/p,t[1]=(f+u)/p,t[2]=.25*p),t}function mx(t,e,n,i){e[0]=i[12],e[1]=i[13],e[2]=i[14];var r=i[0],s=i[1],a=i[2],o=i[4],c=i[5],l=i[6],h=i[8],f=i[9],d=i[10];n[0]=Math.sqrt(r*r+s*s+a*a),n[1]=Math.sqrt(o*o+c*c+l*l),n[2]=Math.sqrt(h*h+f*f+d*d);var u=1/n[0],g=1/n[1],_=1/n[2],p=r*u,m=s*g,T=a*_,y=o*u,v=c*g,P=l*_,b=h*u,w=f*g,R=d*_,S=p+v+R,x=0;return S>0?(x=Math.sqrt(S+1)*2,t[3]=.25*x,t[0]=(P-w)/x,t[1]=(b-T)/x,t[2]=(m-y)/x):p>v&&p>R?(x=Math.sqrt(1+p-v-R)*2,t[3]=(P-w)/x,t[0]=.25*x,t[1]=(m+y)/x,t[2]=(b+T)/x):v>R?(x=Math.sqrt(1+v-p-R)*2,t[3]=(b-T)/x,t[0]=(m+y)/x,t[1]=.25*x,t[2]=(P+w)/x):(x=Math.sqrt(1+R-p-v)*2,t[3]=(m-y)/x,t[0]=(b+T)/x,t[1]=(P+w)/x,t[2]=.25*x),t}function gx(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=e[3],c=r+r,l=s+s,h=a+a,f=r*c,d=r*l,u=r*h,g=s*l,_=s*h,p=a*h,m=o*c,T=o*l,y=o*h,v=i[0],P=i[1],b=i[2];return t[0]=(1-(g+p))*v,t[1]=(d+y)*v,t[2]=(u-T)*v,t[3]=0,t[4]=(d-y)*P,t[5]=(1-(f+p))*P,t[6]=(_+m)*P,t[7]=0,t[8]=(u+T)*b,t[9]=(_-m)*b,t[10]=(1-(f+g))*b,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function _x(t,e,n,i,r){var s=e[0],a=e[1],o=e[2],c=e[3],l=s+s,h=a+a,f=o+o,d=s*l,u=s*h,g=s*f,_=a*h,p=a*f,m=o*f,T=c*l,y=c*h,v=c*f,P=i[0],b=i[1],w=i[2],R=r[0],S=r[1],x=r[2],C=(1-(_+m))*P,L=(u+v)*P,D=(g-y)*P,U=(u-v)*b,X=(1-(d+m))*b,V=(p+T)*b,K=(g+y)*w,G=(p-T)*w,te=(1-(d+_))*w;return t[0]=C,t[1]=L,t[2]=D,t[3]=0,t[4]=U,t[5]=X,t[6]=V,t[7]=0,t[8]=K,t[9]=G,t[10]=te,t[11]=0,t[12]=n[0]+R-(C*R+U*S+K*x),t[13]=n[1]+S-(L*R+X*S+G*x),t[14]=n[2]+x-(D*R+V*S+te*x),t[15]=1,t}function vx(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n+n,o=i+i,c=r+r,l=n*a,h=i*a,f=i*o,d=r*a,u=r*o,g=r*c,_=s*a,p=s*o,m=s*c;return t[0]=1-f-g,t[1]=h+m,t[2]=d-p,t[3]=0,t[4]=h-m,t[5]=1-l-g,t[6]=u+_,t[7]=0,t[8]=d+p,t[9]=u-_,t[10]=1-l-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function xx(t,e,n,i,r,s,a){var o=1/(n-e),c=1/(r-i),l=1/(s-a);return t[0]=s*2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s*2*c,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(r+i)*c,t[10]=(a+s)*l,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*s*2*l,t[15]=0,t}function Rl(t,e,n,i,r){var s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,r!=null&&r!==1/0){var a=1/(i-r);t[10]=(r+i)*a,t[14]=2*r*i*a}else t[10]=-1,t[14]=-2*i;return t}var Mx=Rl;function yx(t,e,n,i,r){var s=1/Math.tan(e/2);if(t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,r!=null&&r!==1/0){var a=1/(i-r);t[10]=r*a,t[14]=r*i*a}else t[10]=-1,t[14]=-i;return t}function Sx(t,e,n,i){var r=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),c=2/(a+o),l=2/(r+s);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=l,t[6]=0,t[7]=0,t[8]=-((a-o)*c*.5),t[9]=(r-s)*l*.5,t[10]=i/(n-i),t[11]=-1,t[12]=0,t[13]=0,t[14]=i*n/(n-i),t[15]=0,t}function Cl(t,e,n,i,r,s,a){var o=1/(e-n),c=1/(i-r),l=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+n)*o,t[13]=(r+i)*c,t[14]=(a+s)*l,t[15]=1,t}var Ex=Cl;function Tx(t,e,n,i,r,s,a){var o=1/(e-n),c=1/(i-r),l=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=l,t[11]=0,t[12]=(e+n)*o,t[13]=(r+i)*c,t[14]=s*l,t[15]=1,t}function bx(t,e,n,i){var r,s,a,o,c,l,h,f,d,u,g=e[0],_=e[1],p=e[2],m=i[0],T=i[1],y=i[2],v=n[0],P=n[1],b=n[2];return Math.abs(g-v)<pe&&Math.abs(_-P)<pe&&Math.abs(p-b)<pe?Sl(t):(h=g-v,f=_-P,d=p-b,u=1/Math.sqrt(h*h+f*f+d*d),h*=u,f*=u,d*=u,r=T*d-y*f,s=y*h-m*d,a=m*f-T*h,u=Math.sqrt(r*r+s*s+a*a),u?(u=1/u,r*=u,s*=u,a*=u):(r=0,s=0,a=0),o=f*a-d*s,c=d*r-h*a,l=h*s-f*r,u=Math.sqrt(o*o+c*c+l*l),u?(u=1/u,o*=u,c*=u,l*=u):(o=0,c=0,l=0),t[0]=r,t[1]=o,t[2]=h,t[3]=0,t[4]=s,t[5]=c,t[6]=f,t[7]=0,t[8]=a,t[9]=l,t[10]=d,t[11]=0,t[12]=-(r*g+s*_+a*p),t[13]=-(o*g+c*_+l*p),t[14]=-(h*g+f*_+d*p),t[15]=1,t)}function Ax(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=i[0],c=i[1],l=i[2],h=r-n[0],f=s-n[1],d=a-n[2],u=h*h+f*f+d*d;u>0&&(u=1/Math.sqrt(u),h*=u,f*=u,d*=u);var g=c*d-l*f,_=l*h-o*d,p=o*f-c*h;return u=g*g+_*_+p*p,u>0&&(u=1/Math.sqrt(u),g*=u,_*=u,p*=u),t[0]=g,t[1]=_,t[2]=p,t[3]=0,t[4]=f*p-d*_,t[5]=d*g-h*p,t[6]=h*_-f*g,t[7]=0,t[8]=h,t[9]=f,t[10]=d,t[11]=0,t[12]=r,t[13]=s,t[14]=a,t[15]=1,t}function wx(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function Rx(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function Cx(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t}function Pl(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function Px(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t}function Dx(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t[4]=e[4]+n[4]*i,t[5]=e[5]+n[5]*i,t[6]=e[6]+n[6]*i,t[7]=e[7]+n[7]*i,t[8]=e[8]+n[8]*i,t[9]=e[9]+n[9]*i,t[10]=e[10]+n[10]*i,t[11]=e[11]+n[11]*i,t[12]=e[12]+n[12]*i,t[13]=e[13]+n[13]*i,t[14]=e[14]+n[14]*i,t[15]=e[15]+n[15]*i,t}function Lx(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function Ix(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=t[8],f=t[9],d=t[10],u=t[11],g=t[12],_=t[13],p=t[14],m=t[15],T=e[0],y=e[1],v=e[2],P=e[3],b=e[4],w=e[5],R=e[6],S=e[7],x=e[8],C=e[9],L=e[10],D=e[11],U=e[12],X=e[13],V=e[14],K=e[15];return Math.abs(n-T)<=pe*Math.max(1,Math.abs(n),Math.abs(T))&&Math.abs(i-y)<=pe*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-v)<=pe*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(s-P)<=pe*Math.max(1,Math.abs(s),Math.abs(P))&&Math.abs(a-b)<=pe*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(o-w)<=pe*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(c-R)<=pe*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(l-S)<=pe*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(h-x)<=pe*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(f-C)<=pe*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(d-L)<=pe*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(u-D)<=pe*Math.max(1,Math.abs(u),Math.abs(D))&&Math.abs(g-U)<=pe*Math.max(1,Math.abs(g),Math.abs(U))&&Math.abs(_-X)<=pe*Math.max(1,Math.abs(_),Math.abs(X))&&Math.abs(p-V)<=pe*Math.max(1,Math.abs(p),Math.abs(V))&&Math.abs(m-K)<=pe*Math.max(1,Math.abs(m),Math.abs(K))}var Ux=El,Nx=Pl;const Fx=Object.freeze(Object.defineProperty({__proto__:null,add:Cx,adjoint:ex,clone:Yv,copy:jv,create:$v,decompose:mx,determinant:tx,equals:Ix,exactEquals:Lx,frob:Rx,fromQuat:vx,fromQuat2:px,fromRotation:hx,fromRotationTranslation:Tl,fromRotationTranslationScale:gx,fromRotationTranslationScaleOrigin:_x,fromScaling:lx,fromTranslation:cx,fromValues:Zv,fromXRotation:fx,fromYRotation:dx,fromZRotation:ux,frustum:xx,getRotation:wl,getScaling:Al,getTranslation:bl,identity:Sl,invert:Qv,lookAt:bx,mul:Ux,multiply:El,multiplyScalar:Px,multiplyScalarAndAdd:Dx,ortho:Ex,orthoNO:Cl,orthoZO:Tx,perspective:Mx,perspectiveFromFieldOfView:Sx,perspectiveNO:Rl,perspectiveZO:yx,rotate:rx,rotateX:sx,rotateY:ax,rotateZ:ox,scale:ix,set:Kv,str:wx,sub:Nx,subtract:Pl,targetTo:Ax,translate:nx,transpose:Jv},Symbol.toStringTag,{value:"Module"}));function Fa(){var t=new Ne(3);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Ox(t){var e=new Ne(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Dl(t){var e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)}function xa(t,e,n){var i=new Ne(3);return i[0]=t,i[1]=e,i[2]=n,i}function zx(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Bx(t,e,n,i){return t[0]=e,t[1]=n,t[2]=i,t}function Hx(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function Ll(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function Il(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function Ul(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function kx(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function Vx(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function Gx(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function Wx(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function Xx(t,e){return t[0]=tn(e[0]),t[1]=tn(e[1]),t[2]=tn(e[2]),t}function qx(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function $x(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t}function Nl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return Math.sqrt(n*n+i*i+r*r)}function Fl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2];return n*n+i*i+r*r}function Ol(t){var e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i}function Yx(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function jx(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function zl(t,e){var n=e[0],i=e[1],r=e[2],s=n*n+i*i+r*r;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function $r(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ir(t,e,n){var i=e[0],r=e[1],s=e[2],a=n[0],o=n[1],c=n[2];return t[0]=r*c-s*o,t[1]=s*a-i*c,t[2]=i*o-r*a,t}function Zx(t,e,n,i){var r=e[0],s=e[1],a=e[2];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=a+i*(n[2]-a),t}function Kx(t,e,n,i){var r=Math.acos(Math.min(Math.max($r(e,n),-1),1)),s=Math.sin(r),a=Math.sin((1-i)*r)/s,o=Math.sin(i*r)/s;return t[0]=a*e[0]+o*n[0],t[1]=a*e[1]+o*n[1],t[2]=a*e[2]+o*n[2],t}function Jx(t,e,n,i,r,s){var a=s*s,o=a*(2*s-3)+1,c=a*(s-2)+s,l=a*(s-1),h=a*(3-2*s);return t[0]=e[0]*o+n[0]*c+i[0]*l+r[0]*h,t[1]=e[1]*o+n[1]*c+i[1]*l+r[1]*h,t[2]=e[2]*o+n[2]*c+i[2]*l+r[2]*h,t}function Qx(t,e,n,i,r,s){var a=1-s,o=a*a,c=s*s,l=o*a,h=3*s*o,f=3*c*a,d=c*s;return t[0]=e[0]*l+n[0]*h+i[0]*f+r[0]*d,t[1]=e[1]*l+n[1]*h+i[1]*f+r[1]*d,t[2]=e[2]*l+n[2]*h+i[2]*f+r[2]*d,t}function e1(t,e){e=e===void 0?1:e;var n=$t()*2*Math.PI,i=$t()*2-1,r=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(n)*r,t[1]=Math.sin(n)*r,t[2]=i*e,t}function t1(t,e,n){var i=e[0],r=e[1],s=e[2],a=n[3]*i+n[7]*r+n[11]*s+n[15];return a=a||1,t[0]=(n[0]*i+n[4]*r+n[8]*s+n[12])/a,t[1]=(n[1]*i+n[5]*r+n[9]*s+n[13])/a,t[2]=(n[2]*i+n[6]*r+n[10]*s+n[14])/a,t}function n1(t,e,n){var i=e[0],r=e[1],s=e[2];return t[0]=i*n[0]+r*n[3]+s*n[6],t[1]=i*n[1]+r*n[4]+s*n[7],t[2]=i*n[2]+r*n[5]+s*n[8],t}function i1(t,e,n){var i=n[0],r=n[1],s=n[2],a=n[3],o=e[0],c=e[1],l=e[2],h=r*l-s*c,f=s*o-i*l,d=i*c-r*o;return h=h+h,f=f+f,d=d+d,t[0]=o+a*h+r*d-s*f,t[1]=c+a*f+s*h-i*d,t[2]=l+a*d+i*f-r*h,t}function r1(t,e,n,i){var r=[],s=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[0],s[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),s[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t}function s1(t,e,n,i){var r=[],s=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),s[1]=r[1],s[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t}function a1(t,e,n,i){var r=[],s=[];return r[0]=e[0]-n[0],r[1]=e[1]-n[1],r[2]=e[2]-n[2],s[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),s[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),s[2]=r[2],t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t}function o1(t,e){var n=t[0],i=t[1],r=t[2],s=e[0],a=e[1],o=e[2],c=Math.sqrt((n*n+i*i+r*r)*(s*s+a*a+o*o)),l=c&&$r(t,e)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function c1(t){return t[0]=0,t[1]=0,t[2]=0,t}function l1(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function h1(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function f1(t,e){var n=t[0],i=t[1],r=t[2],s=e[0],a=e[1],o=e[2];return Math.abs(n-s)<=pe*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-a)<=pe*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=pe*Math.max(1,Math.abs(r),Math.abs(o))}var d1=Ll,u1=Il,p1=Ul,m1=Nl,g1=Fl,Bl=Dl,_1=Ol,v1=(function(){var t=Fa();return function(e,n,i,r,s,a){var o,c;for(n||(n=3),i||(i=0),r?c=Math.min(r*n+i,e.length):c=e.length,o=i;o<c;o+=n)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],s(t,t,a),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2];return e}})();const x1=Object.freeze(Object.defineProperty({__proto__:null,add:Hx,angle:o1,bezier:Qx,ceil:kx,clone:Ox,copy:zx,create:Fa,cross:Ir,dist:m1,distance:Nl,div:p1,divide:Ul,dot:$r,equals:f1,exactEquals:h1,floor:Vx,forEach:v1,fromValues:xa,hermite:Jx,inverse:jx,len:Bl,length:Dl,lerp:Zx,max:Wx,min:Gx,mul:u1,multiply:Il,negate:Yx,normalize:zl,random:e1,rotateX:r1,rotateY:s1,rotateZ:a1,round:Xx,scale:qx,scaleAndAdd:$x,set:Bx,slerp:Kx,sqrDist:g1,sqrLen:_1,squaredDistance:Fl,squaredLength:Ol,str:l1,sub:d1,subtract:Ll,transformMat3:n1,transformMat4:t1,transformQuat:i1,zero:c1},Symbol.toStringTag,{value:"Module"}));function Hl(){var t=new Ne(4);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function kl(t){var e=new Ne(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Vl(t,e,n,i){var r=new Ne(4);return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function Gl(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Wl(t,e,n,i,r){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t}function Xl(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t}function ql(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function $l(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function Yl(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function M1(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function y1(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function S1(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t}function E1(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t}function T1(t,e){return t[0]=tn(e[0]),t[1]=tn(e[1]),t[2]=tn(e[2]),t[3]=tn(e[3]),t}function jl(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t}function b1(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t[2]=e[2]+n[2]*i,t[3]=e[3]+n[3]*i,t}function Zl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],s=e[3]-t[3];return Math.sqrt(n*n+i*i+r*r+s*s)}function Kl(t,e){var n=e[0]-t[0],i=e[1]-t[1],r=e[2]-t[2],s=e[3]-t[3];return n*n+i*i+r*r+s*s}function Oa(t){var e=t[0],n=t[1],i=t[2],r=t[3];return Math.sqrt(e*e+n*n+i*i+r*r)}function za(t){var e=t[0],n=t[1],i=t[2],r=t[3];return e*e+n*n+i*i+r*r}function A1(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function w1(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function Jl(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n*n+i*i+r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=i*a,t[2]=r*a,t[3]=s*a,t}function Ba(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function R1(t,e,n,i){var r=n[0]*i[1]-n[1]*i[0],s=n[0]*i[2]-n[2]*i[0],a=n[0]*i[3]-n[3]*i[0],o=n[1]*i[2]-n[2]*i[1],c=n[1]*i[3]-n[3]*i[1],l=n[2]*i[3]-n[3]*i[2],h=e[0],f=e[1],d=e[2],u=e[3];return t[0]=f*l-d*c+u*o,t[1]=-(h*l)+d*a-u*s,t[2]=h*c-f*a+u*r,t[3]=-(h*o)+f*s-d*r,t}function Ql(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=e[3];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t[2]=a+i*(n[2]-a),t[3]=o+i*(n[3]-o),t}function C1(t,e){e=e===void 0?1:e;var n,i,r,s,a,o,c;c=$t(),n=c*2-1,i=(4*$t()-2)*Math.sqrt(c*-c+c),a=n*n+i*i,c=$t(),r=c*2-1,s=(4*$t()-2)*Math.sqrt(c*-c+c),o=r*r+s*s;var l=Math.sqrt((1-a)/o);return t[0]=e*n,t[1]=e*i,t[2]=e*r*l,t[3]=e*s*l,t}function P1(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*s+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*s+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*s+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*s+n[15]*a,t}function D1(t,e,n){var i=n[0],r=n[1],s=n[2],a=n[3],o=e[0],c=e[1],l=e[2],h=r*l-s*c,f=s*o-i*l,d=i*c-r*o;return h=h+h,f=f+f,d=d+d,t[0]=o+a*h+r*d-s*f,t[1]=c+a*f+s*h-i*d,t[2]=l+a*d+i*f-r*h,t[3]=e[3],t}function L1(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function I1(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function eh(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function U1(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=e[0],o=e[1],c=e[2],l=e[3];return Math.abs(n-a)<=pe*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=pe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-c)<=pe*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-l)<=pe*Math.max(1,Math.abs(s),Math.abs(l))}var N1=ql,F1=$l,O1=Yl,z1=Zl,B1=Kl,H1=Oa,k1=za,V1=(function(){var t=Hl();return function(e,n,i,r,s,a){var o,c;for(n||(n=4),i||(i=0),r?c=Math.min(r*n+i,e.length):c=e.length,o=i;o<c;o+=n)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],t[3]=e[o+3],s(t,t,a),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2],e[o+3]=t[3];return e}})();const G1=Object.freeze(Object.defineProperty({__proto__:null,add:Xl,ceil:M1,clone:kl,copy:Gl,create:Hl,cross:R1,dist:z1,distance:Zl,div:O1,divide:Yl,dot:Ba,equals:U1,exactEquals:eh,floor:y1,forEach:V1,fromValues:Vl,inverse:w1,len:H1,length:Oa,lerp:Ql,max:E1,min:S1,mul:F1,multiply:$l,negate:A1,normalize:Jl,random:C1,round:T1,scale:jl,scaleAndAdd:b1,set:Wl,sqrDist:B1,sqrLen:k1,squaredDistance:Kl,squaredLength:za,str:I1,sub:N1,subtract:ql,transformMat4:P1,transformQuat:D1,zero:L1},Symbol.toStringTag,{value:"Module"}));function Br(){var t=new Ne(4);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function W1(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function th(t,e,n){n=n*.5;var i=Math.sin(n);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n),t}function X1(t,e){var n=Math.acos(e[3])*2,i=Math.sin(n/2);return i>pe?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n}function q1(t,e){var n=ka(t,e);return Math.acos(2*n*n-1)}function nh(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1],l=n[2],h=n[3];return t[0]=i*h+a*o+r*l-s*c,t[1]=r*h+a*c+s*o-i*l,t[2]=s*h+a*l+i*c-r*o,t[3]=a*h-i*o-r*c-s*l,t}function ih(t,e,n){n*=.5;var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c+a*o,t[1]=r*c+s*o,t[2]=s*c-r*o,t[3]=a*c-i*o,t}function rh(t,e,n){n*=.5;var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c-s*o,t[1]=r*c+a*o,t[2]=s*c+i*o,t[3]=a*c-r*o,t}function sh(t,e,n){n*=.5;var i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(n),c=Math.cos(n);return t[0]=i*c+r*o,t[1]=r*c-i*o,t[2]=s*c+a*o,t[3]=a*c-s*o,t}function $1(t,e){var n=e[0],i=e[1],r=e[2];return t[0]=n,t[1]=i,t[2]=r,t[3]=Math.sqrt(Math.abs(1-n*n-i*i-r*r)),t}function ah(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=Math.sqrt(n*n+i*i+r*r),o=Math.exp(s),c=a>0?o*Math.sin(a)/a:0;return t[0]=n*c,t[1]=i*c,t[2]=r*c,t[3]=o*Math.cos(a),t}function oh(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=Math.sqrt(n*n+i*i+r*r),o=a>0?Math.atan2(a,s)/a:0;return t[0]=n*o,t[1]=i*o,t[2]=r*o,t[3]=.5*Math.log(n*n+i*i+r*r+s*s),t}function Y1(t,e,n){return oh(t,e),lh(t,t,n),ah(t,t),t}function Ur(t,e,n,i){var r=e[0],s=e[1],a=e[2],o=e[3],c=n[0],l=n[1],h=n[2],f=n[3],d,u,g,_,p;return u=r*c+s*l+a*h+o*f,u<0&&(u=-u,c=-c,l=-l,h=-h,f=-f),1-u>pe?(d=Math.acos(u),g=Math.sin(d),_=Math.sin((1-i)*d)/g,p=Math.sin(i*d)/g):(_=1-i,p=i),t[0]=_*r+p*c,t[1]=_*s+p*l,t[2]=_*a+p*h,t[3]=_*o+p*f,t}function j1(t){var e=$t(),n=$t(),i=$t(),r=Math.sqrt(1-e),s=Math.sqrt(e);return t[0]=r*Math.sin(2*Math.PI*n),t[1]=r*Math.cos(2*Math.PI*n),t[2]=s*Math.sin(2*Math.PI*i),t[3]=s*Math.cos(2*Math.PI*i),t}function Z1(t,e){var n=e[0],i=e[1],r=e[2],s=e[3],a=n*n+i*i+r*r+s*s,o=a?1/a:0;return t[0]=-n*o,t[1]=-i*o,t[2]=-r*o,t[3]=s*o,t}function K1(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function ch(t,e){var n=e[0]+e[4]+e[8],i;if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);var s=(r+1)%3,a=(r+2)%3;i=Math.sqrt(e[r*3+r]-e[s*3+s]-e[a*3+a]+1),t[r]=.5*i,i=.5/i,t[3]=(e[s*3+a]-e[a*3+s])*i,t[s]=(e[s*3+r]+e[r*3+s])*i,t[a]=(e[a*3+r]+e[r*3+a])*i}return t}function J1(t,e,n,i){var r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:pl,s=Math.PI/360;e*=s,i*=s,n*=s;var a=Math.sin(e),o=Math.cos(e),c=Math.sin(n),l=Math.cos(n),h=Math.sin(i),f=Math.cos(i);switch(r){case"xyz":t[0]=a*l*f+o*c*h,t[1]=o*c*f-a*l*h,t[2]=o*l*h+a*c*f,t[3]=o*l*f-a*c*h;break;case"xzy":t[0]=a*l*f-o*c*h,t[1]=o*c*f-a*l*h,t[2]=o*l*h+a*c*f,t[3]=o*l*f+a*c*h;break;case"yxz":t[0]=a*l*f+o*c*h,t[1]=o*c*f-a*l*h,t[2]=o*l*h-a*c*f,t[3]=o*l*f+a*c*h;break;case"yzx":t[0]=a*l*f+o*c*h,t[1]=o*c*f+a*l*h,t[2]=o*l*h-a*c*f,t[3]=o*l*f-a*c*h;break;case"zxy":t[0]=a*l*f-o*c*h,t[1]=o*c*f+a*l*h,t[2]=o*l*h+a*c*f,t[3]=o*l*f-a*c*h;break;case"zyx":t[0]=a*l*f-o*c*h,t[1]=o*c*f+a*l*h,t[2]=o*l*h-a*c*f,t[3]=o*l*f+a*c*h;break;default:throw new Error("Unknown angle order "+r)}return t}function Q1(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var eM=kl,tM=Vl,Ha=Gl,nM=Wl,iM=Xl,rM=nh,lh=jl,ka=Ba,sM=Ql,Va=Oa,aM=Va,Ga=za,oM=Ga,Wa=Jl,cM=eh;function lM(t,e){return Math.abs(Ba(t,e))>=1-pe}var hM=(function(){var t=Fa(),e=xa(1,0,0),n=xa(0,1,0);return function(i,r,s){var a=$r(r,s);return a<-.999999?(Ir(t,e,r),Bl(t)<1e-6&&Ir(t,n,r),zl(t,t),th(i,t,Math.PI),i):a>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Ir(t,r,s),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+a,Wa(i,i))}})(),fM=(function(){var t=Br(),e=Br();return function(n,i,r,s,a,o){return Ur(t,i,a,o),Ur(e,r,s,o),Ur(n,t,e,2*o*(1-o)),n}})(),dM=(function(){var t=xl();return function(e,n,i,r){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=r[0],t[4]=r[1],t[7]=r[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],Wa(e,ch(e,t))}})();const uM=Object.freeze(Object.defineProperty({__proto__:null,add:iM,calculateW:$1,clone:eM,conjugate:K1,copy:Ha,create:Br,dot:ka,equals:lM,exactEquals:cM,exp:ah,fromEuler:J1,fromMat3:ch,fromValues:tM,getAngle:q1,getAxisAngle:X1,identity:W1,invert:Z1,len:aM,length:Va,lerp:sM,ln:oh,mul:rM,multiply:nh,normalize:Wa,pow:Y1,random:j1,rotateX:ih,rotateY:rh,rotateZ:sh,rotationTo:hM,scale:lh,set:nM,setAxes:dM,setAxisAngle:th,slerp:Ur,sqlerp:fM,sqrLen:oM,squaredLength:Ga,str:Q1},Symbol.toStringTag,{value:"Module"}));function pM(){var t=new Ne(8);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function mM(t){var e=new Ne(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function gM(t,e,n,i,r,s,a,o){var c=new Ne(8);return c[0]=t,c[1]=e,c[2]=n,c[3]=i,c[4]=r,c[5]=s,c[6]=a,c[7]=o,c}function _M(t,e,n,i,r,s,a){var o=new Ne(8);o[0]=t,o[1]=e,o[2]=n,o[3]=i;var c=r*.5,l=s*.5,h=a*.5;return o[4]=c*i+l*n-h*e,o[5]=l*i+h*t-c*n,o[6]=h*i+c*e-l*t,o[7]=-c*t-l*e-h*n,o}function hh(t,e,n){var i=n[0]*.5,r=n[1]*.5,s=n[2]*.5,a=e[0],o=e[1],c=e[2],l=e[3];return t[0]=a,t[1]=o,t[2]=c,t[3]=l,t[4]=i*l+r*c-s*o,t[5]=r*l+s*a-i*c,t[6]=s*l+i*o-r*a,t[7]=-i*a-r*o-s*c,t}function vM(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0]*.5,t[5]=e[1]*.5,t[6]=e[2]*.5,t[7]=0,t}function xM(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function MM(t,e){var n=Br();wl(n,e);var i=new Ne(3);return bl(i,e),hh(t,n,i),t}function fh(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function yM(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function SM(t,e,n,i,r,s,a,o,c){return t[0]=e,t[1]=n,t[2]=i,t[3]=r,t[4]=s,t[5]=a,t[6]=o,t[7]=c,t}var EM=Ha;function TM(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var bM=Ha;function AM(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function wM(t,e){var n=e[4],i=e[5],r=e[6],s=e[7],a=-e[0],o=-e[1],c=-e[2],l=e[3];return t[0]=(n*l+s*a+i*c-r*o)*2,t[1]=(i*l+s*o+r*a-n*c)*2,t[2]=(r*l+s*c+n*o-i*a)*2,t}function RM(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0]*.5,c=n[1]*.5,l=n[2]*.5,h=e[4],f=e[5],d=e[6],u=e[7];return t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=a*o+r*l-s*c+h,t[5]=a*c+s*o-i*l+f,t[6]=a*l+i*c-r*o+d,t[7]=-i*o-r*c-s*l+u,t}function CM(t,e,n){var i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=o*a+h*i+c*s-l*r,d=c*a+h*r+l*i-o*s,u=l*a+h*s+o*r-c*i,g=h*a-o*i-c*r-l*s;return ih(t,e,n),i=t[0],r=t[1],s=t[2],a=t[3],t[4]=f*a+g*i+d*s-u*r,t[5]=d*a+g*r+u*i-f*s,t[6]=u*a+g*s+f*r-d*i,t[7]=g*a-f*i-d*r-u*s,t}function PM(t,e,n){var i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=o*a+h*i+c*s-l*r,d=c*a+h*r+l*i-o*s,u=l*a+h*s+o*r-c*i,g=h*a-o*i-c*r-l*s;return rh(t,e,n),i=t[0],r=t[1],s=t[2],a=t[3],t[4]=f*a+g*i+d*s-u*r,t[5]=d*a+g*r+u*i-f*s,t[6]=u*a+g*s+f*r-d*i,t[7]=g*a-f*i-d*r-u*s,t}function DM(t,e,n){var i=-e[0],r=-e[1],s=-e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7],f=o*a+h*i+c*s-l*r,d=c*a+h*r+l*i-o*s,u=l*a+h*s+o*r-c*i,g=h*a-o*i-c*r-l*s;return sh(t,e,n),i=t[0],r=t[1],s=t[2],a=t[3],t[4]=f*a+g*i+d*s-u*r,t[5]=d*a+g*r+u*i-f*s,t[6]=u*a+g*s+f*r-d*i,t[7]=g*a-f*i-d*r-u*s,t}function LM(t,e,n){var i=n[0],r=n[1],s=n[2],a=n[3],o=e[0],c=e[1],l=e[2],h=e[3];return t[0]=o*a+h*i+c*s-l*r,t[1]=c*a+h*r+l*i-o*s,t[2]=l*a+h*s+o*r-c*i,t[3]=h*a-o*i-c*r-l*s,o=e[4],c=e[5],l=e[6],h=e[7],t[4]=o*a+h*i+c*s-l*r,t[5]=c*a+h*r+l*i-o*s,t[6]=l*a+h*s+o*r-c*i,t[7]=h*a-o*i-c*r-l*s,t}function IM(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[0],c=n[1],l=n[2],h=n[3];return t[0]=i*h+a*o+r*l-s*c,t[1]=r*h+a*c+s*o-i*l,t[2]=s*h+a*l+i*c-r*o,t[3]=a*h-i*o-r*c-s*l,o=n[4],c=n[5],l=n[6],h=n[7],t[4]=i*h+a*o+r*l-s*c,t[5]=r*h+a*c+s*o-i*l,t[6]=s*h+a*l+i*c-r*o,t[7]=a*h-i*o-r*c-s*l,t}function UM(t,e,n,i){if(Math.abs(i)<pe)return fh(t,e);var r=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);i=i*.5;var s=Math.sin(i),a=s*n[0]/r,o=s*n[1]/r,c=s*n[2]/r,l=Math.cos(i),h=e[0],f=e[1],d=e[2],u=e[3];t[0]=h*l+u*a+f*c-d*o,t[1]=f*l+u*o+d*a-h*c,t[2]=d*l+u*c+h*o-f*a,t[3]=u*l-h*a-f*o-d*c;var g=e[4],_=e[5],p=e[6],m=e[7];return t[4]=g*l+m*a+_*c-p*o,t[5]=_*l+m*o+p*a-g*c,t[6]=p*l+m*c+g*o-_*a,t[7]=m*l-g*a-_*o-p*c,t}function NM(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t}function dh(t,e,n){var i=e[0],r=e[1],s=e[2],a=e[3],o=n[4],c=n[5],l=n[6],h=n[7],f=e[4],d=e[5],u=e[6],g=e[7],_=n[0],p=n[1],m=n[2],T=n[3];return t[0]=i*T+a*_+r*m-s*p,t[1]=r*T+a*p+s*_-i*m,t[2]=s*T+a*m+i*p-r*_,t[3]=a*T-i*_-r*p-s*m,t[4]=i*h+a*o+r*l-s*c+f*T+g*_+d*m-u*p,t[5]=r*h+a*c+s*o-i*l+d*T+g*p+u*_-f*m,t[6]=s*h+a*l+i*c-r*o+u*T+g*m+f*p-d*_,t[7]=a*h-i*o-r*c-s*l+g*T-f*_-d*p-u*m,t}var FM=dh;function OM(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t}var uh=ka;function zM(t,e,n,i){var r=1-i;return uh(e,n)<0&&(i=-i),t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i,t[3]=e[3]*r+n[3]*i,t[4]=e[4]*r+n[4]*i,t[5]=e[5]*r+n[5]*i,t[6]=e[6]*r+n[6]*i,t[7]=e[7]*r+n[7]*i,t}function BM(t,e){var n=Yr(e);return t[0]=-e[0]/n,t[1]=-e[1]/n,t[2]=-e[2]/n,t[3]=e[3]/n,t[4]=-e[4]/n,t[5]=-e[5]/n,t[6]=-e[6]/n,t[7]=e[7]/n,t}function HM(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t}var ph=Va,kM=ph,Yr=Ga,VM=Yr;function GM(t,e){var n=Yr(e);if(n>0){n=Math.sqrt(n);var i=e[0]/n,r=e[1]/n,s=e[2]/n,a=e[3]/n,o=e[4],c=e[5],l=e[6],h=e[7],f=i*o+r*c+s*l+a*h;t[0]=i,t[1]=r,t[2]=s,t[3]=a,t[4]=(o-i*f)/n,t[5]=(c-r*f)/n,t[6]=(l-s*f)/n,t[7]=(h-a*f)/n}return t}function WM(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function XM(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function qM(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],a=t[4],o=t[5],c=t[6],l=t[7],h=e[0],f=e[1],d=e[2],u=e[3],g=e[4],_=e[5],p=e[6],m=e[7];return Math.abs(n-h)<=pe*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-f)<=pe*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(r-d)<=pe*Math.max(1,Math.abs(r),Math.abs(d))&&Math.abs(s-u)<=pe*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(a-g)<=pe*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(o-_)<=pe*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-p)<=pe*Math.max(1,Math.abs(c),Math.abs(p))&&Math.abs(l-m)<=pe*Math.max(1,Math.abs(l),Math.abs(m))}const $M=Object.freeze(Object.defineProperty({__proto__:null,add:NM,clone:mM,conjugate:HM,copy:fh,create:pM,dot:uh,equals:qM,exactEquals:XM,fromMat4:MM,fromRotation:xM,fromRotationTranslation:hh,fromRotationTranslationValues:_M,fromTranslation:vM,fromValues:gM,getDual:TM,getReal:EM,getTranslation:wM,identity:yM,invert:BM,len:kM,length:ph,lerp:zM,mul:FM,multiply:dh,normalize:GM,rotateAroundAxis:UM,rotateByQuatAppend:LM,rotateByQuatPrepend:IM,rotateX:CM,rotateY:PM,rotateZ:DM,scale:OM,set:SM,setDual:AM,setReal:bM,sqrLen:VM,squaredLength:Yr,str:WM,translate:RM},Symbol.toStringTag,{value:"Module"}));function mh(){var t=new Ne(2);return Ne!=Float32Array&&(t[0]=0,t[1]=0),t}function YM(t){var e=new Ne(2);return e[0]=t[0],e[1]=t[1],e}function jM(t,e){var n=new Ne(2);return n[0]=t,n[1]=e,n}function ZM(t,e){return t[0]=e[0],t[1]=e[1],t}function KM(t,e,n){return t[0]=e,t[1]=n,t}function JM(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function gh(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function _h(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function vh(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function QM(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function ey(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function ty(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t}function ny(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t}function iy(t,e){return t[0]=tn(e[0]),t[1]=tn(e[1]),t}function ry(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function sy(t,e,n,i){return t[0]=e[0]+n[0]*i,t[1]=e[1]+n[1]*i,t}function xh(t,e){var n=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(n*n+i*i)}function Mh(t,e){var n=e[0]-t[0],i=e[1]-t[1];return n*n+i*i}function yh(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function Sh(t){var e=t[0],n=t[1];return e*e+n*n}function ay(t,e){return t[0]=-e[0],t[1]=-e[1],t}function oy(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function cy(t,e){var n=e[0],i=e[1],r=n*n+i*i;return r>0&&(r=1/Math.sqrt(r)),t[0]=e[0]*r,t[1]=e[1]*r,t}function ly(t,e){return t[0]*e[0]+t[1]*e[1]}function hy(t,e,n){var i=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=i,t}function fy(t,e,n,i){var r=e[0],s=e[1];return t[0]=r+i*(n[0]-r),t[1]=s+i*(n[1]-s),t}function dy(t,e){e=e===void 0?1:e;var n=$t()*2*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t}function uy(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r,t[1]=n[1]*i+n[3]*r,t}function py(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[2]*r+n[4],t[1]=n[1]*i+n[3]*r+n[5],t}function my(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[3]*r+n[6],t[1]=n[1]*i+n[4]*r+n[7],t}function gy(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t}function _y(t,e,n,i){var r=e[0]-n[0],s=e[1]-n[1],a=Math.sin(i),o=Math.cos(i);return t[0]=r*o-s*a+n[0],t[1]=r*a+s*o+n[1],t}function vy(t,e){var n=t[0],i=t[1],r=e[0],s=e[1];return Math.abs(Math.atan2(i*r-n*s,n*r+i*s))}function xy(t,e){var n=t[0],i=t[1],r=e[0],s=e[1];return Math.atan2(n*s-i*r,n*r+i*s)}function My(t){return t[0]=0,t[1]=0,t}function yy(t){return"vec2("+t[0]+", "+t[1]+")"}function Sy(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ey(t,e){var n=t[0],i=t[1],r=e[0],s=e[1];return Math.abs(n-r)<=pe*Math.max(1,Math.abs(n),Math.abs(r))&&Math.abs(i-s)<=pe*Math.max(1,Math.abs(i),Math.abs(s))}var Ty=yh,by=gh,Ay=_h,wy=vh,Ry=xh,Cy=Mh,Py=Sh,Dy=(function(){var t=mh();return function(e,n,i,r,s,a){var o,c;for(n||(n=2),i||(i=0),r?c=Math.min(r*n+i,e.length):c=e.length,o=i;o<c;o+=n)t[0]=e[o],t[1]=e[o+1],s(t,t,a),e[o]=t[0],e[o+1]=t[1];return e}})();const Ly=Object.freeze(Object.defineProperty({__proto__:null,add:JM,angle:vy,ceil:QM,clone:YM,copy:ZM,create:mh,cross:hy,dist:Ry,distance:xh,div:wy,divide:vh,dot:ly,equals:Ey,exactEquals:Sy,floor:ey,forEach:Dy,fromValues:jM,inverse:oy,len:Ty,length:yh,lerp:fy,max:ny,min:ty,mul:Ay,multiply:_h,negate:ay,normalize:cy,random:dy,rotate:_y,round:iy,scale:ry,scaleAndAdd:sy,set:KM,signedAngle:xy,sqrDist:Cy,sqrLen:Py,squaredDistance:Mh,squaredLength:Sh,str:yy,sub:by,subtract:gh,transformMat2:uy,transformMat2d:py,transformMat3:my,transformMat4:gy,zero:My},Symbol.toStringTag,{value:"Module"})),Eh=Object.freeze(Object.defineProperty({__proto__:null,glMatrix:y_,mat2:q_,mat2d:gv,mat3:qv,mat4:Fx,quat:uM,quat2:$M,vec2:Ly,vec3:x1,vec4:G1},Symbol.toStringTag,{value:"Module"}));function Th(t,e,n,i,r){if(t.length===0)return null;if(t.length===1){const p=t[0];return{cx:p.x,cy:p.y,cz:p.z,count:1,size:r,children:null,point:p}}const s=e+r,a=n+r,o=i+r,c=r/2,l=[[],[],[],[],[],[],[],[]];for(const p of t){let m=0;p.x>=s&&(m|=1),p.y>=a&&(m|=2),p.z>=o&&(m|=4),l[m].push(p)}let h=0,f=0,d=0,u=0;const g=[],_=[[0,0,0],[1,0,0],[0,1,0],[1,1,0],[0,0,1],[1,0,1],[0,1,1],[1,1,1]];for(let p=0;p<8;p++){const m=l[p];if(m.length===0)continue;const[T,y,v]=_[p],P=e+T*r,b=n+y*r,w=i+v*r,R=Th(m,P,b,w,c);R&&(g.push(R),h+=R.cx*R.count,f+=R.cy*R.count,d+=R.cz*R.count,u+=R.count)}return u===0?null:{cx:h/u,cy:f/u,cz:d/u,count:u,size:r,children:g,point:null}}function bh(t,e,n,i,r,s,a,o){if(t===null)return;const c=t.cx-e,l=t.cy-n,h=t.cz-i,f=c*c+l*l+h*h;if(f<1e-20)return;const d=Math.sqrt(f);if(t.point!==null){if(t.point.index===r)return;const g=s/f;o.fx-=c*g,o.fy-=l*g,o.fz-=h*g;return}if(t.size/d<a&&t.count>0){const g=s*t.count/f;o.fx-=c*g,o.fy-=l*g,o.fz-=h*g;return}if(t.children)for(const g of t.children)bh(g,e,n,i,r,s,a,o)}const{vec3:yt}=Eh,Iy={simulationBound:1e3,cohesionValue:1,repulsionValue:1,centerPull:.1,iterationsPerStep:1,useOctree:!0,octreeThreshold:64,octreeTheta:.8};function Uy(t,e={}){const n={...Iy,...e},i=t.get_node_ids_order(),r=i.length,s=t.get_adjacency(),a=new Map;i.forEach((g,_)=>a.set(g,_));const o=new Float32Array(r*3);for(let g=0;g<r;g++)o[g*3]=Math.random()*n.simulationBound,o[g*3+1]=Math.random()*n.simulationBound,o[g*3+2]=Math.random()*n.simulationBound;const c={force:yt.create(),diff:yt.create(),neighborAvg:yt.create(),posI:yt.create(),posJ:yt.create()},l=n.useOctree&&r>=n.octreeThreshold,h=l?Array.from({length:r},(g,_)=>({x:0,y:0,z:0,index:_})):[];function f(g){const _=Math.max(1,n.iterationsPerStep);for(let p=0;p<_;p++){let m=null;if(l){let T=1/0,y=1/0,v=1/0,P=-1/0,b=-1/0,w=-1/0;for(let D=0;D<r;D++){const U=o[D*3],X=o[D*3+1],V=o[D*3+2];h[D].x=U,h[D].y=X,h[D].z=V,U<T&&(T=U),U>P&&(P=U),X<y&&(y=X),X>b&&(b=X),V<v&&(v=V),V>w&&(w=V)}const R=1e-6,S=Math.max(P-T,b-y,w-v,R)/2+R,x=(T+P)/2,C=(y+b)/2,L=(v+w)/2;m=Th(h,x-S,C-S,L-S,S)}for(let T=0;T<r;T++){yt.set(c.posI,o[T*3],o[T*3+1],o[T*3+2]),yt.set(c.force,0,0,0);const y=s.get(i[T])??[];if(y.length>0){c.neighborAvg[0]=0,c.neighborAvg[1]=0,c.neighborAvg[2]=0;for(const v of y){const P=a.get(v);P!==void 0&&(c.neighborAvg[0]+=o[P*3],c.neighborAvg[1]+=o[P*3+1],c.neighborAvg[2]+=o[P*3+2])}c.neighborAvg[0]/=y.length,c.neighborAvg[1]/=y.length,c.neighborAvg[2]/=y.length,yt.subtract(c.diff,c.neighborAvg,c.posI),yt.scale(c.diff,c.diff,n.cohesionValue),yt.add(c.force,c.force,c.diff)}if(l&&m){const v={fx:0,fy:0,fz:0};bh(m,c.posI[0],c.posI[1],c.posI[2],T,n.repulsionValue,n.octreeTheta,v),c.force[0]+=v.fx,c.force[1]+=v.fy,c.force[2]+=v.fz}else for(let v=0;v<r;v++){if(v===T)continue;yt.set(c.posJ,o[v*3],o[v*3+1],o[v*3+2]),yt.subtract(c.diff,c.posJ,c.posI);const P=yt.squaredLength(c.diff);P<1e-10||(yt.scale(c.diff,c.diff,n.repulsionValue/P),yt.subtract(c.force,c.force,c.diff))}c.force[0]-=n.centerPull*c.posI[0],c.force[1]-=n.centerPull*c.posI[1],c.force[2]-=n.centerPull*c.posI[2],o[T*3]+=c.force[0],o[T*3+1]+=c.force[1],o[T*3+2]+=c.force[2]}}}function d(){return o}function u(){const g=new Map;for(let _=0;_<r;_++)g.set(i[_],new mt(o[_*3],o[_*3+1],o[_*3+2]));return g}return{step:f,getPositions:d,getPositionMap:u}}const Ny={dimensions:2,simulationBound:1,epochsPerStep:1,centerPull:0,scaleBound:0,useSchedule:!0,learningRate:.08,tMax:80,eps:.01,initialPreservation:0};function Fy(t,e){for(let n=t.length-1;n>=1;n--){const i=Math.floor(e()*(n+1));[t[n],t[i]]=[t[i],t[n]]}}function Oy(t){let e=t;return()=>(e=e*1103515245+12345&2147483647,e/2147483647)}async function zy(t,e,n){const i=e.length,r=new Map;for(let a=0;a<i;a++){const o=e[a],c=await Hr.Dijkstra(t,o);r.set(o,c)}const s=[];for(let a=0;a<i;a++)for(let o=a+1;o<i;o++){const c=r.get(e[a]);if(!c)continue;const l=c.get(e[o]);if(l===void 0||l<=0)continue;const h=1/(l*l);s.push({i:a,j:o,d:l,w:h})}return s}async function By(t,e={}){const n={...Ny,...e,seed:e.seed??Math.floor(Math.random()*2147483647)},i=t.get_node_ids_order(),r=i.length,s=new Map;i.forEach((b,w)=>s.set(b,w));const a=await zy(t,i);a.length;let o=1/0,c=-1/0;for(const b of a)b.w<o&&(o=b.w),b.w>c&&(c=b.w);(o<=0||c<=0)&&(o=1),c<=0&&(c=1);const l=1/o,h=n.eps/c,f=n.tMax>1?Math.log(l/h)/(n.tMax-1):0,d=b=>b>=n.tMax?h:l*Math.exp(-f*b),u=n.dimensions,g=Oy(n.seed),_=new Float32Array(r*3);let p=null;if(n.initialPositions&&n.initialPositions.length>=r*3){if(_.set(n.initialPositions.subarray(0,r*3)),n.initialPreservation>0&&(p=new Float32Array(n.initialPositions.subarray(0,r*3))),u===2)for(let b=0;b<r;b++)_[b*3+2]=0}else{const b=n.simulationBound;for(let w=0;w<r;w++)_[w*3]=g()*b,_[w*3+1]=g()*b,_[w*3+2]=u===2?0:g()*b}let m=0;const T=1e-12;function y(b){const w=Math.max(1,n.epochsPerStep);for(let R=0;R<w&&m<n.tMax;R++){const S=n.useSchedule?d(m):n.learningRate;m++,Fy(a,g);for(const x of a){const{i:C,j:L,d:D,w:U}=x;let X=S*U;X>1&&(X=1);const V=_[C*3]-_[L*3],K=_[C*3+1]-_[L*3+1],G=u===3?_[C*3+2]-_[L*3+2]:0,te=Math.max(Math.sqrt(V*V+K*K+G*G),T),ie=X*(te-D)/(2*te);_[C*3]-=ie*V,_[C*3+1]-=ie*K,u===3&&(_[C*3+2]-=ie*G),_[L*3]+=ie*V,_[L*3+1]+=ie*K,u===3&&(_[L*3+2]+=ie*G)}}if(n.initialPreservation>0&&p){const R=n.initialPreservation;for(let S=0;S<r*3;S++)_[S]=(1-R)*_[S]+R*p[S]}if(n.centerPull>0)for(let R=0;R<r;R++)_[R*3]-=n.centerPull*_[R*3],_[R*3+1]-=n.centerPull*_[R*3+1],u===3&&(_[R*3+2]-=n.centerPull*_[R*3+2]);if(n.scaleBound>0&&r>0){let R=0,S=0,x=0;for(let L=0;L<r;L++)R+=_[L*3],S+=_[L*3+1],x+=_[L*3+2];R/=r,S/=r,x/=r;let C=0;for(let L=0;L<r;L++){_[L*3]-=R,_[L*3+1]-=S,_[L*3+2]-=x;const D=Math.sqrt(_[L*3]**2+_[L*3+1]**2+(u===3?_[L*3+2]**2:0));D>C&&(C=D)}if(C>0){const L=n.scaleBound/C;for(let D=0;D<r*3;D++)_[D]*=L}}if(u===2)for(let R=0;R<r;R++)_[R*3+2]=0}function v(){return _}function P(){const b=new Map;for(let w=0;w<r;w++)b.set(i[w],new mt(_[w*3],_[w*3+1],_[w*3+2]));return b}return{step:y,getPositions:v,getPositionMap:P}}exports.Constructors=vc;exports.Drawing=Ec;exports.Edge=gn;exports.Geometry=wi;exports.Graph=jt;exports.GraphDrawer=i_;exports.GraphMethods=Hr;exports.Hierarchy=d_;exports.Line=kr;exports.Models=s_;exports.Point=mt;exports.SampleData=nf;exports.ThreeWrapper=zg;exports.Utilities=Et;exports._Node=In;exports.createKamadaKawai3D=Uy;exports.createStressSGD3D=By;exports.glMatrix=Eh;exports.matrixVectorMultiply=u_;exports.normalizeVector=p_;
|
|
3887
3887
|
//# sourceMappingURL=pgl.js.map
|