aframe-babia-components 1.3.1 → 1.3.3

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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see aframe-babia-components.min.js.LICENSE.txt */
2
- (()=>{var __webpack_modules__={9590:t=>{t.exports.NotiBuffer=class{constructor(t,e){this.currentId=0,this.notifiers={},this.data,this.function1=t,this.function2=e}set(t){console.log("produced",t),this.data=t;for(const t of Object.values(this.notifiers))t(this.data)}register(t,e){void 0!==this.data&&(console.log("Data was ready"),t(this.data));let i=this.currentId;return this.notifiers[i]=t,this.currentId++,e&&this.function1&&this.function1(e),i}unregister(t,e){delete this.notifiers[t],e&&this.function2&&this.function2(e)}}},4601:(t,e,i)=>{let n=i(1392).findProdComponent,r=i(1392).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const a=i(9590).NotiBuffer;AFRAME.registerComponent("babia-filter",{schema:{from:{type:"string"},filter:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new a},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.filter===t.filter)e.from===t.from&&e.filter===t.filter||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-filter"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=r(e.data);this.processData(t)}},remove:function(){},pause:function(){},play:function(){},prodComponent:void 0,notiBufferId:void 0,processData:function(t){let e,i=this.data.filter.split("=");i[0]&&i[1]?(e=t.filter((t=>t[i[0]]==i[1])),this.notiBuffer.set(e)):console.error("Error on filter, please use key=value syntax")}})},8394:(t,e,i)=>{let n=i(1392).findProdComponent,r=i(1392).findNavComponent,a=i(1392).parseJson;class o{constructor(t,e,i,n,r,a){this.field=t,this.step=i||1,this.speed=n||1,this.current=-2==e?0:e,this.state=r||"play",this.direction=a||"forward"}updateData(t){this.data={};for(let e of t){let t=e[this.field];this.data[t]?this.data[t].push(e):this.data[t]=[e]}this.selectors=Object.keys(this.data).sort(),this.length=this.selectors.length}next(){let t=this.data[this.selectors[this.current]];return this.current+this.step<=this.length-1?this.current+=this.step:(this.current=this.length-1,this.current=this.length),t}prev(){let t=this.data[this.selectors[this.current]];return this.current-this.step>=0?this.current-=this.step:this.current=-1,t}setValue(t){let e=this.data[this.selectors[t]];return"rewind"!=this.direction?t>this.length?this.current=this.length:this.current=t<1?1:t+1:t>this.length-2?this.current=this.length-2:this.current=t<-1?-1:t-1,e}}if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const s=i(9590).NotiBuffer;AFRAME.registerComponent("babia-selector",{schema:{from:{type:"string"},controller:{type:"string",default:""},select:{type:"string",default:"date"},timeout:{type:"number",default:6e3},data:{type:"string"},current_value:{type:"number",default:-2},speed:{type:"number",default:0},step:{type:"number",default:0},direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,interval:void 0,init:function(){this.notiBuffer=new s,this.navNotiBuffer=new s,this.selectable=new o(this.data.select,this.data.current_value,this.data.step,this.data.speed)},babiaMetadata:{id:0},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from&&(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-selector"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));if(e.controller&&e.controller!=t.controller&&(this.selectorController=document.querySelector("#"+e.controller),this.navComponent&&(this.navComponent.notiBuffer.unregister(this.navNotiBufferId,this),i.components.networked&&this.removeOldNavListener(this.navComponent.el)),this.navComponent=r(e,i),this.navComponent.notiBuffer&&(this.navNotiBufferId=this.navComponent.notiBuffer.register(this.processEvent.bind(this),this)),i.components.networked&&this.addMultiuserMode(this.navComponent.el)),e.direction&&e.direction!=t.direction&&("rewind"!=e.direction?(this.selectable.current!=this.selectable.length&&(this.selectable.current+=2),this.navNotiBuffer&&this.navNotiBuffer.set("forward")):(this.selectable.current<1?this.selectable.current=0:this.selectable.current-=2,this.navNotiBuffer&&this.navNotiBuffer.set("rewind"))),e.step&&e.step!=this.selectable.step&&(this.selectable.step=e.step,this.navNotiBuffer.set({type:"step",value:e.step}),"rewind"!=this.data.direction?this.selectable.current+e.step>this.selectable.length?this.selectable.current=this.selectable.length:this.selectable.current+=e.step-1:this.selectable.current-e.step<=0?this.selectable.current=-1:this.selectable.current-=e.step+1),e.speed&&e.speed!=this.selectable.speed){this.selectable.speed=e.speed;let t=this.data.timeout/e.speed;this.navNotiBuffer.set({type:"speed",value:e.speed});let i=this;clearInterval(this.interval),this.interval=window.setInterval((function(){i.loop()}),t)}i.components.networked&&i.components.networked.data.owner!=NAF.clientId&&"scene"!=i.components.networked.data.owner&&(-2!=e.current_value&&e.current_value!=t.current_value&&("rewind"!=e.direction?(this.navNotiBuffer.set({type:"position",value:e.current_value-1,label:this.selectable.selectors[e.current_value-1]}),this.setSelect(e.current_value-1)):(this.navNotiBuffer.set({type:"position",value:e.current_value+1,label:this.selectable.selectors[e.current_value+1]}),this.setSelect(e.current_value+1))),"pause"==e.state&&e.state!=t.state&&this.navNotiBuffer.set("pause"))},nextSelect:function(){this.selectable.current>this.selectable.length-1?(this.selectable.current=this.selectable.length,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause")):(this.newData=this.selectable.next(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]}),this.babiaMetadata={id:this.selectable.current})},prevSelect:function(){this.selectable.current>=0?(this.newData=this.selectable.prev(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current+1]}),this.babiaMetadata={id:this.selectable.current}):(this.selectable.current=-1,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause"))},setSelect:function(t){if(t!=this.selectable.current-1&&"rewind"!=this.data.direction||t!=this.selectable.current+1&&"rewind"===this.data.direction){let e;this.newData=this.selectable.setValue(t),"rewind"!=this.data.direction?(this.babiaMetadata={id:t++},e=this.selectable.selectors[t-1]):(this.babiaMetadata={id:t--},this.selectable.current-=2,e=this.selectable.selectors[t+1]),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:t,label:e})}},loop:function(){"pause"!=this.data.state&&("rewind"!=this.data.direction?this.nextSelect():this.prevSelect())},prodComponent:void 0,navComponent:void 0,prodNotiBufferId:void 0,navNotiBufferId:void 0,newData:void 0,processData:function(t){this.selectable.updateData(t),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]});let e=this;this.nextSelect(),this.interval=window.setInterval((function(){e.loop()}),e.data.timeout*e.selectable.speed)},processEvent:function(t){if(t.includes("pause"))this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause");else if(t.includes("play"))this.selectable.state="play",this.el.setAttribute("babia-selector","state","play");else if(t.includes("forward"))this.selectable.direction="forward",this.el.setAttribute("babia-selector","direction","forward");else if(t.includes("rewind"))this.selectable.direction="rewind",this.el.setAttribute("babia-selector","direction","rewind");else if(t.includes("babiaSetPosition")){this.selectable.state="pause";let e=parseInt(t.substring(16),10);"rewind"!=this.data.direction?this.el.setAttribute("babia-selector",{state:"pause",current_value:e+1}):this.el.setAttribute("babia-selector",{state:"pause",current_value:e-1}),this.setSelect(e),this.navNotiBuffer.set("pause")}else t.includes("babiaSetStep")?this.el.setAttribute("babia-selector","step",parseInt(t.substring(12),10)):t.includes("babiaSetSpeed")&&this.el.setAttribute("babia-selector","speed",parseInt(t.substring(13),10))},removeOldNavListener:function(t){t.removeEventListener("click",(function(){NAF.utils.isMine(selector)||"scene"==selector.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(selector)}))},addMultiuserMode:function(t){let e=this.el;function i(){t.children[1].setAttribute("visible",!1),t.children[2].setAttribute("visible",!1),t.children[3].setAttribute("visible",!1)}document.body.addEventListener("clientConnected",(function(t){let n=t.detail.clientId;console.log("clientConnected event. clientId =",n),console.log("Selector owner: ",e.components.networked.data.owner);let r=!0;if("scene"==e.components.networked.data.owner){for(let t in NAF.connection.getConnectedClients()){let e=NAF.connection.getConnectedClients()[t].roomJoinTime,i=NAF.connection.adapter._myRoomJoinTime;console.log("Other: ",e),console.log("Mine: ",i),i>e&&(r=!1)}r?NAF.utils.takeOwnership(e):(console.log("I'm not first"),i())}else e.components.networked.data.owner!=NAF.clientId&&i()})),t.addEventListener("click",(function(){NAF.utils.isMine(e)||"scene"==e.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(e)})),e.addEventListener("ownership-gained",(e=>{console.log("Selector ownership gained"),t.children[1].setAttribute("visible",!0),t.children[2].setAttribute("visible",!0),t.children[3].setAttribute("visible",!0)})),e.addEventListener("ownership-lost",(t=>{console.log("Selector ownership lost"),i()}))}})},2240:(e,i,n)=>{let r=n(1392).findProdComponent,a=n(1392).parseJson;const o=n(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(e,i,n){for(t=0;t<e.length&&e[t][i]!==n;)t++;return t<e.length&&e[t]}AFRAME.registerComponent("babia-treebuilder",{schema:{from:{type:"string"},field:{type:"string"},split_by:{type:"string",default:"/"},build_root:{type:"boolean",default:!1},root_name:{type:"string",default:"Main"},data:{type:"string"}},multiple:!1,prodComponent:void 0,notiBufferId:void 0,init:function(){this.notiBuffer=new o},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.field===t.field&&e.split_by===t.split_by)e.from===t.from&&e.field===t.field&&e.split_by===t.split_by||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,i,"babia-treebuilder"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=a(e.data);this.processData(t)}},processData:function(t){let e=this.data,i=[],n=i;e.build_root&&(i=[{name:e.root_name,id:"",children:[]}],n=i[0].children);for(let i=0;i<t.length;i++){let r=t[i][e.field].split(e.split_by),a=n,o="";for(let n=0;n<r.length;n++){if(!r[n])continue;let l=r[n],c=s(a,"name",l);if(c)a=c.children,o=c.uid;else{let s={};n===r.length-1?s=t[i]:s.children=[],s.uid=o?o+e.split_by+l:l,s.name=l,a.push(s),a=s.children,o=s.uid}}}this.notiBuffer.set(i)}})},3285:(t,e,i)=>{i(1392).colors,AFRAME.registerComponent("babia-bar",{schema:{height:{type:"number"},width:{type:"number"},depth:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""},labelLookat:{type:"string",default:"[camera]"},labelScale:{type:"number",default:1}},init:function(){console.log("Starting bar:",this.data.height,this.data.color);let t=this.data;this.box=document.createElement("a-entity"),this.box.classList.add("babiaxraycasterclass"),this.el.appendChild(this.box);let e={};e=t.animation?{height:0,width:t.width,depth:t.depth}:{height:t.height,width:t.width,depth:t.depth},this.box.setAttribute("geometry",{primitive:"box",height:e.height,width:e.width,depth:e.depth}),this.box.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.box;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","width",e.animation,e.width,t.width),this.updateProperty(i,"geometry","depth",e.animation,e.depth,t.depth),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let o=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:o.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8),oldHeight=t.height||0,oldDepth=t.depth||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.6,z:.7*e.depth},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText}),e.labelLookat&&t.labelLookat!==e.labelLookat&&this.labelEl.setAttribute("babia-lookat",e.labelLookat),e.labelScale&&t.labelScale!==e.labelScale&&this.labelEl.setAttribute("scale",{x:e.labelScale,y:e.labelScale,z:e.labelScale})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},4324:(t,e,i)=>{i(1392).colors,AFRAME.registerComponent("babia-cyl",{schema:{height:{type:"number"},radius:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""},labelLookat:{type:"string",default:"[camera]"}},init:function(){console.log("Starting cyl:",this.data.height,this.data.color);let t=this.data;this.cylinder=document.createElement("a-entity"),this.cylinder.classList.add("babiaxraycasterclass"),this.el.appendChild(this.cylinder);let e={};e=t.animation?{height:0,radius:t.radius}:{height:t.height,radius:t.radius},this.cylinder.setAttribute("geometry",{primitive:"cylinder",height:e.height,radius:e.radius}),this.cylinder.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.cylinder;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","radius",e.animation,e.radius,t.radius),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let o=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:o.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8),oldHeight=t.height||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.7,z:.7*e.radius},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText}),e.labelLookat&&t.labelLookat!==e.labelLookat&&this.labelEl.setAttribute("babia-lookat",e.labelLookat),e.labelScale&&t.labelScale!==e.labelScale&&this.labelEl.setAttribute("scale",{x:e.labelScale,y:e.labelScale,z:e.labelScale})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},4330:(t,e,i)=>{const n=i(1392).colors;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");class r{constructor(t,e,i,n){this.el=t,this.axis=e,this.anim=i,this.dur=n}updateLine(t,e){const i=this.axis,n=this.el,r=this.anim,a=this.dur,o=`line__${i}axis`;let s=n.components[o],l={x:0,y:0,z:0};l[i]=t,r&&s?(n.setAttribute(`animation__${i}axis`,{property:`${o}.end`,to:l,dur:a}),n.setAttribute(o,{color:e})):n.setAttribute(o,{start:{x:0,y:0,z:0},end:l,color:e})}removeLabels(){const t=this.el,e=this.anim,i=this.dur;let n=t.querySelectorAll("[text]");for(const t of n)e?(t.addEventListener("animationcomplete",(function(t){t.target.remove()})),t.setAttribute("animation",{property:"text.opacity",to:0,dur:i})):t.remove()}updateLabels(t,e,i,r,a){const o=this.axis;let s=this.el;const l=this.anim,c=this.dur;for(let h=0;h<t.length;++h){let d,u=document.createElement("a-entity"),p=i;r&&(p=n.get(h,r)),u.setAttribute("text",{value:e[h],align:"right",width:10,color:p,opacity:0}),"behind"!=a&&"right"!=a||u.setAttribute("text",{align:"left"}),"x"===o?d="behind"==a?{x:t[h],y:0,z:-5.15}:{x:t[h],y:0,z:5.25}:"y"===o?d="right"==a?{x:5.2,y:t[h],z:0}:{x:-5.2,y:t[h],z:0}:"z"===o&&(d="right"==a?{x:5.2,y:0,z:t[h]}:{x:-5.2,y:0,z:t[h]}),u.setAttribute("position",d),"x"===o?u.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===o&&u.setAttribute("rotation",{x:-90,y:0,z:0}),l?u.setAttribute("animation",{property:"text.opacity",to:1,dur:c}):u.setAttribute("text",{opacity:1}),s.appendChild(u)}}updateName(t,e,i){const n=this.axis;let r=this.el;const a=this.anim,o=this.dur;let s,l=document.createElement("a-entity");l.setAttribute("text",{value:t,align:"right",width:10,color:"#000",opacity:0}),"behind"!=e&&"right"!=e||l.setAttribute("text",{align:"left"}),"x"===n?s="behind"==e?{x:i+.5,y:0,z:-5.15}:{x:i+.5,y:0,z:5.25}:"y"===n?s="right"==e?{x:5.2,y:i+.5,z:0}:{x:-5.2,y:i+.5,z:0}:"z"===n&&(s="right"==e?{x:5.2,y:0,z:i+.5}:{x:-5.2,y:0,z:i+.5}),l.setAttribute("position",s),"x"===n?l.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===n&&l.setAttribute("rotation",{x:-90,y:0,z:0}),a?l.setAttribute("animation",{property:"text.opacity",to:1,dur:o}):l.setAttribute("text",{opacity:1}),r.appendChild(l)}}AFRAME.registerComponent("babia-axis-y",{schema:{maxValue:{type:"number"},length:{type:"number"},minSteps:{type:"number",default:6},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"y",this.data.animation,this.data.dur)},update:function(t){const e=this.data;let i=this.data.maxValue,n=this.data.length,r=this.data.minSteps;this.data.animation,this.data.dur;let a=0;if(console.log("Starting babia-axis-y:",i,n,this.data.color),i!=t.maxValue||n!=t.maxValue||r!=t.minSteps){let t=Math.floor(Math.log10(i));t<=0&&(a=1-t);let o=n/i,s=Math.pow(10,t),l=i/s;for(;l<=r;)s/=2,l=i/s;this.axis.updateLine(n,e.color),this.axis.removeLabels();let c=[],h=[];for(let t=1;s*t<i;t++)vtick=s*t,c.push(vtick*o),h.push(vtick.toFixed(a));this.axis.updateLabels(c,h,e.color,e.palette,e.align)}e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-x",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"front"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"x",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-x:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-z",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"z",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-z:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}})},5852:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-camera",{schema:{raycasterMouse:{type:"string",default:".babiaxraycasterclass"},raycasterHand:{type:"string",default:".babiaxraycasterclass"},tipsOpened:{type:"boolean",default:!0},gripRLabel:{type:"string",default:"Open/Close \nTips"},gripLLabel:{type:"string",default:"Stop Audio"},triggerRLabel:{type:"string",default:"Click"},triggerLLabel:{type:"string",default:"Teleport"},teleportCollisions:{type:"string",default:".environmentGround"}},multiple:!1,init:function(){},update:function(t){this.data!=this.oldData&&((this.cursor||this.leftHand||this.rightHand)&&(this.el.parentElement.removeChild(this.cursor),this.el.parentElement.removeChild(this.leftHand),this.el.parentElement.removeChild(this.rightHand),this.cursor=void 0,this.leftHand=void 0,this.rightHand=void 0),this.addCursor(),this.setOculusConnected())},addCursor:function(){this.cursor=document.createElement("a-entity"),this.cursor.id="cursor",this.cursor.setAttribute("cursor",{rayOrigin:"mouse"}),this.cursor.setAttribute("raycaster",{objects:this.data.raycasterMouse}),this.el.parentElement.append(this.cursor)},createTip:function(t,e,i){let n=document.createElement("a-entity");return n.id=t,n.classList.add("tips"),n.setAttribute("tooltip",e),n.setAttribute("position",i),n},setOculusConnected:function(){let t=this;t.tooltips=[],t.leftHand=document.createElement("a-entity"),t.leftHand.id="babia-leftHand",t.leftHand.setAttribute("oculus-touch-controls",{hand:"left"}),t.el.parentElement.append(t.leftHand),t.rightHand=document.createElement("a-entity"),t.rightHand.id="babia-rightHand",t.rightHand.setAttribute("oculus-touch-controls",{hand:"right"}),t.el.parentElement.append(t.rightHand),document.addEventListener("controllerconnected",(e=>{let i=t.el.parentElement.object3D.position;t.el.parentElement.setAttribute("position",{x:i.x,y:0,z:i.z}),"babia-leftHand"===e.target.id&&(t.leftHand.setAttribute("teleport-controls",{cameraRig:`#${t.el.parentElement.id}`,teleportOrigin:`#${t.el.id}`,collisionEntities:t.data.teleportCollisions,hitCylinderColor:"#ff3468",curveHitColor:"#ff3468",curveMissColor:"#333333",curveLineWidth:.01,button:"trigger"}),tipTriggerLconfig={text:t.data.triggerLLabel,width:.07,height:.03,targetPosition:"0.002 -0.02 -0.014",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipTriggerLpos={x:-.09,y:-.04,z:-.08},t.tipTriggerL=this.createTip("babia-tooltip_trigger_L",tipTriggerLconfig,tipTriggerLpos),t.leftHand.append(t.tipTriggerL),t.tooltips.push(t.tipTriggerL),tipGripLconfig={text:t.data.gripLLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",rotation:"-90 0 0",src:tooltip.default},tipGripLpos={x:.085,y:-.01,z:.07},t.tipGripL=this.createTip("babia-tooltip_grip_L",tipGripLconfig,tipGripLpos),t.leftHand.append(t.tipGripL),t.tooltips.push(t.tipGripL)),"babia-rightHand"===e.target.id&&(t.rightHand.setAttribute("laser-controls",{hand:"right"}),t.rightHand.setAttribute("raycaster",{objects:this.data.raycasterHand,lineOpacity:1}),tipTriggerRconfig={text:t.data.triggerRLabel,width:.07,height:.03,targetPosition:"0.005 -0.02 -0.014",lineHorizontalAlign:"left",rotation:"-90 0 0",src:tooltip.default},tipTriggerRpos={x:-.09,y:-.04,z:-.08},t.tipTriggerR=this.createTip("babia-tooltip_trigger_R",tipTriggerRconfig,tipTriggerRpos),t.rightHand.append(t.tipTriggerR),t.tooltips.push(t.tipTriggerR),tipGripRconfig={text:t.data.gripRLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipGripRpos={x:-.085,y:-.01,z:.07},t.tipGripR=this.createTip("babia-tooltip_grip_R",tipGripRconfig,tipGripRpos),t.rightHand.append(t.tipGripR),t.tooltips.push(t.tipGripR)),this.tipsController(),this.data.networkedAudio&&this.setAudioController()}))},tipsController:function(){let t=this;this.tipsOpened=t.data.tipsOpened,t.tipsOpened||t.tooltips.forEach((t=>{t.setAttribute("visible",!1)})),t.rightHand.addEventListener("gripdown",(()=>{t.tipsOpened?(t.tipsOpened=!1,t.tooltips.forEach((t=>{t.setAttribute("visible",!1)}))):(t.tipsOpened=!0,t.tooltips.forEach((t=>{t.setAttribute("visible",!0)})))}))}})},3773:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function t(t,i){t.getObject3D("mesh")?e(t,i):t.addEventListener("model-loaded",(function(){t.color=i,e(t,i)}))}function e(t,e){t.object3D.traverse((function(t){last_material=t.material,last_material&&(t.material=new THREE.MeshBasicMaterial({color:e}))}))}AFRAME.registerComponent("babia-controls",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,init:function(){this.createPlayer()},update:function(e){let i=this.data;if(i.state&&i.state!=e.state){let t=document.getElementsByClassName("babiaPause")[0],e=document.getElementsByClassName("babiaPlay")[0];"pause"===i.state?(t&&this.el.children[0].removeChild(t),e||this.createButton("play","white")):(e&&this.el.children[0].removeChild(e),t||this.createButton("pause","white")),this.el.parentEl.setAttribute("babia-navigator","state",i.state)}if(i.direction&&i.direction!=e.direction){let e=document.getElementsByClassName("babiaRewind")[0],n=document.getElementsByClassName("babiaForward")[0];"rewind"===i.direction?(n.color="white",e.color="grey",t(n,"white"),t(e,"grey")):(n.color="grey",e.color="white",t(n,"grey"),t(e,"white")),this.el.parentEl.setAttribute("babia-navigator","direction",i.direction)}},player:void 0,createPlayer:function(){this.player=document.createElement("a-entity"),this.player.classList.add("babiaxrPlayer"),this.player.classList.add("babiaxraycasterclass"),this.el.appendChild(this.player),this.createButton("rewind","white"),this.createButton("skipPrev","white"),this.createButton("pause","white"),this.createButton("skipNext","white"),this.createButton("forward","grey")},createButton:function(e,i){let n,r,a,o=!1;if("play"===e)n=playButton.default,r=.2,a="babiaPlay";else if("pause"===e)n=pauseButton.default,r=0,a="babiaPause";else if("skipNext"===e)n=skipButton.default,r=3,a="babiaSkipNext",o=!0;else if("skipPrev"===e)n=skipButton.default,r=-3,a="babiaSkipPrev";else if("rewind"===e)n=rewindButton.default,r=-6,a="babiaRewind";else{if("forward"!==e)throw new Error("That button type doesn't exist.");n=rewindButton.default,r=6,a="babiaForward",o=!0}let s=document.createElement("a-entity");s.setAttribute("gltf-model","url("+n+")"),s.classList.add("babiaxraycasterclass"),s.classList.add(a),s.setAttribute("position",{x:r,y:0,z:0}),t(s,i),o&&s.setAttribute("rotation",{x:0,y:180,z:0}),this.player.appendChild(s),this.mouseOver(s),this.processEvents(s)},mouseOver:function(e){e.addEventListener("mouseenter",(function(){t(e,"grey")})),e.addEventListener("mouseleave",(function(){t(e,e.color)}))},processEvents:function(t){let e=this;t.addEventListener("click",(function(){if(t.classList.contains("babiaPlay"))this.parentEl.parentEl.setAttribute("babia-controls","state","play");else if(t.classList.contains("babiaPause"))this.parentEl.parentEl.setAttribute("babia-controls","state","pause");else if(t.classList.contains("babiaSkipNext")||t.classList.contains("babiaSkipPrev")){"pause"!=e.data.state&&this.parentEl.parentEl.setAttribute("babia-controls","state","pause");let i="skipPrev";t.classList.contains("babiaSkipNext")&&(i="skipNext"),e.el.parentEl.components["babia-navigator"].controlNavigator(i)}else t.classList.contains("babiaForward")?this.parentEl.parentEl.setAttribute("babia-controls","direction","forward"):t.classList.contains("babiaRewind")&&this.parentEl.parentEl.setAttribute("babia-controls","direction","rewind")}))}})},80:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function t(t){let e=t.el.sceneEl.camera.el;t.recordedData[Date.now()]={position:e.getAttribute("position"),rotation:e.getAttribute("rotation")}}function e(t,e){let i="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(t)),n=document.createElement("a");n.setAttribute("href",i),n.setAttribute("download",e+".json"),document.body.appendChild(n),n.click(),n.remove()}AFRAME.registerComponent("babia-experiment",{schema:{taskTitle:{type:"string",default:"Default task title"},taskDescription:{type:"string",default:"Default task text"},openTaskImg:{type:"string"},closeTaskImg:{type:"string"},timeLimitEnding:{type:"boolean",default:!1},timeLimitTime:{type:"number",default:300},forceFinishWhenTimeLimit:{type:"boolean",default:!1},finishButton:{type:"boolean",default:!0},recordDelta:{type:"number",default:3e3},recordAudio:{type:"boolean",default:!0},taskAudio:{type:"boolean",default:!1},taskAudioUrl:{type:"string",default:null},taskVideo:{type:"boolean",default:!1},taskVideoId:{type:"string",default:null},taskVideoWidth:{type:"number",default:3},taskVideoHeight:{type:"number",default:1.75},lookat:{type:"string",default:"[camera]"}},multiple:!0,recordedData:{},runningExperiment:!1,init:function(){},update:function(t){if(this.data!=this.oldData){let t=this.el.querySelectorAll("[babia-camera]");if(t.length>0){this.babiaCameraEl=t[0];let e=this.babiaCameraEl.getAttribute("babia-camera");this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:e.raycasterMouse+", #babiaTaskPopup, #babiaTaskPopup--close-icon, #babiaStartButton, #babiaFinishButton, #babiaTaskAudio, #babiaTaskVideo",raycasterHand:e.raycasterHand+", #babiaTaskPopup, #babiaTaskPopup--close-icon, #babiaStartButton, #babiaFinishButton, #babiaTaskAudio, #babiaTaskVideo"})}else this.babiaCameraEl=this.el.sceneEl.camera.el;this.findBabiaCharts(),this.hideCharts(),0==this.el.querySelectorAll("[babia-task]").length&&(this.data.taskAudio?this.addAudioTask():this.data.taskVideo?this.addVideoTask():this.addTask()),this.addStartButton(),this.data.finishButton&&this.addFinishButton()}},findBabiaCharts:function(){this.babiaCharts=this.el.querySelectorAll("[babia-pie], [babia-bars], [babia-barsmap], [babia-bubbles], [babia-city], [babia-cyls], [babia-cylsmap], [babia-doughnut], [babia-terrain], [babia-boats], [babia-network], [babiaxr-codecity]")},hideCharts:function(){for(let t of this.babiaCharts)t.setAttribute("visible",!1)},showCharts:function(){for(let t of this.babiaCharts)t.setAttribute("visible",!0)},addTask:function(){this.taskEntity=document.createElement("a-entity"),this.taskEntity.setAttribute("class","babiaxrayscasterclass"),this.taskEntity.setAttribute("id","babiaTaskPopup"),this.taskEntity.setAttribute("babia-poster",{openIconImage:"../assets/popups/info.jpg",closeIconImage:"../assets/popups/close.jpg",title:this.data.taskTitle,titleWrapCount:30,titleColor:"black",bodyColor:"black",posterBoxColor:"white",bodyFont:"roboto",posterBoxHeight:4.5,body:this.data.taskDescription}),this.taskEntity.setAttribute("scale",{x:.5,y:.5,z:.5}),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskEntity)},audioPlaying:!1,addAudioTask:function(){const t=this;this.taskAudioEntity=document.createElement("a-entity"),this.taskAudioEntity.setAttribute("class","babiaxrayscasterclass"),this.taskAudioEntity.setAttribute("geometry",{primitive:"plane",width:1.1,height:.5}),this.taskAudioEntity.setAttribute("text",{value:"Play audio!",color:"white",align:"center",wrapCount:30,width:3.6}),this.taskAudioEntity.setAttribute("id","babiaTaskAudio"),this.taskAudioEntity.setAttribute("sound",{src:`url(${t.data.taskAudioUrl})`}),this.taskAudioEntity.addEventListener("click",(function(e){t.audioPlaying?(t.audioPlaying=!1,t.taskAudioEntity.components.sound.stopSound(),t.taskAudioEntity.setAttribute("text","value","Play audio!")):(t.audioPlaying=!0,t.taskAudioEntity.components.sound.playSound(),t.taskAudioEntity.setAttribute("text","value","Stop audio!"))}),!1),this.taskAudioEntity.addEventListener("sound-ended",(function(e){t.audioPlaying=!1,t.taskAudioEntity.setAttribute("text","value","Play audio!")}),!1),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskAudioEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskAudioEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskAudioEntity)},videoPlaying:!1,addVideoTask:function(){const t=this;this.taskVideoEntity=document.createElement("a-video"),this.taskVideoEntity.setAttribute("class","babiaxrayscasterclass"),this.taskVideoEntity.setAttribute("id","babiaTaskVideo"),this.taskVideoEntity.setAttribute("src",t.data.taskVideoId),this.taskVideoStream=document.querySelector(t.data.taskVideoId),this.taskVideoEntity.setAttribute("width",t.data.taskVideoWidth),this.taskVideoEntity.setAttribute("height",t.data.taskVideoHeight),this.taskVideoEntity.addEventListener("click",(function(e){t.videoPlaying?(t.videoPlaying=!1,t.taskVideoStream.pause()):(t.videoPlaying=!0,t.taskVideoStream.play())}),!1),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskVideoEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskVideoEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskVideoEntity)},addStartButton:function(){const e=this;this.startButtonEntity=document.createElement("a-plane"),this.startButtonEntity.setAttribute("id","babiaStartButton"),this.startButtonEntity.setAttribute("scale",{x:.4,y:.4,z:.4}),this.startButtonEntity.setAttribute("babia-lookat",this.data.lookat),this.startButtonEntity.setAttribute("class",".babiaxrayscasterclass"),this.startButtonEntity.setAttribute("color","#3ac961"),this.startButtonEntity.setAttribute("geometry",{primitive:"plane",width:1.8,height:.5}),this.startButtonEntity.setAttribute("text",{value:"Start!",color:"white",align:"center",wrapCount:30,width:3.6}),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.startButtonEntity.setAttribute("position",{x:this.babiaCameraPosition.x-.5,y:this.babiaCameraPosition.y+1,z:this.babiaCameraPosition.z-1.5}),this.startButtonEntity.addEventListener("click",(async function(n){e.showCharts(),e.runningExperiment=!0,e.recordingData=window.setInterval((function(){t(e)}),e.data.recordDelta),e.recordedData.startTime=Date.now(),e.data.recordAudio&&(e.audioRecorder=await i(),e.audioRecorder.start()),e.startButtonEntity.setAttribute("visible",!1),e.data.finishButton&&e.finishButtonEntity.setAttribute("visible",!0),e.data.timeLimitEnding&&(e.recordedData.maxTime=e.recordedData.startTime+1e3*e.data.timeLimitTime)}),!1),this.el.parentElement.append(this.startButtonEntity)},addFinishButton:function(){const i=this;this.finishButtonEntity=document.createElement("a-plane"),this.finishButtonEntity.setAttribute("id","babiaFinishButton"),this.finishButtonEntity.setAttribute("scale",{x:.4,y:.4,z:.4}),this.finishButtonEntity.setAttribute("babia-lookat",this.data.lookat),this.finishButtonEntity.setAttribute("class","babiaxrayscasterclass"),this.finishButtonEntity.setAttribute("color","#9e0000"),this.finishButtonEntity.setAttribute("visible",!1),this.finishButtonEntity.setAttribute("geometry",{primitive:"plane",width:1.8,height:.5}),this.finishButtonEntity.setAttribute("text",{value:"Finish!",color:"white",align:"center",wrapCount:30,width:3.6}),this.finishButtonEntity.setAttribute("position",{x:this.babiaCameraPosition.x+.5,y:this.babiaCameraPosition.y+1,z:this.babiaCameraPosition.z-1.5}),this.finishButtonEntity.addEventListener("click",(function(n){i.hideCharts(),i.runningExperiment=!1,t(i),clearInterval(this.recordingData),i.audioRecorder&&i.stopAndDownloadAudio(),i.recordedData.finishTime=Date.now(),i.recordedData.totalDuration=i.recordedData.finishTime-i.recordedData.startTime,e(i.recordedData,"experimentdetails"),i.finishButtonEntity.setAttribute("visible",!1)}),!1),this.el.parentElement.append(this.finishButtonEntity)},stopAndDownloadAudio:async function(){let t=await this.audioRecorder.stop();const e=document.createElement("a");document.body.appendChild(e),e.style="display: none",e.href=t.audioUrl,e.download="audio.webm",e.click(),window.URL.revokeObjectURL(t.audioUrl)},tick:function(){const i=this;this.runningExperiment&&this.data.timeLimitEnding&&Date.now()>this.recordedData.maxTime&&(this.recordedData.finishTime=this.recordedData.maxTime,this.recordedData.totalDuration=this.recordedData.finishTime-this.recordedData.startTime,this.runningExperiment=!1,this.data.forceFinishWhenTimeLimit?(alert("The time limit is done! Thank you!"),this.hideCharts(),e(i.recordedData,"experimentdetails"),i.finishButtonEntity.setAttribute("visible",!1),t(i),clearInterval(this.recordingData),i.audioRecorder&&i.stopAndDownloadAudio()):alert("The time limit is done, but you can continue doing the experiment, please, click on Finish when done!"))}});const i=()=>new Promise((t=>{navigator.mediaDevices.getUserMedia({audio:!0}).then((e=>{const i=new MediaRecorder(e),n=[];i.addEventListener("dataavailable",(t=>{n.push(t.data)})),t({start:()=>{i.start()},stop:()=>new Promise((t=>{i.addEventListener("stop",(()=>{const e=new Blob(n),i=URL.createObjectURL(e),r=new Audio(i);t({audioBlob:e,audioUrl:i,play:()=>{r.play()}})})),i.stop()}))})}))}))},3337:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-label",{schema:{text:{type:"string"},height:{type:"number",default:1},width:{type:"number",default:3},textWidth:{type:"number",default:6},color:{type:"color",default:"white"},font:{type:"string",default:"default"},background:{type:"color",default:"black"},align:{type:"string",default:"center"}},update:function(t){console.log("Starting label..."),this.el.setAttribute("geometry",{primitive:"plane",height:this.data.height,width:this.data.width}),this.el.setAttribute("material",{color:this.data.color}),this.el.setAttribute("text",{value:this.data.text,align:this.data.align,width:this.data.textWidth,color:this.data.background}),this.el.classList.add("babiaxrLegend")}})},577:()=>{var t,e=AFRAME.utils.debug,i=AFRAME.utils.coordinates,n=e("components:babia-lookat:warn"),r=i.isCoordinates||i.isCoordinate;delete AFRAME.components["babia-lookat"],AFRAME.registerComponent("babia-lookat",{schema:{default:"0 0 0",parse:function(t){return r(t)||"object"==typeof t?i.parse(t):t},stringify:function(t){return"object"==typeof t?i.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3,this.cameraListener=AFRAME.utils.bind(this.cameraListener,this),this.el.addEventListener("componentinitialized",this.cameraListener),this.el.addEventListener("componentremoved",this.cameraListener)},update:function(){var t,e=this,i=e.data;return!i||"object"==typeof i&&!Object.keys(i).length?e.remove():"object"==typeof i?this.lookAt(new THREE.Vector3(i.x,i.y,i.z)):(t=e.el.sceneEl.querySelector(i))?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",(function(){e.beginTracking(t)})):void n('"'+i+'" does not point to a valid entity to babia-lookat')},tick:(t=new THREE.Vector3,function(e){var i=this.target3D;i&&(i.getWorldPosition(t),this.lookAt(t))}),remove:function(){this.el.removeEventListener("componentinitialized",this.cameraListener),this.el.removeEventListener("componentremoved",this.cameraListener)},beginTracking:function(t){this.target3D=t.object3D},cameraListener:function(t){t.detail&&"camera"===t.detail.name&&this.update()},lookAt:function(t){var e=this.vector,i=this.el.object3D;this.el.getObject3D("camera")?e.subVectors(i.position,t).add(i.position):e.copy(t),i.lookAt(e)}})},7026:(t,e,i)=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const n=i(9590).NotiBuffer;AFRAME.registerComponent("babia-navigator",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,sliderEl:void 0,init:function(){this.notiBuffer=new n(this.registerBack.bind(this),this.unregisterBack.bind(this))},update:function(t){let e=this,i=this.data;if(i.state&&i.state!=t.state&&this.controlNavigator(i.state),i.direction&&i.direction!=t.direction&&this.controlNavigator(i.direction),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}document.addEventListener("controllerconnected",(t=>{controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))}))},initializeControls:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.min=0,this.sliderEl.max=this.selector.selectable.length-1,this.current=this.selector.selectable.current,this.sliderEl.setAttribute("babia-slider",{size:1.5,min:this.sliderEl.min,max:this.sliderEl.max,value:this.current}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="timeline",this.sliderEl.setAttribute("scale",{x:2.3,y:2.3,z:2.3}),this.el.appendChild(this.sliderEl),this.controlsEl=document.createElement("a-entity"),this.controlsEl.setAttribute("babia-controls",""),this.controlsEl.classList.add("babiaxraycasterclass"),this.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),this.controlsEl.object3D.position.y=-.5,this.el.appendChild(this.controlsEl),this.stepControllerEl=document.createElement("a-entity"),this.stepControllerEl.setAttribute("babia-step-controller",""),this.stepControllerEl.classList.add("babiaxraycasterclass"),this.stepControllerEl.object3D.position.x=2.5,this.el.appendChild(this.stepControllerEl),this.speedControllerEl=document.createElement("a-entity"),this.speedControllerEl.setAttribute("babia-speed-controller",""),this.speedControllerEl.classList.add("babiaxraycasterclass"),this.speedControllerEl.object3D.position.x=3,this.el.appendChild(this.speedControllerEl)},updateSlider:function(t){let e=this.sliderEl.getAttribute("babia-slider").value;"skipNext"===t?e++:"skipPrev"===t&&e--,"skipPrev"===t&&e>=0||"skipNext"===t&&e<=this.sliderEl.max?(this.current=e,this.notiBuffer.set("babiaSetPosition"+this.current)):this.controlsEl.querySelector(".babiaPause")&&(this.current=e,processData("pause"))},registerBack:function(t){this.selector=t,this.prodComponent=t,this.prodComponent.navNotiBuffer&&(this.navNotiBufferId=this.prodComponent.navNotiBuffer.register(this.processData.bind(this)))},unregisterBack:function(t){t.navNotiBuffer.unregister(this.navNotiBufferId)},processData:function(t){"pause"==t?this.controlsEl.setAttribute("babia-controls","state","pause"):"rewind"==t?this.el.setAttribute("babia-navigator","direction","rewind"):"forward"==t?this.el.setAttribute("babia-navigator","direction","forward"):t.type&&("position"===t.type?(this.sliderEl||this.initializeControls(),"rewind"!=this.data.direction?this.current=t.value-1:this.current=t.value+1,this.current>=this.sliderEl.min&&this.current<=this.sliderEl.max&&(t.label?this.sliderEl.setAttribute("babia-slider",{label:t.label,value:this.current}):this.sliderEl.setAttribute("babia-slider","value",this.current))):"step"===t.type?this.stepControllerEl.setAttribute("babia-step-controller","value",t.value):"speed"===t.type&&this.speedControllerEl.setAttribute("babia-speed-controller","value",t.value))},prodComponent:void 0,navNotiBufferId:void 0,sliderComp:void 0,controlsComp:void 0,stepComp:void 0,speedComp:void 0,controlNavigator:function(t,e){"skipNext"==t||"skipPrev"==t?this.updateSlider(t):this.notiBuffer.set(t+e)}});let r=(t,e)=>{let i=document.getElementById(e);t.el.setAttribute("scale",{x:.1,y:.1,z:.1}),t.el.setAttribute("position",{x:0,y:0,z:-.1}),t.el.setAttribute("rotation",{x:-60}),i.appendChild(t.el),t.el.removeChild(t.controlsEl),t.controlsEl=document.createElement("a-entity"),t.controlsEl.setAttribute("babia-controls",""),t.controlsEl.classList.add("babiaxraycasterclass"),t.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),t.controlsEl.object3D.position.y=-.5,t.el.appendChild(t.controlsEl),a(t.handController,t.el)},a=(t,e)=>{let i=!0;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},8630:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-poster",{schema:{title:{type:"string",default:"New Poster"},titleColor:{type:"string",default:"black"},titleFont:{type:"string",default:"mozillavr"},titleWrapCount:{type:"number",default:24},body:{type:"string",default:"This poster has no body yet."},bodyColor:{type:"string",default:"black"},bodyFont:{type:"string",default:"mozillavr"},bodyWrapCount:{type:"number",default:30},openOn:{type:"string",default:"click"},active:{type:"boolean",default:!0},openIconImage:{type:"asset",default:""},openIconRadius:{type:"number",default:.3},openIconColor:{type:"string",default:"white"},closeIconImage:{type:"asset",default:""},closeIconRadius:{type:"number",default:.3},closeIconColor:{type:"string",default:"white"},image:{type:"string",default:""},imageWidth:{type:"number",default:2},imageHeight:{type:"number",default:2},posterBoxWidth:{type:"number",default:4},posterBoxHeight:{type:"number",default:4},posterBoxColor:{type:"string",default:"white"},posterBoxPadding:{type:"number",default:.2}},multiple:!0,posterPlaneEl:null,closeIconEl:null,titleEl:null,bodyEl:null,imageEl:null,hasImage:!1,init(){this.cameraEl=document.querySelector("[camera]"),this.generateOpenIcon(),this.spawnEntities(),this.el.emit("loaded")},tick(){this.isOpen&&this.positionPosterPlane()},remove(){const{openOn:t}=this.data;this.el.removeEventListener(t,this.togglePosterOpen.bind(this)),this.closeIconEl.removeEventListener(t,this.togglePosterOpen.bind(this))},update(){this.generateTitle(),this.generateBody(),this.generateImage()},togglePosterOpen(t){t.target.getAttribute("id")===`${this.el.getAttribute("id")}--close-icon`&&(this.posterPlaneEl.setAttribute("visible",!1),this.isOpen=!1),this.data.active&&t.target.getAttribute("id")===this.el.getAttribute("id")&&(this.positionPosterPlane(),this.posterPlaneEl.setAttribute("visible",!0),this.isOpen=!0)},generateOpenIcon(){const{openIconRadius:t,openIconColor:e,openIconImage:i,openOn:n}=this.data;this.el.setAttribute("geometry",{primitive:"circle",radius:t}),this.el.setAttribute("material",{color:e,src:i}),this.el.addEventListener(n,this.togglePosterOpen.bind(this))},generateCloseIcon(){const{closeIconRadius:t,closeIconColor:e,closeIconImage:i,posterBoxWidth:n,posterBoxHeight:r,openOn:a}=this.data,o=document.createElement("a-entity");return o.setAttribute("id",`${this.el.getAttribute("id")}--close-icon`),o.setAttribute("position",{x:n/2,y:r/2,z:.01}),o.setAttribute("geometry",{primitive:"circle",radius:t}),o.setAttribute("material",{color:e,src:i}),o.addEventListener(a,this.togglePosterOpen.bind(this)),this.closeIconEl=o,o},generateTitle(){const{title:t,titleColor:e,titleFont:i,titleWrapCount:n,posterBoxWidth:r,posterBoxHeight:a,posterBoxPadding:o,imageHeight:s}=this.data,l=this.titleEl||document.createElement("a-entity");l.setAttribute("id",`${this.el.getAttribute("id")}--title`),l.setAttribute("text",{value:t.substring(0,n),color:e,font:i,wrapCount:n,width:r-2*o,baseline:"top",anchor:"left"});let c=a/2-o;return this.hasImage&&(c-=s/2),l.setAttribute("position",{x:-r/2+o,y:c,z:.01}),this.titleEl=l,l},generateBody(){const{body:t,bodyColor:e,bodyFont:i,bodyWrapCount:n,posterBoxWidth:r,posterBoxHeight:a,posterBoxPadding:o,imageHeight:s}=this.data,l=this.bodyEl||document.createElement("a-entity");l.setAttribute("id",`${this.el.getAttribute("id")}--title`),l.setAttribute("text",{value:t,color:e,font:i,wrapCount:n,width:r-2*o,baseline:"top",anchor:"left"});let c=a/2-3*o;return this.hasImage&&(c-=s/2),l.setAttribute("position",{x:-r/2+o,y:c,z:.01}),this.bodyEl=l,l},generateImage(){const{image:t,imageWidth:e,imageHeight:i,posterBoxHeight:n}=this.data;if(!t.length)return null;const r=this.imageEl||document.createElement("a-image");return r.setAttribute("id",`${this.el.getAttribute("id")}--image`),r.setAttribute("src",t),r.setAttribute("width",e),r.setAttribute("height",i),r.setAttribute("position",{x:0,y:n/2,z:.01}),this.hasImage=!0,this.imageEl=r,r},generatePosterPlane(){const{posterBoxWidth:t,posterBoxHeight:e,posterBoxPadding:i,posterBoxColor:n}=this.data,r=this.posterPlaneEl||document.createElement("a-entity");return r.setAttribute("id",`${this.el.getAttribute("id")}--poster-plane`),r.setAttribute("position",{x:0,y:0,z:.5}),r.setAttribute("visible",!1),r.setAttribute("geometry",{primitive:"plane",width:t+i,height:e+i}),this.generateImage()&&r.appendChild(this.generateImage()),r.setAttribute("material",{color:n}),r.appendChild(this.generateCloseIcon()),r.appendChild(this.generateTitle()),r.appendChild(this.generateBody()),this.posterPlaneEl=r,r},positionPosterPlane(){if(this.posterPlaneEl&&this.cameraEl){const t=new THREE.Vector3;this.cameraEl.object3D.getWorldPosition(t);const e=this.posterPlaneEl.object3D.parent.worldToLocal(t);this.posterPlaneEl.object3D.lookAt(e)}},spawnEntities(){this.el.appendChild(this.generatePosterPlane())}})},8566:(t,e,n)=>{if(n(1392).findTargetComponent,"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=n(9590).NotiBuffer;AFRAME.registerComponent("babia-range-selector",{schema:{from:{type:"string"},to:{type:"string"},defaultRange:{type:"string",default:"Last 5 years"}},multiple:!1,init:function(){this.notiBuffer=new r,this.options=[{label:"Last 15 minutes",time:9e5,interval:"30s"},{label:"Last 30 minutes",time:9e5,interval:"30s"},{label:"Last 1 hour",time:36e5,interval:"1m"},{label:"Last 4 hours",time:144e5,interval:"5m"},{label:"Last 12 hours",time:432e5,interval:"10m"},{label:"Last 24 hours",time:864e5,interval:"30m"},{label:"Last 7 days",time:6048e5,interval:"3h"},{label:"Last 30 days",time:2592e6,interval:"12h"},{label:"Last 60 days",time:5184e6,interval:"1d"},{label:"Last 90 days",time:7776e6,interval:"2d"},{label:"Last 6 months",time:15552e6,interval:"3d"},{label:"Last 1 year",time:31536e6,interval:"1w"},{label:"Last 2 years",time:63072e6,interval:"15d"},{label:"Last 5 years",time:15768e7,interval:"30d"}];let t=0;for(i=0;i<this.options.length;i++)if(this.data.defaultRange===this.options[i].label){t=i;break}this.label_select="babia-button-"+this.options[t].label.replaceAll(" ","-")},update:function(t){let e=this.data;this.updateInterface(e)},interface:void 0,options:void 0,handController:void 0,label_select:void 0,updateInterface:function(t){let e=this;for(;e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),a(e,e.handController)}else e.interface=o(e),e.el.appendChild(e.interface);document.addEventListener("controllerconnected",(t=>{for(;e.el.firstChild;)e.el.firstChild.remove();let i=t.detail.name;"left"!==t.target.getAttribute(i).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,e.interface=o(e),a(e,e.handController))}))}});let a=(t,e)=>{let i=document.getElementById(e),n=.03;t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:n,y:n,z:n}),t.interface.setAttribute("position",{x:-.05,y:-.05,z:-.1}),t.interface.setAttribute("rotation",{x:-60,y:0,z:0}),t.interface.setAttribute("visible",!1),i.appendChild(t.interface),c(e,t.interface)},o=t=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let e=7,i=0;return t.options.forEach((n=>{let r=s(t,n.label,i,e);t.interface.appendChild(r),e>1?--e:(i+=3.75,e=7)})),t.interface},s=(t,e,i,n)=>{let r=document.createElement("a-box");r.id="babia-button-"+e.replaceAll(" ","-"),r.classList.add("babiaxraycasterclass"),r.setAttribute("position",{x:i,y:n,z:0}),r.setAttribute("rotation",{x:0,y:0,z:0}),r.setAttribute("height",.8),r.setAttribute("width",3.5),r.setAttribute("depth",.01);let a=document.createElement("a-entity");return a.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),a.setAttribute("position","0 0 0.01"),r.appendChild(a),l(t,r),t.label_select==r.id&&r.emit("click"),r},l=(t,e)=>{e.addEventListener("mouseenter",(function(){e.children[0].setAttribute("text",{color:"#FFFFFF"}),e.setAttribute("color","#333333")})),e.addEventListener("mouseleave",(function(){e.children[0].setAttribute("text",{color:"black"}),t.label_select==e.id?e.setAttribute("color","#555555"):e.setAttribute("color","#FFFFFF")})),e.addEventListener("click",(function(){let i=document.getElementById(t.label_select);null!=i&&(i.children[0].setAttribute("text",{color:"black"}),i.setAttribute("color","#FFFFFF")),t.label_select=e.id,e.children[0].setAttribute("text",{color:"black"}),e.setAttribute("color","#555555");let n=t.label_select.slice(13).replaceAll("-"," ");t.options.forEach((e=>{if(e.label==n){let i=Date.now(),n={from:i-e.time,interval:e.interval,to:i};t.notiBuffer.set(n)}}))}))},c=(t,e)=>{let i=!1;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},6110:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-slider",{schema:{color:{type:"color",default:"#fff"},size:{type:"number",default:.5},min:{type:"number",default:-6},max:{type:"number",default:-4},value:{type:"number",default:-5},innerSize:{type:"number",default:.8},precision:{type:"number",default:2},vertical:{type:"boolean",default:!1},label:{type:"string"}},multiple:!0,init:function(){this.loader=new FontLoader.FontLoader;let t=new THREE.MeshBasicMaterial({color:this.data.color});this.material=t;let e=new THREE.Mesh(new THREE.BoxGeometry(.05,.15,.05),t),i=new THREE.Mesh(new THREE.CylinderGeometry(.03,.03,this.data.size,12),t);i.rotateZ(Math.PI/2);let n=new THREE.Group;this.lever=e,n.add(i),n.add(e),this.data.vertical&&n.rotateZ(Math.PI/2),this.el.setObject3D("mesh",n),this.el.classList.add("babiaxraycasterclass"),this.controllers=Array.prototype.slice.call(document.querySelectorAll("a-entity[hand-controls]")),this.fontURL="https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json",this.loader.load(this.fontURL,(t=>{this.font=t;let e=this.createTextGeometry(this.data.min,-this.data.size/2-.15,-.025),i=this.createTextGeometry(this.data.max,this.data.size/2+.08,-.025);n.add(e),n.add(i)}))},createTextGeometry:function(t,e,i){let n=new TextGeometry.TextGeometry(t.toString(),{font:this.font,size:.07,height:.01,curveSegments:12,bevelEnabled:!1}),r=new THREE.Mesh(n,this.material);return r.position.x=e,r.position.y=i,this.data.vertical&&(r.rotation.z=-Math.PI/2,r.position.y+=.05),r},setTextGeometry:function(t){this.textmesh&&(this.lever.children=[]),this.loader.load(this.fontURL,(e=>{this.font=e,this.data.vertical?this.textmesh=this.createTextGeometry(t,-.025,-.2):this.textmesh=this.createTextGeometry(t,-.025,.15),this.lever.add(this.textmesh)}))},play:function(){this.grabbed=!1,this.el.addEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.addEventListener("triggerdown",this.onTriggerDown.bind(this)),t.addEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},pause:function(){this.el.removeEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.removeEventListener("triggerdown",this.onTriggerDown.bind(this)),t.removeEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},onTriggerDown:function(t){var e=t.target.object3D,i=this.lever,n=(new THREE.Box3).setFromObject(e),r=(new THREE.Box3).setFromObject(i);if(n.intersectsBox(r)){let t=new THREE.Vector3;e.getWorldPosition(t);let n=new THREE.Vector3;i.getWorldPosition(n),t.distanceTo(n)<.1&&(this.grabbed=e,this.grabbed.visible=!1,this.knob.material=this.knobGrabbedMaterial)}},onTriggerUp:function(){this.grabbed&&(this.grabbed.visible=!0,this.grabbed=!1,this.knob.material=this.knobMaterial)},setValue:function(t){var e=this.lever;t<this.data.min?t=this.data.min:t>this.data.max&&(t=this.data.max),this.value=t,e.position.x=this.valueToLeverPosition(t),this.data.label?this.setTextGeometry(this.data.label):this.setTextGeometry(t)},valueToLeverPosition:function(t){var e=this.data.size*this.data.innerSize,i=Math.abs(this.data.max-this.data.min);let n=-1*e/2;return(t-this.data.min)*e/i+n},leverPositionToValue:function(t){var e=this.data.size*this.data.innerSize;return(t- -1*e/2)*Math.abs(this.data.max-this.data.min)/e+this.data.min},tick:function(){if(this.grabbed){var t=this.grabbed,e=this.lever,i=this.data.size*this.data.innerSize,n=(new THREE.Vector3).setFromMatrixPosition(t.matrixWorld);e.parent.worldToLocal(n),Math.abs(n.x)>i/2?e.position.x=i/2*Math.sign(e.position.x):e.position.x=n.x;var r=this.leverPositionToValue(e.position.x);Math.abs(this.value-r)>=Math.pow(10,-this.data.precision)&&(r=Math.round(r),this.value=r,this.setTextGeometry(r),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(r)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(r)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(r)))}},mousexPositionToValue:function(t){let e=new THREE.Vector3;this.el.object3D.getWorldPosition(e);let i=e.x,n=this.data.size*this.el.object3D.scale.x*this.el.parentEl.object3D.scale.x,r=Math.abs(this.data.max-this.data.min),a=i-n/2,o=i+n/2;if(t<a)return this.data.min;if(t>o)return this.data.max;let s=n/r,l=Math.floor((t-a)/s),c=this.data.min+l;return Math.min(Math.max(c,this.data.min),this.data.max)},mouseyPositionToValue:function(t){let e=new THREE.Vector3;this.el.object3D.getWorldPosition(e);let i=e.y,n=this.data.size*this.el.object3D.scale.y*this.el.parentEl.object3D.scale.y,r=Math.abs(this.data.max-this.data.min),a=i-n/2,o=i+n/2;if(t<a)return this.data.min;if(t>o)return this.data.max;let s=n/r,l=Math.floor((t-a)/s),c=this.data.min+l;return Math.min(Math.max(c,this.data.min),this.data.max)},update:function(t){this.data.value!==t.value&&this.setValue(this.data.value),this.el.addEventListener("click",_listener=t=>{let e,i=t.detail.intersection.point;e=this.data.vertical?this.mouseyPositionToValue(i.y):this.mousexPositionToValue(i.x),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(e)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(e)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(e))})}}),AFRAME.registerComponent("babia-step-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,step:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:10,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="step-controller",this.el.appendChild(this.sliderEl)},controlStep:function(t){this.step=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetStep",this.step)}}),AFRAME.registerComponent("babia-speed-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,speed:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:3,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="speed-controller",this.el.appendChild(this.sliderEl)},controlSpeed:function(t){this.speed=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetSpeed",this.speed)}})},4078:(t,e,i)=>{const{randFloatSpread:n}=i(8823);if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-task",{schema:{taskTitle:{type:"string",default:"Default task title"},taskDescription:{type:"string",default:"Default task text"},openTaskImg:{type:"string"},closeTaskImg:{type:"string"},taskAudio:{type:"boolean",default:!1},taskAudioUrl:{type:"string",default:null},taskVideo:{type:"boolean",default:!1},taskVideoId:{type:"string",default:null},taskVideoWidth:{type:"number",default:3},taskVideoHeight:{type:"number",default:1.75},offsetX:{type:"number",default:0},lookat:{type:"string",default:"[camera]"}},multiple:!0,recordedData:{},runningExperiment:!1,init:function(){},taskId:Math.random(),update:function(t){if(this.taskId=this.el.getAttribute("id"),this.data!=this.oldData){let t=this.el.sceneEl.querySelectorAll("[babia-camera]");if(t.length>0){this.babiaCameraEl=t[0];let e=this.babiaCameraEl.getAttribute("babia-camera");"string"==typeof e?this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:e.split("raycasterMouse:")[1].split(";")[0]+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,raycasterHand:e.split("raycasterHand:")[1].split(";")[0]+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,teleportCollision:e.split("teleportCollision:")[1].split(";")[0]}):null==e&&this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:this.babiaCameraEl.components["babia-camera"].attrValue.raycasterMouse+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,raycasterHand:this.babiaCameraEl.components["babia-camera"].attrValue.raycasterHand+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,teleportCollision:this.babiaCameraEl.components["babia-camera"].attrValue.teleportCollision})}else this.babiaCameraEl=this.el.sceneEl.camera.el;this.data.taskAudio?this.addAudioTask():this.data.taskVideo?this.addVideoTask():this.addTask()}},addTask:function(){let t,e,i;this.taskEntity=document.createElement("a-entity"),this.taskEntity.setAttribute("class","babiaxrayscasterclass"),this.taskEntity.setAttribute("id","babiaTaskPopup"+this.taskId),this.taskEntity.setAttribute("babia-poster",{openIconImage:"../assets/popups/info.jpg",closeIconImage:"../assets/popups/close.jpg",title:this.data.taskTitle,titleWrapCount:30,titleColor:"black",bodyColor:"black",posterBoxColor:"white",bodyFont:"roboto",posterBoxHeight:4.5,body:this.data.taskDescription}),this.babiaCameraEl.attributes.position?[t,e,i]=this.babiaCameraEl.attributes.position.value.split(" "):(t=0,e=0,i=0),this.taskEntity.setAttribute("position",{x:parseFloat(t)+this.data.offsetX,y:parseFloat(e)+1.5,z:parseFloat(i)-6}),this.taskEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskEntity)},audioPlaying:!1,addAudioTask:function(){const t=this;let e,i,n;this.taskAudioEntity=document.createElement("a-entity"),this.taskAudioEntity.setAttribute("class","babiaxrayscasterclass"),this.taskAudioEntity.setAttribute("geometry",{primitive:"plane",width:1.1,height:.5}),this.taskAudioEntity.setAttribute("text",{value:"Play audio!",color:"white",align:"center",wrapCount:30,width:3.6}),this.taskAudioEntity.setAttribute("id","babiaTaskAudio"+this.taskId),this.taskAudioEntity.setAttribute("sound",{src:`url(${t.data.taskAudioUrl})`}),this.taskAudioEntity.addEventListener("click",(function(e){t.audioPlaying?(t.audioPlaying=!1,t.taskAudioEntity.components.sound.stopSound(),t.taskAudioEntity.setAttribute("text","value","Play audio!")):(t.audioPlaying=!0,t.taskAudioEntity.components.sound.playSound(),t.taskAudioEntity.setAttribute("text","value","Stop audio!"))}),!1),this.taskAudioEntity.addEventListener("sound-ended",(function(e){t.audioPlaying=!1,t.taskAudioEntity.setAttribute("text","value","Play audio!")}),!1),this.babiaCameraEl.attributes.position?[e,i,n]=this.babiaCameraEl.attributes.position.value.split(" "):(e=0,i=0,n=0),this.taskAudioEntity.setAttribute("position",{x:parseFloat(e)+this.data.offsetX,y:parseFloat(i)+3,z:parseFloat(n)-6}),this.taskAudioEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskAudioEntity)},videoPlaying:!1,addVideoTask:function(){const t=this;let e,i,n;this.taskVideoEntity=document.createElement("a-video"),this.taskVideoEntity.setAttribute("class","babiaxrayscasterclass"),this.taskVideoEntity.setAttribute("id","babiaTaskVideo"+this.taskId),this.taskVideoEntity.setAttribute("src",t.data.taskVideoId),this.taskVideoStream=document.querySelector(t.data.taskVideoId),this.taskVideoEntity.setAttribute("width",t.data.taskVideoWidth),this.taskVideoEntity.setAttribute("height",t.data.taskVideoHeight),this.taskVideoEntity.addEventListener("click",(function(e){t.videoPlaying?(t.videoPlaying=!1,t.taskVideoStream.pause()):(t.videoPlaying=!0,t.taskVideoStream.play())}),!1),this.babiaCameraEl.attributes.position?[e,i,n]=this.babiaCameraEl.attributes.position.value.split(" "):(e=0,i=0,n=0),this.taskVideoEntity.setAttribute("position",{x:parseFloat(e)+this.data.offsetX,y:parseFloat(i)+3,z:parseFloat(n)-6}),this.taskVideoEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskVideoEntity)},tick:function(){}})},4738:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui-link",{schema:{viz:{type:"string"},ui:{type:"string"}},linked_viz:void 0,ui_target:void 0,init:function(){this.createButton()},update:function(i){let n=this,r=this.data;e(r,n.el,n),t(r,n.el,n),console.log("VIZ",n.linked_viz)},createButton:function(){this.button=document.createElement("a-entity"),this.button.classList.add("babiaxraycasterclass"),this.button.setAttribute("geometry",{primitive:"plane",height:1,width:3}),this.button.setAttribute("material",{color:"#FFF"}),this.button.setAttribute("text",{value:"Manage me",align:"center",width:8,color:"#000"}),this.button.setAttribute("position",{x:0,y:-1,z:0}),this.addListeners(this.button,this),this.el.appendChild(this.button)},addListeners:function(t,e){t.addEventListener("mouseenter",(function(){t.setAttribute("text",{color:"#FFF"}),t.setAttribute("material",{color:"#333"})})),t.addEventListener("mouseleave",(function(){t.setAttribute("text",{color:"#000"}),t.setAttribute("material",{color:"#FFF"})})),t.addEventListener("click",(function(){let t=document.querySelector("#"+e.ui_target);console.log(e.linked_viz),t.setAttribute("babia-ui","target",e.linked_viz)}))}});let t=(t,e,i)=>t.ui?void(i.ui_target=t.ui):e.components["babia-ui"]?void(i.ui_target=e.components["babia-ui"]):document.querySelectorAll("[babia-ui]").length>0?void(i.ui_target=document.querySelectorAll("[babia-ui]")[0].id):void console.error("UI Component not found."),e=(t,e,i)=>{if(!t.viz)return e.components["babia-bars"]||e.components["babia-barsmap"]||e.components["babia-boats"]||e.components["babia-bubbles"]||e.components["babia-city"]||e.components["babia-cyls"]||e.components["babia-cylsmap"]||e.components["babia-doughnut"]||e.components["babia-network"]||e.components["babia-pie"]?void(i.linked_viz=e.id):void console.error("Visuzlizer not found.");i.linked_viz=t.viz}},6173:(t,e,i)=>{let n=i(1392).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui",{schema:{target:{type:"string"},hideFields:{type:"array"},hideRows:{type:"array"},showOnly:{type:"array"},maxPerRow:{type:"number",default:5},linesSeparation:{type:"number",default:.3},customQuerierLabel:{type:"string",default:"Data"},customAttributeSwitch:{type:"array"},customAttributeLabel:{type:"array"}},multiple:!1,init:function(){console.log("WELCOME TO UI: Control your data.")},update:function(t){let e=this.data;this.targetComponent&&this.targetComponent.notiBuffer.unregister(this.notiBufferId),this.targetComponent=n(e,this),this.findQuerierComponents(this),this.targetComponent.visProperties&&(this.targetComponentVisProperties=this.targetComponent.visProperties),this.targetComponent.notiBuffer&&(this.notiBufferId=this.targetComponent.notiBuffer.register(this.updateInterface.bind(this)))},targetComponent:void 0,targetComponentVisProperties:void 0,dataMetrics:void 0,interface:void 0,dataQueriers:void 0,handController:void 0,nodesQueriers:void 0,linksQueriers:void 0,updateInterface:function(t){let e=this;for(t&&a(e,t,e.targetComponentVisProperties);e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}else e.interface=s(e,e.dataMetrics,e.el);document.addEventListener("controllerconnected",(t=>{for(;e.el.firstChild;)e.el.firstChild.remove();controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))}))},findQuerierComponents:function(){this.targetComponent.el.components["babia-network"]&&(this.targetComponent.el.components["babia-network"].data.nodesFrom||this.targetComponent.el.components["babia-network"].data.nodes)?(console.log("nodesFrom or nodes"),this.nodesQueriers=[],this.linksQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach((t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&(this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id))})),document.querySelectorAll("[babia-queryes]").forEach((t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)})),document.querySelectorAll("[babia-querygithub]").forEach((t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)})),document.querySelectorAll("[babia-filter]").forEach((t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)}))):this.targetComponent.el.components["babia-boats"]?(this.dataQueriers=[],document.querySelectorAll("[babia-treebuilder]").forEach((t=>{this.dataQueriers.push(t.id)}))):(this.dataQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach((t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&this.dataQueriers.push(t.id)})),document.querySelectorAll("[babia-queryes]").forEach((t=>{this.dataQueriers.push(t.id)})),document.querySelectorAll("[babia-querygithub]").forEach((t=>{this.dataQueriers.push(t.id)})),document.querySelectorAll("[babia-filter]").forEach((t=>{this.dataQueriers.push(t.id)})))},hideAndInsertMetrics:function(t,e,i){const n=this;let r={property:e,metrics:i};if(0!=n.data.hideFields.length){let t=[];i.forEach((e=>{n.data.hideFields.includes(e)||t.push(e)})),r.metrics=t}if(n.data.showOnly.length>0){let t=[];for(let i=0;i<n.data.showOnly.length;i++){const r=n.data.showOnly[i].split(":");e==r[0]&&t.push(r[1])}r.metrics=t}n.data.hideRows.includes(e)||t.push(r)}});let r=(t,e)=>{let i=document.getElementById(e),n=.03;t.interface=s(t,t.dataMetrics,i),t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:n,y:n,z:n}),t.interface.setAttribute("position",{x:-.03*t.interface.width/2,y:n*t.interface.height/2,z:-.1}),t.interface.setAttribute("rotation",{x:-60}),p(t.handController,t.interface)},a=(t,e,i)=>{if("babia-network"==t.targetComponent.attrName)if(e.nodes){t.dataMetrics={nodes:[],links:[]};let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=o(e.nodes[0]),Object.keys(n).forEach((t=>{"number"==typeof n[t]&&a.push(t)})),i.nodes.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics.nodes,i,a):t.hideAndInsertMetrics(t.dataMetrics.nodes,i,Object.keys(e.nodes[0]))})),i.links1.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics.links,i,a):t.hideAndInsertMetrics(t.dataMetrics.links,i,Object.keys(e.links[0]))}))}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=o(e[0]),Object.keys(n).forEach((t=>{"number"==typeof n[t]&&a.push(t)})),i.nodes.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics,i,a):t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))})),i.links0.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics,i,a):t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))}))}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth","color"],a=[];n="babia-city"==t.targetComponent.attrName?o(e):"babia-boats"==t.targetComponent.attrName?o(e[0]):e[0],Object.keys(n).forEach((t=>{"number"==typeof n[t]&&a.push(t)})),i.forEach((i=>{if(r.includes(i)){if(t.hideAndInsertMetrics(t.dataMetrics,i,a),"color"===i&&"babia-boats"==t.targetComponent.attrName){let e=[];for(const[t,i]of Object.entries(n))"string"==typeof i&&e.push(t);t.data.showOnly||t.hideAndInsertMetrics(t.dataMetrics,i,e)}}else t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))}))}},o=t=>(t.children?child=o(t.children[0]):child=t,child),s=(t,e,i)=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let n=0,r=0,a=0;if(t.data.customAttributeSwitch.length>0){t.data.customAttributeLabel&&(t.customAttributesLabel={},t.data.customAttributeLabel.forEach((e=>{let i=e.split(":");Object.defineProperty(t.customAttributesLabel,i[0],{value:i[1]})})));let e=h("Atrributes",r,n);t.interface.appendChild(e),t.data.customAttributeSwitch.forEach(((e,i)=>{let a=e.split(":");r+=3.25;let o=u(t,a,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(i+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,--n,a<r&&(a=r),r=0}if(t.targetComponent.el.components["babia-network"]&&(t.targetComponent.el.components["babia-network"].data.nodesFrom||t.targetComponent.el.components["babia-network"].data.nodes)){if(t.nodesQueriers.length>1){let e=h("Nodes",r,n);t.interface.appendChild(e),t.nodesQueriers.forEach(((e,i)=>{r+=3.25;let a=d(t,e,r,n,"nodes");a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a),(i+1)%t.data.maxPerRow==0&&(--n,r=0)}))}if(--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,t.linksQueriers.length>1){let e=h("Links",r,n);t.interface.appendChild(e),t.linksQueriers.forEach(((e,i)=>{r+=3.25;let a=d(t,e,r,n,"links");a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a),(i+1)%t.data.maxPerRow==0&&(--n,r=0)}))}--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,e.nodes.forEach((e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(((i,a)=>{r+=3.25;let o=l(t,e.property,i,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(a+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,a<r&&(a=r),r=0})),e.links.forEach((e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(((i,a)=>{r+=3.25;let o=l(t,e.property,i,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(a+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,a<r&&(a=r),r=0}))}else{if(t.dataQueriers.length>1){let e=h(t.data.customQuerierLabel,r,n);t.interface.appendChild(e),t.dataQueriers.forEach((e=>{r+=3.25;let i=d(t,e,r,n);i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)}))}--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,e.forEach((e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(((i,a)=>{r+=3.25;let o=l(t,e.property,i,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(a+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0}))}return t.interface.width=a+3,t.interface.height=Math.abs(n),t.interface.setAttribute("position",{x:-t.interface.width/2,y:t.interface.height,z:0}),i.appendChild(t.interface),t.interface},l=(t,e,i,n,r)=>{let a=document.createElement("a-box");a.property=e,a.metric=i,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:n,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let o=document.createElement("a-entity");return o.setAttribute("text",{value:i,align:"center",width:"10",color:"black"}),o.setAttribute("position","0 0 0.01"),a.appendChild(o),t.targetComponent.data[e]==i&&a.setAttribute("color","#555555"),c(a,t.targetComponent,!1),a},c=(t,e,i)=>{t.addEventListener("mouseenter",(function(){t.children[0].setAttribute("text",{color:"#FFFFFF"}),t.setAttribute("color","#333333")})),i?t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data.from==t.from?t.setAttribute("color","#555555"):""!=e.data.from&&e.data.from==t.from||t.setAttribute("color","#FFFFFF")})):t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data[t.property]==t.metric?t.setAttribute("color","#555555"):t.setAttribute("color","#FFFFFF")})),t.addEventListener("click",(function(){t.property&&t.metric?("babia-boats"==e.attrName&&"area"==t.property?(e.el.removeAttribute(e.attrName,"width"),e.el.removeAttribute(e.attrName,"depth")):"babia-boats"!=e.attrName||"width"!=t.property&&"depth"!=t.property||!e.el.getAttribute("babia-boats").area||(e.el.removeAttribute(e.attrName,"area"),"width"==t.property?e.el.setAttribute(e.attrName,"depth",t.metric):e.el.setAttribute(e.attrName,"width",t.metric)),e.el.setAttribute(e.attrName,t.property,t.metric)):t.from?e.el.setAttribute(e.attrName,"from",t.from):t.nodes?e.el.setAttribute(e.attrName,"nodesFrom",t.nodes):t.links&&e.el.setAttribute(e.attrName,"linksFrom",t.links)}))},h=(t,e,i)=>{let n=document.createElement("a-plane");return n.setAttribute("position",{x:e,y:i,z:0}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("height",.8),n.setAttribute("width",3),n.setAttribute("text",{value:t,align:"center",width:"10",color:"#FFFFFF"}),n.setAttribute("color","black"),n},d=(t,e,i,n,r)=>{let a=document.createElement("a-box");"nodes"==r?a.nodes=e:"links"==r?a.links=e:a.from=e,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:i,y:n,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let o=document.createElement("a-entity");return o.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),o.setAttribute("position","0 0 0.01"),a.appendChild(o),t.targetComponent.prodComponent&&t.targetComponent.prodComponent.el.id==e?a.setAttribute("color","#555555"):a.setAttribute("color","#FFFFFF"),c(a,t.targetComponent,!0),a},u=(t,[e,i],n,r)=>{let a=document.createElement("a-box");a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:n,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let o=document.createElement("a-entity"),s=e;return t.customAttributesLabel&&t.customAttributesLabel[e]&&(s=t.customAttributesLabel[e]),o.setAttribute("text",{value:s,align:"center",width:"10",color:"white"}),o.setAttribute("position","0 0 0.01"),a.appendChild(o),a.setAttribute("color","blue"),a.addEventListener("click",(function(){let n=t.targetComponent.el.getAttribute(t.targetComponent.attrName);n[e]&&n[e]==i?t.targetComponent.el.removeAttribute("babia-boats",e):t.targetComponent.el.setAttribute("babia-boats",e,i)})),a},p=(t,e)=>{let i=!0;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},4483:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-debug-data",{schema:{inputEvent:{type:"string"}},multiple:!1,init:function(){let e=this.data,i=this.el;e.input&&e.output&&t(e,i)},update:function(e){let i=this.data,n=this.el;i!==e&&i.inputEvent!==e.inputEvent&&(console.log("Change event because from has changed"),n.removeEventListener(i.inputEvent,(function(t){})),t(i,n))},remove:function(){},pause:function(){},play:function(){}});let t=(t,i)=>{i.addEventListener(t.inputEvent,(function(n){e(t,i)}))},e=(t,e)=>{if(!e.querySelector(".debug-data")){let t=function(t,e,i){let n=document.createElement("a-plane");n.setAttribute("color","white"),n.setAttribute("class","debug_data"),n.setAttribute("width",10),n.setAttribute("height",10);let r=e.getAttribute("position"),a=0,o=0;e.getAttribute("geometry")&&("box"===e.components.geometry.data.primitive?(a=e.getAttribute("geometry").width/2,o=e.getAttribute("geometry").height/2):"sphere"===e.components.geometry.data.primitive?a=e.getAttribute("geometry").radius:(a=0,o=0)),n.setAttribute("position",{x:r.x+a+5,y:0-o+5,z:r.z});let s=document.createElement("a-text");return s.setAttribute("value",JSON.stringify(i)),s.setAttribute("width",10),s.setAttribute("height",10),s.setAttribute("color","black"),s.setAttribute("position",{x:0-n.getAttribute("width")/2,y:0-e.getAttribute("height")/2,z:0}),n.appendChild(s),n}(0,e,e.getAttribute("babiaData"));e.appendChild(t)}}},9632:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let t,e,i;var n;AFRAME.registerComponent("babiaxr-event-controller",{schema:{navigation:{type:"string"},targets:{type:"string"}},multiple:!1,init:function(){},update:function(f){t=this.el;let g=this.data;e=g.navigation,i=JSON.parse(g.targets),function(e){let i=document.getElementById(e).getAttribute("babiaxr-navigation-bar").commits;if(i&&l){n=JSON.parse(i);for(let t in n)r.push(n[t]);if(r.reverse(),s){let t=n.length-1-c;a=r[c],o=t}else a=n[c],o=c;l=!1,h(s?r:n),document.addEventListener("babiaxrShow",(function(e){!function(t){for(let e in n)if(n[e].commit==t.commit){a=n[e],p(e),o=e;break}u()}(e.detail.data),t.emit("babiaxrStop")})),document.addEventListener("babiaxrContinue",(function(){console.log("PLAY"),h(s?r:n)})),document.addEventListener("babiaxrToPresent",(function(){console.log("TO PRESENT"),s=!1,t.emit("babiaxrStop"),h(n)})),document.addEventListener("babiaxrToPast",(function(){console.log("TO PAST"),s=!0,t.emit("babiaxrStop"),h(r)})),document.addEventListener("babiaxrSkipNext",(function(){console.log("SKIP NEXT"),t.emit("babiaxrStop"),d("next")})),document.addEventListener("babiaxrSkipPrev",(function(){console.log("SKIP PREV"),t.emit("babiaxrStop"),d("prev")}))}}(e)},remove:function(){},pause:function(){},play:function(){}});var r=[];let a,o,s=!1,l=!0,c=0;function h(e){let i=0;for(let t in e)e[t]==a&&(i=parseInt(t)+1);let n=setInterval((function(){if(i<e.length){if(a=e[i],s){let t=e.length-1-i;p(t),o=t}else p(i),o=i;u(),i++,document.addEventListener("babiaxrStop",(function(){clearInterval(n)})),i==e.length&&document.getElementsByClassName("babiaxrPause")[0].emit("click")}else t.emit("babiaxrStop")}),3e3)}function d(t){for(let e in n)if(n[e]==a){"next"==t&&e<n.length-1?e++:"prev"==t&&e>=1&&e--,a=n[e],p(e),o=e;break}u()}function u(){let t=document.getElementById(a.commit).getAttribute("babiadata");for(let e in i){let n=document.getElementById(i[e].id);n&&n.setAttribute("babiaxr-vismapper","dataToShow",t)}}function p(t){let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;(o||0==o)&&e[o].emit("removeinfo"),e[t].emit("showinfo")}},6363:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-interaction-mapper",{schema:{input:{type:"string"},output:{type:"string"}},multiple:!1,init:function(){let e=this.data,i=this.el;e.input&&e.output&&t(e,i)},update:function(e){let i=this.data,n=this.el;i!==e&&(i.input===e.input&&i.output===e.output||(console.log("Change event because from has changed"),n.removeEventListener(e.input,(function(t){})),t(i,n)))},remove:function(){},pause:function(){},play:function(){}});let t=(t,e)=>{e.addEventListener(t.input,(function(i){e.emit(t.output,i,!1)}))}},9825:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let t,e,n,r,a,o,s,l,c,h,d;function u(t){let e=document.createElement("a-sphere");var i;return e.setAttribute("radius",.05),e.setAttribute("material",{color:"#FF0000"}),function(t,e){let i,n;t.addEventListener("mouseenter",(function(){l=this.getAttribute("material").color,this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),this.setAttribute("material",{color:"#AAAA00"}),n=p(e),this.appendChild(n)})),t.addEventListener("showinfo",(function(){i=p(e),this.setAttribute("material",{color:"#00AA00"}),this.appendChild(i)})),t.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),this.setAttribute("material",{color:l}),this.removeChild(n)})),t.addEventListener("removeinfo",(function(){i&&(this.removeChild(i),this.setAttribute("material",{color:"#FF0000"}))}))}(e,t),i=t,e.addEventListener("click",(function(){this.setAttribute("material",{color:"#00AA00"}),l=this.getAttribute("material").color,o.emit("babiaxrShow",{data:i}),document.getElementsByClassName("babiaxrPause")[0]&&(a.removeChild(r),a.appendChild(n))})),e}function p(t){let e="",i=[];i.push("Date: "+t.date+"\n"),i.push("commit: "+t.commit+"\n");let n=1;for(let t of i)t.length>10&&n<t.length/2&&(n=t.length/7),e+=t;let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:.4,z:.1}),r.setAttribute("scale",{x:.5,y:.5,z:1}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e,align:"center",width:6,color:"black"}),r.setAttribute("material",{opacity:.6}),r}function f(t){let e=t.length,n=[];const r=.11;for(i=0;i<e;i++){let e=r*t[i][0],a=r*t[i][1],o=r*t[i][2],s=new THREE.Vector3(e,a,o);n.push(s)}let a=new THREE.Shape(n),o=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),s=new THREE.ExtrudeGeometry(a,{depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1});return new THREE.Mesh(s,o)}function g(t){t.addEventListener("mouseenter",(function(){s=Object.assign({},this.object3DMap.mesh.material.color),this.object3DMap.mesh.material.color={r:170/255,g:170/255,b:170/255}})),t.addEventListener("mouseleave",(function(){this.object3DMap.mesh.material.color=s}))}function m(t,e){t.addEventListener("click",(function(){t.classList.contains("babiaxrPlay")?(a.removeChild(t),a.appendChild(r)):t.classList.contains("babiaxrPause")?(a.removeChild(r),a.appendChild(n)):t.classList.contains("babiaxrSkipNext")||t.classList.contains("babiaxrSkipPrev")?document.getElementsByClassName("babiaxrPause")[0]&&(a.removeChild(r),a.appendChild(n)):t.classList.contains("babiaxrForward")?(s={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrRewind")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}):t.classList.contains("babiaxrRewind")&&(s={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrForward")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}),console.log("Emit..... "+e),o.emit(e)}))}AFRAME.registerComponent("babiaxr-navigation-bar",{schema:{commits:{type:"string"},size:{type:"number",default:"5"},points_by_line:{type:"number",default:"5"},to:{type:"string",default:"left"},start_point:{type:"number",default:"0"}},multiple:!1,init:function(){let s=this.data;o=this.el,t=JSON.parse(s.commits),e=s.size,c=s.to,h=s.start_point,d=s.points_by_line;let l=function(t,e,i){let n=document.createElement("a-entity");n.classList.add("babiaxrTimeBar");let r=0,a=Math.ceil(t.length/i)/5-.2,o=e/(i-1),s=0,l=1;for(let e in t){let c=u(t[e]);c.classList.add("babiaxraycasterclass"),c.setAttribute("position",{x:r,y:a,z:0}),n.appendChild(c),e%i==i-1&&e!=t.length-1?(l++,a-=.2,r=0):e!=t.length-1&&(r+=o),s=r}for(let t=0;t<l;t++){let i=document.createElement("a-entity");0!=s&&0==t||1==d||0==s&&0==t?i.setAttribute("line",{start:"0 "+a+" 0",end:s+" "+a+" 0",color:"#FF0000"}):i.setAttribute("line",{start:"0 "+a+" 0",end:e+" "+a+" 0",color:"#FF0000"}),a+=.2,n.appendChild(i)}return n}(t,e,d);this.el.appendChild(l),a=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPlayer"),t.setAttribute("position",{x:(e-5)/2,y:0,z:0}),t.classList.add("babiaxraycasterclass"),n=function(t){let e=document.createElement("a-entity");e.classList.add("babiaxrPlay");let i=f([[0,0,0],[0,3,0],[2.5,1.5,0],[0,0,0]]);return e.setObject3D("mesh",i),m(e,"babiaxrContinue"),g(e),e}(),n.setAttribute("position",{x:2.35,y:-.65,z:0}),n.classList.add("babiaxraycasterclass"),r=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPause");let e=function(t,e){let n=t.length,r=e.length,a=[],o=[];const s=.11;for(i=0;i<n;i++){let e=s*t[i][0],n=s*t[i][1],r=s*t[i][2],o=new THREE.Vector3(e,n,r);a.push(o)}for(i=0;i<r;i++){let t=s*e[i][0],n=s*e[i][1],r=s*e[i][2],a=new THREE.Vector3(t,n,r);o.push(a)}let l=new THREE.Shape(a),c=new THREE.Shape(o),h={depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1},d=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),u=new THREE.ExtrudeGeometry(l,h),p=new THREE.ExtrudeGeometry(c,h),f=new THREE.Mesh(u,d);return f.updateMatrix(),p.merge(f.geometry,f.matrix),new THREE.Mesh(p,d)}([[0,0,0],[0,3,0],[1,3,0],[1,0,0],[0,0,0]],[[1.5,0,0],[1.5,3,0],[2.5,3,0],[2.5,0,0],[1.5,0,0]]);return t.setObject3D("mesh",e),m(t,"babiaxrStop"),g(t),t}(),r.setAttribute("position",{x:2.35,y:-.65,z:0}),r.classList.add("babiaxraycasterclass"),t.appendChild(r);let a=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrRewind");let e=f([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),"left"==c&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255}),m(t,"babiaxrToPast"),g(t),t}();a.setAttribute("position",{x:1.25,y:-.65,z:0}),a.classList.add("babiaxraycasterclass"),t.appendChild(a);let o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrForward");let e=f([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),"right"==c&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255}),m(t,"babiaxrToPresent"),g(t),t}();o.setAttribute("position",{x:3.7,y:-.65,z:0}),o.classList.add("babiaxraycasterclass"),t.appendChild(o);let s=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipPrev");let e=f([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),m(t,"babiaxrSkipPrev"),g(t),t}();s.setAttribute("position",{x:1.95,y:-.65,z:0}),s.classList.add("babiaxraycasterclass"),t.appendChild(s);let l=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipNext");let e=f([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),m(t,"babiaxrSkipNext"),g(t),t}();return l.setAttribute("position",{x:3,y:-.65,z:0}),l.classList.add("babiaxraycasterclass"),t.appendChild(l),t}(),this.el.appendChild(a),function(){let t=document.getElementsByClassName("babiaxrTimeBar")[0].children;for(let e in t)e==h&&t[e].emit("showinfo")}()},update:function(t){},remove:function(){},pause:function(){},play:function(){}})},8628:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-totem",{schema:{charts_id:{type:"string"},data_list:{type:"string"}},multiple:!1,init:function(){let i=this.data,a=this.el;t=a.id,i&&(r.push({id:a.id,charts_id:JSON.parse(i.charts_id)}),i.data_list&&(e=JSON.parse(i.data_list),function(t){let e=new THREE.FileLoader;for(let i of t)if(i.from_querier){let t=document.getElementById(i.from_querier);if(t.getAttribute("babiaData")){let e=JSON.parse(t.getAttribute("babiaData"));n.push({file:e,path:i.from_querier})}else t.addEventListener("dataReady"+i.from_querier,(function(t){n.push({file:t.detail,path:i.from_querier})}))}else if(i.path){let t=i.path;e.load(t,(function(e){n.push({file:e,path:t})}),(function(e){console.log(t.toString()+": "+e.loaded/e.total*100+"% loaded")}),(function(t){console.error("An error happened")}))}}(e)))},update:function(t){let e=this.data;if(i=this.el,e!==t){for(;this.el.firstChild;)this.el.firstChild.remove();console.log("Generating totemchart..."),a(i)}},remove:function(){},pause:function(){},play:function(){}});let t,e,i,n=[],r=[],a=t=>{n&&function(t,e){console.log("Generating Totem...");let i=7.5;e.length%2==1&&(i+=Math.trunc(e.length/2));let n=function(t){let e=5;for(let i of t)i.data&&(i=i.data),i.length>10&&e<i.length/4&&(e=i.length/4);return e}(e);document.createElement,function(t,e,i,n,r,a,o){let s=document.createElement("a-plane");s.setAttribute("class","title"),s.setAttribute("position",{x:-3,y:i,z:6}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height",1),s.setAttribute("width",a),s.setAttribute("color","blue"),s.setAttribute("text",{value:"Select Data",align:"center",width:"10",color:"white"}),t.appendChild(s)}(t,0,i,0,0,n),i-=1,function(t,e,i,n,r,a,s,l){for(let e of s){e.data&&(e=e.data);let n=document.createElement("a-plane");n.setAttribute("position",{x:-3,y:i,z:6}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("height",1),n.setAttribute("width",a),n.setAttribute("text",{value:e,align:"center",width:"10"}),n.setAttribute("color","white"),n.setAttribute("text",{color:"black"}),t.appendChild(n),i-=1,n.classList.add("babiaxraycasterclass"),n.addEventListener("click",(function(){let t=n.parentElement.id,i=n.parentElement.children;l=e;for(let e of s)(e.path||e.from_querier)&&l==e.data&&o(e.path||e.from_querier,t);for(let t in i)i[t]===n?(n.setAttribute("color","black"),n.setAttribute("text",{color:"white"})):i[t].id||"title"!==i[t].className&&(i[t].setAttribute("color","white"),i[t].setAttribute("text",{color:"black"}))}))}}(t,0,i,0,0,n,e)}(t,e)};function o(t,e){var i;i=e,document.getElementById(i);for(let i in r)if(e==r[i].id){let e=r[i].charts_id;for(obj in e){let i,r=e[obj].type,a=e[obj].id;for(let e in n)n[e].path==t&&(i=n[e].file,"babiaxr-vismapper"===r?document.getElementById(a).setAttribute(r,"dataToShow",JSON.stringify(i)):document.getElementById(a).setAttribute(r,"data",i))}}}},1392:t=>{const e={palettes:{blues:["#142850","#27496d","#00909e","#dae1e7"],foxy:["#f79071","#fa744f","#16817a","#024249"],flat:["#120136","#035aa6","#40bad5","#fcbf1e"],sunset:["#202040","#543864","#ff6363","#ffbd69"],bussiness:["#de7119","#dee3e2","#116979","#18b0b0"],icecream:["#f76a8c","#f8dc88","#f8fab8","#ccf0e1"],ubuntu:["#511845","#900c3f","#c70039","#ff5733"],pearl:["#efa8e4","#f8e1f4","#fff0f5","#97e5ef"],commerce:["#222831","#30475e","#f2a365","#ececec"],bluesextra:["#00429d","#09459e","#1147a0","#174aa1","#1c4da2","#214fa3","#2552a5","#2855a6","#2c57a7","#2f5aa8","#335daa","#3660ab","#3962ac","#3b65ad","#3e68ae","#416bb0","#446eb1","#4670b2","#4973b3","#4c76b4","#4e79b6","#517cb7","#537eb8","#5681b9","#5884ba","#5b87bc","#5d8abd","#608dbe","#6290bf","#6593c0","#6895c1","#6a98c2","#6d9bc4","#6f9ec5","#72a1c6","#74a4c7","#77a7c8","#7aaac9","#7cadca","#7fb0cb","#82b3cc","#84b5cd","#87b8ce","#8abbcf","#8dbed0","#90c1d1","#93c4d2","#96c7d3","#99cad4","#9ccdd5","#9fd0d6","#a2d3d7","#a5d5d8","#a9d8d9","#acdbda","#b0dedb","#b4e1db","#b7e4dc","#bbe6dd","#c0e9de","#c4ecde","#c8efdf","#cdf1e0","#d2f4e0","#d7f6e1","#ddf9e1","#e4fbe1","#ebfde1","#f3fee1","#ffffe0"],ubuntuextra:["#511845","#541845","#581844","#5b1844","#5e1744","#621744","#651743","#681743","#6b1743","#6e1643","#711642","#741642","#771642","#7a1641","#7d1541","#801541","#831541","#861540","#891540","#8c1540","#8f1540","#92153f","#94163f","#97163f","#9a163f","#9d173e","#9f173e","#a2183e","#a5183e","#a7193d","#aa1a3d","#ac1a3d","#af1b3d","#b21c3d","#b41d3c","#b71e3c","#b9203c","#bb213c","#be223b","#c0233b","#c3253b","#c5263b","#c7273b","#ca293a","#cc2a3a","#ce2c3a","#d02e3a","#d32f39","#d53139","#d73239","#d93439","#db3638","#dd3738","#e03938","#e23b38","#e43d37","#e63e37","#e84037","#ea4236","#ec4436","#ee4636","#f04836","#f24a35","#f44b35","#f64d35","#f84f34","#f95134","#fb5334","#fd5533","#ff5733"],ubuntudiver:["#511845","#711643","#8d1640","#a81b3f","#c1253d","#d7333a","#ec4437","#ff5733","#ffdac4","#ffb3a7","#fb8a8c","#eb6574","#d5405e","#b81b4a","#93003a"],bluesdiver:["#00429d","#325da9","#4e78b5","#6694c1","#80b1cc","#9dced6","#c0eade","#ffffe0","#f2f0e4","#e5e1e8","#d7d3eb","#c8c5ed","#b8b7ef","#a5aaf0","#6ea9da"],categoric:["#ffb75f","#8e009a","#5c2800","#ff95ff","#a69fff","#da8800","#073479","#ffff00","#00d3ff","#b60026","#00a59d","#7e0000","#0099cc","#ff8080","#7491eb","#365e00","#743570","#00805e","#570000","#00629c","#6d4e00","#002c47","#95824d","#001b2b","#006020","#3d142e","#ffb75f","#8e009a"]},get:function(t,e){if(e in this.palettes){let i=this.palettes[e].length;return this.palettes[e][t%i]}try{let i=JSON.parse(e);return i[t%i.length]}catch(t){console.error(t)}let i=this.palettes.ubuntu.length;return this.palettes[e][t%i]}};let i=(t,e,i)=>{let n=null,r=null,a=null;if(t.from){let i=document.getElementById(t.from);for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub","babia-selector","babia-treebuilder"])if(i.components[t]){n=i.components[t];break}if(null==n)return void console.error("Problem registering to the querier",e)}else{if(t.nodesFrom){let i=document.getElementById(t.nodesFrom);for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub"])if(i.components[t]){r=i.components[t];break}if(null==r)return void console.error("Problem registering to the querier",e);let n=document.getElementById(t.linksFrom);for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub"])if(n.components[t]){a=n.components[t];break}return null==a?void console.error("Problem registering to the querier",e):{nodes:r,links:a}}for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub","babia-selector","babia-treebuilder"])if(e.components[t]&&i!=t){n=e.components[t];break}if(null==n){for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub","babia-selector","babia-treebuilder"])if(document.querySelectorAll("["+t+"]").length>0){n=document.querySelectorAll("["+t+"]")[0].components[t];break}if(null==n)return void console.error("Error, querier not found",e,e.components,e.components["babia-querier"])}}return n},n=t=>{let e;return e="string"==typeof t||t instanceof String?JSON.parse(t):t,e};t.exports.findProdComponent=i,t.exports.findNavComponent=(t,e)=>{let i;if(t.controller){let n=document.getElementById(t.controller);if(!n.components["babia-navigator"])return void console.error("Problem registering to the navigator",e);i=n.components["babia-navigator"]}else if(e.components["babia-navigator"])i=e.components["babia-navigator"];else{if(!(document.querySelectorAll("[babia-navigator]").length>0))return void console.error("Error, navigator not found",e,e.components,e.components["babia-navigator"]);i=document.querySelectorAll("[babia-navigator]")[0].components["babia-navigator"]}return i},t.exports.findTargetComponent=(t,e)=>{let i;if(t.target){{let e=document.getElementById(t.target);if(null==e)return void console.error("Target not exist.");if(e.components["babia-bars"])i=e.components["babia-bars"];else if(e.components["babia-barsmap"])i=e.components["babia-barsmap"];else if(e.components["babia-cyls"])i=e.components["babia-cyls"];else if(e.components["babia-cylsmap"])i=e.components["babia-cylsmap"];else if(e.components["babia-pie"])i=e.components["babia-pie"];else if(e.components["babia-doughnut"])i=e.components["babia-doughnut"];else if(e.components["babia-bubbles"])i=e.components["babia-bubbles"];else if(e.components["babia-city"])i=e.components["babia-city"];else if(e.components["babia-boats"])i=e.components["babia-boats"];else{if(!e.components["babia-network"])return void console.error("Visualizer not found.");i=e.components["babia-network"]}}return i}console.error("Error: Target not inserted. ")},t.exports.colors=e,t.exports.updateTitle=(t,e)=>{let i=document.createElement("a-entity");return i.classList.add("babiaxrTitle"),i.setAttribute("text",{value:t.title}),t.titleColor&&i.setAttribute("material",{color:t.titleColor}),i.setAttribute("scale","10 10 10"),i.setAttribute("wrapCount","10"),i.setAttribute("position",t.titlePosition),i.setAttribute("rotation",e),i},t.exports.parseJson=n,t.exports.updateFunction=(t,e)=>{let r=t.data,a=t.el;if((a.components["babia-bars"]||a.components["babia-barsmap"]||a.components["babia-cyls"])&&(r.index||(r.index=r.x_axis),t.animation=r.animation,t.bar_array=[]),a.components["babia-boats"]&&(t.figures||(t.figures=[])),r.data&&e.data!==r.data){let e=n(r.data);t.processData(e)}else r.from!==e.from?(t.slice_array&&(t.slice_array=[]),t.prodComponent&&t.prodComponent.notiBuffer.unregister(t.notiBufferId),t.prodComponent=i(r,a),t.prodComponent.notiBuffer&&(t.notiBufferId=t.prodComponent.notiBuffer.register(t.processData.bind(t)))):r!==e&&t.newData&&(t.slice_array&&(t.slice_array=[]),t.bar_array&&(t.bar_array=[]),t.processData(t.newData))}},662:(t,e,i)=>{let n=i(4809).parse;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(9590).NotiBuffer;AFRAME.registerComponent("babia-querycsv",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data,{header:!0,dynamicTyping:!0,skipEmptyLines:!0});this.notiBuffer.set(t.data)}else t.url!==e.url&&this.getCSV(e.url)},remove:function(){},pause:function(){},play:function(){},getCSV:async function(t){let e=this.notiBuffer;n(t,{download:!0,header:!0,skipEmptyLines:!0,dynamicTyping:!0,complete:function(t){e.set(t.data)}})}})},6776:(t,e,i)=>{let n=i(1392).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(9590).NotiBuffer;AFRAME.registerComponent("babia-queryes",{schema:{elasticsearch_url:{type:"string"},index:{type:"string"},query:{type:"string"},size:{type:"int",default:10},request:{type:"string"},user:{type:"string"},password:{type:"string"},data:{type:"string"},tableBars:{type:"boolean",default:!1},rangeSelector:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r,this.tableBars=this.data.tableBars},update:function(t){this.oldData=t;let e="";if(this.data.rangeSelector){let t=document.getElementById(this.data.rangeSelector);t.components["babia-range-selector"]&&(this.prodComponent=t.components["babia-range-selector"]),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.updateQuerier.bind(this)),e=this.prodComponent.notiBuffer.data)}this.updateQuerier(e)},updateQuerier:function(t){let e=this.data,i=this.oldData;if(e.data&&i.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else if(e.elasticsearch_url!==i.elasticsearch_url||e.index!==i.index||e.query!==i.query||e.size!==i.size){if(!e.elasticsearch_url||!e.index)return void console.error("elasicsearch_url and index must be defined");this.getJSON(e,t)}else t&&this.getJSON(e,t)},getJSON:async function(t,e){let i,r;if(t.size&&t.query)if(i=`${t.elasticsearch_url}/${t.index}/_search?size=${t.size}&${t.query}`,t.user&&t.password){let e=new Headers;e.append("Authorization","Basic "+btoa(t.user+":"+t.password)),r=await fetch(i,{headers:e})}else r=await fetch(i);else if(t.request){i=`${t.elasticsearch_url}/${t.index}/_search`;let a=await fetch(t.request);if(200!=a.status)throw new Error(a.status);if(this.json=await a.json(),this.json=n(this.json),e){let t;for(let e=0;e<this.json.query.bool.must.length;e++)this.json.query.bool.must[e].range&&(t=e);let i=this.json.query.bool.must[t].range[Object.keys(this.json.query.bool.must[t].range)[0]];i.gte=e.from,i.lte=e.to,this.json.aggs[2]&&this.json.aggs[2].date_histogram&&(this.json.aggs[2].date_histogram.interval=e.interval)}r=t.user&&t.password?await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*",Authorization:"Basic "+btoa(t.user+":"+t.password)},body:JSON.stringify(this.json)}):await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(this.json)})}if(200==r.status){let t=await r.json();return t=this.parseDataES(t),void this.notiBuffer.set(t)}throw new Error(r.status)},parseDataES:function(t){let e=[];console.log("REQUEST:",this.json),console.log("REPLY:",t);let i=Object.keys(t.aggregations);if(this.json.aggs&&1==i.length&&!this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let i=0;i<t.length;i++)e.push(t[i])}else if(this.json.aggs&&1==i.length&&this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let n=0;n<t.length;n++)if(t[0][Object.keys(t[0])[0]].values)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].values[0].value});else if(t[0][Object.keys(t[0])[0]].value&&1==t[0][Object.keys(t[0])[0]].length)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(t[0][Object.keys(t[0])[0]].buckets&&t[0][Object.keys(t[0])[0]].buckets.length>0)for(let i=0;i<t[n][Object.keys(t[0])[0]].buckets.length;i++)e.push({key_as_string:t[n].key_as_string,key:t[n][Object.keys(t[0])[0]].buckets[i].key,count:t[n][Object.keys(t[0])[0]].buckets[i].doc_count,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(Object.keys(t[0]).length>1)if(1==this.tableBars){e.push({key_as_string:i[0],key:t[n].key,value:t[n].doc_count});for(let i=0;i<Object.keys(t[0]).length;i++)t[n][Object.keys(t[0])[i]].value&&e.push({key_as_string:Object.keys(t[0])[i],key:t[n].key,value:t[n][Object.keys(t[0])[i]].value})}else{let r={key:t[n].key,value:t[n].doc_count};t[n].key_as_string?r.key_as_string=t[n].key_as_string:r.key_as_string=i[0];for(let e=0;e<Object.keys(t[0]).length;e++)t[n][Object.keys(t[0])[e]].value&&(r[Object.keys(t[0])[e]]=t[n][Object.keys(t[0])[e]].value);if(t[0][Object.keys(t[0])[0]].buckets)for(let e=0;e<Object.keys(t[0][Object.keys(t[0])[0]].buckets).length;e++)t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value?r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value:r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]].doc_count;e.push(r)}else e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count})}else{t=t.hits.hits;for(let i=0;i<t.length;i++)e[i]=t[i]._source}return e}})},7511:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-querygithub",{schema:{user:{type:"string"},token:{type:"string"},repos:{type:"array"},data:{type:"string"}},multiple:!1,init:function(){},update:function(i){let r=this.data,a=this.el,o=this;r.data&&i.data!==r.data?n(r.data,a,o):i.user===r.user&&i.repos===r.repos&&i.token===r.token||(r.user&&0===r.repos.length?e(r,a,o):r.repos.length>0&&t(r,a,o))},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el,this.interestedElements.push(t),this.babiaData&&a(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let t=(t,e,i)=>{let n=[];t.repos.forEach(((i,r)=>{let a=new XMLHttpRequest,o="https://api.github.com/repos/"+t.user+"/"+i+"?_="+(new Date).getTime();a.open("get",o,!1),a.onload=function(){if(this.status>=200&&this.status<300){console.log("data OK in request.response",e.id);let t=JSON.parse(a.response);n.push(t)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()})),i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},r("babiaData",i)},e=(t,e,n)=>{let a=new XMLHttpRequest,o="https://api.github.com/users/"+t.user+"/repos?_="+(new Date).getTime();a.open("get",o),a.onload=function(){this.status>=200&&this.status<300?(console.log("data OK in request.response",e.id),n.babiaData=i(JSON.parse(a.response)),n.babiaMetadata={id:n.babiaMetadata.id++},r("babiaData",n)):(reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText))},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()},i=t=>{let e=[];return t.forEach(((t,i)=>{e.push(t)})),e},n=(t,e,i)=>{let n=JSON.parse(t);i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},r("babiaData",i)},r=(t,e)=>{e.interestedElements.forEach((e=>{a(e,t)}))},a=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},9522:(t,e,i)=>{let n=i(1392).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(9590).NotiBuffer;AFRAME.registerComponent("babia-queryjson",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else t.url!==e.url&&this.getJSON(e.url)},remove:function(){},pause:function(){},play:function(){},getJSON:async function(t){let e=await fetch(t);if(200!=e.status)throw new Error(e.status);{let t=await e.json(),i=n(t);this.notiBuffer.set(i)}}})},7619:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-bars",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","x_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,total_duration:3e3,proportion:void 0,valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:this.widthBars/2}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-bars:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let a=this.chartEl,o=a.querySelectorAll("a-entity[babia-bar]"),s={};for(let t of o)s[t.getAttribute("babia-name")]={el:t,found:!1};let l=[],c=[],h=0;for(let n=0;n<t.length;n++){let o,d=t[n],u=d[e.x_axis],p=n*this.widthBars*1.25;s[u]&&!d._not?(o=s[u].el,s[u].found=!0):(o=document.createElement("a-entity"),o.setAttribute("babia-name",u),o.id=d[e.index],o.object3D.position.x=p,a.appendChild(o)),o.setAttribute("babia-bar",{height:d[e.height]*this.lengthY/this.maxValue,width:this.widthBars,depth:this.widthBars,color:r.get(h,i),label:"events",animation:e.animation}),e.legend&&o.setAttribute("babia-bar",{labelText:u+": "+d[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),p!==o.object3D.position.x&&(e.animation?o.setAttribute("animation",{property:"object3D.position.x",to:p,dur:e.dur}):o.object3D.position.x=p),l.push(d[e.x_axis]),c.push(p),h++}for(let t in s)s[t].found||s[t].el.remove();const d=this.widthBars*(1.25*t.length);this.updateAxis(l,c,d,this.maxValue)},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach((t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.index]==t[e.index]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)})),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{this.newData.forEach((t=>{if(t._not)this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar","height",-.1);else if(this.chartEl.querySelector("#"+t[e.index]))this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.index]+": "+t[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale});else{let i=this.chartEl.querySelectorAll("[babia-bar]").length,n=this.chartEl.querySelectorAll("[babia-bar]")[i-1].getAttribute("position").x+this.widthBars+this.widthBars/4,r=s(this,e,t,i,e.palette,n);this.chartEl.appendChild(r),this.xLabels.push(r.id),this.xTicks.push(n)}}));let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let s=(t,e,i,n,a,o)=>{let s=document.createElement("a-entity");return s.setAttribute("babia-bar",{height:i[t.data.height]*e.chartHeight/t.maxValue,width:t.widthBars,depth:t.widthBars,color:r.get(n,a),label:"events",animation:e.animation}),e.legend&&s.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),s.setAttribute("position",{x:o,y:0,z:0}),s.id=i[t.data.index],s},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)}},3877:function(t,e,i){i(1392).findProdComponent;let n=i(1392).updateTitle;i(1392).parseJson;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-barsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string",default:"x_axis"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3}},visProperties:["height","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,proportion:void 0,valueMax:void 0,xLabels:[],zLabels:[],xTicks:[],zTicks:[],total_duration:3e3,updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n,r,a,o){const s=this.data;s.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:s.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:o,palette:s.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:0-this.widthBars/2,y:0,z:-this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),s.axis_name&&((s.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",s.index):this.xAxisEl.setAttribute("babia-axis-x","name",s.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",s.height),this.zAxisEl.setAttribute("babia-axis-z","name",s.z_axis)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-barsmap:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let a=[],o=[],s=[],l=[],c=this.chartEl;c.querySelectorAll("a-entity[babia-bar]").forEach((t=>{t.remove()}));for(let h=0;h<t.length;h++){let d,u,p=t[h],f=p[e.x_axis],g=p[e.z_axis];a.includes(f)||(a.push(f),d=(a.length-1)*this.widthBars*1.25,o.push(d+this.widthBars/2)),d||(d=a.indexOf(f)*this.widthBars*1.25),s.includes(g)||(s.push(g),u=(s.length-1)*this.widthBars*1.25,l.push(u+this.widthBars/2)),u||(u=s.indexOf(g)*this.widthBars*1.25),console.log(f+" "+g+" "+d+" "+u);let m,b=a.indexOf(f);m||(m=document.createElement("a-entity"),m.id=f+g,m.classList.add("babiaxraycasterclass"),m.object3D.position.x=d,m.object3D.position.z=u,c.appendChild(m)),p._not?m.setAttribute("babia-bar",{height:-.1,color:r.get(b,i)}):m.setAttribute("babia-bar",{height:p[e.height]*this.lengthY/n,width:this.widthBars,depth:this.widthBars,color:r.get(b,i),label:"events",animation:e.animation}),e.legend&&m.setAttribute("babia-bar",{labelText:f+", "+g+": "+p[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale})}const h=this.widthBars*(1.25*a.length+.75),d=this.widthBars*(1.25*s.length+.75);this.updateAxis(a,o,h,n,s,l,d),this.xLabels=a,this.xTicks=o,this.zLabels=s,this.zTicks=l},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach((t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.x_axis]==t[e.x_axis]&&this.currentData[n][e.z_axis]==t[e.z_axis]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)})),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{console.log("Keep ---\x3e Update"),this.newData.forEach((t=>{t._not?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar","height",-.1):this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis])?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.x_axis]+","+t[e.z_axis]+": "+t[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}):s(this,e,t,this.maxValue,r,this.xLabels,this.zLabels,this.xTicks,this.zTicks)}));let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4,i=this.zTicks[this.zTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue,this.zLabels,this.zTicks,i)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let s=(t,e,i,n,a,o,s,l,c)=>{let h,d,u=i[e.x_axis],p=i[e.z_axis];o.includes(u)||(o.push(u),h=(o.length-1)*this.widthBars*1.25,l.push(h+this.widthBars/2)),h||(h=o.indexOf(u)*this.widthBars*1.25),s.includes(p)||(s.push(p),d=(s.length-1)*this.widthBars*1.25,c.push(d+this.widthBars/2)),d||(d=s.indexOf(p)*this.widthBars*1.25);let f=o.indexOf(u),g=document.createElement("a-entity");return g.id=u+p,g.classList.add("babiaxraycasterclass"),g.setAttribute("babia-bar",{height:i[e.height]*this.lengthY/n,width:this.widthBars,depth:this.widthBars,color:r.get(f,a),label:"events",animation:e.animation}),g.object3D.position.x=h,g.object3D.position.z=d,chartEl.appendChild(g),e.legend&&g.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),this.xLabels=o,this.xTicks=l,this.zLabels=s,this.zTicks=c,bar}},8550:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{let findProdComponent=__webpack_require__(1392).findProdComponent,updateFunction=__webpack_require__(1392).updateFunction;const colorsArray=__webpack_require__(1392).colors.palettes.categoric,NotiBuffer=__webpack_require__(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-boats",{schema:{data:{type:"asset"},from:{type:"string"},border:{type:"number",default:.5},width:{type:"string",default:"width"},depth:{type:"string",default:"depth"},area:{type:"string"},color:{type:"string"},height:{type:"string",default:"height"},maxBuildingHeight:{type:"number",default:2},minBuildingHeight:{type:"number",default:.03},diffBuildingHeight:{type:"boolean",default:!1},zone_elevation:{type:"number",default:.01},separation:{type:"number",default:.1},extra:{type:"number",default:1},levels:{type:"number"},building_color:{type:"string",default:"#E6B9A1"},buildingAlpha:{type:"number",default:1},gradientBaseColor:{type:"boolean",default:!1},base_color:{type:"color",default:"#98e690"},baseAlpha:{type:"number",default:1},height_quarter_legend_box:{type:"number",default:11},height_quarter_legend_title:{type:"number",default:12},height_building_legend:{type:"number",default:0},legend_scale:{type:"number",default:1},legend_lookat:{type:"string",default:"[camera]"},legendsAsChildren:{type:"boolean",default:!1},legendsAsChildrenHeight:{type:"number",default:3},metricsInfoId:{type:"string",default:""},highlightQuarter:{type:"boolean",default:!1},hideQuarterBoxLegend:{type:"boolean",default:!1},highlightQuarterByClick:{type:"boolean",default:!1},field:{type:"string",default:"uid"},numericColorLegendId:{type:"string"},highlightBuildingByField:{type:"string"},highlightBuildingByFieldColor:{type:"string",default:"white"},wireframeByRepeatedField:{type:"string"},transparent80ByRepeatedField:{type:"string"},transparent20ByRepeatedField:{type:"string"},autoscale:{type:"boolean",default:!1},autoscaleSizeX:{type:"number",default:3},autoscaleSizeZ:{type:"number",default:3},treeLayout:{type:"boolean",default:!1},treeQuartersLevelHeight:{type:"number",default:.2},treeFixQuarterHeight:{type:"boolean",default:!1},treeHideOneSonQuarters:{type:"boolean",default:!1}},entitiesWithLegend:[],legendsActive:[],dataComponent:void 0,newData:void 0,babiaMetadata:{id:0},visProperties:["height","area","width","depth","color"],multiple:!1,duration:2e3,figures_del:[],figures_in:[],animation:!1,init:function(){this.notiBuffer=new NotiBuffer},update:function(t){updateFunction(this,t)},alreadyAutoscaled:!1,autoscaleBoats:function(){const self=this;let bbox=(new THREE.Box3).setFromObject(this.el.object3D),finalSizeX=bbox.max.x-bbox.min.x,finalSizeY=bbox.max.y-bbox.min.y,finalSizeZ=bbox.max.z-bbox.min.z,currentScale=this.el.getAttribute("scale");currentScale||(currentScale={x:1,y:1,z:1}),this.el.setAttribute("scale",{x:eval(this.data.autoscaleSizeX/finalSizeX)*currentScale.x,y:currentScale.y,z:eval(this.data.autoscaleSizeZ/finalSizeZ)*currentScale.z})},tick:function(t,e){let i=this;if(this.data.autoscale&&!this.alreadyAutoscaled&&(new THREE.Box3).setFromObject(this.el.object3D).min.x!==1/0&&(this.autoscaleBoats(),this.alreadyAutoscaled=!0),this.animation){let t={x:0,y:0,z:0};Date.now()-this.start_time>this.duration?(this.animation=!1,this.setFigures(this.figures,t),this.data.autoscale&&this.autoscaleBoats(),i.entitiesWithLegend=i.entitiesWithLegend.filter((t=>document.getElementById(t.entity.id))),i.entitiesWithLegend.forEach((t=>{let e=t.entity,n=t.figure;if(n.children){e.legend=generateLegend(n.name,i.data.legend_scale,i.data.legend_lookat,"black","white");let t=(new THREE.Vector3).setFromMatrixPosition(e.object3D.matrixWorld),r={x:t.x,y:i.data.height_quarter_legend_title,z:t.z};i.data.legendsAsChildren?(e.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),e.legend.setAttribute("visible",!0),e.appendChild(e.legend)):(e.legend.setAttribute("position",r),e.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(e.legend)),i.legendsActive.push(e.legend),e.alreadyActive=!0}else{e.legend=generateLegend(n.name,i.data.legend_scale,i.data.legend_lookat,"white","black",e.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let t=(new THREE.Vector3).setFromMatrixPosition(e.object3D.matrixWorld),r=(new THREE.Box3).setFromObject(e.object3D),a={x:t.x,y:r.max.y+1+i.data.height_building_legend,z:t.z};e.legend.setAttribute("position",a),e.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(e.legend),i.legendsActive.push(e.legend),e.alreadyActive=!0}}))):this.Animation(this.el,this.figures,this.figures_old,e,t,t)}},updateChart:function(t){let e={x:0,y:0,z:0};this.idsToNotRepeatWireframe=[],this.idsToNotRepeat20Transparent=[],this.idsToNotRepeat80Transparent=[],this.animation&&(this.figures_del.forEach((t=>{let e=document.getElementById(t.id);e&&e.remove()})),this.figures_in.forEach((t=>{let e=document.getElementById(t.id);e&&setOpacity(e,1)})),this.setFigures(this.figures,e),this.animation=!1,this.figures_del=[],this.figures_in=[]),this.figures_old=this.figures,this.figures=[];let i,n=this.el,r=t;if(this.data.levels)i=this.data.border*this.data.extra*this.data.levels;else{let t=getLevels(r,0);i=this.data.border*this.data.extra*(t+1)}if([x,y,e,this.figures]=this.generateElements(r,this.figures,e,i),e.x=0,e.z=0,0==this.figures_old.length){for(;this.el.firstChild;)this.el.firstChild.remove();this.drawElements(n,this.figures,e)}else this.figures_old!==this.figures&&(this.animation=!0,this.start_time=Date.now())},categoricColorIndex:0,categoricColorMaps:{},generateElements:function(t,e,i,n){const r=this;var a=n,o=0,s=0,l=0,c=0,h=0,d=0,u=0,p=0,f=0,g=0,m=0,b=0,v=!1,y=!1,_=!1,A=!0;for(let i=0;i<t.length;i++){let C={};if(this.data.width&&(C.width=t[i][this.data.width]||.5),this.data.height){let e=0;r.data.diffBuildingHeight&&(e=r.babiaMetadata.heightMin),C.height=r.normalizeValues(e,r.babiaMetadata.heightMax,r.data.minBuildingHeight,r.data.maxBuildingHeight,t[i][this.data.height])||this.data.minBuildingHeight}if(this.data.depth&&(C.depth=t[i][this.data.depth]||.5),this.data.area&&(C.area=t[i][this.data.area]||.5),t[i].children){C.children=t[i].children,this.quarter=!0;var x,E=[];let e=r.el.getAttribute("scale");e||(e={x:1,y:1,z:1}),C.height=this.data.zone_elevation/e.y,a-=this.data.border*this.data.extra,r.data.treeLayout&&C.children.forEach((t=>{t.children||(C.treeMetaphorHeight=t[r.data.height])})),[C.width,C.depth,x,E]=this.generateElements(C.children,E,x,a),x.y=C.height,a=n}0==i?(this.data.area&&!t[i].children?(o+=Math.sqrt(C.area)/2,s-=Math.sqrt(C.area)/2,l+=Math.sqrt(C.area)/2,c-=Math.sqrt(C.area)/2):(o+=C.depth/2,s-=C.depth/2,l+=C.width/2,c-=C.width/2),b=o):C.height>0&&(v?([m,h,d,g]=this.UpSide(C,o,m,g),m>l&&(u=m,v=!1,A=!0,p<c&&(c=p),b=o)):A?([b,h,d,u]=this.RightSide(C,l,b,u),b<s&&(f=b,A=!1,y=!0,g>o&&(o=g),m=l)):y?([m,h,d,f]=this.DownSide(C,s,m,f),m<c&&(p=m,y=!1,_=!0,u>l&&(l=u),b=s)):_&&([b,h,d,p]=this.LeftSide(C,c,b,p),b>o&&(g=b,_=!1,v=!0,f<s&&(s=f),m=c)));let M={id:"boat-"+t[i][this.data.field],posX:h,posY:d,height:C.height,translate_matrix:x};if(t[i].children){M.name=t[i][this.data.field]||"",M.width=C.width-this.data.separation,M.depth=C.depth-this.data.separation,M.children=E,M.alpha=r.data.baseAlpha,M.translate_matrix=x,r.data.treeLayout&&(M.treeMetaphorHeight=C.treeMetaphorHeight);let e=M.name.split("/").length-1;M.hierarchyLevel=e,M.renderOrder=e,r.data.gradientBaseColor?M.color=greenColorsurface(Math.round(r.normalizeValues(1,r.babiaMetadata.maxLevels,15,100,e))):M.color=r.data.base_color}else M.name=t[i].name?t[i].name:t[i][this.data.field],M.alpha=r.data.buildingAlpha,this.data.area?(M.width=Math.sqrt(C.area)-this.data.separation,M.depth=Math.sqrt(C.area)-this.data.separation):(M.width=C.width-this.data.separation,M.depth=C.depth-this.data.separation),"number"==typeof t[i][r.data.color]?M.color=heatMapColorforValue(t[i][r.data.color],r.babiaMetadata.color_max,r.babiaMetadata.color_min):"string"==typeof t[i][r.data.color]&&(t[i][r.data.color]in r.categoricColorMaps?M.color=r.categoricColorMaps[t[i][r.data.color]]:(r.categoricColorMaps[t[i][r.data.color]]=colorsArray[r.categoricColorIndex],M.color=colorsArray[r.categoricColorIndex],r.categoricColorIndex=r.categoricColorIndex+1,r.categoricColorIndex>=colorsArray.length&&(r.categoricColorIndex=0)));M.rawData=t[i],r.data.transparent80ByRepeatedField&&!M.children&&r.idsToNotRepeat80Transparent.includes(M.rawData[r.data.transparent80ByRepeatedField])?(M.alpha=.8,M.renderOrder=2e3):r.idsToNotRepeat80Transparent.push(M.rawData[r.data.transparent80ByRepeatedField]),r.data.transparent20ByRepeatedField&&!M.children&&r.idsToNotRepeat20Transparent.includes(M.rawData[r.data.transparent20ByRepeatedField])?(M.alpha=.45,M.renderOrder=2e3):r.idsToNotRepeat20Transparent.push(M.rawData[r.data.transparent20ByRepeatedField]),r.data.wireframeByRepeatedField&&!M.children&&r.idsToNotRepeatWireframe.includes(M.rawData[r.data.wireframeByRepeatedField])?M.wireframe=!0:(M.wireframe=!1,r.idsToNotRepeatWireframe.push(M.rawData[r.data.wireframeByRepeatedField])),e.push(M)}f<s&&(s=f),p<c&&(c=p),g>o&&(o=g),u>l&&(l=u);var C=Math.abs(c)+Math.abs(l),M=Math.abs(s)+Math.abs(o);return[C+=2*a,M+=2*a,{x:c+C/2-a,y:0,z:s+M/2-a},e]},idsToNotRepeatWireframe:[],idsToNotRepeat80Transparent:[],idsToNotRepeat20Transparent:[],drawElements:function(t,e,i){const n=this;for(let r in e){let a=e[r].height,o=e[r].posX,s=e[r].posY,l={x:o-i.x,y:a/2+i.y/2,z:-s+i.z};if(n.data.treeLayout)if(n.data.treeHideOneSonQuarters&&e[r].children&&1===e[r].children.length&&(e[r].alphaTest=1,e[r].dontAddEvents=!0,e[r].children[0].dontAddLine=!0),n.data.treeFixQuarterHeight){if(void 0!==e[r].treeMetaphorHeight)l.y=a/2+i.y/2+n.data.treeQuartersLevelHeight;else if(l.y=a/2+i.y/2-n.data.treeQuartersLevelHeight-n.data.zone_elevation,e[r].height<n.data.treeQuartersLevelHeight&&(!n.data.treeHideOneSonQuarters||!e[r].dontAddLine)){let e=l.y,i=l.y+(n.data.treeQuartersLevelHeight-a/2),r=document.createElement("a-entity");r.setAttribute("class","babiaboatstreelines"),r.setAttribute("line",{start:{x:l.x,y:e,z:l.z},end:{x:l.x,y:i,z:l.z},color:"yellow"}),t.appendChild(r)}}else if(void 0!==e[r].treeMetaphorHeight){let t=0;n.data.diffBuildingHeight&&(t=n.babiaMetadata.heightMin),l.y=n.normalizeValues(t,n.babiaMetadata.heightMax,n.data.minBuildingHeight,n.data.maxBuildingHeight,e[r].treeMetaphorHeight)}else l.y=a/2+i.y/2-a-.001;let c=this.createElement(e[r],l);this.addEvents(c,e[r]),t.appendChild(c)}},RightSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i-a/2,s=e+r;return s>n&&(n=s),[i-=a,e+r/2,o,n]},DownSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i-r/2,s=e-a;return s<n&&(n=s),[i-=r,o,e-a/2,n]},LeftSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i+a/2,s=e-r;return s<n&&(n=s),[i+=a,e-r/2,o,n]},UpSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i+r/2,s=e+a;return s>n&&(n=s),[i+=r,o,e+a/2,n]},Animation:function(t,e,i,n,r,a){let o,s=this,l=Date.now();s.legendsActive.forEach((t=>{t.remove()})),s.legendsActive=[];for(let c in e)if(document.getElementById(e[c].id))if(o=document.getElementById(e[c].id),e[c].inserted){let t="id="+e[c].id;findIndex(s.figures_in,t)<0&&s.figures_in.push(e[c])}else{let t="id="+e[c].id,h=findIndex(i,t);if(o.babiaRawData=e[c].rawData,h<0)e[c].inserted=!0,o.getAttribute("width")!=e[c].width&&o.setAttribute("width",e[c].width),o.getAttribute("height")!=e[c].height&&o.setAttribute("height",e[c].height),o.getAttribute("depth")!=e[c].depth&&o.setAttribute("depth",e[c].depth),o.getAttribute("color")!=e[c].color&&o.setAttribute("color",e[c].color),o.getAttribute("material").wireframe!=e[c].wireframe&&(o.setAttribute("material","wireframe",e[c].wireframe),o.setAttribute("material","wireframeLinewidth",.1));else if(this.resize(o,l,n,e[c],i[h]),this.traslate(o,l,n,e[c],i[h],r,a),o.getAttribute("color")==e[c].color||s.inEntitiesWithLegend(o)||o.setAttribute("color",e[c].color),o.getAttribute("material").wireframe!=e[c].wireframe&&(o.setAttribute("material","wireframe",e[c].wireframe),o.setAttribute("material","wireframeLinewidth",.1)),o.getAttribute("material").opacity!=e[c].alpha&&(o.setAttribute("material","opacity",e[c].alpha),o.object3D.renderOrder=e[c].renderOrder),e[c].children)this.Animation(o,e[c].children,i[h].children,n,e[c].translate_matrix,i[h].translate_matrix);else if(e[c].rawData[s.data.color]!==i[h].rawData[s.data.color]){let t;"number"==typeof e[c].rawData[s.data.color]?t=heatMapColorforValue(e[c].rawData[s.data.color],s.babiaMetadata.color_max,s.babiaMetadata.color_min):"string"==typeof e[c].rawData[s.data.color]&&(e[c].rawData[s.data.color]in s.categoricColorMaps?t=s.categoricColorMaps[e[c].rawData[s.data.color]]:(s.categoricColorMaps[e[c].rawData[s.data.color]]=colorsArray[s.categoricColorIndex],t=colorsArray[s.categoricColorIndex],s.categoricColorIndex=s.categoricColorIndex+1,s.categoricColorIndex>=colorsArray.length&&(s.categoricColorIndex=0))),t!==o.getAttribute("color")&&o.setAttribute("color",t)}}else{position={x:e[c].posX-r.x,y:e[c].height/2+r.y/2,z:-e[c].posY+r.z};let i=this.createElement(e[c],position);this.addEvents(i,e[c]),setOpacity(i,.5),t.appendChild(i),e[c].inserted=!0}this.duration;for(let t in i){let n="id="+i[t].id;if(findIndex(e,n)<0){findIndex(s.figures_del,n)<0&&s.figures_del.push(i[t]);let e=document.getElementById(i[t].id);e&&(e.object3D.visible=!1,e.remove())}}},inEntitiesWithLegend(t){let e;for(e=0;e<this.entitiesWithLegend.length;e++)if(this.entitiesWithLegend[e].entity===t)return!0;return!1},setFigures:function(t,e){const i=this;t.forEach((t=>{let n=document.getElementById(t.id);if(n){if(n.getAttribute("width")!=t.width&&n.setAttribute("width",t.width),n.getAttribute("height")!=t.height&&n.setAttribute("height",t.height),n.getAttribute("depth")!=t.depth&&n.setAttribute("depth",t.depth),i.inEntitiesWithLegend(n)?n.setAttribute("babiaxrFirstColor",t.color):n.getAttribute("color")!=t.color&&n.setAttribute("color",t.color),n.components.material.data.opacity<1&&setOpacity(n,1),n.getAttribute("material").opacity!=t.alpha&&n.setAttribute("material","opacity",t.alpha),i.data.treeLayout)if(i.data.treeHideOneSonQuarters&&t.children&&1===t.children.length&&(t.alphaTest=1,t.dontAddEvents=!0,t.children[0].dontAddLine=!0),i.data.treeFixQuarterHeight)if(void 0!==t.treeMetaphorHeight)n.object3D.position.set(t.posX-e.x,t.height/2+e.y/2+i.data.treeQuartersLevelHeight,-t.posY+e.z);else{let r=t.height/2+e.y/2-i.data.treeQuartersLevelHeight-i.data.zone_elevation,a=t.posX-e.x,o=-t.posY+e.z;if(n.object3D.position.set(a,r,o),t.height<i.data.treeQuartersLevelHeight&&(!i.data.treeHideOneSonQuarters||!t.dontAddLine)){let e=r,s=r+(i.treeQuartersLevelHeight-t.height/2),l=document.createElement("a-entity");l.setAttribute("class","babiaboatstreelines"),l.setAttribute("line",{start:{x:a,y:e,z:o},end:{x:a,y:s,z:o},color:"yellow"}),n.parentElement.appendChild(l)}}else if(void 0!==t.treeMetaphorHeight){let r=0;i.data.diffBuildingHeight&&(r=i.babiaMetadata.heightMin),n.object3D.position.set(t.posX-e.x,i.normalizeValues(r,i.babiaMetadata.heightMax,i.data.minBuildingHeight,i.data.maxBuildingHeight,t.treeMetaphorHeight),-t.posY+e.z)}else n.object3D.position.set(t.posX-e.x,t.height/2+e.y/2-t.height-.001,-t.posY+e.z);else n.object3D.position.set(t.posX-e.x,(parseFloat(t.height)+e.y)/2,-t.posY+e.z);t.children&&this.setFigures(t.children,t.translate_matrix)}}))},resize:function(t,e,i,n,r){if(e-this.start_time<this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)){let e,a,o,s=Math.abs(n.width-r.width),l=Math.abs(n.height-r.height),c=Math.abs(n.depth-r.depth),h=i*s/this.duration,d=i*l/this.duration,u=i*c/this.duration,p=parseFloat(t.getAttribute("width")),f=parseFloat(t.getAttribute("height")),g=parseFloat(t.getAttribute("depth"));e=n.width-r.width<0?p-h:p+h,a=n.height-r.height<0?f-d:f+d,o=n.depth-r.depth<0?g-u:g+u,t.setAttribute("width",e),t.setAttribute("height",a),t.setAttribute("depth",o),t.classList.contains("babiaquarterboxactivated")&&t.childNodes.forEach((t=>{t.classList.contains("babiaquarterlegendbox")&&(t.setAttribute("geometry","width",e),t.setAttribute("geometry","depth",o),t.setAttribute("material","opacity",.4))}))}else e-this.start_time>this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)&&(t.setAttribute("width",n.width),t.setAttribute("height",n.height),t.setAttribute("depth",n.depth),t.classList.contains("babiaquarterboxactivated")&&t.childNodes.forEach((t=>{t.classList.contains("babiaquarterlegendbox")&&(t.setAttribute("geometry","width",new_width),t.setAttribute("geometry","depth",new_depth),t.setAttribute("material","opacity",.4))})))},traslate:function(t,e,i,n,r,a,o){let s=r.posX-o.x-(n.posX-a.x),l=n.height-r.height,c=r.posY-o.z-(n.posY-a.z);if(0!=s||0!=l||0!=c)if(e-this.start_time<this.duration){let e=i*s/this.duration,n=i*l/(2*this.duration),r=i*c/this.duration,a=parseFloat(t.object3D.position.x)-e,o=parseFloat(t.object3D.position.y)+n,h=parseFloat(t.object3D.position.z)+r;t.object3D.position.set(a,o,h)}else e-this.start_time>this.duration&&t.object3D.position.set(n.posX-a.x,(parseFloat(n.height)+a.y)/2,-n.posY+a.z)},createElement:function(t,e){let i=this,n=document.createElement("a-box");n.id=t.id,n.setAttribute("class","babiaxraycasterclass");let r=t.width,a=t.height,o=t.depth;if(t.children){let e=t.name.split("/").length-1;t.hierarchyLevel=e,n.object3D.renderOrder=e,i.data.gradientBaseColor?color=greenColorsurface(Math.round(i.normalizeValues(1,i.babiaMetadata.maxLevels,15,100,e))):color=i.data.base_color}else i.data.color?"number"==typeof t.rawData[i.data.color]?color=heatMapColorforValue(t.rawData[i.data.color],i.babiaMetadata.color_max,i.babiaMetadata.color_min):"string"==typeof t.rawData[i.data.color]?t.rawData[i.data.color]in i.categoricColorMaps?color=i.categoricColorMaps[t.rawData[i.data.color]]:(i.categoricColorMaps[t.rawData[i.data.color]]=colorsArray[i.categoricColorIndex],color=colorsArray[i.categoricColorIndex],i.categoricColorIndex=i.categoricColorIndex+1,i.categoricColorIndex>=colorsArray.length&&(i.categoricColorIndex=0)):color=i.data.building_color:color=i.data.building_color;return n.setAttribute("color",color),n.setAttribute("babiaxrFirstColor",color),n.setAttribute("width",r),n.setAttribute("height",a),n.setAttribute("depth",o),n.object3D.renderOrder=t.renderOrder,t.rawData&&(n.babiaRawData=t.rawData),i.data.highlightBuildingByField&&t.rawData&&n.setAttribute("babia-highlightbuildingbyfield",String(t.rawData[i.data.highlightBuildingByField]).replace("/","").replace("@","")),n.setAttribute("position",{x:e.x,y:e.y,z:e.z}),n.setAttribute("material","opacity",t.alpha),n.setAttribute("material","wireframe",t.wireframe),n.setAttribute("material","wireframeLinewidth",.1),t.alphaTest&&(n.setAttribute("material","alphaTest",t.alphaTest),n.removeAttribute("class")),n},processData:function(t){const e=this;let i=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.categoricColorMaps={},this.categoricColorIndex=0,i.color){let[t,e,n]=getMaxMinValues(this.newData,i.color,[]);this.babiaMetadata.color_max=t,this.babiaMetadata.color_min=e;let r=Math.round(n.reduce(((t,e)=>t+e),0)/n.length);this.babiaMetadata.colorAvg=r}let[n,r,a]=getMaxMinValues(this.newData,i.height,[]);this.babiaMetadata.heightMax=n,this.babiaMetadata.heightMin=r;let o=Math.round(a.reduce(((t,e)=>t+e),0)/a.length);if(this.babiaMetadata.heightAvg=o,this.babiaMetadata.maxLevels=getLevels(this.newData,0),i.area){let[t,e,n]=getMaxMinValues(this.newData,i.area,[]);this.babiaMetadata.areaMax=t,this.babiaMetadata.areaMin=e,this.babiaMetadata.areaAvg=Math.round(n.reduce(((t,e)=>t+e),0)/n.length)}else{let[t,e,n]=getMaxMinValues(this.newData,i.width,[]);this.babiaMetadata.widthMax=t,this.babiaMetadata.widthMin=e,this.babiaMetadata.widthAvg=Math.round(n.reduce(((t,e)=>t+e),0)/n.length);let[r,a,o]=getMaxMinValues(this.newData,i.depth,[]);this.babiaMetadata.depthMax=r,this.babiaMetadata.depthMin=a,this.babiaMetadata.depthAvg=Math.round(o.reduce(((t,e)=>t+e),0)/o.length)}if(this.data.metricsInfoId){let t=`Metrics information\nMETRIC (FIELD): MIN - MAX - AVG\n\nHeight (${i.height}) - ${r} - ${n} - ${o}`;this.data.area?t+=`\nArea (${i.area}) - ${this.babiaMetadata.areaMin} - ${this.babiaMetadata.areaMax} - ${this.babiaMetadata.areaAvg}`:(t+=`\nWidth (${i.width}) - ${this.babiaMetadata.widthMin} - ${this.babiaMetadata.widthMax} - ${this.babiaMetadata.widthAvg}`,t+=`\nDepth (${i.depth}) - ${this.babiaMetadata.depthMin} - ${this.babiaMetadata.depthMax} - ${this.babiaMetadata.depthAvg}`),this.data.color&&"string"!=typeof this.babiaMetadata.color_max&&(document.getElementById(this.data.numericColorLegendId).setAttribute("visible",!0),t+=`\nColor (${i.color}) - ${this.babiaMetadata.color_min} - ${this.babiaMetadata.color_max} - ${this.babiaMetadata.colorAvg}`),document.getElementById(this.data.metricsInfoId).setAttribute("text",{value:t,align:"center",width:3,color:"black",alphaTest:6,opacity:6,transparent:!1})}if(this.notiBuffer.set(this.newData),this.data.treeLayout&&this.data.treeFixQuarterHeight&&this.removeTreeLines(),this.updateChart(this.newData),this.data.metricsInfoId&&"number"!=typeof this.babiaMetadata.color_max){document.getElementById(e.data.numericColorLegendId).setAttribute("visible",!1),e.entityCatColorLegend&&(e.entityCatColorLegend.remove(),e.entityCatColorLegend=void 0);let t=document.getElementById(this.data.metricsInfoId);e.entityCatColorLegend=document.createElement("a-plane"),e.entityCatColorLegend.setAttribute("position","-3 0 0"),e.entityCatColorLegend.setAttribute("width",2.8),e.entityCatColorLegend.setAttribute("height",5),e.entityCatColorLegend.setAttribute("position","-3 0 0"),e.entityCatColorLegend.setAttribute("material","color","#B7B7B7");let i=2.2,n=`COLOR LEGEND (${this.data.color})`,r=document.createElement("a-entity");r.setAttribute("text",{value:n,align:"center",width:3,color:"black"}),r.setAttribute("position",{x:0,y:i,z:0}),i-=.2,e.entityCatColorLegend.appendChild(r);for(const[t,n]of Object.entries(this.categoricColorMaps)){let r=`${t}: ${n}`,a=document.createElement("a-entity");a.setAttribute("text",{value:r,align:"center",width:3,color:n}),a.setAttribute("position",{x:0,y:i,z:0}),i-=.15,e.entityCatColorLegend.appendChild(a)}t.appendChild(e.entityCatColorLegend)}else this.data.metricsInfoId&&"number"==typeof this.babiaMetadata.color_max&&e.entityCatColorLegend&&(e.entityCatColorLegend.remove(),e.entityCatColorLegend=void 0)},removeTreeLines:function(){let t=this.el.querySelectorAll(".babiaboatstreelines");for(line of t)line.remove()},normalizeValues:function(t,e,i,n,r){return(r-t)/(e-t)*(n-i)+i},addEvents:function(t,e){let i=this;if(e.children){if(!e.dontAddEvents){let n;t.addEventListener("click",(function(r){if(r.target===this)if(t.legend){i.data.hideQuarterBoxLegend||i.el.parentElement.removeChild(n),i.data.highlightQuarterByClick&&(t.setAttribute("material","color",t.getAttribute("babiaxrFirstColor")),t.setAttribute("babiaxrHightlightedByClick",!1)),t.classList.remove("babiaquarterboxactivated"),i.data.legendsAsChildren?t.removeChild(t.legend):i.el.parentElement.removeChild(t.legend);const e=i.entitiesWithLegend.findIndex((e=>e.entity===t));e>-1&&i.entitiesWithLegend.splice(e,1);const r=i.legendsActive.indexOf(t.legend);e>-1&&i.legendsActive.splice(r,1),t.legend=void 0,n=void 0}else{let r=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld);if(!i.data.hideQuarterBoxLegend){n=document.createElement("a-entity"),n.setAttribute("class","babiaquarterlegendbox"),t.classList.add("babiaquarterboxactivated");let e=t.getAttribute("geometry"),a=i.el.getAttribute("scale")||{x:1,y:1,z:1},o=e.height*a.y+i.data.height_quarter_legend_box;n.setAttribute("geometry",{height:o,depth:e.depth*a.z,width:e.width*a.x}),n.setAttribute("material",{visible:!0,opacity:.4}),n.object3D.renderOrder=1e9,n.setAttribute("position",r),i.el.parentElement.appendChild(n)}i.data.highlightQuarterByClick&&t.setAttribute("material","color","#bfbfbf");let a={x:r.x,y:i.data.height_quarter_legend_title,z:r.z};t.legend=generateLegend(e.name,i.data.legend_scale,i.data.legend_lookat,"black","white"),i.data.legendsAsChildren?(t.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),t.legend.setAttribute("visible",!0),t.appendChild(t.legend)):(t.legend.setAttribute("position",a),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend)),i.entitiesWithLegend.push({figure:e,entity:t}),i.legendsActive.push(t.legend)}}))}this.drawElements(t,e.children,e.translate_matrix)}else{let n;t.alreadyActive=!1,t.addEventListener("click",(function(r){if(r.target===this)if(t.alreadyActive){if(i.data.highlightQuarter)if(1==parseInt(t.parentElement.getAttribute("babiaxrHightlighted"))){let e=t.parentElement.getAttribute("position");t.parentElement.setAttribute("position",{x:e.x,y:t.parentElement.getAttribute("babiaxrFirstYPosition"),z:e.z}),t.parentElement.setAttribute("material",{color:t.parentElement.getAttribute("babiaxrFirstColor")}),t.parentElement.setAttribute("babiaxrHightlighted",0)}else{let e=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"));t.parentElement.setAttribute("babiaxrHightlighted",e-1)}t.legend.setAttribute("visible",!1),t.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.data.legendsAsChildren?t.removeChild(t.legend):i.el.parentElement.removeChild(t.legend);const e=i.entitiesWithLegend.findIndex((e=>e.entity===t));e>-1&&i.entitiesWithLegend.splice(e,1);const r=i.legendsActive.indexOf(t.legend);if(e>-1&&i.legendsActive.splice(r,1),i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{if(t!==e&&e.highlightbuildingbyfieldactive&&!e.alreadyActive){let t=e.getAttribute("babiaxrBeforeBuildingHighlight");e.setAttribute("material","color",t),e.highlightbuildingbyfieldactive=!1}}))}t.legend=void 0,t.alreadyActive=!1}else{if(t.highlightbuildingbyfieldactive)return;if(t.alreadyActive=!0,!t.legend){n=t.getAttribute("geometry");let r=t.getAttribute("position");t.setAttribute("position",r),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t.legend=generateLegend(e.name,i.data.legend_scale,i.data.legend_lookat,"white","black",t.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let a=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),o=(new THREE.Box3).setFromObject(t.object3D),s={x:a.x,y:o.max.y+1+i.data.height_building_legend,z:a.z};i.data.legendsAsChildren?(t.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),t.legend.setAttribute("visible",!0),t.appendChild(t.legend)):(t.legend.setAttribute("position",s),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend))}if(i.data.highlightQuarter)if(t.parentElement.getAttribute("babiaxrHightlighted")&&0!=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"))){let e=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"));t.parentElement.setAttribute("babiaxrHightlighted",e+1)}else{let e=t.parentElement.getAttribute("position");t.parentElement.setAttribute("babiaxrFirstYPosition",e.y),t.parentElement.setAttribute("position",{x:e.x,y:e.y+.2,z:e.z}),t.parentElement.setAttribute("material","color","#bfbfbf"),t.parentElement.setAttribute("babiaxrHightlighted",1)}if(i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{t===e||e.highlightbuildingbyfieldactive||e.alreadyActive||(e.highlightbuildingbyfieldactive=!0,e.setAttribute("babiaxrBeforeBuildingHighlight",e.getAttribute("material").color),e.setAttribute("material","color",i.data.highlightBuildingByFieldColor))}))}i.entitiesWithLegend.push({figure:e,entity:t}),i.legendsActive.push(t.legend)}})),t.addEventListener("mouseenter",(function(){if(!t.alreadyActive){n=t.getAttribute("geometry");let r=t.getAttribute("position");t.setAttribute("position",r);let a="undefined"!==t.getAttribute("material").color?t.getAttribute("material").color:i.data.building_color;t.setAttribute("babiaxrFirstColor",a),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t.legend=generateLegend(e.name,i.data.legend_scale,i.data.legend_lookat,"white","black",t.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),s=(new THREE.Box3).setFromObject(t.object3D),l={x:o.x,y:s.max.y+1+i.data.height_building_legend,z:o.z};if(i.data.legendsAsChildren?(t.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),t.legend.setAttribute("visible",!0),t.appendChild(t.legend)):(t.legend.setAttribute("position",l),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend)),i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{t===e||e.highlightbuildingbyfieldactive||e.alreadyActive||(e.highlightbuildingbyfieldactive=!0,e.setAttribute("babiaxrBeforeBuildingHighlight",e.getAttribute("material").color),e.setAttribute("material","color",i.data.highlightBuildingByFieldColor))}))}}})),t.addEventListener("mouseleave",(function(){if(!t.alreadyActive&&t.legend&&(t.legend.setAttribute("visible",!1),t.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.data.legendsAsChildren?t.removeChild(t.legend):i.el.parentElement.removeChild(t.legend),t.legend=void 0),i.data.highlightBuildingByField&&!t.alreadyActive&&!t.highlightbuildingbyfieldactive){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{if(t!==e&&e.highlightbuildingbyfieldactive&&!e.alreadyActive){let t=e.getAttribute("babiaxrBeforeBuildingHighlight");e.setAttribute("material","color",t),e.highlightbuildingbyfieldactive=!1}}))}}))}}});let generateLegend=(t,e,i,n,r,a,o,s,l,c,h)=>{let d=2,u=1;if(t.length>16&&(d=t.length/5),a){let e="\n "+o+" (height): "+Math.round(100*a[o])/100;if(e.length>16&&(d=e.length/5),t+=e,s){let i="\n "+s+" (area): "+Math.round(100*a[s])/100;i.length>16&&i>e&&(d=i.length/5),t+=i}else{let i="\n "+l+" (depth): "+Math.round(100*a[l])/100;i.length>16&&i>e&&(d=i.length/5),t+=i;let n="\n "+c+" (width): "+Math.round(100*a[c])/100;n.length>16&&n>e&&n>i&&(d=n.length/5),t+=n,u=1.5}if(h){let i="\n "+h;"string"==typeof a[h]?i+=" (color): "+a[h]:i+=" (color): "+Math.round(100*a[h])/100,i.length>16&&i>e&&(d=i.length/5),t+=i,u+=.2}}let p=document.createElement("a-plane");return p.setAttribute("babia-lookat",i),p.setAttribute("rotation",{x:0,y:0,z:0}),p.setAttribute("height",u),p.setAttribute("width",d),p.setAttribute("color",n),p.setAttribute("material",{side:"double"}),p.setAttribute("text",{value:t,align:"center",width:6,color:r,alphaTest:6,opacity:6,transparent:!1}),p.setAttribute("visible",!1),p.setAttribute("class","babialegend"),p.setAttribute("scale",{x:e,y:e,z:e}),p};function setOpacity(t,e){if(t.setAttribute("material","opacity",e),t.childNodes)for(let i=0;i<t.childNodes.length;i++)setOpacity(t.childNodes[i],e)}let getLevels=(t,e)=>{let i=e,n=e;for(let r in t)t[r].children&&(i++,n<(e=getLevels(t[r].children,i))&&(n=e),i--);return n},getMaxMinValues=(t,e,i,n,r)=>{for(let a=0;a<t.length;a++)t[a].children?[n,r]=getMaxMinValues(t[a].children,e,i,n,r):(("null"!==t[a][e]&&!n||t[a][e]>n)&&(n=t[a][e]),("null"!==t[a][e]&&void 0===r||t[a][e]<r)&&(r=t[a][e]),i.push(t[a][e]));return[n,r,i]};function heatMapColorforValue(t,e,i){let n=[19,82,138],r=[255,94,83];var a=((((t||0)-i)/(e-i)*2-1)/1+1)/2,o=1-a,s=[Math.round(r[0]*a+n[0]*o),Math.round(r[1]*a+n[1]*o),Math.round(r[2]*a+n[2]*o)];return"rgb("+s[0]+","+s[1]+","+s[2]+")"}let findIndex=(t,e)=>{for(e=e.split("="),i=0;i<t.length;i++)if(t[i][e[0]]===e[1])return i;return-1},greenColorsurface=t=>"hsl(140, 100%,"+t+"%)"},9722:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(t,e,i,n,a,o,s,l,c,h){let d=r.get(i,n);console.log("Generating bubble..."),l?(t/=l,e/=l):(c||h)&&(c&&(t*=c),h&&(e*=h));let u=document.createElement("a-sphere");if(u.setAttribute("color",d),u.setAttribute("radius",e),s){let i=a.toString()+" "+e.toString()+" "+o.toString(),n=a.toString()+" "+(e+t).toString()+" "+o.toString();u.setAttribute("animation__position",{property:"position",from:i,to:n,dur:"3000",easing:"linear"})}else u.setAttribute("position",{x:a,y:e+t,z:o});return u}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,i){let n=e[t.x_axis]+": \n Radius:"+e[t.radius]+"\nHeight:"+e[t.height],r=2;n.length>16&&(r=n.length/8);let a=i.getAttribute("position"),o=parseFloat(i.getAttribute("radius")),s=document.createElement("a-plane");return s.setAttribute("position",{x:a.x,y:a.y+o+1,z:a.z+.1}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",r),s.setAttribute("color","white"),s.setAttribute("text",{value:n,align:"center",width:6,color:"black"}),s.classList.add("babiaxrLegend"),s.setAttribute("babia-lookat",t.legend_lookat),s.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),s}(t,i,e),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-bubbles",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=n(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-bubbles:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette,a=e.scale;let o=e.heightMax,c=e.radiusMax,h=[],d=[],u=[],p=[],f=0,g=0,m=0,b=0,v=0,y=0,_={},A={},x=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),E=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(x/=a,E/=a),o||(o=x),proportion=o/x,c||(c=E),radius_scale=c/E,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl),a?(v=E/a,y=E/a):(v=E*radius_scale,y=E*radius_scale);for(let o of t){let t=o[e.x_axis],c=o[e.z_axis],x=o[e.height],C=o[e.radius];_[t]?(m=_[t].posX,f=_[t].colorId):(m+=a?2*E/a+.5:2*E*radius_scale+.5,f=g,_[t]={posX:m,colorId:f},h.push(t),d.push(m),g++),A[c]?b=A[c].posZ:(b=a?y+2*E/a+.5:y+2*E*radius_scale+.5,A[c]={posZ:b},u.push(c),p.push(b)),m>v&&(v=m),b>y&&(y=b);let M=s(x,C,f,r,m,b,n,a,proportion,radius_scale);M.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(M),e.legend&&l(e,M,o,i)}if(e.axis){const t=v,e=y,i=o;this.updateAxis(h,d,t,u,p,e,x,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,o,s){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-y",{maxValue:o,length:s}),c.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-z",{labels:n,ticks:r,length:a}),h.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),c.setAttribute("babia-axis-y","name",this.data.height),h.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating bubbles..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},9530:(t,e,i)=>{let n=i(1392).findProdComponent;const r=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-city",{schema:{from:{type:"string"},absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string"},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else if(e.from!==t.from)this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)));else if(e!==t&&this.newData){for(console.log("Generating city...");this.el.firstChild;)this.el.firstChild.remove();this.processData(this.newData)}},dataComponent:void 0,dataComponentDataPropertyName:"babiaData",dataComponentEventName:void 0,babiaData:void 0,babiaMetadata:{id:0},visProperties:["fheight","farea"],processData:function(t){let e;console.log("processData",t),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e=this.newData.length>0?{id:"init",children:this.newData}:this.newData.length<=0?this.newData[0]:this.newData,console.log("toSave",e),this.notiBuffer.set(e),a(this,e)}});let a=(t,e)=>{t.loader=new THREE.FileLoader;let i=t.data,n=t.el;c=i.building_color;let r=n;n.emit("babiaxr-dataLoaded",{data:e,codecity:!0}),h=i.time_evolution_delta,t.zone_data=e;let a,s,d=new o({data:t.zone_data,extra:function(t){return t*i.extra},farea:i.farea,fheight:i.fheight,fmaxarea:i.fmaxarea});1==i.absolute?(a=Math.sqrt(d.areas.canvas)*i.width/i.depth,s=d.areas.canvas/a):(a=i.width,s=i.depth);let u=!1,p=new l({width:a,depth:s,x:0,z:0});d.add_rects({rect:p,split:i.split,relative:u});let f=document.createElement("a-entity");t.base=f,d.draw_rects({ground:p,el:f,base:i.base,level:0,elevation:0,relative:u,base_thick:i.base_thick,wireframe:i.wireframe,building_color:i.building_color,base_color:i.base_color,model:i.building_model,visible:!0,titles:i.titles,rootCodecityEntity:r}),n.appendChild(f)},o=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea]||.5,n.max_area=i[this.fmaxarea]||.5,n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new s(e.children.map((t=>t.canvas)),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:n=0,elevation:r=0,relative:a=!0,base_thick:o=.2,wireframe:s=!1,building_color:l="red",base_color:c="green",model:h=null,visible:u=!0,titles:p=!0,rootCodecityEntity:f}){let g=this;if(0===n&&(this.el=e),this.pending_rects,"children"in i){let t=i.rect.box({elevation:r,height:o,color:c,inner:!1,wireframe:s,visible:u,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)f.removeChild(i),f.parentElement.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let n=t.getAttribute("geometry"),r=t.getAttribute("position"),a=f.getAttribute("scale"),o=n.height+11;a&&(o=(n.height+11)/a.y),i.setAttribute("geometry",{height:o,depth:n.depth,width:n.width}),i.setAttribute("position",r),i.setAttribute("material",{visible:!0,opacity:.4}),f.appendChild(i),e=d(this.getAttribute("id"),"black","white");let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l={x:s.x,y:12,z:s.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let g=t;a||(g=e);for(const t of i.children){let e=o/2;a||(e=r+o),this.draw_rects({ground:i.rect,el:g,area:t,level:n+1,elevation:e,relative:a,building_color:l,base_color:c,model:h,base_thick:o,wireframe:s,visible:u,titles:p,rootCodecityEntity:f})}}else{let t=i.rect.box({height:i.data[this.fheight],elevation:r,wireframe:s,color:l,model:h,visible:u,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,n,r=!1;t.addEventListener("click",(function(){r?(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=d(this.getAttribute("id"),"white","black",i.data,g.fheight,g.farea);let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),s=(new THREE.Box3).setFromObject(t.object3D),l={x:o.x,y:s.max.y+1,z:o.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e),f.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0)}))}}}},s=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce(((t,e)=>t+e),0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new s(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:s.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:s.range(0,r),a2:[r+1],a3:[]};let a=t*e,o=this.scaled_area(a,r),l=Math.sqrt(o)*e-o,c=0,h=c,d=r+1;for(;c<l&&d<this.items.length;)h=c,c+=this.scaled_area(a,d),d++;let u=d;return d-1>r&&Math.abs(c-l)>Math.abs(h-l)&&(u=d-1),i=u-r-1,n=this.items.length-u,{pivot:r,a1:s.range(0,r),a2:s.range(r+1,i),a3:s.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},l=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,o]=this.idims_as_laying(),s=i/t.total,c=-i/2,h=0;e||(c+=r,h=a);let d=[];for(const e of t.items){let t=e*s,i=new l({width:t,depth:n,x:c+t/2,z:h});o&&i.reflect(),d.push(i),c+=t}return d}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,o]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:s,a1:c,a2:h,a3:d}=t.pivot_regions(i,n),u=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(s),i),f=t.pivot_region_width(d,i),g=r-i/2+u/2,m=r-i/2+u+p/2,b=r-i/2+u+p+f/2,v=[],y=t.scaled_area(i*n,s)/p;v[s]=new l({width:p,depth:y,x:m,z:a+n/2-y/2});let _=[[c,u,n,g,a],[h,p,n-y,m,a-y/2],[d,f,n,b,a]];for(const[e,i,n,r,a]of _)if(e.length>0){let o=new l({width:i,depth:n,x:r,z:a});o.inner();let s=t.values_i(e),c=o.split_pivot(s,!1),h=0;for(const t of e)v[t]=c[h],h++}if(o)for(const t of v)t.reflect();return v}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:o=!0,id:s="",rawarea:l=0,inner_real:c=!1}){let h,d;[h,d]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let u=document.createElement("a-entity");return u.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:d,height:t}),u.setAttribute("material",{color:i}),u.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),u.setAttribute("id",s),u.setAttribute("babiaxr-rawarea",l),u}};t.exports={Values:s,Rectangle:l,Zone:o};let c,h=8e3,d=(t,e,i,n,r,a)=>{let o=2;if(t.length>16&&(o=t.length/8),n){let e="\n "+r+" (height): "+n[r];e.length>16&&(o=e.length/8),t+=e;let i="\n "+a+" (area): "+n[a];i.length>16&&i>e&&(o=i.length/8),t+=i}let s=document.createElement("a-plane");return s.setAttribute("babia-lookat","[camera]"),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",o),s.setAttribute("color",e),s.setAttribute("material",{side:"double"}),s.setAttribute("text",{value:t,align:"center",width:6,color:i}),s.setAttribute("visible",!1),s}},7232:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cyls",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},radiusMax:{type:"number",default:2},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","radius","x_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateChart:function(){let t=this.newData;t=this.currentData?this.currentData:this.newData,console.log("Data babia-cyls:",t);const e=this.data;this.el,this.updateTitle();let i=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=i;let n=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));this.radius_scale=e.radiusMax/n;let r=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),a={};for(let t of r)a[t.getAttribute("babia-name")]={el:t,found:!1};let o,l=[],c=[],h=0;for(let i=0;i<t.length;i++){let n,r,d=t[i],u=d[e.x_axis];n=0==i?.5+d[e.radius]*this.radius_scale:c[i-1]+o+.5+d[e.radius]*this.radius_scale,a[u]&&!d._not?(r=a[u].el,a[u].found=!0):(r=document.createElement("a-entity"),r.setAttribute("babia-name",u),r.id=d[e.index],r.object3D.position.x=n,this.chartEl.appendChild(r)),s(this,r,e,d,h,u,n,0),l.push(u),c.push(n),h++,o=d[e.radius]*this.radius_scale}for(let t in a)a[t].found||a[t].el.remove();if(e.axis){const i=c[c.length-1]+(t[0][e.radius]+t[t.length-1][e.radius])*this.radius_scale/2;this.updateAxis(l,c,i,this.maxValue)}},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cyls..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let s=(t,e,i,n,a,o,s,l,c)=>{e.setAttribute("babia-cyl",{height:n[i.height]*t.lengthY/t.maxValue,radius:n[i.radius]*t.radius_scale,color:r.get(a,i.palette),label:"events",animation:i.animation}),i.legend&&(c?e.setAttribute("babia-cyl",{labelText:o+" | "+c+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius],labelLookat:i.legend_lookat,labelScale:i.legend_scale}):e.setAttribute("babia-cyl",{labelText:o+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius],labelLookat:i.legend_lookat,labelScale:i.legend_scale})),s!==e.object3D.position.x&&(i.animation?e.setAttribute("animation",{property:"object3D.position.x",to:s,dur:i.dur}):e.object3D.position.x=s),l!==e.object3D.position.z&&(i.animation?e.setAttribute("animation",{property:"object3D.position.z",to:l,dur:i.dur}):e.object3D.position.z=l)},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)};t.exports.createCylinder=s},7040:(t,e,n)=>{let r=n(1392).updateTitle;n(1392).colors;let a=n(1392).updateFunction,o=n(7232).createCylinder;const s=n(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cylsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number",default:2},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new s,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateChart:function(){const t=this.newData,e=this.data;let n=[],r=[],a=new Array,s=0,c=[],h=[];for(i=0;i<t.length;i++){let o=t[i][e.x_axis],s=t[i][e.z_axis];n.includes(o)||n.push(o),r.includes(s)||r.push(s);let l=n.indexOf(o),c=r.indexOf(s);if(a[l])a[l][c]=t[i][e.radius];else{let n=new Array;n[c]=t[i][e.radius],a[l]=n}}let d=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*this.maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=d;let u=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));for(this.radius_scale=e.radiusMax/u,i=0;i<n.length;i++){let t=Math.max.apply(Math,a[i].filter((function(t){if(""!=t)return t})));if(0==i)c.push(t*this.radius_scale);else{let e=Math.max.apply(Math,a[i-1].filter((function(t){if(""!=t)return t})));c.push(c[i-1]+t*this.radius_scale+.5+e*this.radius_scale)}}for(j=0;j<r.length;j++)rad_0=l(a,n.length,j),0==j?h.push(rad_0*this.radius_scale):(rad_1=l(a,n.length,j-1),h.push(h[j-1]+rad_1*this.radius_scale+.5+rad_0*this.radius_scale));let p=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),f={};for(let t of p)f[t.getAttribute("babia-name")]={el:t,found:!1};for(let i=0;i<t.length;i++){let a,l=t[i],d=l[e.x_axis],u=l[e.z_axis],p=d+"-"+u,g=c[n.indexOf(d)],m=h[r.indexOf(u)];f[p]&&!l._not?(a=f[p].el,f[p].found=!0):(a=document.createElement("a-entity"),a.setAttribute("babia-name",p),a.id=p,a.object3D.position.x=g,a.object3D.position.z=m,this.chartEl.appendChild(a)),s=n.indexOf(d),o(this,a,e,l,s,d,g,m,u)}for(let t in f)f[t].found||f[t].el.remove();if(e.axis){let t=Math.max.apply(Math,a[n.length-1].filter((function(t){if(""!=t)return t})));const e=c[c.length-1]+t*this.radius_scale+.5,i=h[h.length-1]+l(a,n.length,r.length-1)*this.radius_scale+.5;c+=.25,h+=.25,this.updateAxis(n,c,e,d,r,h,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,o){const s=this.data;s.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:s.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:o,palette:s.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),s.axis_name&&((s.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",s.index):this.xAxisEl.setAttribute("babia-axis-x","name",s.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",s.height),this.zAxisEl.setAttribute("babia-axis-z","name",s.z_axis)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cylsmap..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let l=(t,e,n)=>{let r=0;for(i=0;i<e;i++)t[i][n]&&r<t[i][n]&&(r=t[i][n]);return r}},575:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(t,e,i,n,a){let o=r.get(n,a);console.log("Generating slice...");let s=document.createElement("a-torus");return s.setAttribute("color",o),s.setAttribute("rotation",{x:90,y:0,z:t}),s.setAttribute("arc",e),s.setAttribute("side","double"),s.setAttribute("radius",i),s.setAttribute("radius-tubular",i/4),s}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:1,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r.setAttribute("babia-lookat",t.legend_lookat),r.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-doughnut",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){a(this,t)},tick:function(t,e){let i=this;if(this.data.animation&&this.loaded){let n=i.el.children[0].children;for(let i in this.slice_array){let r=this.slice_array[i].delay,a=this.slice_array[i].arc,o=parseFloat(n[i].getAttribute("arc"));t>=r&&o<a&&(o+=360*e/this.total_duration,o>a&&(o=a),n[i].setAttribute("arc",o))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-doughnut",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,o=0,c=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.chartEl.setAttribute("rotation",{y:90}),i.appendChild(this.chartEl);let d=0;for(let u of t){let t;if(o=360*u[e.size]/h,n){let e=this.total_duration*o/360;this.slice_array.push({arc:o,duration:e,delay:d}),d+=e,t=s(a,.01,1,c,r)}else t=s(a,o,1,c,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=o,e.legend&&l(e,t,u,i),c++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating doughnut..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},7552:()=>{AFRAME.registerComponent("babia-html",{schema:{html:{type:"string"},distanceLevels:{type:"float",default:.7},renderHTML:{type:"boolean",default:!1},renderHTMLOnlyLeafs:{type:"boolean",default:!1}},babiaDiv:null,clickedBoxes:new Map,init:function(){const t=this.data;this.observer=new MutationObserver((t=>{t.forEach((t=>{t.addedNodes&&t.addedNodes.forEach((t=>{if("babiaHtmlDiv"===t.id){console.log('A div with id "babiaHtmlDiv" has been rendered in the DOM');for(let e=0;e<t.children.length;e++)this.processNodeNoOffset(t.children[e],null,0);this.observer.disconnect()}}))}))})),this.observer.observe(document.body,{childList:!0,subtree:!0}),babiaDiv=document.createElement("div"),babiaDiv.setAttribute("id","babiaHtmlDiv"),babiaDiv.innerHTML=t.html,document.body.appendChild(babiaDiv)},processNodeNoOffset:function(t,e,i){const n=this.el,r=t.getBoundingClientRect(),a=.01;e||(e={x:r.left*a,y:r.top*a});const o=r.right*a-r.width*a/2-e.x,s=-r.bottom*a+r.height*a/2+e.y,l=document.createElement("a-box");if(l.setAttribute("position",`${o} ${s} ${i*this.data.distanceLevels}`),l.setAttribute("width",r.width*a),l.setAttribute("height",r.height*a),l.setAttribute("depth",.01),l.classList.add("babiaxraycasterclass"),l.setAttribute("html-content",t.outerHTML),l.addEventListener("mouseenter",(()=>{l.classList.contains("clicked")||this.showHtmlContent(l,t.outerHTML,"temp")})),l.addEventListener("mouseleave",(()=>{l.classList.contains("clicked")||this.removeHtmlContent("temp")})),l.addEventListener("click",(e=>{e.stopPropagation(),l.classList.contains("clicked")?(l.classList.remove("clicked"),this.removeHtmlContent("permanent",l)):(l.classList.add("clicked"),this.showHtmlContent(l,t.outerHTML,"permanent"))})),this.data.renderHTML&&"undefined"!=typeof html2canvas?this.data.renderHTMLOnlyLeafs?0==t.children.length?html2canvas(t).then((function(t){l.setAttribute("material",{shader:"flat",src:t.toDataURL()})})):l.setAttribute("color",this.colors_grad[i%this.colors_grad.length]):html2canvas(t).then((function(t){l.setAttribute("material",{shader:"flat",src:t.toDataURL()})})):l.setAttribute("color",this.colors_grad[i%this.colors_grad.length]),n.appendChild(l),i>0){let t=document.createElement("a-entity");t.setAttribute("line",{start:`${o} ${s} ${i*this.data.distanceLevels}`,end:`${o} ${s} ${i*this.data.distanceLevels-this.data.distanceLevels}`,color:"yellow"}),n.appendChild(t)}for(let n=0;n<t.children.length;n++)this.processNodeNoOffset(t.children[n],e,i+1)},showHtmlContent:function(t,e,i){"temp"===i&&this.removeHtmlContent("temp");const n=document.createElement("a-plane");n.setAttribute("class",`${i}-plane`);let r=t.getAttribute("position");n.setAttribute("position",{x:r.x,y:r.y+1,z:r.z+.2}),n.setAttribute("width","3");const a=e.split("\n").length,o=Math.max(.15*a,.2);n.setAttribute("height",o),n.setAttribute("color","white");const s=document.createElement("a-text");s.setAttribute("value",e),s.setAttribute("color","black"),s.setAttribute("align","left"),s.setAttribute("width","2.5"),s.setAttribute("position","-1 0 0.01"),n.appendChild(s),this.el.appendChild(n),"permanent"===i&&(t.permanentPlane=n)},removeHtmlContent:function(t,e){if("temp"===t){const t=document.querySelector(".temp-plane");t&&t.parentNode.removeChild(t)}else"permanent"===t&&e&&(e.permanentPlane&&(e.permanentPlane.parentNode.removeChild(e.permanentPlane),e.permanentPlane=null),this.clickedBoxes.delete(e))},colors_grad:["#4B0082","#800080","#B22222","#A0522D","#CD5C5C","#8B008B","#9932CC","#FF4500","#FF8C00","#B8860B","#D2691E","#DAA520","#ADFF2F","#7FFF00","#32CD32","#00FF00","#00FA9A","#40E0D0","#4682B4","#1E90FF","#0000FF","#4169E1","#8A2BE2","#FF00FF","#FF1493","#FF69B4","#FF6347","#FFA07A","#FFA500","#FFD700","#FFFF00","#FFFACD","#F0E68C","#E6E6FA","#F0F8FF","#E0FFFF","#AFEEEE","#ADD8E6","#87CEFA","#B0C4DE","#D3D3D3","#DDA0DD","#EE82EE","#F5DEB3","#FAFAD2","#FFE4E1","#FFF0F5","#F5F5DC","#FFFFE0","#FFF8DC","#F8F8FF","#FFFFFF"],update:function(){let t=this.data,e=this.previousOldData;if(t.html!=e.html||t.distanceLevels!=e.distanceLevels){for(this.observer&&this.observer.disconnect();this.el.firstChild;)this.el.removeChild(this.el.firstChild);this.init()}}})},647:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function t(t,i,n,r,a,o,s){o.forEach((i=>{const n=e(`primitive: plane; height: ${i.height}; width: ${i.width}`,i.label,i.color,i.position,i.rotation,i.textSize,[i.className]);t.appendChild(n)})),n.forEach((t=>{const n=e(`primitive: plane; height: ${t.height}; width: ${t.width}`,t.label,t.color,t.position,t.rotation,t.textSize,[t.className]);i.appendChild(n)}));let l=document.createElement("a-entity");l.setAttribute("rotation",r.rotation),l.setAttribute("position",r.position),l.classList.add("cross"),i.appendChild(l),a.forEach((t=>{const i=e(`primitive: plane; height: ${t.height}; width: ${t.width}`,t.label,t.color,t.position,t.rotation,t.textSize,[t.className]);l.appendChild(i)}));let c=document.createElement("a-text");c.setAttribute("value",s.label),c.setAttribute("color",s.color),c.setAttribute("position",s.position),c.setAttribute("rotation",s.rotation),c.setAttribute("width",s.textSize),c.classList.add("coordinates-text"),t.appendChild(c)}function e(t,e,i,n,r=null,a=.5,o=[]){const s=document.createElement("a-text");return s.setAttribute("geometry",t),s.setAttribute("material",`color: ${i}`),s.setAttribute("value",e),s.setAttribute("align","center"),s.setAttribute("width",a),s.setAttribute("position",n),r&&s.setAttribute("rotation",r),s.classList.add("collidable","interactive-button",...o),s}AFRAME.registerComponent("babia-map",{dependencies:["raycaster"],schema:{width:{type:"number",default:1e3},height:{type:"number",default:1e3},horTexture:{type:"number",default:2},vertTexture:{type:"number",default:2},widthSegments:{type:"int",default:200},heightSegments:{type:"int",default:200},bumpScale:{type:"number",default:300},wireframe:{type:"boolean",default:!1},token:{type:"string"},zoom:{type:"number",default:4},x:{type:"number",default:0},y:{type:"number",default:0},subdomain:{type:"string",default:"a"},textureType:{type:"string",default:"Standard"},coordinates:{type:"vec2"},handsUi:{type:"boolean",default:!0},entityRightButton:{type:"string",default:JSON.stringify({position:"0.25 201.5 -0.5",rotation:"-30 0 0"})},entityLeftButton:{type:"string",default:JSON.stringify({position:"-0.25 201.5 -0.5",rotation:"-30 0 0"})},rightButtons:{type:"string",default:JSON.stringify([{height:"0.075",width:"0.2",label:"Zoom In",color:"blue",position:"0 0.15 -0.3",rotation:"0 0 0",textSize:.6,className:"zoomInBtn"},{height:"0.075",width:"0.2",label:"Zoom Out",color:"purple",position:"0 0.05 -0.3",rotation:"-0 0 0",textSize:.6,className:"zoomOutBtn"}])},crossEntity:{type:"string",default:JSON.stringify({position:"0 -0.15 -0.25",rotation:"0 0 0"})},crossButtons:{type:"string",default:JSON.stringify([{height:"0.06",width:"0.06",label:"^",color:"darkgray",position:"0 0.1 0",textSize:.6,className:"dpadUp"},{height:"0.06",width:"0.06",label:"v",color:"darkgray",position:"0 -0.1 0",textSize:.6,className:"dpadDown"},{height:"0.06",width:"0.06",label:"<",color:"darkgray",position:"-0.125 0 0",textSize:.6,className:"dpadLeft"},{height:"0.06",width:"0.06",label:">",color:"darkgray",position:"0.125 0 0",textSize:.6,className:"dpadRight"}])},leftButtons:{type:"string",default:JSON.stringify([{height:"0.075",width:"0.2",label:"Next Layer",color:"green",position:"0 0.05 -0.3",rotation:"0 0 0",textSize:.6,className:"layerUpBtn"},{height:"0.075",width:"0.2",label:"Previous Layer",color:"orange",position:"0 -0.05 -0.3",rotation:"0 0 0",textSize:.6,className:"layerDownBtn"}])},coordinatesText:{type:"string",default:JSON.stringify({label:"Coordinates: ",color:"black",position:"-0.15 0.1 -0.2",rotation:"0 0 0",textSize:.6})}},init:function(){const e=this.data,i=this.el,n=["Coloured","Cycle","Transport","Standard","Satellite","Hot"];let r=n.indexOf(i.getAttribute("babia-map").textureType);-1===r&&(r=0);const a=[{height:"0.075",width:"0.2",label:"Zoom In",color:"blue",position:"-0.2 0.1 -0.3",rotation:"-30 0 0",textSize:.6,className:"zoomInBtn"},{height:"0.075",width:"0.2",label:"Zoom Out",color:"purple",position:"-0.2 0 -0.25",rotation:"-30 0 0",textSize:.6,className:"zoomOutBtn"}],o={position:"0.2 0 -0.2",rotation:"-30 0 0"},s=[{height:"0.06",width:"0.06",label:"^",color:"darkgray",position:"-0.125 0.175 0",textSize:.6,className:"dpadUp"},{height:"0.06",width:"0.06",label:"v",color:"darkgray",position:"-0.125 0.025 0",textSize:.6,className:"dpadDown"},{height:"0.06",width:"0.06",label:"<",color:"darkgray",position:"-0.2 0.1 0",textSize:.6,className:"dpadLeft"},{height:"0.06",width:"0.06",label:">",color:"darkgray",position:"-0.05 0.1 0",textSize:.6,className:"dpadRight"}],l=[{height:"0.075",width:"0.2",label:"Next Layer",color:"green",position:"0 0.2 -0.3",rotation:"-30 0 0",textSize:.6,className:"layerUpBtn"},{height:"0.075",width:"0.2",label:"Previous Layer",color:"orange",position:"0 0.1 -0.25",rotation:"-30 0 0",textSize:.6,className:"layerDownBtn"}],c={label:"Coordinates: ",color:"black",position:"-0.15 0 -0.2",rotation:"-30 0 0",textSize:.6};let h=[],d=[],u=[],p=[],f=[],g=[],m=[];try{const y=document.querySelector("a-scene");function b(t){const e=`#${t}Hand`;let i=document.querySelector(e);return i||(i=document.querySelector(`[laser-controls][hand="${t}"]`),i||(i=document.querySelector(`[oculus-touch-controls][hand="${t}"]`),i||null))}const _=b("left"),A=b("right");let x=!1;const E={layerUp:()=>{r<n.length-1&&(r++,S())},layerDown:()=>{r>0&&(r--,S())},zoomIn:()=>I(!0),zoomOut:()=>I(!1),mouseEnter:t=>{t.target.setAttribute("material","color","yellow")},mouseLeave:t=>{const e=t.target,i=e.classList.contains("zoomInBtn")?"blue":e.classList.contains("zoomOutBtn")?"purple":e.classList.contains("layerUpBtn")?"green":e.classList.contains("layerDownBtn")?"orange":"darkgray";e.setAttribute("material","color",i)},moveUp:()=>T("up"),moveDown:()=>T("down"),moveRight:()=>T("right"),moveLeft:()=>T("left")};function v(t,...e){const i=(e,i,n)=>{e[t?"addEventListener":"removeEventListener"](i,n)};e.forEach((t=>{const e={".layerUpBtn":E.layerUp,".layerDownBtn":E.layerDown,".zoomInBtn":E.zoomIn,".zoomOutBtn":E.zoomOut,".dpadUp":E.moveUp,".dpadDown":E.moveDown,".dpadLeft":E.moveLeft,".dpadRight":E.moveRight};[t,...t.querySelectorAll(".cross")].forEach((t=>{for(const[n,r]of Object.entries(e))t.querySelectorAll(n).forEach((t=>i(t,"click",r)))})),t.querySelectorAll(".interactive-button").forEach((t=>{i(t,"mouseenter",E.mouseEnter),i(t,"mouseleave",E.mouseLeave)}))}))}let C=t=>{t.addEventListener("gripdown",(function(){const e=t.children;x=!x;for(let t=0;t<e.length;t++)e[t].setAttribute&&e[t].setAttribute("visible",x)}))};h=JSON.parse(e.crossButtons),d=JSON.parse(e.entityRightButton),u=JSON.parse(e.entityLeftButton),p=JSON.parse(e.rightButtons),f=JSON.parse(e.crossEntity),g=JSON.parse(e.leftButtons),m=JSON.parse(e.coordinatesText);let M=document.createElement("a-entity");M.setAttribute("position",u.position),M.setAttribute("rotation",u.rotation),M.classList.add("left-desktop-ui-position"),i.appendChild(M);let w=document.createElement("a-entity");w.setAttribute("position",d.position),w.setAttribute("rotation",d.rotation),w.classList.add("right-desktop-ui-position"),i.appendChild(w),t(M,w,p,f,h,g,m),e.handsUi&&(t(_,A,a,o,s,l,c),y.addEventListener("enter-vr",(()=>{console.log("Conectado a VR"),x=!0,M.setAttribute("visible",!1),w.setAttribute("visible",!1),_.setAttribute("visible",!0),A.setAttribute("visible",!0),C(_),C(A),v(!0,_,A),v(!1,M,w)})),y.addEventListener("exit-vr",(()=>{console.log("Saliendo de VR"),x=!1,M.setAttribute("visible",!0),w.setAttribute("visible",!0),_.setAttribute("visible",!1),A.setAttribute("visible",!1),v(!1,_,A),v(!0,M,w)})));const S=()=>{const t=n[r];console.log("Cambiando a capa:",t),i.setAttribute("babia-map","textureType",t),this.buildMesh(e,i)},I=t=>{let n=i.getAttribute("babia-map").zoom,r=i.getAttribute("babia-map").x,a=i.getAttribute("babia-map").y;!0===t&&n<19?(n+=1,r=Math.min(2*r,Math.pow(2,n)-1),a=Math.min(2*a,Math.pow(2,n)-1)):!t&&n>0&&(n-=1,r=Math.max(0,Math.trunc(r/2)),a=Math.max(0,Math.trunc(a/2))),i.setAttribute("babia-map","zoom",n),i.setAttribute("babia-map","x",r),i.setAttribute("babia-map","y",a),this.buildMesh(e,i)},T=t=>{let n=i.getAttribute("babia-map").zoom,r=i.getAttribute("babia-map").x,a=i.getAttribute("babia-map").y;const o=Math.pow(2,n)-1,s=o;switch(console.log(t),t){case"up":a>0&&(a-=1);break;case"down":a<s&&(a+=1);break;case"right":r<o&&(r+=1);break;case"left":r>0&&(r-=1);break;default:console.error("Opción de movimiento no permitida.")}i.setAttribute("babia-map","x",r),i.setAttribute("babia-map","y",a),this.buildMesh(e,i)};_.addEventListener("click",(t=>{const n=t.detail.intersection;if(!n)return;if(n.object.el!==i)return;const r=n.point.clone(),a=i.object3D.worldToLocal(r),o=a.x,s=a.y,l=a.z,c=function(t,e,i){const n=i.getAttribute("babia-map").zoom,r=i.getAttribute("babia-map").x,a=i.getAttribute("babia-map").y,o=i.getAttribute("babia-map").width,s=i.getAttribute("babia-map").height,l=(t+o/2)/o,c=1-(e+s/2)/s,h=Math.pow(2,n),d=r+l,u=a+c;console.log(`Global: ${d}, ${u}`);const p=d/h*360-180;return{lat:Math.atan(Math.sinh(Math.PI*(1-2*u/h)))*(180/Math.PI),lon:p}}(o,l,i);i.setAttribute("babia-map","coordinates",{x:c.lat,y:c.lon});let h=i.querySelector(".marker");h?(h.object3D.position.set(o,s+e.bumpScale/1.5,l),h.setAttribute("visible","true")):(h=document.createElement("a-entity"),h.setAttribute("geometry",{primitive:"sphere",radius:e.width/100}),h.setAttribute("material",{color:"red"}),h.setAttribute("position",{x:o,y:s+e.bumpScale/1.5,z:l}),h.classList.add("marker"),i.appendChild(h));const d=i.getAttribute("babia-map").coordinates;console.log(`Coordenadas: ${d.x.toFixed(2)}, ${d.y.toFixed(2)}`),i.querySelectorAll(".coordinates-text").forEach((t=>{t.setAttribute("value",`Coordenadas: ${d.x.toFixed(2)}, ${d.y.toFixed(2)}`)})),e.handsUi&&_.querySelector(".coordinates-text").setAttribute("value",`Coordenadas: ${d.x.toFixed(2)}, ${d.y.toFixed(2)}`)})),v(!0,M,w);const U=document.querySelector("#token-form"),F=document.querySelector("#token-input"),B=localStorage.getItem("babia-map-token");B&&(F.value=B,e.token=B,this.buildMesh(e,i)),U&&F?U.addEventListener("submit",(t=>{t.preventDefault();const n=F.value.trim();n?(e.token=n,localStorage.setItem("babia-map-token",n),console.log("Token actualizado:",n),this.buildMesh(e,i)):alert("Por favor, introduce un token válido.")})):console.warn("Formulario de token no encontrado en el DOM.")}catch(R){console.warn("Error:",R)}},remove:function(){this.el.removeObject3D("mesh")},update:function(t){const e=this.data,i=this.el;e.token===t.token&&e.textureType===t.textureType||(i.removeObject3D("mesh"),this.buildMesh(e,i))},buildMesh:function(t,e){let i,n,r=`https://api.mapbox.com/v4/mapbox.terrain-rgb/${t.zoom}/${t.x}/${t.y}@2x.pngraw?access_token=${t.token}`;(async function(t){let e=new Image;return e.src=t,e.crossOrigin="Anonymous",new Promise(((t,r)=>{e.onload=()=>{const r=document.createElement("canvas");r.width=e.width,r.height=e.height;const a=r.getContext("2d");a.translate(0,r.height),a.scale(1,-1),a.drawImage(e,0,0);const o=a.getImageData(0,0,e.width,e.height).data,s=new Float32Array(e.width*e.height);let l,c=1,h=0;for(let t=0;t<o.length;t+=4)l=.1*(256*o[t]*256+256*o[t+1]+o[t+2])-1e4,l=(l+1e4)/2e4,l<c&&(c=l),l>h&&(h=l),s[t/4]=l;i=c,n=h;const d=new THREE.DataTexture(s,e.width,e.height,THREE.RedFormat,THREE.FloatType);d.needsUpdate=!0,t(d)},e.onerror=r}))})(r).then((a=>{let o,s;if(console.log("Displacement map cargado:",r),a.wrapS=a.wrapT=THREE.RepeatWrapping,a.repeat.set(t.horTexture,t.vertTexture),"Coloured"===t.textureType)o={bumpTexture:{type:"t",value:a},bumpScale:{type:"f",value:t.bumpScale},minHeight:{value:i},maxHeight:{value:n}},console.log("Uniforms:",o),s=new THREE.ShaderMaterial({uniforms:o,vertexShader:"\n uniform sampler2D bumpTexture;\n uniform float bumpScale;\n varying float vAmount;\n void main() {\n vec4 bumpData = texture2D(bumpTexture, uv);\n vAmount = bumpData.r;\n vec3 newPosition = position + normal * bumpScale * vAmount;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n }\n ",fragmentShader:"\n uniform float minHeight;\n uniform float maxHeight;\n varying float vAmount;\n void main() {\n float totalHeight = maxHeight - minHeight;\n float maxWater = minHeight + totalHeight * 0.55;\n float minSand = minHeight + totalHeight * 0.54;\n float maxSand = minHeight + totalHeight * 0.57;\n float minGrass = minHeight + totalHeight * 0.56;\n float maxGrass = minHeight + totalHeight * 0.7;\n float minRock = minHeight + totalHeight * 0.60;\n float maxRock = minHeight + totalHeight * 0.80;\n float minSnow = minHeight + totalHeight * 0.65;\n\n vec3 water = (smoothstep(0.00, maxWater, vAmount) - smoothstep(minSand, maxWater, vAmount)) * vec3(0.0, 0.0, 1.0);\n vec3 sand = (smoothstep(minSand, maxSand, vAmount) - smoothstep(minGrass, maxSand, vAmount)) * vec3(0.76, 0.7, 0.5);\n vec3 grass = (smoothstep(minGrass, maxGrass, vAmount) - smoothstep(minRock, maxGrass, vAmount)) * vec3(0.0, 0.6, 0.01);\n vec3 rock = (smoothstep(minRock, maxRock, vAmount) - smoothstep(minSnow, maxRock, vAmount)) * vec3(0.28, 0.25, 0.23);\n vec3 snow = (smoothstep(minSnow, 1.0, vAmount)) * vec3(1.0, 1.0, 1.0);\n\n gl_FragColor = vec4(water + sand + grass + rock + snow, 1.0);\n }\n "});else{let e;switch(t.textureType){case"Standard":e=`https://tile.openstreetmap.org/${t.zoom}/${t.x}/${t.y}.png`;break;case"Satellite":e=`https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/256/${t.zoom}/${t.x}/${t.y}?access_token=${t.token}`;break;case"Hot":e=`https://tile-a.openstreetmap.fr/hot/${t.zoom}/${t.x}/${t.y}.png`;break;case"Cycle":e=`https://${t.subdomain}.tile.thunderforest.com/cycle/${t.zoom}/${t.x}/${t.y}.png`;break;case"Transport":e=`https://${t.subdomain}.tile.thunderforest.com/transport/${t.zoom}/${t.x}/${t.y}.png`;break;default:console.error("Tipo de textura no soportado")}const i=(new THREE.TextureLoader).load(e);o={bumpTexture:{type:"t",value:a},bumpScale:{type:"f",value:t.bumpScale},mapTexture:{value:i}},console.log("Uniforms:",o),s=new THREE.ShaderMaterial({uniforms:o,vertexShader:"\n uniform sampler2D bumpTexture;\n uniform float bumpScale;\n varying vec2 vUv;\n\n varying float vAmount;\n void main() {\n vUv = uv;\n vec4 bumpData = texture2D(bumpTexture, uv);\n vAmount = bumpData.r; // Solo canal rojo\n vec3 newPosition = position + normal * bumpScale * vAmount;\n\n // Posición final del vértice con transformación del modelo, vista y proyección\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D mapTexture;\n varying vec2 vUv;\n\n void main() {\n vec3 textureColor = texture2D(mapTexture, vUv).rgb;\n gl_FragColor = vec4(textureColor, 1.0);\n }\n "})}const l=new THREE.PlaneGeometry(t.width,t.height,t.widthSegments,t.heightSegments);let c=new THREE.Mesh(l,s);c.rotation.x=-Math.PI/2,c.position.y=0,e.setObject3D("mesh",c),console.log(t)}),(t=>{console.error("Error al cargar el displacement map:",t)}))}})},1987:(t,e,i)=>{let n=i(1392).findProdComponent,r=i(1392).parseJson;const a=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let o=i(4468);"default"in o&&(o=o.default);let s=i(8524);"default"in s&&(s=s.default);let l=function(t){if("function"==typeof t)return t;let e=eval;try{return e("("+t+")")}catch(t){}return null},c=function(t){return isNaN(parseFloat(t))?l(t)?l(t):t:parseFloat(t)},h="";AFRAME.registerComponent("babia-network",{schema:{nodeLegend:{type:"boolean",default:!1},linkLegend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},from:{type:"string"},nodesFrom:{type:"string"},linksFrom:{type:"string"},data:{type:"string",default:""},nodes:{type:"string",default:""},links:{type:"string",default:""},nodeId:{type:"string",default:"id"},nodeLabel:{parse:c,default:"id"},linkId:{type:"string",default:""},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},nodeVal:{type:"string",default:""},nodeRelSize:{type:"number",default:4},nodeColor:{parse:c,default:"color"},nodeAutoColorBy:{parse:c,default:""},nodeResolution:{type:"number",default:8},linkColor:{parse:c,default:"color"},linkAutoColorBy:{parse:c,default:""},linkWidth:{parse:c,default:0},linkResolution:{type:"number",default:6},linkLabel:{parse:c,default:""},nodeDesc:{parse:c,default:"desc"},linkDesc:{parse:c,default:"desc"},nodeVisibility:{parse:c,default:!0},nodeOpacity:{type:"number",default:1},linkVisibility:{parse:c,default:!0},linkOpacity:{type:"number",default:1},nodeThreeObject:{parse:c,default:null},nodeThreeObjectExtend:{parse:c,default:!1},linkCurvature:{parse:c,default:0},linkCurveRotation:{parse:c,default:0},linkMaterial:{parse:c,default:null},linkThreeObject:{parse:c,default:null},linkThreeObjectExtend:{parse:c,default:!1},linkPositionUpdate:{parse:l,default:null},linkDirectionalArrowLength:{parse:c,default:0},linkDirectionalArrowColor:{parse:c,default:null},linkDirectionalArrowRelPos:{parse:c,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:c,default:0},linkDirectionalParticleSpeed:{parse:c,default:.01},linkDirectionalParticleWidth:{parse:c,default:.5},linkDirectionalParticleColor:{parse:c,default:null},linkDirectionalParticleResolution:{type:"number",default:4},linkDistance:{type:"number",default:30},linkHoverPrecision:{type:"number",default:2},onNodeCenterHover:{parse:l,default:function(){}},onLinkCenterHover:{parse:l,default:function(){}},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:l,function:()=>!0},onDagError:{parse:l,default:void 0},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:r,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:l,default:function(){}},onEngineStop:{parse:l,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new s),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new s);const t=this.forceGraph,e=t.emitParticle.apply(t,arguments);return e===t?this:e},d3Force:function(){this.forceGraph||(this.forceGraph=new s);const t=this.forceGraph,e=t.d3Force.apply(t,arguments);return e===t?this:e},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},visProperties:{nodes:["nodeId"],links0:["linkId"],links1:["linkSource","linkTarget"]},init:function(){const t=this;this.isFirstTimeNodes=!0,this.isFirstTimeLinks=!0,this.notiBuffer=new a;let e=this.state={},i=document.querySelector("a-entity[camera], a-camera");e.cameraObj=i.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(t){e.cameraObj=t.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new s),this.el.object3D.add(this.forceGraph),this.data.linkDistance&&this.forceGraph.d3Force("link").distance((function(){return t.data.linkDistance})),h=document.querySelector("[cursor]"),document.addEventListener("controllerconnected",(t=>{h=document.querySelector("[laser-controls]")}))},update:function(t){let e=this.el,i=this.data;if(this.currentData=t,i.data&&t.data!==i.data){let t=r(i.data);this.processData(t)}else if(i.nodes){if(t.nodes!==i.nodes){let t=r(i.nodes);this.processNodes(t)}if(t.links!==i.links){let t=r(i.links);this.processLinks(t)}}else if(i.from===t.from||i.nodesFrom){if(i.nodesFrom!==t.nodesFrom||i.linksFrom!==t.linksFrom){this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId);let t=n(i,e);this.nodesProdComponent=t.nodes,this.nodesProdComponent.notiBuffer&&(this.notiBufferId=this.nodesProdComponent.notiBuffer.register(this.processNodes.bind(this))),this.linksProdComponent=t.links,this.linksProdComponent.notiBuffer&&(this.notiBufferId=this.linksProdComponent.notiBuffer.register(this.processLinks.bind(this)))}else if(i!==t)if(this.newData){let t=r(this.newData);this.processData(t,!0)}else if(this.newNodes)if(i.linkSource!=t.linkSource||i.linkTarget!=t.linkTarget){let t=r(this.newLinks);this.processLinks(t,!0)}else{let t=r(this.newNodes);this.processNodes(t,!0)}}else this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(i,e),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))},tick:function(t,e){if(h){if(h.components.raycaster.raycaster){let t=h.components.raycaster.raycaster.intersectObjects(this.forceGraph.children).filter((function(t){return-1!==["node","link"].indexOf(t.object.__graphObjType)})).sort((function(t,e){return i(e)-i(t);function i(t){return"node"===t.object.__graphObjType}})),e=t.length?t[0].object:null;if(e!==this.state.hoverObj){const t=this.state.hoverObj?this.state.hoverObj.__graphObjType:null,i=this.state.hoverObj?this.state.hoverObj.__data:null,n=e?e.__graphObjType:null,r=e?e.__data:null;t&&t!==n&&this.data["on"+("node"===t?"Node":"Link")+"CenterHover"](null,i),(this.data.nodeLegend&&"node"===t||this.data.linkLegend&&""!=this.data.linkLabel&&"link"===t)&&this.removeLegend(this),n&&this.data["on"+("node"===n?"Node":"Link")+"CenterHover"](r,t===n?i:null),this.state.hoverObj=e,e&&(this.data.nodeLegend&&"node"===e.__graphObjType?this.showLegend(e,e.__data,this.data.nodeLabel,this.el.getAttribute("scale")):this.data.linkLegend&&"link"===e.__graphObjType&&""!=this.data.linkLabel&&this.showLinkLegend(e,e.__data,this.data.linkLabel,this.el.getAttribute("scale")))}}}else h=document.querySelector("[cursor]");this.forceGraph.tickFrame()},prodComponent:void 0,nodesProdComponent:void 0,linksProdComponent:void 0,notiBufferId:void 0,newData:void 0,newNodes:void 0,newLinks:void 0,isFirstTimeNodes:void 0,isFirstTimeLinks:void 0,nodeFields:void 0,linkFields:void 0,currentData:void 0,babiaMetadata:{id:0},legend:"",updateChart:function(t,e){if(e.currentData){let i=[];for(let t in this.data)i[t]=this.data[t];i.nodes=t.nodes,i.links=t.links;let n=AFRAME.utils.diff(i,e.currentData);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(t){return t in n})).forEach((function(t){e.forceGraph[t](""!==i[t]?i[t]:null)})),("nodes"in n||"links"in n)&&e.forceGraph.graphData({nodes:i.nodes,links:i.links})}},processData:function(t,e){if(console.log("processData",this),this.newData!=t||e){this.newData=t;let e=this.elDataFromData(t);this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set(t)}},processNodes:function(t,e){if(console.log("processNodes",this),this.newNodes!=t||e){this.newNodes=t;let e=this.elDataFromNodesAndLinks(t,this.newLinks);if(e)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set({nodes:e.nodes,links:e.links});else if(this.data.links){let t=r(this.data.links);this.processLinks(t)}else this.data.linksFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},processLinks:function(t,e){console.log("processLinks",this);let i=r(t);if(this.newLinks!=i||e){this.newLinks=i;let t=this.elDataFromNodesAndLinks(this.newNodes,i);if(t)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(t,this),this.notiBuffer.set({nodes:t.nodes,links:t.links});else if(this.data.nodes){let t=r(this.data.nodes);this.processNodes(t)}else this.data.nodesFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},elDataFromData:function(t){let e=[],i=[];const n=this.data.nodeId,r=this.data.linkId,a=this.data.nodeVal,o=this.data.linkSource,s=this.data.linkTarget,l=this.data.linkLabel;return t.forEach((t=>{let i={};Object.keys(t).forEach((function(e){e===n&&(i[n]=t[e]),e===r&&(i.linkId=t[e]),e===a&&(i[a]=t[e])})),e.push(i)})),e.forEach((t=>{e.forEach((e=>{if(t[n]!==e[n]&&t.linkId===e.linkId)if(i.length>0){let r=!1;if(i.forEach((i=>{(i[o]===t[n]&&i[s]===e[n]||i[o]===e[n]&&i[s]===t[n])&&(r=!0)})),!r){let r={};r[l]=t[l],r[o]=t[n],r[s]=e[n],i.push(r)}}else{let r={};r[l]=t[l],r[o]=t[n],r[s]=e[n],i.push(r)}}))})),{nodes:e,links:i}},elDataFromNodesAndLinks:function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;this.isFirstTimeNodes&&(this.nodeFields=[],Object.keys(t[0]).forEach((t=>{this.nodeFields.push(t)})),this.isFirstTimeNodes=!1),this.isFirstTimeLinks&&(this.linkFields=[],Object.keys(e[0]).forEach((t=>{this.linkFields.push(t)})),this.isFirstTimeLinks=!1),"object"==typeof e[0].source&&e.forEach((t=>{t.source=t.source[this.data.nodeId],t.target=t.target[this.data.nodeId]}));let i=[];t.forEach((t=>{let e={};Object.keys(t).forEach((i=>{for(let n in this.nodeFields)i==this.nodeFields[n]&&(e[i]=t[i])})),i.push(e)}));let n=[];return e.forEach((t=>{let e={};Object.keys(t).forEach((i=>{for(let n in this.linkFields)i==this.linkFields[n]&&i!=this.data.linkId&&(e[i]=t[i])})),n.push(e)})),{nodes:i,links:n}},showLegend:function(t,e,i,n){let r=new THREE.Vector3;t.getWorldPosition(r);let a=t.geometry.boundingSphere.radius,o=document.querySelector("a-scene");this.legend=function(t,e,i,n,r,a){let o=e[i];if(o){let i=2,s=1;if(o.length>16&&(i=o.length/5),t){let n="\n "+t.nodeVal+" (radius): "+Math.round(100*e[t.nodeVal])/100;if(n.length>16&&(i=n.length/5),o+=n,t.nodeAutoColorBy){let r="\n "+t.nodeAutoColorBy+" (color): "+e[t.nodeAutoColorBy];r.length>16&&r>n&&(i=r.length/5),o+=r}else{let r="\n "+t.nodeAutoColorBy+" (color): "+e[t.nodeAutoColorBy];r.length>16&&r>n&&(i=r.length/5),o+=r}}let l=3,c=3,h=3;o.length>16&&(i=o.length/16),a&&(l=l*a.x*t.legend_scale,c=c*a.y*t.legend_scale,h=h*a.z*t.legend_scale,r=(r+3)*a.y*t.legend_scale);let d=document.createElement("a-plane");return d.setAttribute("position",{x:n.x,y:n.y+r,z:n.z}),d.setAttribute("babia-lookat",t.legend_lookat),d.setAttribute("width",i),d.setAttribute("height",s),d.setAttribute("color","white"),d.setAttribute("scale",{x:l*t.legend_scale,y:c*t.legend_scale,z:h*t.legend_scale}),d.setAttribute("material",{side:"double"}),d.setAttribute("text",{value:o,align:"center",width:6,color:"black",alphaTest:6,opacity:6,transparent:!1}),d.classList.add("babiaxrLegend"),d}}(this.data,e,i,r,a,n),this.legend&&o.appendChild(this.legend)},showLinkLegend:function(t,e,i,n){let r=new THREE.Vector3,a=t.geometry.boundingSphere.radius,o=new THREE.Vector3,s=new THREE.Vector3;this.forceGraph.children.filter((t=>"node"==t.__graphObjType)).forEach((t=>{t.__data[this.data.nodeId]==e.source[this.data.nodeId]&&t.getWorldPosition(o),t.__data[this.data.nodeId]==e.target[this.data.nodeId]&&t.getWorldPosition(s)})),r.x=(o.x+s.x)/2,r.y=(o.y+s.y)/2,r.z=(o.z+s.z)/2;let l=document.querySelector("a-scene");this.legend=function(t,e,i,n,r,a){let o=e[i];if(o){let s=2,l=3,c=3,h=3;o.length>16&&(s=o.length/8),a&&(l*=a.x,c*=a.y,h*=a.z,r=(r+3)*a.y);let d=document.createElement("a-plane");return d.setAttribute("position",{x:n.x,y:n.y+r,z:n.z}),d.setAttribute("babia-lookat",t.legend_lookat),d.setAttribute("width",s),d.setAttribute("height","1"),d.setAttribute("color","white"),d.setAttribute("scale",{x:l*t.legend_scale,y:c*t.legend_scale,z:h*t.legend_scale}),d.setAttribute("material",{side:"double"}),d.setAttribute("text",{value:e[i],align:"center",width:6,color:"black",alphaTest:6,opacity:6,transparent:!1}),d.classList.add("babiaxrLegend"),d}}(this.data,e,i,r,a,n),this.legend&&l.appendChild(this.legend)},removeLegend:function(){this.legend&&document.querySelector("a-scene").removeChild(this.legend)}})},5723:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(t,e,i,n,a){let o=r.get(n,a);console.log("Generating slice...");let s=document.createElement("a-cylinder");return s.setAttribute("color",o),s.setAttribute("theta-start",t),s.setAttribute("theta-length",e),s.setAttribute("side","double"),s.setAttribute("radius",i),s}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:0,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r.setAttribute("babia-lookat",t.legend_lookat),r.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-pie",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){a(this,t)},tick:function(t,e){let i=this;if(this.data.animation&&this.loaded){let n=i.el.children[0].children;for(let i in this.slice_array){let r=this.slice_array[i].delay,a=this.slice_array[i].degreeLenght,o=parseFloat(n[i].getAttribute("theta-length"));t>=r&&o<a&&(o+=360*e/this.total_duration,o>a&&(o=a),n[i].setAttribute("theta-length",o))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-pie:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,o=0,c=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl);let d=0;for(let u of t){let t;if(o=360*u[e.size]/h,n){let e=this.total_duration*o/360;this.slice_array.push({degreeLenght:o,duration:e,delay:d}),d+=e,t=s(a,.01,1,c,r)}else t=s(a,o,1,c,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=o,e.legend&&l(e,t,u,i),c++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating pie..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},7100:()=>{AFRAME.registerComponent("babia-terrain",{schema:{width:{type:"number",default:1},height:{type:"number",default:1},segmentsHeight:{type:"number",default:1},segmentsWidth:{type:"number",default:1},data:{type:"array"},color:{type:"string",default:"0xdddddd"},filled:{type:"boolean",default:!1}},init:function(){var t=this.data,e=this.el,i=t.data;console.log("Vertices:"),console.log(i),this.geometry=new THREE.PlaneGeometry(t.width,t.height,t.segmentsHeight,t.segmentsWidth);for(var n=0,r=this.geometry.vertices.length;n<r;n++)this.geometry.vertices[n].z=i[n];var a=t.color;t.filled?this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!1}):this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!0}),this.mesh=new THREE.Mesh(this.geometry,this.material),e.setObject3D("mesh",this.mesh)}})},9781:t=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let e;AFRAME.registerComponent("babiaxr-codecity",{schema:{absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string",default:JSON.stringify({id:"CodeCity",area:1,height:1})},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){},update:function(t){this.loader=new THREE.FileLoader;let n=this.data,s=this.el;h=n.building_color,e=s,"string"==typeof n.data?n.data.endsWith("json")?raw_items=d(n):raw_items=JSON.parse(n.data):raw_items=n.data,s.emit("babiaxr-dataLoaded",{data:raw_items,codecity:!0}),b=n.time_evolution_delta,this.zone_data=raw_items;let l,g,v=new i({data:this.zone_data,extra:function(t){return t*n.extra},farea:n.farea,fheight:n.fheight,fmaxarea:n.fmaxarea});1==n.absolute?(l=Math.sqrt(v.areas.canvas)*n.width/n.depth,g=v.areas.canvas/l):(l=n.width,g=n.depth);let y=!1,x=new r({width:l,depth:g,x:0,z:0});v.add_rects({rect:x,split:n.split,relative:y});let M=document.createElement("a-entity");this.base=M,v.draw_rects({ground:x,el:M,base:n.base,level:0,elevation:0,relative:y,base_thick:n.base_thick,wireframe:n.wireframe,building_color:n.building_color,base_color:n.base_color,model:n.building_model,visible:!0,titles:n.titles}),s.appendChild(M),u&&(time_evolution_past_present=n.time_evolution_past_present,p=n.time_evolution_animation,f=n.time_evolution_color,A(n),function(){const t=Object.keys(m).length;let e=0;a&&(document.addEventListener("babiaxrToPast",(function(){time_evolution_past_present=!1})),document.addEventListener("babiaxrToPresent",(function(){time_evolution_past_present=!0})),document.addEventListener("babiaxrStop",(function(){clearInterval(c)})),document.addEventListener("babiaxrContinue",(function(){c=setTimeout((function(){E(t,e),e<t-1&&i()}),b)})),document.addEventListener("babiaxrSkipNext",(function(){time_evolution_past_present=!1,clearInterval(c),B(t-_-1),o=t-_-1,e--,_--,C()})),document.addEventListener("babiaxrSkipPrev",(function(){time_evolution_past_present=!0,clearInterval(c),B(t-_-3),o=t-_-3,e++,_++,C()})),document.addEventListener("babiaxrShow",(function(i){clearInterval(c),eventData=i.detail.data,e=eventData.data,B(t-e-1),o=t-e-1,_=e-1,C(!0)})));let i=()=>{c=setTimeout((function(){a&&B(t-_-2),o=t-_-2,E(t,e),e<t-1&&i()}),b)};i()}())},remove:function(){},play:function(){}});let i=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea],n.max_area=i[this.fmaxarea],n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:r="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,a=new n(e.children.map((t=>t.canvas)),e.inner);if("naive"===r)t=e.rect.split(a,i);else{if("pivot"!==r)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(a,i)}for(const n in e.children)this.add_rects({rect:t[n],area:e.children[n],relative:i,split:r})}}draw_rects({ground:t,el:i,area:n=this.areas,level:r=0,elevation:a=0,relative:o=!0,base_thick:s=.2,wireframe:l=!1,building_color:c="red",base_color:h="green",model:d=null,visible:u=!0,titles:p=!0}){if(0===r&&(this.el=i),this.pending_rects,"children"in n){let t=n.rect.box({elevation:a,height:s,color:h,inner:!1,wireframe:l,visible:u,id:n.data.id,rawarea:0});if(p){let i,n;t.addEventListener("click",(function(){if(i)e.removeChild(n),e.removeChild(i),i=void 0,n=void 0;else{n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("geometry",{height:r.height+10,depth:r.depth,width:r.width}),n.setAttribute("position",a),n.setAttribute("material",{visible:!0,opacity:.4}),i=x(this.getAttribute("id"),r.height+10,a,null,e),e.appendChild(i),e.appendChild(n)}}))}t.setAttribute("class","babiaxraycasterclass"),i.appendChild(t);let f=t;o||(f=i);for(const t of n.children){let e=s/2;o||(e=a+s),this.draw_rects({ground:n.rect,el:f,area:t,level:r+1,elevation:e,relative:o,building_color:c,base_color:h,model:d,base_thick:s,wireframe:l,visible:u,titles:p})}}else{n.data[this.fheight];let t=n.rect.box({height:n.data[this.fheight],elevation:a,wireframe:l,color:c,model:d,visible:u,id:n.data.id,rawarea:n.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),i.appendChild(t),p){let i,n,r=!1;t.addEventListener("click",(function(){r?(e.removeChild(i),e.removeChild(n),i=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),i=x(this.getAttribute("id"),r.height+.1,a,null,e),e.appendChild(i),e.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&i&&(e.removeChild(i),e.removeChild(n),i=void 0,n=void 0)}))}}}},n=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce(((t,e)=>t+e),0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new n(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,r,a=this.imax();if(this.items.lenght==a+1)return{pivot:a,a1:n.range(0,a),a2:[],a3:[]};if(this.items.length==a+2)return{pivot:a,a1:n.range(0,a),a2:[a+1],a3:[]};let o=t*e,s=this.scaled_area(o,a),l=Math.sqrt(s)*e-s,c=0,h=c,d=a+1;for(;c<l&&d<this.items.length;)h=c,c+=this.scaled_area(o,d),d++;let u=d;return d-1>a&&Math.abs(c-l)>Math.abs(h-l)&&(u=d-1),i=u-a-1,r=this.items.length-u,{pivot:a,a1:n.range(0,a),a2:n.range(a+1,i),a3:n.range(a+1+i,r)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},r=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,a,o,s]=this.idims_as_laying(),l=i/t.total,c=-i/2,h=0;e||(c+=a,h=o);let d=[];for(const e of t.items){let t=e*l,i=new r({width:t,depth:n,x:c+t/2,z:h});s&&i.reflect(),d.push(i),c+=t}return d}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,a,o,s]=this.idims_as_laying();e&&(a=0,o=0);let{pivot:l,a1:c,a2:h,a3:d}=t.pivot_regions(i,n),u=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(l),i),f=t.pivot_region_width(d,i),g=a-i/2+u/2,m=a-i/2+u+p/2,b=a-i/2+u+p+f/2,v=[],y=t.scaled_area(i*n,l)/p;v[l]=new r({width:p,depth:y,x:m,z:o+n/2-y/2});let _=[[c,u,n,g,o],[h,p,n-y,m,o-y/2],[d,f,n,b,o]];for(const[e,i,n,a,o]of _)if(e.length>0){let s=new r({width:i,depth:n,x:a,z:o});s.inner();let l=t.values_i(e),c=s.split_pivot(l,!1),h=0;for(const t of e)v[t]=c[h],h++}if(s)for(const t of v)t.reflect();return v}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:o=!0,id:s="",rawarea:l=0,inner_real:c=!1}){let h,d;[h,d]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let u=document.createElement("a-entity");return u.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:d,height:t}),u.setAttribute("material",{color:i}),u.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),u.setAttribute("id",s),u.setAttribute("babiaxr-rawarea",l),u}};t.exports={Values:n,Rectangle:r,Zone:i};let a,o,s,l,c,h,d=t=>{let e,i=t.data,n=new XMLHttpRequest;if(n.open("get",i,!1),n.onload=function(){this.status>=200&&this.status<300?e="string"==typeof n.response||n.response instanceof String?JSON.parse(n.response):n.response:reject({status:this.status,statusText:xhr.statusText})},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText})},n.send(),e.time_evolution){v=e,u=!0,g=e.time_evolution_commit_by_commit;let i=e.data_files.find((t=>"data_0_tree"===t.key_tree));e=i.data_0_tree,l=i.data_0;let n=[];for(let t=0;t<v.data_files.length;t++)m["data_"+t]=v.data_files[t],n.push({date:new Date(1e3*v.data_files[t].date).toLocaleDateString(),commit:v.data_files[t].commit_sha,data:t});if(t.ui_navbar&&(o=t.time_evolution_past_present?parseInt(t.time_evolution_init.split("_")[1]):v.data_files.length-1,a=t.ui_navbar,document.getElementById(a).setAttribute("babiaxr-navigation-bar","commits",JSON.stringify(n.reverse()))),"data_0"!==t.time_evolution_init){let i;i=m[t.time_evolution_init][t.time_evolution_init+"_allfiles"]?t.time_evolution_init+"_allfiles":t.time_evolution_init;let n=F(e.children,{});m[t.time_evolution_init][i].forEach((t=>{n[t.id]&&(n[t.id].height=t.height,n[t.id].area=t.area,n[t.id].max_area=t.max_area)})),_=parseInt(t.time_evolution_init.split("_")[1])}}return e},u=!1,p=!0,f=!1,g=!1,m={},b=8e3,v={},y=[],_=0,A=t=>{let e;document.getElementById("scene")?e=document.getElementById("scene"):(e=document.getElementsByTagName("a-scene"),document.getElementsByTagName("a-entity"));let i=document.createElement("a-entity");i.classList.add("babiaxrDateBar"),i.setAttribute("position",{x:-13,y:10,z:-3}),i.setAttribute("rotation",{x:0,y:0,z:0}),i.setAttribute("material",{color:"black"}),i.setAttribute("height",.5),i.setAttribute("width",2),i.setAttribute("scale",{x:1,y:1,z:1});let n="Date: "+new Date(1e3*m[t.time_evolution_init].date).toLocaleDateString();m[t.time_evolution_init].commit_sha&&(n+="\n\nCommit: "+m[t.time_evolution_init].commit_sha),i.setAttribute("text-geometry",{value:n}),s=i,e.appendChild(i)},x=(t,e,i,n,r)=>{let a=2;t.length>16&&(a=t.length/8);let o=e,s=document.createElement("a-plane");s.setAttribute("babia-lookat","[camera]"),s.setAttribute("position",{x:i.x,y:i.y+o/2+1,z:i.z}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",a),s.setAttribute("color","white"),s.setAttribute("material",{side:"double"}),s.setAttribute("text",{value:t,align:"center",width:6,color:"black"});let l=r.getAttribute("scale");return!l||l.x===l.y&&l.x===l.z||s.setAttribute("scale",{x:1/l.x,y:1/l.y,z:1/l.z}),s},E=(t,e)=>{console.log("Loop number",e),C(),time_evolution_past_present?(_--,0==_&&console.log("finished"),e--):(_++,e++,_>t-1&&(_=0))},C=t=>{let e,i="data_"+(_+1);e=t?"data_"+(_+1)+"_allfiles":time_evolution_past_present?"data_reverse_"+(_+1):"data_"+(_+1);let n="Date: "+new Date(1e3*m[i].date).toLocaleDateString();m[i].commit_sha&&(n+="\n\nCommit: "+m[i].commit_sha),s.setAttribute("text-geometry","value",n),y=[],f&&(M+=5,80!==M?h=function(t,e){let i,n=function(t,e,i){t/=255,e/=255,i/=255;let n,r,a=Math.max(t,e,i),o=Math.min(t,e,i),s=(a+o)/2;if(a==o)n=r=0;else{let l=a-o;switch(r=s>.5?l/(2-a-o):l/(a+o),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return[n,r,s]}(parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16));return i=function(t,e,i){let n,r,a;if(0==e)n=r=a=i;else{function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}let s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=o(l,s,t+1/3),r=o(l,s,t),a=o(l,s,t-1/3)}return[255*n,255*r,255*a]}(n[0],n[1],e/100),"#"+R(i[0])+R(i[1])+R(i[2])}(h,M):(S++,S>w.length-1&&(S=0),h=w[S],M=20)),m[i][e]?m[i][e].forEach((t=>{I(t)})):m[i][i].forEach((t=>{I(t)})),g||l.forEach((t=>{y.includes(t.id)||T(t.id)})),U()},M=20,w=["#000066","#006600","#666600","#660000"],S=0,I=t=>{if(null!=document.getElementById(t.id)&&0!=t.area){y.push(t.id);let e=document.getElementById(t.id).getAttribute("position"),i=document.getElementById(t.id).getAttribute("position").x,n=document.getElementById(t.id).getAttribute("position").y,r=document.getElementById(t.id).getAttribute("position").z,a=document.getElementById(t.id).getAttribute("geometry").width,o=document.getElementById(t.id).getAttribute("geometry").depth,s=document.getElementById(t.id).getAttribute("geometry").height,l=parseFloat(document.getElementById(t.id).getAttribute("babiaxr-rawarea"));if(s.toFixed(6)!==t.height.toFixed(6)||l.toFixed(6)!==t.area.toFixed(6)){f&&document.getElementById(t.id).setAttribute("material",{color:h});let c=!1,d=a/o;d<1&&(c=!0,d=o/a);let u=t.area*(o*a)/l,g=Math.sqrt(u*d),m=Math.sqrt(u/d);if(c&&(m=Math.sqrt(u*d),g=Math.sqrt(u/d)),document.getElementById(t.id).setAttribute("babiaxr-rawarea",t.area),p){let e=500;if(g>a||m>o){let i=20*(g-a)/e,n=20*(m-o)/e,r=a,s=o,l=setInterval((function(){r>=g||s>=m?(document.getElementById(t.id).setAttribute("geometry","width",g),document.getElementById(t.id).setAttribute("geometry","depth",m),clearInterval(l)):(r+=i,s+=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",s))}),1)}else if(g<a||m<o){let i=20*(a-g)/e,n=20*(o-m)/e,r=a,s=o,l=setInterval((function(){r<=g||s<=m?(document.getElementById(t.id).setAttribute("geometry","width",g),document.getElementById(t.id).setAttribute("geometry","depth",m),clearInterval(l)):(r-=i,s-=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",s))}),1)}if(t.height<0)T(t.id);else if(t.height>s){let a=20*(t.height-s)/e,o=s,l=setInterval((function(){o>=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+t.height/2,z:r}),clearInterval(l)):(o+=a,document.getElementById(t.id).setAttribute("geometry","height",o),document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+o/2,z:r}))}),1)}else if(t.height<s){let a=20*(s-t.height)/e,o=s,l=setInterval((function(){o<=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+t.height/2,z:r}),clearInterval(l)):(o-=a,document.getElementById(t.id).setAttribute("geometry","height",o),document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+o/2,z:r}))}),1)}}else document.getElementById(t.id).setAttribute("geometry","width",g),document.getElementById(t.id).setAttribute("geometry","depth",m),document.getElementById(t.id).setAttribute("geometry","height",t.height),document.getElementById(t.id).setAttribute("position",{x:e.x,y:e.y-s/2+t.height/2,z:e.z})}}},T=t=>{let e=document.getElementById(t).getAttribute("material").color;document.getElementById(t).setAttribute("material",{color:"black"}),document.getElementById(t).setAttribute("material",{opacity:"0.3"});let i=setInterval((function(){!function(){let n=document.getElementById(t).getAttribute("position"),r=document.getElementById(t).getAttribute("geometry").height;document.getElementById(t).setAttribute("geometry","height",-.1),document.getElementById(t).setAttribute("position",{x:n.x,y:n.y-r/2-.05,z:n.z}),document.getElementById(t).setAttribute("material",{color:e}),document.getElementById(t).setAttribute("material",{opacity:"1.0"}),clearInterval(i)}()}),1e3)},U=()=>{console.log("Changing city")},F=(t,e)=>(t.forEach((t=>{t.children?F(t.children,e):e[t.id]=t})),e),B=t=>{let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;(o||0==o)&&e[o].emit("removeinfo"),e[t].emit("showinfo")};function R(t){let e=Math.round(t).toString(16);return e.length>1||(e="0"+e),e}},1790:t=>{t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],i=0;i<e.length;++i)if(t.hasOwnProperty(e[i]))throw new Error("Subject cannot be eventified, since it already has property '"+e[i]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(i,n,r){if("function"!=typeof n)throw new Error("callback is expected to be a function");var a=e[i];return a||(a=e[i]=[]),a.push({callback:n,ctx:r}),t},off:function(i,n){if(void 0===i)return e=Object.create(null),t;if(e[i])if("function"!=typeof n)delete e[i];else for(var r=e[i],a=0;a<r.length;++a)r[a].callback===n&&r.splice(a,1);return t},fire:function(i){var n,r=e[i];if(!r)return t;arguments.length>1&&(n=Array.prototype.splice.call(arguments,1));for(var a=0;a<r.length;++a){var o=r[a];o.callback.apply(o.ctx,n)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},7348:(t,e,i)=>{t.exports=function(t,e){if(!t)throw new Error("Graph structure cannot be undefined");var a=(e&&e.createSimulator||i(6571))(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var o=t.version>19?function(e){var i=t.getLinks(e);return i?1+i.size/3:1}:function(e){var i=t.getLinks(e);return i?1+i.length/3:1};e&&"function"==typeof e.nodeMass&&(o=e.nodeMass);var s=new Map,l={},c=0,h=a.settings.springTransform||r;c=0,t.forEachNode((function(t){m(t.id),c+=1})),t.forEachLink(b),t.on("changed",g);var d=!1,u={step:function(){if(0===c)return p(!0),!0;var t=a.step();u.lastMove=t,u.fire("step");var e=t/c<=.01;return p(e),e},getNodePosition:function(t){return _(t).pos},setNodePosition:function(t){var e=_(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=l[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return a.getBBox()},forEachBody:f,pinNode:function(t,e){_(t.id).isPinned=!!e},isNodePinned:function(t){return _(t.id).isPinned},dispose:function(){t.off("changed",g),u.fire("disposed")},getBody:function(t){return s.get(t)},getSpring:function(e,i){var n;if(void 0===i)n="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,i);if(!r)return;n=r.id}return l[n]},getForceVectorLength:function(){var t=0,e=0;return f((function(i){t+=Math.abs(i.force.x),e+=Math.abs(i.force.y)})),Math.sqrt(t*t+e*e)},simulator:a,graph:t,lastMove:0};return n(u),u;function p(t){var e;d!==t&&(d=t,e=t,u.fire("stable",e))}function f(t){s.forEach(t)}function g(e){for(var i=0;i<e.length;++i){var n=e[i];"add"===n.changeType?(n.node&&m(n.node.id),n.link&&b(n.link)):"remove"===n.changeType&&(n.node&&(r=n.node,o=void 0,l=void 0,o=r.id,(l=s.get(o))&&(s.delete(o),a.removeBody(l))),n.link&&v(n.link))}var r,o,l;c=t.getNodesCount()}function m(e){var i=s.get(e);if(!i){var n=t.getNode(e);if(!n)throw new Error("initBody() was called with unknown node id");var r=n.position;if(!r){var o=function(t){var e=[];if(!t.links)return e;for(var i=Math.min(t.links.length,2),n=0;n<i;++n){var r=t.links[n],a=r.fromId!==t.id?s.get(r.fromId):s.get(r.toId);a&&a.pos&&e.push(a)}return e}(n);r=a.getBestNewBodyPosition(o)}(i=a.addBodyAt(r)).id=e,s.set(e,i),y(e),function(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}(n)&&(i.isPinned=!0)}}function b(t){y(t.fromId),y(t.toId);var e=s.get(t.fromId),i=s.get(t.toId),n=a.addSpring(e,i,t.length);h(t,n),l[t.id]=n}function v(e){var i=l[e.id];if(i){var n=t.getNode(e.fromId),r=t.getNode(e.toId);n&&y(n.id),r&&y(r.id),delete l[e.id],a.removeSpring(i)}}function y(t){var e=s.get(t);if(e.mass=o(t),Number.isNaN(e.mass))throw new Error("Node mass should be a number")}function _(t){var e=s.get(t);return e||(m(t),e=s.get(t)),e}},t.exports.simulator=i(6571);var n=i(1790);function r(){}},3789:(t,e,i)=>{const n=i(9169);t.exports=function(t){return function(e,i){let r=i&&i.indent||0,a=i&&void 0!==i.join?i.join:"\n",o=Array(r+1).join(" "),s=[];for(let i=0;i<t;++i){let t=n(i),r=0===i?"":o;s.push(r+e.replace(/{var}/g,t))}return s.join(a)}}},2758:(t,e,i)=>{t.exports=function(t){let e=r(t);return new Function("bodies","settings","random",e)},t.exports.generateFunctionBody=r;const n=i(3789);function r(t){let e=n(t);return`\n var boundingBox = {\n ${e("min_{var}: 0, max_{var}: 0,",{indent:4})}\n };\n\n return {\n box: boundingBox,\n\n update: updateBoundingBox,\n\n reset: resetBoundingBox,\n\n getBestNewPosition: function (neighbors) {\n var ${e("base_{var} = 0",{join:", "})};\n\n if (neighbors.length) {\n for (var i = 0; i < neighbors.length; ++i) {\n let neighborPos = neighbors[i].pos;\n ${e("base_{var} += neighborPos.{var};",{indent:10})}\n }\n\n ${e("base_{var} /= neighbors.length;",{indent:8})}\n } else {\n ${e("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}\n }\n\n var springLength = settings.springLength;\n return {\n ${e("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}\n };\n }\n };\n\n function updateBoundingBox() {\n var i = bodies.length;\n if (i === 0) return; // No bodies - no borders.\n\n ${e("var max_{var} = -Infinity;",{indent:4})}\n ${e("var min_{var} = Infinity;",{indent:4})}\n\n while(i--) {\n // this is O(n), it could be done faster with quadtree, if we check the root node bounds\n var bodyPos = bodies[i].pos;\n ${e("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}\n ${e("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}\n }\n\n ${e("boundingBox.min_{var} = min_{var};",{indent:4})}\n ${e("boundingBox.max_{var} = max_{var};",{indent:4})}\n }\n\n function resetBoundingBox() {\n ${e("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}\n }\n`}},8379:(t,e,i)=>{const n=i(3789);function r(t,e){return`\n${o(t,e)}\n${a(t)}\nreturn {Body: Body, Vector: Vector};\n`}function a(t){let e=n(t),i=e("{var}",{join:", "});return`\nfunction Body(${i}) {\n this.isPinned = false;\n this.pos = new Vector(${i});\n this.force = new Vector();\n this.velocity = new Vector();\n this.mass = 1;\n\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.reset = function() {\n this.force.reset();\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.setPosition = function (${i}) {\n ${e("this.pos.{var} = {var} || 0;",{indent:2})}\n};`}function o(t,e){let i=n(t),r="";return e&&(r=`${i("\n var v{var};\nObject.defineProperty(this, '{var}', {\n set: function(v) { \n if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');\n v{var} = v; \n },\n get: function() { return v{var}; }\n});")}`),`function Vector(${i("{var}",{join:", "})}) {\n ${r}\n if (typeof arguments[0] === 'object') {\n // could be another vector\n let v = arguments[0];\n ${i('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}\n ${i("this.{var} = v.{var};",{indent:4})}\n } else {\n ${i('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}\n }\n }\n \n Vector.prototype.reset = function () {\n ${i("this.{var} = ",{join:""})}0;\n };`}t.exports=function(t,e){let i=r(t,e),{Body:n}=new Function(i)();return n},t.exports.generateCreateBodyFunctionBody=r,t.exports.getVectorCode=o,t.exports.getBodyCode=a},5226:(t,e,i)=>{const n=i(3789);function r(t){return`\n if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');\n\n return {\n update: function(body) {\n ${n(t)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options",e)},t.exports.generateCreateDragForceFunctionBody=r},2843:(t,e,i)=>{const n=i(3789);function r(t){let e=n(t);return`\n if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');\n if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');\n\n return {\n /**\n * Updates forces acting on a spring\n */\n update: function (spring) {\n var body1 = spring.from;\n var body2 = spring.to;\n var length = spring.length < 0 ? options.springLength : spring.length;\n ${e("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}\n var r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n var d = r - length;\n var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;\n\n ${e("body1.force.{var} += coefficient * d{var}",{indent:6})};\n body1.springCount += 1;\n body1.springLength += r;\n\n ${e("body2.force.{var} -= coefficient * d{var}",{indent:6})};\n body2.springCount += 1;\n body2.springLength += r;\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options","random",e)},t.exports.generateCreateSpringForceFunctionBody=r},8222:(t,e,i)=>{const n=i(3789);function r(t){let e=n(t);return`\n var length = bodies.length;\n if (length === 0) return 0;\n\n ${e("var d{var} = 0, t{var} = 0;",{indent:2})}\n\n for (var i = 0; i < length; ++i) {\n var body = bodies[i];\n if (body.isPinned) continue;\n\n if (adaptiveTimeStepWeight && body.springCount) {\n timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);\n }\n\n var coeff = timeStep / body.mass;\n\n ${e("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}\n ${e("var v{var} = body.velocity.{var};",{indent:4})}\n var v = Math.sqrt(${e("v{var} * v{var}",{join:" + "})});\n\n if (v > 1) {\n // We normalize it so that we move within timeStep range. \n // for the case when v <= 1 - we let velocity to fade out.\n ${e("body.velocity.{var} = v{var} / v;",{indent:6})}\n }\n\n ${e("d{var} = timeStep * body.velocity.{var};",{indent:4})}\n\n ${e("body.pos.{var} += d{var};",{indent:4})}\n\n ${e("t{var} += Math.abs(d{var});",{indent:4})}\n }\n\n return (${e("t{var} * t{var}",{join:" + "})})/length;\n`}t.exports=function(t){let e=r(t);return new Function("bodies","timeStep","adaptiveTimeStepWeight",e)},t.exports.generateIntegratorFunctionBody=r},1756:(t,e,i)=>{const n=i(3789),r=i(9169);function a(t){let e=n(t),i=Math.pow(2,t);return`\n\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n\n${c(t)}\n${o(t)}\n${l(t)}\n${s(t)}\n\nfunction createQuadTree(options, random) {\n options = options || {};\n options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;\n options.theta = typeof options.theta === 'number' ? options.theta : 0.8;\n\n var gravity = options.gravity;\n var updateQueue = [];\n var insertStack = new InsertStack();\n var theta = options.theta;\n\n var nodesCache = [];\n var currentInCache = 0;\n var root = newNode();\n\n return {\n insertBodies: insertBodies,\n\n /**\n * Gets root node if it is present\n */\n getRoot: function() {\n return root;\n },\n\n updateBodyForce: update,\n\n options: function(newOptions) {\n if (newOptions) {\n if (typeof newOptions.gravity === 'number') {\n gravity = newOptions.gravity;\n }\n if (typeof newOptions.theta === 'number') {\n theta = newOptions.theta;\n }\n\n return this;\n }\n\n return {\n gravity: gravity,\n theta: theta\n };\n }\n };\n\n function newNode() {\n // To avoid pressure on GC we reuse nodes.\n var node = nodesCache[currentInCache];\n if (node) {\n${function(t){let e=[];for(let t=0;t<i;++t)e.push(` node.quad${t} = null;`);return e.join("\n")}()}\n node.body = null;\n node.mass = ${e("node.mass_{var} = ",{join:""})}0;\n ${e("node.min_{var} = node.max_{var} = ",{join:""})}0;\n } else {\n node = new QuadNode();\n nodesCache[currentInCache] = node;\n }\n\n ++currentInCache;\n return node;\n }\n\n function update(sourceBody) {\n var queue = updateQueue;\n var v;\n ${e("var d{var};",{indent:4})}\n var r; \n ${e("var f{var} = 0;",{indent:4})}\n var queueLength = 1;\n var shiftIdx = 0;\n var pushIdx = 1;\n\n queue[0] = root;\n\n while (queueLength) {\n var node = queue[shiftIdx];\n var body = node.body;\n\n queueLength -= 1;\n shiftIdx += 1;\n var differentBody = (body !== sourceBody);\n if (body && differentBody) {\n // If the current node is a leaf node (and it is not source body),\n // calculate the force exerted by the current node on body, and add this\n // amount to body's net force.\n ${e("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Poor man's protection against zero distance.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n // This is standard gravitation force calculation but we divide\n // by r^3 to save two operations when normalizing force vector.\n v = gravity * body.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:8})}\n } else if (differentBody) {\n // Otherwise, calculate the ratio s / r, where s is the width of the region\n // represented by the internal node, and r is the distance between the body\n // and the node's center-of-mass\n ${e("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Sorry about code duplication. I don't want to create many functions\n // right away. Just want to see performance first.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n // If s / r < θ, treat this internal node as a single body, and calculate the\n // force it exerts on sourceBody, and add this amount to sourceBody's net force.\n if ((node.max_${r(0)} - node.min_${r(0)}) / r < theta) {\n // in the if statement above we consider node's width only\n // because the region was made into square during tree creation.\n // Thus there is no difference between using width or height.\n v = gravity * node.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:10})}\n } else {\n // Otherwise, run the procedure recursively on each of the current node's children.\n\n // I intentionally unfolded this loop, to save several CPU cycles.\n${function(){let t=Array(11).join(" "),e=[];for(let n=0;n<i;++n)e.push(t+`if (node.quad${n}) {`),e.push(t+` queue[pushIdx] = node.quad${n};`),e.push(t+" queueLength += 1;"),e.push(t+" pushIdx += 1;"),e.push(t+"}");return e.join("\n")}()}\n }\n }\n }\n\n ${e("sourceBody.force.{var} += f{var};",{indent:4})}\n }\n\n function insertBodies(bodies) {\n ${e("var {var}min = Number.MAX_VALUE;",{indent:4})}\n ${e("var {var}max = Number.MIN_VALUE;",{indent:4})}\n var i = bodies.length;\n\n // To reduce quad tree depth we are looking for exact bounding box of all particles.\n while (i--) {\n var pos = bodies[i].pos;\n ${e("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}\n ${e("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}\n }\n\n // Makes the bounds square.\n var maxSideLength = -Infinity;\n ${e("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}\n\n currentInCache = 0;\n root = newNode();\n ${e("root.min_{var} = {var}min;",{indent:4})}\n ${e("root.max_{var} = {var}min + maxSideLength;",{indent:4})}\n\n i = bodies.length - 1;\n if (i >= 0) {\n root.body = bodies[i];\n }\n while (i--) {\n insert(bodies[i], root);\n }\n }\n\n function insert(newBody) {\n insertStack.reset();\n insertStack.push(root, newBody);\n\n while (!insertStack.isEmpty()) {\n var stackItem = insertStack.pop();\n var node = stackItem.node;\n var body = stackItem.body;\n\n if (!node.body) {\n // This is internal node. Update the total mass of the node and center-of-mass.\n ${e("var {var} = body.pos.{var};",{indent:8})}\n node.mass += body.mass;\n ${e("node.mass_{var} += body.mass * {var};",{indent:8})}\n\n // Recursively insert the body in the appropriate quadrant.\n // But first find the appropriate quadrant.\n var quadIdx = 0; // Assume we are in the 0's quad.\n ${e("var min_{var} = node.min_{var};",{indent:8})}\n ${e("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}\n\n${function(e){let i=[],n=Array(9).join(" ");for(let e=0;e<t;++e)i.push(n+`if (${r(e)} > max_${r(e)}) {`),i.push(n+` quadIdx = quadIdx + ${Math.pow(2,e)};`),i.push(n+` min_${r(e)} = max_${r(e)};`),i.push(n+` max_${r(e)} = node.max_${r(e)};`),i.push(n+"}");return i.join("\n")}()}\n\n var child = getChild(node, quadIdx);\n\n if (!child) {\n // The node is internal but this quadrant is not taken. Add\n // subnode to it.\n child = newNode();\n ${e("child.min_{var} = min_{var};",{indent:10})}\n ${e("child.max_{var} = max_{var};",{indent:10})}\n child.body = body;\n\n setChild(node, quadIdx, child);\n } else {\n // continue searching in this quadrant.\n insertStack.push(child, body);\n }\n } else {\n // We are trying to add to the leaf node.\n // We have to convert current leaf into internal node\n // and continue adding two nodes.\n var oldBody = node.body;\n node.body = null; // internal nodes do not cary bodies\n\n if (isSamePosition(oldBody.pos, body.pos)) {\n // Prevent infinite subdivision by bumping one node\n // anywhere in this quadrant\n var retriesCount = 3;\n do {\n var offset = random.nextDouble();\n ${e("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}\n\n ${e("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}\n retriesCount -= 1;\n // Make sure we don't bump it out of the box. If we do, next iteration should fix it\n } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));\n\n if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {\n // This is very bad, we ran out of precision.\n // if we do not return from the method we'll get into\n // infinite loop here. So we sacrifice correctness of layout, and keep the app running\n // Next layout iteration should get larger bounding box in the first step and fix this\n return;\n }\n }\n // Next iteration should subdivide node further.\n insertStack.push(node, oldBody);\n insertStack.push(node, body);\n }\n }\n }\n}\nreturn createQuadTree;\n\n`}function o(t){let e=n(t);return`\n function isSamePosition(point1, point2) {\n ${e("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}\n \n return ${e("d{var} < 1e-8",{join:" && "})};\n } \n`}function s(t){var e=Math.pow(2,t);return`\nfunction setChild(node, idx, child) {\n ${function(){let t=[];for(let i=0;i<e;++i){let e=0===i?" ":" else ";t.push(`${e}if (idx === ${i}) node.quad${i} = child;`)}return t.join("\n")}()}\n}`}function l(t){return`function getChild(node, idx) {\n${function(){let e=[],i=Math.pow(2,t);for(let t=0;t<i;++t)e.push(` if (idx === ${t}) return node.quad${t};`);return e.join("\n")}()}\n return null;\n}`}function c(t){let e=n(t),i=Math.pow(2,t);return`\nfunction QuadNode() {\n // body stored inside this node. In quad tree only leaf nodes (by construction)\n // contain bodies:\n this.body = null;\n\n // Child nodes are stored in quads. Each quad is presented by number:\n // 0 | 1\n // -----\n // 2 | 3\n${function(t){let e=[];for(let t=0;t<i;++t)e.push(` this.quad${t} = null;`);return e.join("\n")}()}\n\n // Total mass of current node\n this.mass = 0;\n\n // Center of mass coordinates\n ${e("this.mass_{var} = 0;",{indent:2})}\n\n // bounding box coordinates\n ${e("this.min_{var} = 0;",{indent:2})}\n ${e("this.max_{var} = 0;",{indent:2})}\n}\n`}function h(){return"\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n"}t.exports=function(t){let e=a(t);return new Function(e)()},t.exports.generateQuadTreeFunctionBody=a,t.exports.getInsertStackCode=h,t.exports.getQuadNodeCode=c,t.exports.isSamePosition=o,t.exports.getChildBodyCode=l,t.exports.setChildBodyCode=s},9169:t=>{t.exports=function(t){return 0===t?"x":1===t?"y":2===t?"z":"c"+(t+1)}},6571:(t,e,i)=>{t.exports=function(t){var e=i(8787),d=i(1277),u=i(1790);if(t){if(void 0!==t.springCoeff)throw new Error("springCoeff was renamed to springCoefficient");if(void 0!==t.dragCoeff)throw new Error("dragCoeff was renamed to dragCoefficient")}t=d(t,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var p=c[t.dimensions];if(!p){var f=t.dimensions;p={Body:n(f,t.debug),createQuadTree:r(f),createBounds:a(f),createDragForce:o(f),createSpringForce:s(f),integrate:l(f)},c[f]=p}var g=p.Body,m=p.createQuadTree,b=p.createBounds,v=p.createDragForce,y=p.createSpringForce,_=p.integrate,A=i(1304).random(42),x=[],E=[],C=m(t,A),M=b(x,t,A),w=y(t,A),S=v(t),I=[],T=new Map,U=0;R("nbody",(function(){if(0!==x.length){C.insertBodies(x);for(var t=x.length;t--;){var e=x[t];e.isPinned||(e.reset(),C.updateBodyForce(e),S.update(e))}}})),R("spring",(function(){for(var t=E.length;t--;)w.update(E[t])}));var F={bodies:x,quadTree:C,springs:E,settings:t,addForce:R,removeForce:function(t){var e=I.indexOf(T.get(t));e<0||(I.splice(e,1),T.delete(t))},getForces:function(){return T},step:function(){for(var e=0;e<I.length;++e)I[e](U);var i=_(x,t.timeStep,t.adaptiveTimeStepWeight);return U+=1,i},addBody:function(t){if(!t)throw new Error("Body is required");return x.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=(t=>new g(t))(t);return x.push(e),e},removeBody:function(t){if(t){var e=x.indexOf(t);if(!(e<0))return x.splice(e,1),0===x.length&&M.reset(),!0}},addSpring:function(t,i,n,r){if(!t||!i)throw new Error("Cannot add null spring to force simulator");"number"!=typeof n&&(n=-1);var a=new e(t,i,n,r>=0?r:-1);return E.push(a),a},getTotalMovement:function(){return 0},removeSpring:function(t){if(t){var e=E.indexOf(t);return e>-1?(E.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return M.getBestNewPosition(t)},getBBox:B,getBoundingBox:B,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(e){return void 0!==e?(t.gravity=e,C.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,C.options({theta:e}),this):t.theta},random:A};return function(t,e){for(var i in t)h(t,e,i)}(t,F),u(F),F;function B(){return M.update(),M.box}function R(t,e){if(T.has(t))throw new Error("Force "+t+" is already added");T.set(t,e),I.push(e)}};var n=i(8379),r=i(1756),a=i(2758),o=i(5226),s=i(2843),l=i(8222),c={};function h(t,e,i){if(t.hasOwnProperty(i)&&"function"!=typeof e[i]){var n=Number.isFinite(t[i]);e[i]=n?function(n){if(void 0!==n){if(!Number.isFinite(n))throw new Error("Value of "+i+" should be a valid number.");return t[i]=n,e}return t[i]}:function(n){return void 0!==n?(t[i]=n,e):t[i]}}}},8787:t=>{t.exports=function(t,e,i,n){this.from=t,this.to=e,this.length=i,this.coefficient=n}},5261:(t,e,i)=>{t.exports=function(t){if("uniqueLinkId"in(t=t||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),t.multigraph=t.uniqueLinkId),void 0===t.multigraph&&(t.multigraph=!1),"function"!=typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e,i=new Map,l=new Map,c={},h=0,d=t.multigraph?function(t,e,i){var n=s(t,e),r=c.hasOwnProperty(n);if(r||w(t,e)){r||(c[n]=0);var a="@"+ ++c[n];n=s(t+a,e+a)}return new o(t,e,i,n)}:function(t,e,i){var n=s(t,e),r=l.get(n);return r?(r.data=i,r):new o(t,e,i,n)},u=[],p=S,f=S,g=S,m=S,b={version:20,addNode:_,addLink:function(t,e,i){g();var n=A(t)||_(t),r=A(e)||_(e),o=d(t,e,i),s=l.has(o.id);return l.set(o.id,o),a(n,o),t!==e&&a(r,o),p(o,s?"update":"add"),m(),o},removeLink:function(t,e){return void 0!==e&&(t=w(t,e)),M(t)},removeNode:x,getNode:A,getNodeCount:E,getLinkCount:C,getEdgeCount:C,getLinksCount:C,getNodesCount:E,getLinks:function(t){var e=A(t);return e?e.links:null},forEachNode:U,forEachLinkedNode:function(t,e,n){var r=A(t);if(r&&r.links&&"function"==typeof e)return n?function(t,e,n){for(var r=t.values(),a=r.next();!a.done;){var o=a.value;if(o.fromId===e&&n(i.get(o.toId),o))return!0;a=r.next()}}(r.links,t,e):function(t,e,n){for(var r=t.values(),a=r.next();!a.done;){var o=a.value,s=o.fromId===e?o.toId:o.fromId;if(n(i.get(s),o))return!0;a=r.next()}}(r.links,t,e)},forEachLink:function(t){if("function"==typeof t)for(var e=l.values(),i=e.next();!i.done;){if(t(i.value))return!0;i=e.next()}},beginUpdate:g,endUpdate:m,clear:function(){g(),U((function(t){x(t.id)})),m()},hasLink:w,hasNode:A,getLink:w};return n(b),e=b.on,b.on=function(){return b.beginUpdate=g=I,b.endUpdate=m=T,p=v,f=y,b.on=e,e.apply(b,arguments)},b;function v(t,e){u.push({link:t,changeType:e})}function y(t,e){u.push({node:t,changeType:e})}function _(t,e){if(void 0===t)throw new Error("Invalid node identifier");g();var n=A(t);return n?(n.data=e,f(n,"update")):(n=new r(t,e),f(n,"add")),i.set(t,n),m(),n}function A(t){return i.get(t)}function x(t){var e=A(t);if(!e)return!1;g();var n=e.links;return n&&(n.forEach(M),e.links=null),i.delete(t),f(e,"remove"),m(),!0}function E(){return i.size}function C(){return l.size}function M(t){if(!t)return!1;if(!l.get(t.id))return!1;g(),l.delete(t.id);var e=A(t.fromId),i=A(t.toId);return e&&e.links.delete(t),i&&i.links.delete(t),p(t,"remove"),m(),!0}function w(t,e){if(void 0!==t&&void 0!==e)return l.get(s(t,e))}function S(){}function I(){h+=1}function T(){0==(h-=1)&&u.length>0&&(b.fire("changed",u),u.length=0)}function U(t){if("function"!=typeof t)throw new Error("Function is expected to iterate over graph nodes. You passed "+t);for(var e=i.values(),n=e.next();!n.done;){if(t(n.value))return!0;n=e.next()}}};var n=i(1790);function r(t,e){this.id=t,this.links=null,this.data=e}function a(t,e){t.links?t.links.add(e):t.links=new Set([e])}function o(t,e,i,n){this.fromId=t,this.toId=e,this.data=i,this.id=n}function s(t,e){return t.toString()+"👉 "+e.toString()}},1277:t=>{t.exports=function t(e,i){var n;if(e||(e={}),i)for(n in i)if(i.hasOwnProperty(n)){var r=e.hasOwnProperty(n),a=typeof i[n];r&&typeof e[n]===a?"object"===a&&(e[n]=t(e[n],i[n])):e[n]=i[n]}return e}},1304:t=>{function e(t){return new i("number"==typeof t?t:+new Date)}function i(t){this.seed=t}function n(t){return Math.sqrt(2*Math.PI/t)*Math.pow(1/Math.E*(t+1/(12*t-1/(10*t))),t)}function r(){var t=this.seed;return t=4294967295&(3042594569^(t=4251993797+(t=4294967295&(3550635116+(t=374761393+(t=4294967295&(3345072700^(t=t+2127912214+(t<<12)&4294967295)^t>>>19))+(t<<5)&4294967295)^t<<9))+(t<<3)&4294967295)^t>>>16),this.seed=t,(268435455&t)/268435456}t.exports=e,t.exports.random=e,t.exports.randomIterator=function(t,i){var n=i||e();if("function"!=typeof n.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var i,r,a;for(i=t.length-1;i>0;--i)r=n.next(i+1),a=t[r],t[r]=t[i],t[i]=a,e(a);t.length&&e(t[0])},shuffle:function(){var e,i,r;for(e=t.length-1;e>0;--e)i=n.next(e+1),r=t[i],t[i]=t[e],t[e]=r;return t}}},i.prototype.next=function(t){return Math.floor(this.nextDouble()*t)},i.prototype.nextDouble=r,i.prototype.uniform=r,i.prototype.gaussian=function(){var t,e,i;do{t=(e=2*this.nextDouble()-1)*e+(i=2*this.nextDouble()-1)*i}while(t>=1||0===t);return e*Math.sqrt(-2*Math.log(t)/t)},i.prototype.levy=function(){var t=1.5,e=Math.pow(n(2.5)*Math.sin(Math.PI*t/2)/(n(1.25)*t*Math.pow(2,.25)),1/t);return this.gaussian()*e/Math.pow(Math.abs(this.gaussian()),1/t)}},4809:function(t,e){var i,n;i=function t(){"use strict";var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,n=e.IS_PAPA_WORKER||!1,r={},a=0,o={parse:function(i,n){var s=(n=n||{}).dynamicTyping||!1;if(A(s)&&(n.dynamicTypingFunction=s,s={}),n.dynamicTyping=s,n.transform=!!A(n.transform)&&n.transform,n.worker&&o.WORKERS_SUPPORTED){var l=function(){if(!o.WORKERS_SUPPORTED)return!1;var i,n,s=(i=e.URL||e.webkitURL||null,n=t.toString(),o.BLOB_URL||(o.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",n,")();"],{type:"text/javascript"})))),l=new e.Worker(s);return l.onmessage=m,l.id=a++,r[l.id]=l}();return l.userStep=n.step,l.userChunk=n.chunk,l.userComplete=n.complete,l.userError=n.error,n.step=A(n.step),n.chunk=A(n.chunk),n.complete=A(n.complete),n.error=A(n.error),delete n.worker,void l.postMessage({input:i,config:n,workerId:l.id})}var p=null;return o.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=n.download?new c(n):new d(n)):!0===i.readable&&A(i.read)&&A(i.on)?p=new u(n):(e.File&&i instanceof File||i instanceof Object)&&(p=new h(n)),p.stream(i)},unparse:function(t,e){var i=!1,n=!0,r=",",a="\r\n",s='"',l=s+s,c=!1,h=null,d=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||o.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(c=e.skipEmptyLines),"string"==typeof e.newline&&(a=e.newline),"string"==typeof e.quoteChar&&(s=e.quoteChar),"boolean"==typeof e.header&&(n=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");h=e.columns}void 0!==e.escapeChar&&(l=e.escapeChar+s),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(d=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var u=new RegExp(f(s),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,c);if("object"==typeof t[0])return p(h||Object.keys(t[0]),t,c)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||h),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],c);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var o="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var s=Array.isArray(t)&&0<t.length,l=!Array.isArray(e[0]);if(s&&n){for(var c=0;c<t.length;c++)0<c&&(o+=r),o+=g(t[c],c);0<e.length&&(o+=a)}for(var h=0;h<e.length;h++){var d=s?t.length:e[h].length,u=!1,p=s?0===Object.keys(e[h]).length:0===e[h].length;if(i&&!s&&(u="greedy"===i?""===e[h].join("").trim():1===e[h].length&&0===e[h][0].length),"greedy"===i&&s){for(var f=[],m=0;m<d;m++){var b=l?t[m]:m;f.push(e[h][b])}u=""===f.join("").trim()}if(!u){for(var v=0;v<d;v++){0<v&&!p&&(o+=r);var y=s&&l?t[v]:v;o+=g(e[h][y],v)}h<e.length-1&&(!i||0<d&&!p)&&(o+=a)}}return o}function g(t,e){if(null==t)return"";if(t.constructor===Date)return JSON.stringify(t).slice(1,25);var n=!1;d&&"string"==typeof t&&d.test(t)&&(t="'"+t,n=!0);var a=t.toString().replace(u,l);return(n=n||!0===i||"function"==typeof i&&i(t,e)||Array.isArray(i)&&i[e]||function(t,e){for(var i=0;i<e.length;i++)if(-1<t.indexOf(e[i]))return!0;return!1}(a,o.BAD_DELIMITERS)||-1<a.indexOf(r)||" "===a.charAt(0)||" "===a.charAt(a.length-1))?s+a+s:a}}};if(o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\ufeff",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!i&&!!e.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=g,o.ParserHandle=p,o.NetworkStreamer=c,o.FileStreamer=h,o.StringStreamer=d,o.ReadableStreamStreamer=u,e.jQuery){var s=e.jQuery;s.fn.parse=function(t){var i=t.config||{},n=[];return this.each((function(t){if("INPUT"!==s(this).prop("tagName").toUpperCase()||"file"!==s(this).attr("type").toLowerCase()||!e.FileReader||!this.files||0===this.files.length)return!0;for(var r=0;r<this.files.length;r++)n.push({file:this.files[r],inputElem:this,instanceConfig:s.extend({},i)})})),r(),this;function r(){if(0!==n.length){var e,i,r,l=n[0];if(A(t.before)){var c=t.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",e=l.file,i=l.inputElem,r=c.reason,void(A(t.error)&&t.error({name:"AbortError"},e,i,r));if("skip"===c.action)return void a();"object"==typeof c.config&&(l.instanceConfig=s.extend(l.instanceConfig,c.config))}else if("skip"===c)return void a()}var h=l.instanceConfig.complete;l.instanceConfig.complete=function(t){A(h)&&h(t,l.file,l.inputElem),a()},o.parse(l.file,l.instanceConfig)}else A(t.complete)&&t.complete()}function a(){n.splice(0,1),r()}}}function l(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(t){var e=y(t);e.chunkSize=parseInt(e.chunkSize),t.step||t.chunk||(e.chunkSize=null),this._handle=new p(e),(this._handle.streamer=this)._config=e}.call(this,t),this.parseChunk=function(t,i){if(this.isFirstChunk&&A(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(t);void 0!==r&&(t=r)}this.isFirstChunk=!1,this._halted=!1;var a=this._partialLine+t;this._partialLine="";var s=this._handle.parse(a,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=s.meta.cursor;this._finished||(this._partialLine=a.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(n)e.postMessage({results:s,workerId:o.WORKER_ID,finished:c});else if(A(this._config.chunk)&&!i){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);s=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!c||!A(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(t){A(this._config.error)?this._config.error(t):n&&this._config.error&&e.postMessage({workerId:o.WORKER_ID,error:t,finished:!1})}}function c(t){var e;(t=t||{}).chunkSize||(t.chunkSize=o.RemoteChunkSize),l.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=_(this._chunkLoaded,this),e.onerror=_(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var n in t)e.setRequestHeader(n,t[n])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function h(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=o.LocalChunkSize),l.call(this,t);var n="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,n?((e=new FileReader).onload=_(this._chunkLoaded,this),e.onerror=_(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var t=this._input;if(this._config.chunkSize){var r=Math.min(this._start+this._config.chunkSize,this._input.size);t=i.call(t,this._start,r)}var a=e.readAsText(t,this._config.encoding);n||this._chunkLoaded({target:{result:a}})},this._chunkLoaded=function(t){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function d(t){var e;l.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function u(t){l.call(this,t=t||{});var e=[],i=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=_((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=_((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=_((function(){this._streamCleanUp(),n=!0,this._streamData("")}),this),this._streamCleanUp=_((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,n,r=Math.pow(2,53),a=-r,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,c=this,h=0,d=0,u=!1,p=!1,m=[],b={data:[],errors:[],meta:{}};if(A(t.step)){var v=t.step;t.step=function(e){if(b=e,E())x();else{if(x(),0===b.data.length)return;h+=e.data.length,t.preview&&h>t.preview?i.abort():(b.data=b.data[0],v(b,c))}}}function _(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function x(){return b&&n&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),t.skipEmptyLines&&(b.data=b.data.filter((function(t){return!_(t)}))),E()&&function(){if(b)if(Array.isArray(b.data[0])){for(var e=0;E()&&e<b.data.length;e++)b.data[e].forEach(i);b.data.splice(0,1)}else b.data.forEach(i);function i(e,i){A(t.transformHeader)&&(e=t.transformHeader(e,i)),m.push(e)}}(),function(){if(!b||!t.header&&!t.dynamicTyping&&!t.transform)return b;function e(e,i){var n,r=t.header?{}:[];for(n=0;n<e.length;n++){var a=n,o=e[n];t.header&&(a=n>=m.length?"__parsed_extra":m[n]),t.transform&&(o=t.transform(o,a)),o=C(a,o),"__parsed_extra"===a?(r[a]=r[a]||[],r[a].push(o)):r[a]=o}return t.header&&(n>m.length?M("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+n,d+i):n<m.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+n,d+i)),r}var i=1;return!b.data.length||Array.isArray(b.data[0])?(b.data=b.data.map(e),i=b.data.length):b.data=e(b.data,0),t.header&&b.meta&&(b.meta.fields=m),d+=i,b}()}function E(){return t.header&&0===m.length}function C(e,i){return n=e,t.dynamicTypingFunction&&void 0===t.dynamicTyping[n]&&(t.dynamicTyping[n]=t.dynamicTypingFunction(n)),!0===(t.dynamicTyping[n]||t.dynamicTyping)?"true"===i||"TRUE"===i||"false"!==i&&"FALSE"!==i&&(function(t){if(s.test(t)){var e=parseFloat(t);if(a<e&&e<r)return!0}return!1}(i)?parseFloat(i):l.test(i)?new Date(i):""===i?null:i):i;var n}function M(t,e,i,n){var r={type:t,code:e,message:i};void 0!==n&&(r.row=n),b.errors.push(r)}this.parse=function(r,a,s){var l=t.quoteChar||'"';if(t.newline||(t.newline=function(t,e){t=t.substring(0,1048576);var i=new RegExp(f(e)+"([^]*?)"+f(e),"gm"),n=(t=t.replace(i,"")).split("\r"),r=t.split("\n"),a=1<r.length&&r[0].length<n[0].length;if(1===n.length||a)return"\n";for(var o=0,s=0;s<n.length;s++)"\n"===n[s][0]&&o++;return o>=n.length/2?"\r\n":"\r"}(r,l)),n=!1,t.delimiter)A(t.delimiter)&&(t.delimiter=t.delimiter(r),b.meta.delimiter=t.delimiter);else{var c=function(e,i,n,r,a){var s,l,c,h;a=a||[",","\t","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var d=0;d<a.length;d++){var u=a[d],p=0,f=0,m=0;c=void 0;for(var b=new g({comments:r,delimiter:u,newline:i,preview:10}).parse(e),v=0;v<b.data.length;v++)if(n&&_(b.data[v]))m++;else{var y=b.data[v].length;f+=y,void 0!==c?0<y&&(p+=Math.abs(y-c),c=y):c=y}0<b.data.length&&(f/=b.data.length-m),(void 0===l||p<=l)&&(void 0===h||h<f)&&1.99<f&&(l=p,s=u,h=f)}return{successful:!!(t.delimiter=s),bestDelimiter:s}}(r,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess);c.successful?t.delimiter=c.bestDelimiter:(n=!0,t.delimiter=o.DefaultDelimiter),b.meta.delimiter=t.delimiter}var h=y(t);return t.preview&&t.header&&h.preview++,e=r,i=new g(h),b=i.parse(e,a,s),x(),u?{meta:{paused:!0}}:b||{meta:{paused:!1}}},this.paused=function(){return u},this.pause=function(){u=!0,i.abort(),e=A(t.chunk)?"":e.substring(i.getCharIndex())},this.resume=function(){c.streamer._halted?(u=!1,c.streamer.parseChunk(e,!0)):setTimeout(c.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,i.abort(),b.meta.aborted=!0,A(t.complete)&&t.complete(b),e=""}}function f(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(t){var e,i=(t=t||{}).delimiter,n=t.newline,r=t.comments,a=t.step,s=t.preview,l=t.fastMode,c=e=void 0===t.quoteChar||null===t.quoteChar?'"':t.quoteChar;if(void 0!==t.escapeChar&&(c=t.escapeChar),("string"!=typeof i||-1<o.BAD_DELIMITERS.indexOf(i))&&(i=","),r===i)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<o.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var h=0,d=!1;this.parse=function(o,u,p){if("string"!=typeof o)throw new Error("Input must be a string");var g=o.length,m=i.length,b=n.length,v=r.length,y=A(a),_=[],x=[],E=[],C=h=0;if(!o)return j();if(t.header&&!u){var M=o.split(n)[0].split(i),w=[],S={},I=!1;for(var T in M){var U=M[T];A(t.transformHeader)&&(U=t.transformHeader(U,T));var F=U,B=S[U]||0;for(0<B&&(I=!0,F=U+"_"+B),S[U]=B+1;w.includes(F);)F=F+"_"+B;w.push(F)}if(I){var R=o.split(n);R[0]=w.join(i),o=R.join(n)}}if(l||!1!==l&&-1===o.indexOf(e)){for(var L=o.split(n),D=0;D<L.length;D++){if(E=L[D],h+=E.length,D!==L.length-1)h+=n.length;else if(p)return j();if(!r||E.substring(0,v)!==r){if(y){if(_=[],V(E.split(i)),X(),d)return j()}else V(E.split(i));if(s&&s<=D)return _=_.slice(0,s),j(!0)}}return j()}for(var P=o.indexOf(i,h),N=o.indexOf(n,h),O=new RegExp(f(c)+f(e),"g"),k=o.indexOf(e,h);;)if(o[h]!==e)if(r&&0===E.length&&o.substring(h,h+v)===r){if(-1===N)return j();h=N+b,N=o.indexOf(n,h),P=o.indexOf(i,h)}else if(-1!==P&&(P<N||-1===N))E.push(o.substring(h,P)),h=P+m,P=o.indexOf(i,h);else{if(-1===N)break;if(E.push(o.substring(h,N)),W(N+b),y&&(X(),d))return j();if(s&&_.length>=s)return j(!0)}else for(k=h,h++;;){if(-1===(k=o.indexOf(e,k+1)))return p||x.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:_.length,index:h}),G();if(k===g-1)return G(o.substring(h,k).replace(O,e));if(e!==c||o[k+1]!==c){if(e===c||0===k||o[k-1]!==c){-1!==P&&P<k+1&&(P=o.indexOf(i,k+1)),-1!==N&&N<k+1&&(N=o.indexOf(n,k+1));var z=H(-1===N?P:Math.min(P,N));if(o.substr(k+1+z,m)===i){E.push(o.substring(h,k).replace(O,e)),o[h=k+1+z+m]!==e&&(k=o.indexOf(e,h)),P=o.indexOf(i,h),N=o.indexOf(n,h);break}var Q=H(N);if(o.substring(k+1+Q,k+1+Q+b)===n){if(E.push(o.substring(h,k).replace(O,e)),W(k+1+Q+b),P=o.indexOf(i,h),k=o.indexOf(e,h),y&&(X(),d))return j();if(s&&_.length>=s)return j(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:_.length,index:h}),k++}}else k++}return G();function V(t){_.push(t),C=h}function H(t){var e=0;if(-1!==t){var i=o.substring(k+1,t);i&&""===i.trim()&&(e=i.length)}return e}function G(t){return p||(void 0===t&&(t=o.substring(h)),E.push(t),h=g,V(E),y&&X()),j()}function W(t){h=t,V(E),E=[],N=o.indexOf(n,h)}function j(t){return{data:_,errors:x,meta:{delimiter:i,linebreak:n,aborted:d,truncated:!!t,cursor:C+(u||0)}}}function X(){a(j()),_=[],x=[]}},this.abort=function(){d=!0},this.getCharIndex=function(){return h}}function m(t){var e=t.data,i=r[e.workerId],n=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var a={abort:function(){n=!0,b(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(A(i.userStep)){for(var o=0;o<e.results.data.length&&(i.userStep({data:e.results.data[o],errors:e.results.errors,meta:e.results.meta},a),!n);o++);delete e.results}else A(i.userChunk)&&(i.userChunk(e.results,a,e.file),delete e.results)}e.finished&&!n&&b(e.workerId,e.results)}function b(t,e){var i=r[t];A(i.userComplete)&&i.userComplete(e),i.terminate(),delete r[t]}function v(){throw new Error("Not implemented.")}function y(t){if("object"!=typeof t||null===t)return t;var e=Array.isArray(t)?[]:{};for(var i in t)e[i]=y(t[i]);return e}function _(t,e){return function(){t.apply(e,arguments)}}function A(t){return"function"==typeof t}return n&&(e.onmessage=function(t){var i=t.data;if(void 0===o.WORKER_ID&&i&&(o.WORKER_ID=i.workerId),"string"==typeof i.input)e.postMessage({workerId:o.WORKER_ID,results:o.parse(i.input,i.config),finished:!0});else if(e.File&&i.input instanceof File||i.input instanceof Object){var n=o.parse(i.input,i.config);n&&e.postMessage({workerId:o.WORKER_ID,results:n,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(h.prototype=Object.create(l.prototype)).constructor=h,(d.prototype=Object.create(d.prototype)).constructor=d,(u.prototype=Object.create(l.prototype)).constructor=u,o},void 0===(n=i.apply(e,[]))||(t.exports=n)},5298:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAC70lEQVR42u3by04TURzH8W+nFx0kMUBbE6eNiSCXjQlxZQKU2qUbSERfwUQQ0ATfwATYGCPxHSwoLtzZ9ObWGIMRSDDRlFlIW1xIUuxtXHQ0gC1MTRM6nfNPupmeaef3OTNnziRzbJqmcUy5gDH9cx24qG9r5toDtoEPwCvgNZCv1dh2DMA4sAD0YO7aAh4BL6t9KVXZZgfm9R3MHh49w4qeyX4SgB14DMzRejWnZ7PXAmjl8DURDo4B8y0e/mAt6OPCX4BbQBhr1QSwbNM0zQV8AXwWA1CBy5IuYbXwAApwW9InOVatMZumaV+BS0b3KBSK5XgyqcYSSXXt01o2k87k8sVi+TSOvk2WHV6vV+7r7e0IBoaVkaFhxel0SHX8xDebpmn7wBkjrWPxhPp06fnHlLq914zd6Vd87VP37l4NBgJGL+m8TTvhYeBgz49P3HnzPb2Ta+Zz2uv2yKvLL24aPRMMny6RaDTV7OEBdjLp3NtIJGW0vWGAWDyhmmVkiyXfqQ0H+LyxvmsWgPU6jtUwQDa7u28WgGwmu99wgHyhUDYLQD23ZQmLlwAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAByqc22ywyyhXA7jL0oZbtjV6ZbNAtDl7jrbcIArPd3nzQIw0D/Q2XCA0cCIYhaA0eEhpeEAoWDQf8HjbfrLwOv2yKHQDX89AD+NNHQ6HdLs9NSgX/G1N2t4v+Jrfzhzf9DldBrt2LxN07RNoNfonxQKxXIkGk1F4wl1Y3PjR3onkyuUTudVWafdIXm8brm/r78jGBhRQsGg/39elQ1TWS9gxVqRgFULz4NWrb5goluisqjwgQV7fxb49WfACAOLFgq/qGc+tGrMDjwBJls8/BIwDZSOToRKwAzwzCrhq80EWxnhn/C1psIlYEqfG2y1QPAtKivjJo+GPzoGVH201nceB65RWWrmbPLABf0W957K8vkwxyyf/w0kIOOe2pS1LAAAAABJRU5ErkJggg=="},5379:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInBhdXNlIiwKICAgICAgICAgICAgInJvdGF0aW9uIiA6IFsKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgIm1lc2hlcyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAibmFtZSIgOiAiUGxhbmUiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNTYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMC44MDk2NzM1NDc3NDQ3NTEsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMQogICAgICAgICAgICBdLAogICAgICAgICAgICAibWluIiA6IFsKICAgICAgICAgICAgICAgIC0wLjc5NjU0NzUzMjA4MTYwNCwKICAgICAgICAgICAgICAgIC0wLjE5Njg4OTQ2MDA4NjgyMjUsCiAgICAgICAgICAgICAgICAtMQogICAgICAgICAgICBdLAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMSwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMiwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMywKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyMywKICAgICAgICAgICAgImNvdW50IiA6IDcyLAogICAgICAgICAgICAidHlwZSIgOiAiU0NBTEFSIgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVyVmlld3MiIDogWwogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDY3MgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDQ0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTM0NAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE0NCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTc5MgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxOTM2LAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy82RlZRdmdBQUFBQUFBSUMvNkZWUXZnQUFBQUFBQUlBL3hFWlBQMlNkU2I0QUFJQS94RVpQUDJTZFNiNEFBSUMvYkoxSlBtU2RTYjRBQUlDL2NKMUpQbVNkU2I0QUFJQS82RlZRdm1TZFNiNEFBSUEvNkZWUXZtU2RTYjRBQUlDL2l1cEx2MlNkU2I0QUFJQy9pdXBMdjJTZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy94RVpQUHdBQUFBQUFBSUMveEVaUFB3QUFBQUFBQUlBLzZGVlF2Z0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS94RVpQUHdBQUFBQUFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQMlNkU2I0QUFJQS94RVpQUHdBQUFBQUFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2MlNkU2I0QUFJQS9pdXBMdjJTZFNiNEFBSUMvaXVwTHZ3QUFBQUFBQUlDL2NKMUpQZ0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvYkoxSlBtU2RTYjRBQUlDL2NKMUpQZ0FBQUFBQUFJQS9iSjFKUG1TZFNiNEFBSUMvYkoxSlBnQUFBQUFBQUlDLzZGVlF2Z0FBQUFBQUFJQS82RlZRdm1TZFNiNEFBSUEvaXVwTHYyU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS9pdXBMdjJTZFNiNEFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy9pdXBMdjJTZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlDL2l1cEx2d0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZnQUFBQUFBQUlDL3hFWlBQd0FBQUFBQUFJQS94RVpQUDJTZFNiNEFBSUEvY0oxSlBtU2RTYjRBQUlBL3hFWlBQd0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy9iSjFKUG1TZFNiNEFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQd0FBQUFBQUFJQy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFhaDZLeUFBQ0FQd0FBQUFBYWg2S3lBQUNBUHdBQUFBQWFoNkt5QUFDQVB3QUFBQUFhaHlLekFBQ0FQd0FBQUFBYWh5S3pBQUNBUHdBQUFBQWFoeUt6QUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUQvLzM4L0FBQUFBQUFBQUFELy8zOC9BQUFBQUFBQUFBRC8vMzgvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUFBQUJEVmx6NEFBQUFBRU5XWFBnQUFnRDhBQUlBL0FBQ0FQd0FBZ0Q4QUFBQUFUSkF4UHdBQUFBQk1rREUvQUFDQVB4RFZsejRBQUlBL0VOV1hQZ0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBSUEvVEpBeFB3QUFnRDlNa0RFL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOFExWmMrQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBZ0Q4UTFaYytBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFCTWtERS9BQUNBUDB5UU1UOEFBSUEvVEpBeFB3QUFBQUJNa0RFL0FBQ0FQMHlRTVQ4QUFBQUFUSkF4UHdBQUFBQVExWmMrQUFDQVB4RFZsejRBQUlBL0FBQUFBQUFBZ0Q4UTFaYytBQUNBUHdBQUFBQUFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBQUFBQUFBQUFFTldYUGdBQUFBQUFBQUFBQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBQUFBQUFJQS9BQUNBUHdBQWdEOEFBSUEvVEpBeFB3QUFnRDhBQUlBL0FBQ0FQMHlRTVQ4QUFJQS9USkF4UHdBQWdEOU1rREUvQUFBQUFFeVFNVDhBQUFBQUFBQ0FQd0FBQUFBQUFJQS9BQUFBQUFBQUFRQUNBQUFBQWdBREFBUUFCUUFHQUFRQUJnQUhBQWdBQ1FBS0FBZ0FDZ0FMQUF3QURRQU9BQXdBRGdBUEFCQUFFUUFTQUJBQUVnQVRBQlFBRlFBV0FCUUFGZ0FYQUJnQUdRQWFBQmdBR2dBYkFCd0FIUUFlQUI4QUlBQWhBQ0lBSXdBa0FDVUFKZ0FuQUNnQUtRQXFBQ3NBTEFBdEFDNEFMd0F3QURFQU1nQXpBRFFBTlFBMkFEUUFOZ0EzQUE9PSIKICAgICAgICB9CiAgICBdCn0K"},6457:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogIlBsYXkiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDEiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4xOTY4ODk0NzQ5ODc5ODM3LAogICAgICAgICAgICAgICAgLTAuOTk0OTY1NjcyNDkyOTgxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogMjQsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMjE2CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0MzIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTc2CiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDYyNCwKICAgICAgICAgICAgInVyaSIgOiAiZGF0YTphcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07YmFzZTY0LEFBQ0F2MldkU2I0U3RuNi9BQUNBdjJXZFNiNEFBSUEvQUFDQVAyV2RTYjRBR2txOEFBQ0FQd0FBQUFBQUdrcThBQUNBUDJXZFNiNEFHa3E4QUFDQXYyV2RTYjRBQUlBL0FBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQVB3QUFBQUFBR2txOEFBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQXYyV2RTYjRTdG42L0FBQ0FQMldkU2I0QUdrcThBQUNBUHdBQUFBQUFHa3E4QUFDQXZ3QUFBQUFBQUlBL0FBQ0F2MldkU2I0QUFJQS9BQUNBdjJXZFNiNFN0bjYvQUFDQXZ3QUFBQUFTdG42L0FBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQWZqbm52Z0FBQUFBNGFHUy9mam5udmdBQUFBQTRhR1MvZmpubnZnQUFBQUE0YUdTL2Zqbm52Z0FBQUFBNGFHUy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FhY2JodmdBQUFBQVh4R1UvYWNiaHZnQUFBQUFYeEdVL2FjYmh2Z0FBQUFBWHhHVS9hY2JodmdBQUFBQVh4R1UvQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQUFBQUQzSkRzQUFBQUFBQUNBUHdBQWdEK1kxL3crQUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFnRCtZMS93K0FBQUFBQUFBZ0Q4QUFBQUFBUGNrT3dBQUFBQUE5eVE3QUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFBQUFBOXlRN0FBQUJBQUlBQXdBRUFBVUFBd0FGQUFZQUJ3QUlBQWtBQ2dBTEFBd0FDZ0FNQUEwQURnQVBBQkFBRGdBUUFCRUEiCiAgICAgICAgfQogICAgXQp9Cg=="},5126:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInJld2luZCIsCiAgICAgICAgICAgICJyb3RhdGlvbiIgOiBbCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNAogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXSwKICAgICJtZXNoZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlBsYW5lLjAwMyIsCiAgICAgICAgICAgICJwcmltaXRpdmVzIiA6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiYXR0cmlidXRlcyIgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJQT1NJVElPTiIgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAiTk9STUFMIiA6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICJURVhDT09SRF8wIiA6IDIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICJpbmRpY2VzIiA6IDMKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAiYWNjZXNzb3JzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDAsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgIm1heCIgOiBbCiAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgIm1pbiIgOiBbCiAgICAgICAgICAgICAgICAtMSwKICAgICAgICAgICAgICAgIC0wLjE5NzQ5NzA4NDczNjgyNDA0LAogICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDEsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDIsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzIiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDMsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjMsCiAgICAgICAgICAgICJjb3VudCIgOiA2MCwKICAgICAgICAgICAgInR5cGUiIDogIlNDQUxBUiIKICAgICAgICB9CiAgICBdLAogICAgImJ1ZmZlclZpZXdzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAwCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0ODAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAzMjAsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDk2MAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDEyMCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTI4MAogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxNDAwLAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsQUFDQVB3QUFBQUFBQUlBL0FBQ0FQNjA4U3I0QUFJQS9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQNjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3QUFDQVA2MDhTcjRBQUlBL0FBQ0F2d0FBQUFBQTZQaTdBQUNBdjYwOFNyNEE2UGk3QUNDcnU2MDhTcjRBQUlDL0FDQ3J1d0FBQUFBQUFJQy9BQUNBdndBQUFBQUE2UGk3QUNDcnV3QUFBQUFBQUlDL0p4WTd1d0FBQUFBQUtuZzdBR0FFdWdBQUFBQUFBSUEvQUNDcnV3QUFBQUFBQUlDL0FDQ3J1NjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHdBQUFBQUFBSUEvQUNDcnU2MDhTcjRBQUlDL0FBQ0F2NjA4U3I0QTZQaTdBR0FFdXEwOFNyNEFBSUEvSnhZN3V3QUFBQUFBS25nN0p4WTd1NjA4U3I0QUtuZzdBR0FFdXEwOFNyNEFBSUEvQUdBRXVnQUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUDYwOFNyNEFBSUMvQUFDQVA2MDhTcjRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9KeFk3dXdBQUFBQUFLbmc3SnhZN3U2MDhTcjRBS25nN0FBQ0FQNjA4U3I0QUFJQy9BQUNBUHdBQUFBQUFBSUMvQUdBRXVnQUFBQUFBQUlBL0FHQUV1cTA4U3I0QUFJQS9BQUNBdjYwOFNyNEE2UGk3QUFDQXZ3QUFBQUFBNlBpN3ZXbzBQd0FBQUFDbm5qVy92V28wUHdBQUFBQ25ualcvdldvMFB3QUFBQUNubmpXL3ZXbzBQd0FBQUFDbm5qVy9BQUFBQUFBQWdEOEFBQUFBQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBZ0Q4QUFBQUFrTTAwUHdBQUFBQkZQRFUva00wMFB3QUFBQUJGUERVL2tNMDBQd0FBQUFCRlBEVS9rTTAwUHdBQUFBQkZQRFUvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQTB2OS92d0FBQUFEbGt4bzcwdjkvdndBQUFBRGxreG83MHY5L3Z3QUFBQURsa3hvNzB2OS92d0FBQUFEbGt4bzdBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQTBQOS92d0FBQUFEamt4bzcwUDkvdndBQUFBRGpreG83MFA5L3Z3QUFBQURqa3hvNzBQOS92d0FBQUFEamt4bzdBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBZHhvMVB3QUFBQUJyN3pRL2R4bzFQd0FBQUFCcjd6US9keG8xUHdBQUFBQnI3elEvZHhvMVB3QUFBQUJyN3pRL25iODFQd0FBQUFDSlNUUy9uYjgxUHdBQUFBQ0pTVFMvbmI4MVB3QUFBQUNKU1RTL25iODFQd0FBQUFDSlNUUy9BQUNBUHdBQWdEOEFBSUEvQUFDQVArcEUvejRWZkFBLzZrVC9QaFY4QUQ4QUFJQS9BQUFBQU9wRS96NFZmQUEvQUFDQVB3QUFnRDhBQUFBQU1BNytQZ0FBQUFBd0R2NCt3S24rUGdBQUFBREFxZjQrQUFBQUFBQUFBQUF3RHY0K3dLbitQZ0FBQUFEcVJQOCtGWHdBUCtqZS96NEFBSUEvd0tuK1BnQUFBQURBcWY0K0FBQUFBT3BFL3o0VmZBQS82a1QvUGhWOEFEOEFBSUEvQUFBQUFBQUFnRDhBQUlBL3dLbitQZ0FBQUFBQUFBQUFNQTcrUHVqZS96NEFBSUEvNmtUL1BoVjhBRC9xUlA4K0ZYd0FQK2plL3o0QUFJQS82TjcvUGdBQWdEOEFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQ0FQd0FBZ0Q4QUFJQS9BQUNBUCtwRS96NFZmQUEvNmtUL1BoVjhBRDhBQUlBL0FBQUFBQUFBZ0Q4QUFBQUE2TjcvUGdBQWdEL28zdjgrQUFDQVB3QUFBQUF3RHY0K0FBQUFBREFPL2o0QUFBRUFBZ0FBQUFJQUF3QUVBQVVBQmdBSEFBZ0FDUUFIQUFrQUNnQUxBQXdBRFFBT0FBc0FEUUFQQUJBQUVRQVBBQkVBRWdBVEFCUUFEUUFGQUJVQUZnQUZBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FnQUNFQUlnQWdBQ0lBSXdBa0FDVUFKZ0FrQUNZQUp3QT0iCiAgICAgICAgfQogICAgXQp9Cg=="},4906:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInNraXAiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDIiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4yMDIzNTg2MDM0Nzc0NzgwMywKICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogNzIsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTUyCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMzY4LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxMTA0CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxNDcyCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE2MTYsCiAgICAgICAgICAgICJ1cmkiIDogImRhdGE6YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtO2Jhc2U2NCxBQUNBdndBQUFBQUFBSUEvQUFDQXZ3QUFBQUFBQUlDLzVBSWF2d0FBQUFBQUFJQy81QUlhdndBQUFBQUFOck83NUFJYXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBUHhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBUHhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPN0FBQ0FQeGczVDc0QUFJQS9BQUNBUHdBQUFBQUFBSUMvQUFDQVB3QUFBQUFBQUlBLzVBSWF2d0FBQUFBQU5yTzc1QUlhdnhnM1Q3NEFOck83NUFJYXZ4ZzNUNzRBQUlDL0FBQ0F2eGczVDc0QUFJQy9BQUNBdnhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBQUlBLzVBSWF2d0FBQUFBQUFJQy81QUlhdnhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBdndBQUFBQUFBSUMvQUFDQXZ4ZzNUNzRBQUlDLzVBSWF2eGczVDc0QUFJQy81QUlhdndBQUFBQUFBSUMvNUFJYXZ3QUFBQUFBTnJPNzVBSWF2eGczVDc0QU5yTzdBQUNBUHhnM1Q3NEFBSUMvQUFDQVB3QUFBQUFBQUlDLzVBSWF2eGczVDc0QUFJQS81QUlhdndBQUFBQUFBSUEvNUFJYXZ3QUFBQUFBQUlBLzVBSWF2eGczVDc0QUFJQS9BQUNBdnhnM1Q3NEFBSUEvQUFDQXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHhnM1Q3NEFBSUMvQUFDQVB4ZzNUNzRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBdndBQUFBQUFBSUEvQUFDQXZ4ZzNUNzRBQUlBL0FBQ0F2eGczVDc0QUFJQy9BQUNBdndBQUFBQUFBSUMvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FOUjBJUHdBQUFBREQwRmkvTlIwSVB3QUFBQUREMEZpL05SMElQd0FBQUFERDBGaS9OUjBJUHdBQUFBREQwRmkvQUFBQUFQLy9mejhBQUFBQUFBQUFBUC8vZno4QUFBQUFBQUFBQVAvL2Z6OEFBQUFBQUFBQUFQLy9mNzhBQUFDQUFBQUFBUC8vZjc4QUFBQ0FBQUFBQVAvL2Y3OEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0RRd0hQd0FBQUFCUmUxay9EUXdIUHdBQUFBQlJlMWsvRFF3SFB3QUFBQUJSZTFrL0RRd0hQd0FBQUFCUmUxay9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQUFBQUFBQUlBQUFJQy9BQUFBQUFBQUFJQUFBSUMvQUFBQUFBQUFBSUFBQUlDL0FBQUFBQUFBQUlBQUFJQy9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQ0FQd0FBQUlBQUFBQ0FBQUNBUHdBQUFJQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQUFBQUFBZ0Q4QUFBQUFBQUFBQURqNlN6NEFBQUFBT1BwTFBwU1ovajQ0K2tzK0FBQ0FQd0FBZ0Q4QUFJQS9BQUNBUHdBQWdEODQra3MrbEpuK1BqajZTejZVbWY0K0FBQ0FQd0FBQUFBNCtrcytsSm4rUGdBQWdEOEFBSUEvQUFDQVB3QUFBQUFBQUlBL0FBQ0FQemo2U3o2VW1mNCtPUHBMUHBTWi9qNDQra3MrQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBZ0Q4NCtrcytBQUNBUHpqNlN6NEFBQUFBT1BwTFBnQUFBQUE0K2tzK2xKbitQamo2U3o2VW1mNCtBQUFBQUFBQUFBQUFBQUFBQUFBQUFEajZTejRBQUFBQU9QcExQZ0FBQUFBNCtrcytsSm4rUGpqNlN6NlVtZjQrQUFDQVB3QUFBQUFBQUlBL0FBQUFBRGo2U3o0QUFJQS9PUHBMUGdBQWdEODQra3MrQUFDQVB6ajZTejRBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBRUFBZ0FBQUFJQUF3QUFBQU1BQkFBRkFBWUFCd0FGQUFjQUNBQUpBQW9BQ3dBTUFBMEFEZ0FQQUJBQUVRQVBBQkVBRWdBVEFBOEFFZ0FVQUJVQUZnQVVBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FYQUJZQUlBQVhBQ0FBSVFBaUFDTUFKQUFpQUNRQUpRQW1BQ2NBS0FBbUFDZ0FLUUFxQUNzQUxBQXFBQ3dBTFFBPSIKICAgICAgICB9CiAgICBdCn0K"},4468:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});var n=function(t){return"function"==typeof t?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}}},8524:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>Ui});var n=i(9437),r={value:()=>{}};function a(){for(var t,e=0,i=arguments.length,n={};e<i;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new o(n)}function o(t){this._=t}function s(t,e){for(var i,n=0,r=t.length;n<r;++n)if((i=t[n]).name===e)return i.value}function l(t,e,i){for(var n=0,a=t.length;n<a;++n)if(t[n].name===e){t[n]=r,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=i&&t.push({name:e,value:i}),t}o.prototype=a.prototype={constructor:o,on:function(t,e){var i,n,r=this._,a=(n=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",i=t.indexOf(".");if(i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),o=-1,c=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<c;)if(i=(t=a[o]).type)r[i]=l(r[i],t.name,e);else if(null==e)for(i in r)r[i]=l(r[i],t.name,null);return this}for(;++o<c;)if((i=(t=a[o]).type)&&(i=s(r[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new o(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,n,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(n=this._[t]).length;a<i;++a)n[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,a=n.length;r<a;++r)n[r].value.apply(e,i)}};const c=a;var h,d,u=0,p=0,f=0,g=1e3,m=0,b=0,v=0,y="object"==typeof performance&&performance.now?performance:Date,_="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function A(){return b||(_(x),b=y.now()+v)}function x(){b=0}function E(){this._call=this._time=this._next=null}function C(t,e,i){var n=new E;return n.restart(t,e,i),n}function M(){b=(m=y.now())+v,u=p=0;try{!function(){A(),++u;for(var t,e=h;e;)(t=b-e._time)>=0&&e._call.call(void 0,t),e=e._next;--u}()}finally{u=0,function(){for(var t,e,i=h,n=1/0;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:h=e);d=t,S(n)}(),b=0}}function w(){var t=y.now(),e=t-m;e>g&&(v-=e,m=t)}function S(t){u||(p&&(p=clearTimeout(p)),t-b>24?(t<1/0&&(p=setTimeout(M,t-y.now()-v)),f&&(f=clearInterval(f))):(f||(m=y.now(),f=setInterval(w,g)),u=1,_(M)))}E.prototype=C.prototype={constructor:E,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?A():+i)+(null==e?0:+e),this._next||d===this||(d?d._next=this:h=this,d=this),this._call=t,this._time=i,S()},stop:function(){this._call&&(this._call=null,this._time=1/0,S())}};const I=4294967296;function T(t){return t.x}function U(t){return t.y}function F(t){return t.z}var B=Math.PI*(3-Math.sqrt(5)),R=20*Math.PI/(9+Math.sqrt(221));function L(t,e){e=e||2;var i,n=Math.min(3,Math.max(1,Math.round(e))),r=1,a=.001,o=1-Math.pow(a,1/300),s=0,l=.6,h=new Map,d=C(f),u=c("tick","end"),p=function(){let t=1;return()=>(t=(1664525*t+1013904223)%I)/I}();function f(){g(),u.call("tick",i),r<a&&(d.stop(),u.call("end",i))}function g(e){var a,c,d=t.length;void 0===e&&(e=1);for(var u=0;u<e;++u)for(r+=(s-r)*o,h.forEach((function(t){t(r)})),a=0;a<d;++a)null==(c=t[a]).fx?c.x+=c.vx*=l:(c.x=c.fx,c.vx=0),n>1&&(null==c.fy?c.y+=c.vy*=l:(c.y=c.fy,c.vy=0)),n>2&&(null==c.fz?c.z+=c.vz*=l:(c.z=c.fz,c.vz=0));return i}function m(){for(var e,i=0,r=t.length;i<r;++i){if((e=t[i]).index=i,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var a=10*(n>2?Math.cbrt(.5+i):n>1?Math.sqrt(.5+i):i),o=i*B,s=i*R;1===n?e.x=a:2===n?(e.x=a*Math.cos(o),e.y=a*Math.sin(o)):(e.x=a*Math.sin(o)*Math.cos(s),e.y=a*Math.cos(o),e.z=a*Math.sin(o)*Math.sin(s))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function b(e){return e.initialize&&e.initialize(t,p,n),e}return null==t&&(t=[]),m(),i={tick:g,restart:function(){return d.restart(f),i},stop:function(){return d.stop(),i},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(b),i):n},nodes:function(e){return arguments.length?(t=e,m(),h.forEach(b),i):t},alpha:function(t){return arguments.length?(r=+t,i):r},alphaMin:function(t){return arguments.length?(a=+t,i):a},alphaDecay:function(t){return arguments.length?(o=+t,i):+o},alphaTarget:function(t){return arguments.length?(s=+t,i):s},velocityDecay:function(t){return arguments.length?(l=1-t,i):1-l},randomSource:function(t){return arguments.length?(p=t,h.forEach(b),i):p},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,b(e)),i):h.get(t)},find:function(){var e,i,r,a,o,s,l=Array.prototype.slice.call(arguments),c=l.shift()||0,h=(n>1?l.shift():null)||0,d=(n>2?l.shift():null)||0,u=l.shift()||1/0,p=0,f=t.length;for(u*=u,p=0;p<f;++p)(a=(e=c-(o=t[p]).x)*e+(i=h-(o.y||0))*i+(r=d-(o.z||0))*r)<u&&(s=o,u=a);return s},on:function(t,e){return arguments.length>1?(u.on(t,e),i):u.on(t)}}}function D(t){return function(){return t}}function P(t){return 1e-6*(t()-.5)}function N(t){return t.index}function O(t,e){var i=t.get(e);if(!i)throw new Error("node not found: "+e);return i}function k(t){var e,i,n,r,a,o,s,l=N,c=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},h=D(30),d=1;function u(n){for(var a=0,l=t.length;a<d;++a)for(var c,h,u,p,f,g=0,m=0,b=0,v=0;g<l;++g)h=(c=t[g]).source,m=(u=c.target).x+u.vx-h.x-h.vx||P(s),r>1&&(b=u.y+u.vy-h.y-h.vy||P(s)),r>2&&(v=u.z+u.vz-h.z-h.vz||P(s)),m*=p=((p=Math.sqrt(m*m+b*b+v*v))-i[g])/p*n*e[g],b*=p,v*=p,u.vx-=m*(f=o[g]),r>1&&(u.vy-=b*f),r>2&&(u.vz-=v*f),h.vx+=m*(f=1-f),r>1&&(h.vy+=b*f),r>2&&(h.vz+=v*f)}function p(){if(n){var r,s,c=n.length,h=t.length,d=new Map(n.map(((t,e)=>[l(t,e,n),t])));for(r=0,a=new Array(c);r<h;++r)(s=t[r]).index=r,"object"!=typeof s.source&&(s.source=O(d,s.source)),"object"!=typeof s.target&&(s.target=O(d,s.target)),a[s.source.index]=(a[s.source.index]||0)+1,a[s.target.index]=(a[s.target.index]||0)+1;for(r=0,o=new Array(h);r<h;++r)s=t[r],o[r]=a[s.source.index]/(a[s.source.index]+a[s.target.index]);e=new Array(h),f(),i=new Array(h),g()}}function f(){if(n)for(var i=0,r=t.length;i<r;++i)e[i]=+c(t[i],i,t)}function g(){if(n)for(var e=0,r=t.length;e<r;++e)i[e]=+h(t[e],e,t)}return null==t&&(t=[]),u.initialize=function(t,...e){n=t,s=e.find((t=>"function"==typeof t))||Math.random,r=e.find((t=>[1,2,3].includes(t)))||2,p()},u.links=function(e){return arguments.length?(t=e,p(),u):t},u.id=function(t){return arguments.length?(l=t,u):l},u.iterations=function(t){return arguments.length?(d=+t,u):d},u.strength=function(t){return arguments.length?(c="function"==typeof t?t:D(+t),f(),u):c},u.distance=function(t){return arguments.length?(h="function"==typeof t?t:D(+t),g(),u):h},u}function z(t,e,i){if(isNaN(e))return t;var n,r,a,o,s,l,c=t._root,h={data:i},d=t._x0,u=t._x1;if(!c)return t._root=h,t;for(;c.length;)if((o=e>=(r=(d+u)/2))?d=r:u=r,n=c,!(c=c[s=+o]))return n[s]=h,t;if(e===(a=+t._x.call(null,c.data)))return h.next=c,n?n[s]=h:t._root=h,t;do{n=n?n[s]=new Array(2):t._root=new Array(2),(o=e>=(r=(d+u)/2))?d=r:u=r}while((s=+o)==(l=+(a>=r)));return n[l]=c,n[s]=h,t}function Q(t,e,i){this.node=t,this.x0=e,this.x1=i}function V(t){return t[0]}function H(t,e){var i=new G(null==e?V:e,NaN,NaN);return null==t?i:i.addAll(t)}function G(t,e,i){this._x=t,this._x0=e,this._x1=i,this._root=void 0}function W(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var j=H.prototype=G.prototype;function X(t,e,i,n){if(isNaN(e)||isNaN(i))return t;var r,a,o,s,l,c,h,d,u,p=t._root,f={data:n},g=t._x0,m=t._y0,b=t._x1,v=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((c=e>=(a=(g+b)/2))?g=a:b=a,(h=i>=(o=(m+v)/2))?m=o:v=o,r=p,!(p=p[d=h<<1|c]))return r[d]=f,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&i===l)return f.next=p,r?r[d]=f:t._root=f,t;do{r=r?r[d]=new Array(4):t._root=new Array(4),(c=e>=(a=(g+b)/2))?g=a:b=a,(h=i>=(o=(m+v)/2))?m=o:v=o}while((d=h<<1|c)==(u=(l>=o)<<1|s>=a));return r[u]=p,r[d]=f,t}function q(t,e,i,n,r){this.node=t,this.x0=e,this.y0=i,this.x1=n,this.y1=r}function Z(t){return t[0]}function Y(t){return t[1]}function J(t,e,i){var n=new K(null==e?Z:e,null==i?Y:i,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function K(t,e,i,n,r,a){this._x=t,this._y=e,this._x0=i,this._y0=n,this._x1=r,this._y1=a,this._root=void 0}function $(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}j.copy=function(){var t,e,i=new G(this._x,this._x0,this._x1),n=this._root;if(!n)return i;if(!n.length)return i._root=W(n),i;for(t=[{source:n,target:i._root=new Array(2)}];n=t.pop();)for(var r=0;r<2;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(2)}):n.target[r]=W(e));return i},j.add=function(t){const e=+this._x.call(null,t);return z(this.cover(e),e,t)},j.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,i=new Float64Array(e);let n=1/0,r=-1/0;for(let a,o=0;o<e;++o)isNaN(a=+this._x.call(null,t[o]))||(i[o]=a,a<n&&(n=a),a>r&&(r=a));if(n>r)return this;this.cover(n).cover(r);for(let n=0;n<e;++n)z(this,i[n],t[n]);return this},j.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,i=this._x1;if(isNaN(e))i=(e=Math.floor(t))+1;else{for(var n,r,a=i-e||1,o=this._root;e>t||t>=i;)switch(r=+(t<e),(n=new Array(2))[r]=o,o=n,a*=2,r){case 0:i=e+a;break;case 1:e=i-a}this._root&&this._root.length&&(this._root=o)}return this._x0=e,this._x1=i,this},j.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},j.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},j.find=function(t,e){var i,n,r,a,o,s=this._x0,l=this._x1,c=[],h=this._root;for(h&&c.push(new Q(h,s,l)),null==e?e=1/0:(s=t-e,l=t+e);a=c.pop();)if(!(!(h=a.node)||(n=a.x0)>l||(r=a.x1)<s))if(h.length){var d=(n+r)/2;c.push(new Q(h[1],d,r),new Q(h[0],n,d)),(o=+(t>=d))&&(a=c[c.length-1],c[c.length-1]=c[c.length-1-o],c[c.length-1-o]=a)}else{var u=Math.abs(t-+this._x.call(null,h.data));u<e&&(e=u,s=t-u,l=t+u,i=h.data)}return i},j.remove=function(t){if(isNaN(a=+this._x.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h=this._root,d=this._x0,u=this._x1;if(!h)return this;if(h.length)for(;;){if((s=a>=(o=(d+u)/2))?d=o:u=o,e=h,!(h=h[l=+s]))return this;if(!h.length)break;e[l+1&1]&&(i=e,c=l)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,n?(r?n.next=r:delete n.next,this):e?(r?e[l]=r:delete e[l],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(i?i[c]=h:this._root=h),this):(this._root=r,this)},j.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},j.root=function(){return this._root},j.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},j.visit=function(t){var e,i,n,r,a=[],o=this._root;for(o&&a.push(new Q(o,this._x0,this._x1));e=a.pop();)if(!t(o=e.node,n=e.x0,r=e.x1)&&o.length){var s=(n+r)/2;(i=o[1])&&a.push(new Q(i,s,r)),(i=o[0])&&a.push(new Q(i,n,s))}return this},j.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new Q(this._root,this._x0,this._x1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.x1,l=(o+s)/2;(a=r[0])&&i.push(new Q(a,o,l)),(a=r[1])&&i.push(new Q(a,l,s))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},j.x=function(t){return arguments.length?(this._x=t,this):this._x};var tt=J.prototype=K.prototype;function et(t,e,i,n,r){if(isNaN(e)||isNaN(i)||isNaN(n))return t;var a,o,s,l,c,h,d,u,p,f,g,m,b=t._root,v={data:r},y=t._x0,_=t._y0,A=t._z0,x=t._x1,E=t._y1,C=t._z1;if(!b)return t._root=v,t;for(;b.length;)if((u=e>=(o=(y+x)/2))?y=o:x=o,(p=i>=(s=(_+E)/2))?_=s:E=s,(f=n>=(l=(A+C)/2))?A=l:C=l,a=b,!(b=b[g=f<<2|p<<1|u]))return a[g]=v,t;if(c=+t._x.call(null,b.data),h=+t._y.call(null,b.data),d=+t._z.call(null,b.data),e===c&&i===h&&n===d)return v.next=b,a?a[g]=v:t._root=v,t;do{a=a?a[g]=new Array(8):t._root=new Array(8),(u=e>=(o=(y+x)/2))?y=o:x=o,(p=i>=(s=(_+E)/2))?_=s:E=s,(f=n>=(l=(A+C)/2))?A=l:C=l}while((g=f<<2|p<<1|u)==(m=(d>=l)<<2|(h>=s)<<1|c>=o));return a[m]=b,a[g]=v,t}function it(t,e,i,n,r,a,o){this.node=t,this.x0=e,this.y0=i,this.z0=n,this.x1=r,this.y1=a,this.z1=o}function nt(t){return t[0]}function rt(t){return t[1]}function at(t){return t[2]}function ot(t,e,i,n){var r=new st(null==e?nt:e,null==i?rt:i,null==n?at:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function st(t,e,i,n,r,a,o,s,l){this._x=t,this._y=e,this._z=i,this._x0=n,this._y0=r,this._z0=a,this._x1=o,this._y1=s,this._z1=l,this._root=void 0}function lt(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}tt.copy=function(){var t,e,i=new K(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return i;if(!n.length)return i._root=$(n),i;for(t=[{source:n,target:i._root=new Array(4)}];n=t.pop();)for(var r=0;r<4;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(4)}):n.target[r]=$(e));return i},tt.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t);return X(this.cover(e,i),e,i,t)},tt.addAll=function(t){var e,i,n,r,a=t.length,o=new Array(a),s=new Array(a),l=1/0,c=1/0,h=-1/0,d=-1/0;for(i=0;i<a;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||(o[i]=n,s[i]=r,n<l&&(l=n),n>h&&(h=n),r<c&&(c=r),r>d&&(d=r));if(l>h||c>d)return this;for(this.cover(l,c).cover(h,d),i=0;i<a;++i)X(this,o[i],s[i],t[i]);return this},tt.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var i=this._x0,n=this._y0,r=this._x1,a=this._y1;if(isNaN(i))r=(i=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{for(var o,s,l=r-i||1,c=this._root;i>t||t>=r||n>e||e>=a;)switch(s=(e<n)<<1|t<i,(o=new Array(4))[s]=c,c=o,l*=2,s){case 0:r=i+l,a=n+l;break;case 1:i=r-l,a=n+l;break;case 2:r=i+l,n=a-l;break;case 3:i=r-l,n=a-l}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=n,this._x1=r,this._y1=a,this},tt.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},tt.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},tt.find=function(t,e,i){var n,r,a,o,s,l,c,h=this._x0,d=this._y0,u=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new q(g,h,d,u,p)),null==i?i=1/0:(h=t-i,d=e-i,u=t+i,p=e+i,i*=i);l=f.pop();)if(!(!(g=l.node)||(r=l.x0)>u||(a=l.y0)>p||(o=l.x1)<h||(s=l.y1)<d))if(g.length){var m=(r+o)/2,b=(a+s)/2;f.push(new q(g[3],m,b,o,s),new q(g[2],r,b,m,s),new q(g[1],m,a,o,b),new q(g[0],r,a,m,b)),(c=(e>=b)<<1|t>=m)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-c],f[f.length-1-c]=l)}else{var v=t-+this._x.call(null,g.data),y=e-+this._y.call(null,g.data),_=v*v+y*y;if(_<i){var A=Math.sqrt(i=_);h=t-A,d=e-A,u=t+A,p=e+A,n=g.data}}return n},tt.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h,d,u,p=this._root,f=this._x0,g=this._y0,m=this._x1,b=this._y1;if(!p)return this;if(p.length)for(;;){if((c=a>=(s=(f+m)/2))?f=s:m=s,(h=o>=(l=(g+b)/2))?g=l:b=l,e=p,!(p=p[d=h<<1|c]))return this;if(!p.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(i=e,u=d)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,n?(r?n.next=r:delete n.next,this):e?(r?e[d]=r:delete e[d],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(i?i[u]=p:this._root=p),this):(this._root=r,this)},tt.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},tt.root=function(){return this._root},tt.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},tt.visit=function(t){var e,i,n,r,a,o,s=[],l=this._root;for(l&&s.push(new q(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,n=e.x0,r=e.y0,a=e.x1,o=e.y1)&&l.length){var c=(n+a)/2,h=(r+o)/2;(i=l[3])&&s.push(new q(i,c,h,a,o)),(i=l[2])&&s.push(new q(i,n,h,c,o)),(i=l[1])&&s.push(new q(i,c,r,a,h)),(i=l[0])&&s.push(new q(i,n,r,c,h))}return this},tt.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new q(this._root,this._x0,this._y0,this._x1,this._y1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.y0,l=e.x1,c=e.y1,h=(o+l)/2,d=(s+c)/2;(a=r[0])&&i.push(new q(a,o,s,h,d)),(a=r[1])&&i.push(new q(a,h,s,l,d)),(a=r[2])&&i.push(new q(a,o,d,h,c)),(a=r[3])&&i.push(new q(a,h,d,l,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},tt.x=function(t){return arguments.length?(this._x=t,this):this._x},tt.y=function(t){return arguments.length?(this._y=t,this):this._y};var ct=ot.prototype=st.prototype;function ht(){var t,e,i,n,r,a,o=D(-30),s=1,l=1/0,c=.81;function h(n){var a,o=t.length,s=(1===e?H(t,T):2===e?J(t,T,U):3===e?ot(t,T,U,F):null).visitAfter(u);for(r=n,a=0;a<o;++a)i=t[a],s.visit(p)}function d(){if(t){var e,i,n=t.length;for(a=new Array(n),e=0;e<n;++e)i=t[e],a[i.index]=+o(i,e,t)}}function u(t){var i,n,r,o,s,l,c=0,h=0,d=t.length;if(d){for(r=o=s=l=0;l<d;++l)(i=t[l])&&(n=Math.abs(i.value))&&(c+=i.value,h+=n,r+=n*(i.x||0),o+=n*(i.y||0),s+=n*(i.z||0));c*=Math.sqrt(4/d),t.x=r/h,e>1&&(t.y=o/h),e>2&&(t.z=s/h)}else{(i=t).x=i.data.x,e>1&&(i.y=i.data.y),e>2&&(i.z=i.data.z);do{c+=a[i.data.index]}while(i=i.next)}t.value=c}function p(t,o,h,d,u){if(!t.value)return!0;var p=[h,d,u][e-1],f=t.x-i.x,g=e>1?t.y-i.y:0,m=e>2?t.z-i.z:0,b=p-o,v=f*f+g*g+m*m;if(b*b/c<v)return v<l&&(0===f&&(v+=(f=P(n))*f),e>1&&0===g&&(v+=(g=P(n))*g),e>2&&0===m&&(v+=(m=P(n))*m),v<s&&(v=Math.sqrt(s*v)),i.vx+=f*t.value*r/v,e>1&&(i.vy+=g*t.value*r/v),e>2&&(i.vz+=m*t.value*r/v)),!0;if(!(t.length||v>=l)){(t.data!==i||t.next)&&(0===f&&(v+=(f=P(n))*f),e>1&&0===g&&(v+=(g=P(n))*g),e>2&&0===m&&(v+=(m=P(n))*m),v<s&&(v=Math.sqrt(s*v)));do{t.data!==i&&(b=a[t.data.index]*r/v,i.vx+=f*b,e>1&&(i.vy+=g*b),e>2&&(i.vz+=m*b))}while(t=t.next)}}return h.initialize=function(i,...r){t=i,n=r.find((t=>"function"==typeof t))||Math.random,e=r.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(o="function"==typeof t?t:D(+t),d(),h):o},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(l=t*t,h):Math.sqrt(l)},h.theta=function(t){return arguments.length?(c=t*t,h):Math.sqrt(c)},h}function dt(t,e,i){var n,r=1;function a(){var a,o,s=n.length,l=0,c=0,h=0;for(a=0;a<s;++a)l+=(o=n[a]).x||0,c+=o.y||0,h+=o.z||0;for(l=(l/s-t)*r,c=(c/s-e)*r,h=(h/s-i)*r,a=0;a<s;++a)o=n[a],l&&(o.x-=l),c&&(o.y-=c),h&&(o.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==i&&(i=0),a.initialize=function(t){n=t},a.x=function(e){return arguments.length?(t=+e,a):t},a.y=function(t){return arguments.length?(e=+t,a):e},a.z=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a}ct.copy=function(){var t,e,i=new st(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return i;if(!n.length)return i._root=lt(n),i;for(t=[{source:n,target:i._root=new Array(8)}];n=t.pop();)for(var r=0;r<8;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(8)}):n.target[r]=lt(e));return i},ct.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t),n=+this._z.call(null,t);return et(this.cover(e,i,n),e,i,n,t)},ct.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,i=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e);let a=1/0,o=1/0,s=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d,u,p,f,g=0;g<e;++g)isNaN(u=+this._x.call(null,d=t[g]))||isNaN(p=+this._y.call(null,d))||isNaN(f=+this._z.call(null,d))||(i[g]=u,n[g]=p,r[g]=f,u<a&&(a=u),u>l&&(l=u),p<o&&(o=p),p>c&&(c=p),f<s&&(s=f),f>h&&(h=f));if(a>l||o>c||s>h)return this;this.cover(a,o,s).cover(l,c,h);for(let a=0;a<e;++a)et(this,i[a],n[a],r[a],t[a]);return this},ct.cover=function(t,e,i){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(i=+i))return this;var n=this._x0,r=this._y0,a=this._z0,o=this._x1,s=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(t))+1,s=(r=Math.floor(e))+1,l=(a=Math.floor(i))+1;else{for(var c,h,d=o-n||1,u=this._root;n>t||t>=o||r>e||e>=s||a>i||i>=l;)switch(h=(i<a)<<2|(e<r)<<1|t<n,(c=new Array(8))[h]=u,u=c,d*=2,h){case 0:o=n+d,s=r+d,l=a+d;break;case 1:n=o-d,s=r+d,l=a+d;break;case 2:o=n+d,r=s-d,l=a+d;break;case 3:n=o-d,r=s-d,l=a+d;break;case 4:o=n+d,s=r+d,a=l-d;break;case 5:n=o-d,s=r+d,a=l-d;break;case 6:o=n+d,r=s-d,a=l-d;break;case 7:n=o-d,r=s-d,a=l-d}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=a,this._x1=o,this._y1=s,this._z1=l,this},ct.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},ct.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},ct.find=function(t,e,i,n){var r,a,o,s,l,c,h,d,u,p=this._x0,f=this._y0,g=this._z0,m=this._x1,b=this._y1,v=this._z1,y=[],_=this._root;for(_&&y.push(new it(_,p,f,g,m,b,v)),null==n?n=1/0:(p=t-n,f=e-n,g=i-n,m=t+n,b=e+n,v=i+n,n*=n);d=y.pop();)if(!(!(_=d.node)||(a=d.x0)>m||(o=d.y0)>b||(s=d.z0)>v||(l=d.x1)<p||(c=d.y1)<f||(h=d.z1)<g))if(_.length){var A=(a+l)/2,x=(o+c)/2,E=(s+h)/2;y.push(new it(_[7],A,x,E,l,c,h),new it(_[6],a,x,E,A,c,h),new it(_[5],A,o,E,l,x,h),new it(_[4],a,o,E,A,x,h),new it(_[3],A,x,s,l,c,E),new it(_[2],a,x,s,A,c,E),new it(_[1],A,o,s,l,x,E),new it(_[0],a,o,s,A,x,E)),(u=(i>=E)<<2|(e>=x)<<1|t>=A)&&(d=y[y.length-1],y[y.length-1]=y[y.length-1-u],y[y.length-1-u]=d)}else{var C=t-+this._x.call(null,_.data),M=e-+this._y.call(null,_.data),w=i-+this._z.call(null,_.data),S=C*C+M*M+w*w;if(S<n){var I=Math.sqrt(n=S);p=t-I,f=e-I,g=i-I,m=t+I,b=e+I,v=i+I,r=_.data}}return r},ct.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h,d,u,p,f,g,m=this._root,b=this._x0,v=this._y0,y=this._z0,_=this._x1,A=this._y1,x=this._z1;if(!m)return this;if(m.length)for(;;){if((d=a>=(l=(b+_)/2))?b=l:_=l,(u=o>=(c=(v+A)/2))?v=c:A=c,(p=s>=(h=(y+x)/2))?y=h:x=h,e=m,!(m=m[f=p<<2|u<<1|d]))return this;if(!m.length)break;(e[f+1&7]||e[f+2&7]||e[f+3&7]||e[f+4&7]||e[f+5&7]||e[f+6&7]||e[f+7&7])&&(i=e,g=f)}for(;m.data!==t;)if(n=m,!(m=m.next))return this;return(r=m.next)&&delete m.next,n?(r?n.next=r:delete n.next,this):e?(r?e[f]=r:delete e[f],(m=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&m===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!m.length&&(i?i[g]=m:this._root=m),this):(this._root=r,this)},ct.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},ct.root=function(){return this._root},ct.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},ct.visit=function(t){var e,i,n,r,a,o,s,l,c=[],h=this._root;for(h&&c.push(new it(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(h=e.node,n=e.x0,r=e.y0,a=e.z0,o=e.x1,s=e.y1,l=e.z1)&&h.length){var d=(n+o)/2,u=(r+s)/2,p=(a+l)/2;(i=h[7])&&c.push(new it(i,d,u,p,o,s,l)),(i=h[6])&&c.push(new it(i,n,u,p,d,s,l)),(i=h[5])&&c.push(new it(i,d,r,p,o,u,l)),(i=h[4])&&c.push(new it(i,n,r,p,d,u,l)),(i=h[3])&&c.push(new it(i,d,u,a,o,s,p)),(i=h[2])&&c.push(new it(i,n,u,a,d,s,p)),(i=h[1])&&c.push(new it(i,d,r,a,o,u,p)),(i=h[0])&&c.push(new it(i,n,r,a,d,u,p))}return this},ct.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new it(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.y0,l=e.z0,c=e.x1,h=e.y1,d=e.z1,u=(o+c)/2,p=(s+h)/2,f=(l+d)/2;(a=r[0])&&i.push(new it(a,o,s,l,u,p,f)),(a=r[1])&&i.push(new it(a,u,s,l,c,p,f)),(a=r[2])&&i.push(new it(a,o,p,l,u,h,f)),(a=r[3])&&i.push(new it(a,u,p,l,c,h,f)),(a=r[4])&&i.push(new it(a,o,s,f,u,p,d)),(a=r[5])&&i.push(new it(a,u,s,f,c,p,d)),(a=r[6])&&i.push(new it(a,o,p,f,u,h,d)),(a=r[7])&&i.push(new it(a,u,p,f,c,h,d))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},ct.x=function(t){return arguments.length?(this._x=t,this):this._x},ct.y=function(t){return arguments.length?(this._y=t,this):this._y},ct.z=function(t){return arguments.length?(this._z=t,this):this._z};var ut=i(5261),pt=i(7348);const ft=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},gt="object"==typeof global&&global&&global.Object===Object&&global;var mt="object"==typeof self&&self&&self.Object===Object&&self;const bt=gt||mt||Function("return this")(),vt=function(){return bt.Date.now()};var yt=/\s/;var _t=/^\s+/;const At=function(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&yt.test(t.charAt(e)););return e}(t)+1).replace(_t,""):t},xt=bt.Symbol;var Et=Object.prototype,Ct=Et.hasOwnProperty,Mt=Et.toString,wt=xt?xt.toStringTag:void 0;var St=Object.prototype.toString;var It=xt?xt.toStringTag:void 0;const Tt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":It&&It in Object(t)?function(t){var e=Ct.call(t,wt),i=t[wt];try{t[wt]=void 0;var n=!0}catch(t){}var r=Mt.call(t);return n&&(e?t[wt]=i:delete t[wt]),r}(t):function(t){return St.call(t)}(t)};var Ut=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Bt=/^0o[0-7]+$/i,Rt=parseInt;const Lt=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return null!=t&&"object"==typeof t}(t)&&"[object Symbol]"==Tt(t)}(t))return NaN;if(ft(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ft(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=At(t);var i=Ft.test(t);return i||Bt.test(t)?Rt(t.slice(2),i?2:8):Ut.test(t)?NaN:+t};var Dt=Math.max,Pt=Math.min;function Nt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(void 0,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(n.key))?r:String(r)),n)}var r}function Ot(t,e,i){return e&&Nt(t.prototype,e),i&&Nt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var zt=Ot((function t(e,i){var n=i.default,r=void 0===n?null:n,a=i.triggerUpdate,o=void 0===a||a,s=i.onChange,l=void 0===s?function(t,e){}:s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l})),Qt=i(4468);function Vt(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i>r||void 0===i&&r>=r)&&(i=r)}return i}function Ht(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i<e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i<r||void 0===i&&r>=r)&&(i=r)}return i}function Gt(t,e){if(t){if("string"==typeof t)return Wt(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Wt(t,e):void 0}}function Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function jt(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var Xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=(e instanceof Array?e.length?e:[void 0]:[e]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),a=t.reduce((function(t,e){var n=t,a=e;return r.forEach((function(t,e){var o,s=t.keyAccessor;if(t.isProp){var l=a,c=l[s],h=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(l,[s].map(jt));o=c,a=h}else o=s(a,e);e+1<r.length?(n.hasOwnProperty(o)||(n[o]={}),n=n[o]):i?(n.hasOwnProperty(o)||(n[o]=[]),n[o].push(a)):n[o]=a})),t}),{});i instanceof Function&&function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;n===r.length?Object.keys(e).forEach((function(t){return e[t]=i(e[t])})):Object.values(e).forEach((function(e){return t(e,n+1)}))}(a);var o=a;return n&&(o=[],function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];i.length===r.length?o.push({keys:i,vals:e}):Object.entries(e).forEach((function(e){var n,r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||Gt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e,2),a=r[0],o=r[1];return t(o,[].concat(function(t){if(Array.isArray(t))return Wt(t)}(n=i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Gt(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[a]))}))}(a),e instanceof Array&&0===e.length&&1===o.length&&(o[0].keys=[])),o};function qt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Zt(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Yt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||Kt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jt(t){return function(t){if(Array.isArray(t))return $t(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Kt(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kt(t,e){if(t){if("string"==typeof t)return $t(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$t(t,e):void 0}}function $t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var te=["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"];function ee(t,e,i,n,r){var a=r.createObj,o=void 0===a?function(t){return{}}:a,s=r.updateObj,l=void 0===s?function(t,e){}:s,c=r.exitObj,h=void 0===c?function(t){}:c,d=r.objBindAttr,u=void 0===d?"__obj":d,p=r.dataBindAttr,f=void 0===p?"__data":p,g=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(r,te),m=function(t,e,i){var n=i.objBindAttr,r=void 0===n?"__obj":n,a=i.dataBindAttr,o=void 0===a?"__data":a,s=i.idAccessor,l=i.purge,c=void 0!==l&&l,h=function(t){return t.hasOwnProperty(o)},d=e.filter((function(t){return!h(t)})),u=e.filter(h).map((function(t){return t[o]})),p=c?{enter:t,exit:u,update:[]}:function(t,e,i){var n={enter:[],update:[],exit:[]};if(i){var r=Xt(t,i,!1),a=Xt(e,i,!1),o=Object.assign({},r,a);Object.entries(o).forEach((function(t){var e=Yt(t,2),i=e[0],o=e[1],s=r.hasOwnProperty(i)?a.hasOwnProperty(i)?"update":"exit":"enter";n[s].push("update"===s?[r[i],a[i]]:o)}))}else{var s=new Set(t),l=new Set(e);new Set([].concat(Jt(s),Jt(l))).forEach((function(t){var e=s.has(t)?l.has(t)?"update":"exit":"enter";n[e].push("update"===e?[t,t]:t)}))}return n}(u,t,s);return p.update=p.update.map((function(t){var e=Yt(t,2),i=e[0],n=e[1];return i!==n&&(n[r]=i[r],n[r][o]=n),n})),p.exit=p.exit.concat(d.map((function(t){return Zt({},r,t)}))),p}(t,e,function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?qt(Object(i),!0).forEach((function(e){Zt(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):qt(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({objBindAttr:u,dataBindAttr:f},g)),b=m.enter,v=m.update;m.exit.forEach((function(t){var e=t[u];delete t[u],h(e),n(e)}));var y=function(t){var e=[];return t.forEach((function(t){var i=o(t);i&&(i[f]=t,t[u]=i,e.push(i))})),e}(b);!function(t){t.forEach((function(t){var e=t[u];e&&(e[f]=t,l(e,t))}))}([].concat(Jt(b),Jt(v))),y.forEach(i)}class ie extends Map{constructor(t,e=re){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,i]of t)this.set(e,i)}get(t){return super.get(ne(this,t))}has(t){return super.has(ne(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):(t.set(n,i),i)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},i){const n=e(i);return t.has(n)&&(i=t.get(n),t.delete(n)),i}(this,t))}}function ne({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):i}function re(t){return null!==t&&"object"==typeof t?t.valueOf():t}function ae(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}Set;const oe=Symbol("implicit"),se=function(t){for(var e=new Array(12),i=0;i<12;)e[i]="#"+t.slice(6*i,6*++i);return e}("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}var ce=/^\s+/,he=/\s+$/;function de(t,e){if(e=e||{},(t=t||"")instanceof de)return t;if(!(this instanceof de))return new de(t,e);var i=function(t){var e,i,n,r={r:0,g:0,b:0},a=1,o=null,s=null,l=null,c=!1,h=!1;return"string"==typeof t&&(t=function(t){t=t.replace(ce,"").replace(he,"").toLowerCase();var e,i=!1;if(Ie[t])t=Ie[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=Qe.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=Qe.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Qe.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=Qe.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Qe.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=Qe.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Qe.hex8.exec(t))?{r:Re(e[1]),g:Re(e[2]),b:Re(e[3]),a:Ne(e[4]),format:i?"name":"hex8"}:(e=Qe.hex6.exec(t))?{r:Re(e[1]),g:Re(e[2]),b:Re(e[3]),format:i?"name":"hex"}:(e=Qe.hex4.exec(t))?{r:Re(e[1]+""+e[1]),g:Re(e[2]+""+e[2]),b:Re(e[3]+""+e[3]),a:Ne(e[4]+""+e[4]),format:i?"name":"hex8"}:!!(e=Qe.hex3.exec(t))&&{r:Re(e[1]+""+e[1]),g:Re(e[2]+""+e[2]),b:Re(e[3]+""+e[3]),format:i?"name":"hex"}}(t)),"object"==le(t)&&(Ve(t.r)&&Ve(t.g)&&Ve(t.b)?(e=t.r,i=t.g,n=t.b,r={r:255*Fe(e,255),g:255*Fe(i,255),b:255*Fe(n,255)},c=!0,h="%"===String(t.r).substr(-1)?"prgb":"rgb"):Ve(t.h)&&Ve(t.s)&&Ve(t.v)?(o=De(t.s),s=De(t.v),r=function(t,e,i){t=6*Fe(t,360),e=Fe(e,100),i=Fe(i,100);var n=Math.floor(t),r=t-n,a=i*(1-e),o=i*(1-r*e),s=i*(1-(1-r)*e),l=n%6;return{r:255*[i,o,a,a,s,i][l],g:255*[s,i,i,o,a,a][l],b:255*[a,a,s,i,i,o][l]}}(t.h,o,s),c=!0,h="hsv"):Ve(t.h)&&Ve(t.s)&&Ve(t.l)&&(o=De(t.s),l=De(t.l),r=function(t,e,i){var n,r,a;function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=Fe(t,360),e=Fe(e,100),i=Fe(i,100),0===e)n=r=a=i;else{var s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=o(l,s,t+1/3),r=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*n,g:255*r,b:255*a}}(t.h,o,l),c=!0,h="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=Ue(a),{ok:c,format:t.format||h,r:Math.min(255,Math.max(r.r,0)),g:Math.min(255,Math.max(r.g,0)),b:Math.min(255,Math.max(r.b,0)),a}}(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||i.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}function ue(t,e,i){t=Fe(t,255),e=Fe(e,255),i=Fe(i,255);var n,r,a=Math.max(t,e,i),o=Math.min(t,e,i),s=(a+o)/2;if(a==o)n=r=0;else{var l=a-o;switch(r=s>.5?l/(2-a-o):l/(a+o),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,l:s}}function pe(t,e,i){t=Fe(t,255),e=Fe(e,255),i=Fe(i,255);var n,r,a=Math.max(t,e,i),o=Math.min(t,e,i),s=a,l=a-o;if(r=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,v:s}}function fe(t,e,i,n){var r=[Le(Math.round(t).toString(16)),Le(Math.round(e).toString(16)),Le(Math.round(i).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function ge(t,e,i,n){return[Le(Pe(n)),Le(Math.round(t).toString(16)),Le(Math.round(e).toString(16)),Le(Math.round(i).toString(16))].join("")}function me(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.s-=e/100,i.s=Be(i.s),de(i)}function be(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.s+=e/100,i.s=Be(i.s),de(i)}function ve(t){return de(t).desaturate(100)}function ye(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.l+=e/100,i.l=Be(i.l),de(i)}function _e(t,e){e=0===e?0:e||10;var i=de(t).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(-e/100*255))),i.g=Math.max(0,Math.min(255,i.g-Math.round(-e/100*255))),i.b=Math.max(0,Math.min(255,i.b-Math.round(-e/100*255))),de(i)}function Ae(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.l-=e/100,i.l=Be(i.l),de(i)}function xe(t,e){var i=de(t).toHsl(),n=(i.h+e)%360;return i.h=n<0?360+n:n,de(i)}function Ee(t){var e=de(t).toHsl();return e.h=(e.h+180)%360,de(e)}function Ce(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var i=de(t).toHsl(),n=[de(t)],r=360/e,a=1;a<e;a++)n.push(de({h:(i.h+a*r)%360,s:i.s,l:i.l}));return n}function Me(t){var e=de(t).toHsl(),i=e.h;return[de(t),de({h:(i+72)%360,s:e.s,l:e.l}),de({h:(i+216)%360,s:e.s,l:e.l})]}function we(t,e,i){e=e||6,i=i||30;var n=de(t).toHsl(),r=360/i,a=[de(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,a.push(de(n));return a}function Se(t,e){e=e||6;for(var i=de(t).toHsv(),n=i.h,r=i.s,a=i.v,o=[],s=1/e;e--;)o.push(de({h:n,s:r,v:a})),a=(a+s)%1;return o}de.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,n=this.toRgb();return t=n.r/255,e=n.g/255,i=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=Ue(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=pe(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=pe(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=ue(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ue(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+n+"%)":"hsla("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return fe(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,n,r){var a=[Le(Math.round(t).toString(16)),Le(Math.round(e).toString(16)),Le(Math.round(i).toString(16)),Le(Pe(n))];return r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*Fe(this._r,255))+"%",g:Math.round(100*Fe(this._g,255))+"%",b:Math.round(100*Fe(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*Fe(this._r,255))+"%, "+Math.round(100*Fe(this._g,255))+"%, "+Math.round(100*Fe(this._b,255))+"%)":"rgba("+Math.round(100*Fe(this._r,255))+"%, "+Math.round(100*Fe(this._g,255))+"%, "+Math.round(100*Fe(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Te[fe(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+ge(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var r=de(t);i="#"+ge(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return de(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(ye,arguments)},brighten:function(){return this._applyModification(_e,arguments)},darken:function(){return this._applyModification(Ae,arguments)},desaturate:function(){return this._applyModification(me,arguments)},saturate:function(){return this._applyModification(be,arguments)},greyscale:function(){return this._applyModification(ve,arguments)},spin:function(){return this._applyModification(xe,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(we,arguments)},complement:function(){return this._applyCombination(Ee,arguments)},monochromatic:function(){return this._applyCombination(Se,arguments)},splitcomplement:function(){return this._applyCombination(Me,arguments)},triad:function(){return this._applyCombination(Ce,[3])},tetrad:function(){return this._applyCombination(Ce,[4])}},de.fromRatio=function(t,e){if("object"==le(t)){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]="a"===n?t[n]:De(t[n]));t=i}return de(t,e)},de.equals=function(t,e){return!(!t||!e)&&de(t).toRgbString()==de(e).toRgbString()},de.random=function(){return de.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},de.mix=function(t,e,i){i=0===i?0:i||50;var n=de(t).toRgb(),r=de(e).toRgb(),a=i/100;return de({r:(r.r-n.r)*a+n.r,g:(r.g-n.g)*a+n.g,b:(r.b-n.b)*a+n.b,a:(r.a-n.a)*a+n.a})},de.readability=function(t,e){var i=de(t),n=de(e);return(Math.max(i.getLuminance(),n.getLuminance())+.05)/(Math.min(i.getLuminance(),n.getLuminance())+.05)},de.isReadable=function(t,e,i){var n,r,a,o,s,l=de.readability(t,e);switch(r=!1,"AA"!==(o=((a=(a=i)||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==o&&(o="AA"),"small"!==(s=(a.size||"small").toLowerCase())&&"large"!==s&&(s="small"),(n={level:o,size:s}).level+n.size){case"AAsmall":case"AAAlarge":r=l>=4.5;break;case"AAlarge":r=l>=3;break;case"AAAsmall":r=l>=7}return r},de.mostReadable=function(t,e,i){var n,r,a,o,s=null,l=0;r=(i=i||{}).includeFallbackColors,a=i.level,o=i.size;for(var c=0;c<e.length;c++)(n=de.readability(t,e[c]))>l&&(l=n,s=de(e[c]));return de.isReadable(t,s,{level:a,size:o})||!r?s:(i.includeFallbackColors=!1,de.mostReadable(t,["#fff","#000"],i))};var Ie=de.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Te=de.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(Ie);function Ue(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Fe(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Be(t){return Math.min(1,Math.max(0,t))}function Re(t){return parseInt(t,16)}function Le(t){return 1==t.length?"0"+t:""+t}function De(t){return t<=1&&(t=100*t+"%"),t}function Pe(t){return Math.round(255*parseFloat(t)).toString(16)}function Ne(t){return Re(t)/255}var Oe,ke,ze,Qe=(ke="[\\s|\\(]+("+(Oe="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Oe+")[,|\\s]+("+Oe+")\\s*\\)?",ze="[\\s|\\(]+("+Oe+")[,|\\s]+("+Oe+")[,|\\s]+("+Oe+")[,|\\s]+("+Oe+")\\s*\\)?",{CSS_UNIT:new RegExp(Oe),rgb:new RegExp("rgb"+ke),rgba:new RegExp("rgba"+ze),hsl:new RegExp("hsl"+ke),hsla:new RegExp("hsla"+ze),hsv:new RegExp("hsv"+ke),hsva:new RegExp("hsva"+ze),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function Ve(t){return!!Qe.CSS_UNIT.exec(t)}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(He=function(){return!!t})()}function Ge(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function We(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ge(Object(i),!0).forEach((function(e){qe(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ge(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function je(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}function Xe(t){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xe(t)}function qe(t,e,i){return(e=je(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ze(t){return Ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ze(t)}function Ye(t,e){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ye(t,e)}function Je(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ke(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||ti(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $e(t){return function(t){if(Array.isArray(t))return ei(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ti(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ti(t,e){if(t){if("string"==typeof t)return ei(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ei(t,e):void 0}}function ei(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var ii=function t(e){e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())},ni=function t(e){e.geometry&&e.geometry.dispose(),e.material&&ii(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(t)},ri=function(t){for(;t.children.length;){var e=t.children[0];t.remove(e),ni(e)}},ai=["objFilter"];function oi(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.objFilter,r=void 0===n?function(){return!0}:n,a=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(i,ai);return ee(t,e.children.filter(r),(function(t){return e.add(t)}),(function(t){e.remove(t),ri(t)}),We({objBindAttr:"__threeObj"},a))}var si=function(t){return isNaN(t)?parseInt(de(t).toHex(),16):t},li=function(t){return isNaN(t)?de(t).getAlpha():1},ci=function t(){var e=new ie,i=[],n=[],r=oe;function a(t){let a=e.get(t);if(void 0===a){if(r!==oe)return r;e.set(t,a=i.push(t)-1)}return n[a%n.length]}return a.domain=function(t){if(!arguments.length)return i.slice();i=[],e=new ie;for(const n of t)e.has(n)||e.set(n,i.push(n)-1);return a},a.range=function(t){return arguments.length?(n=Array.from(t),a):n.slice()},a.unknown=function(t){return arguments.length?(r=t,a):r},a.copy=function(){return t(i,n).unknown(r)},ae.apply(a,arguments),a}(se);function hi(t,e,i){e&&"string"==typeof i&&t.filter((function(t){return!t[i]})).forEach((function(t){t[i]=ci(e(t))}))}var di,ui,pi,fi,gi,mi,bi,vi,yi,_i,Ai,xi,Ei,Ci,Mi=window.THREE?window.THREE:{Group:n.YJl,Mesh:n.eaF,MeshLambertMaterial:n.G_z,Color:n.Q1f,BufferGeometry:n.LoY,BufferAttribute:n.THS,Matrix4:n.kn4,Vector3:n.Pq0,SphereGeometry:n.Gu$,CylinderGeometry:n.Ho_,TubeGeometry:n.j6,ConeGeometry:n.qFE,Line:n.N1A,LineBasicMaterial:n.mrM,QuadraticBezierCurve3:n.CV9,CubicBezierCurve3:n.s0K,Box3:n.NRn},wi={graph:ut,forcelayout:pt},Si=(new Mi.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Ii=(new Mi.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix",Ti=(di={props:{jsonUrl:{onChange:function(t,e){var i=this;t&&!e.fetchingJson&&(e.fetchingJson=!0,e.onLoading(),fetch(t).then((function(t){return t.json()})).then((function(t){e.fetchingJson=!1,e.onFinishLoading(t),i.graphData(t)})))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,e){e.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,e){var i=e.d3ForceLayout.force("charge");function n(t,e){t.forEach((function(t){delete t[e],delete t["v".concat(e)]}))}i&&i.strength(t>2?-60:-30),t<3&&n(e.graphData.nodes,"z"),t<2&&n(e.graphData.nodes,"y")}},dagMode:{onChange:function(t,e){!t&&"d3"===e.forceEngine&&(e.graphData.nodes||[]).forEach((function(t){return t.fx=t.fy=t.fz=void 0}))}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,e,i){return void 0===i?t.d3ForceLayout.force(e):(t.d3ForceLayout.force(e,i),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var e,i,n,r,a="ngraph"!==t.forceEngine;return t.engineRunning&&function(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||a&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[a?"tick":"step"](),t.onEngineTick());var e=(0,Qt.default)(t.nodeThreeObjectExtend);t.graphData.nodes.forEach((function(i){var n=i.__threeObj;if(n){var r=a?i:t.layout.getNodePosition(i[t.nodeId]),o=e(i);t.nodePositionUpdate&&t.nodePositionUpdate(o?n.children[0]:n,{x:r.x,y:r.y,z:r.z},i)&&!o||(n.position.x=r.x,n.position.y=r.y||0,n.position.z=r.z||0)}}));var i=(0,Qt.default)(t.linkWidth),n=(0,Qt.default)(t.linkCurvature),r=(0,Qt.default)(t.linkCurveRotation),o=(0,Qt.default)(t.linkThreeObjectExtend);t.graphData.links.forEach((function(e){var s=e.__lineObj;if(s){var l=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),c=l[a?"source":"from"],h=l[a?"target":"to"];if(c&&h&&c.hasOwnProperty("x")&&h.hasOwnProperty("x")){!function(e){var i=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),o=i[a?"source":"from"],s=i[a?"target":"to"];if(o&&s&&o.hasOwnProperty("x")&&s.hasOwnProperty("x")){var l=n(e);if(l){var c,h=new Mi.Vector3(o.x,o.y||0,o.z||0),d=new Mi.Vector3(s.x,s.y||0,s.z||0),u=h.distanceTo(d),p=r(e);if(u>0){var f=s.x-o.x,g=s.y-o.y||0,m=(new Mi.Vector3).subVectors(d,h),b=m.clone().multiplyScalar(l).cross(0!==f||0!==g?new Mi.Vector3(0,0,1):new Mi.Vector3(0,1,0)).applyAxisAngle(m.normalize(),p).add((new Mi.Vector3).addVectors(h,d).divideScalar(2));c=new Mi.QuadraticBezierCurve3(h,b,d)}else{var v=70*l,y=-p,_=y+Math.PI/2;c=new Mi.CubicBezierCurve3(h,new Mi.Vector3(v*Math.cos(_),v*Math.sin(_),0).add(h),new Mi.Vector3(v*Math.cos(y),v*Math.sin(y),0).add(h),d)}e.__curve=c}else e.__curve=null}}(e);var d=o(e);if(!t.linkPositionUpdate||!t.linkPositionUpdate(d?s.children[1]:s,{start:{x:c.x,y:c.y,z:c.z},end:{x:h.x,y:h.y,z:h.z}},e)||d){var u=e.__curve,p=s.children.length?s.children[0]:s;if("Line"===p.type){if(u)p.geometry.setFromPoints(u.getPoints(30));else{var f=p.geometry.getAttribute("position");f&&f.array&&6===f.array.length||p.geometry[Si]("position",f=new Mi.BufferAttribute(new Float32Array(6),3)),f.array[0]=c.x,f.array[1]=c.y||0,f.array[2]=c.z||0,f.array[3]=h.x,f.array[4]=h.y||0,f.array[5]=h.z||0,f.needsUpdate=!0}p.geometry.computeBoundingSphere()}else if("Mesh"===p.type)if(u){p.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(p.position.set(0,0,0),p.rotation.set(0,0,0),p.scale.set(1,1,1));var g=Math.ceil(10*i(e))/10/2,m=new Mi.TubeGeometry(u,30,g,t.linkResolution,!1);p.geometry.dispose(),p.geometry=m}else{if(!p.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var b=Math.ceil(10*i(e))/10/2,v=new Mi.CylinderGeometry(b,b,1,t.linkResolution,1,!1);v[Ii]((new Mi.Matrix4).makeTranslation(0,.5,0)),v[Ii]((new Mi.Matrix4).makeRotationX(Math.PI/2)),p.geometry.dispose(),p.geometry=v}var y=new Mi.Vector3(c.x,c.y||0,c.z||0),_=new Mi.Vector3(h.x,h.y||0,h.z||0),A=y.distanceTo(_);p.position.x=y.x,p.position.y=y.y,p.position.z=y.z,p.scale.z=A,p.parent.localToWorld(_),p.lookAt(_)}}}}}))}(),e=(0,Qt.default)(t.linkDirectionalArrowRelPos),i=(0,Qt.default)(t.linkDirectionalArrowLength),n=(0,Qt.default)(t.nodeVal),t.graphData.links.forEach((function(r){var o=r.__arrowObj;if(o){var s=a?r:t.layout.getLinkPosition(t.layout.graph.getLink(r.source,r.target).id),l=s[a?"source":"from"],c=s[a?"target":"to"];if(l&&c&&l.hasOwnProperty("x")&&c.hasOwnProperty("x")){var h=Math.cbrt(Math.max(0,n(l)||1))*t.nodeRelSize,d=Math.cbrt(Math.max(0,n(c)||1))*t.nodeRelSize,u=i(r),p=e(r),f=r.__curve?function(t){return r.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",l,c,t),y:e("y",l,c,t),z:e("z",l,c,t)}},g=r.__curve?r.__curve.getLength():Math.sqrt(["x","y","z"].map((function(t){return Math.pow((c[t]||0)-(l[t]||0),2)})).reduce((function(t,e){return t+e}),0)),m=h+u+(g-h-d-u)*p,b=f(m/g),v=f((m-u)/g);["x","y","z"].forEach((function(t){return o.position[t]=v[t]}));var y=function(t,e,i){if(He())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(t.bind.apply(t,n));return i&&Ye(r,i.prototype),r}(Mi.Vector3,$e(["x","y","z"].map((function(t){return b[t]}))));o.parent.localToWorld(y),o.lookAt(y)}}})),r=(0,Qt.default)(t.linkDirectionalParticleSpeed),t.graphData.links.forEach((function(e){var i=e.__photonsObj&&e.__photonsObj.children,n=e.__singleHopPhotonsObj&&e.__singleHopPhotonsObj.children;if(n&&n.length||i&&i.length){var o=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),s=o[a?"source":"from"],l=o[a?"target":"to"];if(s&&l&&s.hasOwnProperty("x")&&l.hasOwnProperty("x")){var c=r(e),h=e.__curve?function(t){return e.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",s,l,t),y:e("y",s,l,t),z:e("z",s,l,t)}};[].concat($e(i||[]),$e(n||[])).forEach((function(t,e){var n="singleHopPhotons"===t.parent.__linkThreeObjType;if(t.hasOwnProperty("__progressRatio")||(t.__progressRatio=n?0:e/i.length),t.__progressRatio+=c,t.__progressRatio>=1){if(n)return t.parent.remove(t),void ri(t);t.__progressRatio=t.__progressRatio%1}var r=t.__progressRatio,a=h(r);["x","y","z"].forEach((function(e){return t.position[e]=a[e]}))}))}}})),this},emitParticle:function(t,e){if(e&&t.graphData.links.includes(e)){if(!e.__singleHopPhotonsObj){var i=new Mi.Group;i.__linkThreeObjType="singleHopPhotons",e.__singleHopPhotonsObj=i,t.graphScene.add(i)}var n=(0,Qt.default)(t.linkDirectionalParticleWidth),r=Math.ceil(10*n(e))/10/2,a=t.linkDirectionalParticleResolution,o=new Mi.SphereGeometry(r,a,a),s=(0,Qt.default)(t.linkColor),l=(0,Qt.default)(t.linkDirectionalParticleColor)(e)||s(e)||"#f0f0f0",c=new Mi.Color(si(l)),h=3*t.linkOpacity,d=new Mi.MeshLambertMaterial({color:c,transparent:!0,opacity:h});e.__singleHopPhotonsObj.add(new Mi.Mesh(o,d))}return this},getGraphBbox:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(!t.initialised)return null;var i=function t(i){var n=[];if(i.geometry){i.geometry.computeBoundingBox();var r=new Mi.Box3;r.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),n.push(r)}return n.concat.apply(n,$e((i.children||[]).filter((function(t){return!t.hasOwnProperty("__graphObjType")||"node"===t.__graphObjType&&e(t.__data)})).map(t)))}(t.graphScene);return i.length?Object.assign.apply(Object,$e(["x","y","z"].map((function(t){return qe({},t,[Vt(i,(function(e){return e.min[t]})),Ht(i,(function(e){return e.max[t]}))])})))):null}},stateInit:function(){return{d3ForceLayout:L().force("link",k()).force("charge",ht()).force("center",dt()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,e){e.graphScene=t},update:function(t,e){var i=function(t){return t.some((function(t){return e.hasOwnProperty(t)}))};if(t.engineRunning=!1,t.onUpdate(),null!==t.nodeAutoColorBy&&i(["nodeAutoColorBy","graphData","nodeColor"])&&hi(t.graphData.nodes,(0,Qt.default)(t.nodeAutoColorBy),t.nodeColor),null!==t.linkAutoColorBy&&i(["linkAutoColorBy","graphData","linkColor"])&&hi(t.graphData.links,(0,Qt.default)(t.linkAutoColorBy),t.linkColor),t._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var n=(0,Qt.default)(t.nodeThreeObject),r=(0,Qt.default)(t.nodeThreeObjectExtend),a=(0,Qt.default)(t.nodeVal),o=(0,Qt.default)(t.nodeColor),s=(0,Qt.default)(t.nodeVisibility),l={},c={};oi(t.graphData.nodes.filter(s),t.graphScene,{purge:t._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]),objFilter:function(t){return"node"===t.__graphObjType},createObj:function(e){var i,a=n(e),o=r(e);return a&&t.nodeThreeObject===a&&(a=a.clone()),a&&!o?i=a:((i=new Mi.Mesh).__graphDefaultObj=!0,a&&o&&i.add(a)),i.__graphObjType="node",i},updateObj:function(e,i){if(e.__graphDefaultObj){var n=a(i)||1,r=Math.cbrt(n)*t.nodeRelSize,s=t.nodeResolution;e.geometry.type.match(/^Sphere(Buffer)?Geometry$/)&&e.geometry.parameters.radius===r&&e.geometry.parameters.widthSegments===s||(l.hasOwnProperty(n)||(l[n]=new Mi.SphereGeometry(r,s,s)),e.geometry.dispose(),e.geometry=l[n]);var h=o(i),d=new Mi.Color(si(h||"#ffffaa")),u=t.nodeOpacity*li(h);"MeshLambertMaterial"===e.material.type&&e.material.color.equals(d)&&e.material.opacity===u||(c.hasOwnProperty(h)||(c[h]=new Mi.MeshLambertMaterial({color:d,transparent:!0,opacity:u})),e.material.dispose(),e.material=c[h])}}})}if(t._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var h=(0,Qt.default)(t.linkThreeObject),d=(0,Qt.default)(t.linkThreeObjectExtend),u=(0,Qt.default)(t.linkMaterial),p=(0,Qt.default)(t.linkVisibility),f=(0,Qt.default)(t.linkColor),g=(0,Qt.default)(t.linkWidth),m={},b={},v={},y=t.graphData.links.filter(p);if(oi(y,t.graphScene,{objBindAttr:"__lineObj",purge:t._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]),objFilter:function(t){return"link"===t.__graphObjType},exitObj:function(t){var e=t.__data&&t.__data.__singleHopPhotonsObj;e&&(e.parent.remove(e),ri(e),delete t.__data.__singleHopPhotonsObj)},createObj:function(e){var i,n,r=h(e),a=d(e);if(r&&t.linkThreeObject===r&&(r=r.clone()),!r||a)if(g(e))i=new Mi.Mesh;else{var o=new Mi.BufferGeometry;o[Si]("position",new Mi.BufferAttribute(new Float32Array(6),3)),i=new Mi.Line(o)}return r?a?((n=new Mi.Group).__graphDefaultObj=!0,n.add(i),n.add(r)):n=r:(n=i).__graphDefaultObj=!0,n.renderOrder=10,n.__graphObjType="link",n},updateObj:function(e,i){if(e.__graphDefaultObj){var n=e.children.length?e.children[0]:e,r=Math.ceil(10*g(i))/10,a=!!r;if(a){var o=r/2,s=t.linkResolution;if(!n.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||n.geometry.parameters.radiusTop!==o||n.geometry.parameters.radialSegments!==s){if(!m.hasOwnProperty(r)){var l=new Mi.CylinderGeometry(o,o,1,s,1,!1);l[Ii]((new Mi.Matrix4).makeTranslation(0,.5,0)),l[Ii]((new Mi.Matrix4).makeRotationX(Math.PI/2)),m[r]=l}n.geometry.dispose(),n.geometry=m[r]}}var c=u(i);if(c)n.material=c;else{var h=f(i),d=new Mi.Color(si(h||"#f0f0f0")),p=t.linkOpacity*li(h),y=a?"MeshLambertMaterial":"LineBasicMaterial";if(n.material.type!==y||!n.material.color.equals(d)||n.material.opacity!==p){var _=a?b:v;_.hasOwnProperty(h)||(_[h]=new Mi[y]({color:d,transparent:p<1,opacity:p,depthWrite:p>=1})),n.material.dispose(),n.material=_[h]}}}}}),t.linkDirectionalArrowLength||e.hasOwnProperty("linkDirectionalArrowLength")){var _=(0,Qt.default)(t.linkDirectionalArrowLength),A=(0,Qt.default)(t.linkDirectionalArrowColor);oi(y.filter(_),t.graphScene,{objBindAttr:"__arrowObj",objFilter:function(t){return"arrow"===t.__linkThreeObjType},createObj:function(){var t=new Mi.Mesh(void 0,new Mi.MeshLambertMaterial({transparent:!0}));return t.__linkThreeObjType="arrow",t},updateObj:function(e,i){var n=_(i),r=t.linkDirectionalArrowResolution;if(!e.geometry.type.match(/^Cone(Buffer)?Geometry$/)||e.geometry.parameters.height!==n||e.geometry.parameters.radialSegments!==r){var a=new Mi.ConeGeometry(.25*n,n,r);a.translate(0,n/2,0),a.rotateX(Math.PI/2),e.geometry.dispose(),e.geometry=a}var o=A(i)||f(i)||"#f0f0f0";e.material.color=new Mi.Color(si(o)),e.material.opacity=3*t.linkOpacity*li(o)}})}if(t.linkDirectionalParticles||e.hasOwnProperty("linkDirectionalParticles")){var x=(0,Qt.default)(t.linkDirectionalParticles),E=(0,Qt.default)(t.linkDirectionalParticleWidth),C=(0,Qt.default)(t.linkDirectionalParticleColor),M={},w={};oi(y.filter(x),t.graphScene,{objBindAttr:"__photonsObj",objFilter:function(t){return"photons"===t.__linkThreeObjType},createObj:function(){var t=new Mi.Group;return t.__linkThreeObjType="photons",t},updateObj:function(e,i){var n,r=Math.round(Math.abs(x(i))),a=!!e.children.length&&e.children[0],o=Math.ceil(10*E(i))/10/2,s=t.linkDirectionalParticleResolution;a&&a.geometry.parameters.radius===o&&a.geometry.parameters.widthSegments===s?n=a.geometry:(w.hasOwnProperty(o)||(w[o]=new Mi.SphereGeometry(o,s,s)),n=w[o],a&&a.geometry.dispose());var l,c=C(i)||f(i)||"#f0f0f0",h=new Mi.Color(si(c)),d=3*t.linkOpacity;a&&a.material.color.equals(h)&&a.material.opacity===d?l=a.material:(M.hasOwnProperty(c)||(M[c]=new Mi.MeshLambertMaterial({color:h,transparent:!0,opacity:d})),l=M[c],a&&a.material.dispose()),oi($e(new Array(r)).map((function(t,e){return{idx:e}})),e,{idAccessor:function(t){return t.idx},createObj:function(){return new Mi.Mesh(n,l)},updateObj:function(t){t.geometry=n,t.material=l}})}})}}if(t._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach((function(e){e.source=e[t.linkSource],e.target=e[t.linkTarget]}));var S,I="ngraph"!==t.forceEngine;if(I){(S=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var T=t.d3ForceLayout.force("link");T&&T.id((function(e){return e[t.nodeId]})).links(t.graphData.links);var U=t.dagMode&&function(t,e){var i=t.nodes,n=t.links,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.nodeFilter,o=void 0===a?function(){return!0}:a,s=r.onLoopError,l=void 0===s?function(t){throw"Invalid DAG structure! Found cycle in node path: ".concat(t.join(" -> "),".")}:s,c={};i.forEach((function(t){return c[e(t)]={data:t,out:[],depth:-1,skip:!o(t)}})),n.forEach((function(t){var i=t.source,n=t.target,r=l(i),a=l(n);if(!c.hasOwnProperty(r))throw"Missing source node with id: ".concat(r);if(!c.hasOwnProperty(a))throw"Missing target node with id: ".concat(a);var o=c[r],s=c[a];function l(t){return"object"===Xe(t)?e(t):t}o.out.push(s)}));var h=[];return function t(i){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=function(){var a=i[o];if(-1!==n.indexOf(a)){var s=[].concat($e(n.slice(n.indexOf(a))),[a]).map((function(t){return e(t.data)}));return h.some((function(t){return t.length===s.length&&t.every((function(t,e){return t===s[e]}))}))||(h.push(s),l(s)),1}r>a.depth&&(a.depth=r,t(a.out,[].concat($e(n),[a]),r+(a.skip?0:1)))},o=0,s=i.length;o<s;o++)a()}(Object.values(c)),Object.assign.apply(Object,[{}].concat($e(Object.entries(c).filter((function(t){return!Ke(t,2)[1].skip})).map((function(t){var e=Ke(t,2);return qe({},e[0],e[1].depth)})))))}(t.graphData,(function(e){return e[t.nodeId]}),{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),F=Math.max.apply(Math,$e(Object.values(U||[]))),B=t.dagLevelDistance||t.graphData.nodes.length/(F||1)*2*(-1!==["radialin","radialout"].indexOf(t.dagMode)?.7:1);if(t.dagMode){var R=function(e,i){return function(n){return e?(U[n[t.nodeId]]-F/2)*B*(i?-1:1):void 0}},L=R(-1!==["lr","rl"].indexOf(t.dagMode),"rl"===t.dagMode),P=R(-1!==["td","bu"].indexOf(t.dagMode),"td"===t.dagMode),N=R(-1!==["zin","zout"].indexOf(t.dagMode),"zout"===t.dagMode);t.graphData.nodes.filter(t.dagNodeFilter).forEach((function(t){t.fx=L(t),t.fy=P(t),t.fz=N(t)}))}t.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(t.dagMode)?function(t,e,i,n){var r,a,o,s,l=D(.1);function c(t){for(var l=0,c=r.length;l<c;++l){var h=r[l],d=h.x-e||1e-6,u=(h.y||0)-i||1e-6,p=(h.z||0)-n||1e-6,f=Math.sqrt(d*d+u*u+p*p),g=(s[l]-f)*o[l]*t/f;h.vx+=d*g,a>1&&(h.vy+=u*g),a>2&&(h.vz+=p*g)}}function h(){if(r){var e,i=r.length;for(o=new Array(i),s=new Array(i),e=0;e<i;++e)s[e]=+t(r[e],e,r),o[e]=isNaN(s[e])?0:+l(r[e],e,r)}}return"function"!=typeof t&&(t=D(+t)),null==e&&(e=0),null==i&&(i=0),null==n&&(n=0),c.initialize=function(t,...e){r=t,a=e.find((t=>[1,2,3].includes(t)))||2,h()},c.strength=function(t){return arguments.length?(l="function"==typeof t?t:D(+t),h(),c):l},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:D(+e),h(),c):t},c.x=function(t){return arguments.length?(e=+t,c):e},c.y=function(t){return arguments.length?(i=+t,c):i},c.z=function(t){return arguments.length?(n=+t,c):n},c}((function(e){var i=U[e[t.nodeId]]||-1;return("radialin"===t.dagMode?F-i:i)*B})).strength((function(e){return t.dagNodeFilter(e)?1:0})):null)}else{var O=wi.graph();t.graphData.nodes.forEach((function(e){O.addNode(e[t.nodeId])})),t.graphData.links.forEach((function(t){O.addLink(t.source,t.target)})),(S=wi.forcelayout(O,We({dimensions:t.numDimensions},t.ngraphPhysics))).graph=O}for(var k=0;k<t.warmupTicks&&!(I&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);k++)S[I?"tick":"step"]();t.layout=S,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}},pi=void 0===(ui=di.stateInit)?function(){return{}}:ui,gi=void 0===(fi=di.props)?{}:fi,bi=void 0===(mi=di.methods)?{}:mi,yi=void 0===(vi=di.aliases)?{}:vi,Ai=void 0===(_i=di.init)?function(){}:_i,Ei=void 0===(xi=di.update)?function(){}:xi,Ci=Object.keys(gi).map((function(t){return new zt(t,gi[t])})),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},pi instanceof Function?pi(t):pi,{initialised:!1}),i={};function n(e){return r(e,t),a(),n}var r=function(t,i){Ai.call(n,t,e,i),e.initialised=!0},a=function(t,e,i){var n,r,a,o,s,l,c=0,h=!1,d=!1,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var i=n,a=r;return n=r=void 0,c=e,o=t.apply(a,i)}function f(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-c>=a}function g(){var t=vt();if(f(t))return m(t);s=setTimeout(g,function(t){var i=e-(t-l);return d?Pt(i,a-(t-c)):i}(t))}function m(t){return s=void 0,u&&n?p(t):(n=r=void 0,o)}function b(){var t=vt(),i=f(t);if(n=arguments,r=this,l=t,i){if(void 0===s)return function(t){return c=t,s=setTimeout(g,e),h?p(t):o}(l);if(d)return clearTimeout(s),s=setTimeout(g,e),p(l)}return void 0===s&&(s=setTimeout(g,e)),o}return e=Lt(e)||0,ft(i)&&(h=!!i.leading,a=(d="maxWait"in i)?Dt(Lt(i.maxWait)||0,e):a,u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=r=s=void 0},b.flush=function(){return void 0===s?o:m(vt())},b}((function(){e.initialised&&(Ei.call(n,e,i),i={})}),1);return Ci.forEach((function(t){n[t.name]=function(t){var r=t.name,o=t.triggerUpdate,s=void 0!==o&&o,l=t.onChange,c=void 0===l?function(t,e){}:l,h=t.defaultVal,d=void 0===h?null:h;return function(t){var o=e[r];if(!arguments.length)return o;var l=void 0===t?d:t;return e[r]=l,c.call(n,l,e,o),!i.hasOwnProperty(r)&&(i[r]=o),s&&a(),n}}(t)})),Object.keys(bi).forEach((function(t){n[t]=function(){for(var i,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return(i=bi[t]).call.apply(i,[n,e].concat(a))}})),Object.entries(yi).forEach((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return kt(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?kt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),i=e[0],r=e[1];return n[i]=n[r]})),n.resetProps=function(){return Ci.forEach((function(t){n[t.name](t.defaultVal)})),n},n.resetProps(),e._rerender=a,n}),Ui=function(t){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=function(i){function n(){var i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return(i=function(t,e,i){return e=Ze(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Je(t)}(t,He()?Reflect.construct(e,i||[],Ze(t).constructor):e.apply(t,i))}(this,n,[].concat(a))).__kapsuleInstance=t().apply(void 0,[].concat($e(e?[Je(i)]:[]),a)),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ye(t,e)}(n,i),r=n,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object);return Object.keys(t()).forEach((function(t){return i.prototype[t]=function(){var e,i=(e=this.__kapsuleInstance)[t].apply(e,arguments);return i===this.__kapsuleInstance?this:i}})),i}(Ti,(window.THREE?window.THREE:{Group:n.YJl}).Group,!0)},9437:(t,e,i)=>{"use strict";i.d(e,{CV9:()=>jo,G_z:()=>Fs,Gu$:()=>Ts,Ho_:()=>Jo,Ld9:()=>il,LoY:()=>nn,N1A:()=>Fo,NRn:()=>Ee,Pq0:()=>_e,Q1f:()=>Oi,QCA:()=>Ss,THS:()=>Wi,Y9S:()=>qs,YJl:()=>vo,aHM:()=>Ws,eaF:()=>An,j6:()=>Us,kn4:()=>Ye,mrM:()=>Mo,qFE:()=>Ko,s0K:()=>Ho});const n="159",r=1,a=2,o=3,s=0,l=1,c=2,h=100,d=101,u=102,p=200,f=201,g=202,m=203,b=204,v=205,y=206,_=207,A=208,x=209,E=210,C=211,M=212,w=213,S=214,I=0,T=1,U=2,F=0,B=1,R=2,L=3,D=4,P=5,N=301,O=302,k=306,z=1e3,Q=1001,V=1002,H=1003,G=1004,W=1005,j=1006,X=1007,q=1008,Z=1009,Y=1012,J=1014,K=1015,$=1016,tt=1020,et=1023,it=1026,nt=1027,rt=33776,at=33777,ot=33778,st=33779,lt=36492,ct=2300,ht=2301,dt=2302,ut=3001,pt="",ft="srgb",gt="srgb-linear",mt="display-p3",bt="display-p3-linear",vt="linear",yt="srgb",_t="rec709",At="p3",xt=7680,Et=512,Ct=513,Mt=514,wt=515,St=516,It=517,Tt=518,Ut=519,Ft="300 es",Bt=1035,Rt=2e3,Lt=2001;class Dt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const Pt=["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"],Nt=Math.PI/180,Ot=180/Math.PI;function kt(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Pt[255&t]+Pt[t>>8&255]+Pt[t>>16&255]+Pt[t>>24&255]+"-"+Pt[255&e]+Pt[e>>8&255]+"-"+Pt[e>>16&15|64]+Pt[e>>24&255]+"-"+Pt[63&i|128]+Pt[i>>8&255]+"-"+Pt[i>>16&255]+Pt[i>>24&255]+Pt[255&n]+Pt[n>>8&255]+Pt[n>>16&255]+Pt[n>>24&255]).toLowerCase()}function zt(t,e,i){return Math.max(e,Math.min(i,t))}function Qt(t,e,i){return(1-i)*t+i*e}function Vt(t){return!(t&t-1)&&0!==t}function Ht(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Gt(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 Wt(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class jt{constructor(t=0,e=0){jt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(zt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Xt{constructor(t,e,i,n,r,a,o,s,l){Xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,r,a,o,s,l)}set(t,e,i,n,r,a,o,s,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=o,c[3]=e,c[4]=r,c[5]=s,c[6]=i,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],l=i[1],c=i[4],h=i[7],d=i[2],u=i[5],p=i[8],f=n[0],g=n[3],m=n[6],b=n[1],v=n[4],y=n[7],_=n[2],A=n[5],x=n[8];return r[0]=a*f+o*b+s*_,r[3]=a*g+o*v+s*A,r[6]=a*m+o*y+s*x,r[1]=l*f+c*b+h*_,r[4]=l*g+c*v+h*A,r[7]=l*m+c*y+h*x,r[2]=d*f+u*b+p*_,r[5]=d*g+u*v+p*A,r[8]=d*m+u*y+p*x,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8];return e*a*c-e*o*l-i*r*c+i*o*s+n*r*l-n*a*s}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],h=c*a-o*l,d=o*s-c*r,u=l*r-a*s,p=e*h+i*d+n*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(n*l-c*i)*f,t[2]=(o*i-n*a)*f,t[3]=d*f,t[4]=(c*e-n*s)*f,t[5]=(n*r-o*e)*f,t[6]=u*f,t[7]=(i*s-l*e)*f,t[8]=(a*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,a,o){const s=Math.cos(r),l=Math.sin(r);return this.set(i*s,i*l,-i*(s*a+l*o)+a+t,-n*l,n*s,-n*(-l*a+s*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(qt.makeScale(t,e)),this}rotate(t){return this.premultiply(qt.makeRotation(-t)),this}translate(t,e){return this.premultiply(qt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const qt=new Xt;function Zt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Yt(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Jt(){const t=Yt("canvas");return t.style.display="block",t}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const Kt={};function $t(t){t in Kt||(Kt[t]=!0,console.warn(t))}const te=(new Xt).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),ee=(new Xt).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ie={[gt]:{transfer:vt,primaries:_t,toReference:t=>t,fromReference:t=>t},[ft]:{transfer:yt,primaries:_t,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[bt]:{transfer:vt,primaries:At,toReference:t=>t.applyMatrix3(ee),fromReference:t=>t.applyMatrix3(te)},[mt]:{transfer:yt,primaries:At,toReference:t=>t.convertSRGBToLinear().applyMatrix3(ee),fromReference:t=>t.applyMatrix3(te).convertLinearToSRGB()}},ne=new Set([gt,bt]),re={enabled:!0,_workingColorSpace:gt,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!ne.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,i){if(!1===this.enabled||e===i||!e||!i)return t;const n=ie[e].toReference;return(0,ie[i].fromReference)(n(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 ie[t].primaries},getTransfer:function(t){return t===pt?vt:ie[t].transfer}};function ae(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function oe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let se;class le{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===se&&(se=Yt("canvas")),se.width=t.width,se.height=t.height;const i=se.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=se}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Yt("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t<r.length;t++)r[t]=255*ae(r[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*ae(e[t]/255)):e[t]=ae(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let ce=0;class he{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ce++}),this.uuid=kt(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(de(n[e].image)):t.push(de(n[e]))}else t=de(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function de(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?le.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 ue=0;class pe extends Dt{constructor(t=pe.DEFAULT_IMAGE,e=pe.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,o=1023,s=1009,l=pe.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ue++}),this.uuid=kt(),this.name="",this.source=new he(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=s,this.offset=new jt(0,0),this.repeat=new jt(1,1),this.center=new jt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,"string"==typeof c?this.colorSpace=c:($t("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=c===ut?ft:pt),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case z:t.x=t.x-Math.floor(t.x);break;case Q:t.x=t.x<0?0:1;break;case V:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case z:t.y=t.y-Math.floor(t.y);break;case Q:t.y=t.y<0?0:1;break;case V:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return $t("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ft?ut:3e3}set encoding(t){$t("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===ut?ft:pt}}pe.DEFAULT_IMAGE=null,pe.DEFAULT_MAPPING=300,pe.DEFAULT_ANISOTROPY=1;class fe{constructor(t=0,e=0,i=0,n=1){fe.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const a=.01,o=.1,s=t.elements,l=s[0],c=s[4],h=s[8],d=s[1],u=s[5],p=s[9],f=s[2],g=s[6],m=s[10];if(Math.abs(c-d)<a&&Math.abs(h-f)<a&&Math.abs(p-g)<a){if(Math.abs(c+d)<o&&Math.abs(h+f)<o&&Math.abs(p+g)<o&&Math.abs(l+u+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,s=(u+1)/2,b=(m+1)/2,v=(c+d)/4,y=(h+f)/4,_=(p+g)/4;return t>s&&t>b?t<a?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=v/i,r=y/i):s>b?s<a?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(s),i=v/n,r=_/n):b<a?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(b),i=y/r,n=_/r),this.set(i,n,r,e),this}let b=Math.sqrt((g-p)*(g-p)+(h-f)*(h-f)+(d-c)*(d-c));return Math.abs(b)<.001&&(b=1),this.x=(g-p)/b,this.y=(h-f)/b,this.z=(d-c)/b,this.w=Math.acos((l+u+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ge extends Dt{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new fe(0,0,t,e),this.scissorTest=!1,this.viewport=new fe(0,0,t,e);const n={width:t,height:e,depth:1};void 0!==i.encoding&&($t("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===ut?ft:pt),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:j,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new pe(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new he(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class me extends ge{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class be extends pe{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=H,this.minFilter=H,this.wrapR=Q,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ve extends pe{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=H,this.minFilter=H,this.wrapR=Q,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ye{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,a,o){let s=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3];const d=r[a+0],u=r[a+1],p=r[a+2],f=r[a+3];if(0===o)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=d,t[e+1]=u,t[e+2]=p,void(t[e+3]=f);if(h!==f||s!==d||l!==u||c!==p){let t=1-o;const e=s*d+l*u+c*p+h*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),a=Math.atan2(r,e*i);t=Math.sin(t*a)/r,o=Math.sin(o*a)/r}const r=o*i;if(s=s*t+d*r,l=l*t+u*r,c=c*t+p*r,h=h*t+f*r,t===1-o){const t=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=t,l*=t,c*=t,h*=t}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,r,a){const o=i[n],s=i[n+1],l=i[n+2],c=i[n+3],h=r[a],d=r[a+1],u=r[a+2],p=r[a+3];return t[e]=o*p+c*h+s*u-l*d,t[e+1]=s*p+c*d+l*h-o*u,t[e+2]=l*p+c*u+o*d-s*h,t[e+3]=c*p-o*h-s*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const i=t._x,n=t._y,r=t._z,a=t._order,o=Math.cos,s=Math.sin,l=o(i/2),c=o(n/2),h=o(r/2),d=s(i/2),u=s(n/2),p=s(r/2);switch(a){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],a=e[1],o=e[5],s=e[9],l=e[2],c=e[6],h=e[10],d=i+o+h;if(d>0){const t=.5/Math.sqrt(d+1);this._w=.25/t,this._x=(c-s)*t,this._y=(r-l)*t,this._z=(a-n)*t}else if(i>o&&i>h){const t=2*Math.sqrt(1+i-o-h);this._w=(c-s)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(r+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-i-h);this._w=(r-l)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(s+c)/t}else{const t=2*Math.sqrt(1+h-i-o);this._w=(a-n)/t,this._x=(r+l)/t,this._y=(s+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(zt(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,l=e._z,c=e._w;return this._x=i*c+a*o+n*l-r*s,this._y=n*c+a*s+r*o-i*l,this._z=r*c+a*l+i*s-n*o,this._w=a*c-i*o-n*s-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,a=this._w;let o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;const s=1-o*o;if(s<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this._w=a*h+this._w*d,this._x=i*h+this._x*d,this._y=n*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class _e{constructor(t=0,e=0,i=0){_e.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(xe.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(xe.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,l=2*(a*n-o*i),c=2*(o*e-r*n),h=2*(r*i-a*e);return this.x=e+s*l+a*h-o*c,this.y=i+s*c+o*l-r*h,this.z=n+s*h+r*c-a*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Ae.copy(this).projectOnVector(t),this.sub(Ae)}reflect(t){return this.sub(Ae.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(zt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ae=new _e,xe=new ye;class Ee{constructor(t=new _e(1/0,1/0,1/0),e=new _e(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Me.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Me.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Me.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Me):Me.fromBufferAttribute(n,e),Me.applyMatrix4(t.matrixWorld),this.expandByPoint(Me);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),we.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),we.copy(i.boundingBox)),we.applyMatrix4(t.matrixWorld),this.union(we)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Me),Me.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Re),Le.subVectors(this.max,Re),Se.subVectors(t.a,Re),Ie.subVectors(t.b,Re),Te.subVectors(t.c,Re),Ue.subVectors(Ie,Se),Fe.subVectors(Te,Ie),Be.subVectors(Se,Te);let e=[0,-Ue.z,Ue.y,0,-Fe.z,Fe.y,0,-Be.z,Be.y,Ue.z,0,-Ue.x,Fe.z,0,-Fe.x,Be.z,0,-Be.x,-Ue.y,Ue.x,0,-Fe.y,Fe.x,0,-Be.y,Be.x,0];return!!Ne(e,Se,Ie,Te,Le)&&(e=[1,0,0,0,1,0,0,0,1],!!Ne(e,Se,Ie,Te,Le)&&(De.crossVectors(Ue,Fe),e=[De.x,De.y,De.z],Ne(e,Se,Ie,Te,Le)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Me).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Me).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ce[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ce[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ce[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ce[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ce[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ce[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ce[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ce[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ce)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ce=[new _e,new _e,new _e,new _e,new _e,new _e,new _e,new _e],Me=new _e,we=new Ee,Se=new _e,Ie=new _e,Te=new _e,Ue=new _e,Fe=new _e,Be=new _e,Re=new _e,Le=new _e,De=new _e,Pe=new _e;function Ne(t,e,i,n,r){for(let a=0,o=t.length-3;a<=o;a+=3){Pe.fromArray(t,a);const o=r.x*Math.abs(Pe.x)+r.y*Math.abs(Pe.y)+r.z*Math.abs(Pe.z),s=e.dot(Pe),l=i.dot(Pe),c=n.dot(Pe);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>o)return!1}return!0}const Oe=new Ee,ke=new _e,ze=new _e;class Qe{constructor(t=new _e,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):Oe.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ke.subVectors(t,this.center);const e=ke.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(ke,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(ze.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ke.copy(t.center).add(ze)),this.expandByPoint(ke.copy(t.center).sub(ze))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Ve=new _e,He=new _e,Ge=new _e,We=new _e,je=new _e,Xe=new _e,qe=new _e;class Ze{constructor(t=new _e,e=new _e(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ve)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Ve.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ve.copy(this.origin).addScaledVector(this.direction,e),Ve.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){He.copy(t).add(e).multiplyScalar(.5),Ge.copy(e).sub(t).normalize(),We.copy(this.origin).sub(He);const r=.5*t.distanceTo(e),a=-this.direction.dot(Ge),o=We.dot(this.direction),s=-We.dot(Ge),l=We.lengthSq(),c=Math.abs(1-a*a);let h,d,u,p;if(c>0)if(h=a*s-o,d=a*o-s,p=r*c,h>=0)if(d>=-p)if(d<=p){const t=1/c;h*=t,d*=t,u=h*(h+a*d+2*o)+d*(a*h+d+2*s)+l}else d=r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;else d=-r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;else d<=-p?(h=Math.max(0,-(-a*r+o)),d=h>0?-r:Math.min(Math.max(-r,-s),r),u=-h*h+d*(d+2*s)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-s),r),u=d*(d+2*s)+l):(h=Math.max(0,-(a*r+o)),d=h>0?r:Math.min(Math.max(-r,-s),r),u=-h*h+d*(d+2*s)+l);else d=a>0?-r:r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),n&&n.copy(He).addScaledVector(Ge,d),u}intersectSphere(t,e){Ve.subVectors(t.center,this.origin);const i=Ve.dot(this.direction),n=Ve.dot(Ve)-i*i,r=t.radius*t.radius;if(n>r)return null;const a=Math.sqrt(r-n),o=i-a,s=i+a;return s<0?null:o<0?this.at(s,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,a,o,s;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),c>=0?(r=(t.min.y-d.y)*c,a=(t.max.y-d.y)*c):(r=(t.max.y-d.y)*c,a=(t.min.y-d.y)*c),i>a||r>n?null:((r>i||isNaN(i))&&(i=r),(a<n||isNaN(n))&&(n=a),h>=0?(o=(t.min.z-d.z)*h,s=(t.max.z-d.z)*h):(o=(t.max.z-d.z)*h,s=(t.min.z-d.z)*h),i>s||o>n?null:((o>i||i!=i)&&(i=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,Ve)}intersectTriangle(t,e,i,n,r){je.subVectors(e,t),Xe.subVectors(i,t),qe.crossVectors(je,Xe);let a,o=this.direction.dot(qe);if(o>0){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}We.subVectors(this.origin,t);const s=a*this.direction.dot(Xe.crossVectors(We,Xe));if(s<0)return null;const l=a*this.direction.dot(je.cross(We));if(l<0)return null;if(s+l>o)return null;const c=-a*We.dot(qe);return c<0?null:this.at(c/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ye{constructor(t,e,i,n,r,a,o,s,l,c,h,d,u,p,f,g){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,n,r,a,o,s,l,c,h,d,u,p,f,g)}set(t,e,i,n,r,a,o,s,l,c,h,d,u,p,f,g){const m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=c,m[10]=h,m[14]=d,m[3]=u,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Ye).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/Je.setFromMatrixColumn(t,0).length(),r=1/Je.setFromMatrixColumn(t,1).length(),a=1/Je.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=a*c,i=a*h,n=o*c,r=o*h;e[0]=s*c,e[4]=-s*h,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-o*s,e[2]=r-t*l,e[6]=n+i*l,e[10]=a*s}else if("YXZ"===t.order){const t=s*c,i=s*h,n=l*c,r=l*h;e[0]=t+r*o,e[4]=n*o-i,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-o,e[2]=i*o-n,e[6]=r+t*o,e[10]=a*s}else if("ZXY"===t.order){const t=s*c,i=s*h,n=l*c,r=l*h;e[0]=t-r*o,e[4]=-a*h,e[8]=n+i*o,e[1]=i+n*o,e[5]=a*c,e[9]=r-t*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){const t=a*c,i=a*h,n=o*c,r=o*h;e[0]=s*c,e[4]=n*l-i,e[8]=t*l+r,e[1]=s*h,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){const t=a*s,i=a*l,n=o*s,r=o*l;e[0]=s*c,e[4]=r-t*h,e[8]=n*h+i,e[1]=h,e[5]=a*c,e[9]=-o*c,e[2]=-l*c,e[6]=i*h+n,e[10]=t-r*h}else if("XZY"===t.order){const t=a*s,i=a*l,n=o*s,r=o*l;e[0]=s*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=a*c,e[9]=i*h-n,e[2]=n*h-i,e[6]=o*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose($e,t,ti)}lookAt(t,e,i){const n=this.elements;return ni.subVectors(t,e),0===ni.lengthSq()&&(ni.z=1),ni.normalize(),ei.crossVectors(i,ni),0===ei.lengthSq()&&(1===Math.abs(i.z)?ni.x+=1e-4:ni.z+=1e-4,ni.normalize(),ei.crossVectors(i,ni)),ei.normalize(),ii.crossVectors(ni,ei),n[0]=ei.x,n[4]=ii.x,n[8]=ni.x,n[1]=ei.y,n[5]=ii.y,n[9]=ni.y,n[2]=ei.z,n[6]=ii.z,n[10]=ni.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],l=i[12],c=i[1],h=i[5],d=i[9],u=i[13],p=i[2],f=i[6],g=i[10],m=i[14],b=i[3],v=i[7],y=i[11],_=i[15],A=n[0],x=n[4],E=n[8],C=n[12],M=n[1],w=n[5],S=n[9],I=n[13],T=n[2],U=n[6],F=n[10],B=n[14],R=n[3],L=n[7],D=n[11],P=n[15];return r[0]=a*A+o*M+s*T+l*R,r[4]=a*x+o*w+s*U+l*L,r[8]=a*E+o*S+s*F+l*D,r[12]=a*C+o*I+s*B+l*P,r[1]=c*A+h*M+d*T+u*R,r[5]=c*x+h*w+d*U+u*L,r[9]=c*E+h*S+d*F+u*D,r[13]=c*C+h*I+d*B+u*P,r[2]=p*A+f*M+g*T+m*R,r[6]=p*x+f*w+g*U+m*L,r[10]=p*E+f*S+g*F+m*D,r[14]=p*C+f*I+g*B+m*P,r[3]=b*A+v*M+y*T+_*R,r[7]=b*x+v*w+y*U+_*L,r[11]=b*E+v*S+y*F+_*D,r[15]=b*C+v*I+y*B+_*P,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],l=t[13],c=t[2],h=t[6],d=t[10],u=t[14];return t[3]*(+r*s*h-n*l*h-r*o*d+i*l*d+n*o*u-i*s*u)+t[7]*(+e*s*u-e*l*d+r*a*d-n*a*u+n*l*c-r*s*c)+t[11]*(+e*l*h-e*o*u-r*a*h+i*a*u+r*o*c-i*l*c)+t[15]*(-n*o*c-e*s*h+e*o*d+n*a*h-i*a*d+i*s*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],h=t[9],d=t[10],u=t[11],p=t[12],f=t[13],g=t[14],m=t[15],b=h*g*l-f*d*l+f*s*u-o*g*u-h*s*m+o*d*m,v=p*d*l-c*g*l-p*s*u+a*g*u+c*s*m-a*d*m,y=c*f*l-p*h*l+p*o*u-a*f*u-c*o*m+a*h*m,_=p*h*s-c*f*s-p*o*d+a*f*d+c*o*g-a*h*g,A=e*b+i*v+n*y+r*_;if(0===A)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/A;return t[0]=b*x,t[1]=(f*d*r-h*g*r-f*n*u+i*g*u+h*n*m-i*d*m)*x,t[2]=(o*g*r-f*s*r+f*n*l-i*g*l-o*n*m+i*s*m)*x,t[3]=(h*s*r-o*d*r-h*n*l+i*d*l+o*n*u-i*s*u)*x,t[4]=v*x,t[5]=(c*g*r-p*d*r+p*n*u-e*g*u-c*n*m+e*d*m)*x,t[6]=(p*s*r-a*g*r-p*n*l+e*g*l+a*n*m-e*s*m)*x,t[7]=(a*d*r-c*s*r+c*n*l-e*d*l-a*n*u+e*s*u)*x,t[8]=y*x,t[9]=(p*h*r-c*f*r-p*i*u+e*f*u+c*i*m-e*h*m)*x,t[10]=(a*f*r-p*o*r+p*i*l-e*f*l-a*i*m+e*o*m)*x,t[11]=(c*o*r-a*h*r-c*i*l+e*h*l+a*i*u-e*o*u)*x,t[12]=_*x,t[13]=(c*f*n-p*h*n+p*i*d-e*f*d-c*i*g+e*h*g)*x,t[14]=(p*o*n-a*f*n-p*i*s+e*f*s+a*i*g-e*o*g)*x,t[15]=(a*h*n-c*o*n+c*i*s-e*h*s-a*i*d+e*o*d)*x,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,l=r*a,c=r*o;return this.set(l*a+i,l*o-n*s,l*s+n*o,0,l*o+n*s,c*o+i,c*s-n*a,0,l*s-n*o,c*s+n*a,r*s*s+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,a){return this.set(1,i,r,0,t,1,a,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,a=e._y,o=e._z,s=e._w,l=r+r,c=a+a,h=o+o,d=r*l,u=r*c,p=r*h,f=a*c,g=a*h,m=o*h,b=s*l,v=s*c,y=s*h,_=i.x,A=i.y,x=i.z;return n[0]=(1-(f+m))*_,n[1]=(u+y)*_,n[2]=(p-v)*_,n[3]=0,n[4]=(u-y)*A,n[5]=(1-(d+m))*A,n[6]=(g+b)*A,n[7]=0,n[8]=(p+v)*x,n[9]=(g-b)*x,n[10]=(1-(d+f))*x,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=Je.set(n[0],n[1],n[2]).length();const a=Je.set(n[4],n[5],n[6]).length(),o=Je.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],Ke.copy(this);const s=1/r,l=1/a,c=1/o;return Ke.elements[0]*=s,Ke.elements[1]*=s,Ke.elements[2]*=s,Ke.elements[4]*=l,Ke.elements[5]*=l,Ke.elements[6]*=l,Ke.elements[8]*=c,Ke.elements[9]*=c,Ke.elements[10]*=c,e.setFromRotationMatrix(Ke),i.x=r,i.y=a,i.z=o,this}makePerspective(t,e,i,n,r,a,o=2e3){const s=this.elements,l=2*r/(e-t),c=2*r/(i-n),h=(e+t)/(e-t),d=(i+n)/(i-n);let u,p;if(o===Rt)u=-(a+r)/(a-r),p=-2*a*r/(a-r);else{if(o!==Lt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-a/(a-r),p=-a*r/(a-r)}return s[0]=l,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=c,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,i,n,r,a,o=2e3){const s=this.elements,l=1/(e-t),c=1/(i-n),h=1/(a-r),d=(e+t)*l,u=(i+n)*c;let p,f;if(o===Rt)p=(a+r)*h,f=-2*h;else{if(o!==Lt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,f=-1*h}return s[0]=2*l,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=f,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Je=new _e,Ke=new Ye,$e=new _e(0,0,0),ti=new _e(1,1,1),ei=new _e,ii=new _e,ni=new _e,ri=new Ye,ai=new ye;class oi{constructor(t=0,e=0,i=0,n=oi.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],a=n[4],o=n[8],s=n[1],l=n[5],c=n[9],h=n[2],d=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(zt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-zt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(zt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-zt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(zt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-zt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ri.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ri,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ai.setFromEuler(this),this.setFromQuaternion(ai,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}oi.DEFAULT_ORDER="XYZ";class si{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let li=0;const ci=new _e,hi=new ye,di=new Ye,ui=new _e,pi=new _e,fi=new _e,gi=new ye,mi=new _e(1,0,0),bi=new _e(0,1,0),vi=new _e(0,0,1),yi={type:"added"},_i={type:"removed"};class Ai extends Dt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:li++}),this.uuid=kt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ai.DEFAULT_UP.clone();const t=new _e,e=new oi,i=new ye,n=new _e(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ye},normalMatrix:{value:new Xt}}),this.matrix=new Ye,this.matrixWorld=new Ye,this.matrixAutoUpdate=Ai.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ai.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new si,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return hi.setFromAxisAngle(t,e),this.quaternion.multiply(hi),this}rotateOnWorldAxis(t,e){return hi.setFromAxisAngle(t,e),this.quaternion.premultiply(hi),this}rotateX(t){return this.rotateOnAxis(mi,t)}rotateY(t){return this.rotateOnAxis(bi,t)}rotateZ(t){return this.rotateOnAxis(vi,t)}translateOnAxis(t,e){return ci.copy(t).applyQuaternion(this.quaternion),this.position.add(ci.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(mi,t)}translateY(t){return this.translateOnAxis(bi,t)}translateZ(t){return this.translateOnAxis(vi,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(di.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?ui.copy(t):ui.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),pi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?di.lookAt(pi,ui,this.up):di.lookAt(ui,pi,this.up),this.quaternion.setFromRotationMatrix(di),n&&(di.extractRotation(n.matrixWorld),hi.setFromRotationMatrix(di),this.quaternion.premultiply(hi.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(yi)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(_i)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),di.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),di.multiply(t.parent.matrixWorld)),t.applyMatrix4(di),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pi,t,fi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pi,gi,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){const n=e[i];!0!==n.matrixWorldAutoUpdate&&!0!==t||n.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){const i=t[e];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),n.maxGeometryCount=this._maxGeometryCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(t),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=a(t.geometries),n=a(t.materials),r=a(t.textures),o=a(t.images),s=a(t.shapes),l=a(t.skeletons),c=a(t.animations),h=a(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),o.length>0&&(i.images=o),s.length>0&&(i.shapes=s),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),h.length>0&&(i.nodes=h)}return i.object=n,i;function a(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Ai.DEFAULT_UP=new _e(0,1,0),Ai.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ai.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const xi=new _e,Ei=new _e,Ci=new _e,Mi=new _e,wi=new _e,Si=new _e,Ii=new _e,Ti=new _e,Ui=new _e,Fi=new _e;let Bi=!1;class Ri{constructor(t=new _e,e=new _e,i=new _e){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),xi.subVectors(t,e),n.cross(xi);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){xi.subVectors(n,e),Ei.subVectors(i,e),Ci.subVectors(t,e);const a=xi.dot(xi),o=xi.dot(Ei),s=xi.dot(Ci),l=Ei.dot(Ei),c=Ei.dot(Ci),h=a*l-o*o;if(0===h)return r.set(-2,-1,-1);const d=1/h,u=(l*s-o*c)*d,p=(a*c-o*s)*d;return r.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Mi),Mi.x>=0&&Mi.y>=0&&Mi.x+Mi.y<=1}static getUV(t,e,i,n,r,a,o,s){return!1===Bi&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Bi=!0),this.getInterpolation(t,e,i,n,r,a,o,s)}static getInterpolation(t,e,i,n,r,a,o,s){return this.getBarycoord(t,e,i,n,Mi),s.setScalar(0),s.addScaledVector(r,Mi.x),s.addScaledVector(a,Mi.y),s.addScaledVector(o,Mi.z),s}static isFrontFacing(t,e,i,n){return xi.subVectors(i,e),Ei.subVectors(t,e),xi.cross(Ei).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return xi.subVectors(this.c,this.b),Ei.subVectors(this.a,this.b),.5*xi.cross(Ei).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ri.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ri.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return!1===Bi&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Bi=!0),Ri.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}getInterpolation(t,e,i,n,r){return Ri.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Ri.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ri.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let a,o;wi.subVectors(n,i),Si.subVectors(r,i),Ti.subVectors(t,i);const s=wi.dot(Ti),l=Si.dot(Ti);if(s<=0&&l<=0)return e.copy(i);Ui.subVectors(t,n);const c=wi.dot(Ui),h=Si.dot(Ui);if(c>=0&&h<=c)return e.copy(n);const d=s*h-c*l;if(d<=0&&s>=0&&c<=0)return a=s/(s-c),e.copy(i).addScaledVector(wi,a);Fi.subVectors(t,r);const u=wi.dot(Fi),p=Si.dot(Fi);if(p>=0&&u<=p)return e.copy(r);const f=u*l-s*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(i).addScaledVector(Si,o);const g=c*p-u*h;if(g<=0&&h-c>=0&&u-p>=0)return Ii.subVectors(r,n),o=(h-c)/(h-c+(u-p)),e.copy(n).addScaledVector(Ii,o);const m=1/(g+f+d);return a=f*m,o=d*m,e.copy(i).addScaledVector(wi,a).addScaledVector(Si,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Li={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},Di={h:0,s:0,l:0},Pi={h:0,s:0,l:0};function Ni(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Oi{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ft){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,re.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=re.workingColorSpace){return this.r=t,this.g=e,this.b=i,re.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=re.workingColorSpace){if(t=(t%(r=1)+r)%r,e=zt(e,0,1),i=zt(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Ni(r,n,t+1/3),this.g=Ni(r,n,t),this.b=Ni(r,n,t-1/3)}var r;return re.toWorkingColorSpace(this,n),this}setStyle(t,e=ft){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const a=n[1],o=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(i,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ft){const i=Li[t.toLowerCase()];return void 0!==i?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ae(t.r),this.g=ae(t.g),this.b=ae(t.b),this}copyLinearToSRGB(t){return this.r=oe(t.r),this.g=oe(t.g),this.b=oe(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ft){return re.fromWorkingColorSpace(ki.copy(this),t),65536*Math.round(zt(255*ki.r,0,255))+256*Math.round(zt(255*ki.g,0,255))+Math.round(zt(255*ki.b,0,255))}getHexString(t=ft){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=re.workingColorSpace){re.fromWorkingColorSpace(ki.copy(this),e);const i=ki.r,n=ki.g,r=ki.b,a=Math.max(i,n,r),o=Math.min(i,n,r);let s,l;const c=(o+a)/2;if(o===a)s=0,l=0;else{const t=a-o;switch(l=c<=.5?t/(a+o):t/(2-a-o),a){case i:s=(n-r)/t+(n<r?6:0);break;case n:s=(r-i)/t+2;break;case r:s=(i-n)/t+4}s/=6}return t.h=s,t.s=l,t.l=c,t}getRGB(t,e=re.workingColorSpace){return re.fromWorkingColorSpace(ki.copy(this),e),t.r=ki.r,t.g=ki.g,t.b=ki.b,t}getStyle(t=ft){re.fromWorkingColorSpace(ki.copy(this),t);const e=ki.r,i=ki.g,n=ki.b;return t!==ft?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(Di),this.setHSL(Di.h+t,Di.s+e,Di.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Di),t.getHSL(Pi);const i=Qt(Di.h,Pi.h,e),n=Qt(Di.s,Pi.s,e),r=Qt(Di.l,Pi.l,e);return this.setHSL(i,n,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*n,this.g=r[1]*e+r[4]*i+r[7]*n,this.b=r[2]*e+r[5]*i+r[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ki=new Oi;Oi.NAMES=Li;let zi=0;class Qi extends Dt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zi++}),this.uuid=kt(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=h,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Oi(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=xt,this.stencilZFail=xt,this.stencilZPass=xt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),this.blendEquation!==h&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==xt&&(i.stencilFail=this.stencilFail),this.stencilZFail!==xt&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==xt&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Vi extends Qi{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Oi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=I,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Hi=new _e,Gi=new jt;class Wi{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=K,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Gi.fromBufferAttribute(this,e),Gi.applyMatrix3(t),this.setXY(e,Gi.x,Gi.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.applyMatrix3(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.applyMatrix4(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.applyNormalMatrix(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.transformDirection(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Gt(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Wt(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Gt(e,this.array)),e}setX(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Gt(e,this.array)),e}setY(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Gt(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Gt(e,this.array)),e}setW(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),i=Wt(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),i=Wt(i,this.array),n=Wt(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),i=Wt(i,this.array),n=Wt(n,this.array),r=Wt(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class ji extends Wi{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Xi extends Wi{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class qi extends Wi{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Zi=0;const Yi=new Ye,Ji=new Ai,Ki=new _e,$i=new Ee,tn=new Ee,en=new _e;class nn extends Dt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zi++}),this.uuid=kt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Zt(t)?Xi:ji)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new Xt).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Yi.makeRotationFromQuaternion(t),this.applyMatrix4(Yi),this}rotateX(t){return Yi.makeRotationX(t),this.applyMatrix4(Yi),this}rotateY(t){return Yi.makeRotationY(t),this.applyMatrix4(Yi),this}rotateZ(t){return Yi.makeRotationZ(t),this.applyMatrix4(Yi),this}translate(t,e,i){return Yi.makeTranslation(t,e,i),this.applyMatrix4(Yi),this}scale(t,e,i){return Yi.makeScale(t,e,i),this.applyMatrix4(Yi),this}lookAt(t){return Ji.lookAt(t),Ji.updateMatrix(),this.applyMatrix4(Ji.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ki).negate(),this.translate(Ki.x,Ki.y,Ki.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new qi(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ee);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new _e(-1/0,-1/0,-1/0),new _e(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];$i.setFromBufferAttribute(i),this.morphTargetsRelative?(en.addVectors(this.boundingBox.min,$i.min),this.boundingBox.expandByPoint(en),en.addVectors(this.boundingBox.max,$i.max),this.boundingBox.expandByPoint(en)):(this.boundingBox.expandByPoint($i.min),this.boundingBox.expandByPoint($i.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(){null===this.boundingSphere&&(this.boundingSphere=new Qe);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new _e,1/0);if(t){const i=this.boundingSphere.center;if($i.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];tn.setFromBufferAttribute(i),this.morphTargetsRelative?(en.addVectors($i.min,tn.min),$i.expandByPoint(en),en.addVectors($i.max,tn.max),$i.expandByPoint(en)):($i.expandByPoint(tn.min),$i.expandByPoint(tn.max))}$i.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)en.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(en));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],o=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)en.fromBufferAttribute(a,e),o&&(Ki.fromBufferAttribute(t,e),en.add(Ki)),n=Math.max(n,i.distanceToSquared(en))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,a=e.uv.array,o=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Wi(new Float32Array(4*o),4));const s=this.getAttribute("tangent").array,l=[],c=[];for(let t=0;t<o;t++)l[t]=new _e,c[t]=new _e;const h=new _e,d=new _e,u=new _e,p=new jt,f=new jt,g=new jt,m=new _e,b=new _e;function v(t,e,i){h.fromArray(n,3*t),d.fromArray(n,3*e),u.fromArray(n,3*i),p.fromArray(a,2*t),f.fromArray(a,2*e),g.fromArray(a,2*i),d.sub(h),u.sub(h),f.sub(p),g.sub(p);const r=1/(f.x*g.y-g.x*f.y);isFinite(r)&&(m.copy(d).multiplyScalar(g.y).addScaledVector(u,-f.y).multiplyScalar(r),b.copy(u).multiplyScalar(f.x).addScaledVector(d,-g.x).multiplyScalar(r),l[t].add(m),l[e].add(m),l[i].add(m),c[t].add(b),c[e].add(b),c[i].add(b))}let y=this.groups;0===y.length&&(y=[{start:0,count:i.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)v(i[t+0],i[t+1],i[t+2])}const _=new _e,A=new _e,x=new _e,E=new _e;function C(t){x.fromArray(r,3*t),E.copy(x);const e=l[t];_.copy(e),_.sub(x.multiplyScalar(x.dot(e))).normalize(),A.crossVectors(E,e);const i=A.dot(c[t])<0?-1:1;s[4*t]=_.x,s[4*t+1]=_.y,s[4*t+2]=_.z,s[4*t+3]=i}for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)C(i[t+0]),C(i[t+1]),C(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Wi(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new _e,r=new _e,a=new _e,o=new _e,s=new _e,l=new _e,c=new _e,h=new _e;if(t)for(let d=0,u=t.count;d<u;d+=3){const u=t.getX(d+0),p=t.getX(d+1),f=t.getX(d+2);n.fromBufferAttribute(e,u),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),o.fromBufferAttribute(i,u),s.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),o.add(c),s.add(c),l.add(c),i.setXYZ(u,o.x,o.y,o.z),i.setXYZ(p,s.x,s.y,s.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,o=e.count;t<o;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),i.setXYZ(t+0,c.x,c.y,c.z),i.setXYZ(t+1,c.x,c.y,c.z),i.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)en.fromBufferAttribute(t,e),en.normalize(),t.setXYZ(e,en.x,en.y,en.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,a=new i.constructor(e.length*n);let o=0,s=0;for(let r=0,l=e.length;r<l;r++){o=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)a[s++]=i[o++]}return new Wi(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new nn,i=this.index.array,n=this.attributes;for(const r in n){const a=t(n[r],i);e.setAttribute(r,a)}const r=this.morphAttributes;for(const n in r){const a=[],o=r[n];for(let e=0,n=o.length;e<n;e++){const n=t(o[e],i);a.push(n)}e.morphAttributes[n]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,i=a.length;t<i;t++){const i=a[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],a=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];a.push(n.toJSON(t.data))}a.length>0&&(n[e]=a,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const rn=new Ye,an=new Ze,on=new Qe,sn=new _e,ln=new _e,cn=new _e,hn=new _e,dn=new _e,un=new _e,pn=new jt,fn=new jt,gn=new jt,mn=new _e,bn=new _e,vn=new _e,yn=new _e,_n=new _e;class An extends Ai{constructor(t=new nn,e=new Vi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,a=i.morphTargetsRelative;e.fromBufferAttribute(n,t);const o=this.morphTargetInfluences;if(r&&o){un.set(0,0,0);for(let i=0,n=r.length;i<n;i++){const n=o[i],s=r[i];0!==n&&(dn.fromBufferAttribute(s,t),a?un.addScaledVector(dn,n):un.addScaledVector(dn.sub(e),n))}e.add(un)}return e}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),on.copy(i.boundingSphere),on.applyMatrix4(r),an.copy(t.ray).recast(t.near),!1===on.containsPoint(an.origin)){if(null===an.intersectSphere(on,sn))return;if(an.origin.distanceToSquared(sn)>(t.far-t.near)**2)return}rn.copy(r).invert(),an.copy(t.ray).applyMatrix4(rn),null!==i.boundingBox&&!1===an.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,an)}}_computeIntersections(t,e,i){let n;const r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(a))for(let r=0,s=d.length;r<s;r++){const s=d[r],p=a[s.materialIndex];for(let r=Math.max(s.start,u.start),a=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));r<a;r+=3)n=xn(this,p,t,i,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),n&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=s.materialIndex,e.push(n))}else for(let r=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);r<s;r+=3)n=xn(this,a,t,i,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),n&&(n.faceIndex=Math.floor(r/3),e.push(n));else if(void 0!==s)if(Array.isArray(a))for(let r=0,o=d.length;r<o;r++){const o=d[r],p=a[o.materialIndex];for(let r=Math.max(o.start,u.start),a=Math.min(s.count,Math.min(o.start+o.count,u.start+u.count));r<a;r+=3)n=xn(this,p,t,i,l,c,h,r,r+1,r+2),n&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=o.materialIndex,e.push(n))}else for(let r=Math.max(0,u.start),o=Math.min(s.count,u.start+u.count);r<o;r+=3)n=xn(this,a,t,i,l,c,h,r,r+1,r+2),n&&(n.faceIndex=Math.floor(r/3),e.push(n))}}function xn(t,e,i,n,r,a,o,s,l,c){t.getVertexPosition(s,ln),t.getVertexPosition(l,cn),t.getVertexPosition(c,hn);const h=function(t,e,i,n,r,a,o,s){let l;if(l=1===e.side?n.intersectTriangle(o,a,r,!0,s):n.intersectTriangle(r,a,o,0===e.side,s),null===l)return null;_n.copy(s),_n.applyMatrix4(t.matrixWorld);const c=i.ray.origin.distanceTo(_n);return c<i.near||c>i.far?null:{distance:c,point:_n.clone(),object:t}}(t,e,i,n,ln,cn,hn,yn);if(h){r&&(pn.fromBufferAttribute(r,s),fn.fromBufferAttribute(r,l),gn.fromBufferAttribute(r,c),h.uv=Ri.getInterpolation(yn,ln,cn,hn,pn,fn,gn,new jt)),a&&(pn.fromBufferAttribute(a,s),fn.fromBufferAttribute(a,l),gn.fromBufferAttribute(a,c),h.uv1=Ri.getInterpolation(yn,ln,cn,hn,pn,fn,gn,new jt),h.uv2=h.uv1),o&&(mn.fromBufferAttribute(o,s),bn.fromBufferAttribute(o,l),vn.fromBufferAttribute(o,c),h.normal=Ri.getInterpolation(yn,ln,cn,hn,mn,bn,vn,new _e),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const t={a:s,b:l,c,normal:new _e,materialIndex:0};Ri.getNormal(ln,cn,hn,t.normal),h.face=t}return h}class En extends nn{constructor(t=1,e=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const o=this;n=Math.floor(n),r=Math.floor(r),a=Math.floor(a);const s=[],l=[],c=[],h=[];let d=0,u=0;function p(t,e,i,n,r,a,p,f,g,m,b){const v=a/g,y=p/m,_=a/2,A=p/2,x=f/2,E=g+1,C=m+1;let M=0,w=0;const S=new _e;for(let a=0;a<C;a++){const o=a*y-A;for(let s=0;s<E;s++){const d=s*v-_;S[t]=d*n,S[e]=o*r,S[i]=x,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[i]=f>0?1:-1,c.push(S.x,S.y,S.z),h.push(s/g),h.push(1-a/m),M+=1}}for(let t=0;t<m;t++)for(let e=0;e<g;e++){const i=d+e+E*t,n=d+e+E*(t+1),r=d+(e+1)+E*(t+1),a=d+(e+1)+E*t;s.push(i,n,a),s.push(n,r,a),w+=6}o.addGroup(u,w,b),u+=w,d+=M}p("z","y","x",-1,-1,i,e,t,a,r,0),p("z","y","x",1,-1,i,e,-t,a,r,1),p("x","z","y",1,1,t,i,e,n,a,2),p("x","z","y",1,-1,t,i,-e,n,a,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(s),this.setAttribute("position",new qi(l,3)),this.setAttribute("normal",new qi(c,3)),this.setAttribute("uv",new qi(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new En(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Cn(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];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[i][n]=null):e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Mn(t){const e={};for(let i=0;i<t.length;i++){const n=Cn(t[i]);for(const t in n)e[t]=n[t]}return e}function wn(t){return null===t.getRenderTarget()?t.outputColorSpace:re.workingColorSpace}const Sn={clone:Cn,merge:Mn};class In extends Qi{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Cn(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Tn extends Ai{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye,this.coordinateSystem=Rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class Un extends Tn{constructor(t=50,e=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Ot*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Nt*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Ot*Math.atan(Math.tan(.5*Nt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Nt*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,o=a.fullHeight;r+=a.offsetX*n/t,e-=a.offsetY*i/o,n*=a.width/t,i*=a.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Fn=-90;class Bn extends Ai{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new Un(Fn,1,t,e);n.layers=this.layers,this.add(n);const r=new Un(Fn,1,t,e);r.layers=this.layers,this.add(r);const a=new Un(Fn,1,t,e);a.layers=this.layers,this.add(a);const o=new Un(Fn,1,t,e);o.layers=this.layers,this.add(o);const s=new Un(Fn,1,t,e);s.layers=this.layers,this.add(s);const l=new Un(Fn,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,n,r,a,o,s]=e;for(const t of e)this.remove(t);if(t===Rt)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.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),s.up.set(0,1,0),s.lookAt(0,0,-1);else{if(t!==Lt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.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),s.up.set(0,-1,0),s.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,s,l,c]=this.children,h=t.getRenderTarget(),d=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,n),t.render(e,r),t.setRenderTarget(i,1,n),t.render(e,a),t.setRenderTarget(i,2,n),t.render(e,o),t.setRenderTarget(i,3,n),t.render(e,s),t.setRenderTarget(i,4,n),t.render(e,l),i.texture.generateMipmaps=f,t.setRenderTarget(i,5,n),t.render(e,c),t.setRenderTarget(h,d,u),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class Rn extends pe{constructor(t,e,i,n,r,a,o,s,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:N,i,n,r,a,o,s,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Ln extends me{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];void 0!==e.encoding&&($t("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===ut?ft:pt),this.texture=new Rn(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:j}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={tEquirect:{value:null}},n="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new En(5,5,5),o=new In({name:"CubemapFromEquirect",uniforms:Cn(i),vertexShader:n,fragmentShader:r,side:1,blending:0});o.uniforms.tEquirect.value=e;const s=new An(a,o),l=e.minFilter;return e.minFilter===q&&(e.minFilter=j),new Bn(1,10,this).update(t,s),e.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}const Dn=new _e,Pn=new _e,Nn=new Xt;class On{constructor(t=new _e(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=Dn.subVectors(i,e).cross(Pn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(Dn),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Nn.getNormalMatrix(t),n=this.coplanarPoint(Dn).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const kn=new Qe,zn=new _e;class Qn{constructor(t=new On,e=new On,i=new On,n=new On,r=new On,a=new On){this.planes=[t,e,i,n,r,a]}set(t,e,i,n,r,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3){const i=this.planes,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],h=n[6],d=n[7],u=n[8],p=n[9],f=n[10],g=n[11],m=n[12],b=n[13],v=n[14],y=n[15];if(i[0].setComponents(s-r,d-l,g-u,y-m).normalize(),i[1].setComponents(s+r,d+l,g+u,y+m).normalize(),i[2].setComponents(s+a,d+c,g+p,y+b).normalize(),i[3].setComponents(s-a,d-c,g-p,y-b).normalize(),i[4].setComponents(s-o,d-h,g-f,y-v).normalize(),e===Rt)i[5].setComponents(s+o,d+h,g+f,y+v).normalize();else{if(e!==Lt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(o,h,f,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),kn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),kn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(kn)}intersectsSprite(t){return kn.center.set(0,0,0),kn.radius=.7071067811865476,kn.applyMatrix4(t.matrixWorld),this.intersectsSphere(kn)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)<n)return!1;return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(zn.x=n.normal.x>0?t.max.x:t.min.x,zn.y=n.normal.y>0?t.max.y:t.min.y,zn.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(zn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Vn(){let t=null,e=!1,i=null,n=null;function r(e,a){i(e,a),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Hn(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=n.get(e);if(void 0===a)n.set(e,function(e,n){const r=e.array,a=e.usage,o=r.byteLength,s=t.createBuffer();let l;if(t.bindBuffer(n,s),t.bufferData(n,r,a),e.onUploadCallback(),r instanceof Float32Array)l=t.FLOAT;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!i)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");l=t.HALF_FLOAT}else l=t.UNSIGNED_SHORT;else if(r instanceof Int16Array)l=t.SHORT;else if(r instanceof Uint32Array)l=t.UNSIGNED_INT;else if(r instanceof Int32Array)l=t.INT;else if(r instanceof Int8Array)l=t.BYTE;else if(r instanceof Uint8Array)l=t.UNSIGNED_BYTE;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);l=t.UNSIGNED_BYTE}return{buffer:s,type:l,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,size:o}}(e,r));else if(a.version<e.version){if(a.size!==e.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.");!function(e,n,r){const a=n.array,o=n._updateRange,s=n.updateRanges;if(t.bindBuffer(r,e),-1===o.count&&0===s.length&&t.bufferSubData(r,0,a),0!==s.length){for(let e=0,n=s.length;e<n;e++){const n=s[e];i?t.bufferSubData(r,n.start*a.BYTES_PER_ELEMENT,a,n.start,n.count):t.bufferSubData(r,n.start*a.BYTES_PER_ELEMENT,a.subarray(n.start,n.start+n.count))}n.clearUpdateRanges()}-1!==o.count&&(i?t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),n.onUploadCallback()}(a.buffer,e,r),a.version=e.version}}}}class Gn extends nn{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,a=e/2,o=Math.floor(i),s=Math.floor(n),l=o+1,c=s+1,h=t/o,d=e/s,u=[],p=[],f=[],g=[];for(let t=0;t<c;t++){const e=t*d-a;for(let i=0;i<l;i++){const n=i*h-r;p.push(n,-e,0),f.push(0,0,1),g.push(i/o),g.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<o;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;u.push(i,n,a),u.push(n,r,a)}this.setIndex(u),this.setAttribute("position",new qi(p,3)),this.setAttribute("normal",new qi(f,3)),this.setAttribute("uv",new qi(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Gn(t.width,t.height,t.widthSegments,t.heightSegments)}}const Wn={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},jn={common:{diffuse:{value:new Oi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new jt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Oi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Oi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new Oi(16777215)},opacity:{value:1},center:{value:new jt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},Xn={basic:{uniforms:Mn([jn.common,jn.specularmap,jn.envmap,jn.aomap,jn.lightmap,jn.fog]),vertexShader:Wn.meshbasic_vert,fragmentShader:Wn.meshbasic_frag},lambert:{uniforms:Mn([jn.common,jn.specularmap,jn.envmap,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)}}]),vertexShader:Wn.meshlambert_vert,fragmentShader:Wn.meshlambert_frag},phong:{uniforms:Mn([jn.common,jn.specularmap,jn.envmap,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)},specular:{value:new Oi(1118481)},shininess:{value:30}}]),vertexShader:Wn.meshphong_vert,fragmentShader:Wn.meshphong_frag},standard:{uniforms:Mn([jn.common,jn.envmap,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.roughnessmap,jn.metalnessmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wn.meshphysical_vert,fragmentShader:Wn.meshphysical_frag},toon:{uniforms:Mn([jn.common,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.gradientmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)}}]),vertexShader:Wn.meshtoon_vert,fragmentShader:Wn.meshtoon_frag},matcap:{uniforms:Mn([jn.common,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.fog,{matcap:{value:null}}]),vertexShader:Wn.meshmatcap_vert,fragmentShader:Wn.meshmatcap_frag},points:{uniforms:Mn([jn.points,jn.fog]),vertexShader:Wn.points_vert,fragmentShader:Wn.points_frag},dashed:{uniforms:Mn([jn.common,jn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wn.linedashed_vert,fragmentShader:Wn.linedashed_frag},depth:{uniforms:Mn([jn.common,jn.displacementmap]),vertexShader:Wn.depth_vert,fragmentShader:Wn.depth_frag},normal:{uniforms:Mn([jn.common,jn.bumpmap,jn.normalmap,jn.displacementmap,{opacity:{value:1}}]),vertexShader:Wn.meshnormal_vert,fragmentShader:Wn.meshnormal_frag},sprite:{uniforms:Mn([jn.sprite,jn.fog]),vertexShader:Wn.sprite_vert,fragmentShader:Wn.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Wn.background_vert,fragmentShader:Wn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Wn.backgroundCube_vert,fragmentShader:Wn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Wn.cube_vert,fragmentShader:Wn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wn.equirect_vert,fragmentShader:Wn.equirect_frag},distanceRGBA:{uniforms:Mn([jn.common,jn.displacementmap,{referencePosition:{value:new _e},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wn.distanceRGBA_vert,fragmentShader:Wn.distanceRGBA_frag},shadow:{uniforms:Mn([jn.lights,jn.fog,{color:{value:new Oi(0)},opacity:{value:1}}]),vertexShader:Wn.shadow_vert,fragmentShader:Wn.shadow_frag}};Xn.physical={uniforms:Mn([Xn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new jt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new Oi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new jt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new Oi(0)},specularColor:{value:new Oi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new jt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:Wn.meshphysical_vert,fragmentShader:Wn.meshphysical_frag};const qn={r:0,b:0,g:0};function Zn(t,e,i,n,r,a,o){const s=new Oi(0);let l,c,h=!0===a?0:1,d=null,u=0,p=null;function f(e,i){e.getRGB(qn,wn(t)),n.buffers.color.setClear(qn.r,qn.g,qn.b,i,o)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),h=e,f(s,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(s,h)},render:function(a,g){let m=!1,b=!0===g.isScene?g.background:null;b&&b.isTexture&&(b=(g.backgroundBlurriness>0?i:e).get(b)),null===b?f(s,h):b&&b.isColor&&(f(b,1),m=!0);const v=t.xr.getEnvironmentBlendMode();"additive"===v?n.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===v&&n.buffers.color.setClear(0,0,0,0,o),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),b&&(b.isCubeTexture||b.mapping===k)?(void 0===c&&(c=new An(new En(1,1,1),new In({name:"BackgroundCubeMaterial",uniforms:Cn(Xn.backgroundCube.uniforms),vertexShader:Xn.backgroundCube.vertexShader,fragmentShader:Xn.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=b,c.material.uniforms.flipEnvMap.value=b.isCubeTexture&&!1===b.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=re.getTransfer(b.colorSpace)!==yt,d===b&&u===b.version&&p===t.toneMapping||(c.material.needsUpdate=!0,d=b,u=b.version,p=t.toneMapping),c.layers.enableAll(),a.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(void 0===l&&(l=new An(new Gn(2,2),new In({name:"BackgroundMaterial",uniforms:Cn(Xn.background.uniforms),vertexShader:Xn.background.vertexShader,fragmentShader:Xn.background.fragmentShader,side:0,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=b,l.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,l.material.toneMapped=re.getTransfer(b.colorSpace)!==yt,!0===b.matrixAutoUpdate&&b.updateMatrix(),l.material.uniforms.uvTransform.value.copy(b.matrix),d===b&&u===b.version&&p===t.toneMapping||(l.material.needsUpdate=!0,d=b,u=b.version,p=t.toneMapping),l.layers.enableAll(),a.unshift(l,l.geometry,l.material,0,0,null))}}}function Yn(t,e,i,n){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),a=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||null!==a,s={},l=p(null);let c=l,h=!1;function d(e){return n.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function p(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function f(){const t=c.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function g(t){m(t,0)}function m(i,r){const a=c.newAttributes,o=c.enabledAttributes,s=c.attributeDivisors;a[i]=1,0===o[i]&&(t.enableVertexAttribArray(i),o[i]=1),s[i]!==r&&((n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),s[i]=r)}function b(){const e=c.newAttributes,i=c.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function v(e,i,n,r,a,o,s){!0===s?t.vertexAttribIPointer(e,i,n,a,o):t.vertexAttribPointer(e,i,n,r,a,o)}function y(){_(),h=!0,c!==l&&(c=l,d(c.object))}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,y,_){let A=!1;if(o){const e=function(e,i,r){const o=!0===r.wireframe;let l=s[e.id];void 0===l&&(l={},s[e.id]=l);let c=l[i.id];void 0===c&&(c={},l[i.id]=c);let h=c[o];return void 0===h&&(h=p(n.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),c[o]=h),h}(y,u,l);c!==e&&(c=e,d(c.object)),A=function(t,e,i,n){const r=c.attributes,a=e.attributes;let o=0;const s=i.getAttributes();for(const e in s)if(s[e].location>=0){const i=r[e];let n=a[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;o++}return c.attributesNum!==o||c.index!==n}(r,y,u,_),A&&function(t,e,i,n){const r={},a=e.attributes;let o=0;const s=i.getAttributes();for(const e in s)if(s[e].location>=0){let i=a[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[e]=n,o++}c.attributes=r,c.attributesNum=o,c.index=n}(r,y,u,_)}else{const t=!0===l.wireframe;c.geometry===y.id&&c.program===u.id&&c.wireframe===t||(c.geometry=y.id,c.program=u.id,c.wireframe=t,A=!0)}null!==_&&i.update(_,t.ELEMENT_ARRAY_BUFFER),(A||h)&&(h=!1,function(r,a,o,s){if(!1===n.isWebGL2&&(r.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;f();const l=s.attributes,c=o.getAttributes(),h=a.defaultAttributeValues;for(const e in c){const a=c[e];if(a.location>=0){let o=l[e];if(void 0===o&&("instanceMatrix"===e&&r.instanceMatrix&&(o=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(o=r.instanceColor)),void 0!==o){const e=o.normalized,l=o.itemSize,c=i.get(o);if(void 0===c)continue;const h=c.buffer,d=c.type,u=c.bytesPerElement,p=!0===n.isWebGL2&&(d===t.INT||d===t.UNSIGNED_INT||1013===o.gpuType);if(o.isInterleavedBufferAttribute){const i=o.data,n=i.stride,c=o.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t<a.locationSize;t++)m(a.location+t,i.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<a.locationSize;t++)g(a.location+t);t.bindBuffer(t.ARRAY_BUFFER,h);for(let t=0;t<a.locationSize;t++)v(a.location+t,l/a.locationSize,d,e,n*u,(c+l/a.locationSize*t)*u,p)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<a.locationSize;t++)m(a.location+t,o.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<a.locationSize;t++)g(a.location+t);t.bindBuffer(t.ARRAY_BUFFER,h);for(let t=0;t<a.locationSize;t++)v(a.location+t,l/a.locationSize,d,e,l*u,l/a.locationSize*t*u,p)}}else if(void 0!==h){const i=h[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(a.location,i);break;case 3:t.vertexAttrib3fv(a.location,i);break;case 4:t.vertexAttrib4fv(a.location,i);break;default:t.vertexAttrib1fv(a.location,i)}}}}b()}(r,l,u,y),null!==_&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i.get(_).buffer))},reset:y,resetDefaultState:_,dispose:function(){y();for(const t in s){const e=s[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const i=s[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:f,enableAttribute:g,disableUnusedAttributes:b}}function Jn(t,e,i,n){const r=n.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,n){t.drawArrays(a,e,n),i.update(n,a,1)},this.renderInstances=function(n,o,s){if(0===s)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](a,n,o,s),i.update(o,a,s)},this.renderMultiDraw=function(t,n,r){if(0===r)return;const o=e.get("WEBGL_multi_draw");if(null===o)for(let e=0;e<r;e++)this.render(t[e],n[e]);else{o.multiDrawArraysWEBGL(a,t,0,n,0,r);let e=0;for(let t=0;t<r;t++)e+=n[t];i.update(e,a,1)}}}function Kn(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name;let o=void 0!==i.precision?i.precision:"highp";const s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=a||e.has("WEBGL_draw_buffers"),c=!0===i.logarithmicDepthBuffer,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),g=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),b=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=d>0,y=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:b,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?t.getParameter(t.MAX_SAMPLES):0}}function $n(t){const e=this;let i=null,n=0,r=!1,a=!1;const o=new On,s=new Xt,l={value:null,needsUpdate:!1};function c(t,i,n,r){const a=null!==t?t.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const e=n+4*a,r=i.matrixWorldInverse;s.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,i=n;e!==a;++e,i+=4)o.copy(t[e]).applyMatrix4(r,s),o.normal.toArray(c,i),c[i+3]=o.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const i=0!==t.length||e||0!==n||r;return r=e,n=t.length,i},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(t,e){i=c(t,e,0)},this.setState=function(o,s,h){const d=o.clippingPlanes,u=o.clipIntersection,p=o.clipShadows,f=t.get(o);if(!r||null===d||0===d.length||a&&!p)a?c(null):(l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0);else{const t=a?0:n,e=4*t;let r=f.clippingState||null;l.value=r,r=c(d,s,e,h);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function tr(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=N:304===e&&(t.mapping=O),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r))return i(e.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const o=new Ln(a.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),r.addEventListener("dispose",n),i(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class er extends Tn{constructor(t=-1,e=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,o-=e*this.view.offsetY,s=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const ir=[.125,.215,.35,.446,.526,.582],nr=new er,rr=new Oi;let ar=null,or=0,sr=0;const lr=(1+Math.sqrt(5))/2,cr=1/lr,hr=[new _e(1,1,1),new _e(-1,1,1),new _e(1,1,-1),new _e(-1,1,-1),new _e(0,lr,cr),new _e(0,lr,-cr),new _e(cr,0,lr),new _e(-cr,0,lr),new _e(lr,cr,0),new _e(-lr,cr,0)];class dr{constructor(t){this._renderer=t,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(t,e=0,i=.1,n=100){ar=this._renderer.getRenderTarget(),or=this._renderer.getActiveCubeFace(),sr=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=gr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=fr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(ar,or,sr),t.scissorTest=!1,pr(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===N||t.mapping===O?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ar=this._renderer.getRenderTarget(),or=this._renderer.getActiveCubeFace(),sr=this._renderer.getActiveMipmapLevel();const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:j,minFilter:j,generateMipmaps:!1,type:$,format:et,colorSpace:gt,depthBuffer:!1},n=ur(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=ur(t,e,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let r=t;const a=t-4+1+ir.length;for(let o=0;o<a;o++){const a=Math.pow(2,r);i.push(a);let s=1/a;o>t-4?s=ir[o-t+4-1]:0===o&&(s=0),n.push(s);const l=1/(a-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,f=3,g=2,m=1,b=new Float32Array(f*p*u),v=new Float32Array(g*p*u),y=new Float32Array(m*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];b.set(n,f*p*t),v.set(d,g*p*t);const r=[t,t,t,t,t,t];y.set(r,m*p*t)}const _=new nn;_.setAttribute("position",new Wi(b,f)),_.setAttribute("uv",new Wi(v,g)),_.setAttribute("faceIndex",new Wi(y,m)),e.push(_),r>4&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(20),r=new _e(0,1,0);return new In({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(n,t,e)}return n}_compileMaterial(t){const e=new An(this._lodPlanes[0],t);this._renderer.compile(e,nr)}_sceneToCubeUV(t,e,i,n){const r=new Un(90,1,e,i),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.toneMapping;s.getClearColor(rr),s.toneMapping=F,s.autoClear=!1;const h=new Vi({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new An(new En,h);let u=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,u=!0):(h.color.copy(rr),u=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(r.up.set(0,a[e],0),r.lookAt(o[e],0,0)):1===i?(r.up.set(0,0,a[e]),r.lookAt(0,o[e],0)):(r.up.set(0,a[e],0),r.lookAt(0,0,o[e]));const l=this._cubeSize;pr(n,i*l,e>2?l:0,l,l),s.setRenderTarget(n),u&&s.render(d,r),s.render(t,r)}d.geometry.dispose(),d.material.dispose(),s.toneMapping=c,s.autoClear=l,t.background=p}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===N||t.mapping===O;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=gr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=fr());const r=n?this._cubemapMaterial:this._equirectMaterial,a=new An(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const o=this._cubeSize;pr(e,0,0,3*o,2*o),i.setRenderTarget(e),i.render(a,nr)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),n=hr[(e-1)%hr.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,i,n,"latitudinal",r),this._halfBlur(a,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new An(this._lodPlanes[n],l),h=l.uniforms,d=this._sizeLods[i]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const g=[];let m=0;for(let t=0;t<20;++t){const e=t/p,i=Math.exp(-e*e/2);g.push(i),0===t?m+=i:t<f&&(m+=2*i)}for(let t=0;t<g.length;t++)g[t]=g[t]/m;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=g,h.latitudinal.value="latitudinal"===a,o&&(h.poleAxis.value=o);const{_lodMax:b}=this;h.dTheta.value=u,h.mipInt.value=b-i;const v=this._sizeLods[n];pr(e,3*v*(n>b-4?n-b+4:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(e),s.render(c,nr)}}function ur(t,e,i){const n=new me(t,e,i);return n.texture.mapping=k,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function pr(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function fr(){return new In({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function gr(){return new In({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function mr(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,o=303===a||304===a,s=a===N||a===O;if(o||s){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=e.get(r);return null===i&&(i=new dr(t)),n=o?i.fromEquirectangular(r,n):i.fromCubemap(r,n),e.set(r,n),n.texture}if(e.has(r))return e.get(r).texture;{const a=r.image;if(o&&a&&a.height>0||s&&a&&function(t){let e=0;for(let i=0;i<6;i++)void 0!==t[i]&&e++;return 6===e}(a)){null===i&&(i=new dr(t));const a=o?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,a),r.addEventListener("dispose",n),a.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function br(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=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":n=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":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function vr(t,e,i,n){const r={},a=new WeakMap;function o(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);for(const t in s.morphAttributes){const i=s.morphAttributes[t];for(let t=0,n=i.length;t<n;t++)e.remove(i[t])}s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(e.remove(l),a.delete(s)),n.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,i.memory.geometries--}function s(t){const i=[],n=t.index,r=t.attributes.position;let o=0;if(null!==n){const t=n.array;o=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],a=t[e+2];i.push(n,r,r,a,a,n)}}else{if(void 0===r)return;{const t=r.array;o=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}}const s=new(Zt(i)?Xi:ji)(i,1);s.version=o;const l=a.get(t);l&&e.remove(l),a.set(t,s)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,i.memory.geometries++),e},update:function(i){const n=i.attributes;for(const i in n)e.update(n[i],t.ARRAY_BUFFER);const r=i.morphAttributes;for(const i in r){const n=r[i];for(let i=0,r=n.length;i<r;i++)e.update(n[i],t.ARRAY_BUFFER)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&s(t)}else s(t);return a.get(t)}}}function yr(t,e,i,n){const r=n.isWebGL2;let a,o,s;this.setMode=function(t){a=t},this.setIndex=function(t){o=t.type,s=t.bytesPerElement},this.render=function(e,n){t.drawElements(a,n,o,e*s),i.update(n,a,1)},this.renderInstances=function(n,l,c){if(0===c)return;let h,d;if(r)h=t,d="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](a,l,o,n*s,c),i.update(l,a,c)},this.renderMultiDraw=function(t,n,r){if(0===r)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<r;e++)this.render(t[e]/s,n[e]);else{l.multiDrawElementsWEBGL(a,n,0,o,t,0,r);let e=0;for(let t=0;t<r;t++)e+=n[t];i.update(e,a,1)}}}function _r(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(i,n,r){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=r*(i/3);break;case t.LINES:e.lines+=r*(i/2);break;case t.LINE_STRIP:e.lines+=r*(i-1);break;case t.LINE_LOOP:e.lines+=r*i;break;case t.POINTS:e.points+=r*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Ar(t,e){return t[0]-e[0]}function xr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Er(t,e,i){const n={},r=new Float32Array(8),a=new WeakMap,o=new fe,s=[];for(let t=0;t<8;t++)s[t]=[t,0];return{update:function(l,c,h){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const u=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,p=void 0!==u?u.length:0;let f=a.get(c);if(void 0===f||f.count!==p){void 0!==f&&f.texture.dispose();const b=void 0!==c.morphAttributes.position,v=void 0!==c.morphAttributes.normal,y=void 0!==c.morphAttributes.color,_=c.morphAttributes.position||[],A=c.morphAttributes.normal||[],x=c.morphAttributes.color||[];let E=0;!0===b&&(E=1),!0===v&&(E=2),!0===y&&(E=3);let C=c.attributes.position.count*E,M=1;C>e.maxTextureSize&&(M=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const w=new Float32Array(C*M*4*p),S=new be(w,C,M,p);S.type=K,S.needsUpdate=!0;const I=4*E;for(let U=0;U<p;U++){const F=_[U],B=A[U],R=x[U],L=C*M*4*U;for(let D=0;D<F.count;D++){const P=D*I;!0===b&&(o.fromBufferAttribute(F,D),w[L+P+0]=o.x,w[L+P+1]=o.y,w[L+P+2]=o.z,w[L+P+3]=0),!0===v&&(o.fromBufferAttribute(B,D),w[L+P+4]=o.x,w[L+P+5]=o.y,w[L+P+6]=o.z,w[L+P+7]=0),!0===y&&(o.fromBufferAttribute(R,D),w[L+P+8]=o.x,w[L+P+9]=o.y,w[L+P+10]=o.z,w[L+P+11]=4===R.itemSize?o.w:1)}}function T(){S.dispose(),a.delete(c),c.removeEventListener("dispose",T)}f={count:p,texture:S,size:new jt(C,M)},a.set(c,f),c.addEventListener("dispose",T)}let g=0;for(let N=0;N<d.length;N++)g+=d[N];const m=c.morphTargetsRelative?1:1-g;h.getUniforms().setValue(t,"morphTargetBaseInfluence",m),h.getUniforms().setValue(t,"morphTargetInfluences",d),h.getUniforms().setValue(t,"morphTargetsTexture",f.texture,i),h.getUniforms().setValue(t,"morphTargetsTextureSize",f.size)}else{const O=void 0===d?0:d.length;let k=n[c.id];if(void 0===k||k.length!==O){k=[];for(let G=0;G<O;G++)k[G]=[G,0];n[c.id]=k}for(let W=0;W<O;W++){const j=k[W];j[0]=W,j[1]=d[W]}k.sort(xr);for(let X=0;X<8;X++)X<O&&k[X][1]?(s[X][0]=k[X][0],s[X][1]=k[X][1]):(s[X][0]=Number.MAX_SAFE_INTEGER,s[X][1]=0);s.sort(Ar);const z=c.morphAttributes.position,Q=c.morphAttributes.normal;let V=0;for(let q=0;q<8;q++){const Z=s[q],Y=Z[0],J=Z[1];Y!==Number.MAX_SAFE_INTEGER&&J?(z&&c.getAttribute("morphTarget"+q)!==z[Y]&&c.setAttribute("morphTarget"+q,z[Y]),Q&&c.getAttribute("morphNormal"+q)!==Q[Y]&&c.setAttribute("morphNormal"+q,Q[Y]),r[q]=J,V+=J):(z&&!0===c.hasAttribute("morphTarget"+q)&&c.deleteAttribute("morphTarget"+q),Q&&!0===c.hasAttribute("morphNormal"+q)&&c.deleteAttribute("morphNormal"+q),r[q]=0)}const H=c.morphTargetsRelative?1:1-V;h.getUniforms().setValue(t,"morphTargetBaseInfluence",H),h.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function Cr(t,e,i,n){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(o){const s=n.render.frame,l=o.geometry,c=e.get(o,l);if(r.get(c)!==s&&(e.update(c),r.set(c,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),r.get(o)!==s&&(i.update(o.instanceMatrix,t.ARRAY_BUFFER),null!==o.instanceColor&&i.update(o.instanceColor,t.ARRAY_BUFFER),r.set(o,s))),o.isSkinnedMesh){const t=o.skeleton;r.get(t)!==s&&(t.update(),r.set(t,s))}return c},dispose:function(){r=new WeakMap}}}class Mr extends pe{constructor(t,e,i,n,r,a,o,s,l,c){if((c=void 0!==c?c:it)!==it&&c!==nt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&c===it&&(i=J),void 0===i&&c===nt&&(i=tt),super(null,n,r,a,o,s,c,i,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==o?o:H,this.minFilter=void 0!==s?s:H,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}const wr=new pe,Sr=new Mr(1,1);Sr.compareFunction=515;const Ir=new be,Tr=new ve,Ur=new Rn,Fr=[],Br=[],Rr=new Float32Array(16),Lr=new Float32Array(9),Dr=new Float32Array(4);function Pr(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let a=Fr[r];if(void 0===a&&(a=new Float32Array(r),Fr[r]=a),0!==e){n.toArray(a,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(a,r)}return a}function Nr(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Or(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function kr(t,e){let i=Br[e];void 0===i&&(i=new Int32Array(e),Br[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function zr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Qr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Nr(i,e))return;t.uniform2fv(this.addr,e),Or(i,e)}}function Vr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Nr(i,e))return;t.uniform3fv(this.addr,e),Or(i,e)}}function Hr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Nr(i,e))return;t.uniform4fv(this.addr,e),Or(i,e)}}function Gr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Nr(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Or(i,e)}else{if(Nr(i,n))return;Dr.set(n),t.uniformMatrix2fv(this.addr,!1,Dr),Or(i,n)}}function Wr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Nr(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Or(i,e)}else{if(Nr(i,n))return;Lr.set(n),t.uniformMatrix3fv(this.addr,!1,Lr),Or(i,n)}}function jr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Nr(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Or(i,e)}else{if(Nr(i,n))return;Rr.set(n),t.uniformMatrix4fv(this.addr,!1,Rr),Or(i,n)}}function Xr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function qr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Nr(i,e))return;t.uniform2iv(this.addr,e),Or(i,e)}}function Zr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Nr(i,e))return;t.uniform3iv(this.addr,e),Or(i,e)}}function Yr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Nr(i,e))return;t.uniform4iv(this.addr,e),Or(i,e)}}function Jr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Kr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Nr(i,e))return;t.uniform2uiv(this.addr,e),Or(i,e)}}function $r(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Nr(i,e))return;t.uniform3uiv(this.addr,e),Or(i,e)}}function ta(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Nr(i,e))return;t.uniform4uiv(this.addr,e),Or(i,e)}}function ea(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r);const a=this.type===t.SAMPLER_2D_SHADOW?Sr:wr;i.setTexture2D(e||a,r)}function ia(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||Tr,r)}function na(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||Ur,r)}function ra(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||Ir,r)}function aa(t,e){t.uniform1fv(this.addr,e)}function oa(t,e){const i=Pr(e,this.size,2);t.uniform2fv(this.addr,i)}function sa(t,e){const i=Pr(e,this.size,3);t.uniform3fv(this.addr,i)}function la(t,e){const i=Pr(e,this.size,4);t.uniform4fv(this.addr,i)}function ca(t,e){const i=Pr(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function ha(t,e){const i=Pr(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function da(t,e){const i=Pr(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function ua(t,e){t.uniform1iv(this.addr,e)}function pa(t,e){t.uniform2iv(this.addr,e)}function fa(t,e){t.uniform3iv(this.addr,e)}function ga(t,e){t.uniform4iv(this.addr,e)}function ma(t,e){t.uniform1uiv(this.addr,e)}function ba(t,e){t.uniform2uiv(this.addr,e)}function va(t,e){t.uniform3uiv(this.addr,e)}function ya(t,e){t.uniform4uiv(this.addr,e)}function _a(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTexture2D(e[t]||wr,a[t])}function Aa(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTexture3D(e[t]||Tr,a[t])}function xa(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTextureCube(e[t]||Ur,a[t])}function Ea(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTexture2DArray(e[t]||Ir,a[t])}class Ca{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return zr;case 35664:return Qr;case 35665:return Vr;case 35666:return Hr;case 35674:return Gr;case 35675:return Wr;case 35676:return jr;case 5124:case 35670:return Xr;case 35667:case 35671:return qr;case 35668:case 35672:return Zr;case 35669:case 35673:return Yr;case 5125:return Jr;case 36294:return Kr;case 36295:return $r;case 36296:return ta;case 35678:case 36198:case 36298:case 36306:case 35682:return ea;case 35679:case 36299:case 36307:return ia;case 35680:case 36300:case 36308:case 36293:return na;case 36289:case 36303:case 36311:case 36292:return ra}}(e.type)}}class Ma{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return aa;case 35664:return oa;case 35665:return sa;case 35666:return la;case 35674:return ca;case 35675:return ha;case 35676:return da;case 5124:case 35670:return ua;case 35667:case 35671:return pa;case 35668:case 35672:return fa;case 35669:case 35673:return ga;case 5125:return ma;case 36294:return ba;case 36295:return va;case 36296:return ya;case 35678:case 36198:case 36298:case 36306:case 35682:return _a;case 35679:case 36299:case 36307:return Aa;case 35680:case 36300:case 36308:case 36293:return xa;case 36289:case 36303:case 36311:case 36292:return Ea}}(e.type)}}class wa{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const n=this.seq;for(let r=0,a=n.length;r!==a;++r){const a=n[r];a.setValue(t,e[a.id],i)}}}const Sa=/(\w+)(\])?(\[|\.)?/g;function Ia(t,e){t.seq.push(e),t.map[e.id]=e}function Ta(t,e,i){const n=t.name,r=n.length;for(Sa.lastIndex=0;;){const a=Sa.exec(n),o=Sa.lastIndex;let s=a[1];const l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){Ia(i,void 0===c?new Ca(s,t,e):new Ma(s,t,e));break}{let t=i.map[s];void 0===t&&(t=new wa(s),Ia(i,t)),i=t}}}class Ua{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Ta(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let r=0,a=e.length;r!==a;++r){const a=e[r],o=i[a.id];!1!==o.needsUpdate&&a.setValue(t,o.value,n)}}static seqWithValue(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i}}function Fa(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}const Ba=37297;let Ra=0;function La(t,e,i){const n=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const n=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const i=t.split("\n"),n=[],r=Math.max(e-6,0),a=Math.min(e+6,i.length);for(let t=r;t<a;t++){const r=t+1;n.push(`${r===e?">":" "} ${r}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return r}function Da(t,e){const i=function(t){const e=re.getPrimaries(re.workingColorSpace),i=re.getPrimaries(t);let n;switch(e===i?n="":e===At&&i===_t?n="LinearDisplayP3ToLinearSRGB":e===_t&&i===At&&(n="LinearSRGBToLinearDisplayP3"),t){case gt:case bt:return[n,"LinearTransferOETF"];case ft:case mt:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[n,"LinearTransferOETF"]}}(e);return`vec4 ${t}( vec4 value ) { return ${i[0]}( ${i[1]}( value ) ); }`}function Pa(t,e){let i;switch(e){case B:i="Linear";break;case R:i="Reinhard";break;case L:i="OptimizedCineon";break;case D:i="ACESFilmic";break;case P:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Na(t){return""!==t}function Oa(t,e){const i=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,i).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 ka(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const za=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qa(t){return t.replace(za,Ha)}const Va=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Ha(t,e){let i=Wn[e];if(void 0===i){const t=Va.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");i=Wn[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Qa(i)}const Ga=/#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 Wa(t){return t.replace(Ga,ja)}function ja(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Xa(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function qa(t,e,i,n){const s=t.getContext(),l=i.defines;let c=i.vertexShader,h=i.fragmentShader;const d=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===r?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===a?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===o&&(e="SHADOWMAP_TYPE_VSM"),e}(i),u=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case N:case O:e="ENVMAP_TYPE_CUBE";break;case k:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),p=function(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===O&&(e="ENVMAP_MODE_REFRACTION"),e}(i),f=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case I:e="ENVMAP_BLENDING_MULTIPLY";break;case T:e="ENVMAP_BLENDING_MIX";break;case U:e="ENVMAP_BLENDING_ADD"}return e}(i),g=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),m=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Na).join("\n")}(i),b=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(l),v=s.createProgram();let y,_,A=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(y=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b].filter(Na).join("\n"),y.length>0&&(y+="\n"),_=[m,"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b].filter(Na).join("\n"),_.length>0&&(_+="\n")):(y=[Xa(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b,i.batching?"#define USE_BATCHING":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Na).join("\n"),_=[m,Xa(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.envMap?"#define "+p:"",i.envMap?"#define "+f:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==F?"#define TONE_MAPPING":"",i.toneMapping!==F?Wn.tonemapping_pars_fragment:"",i.toneMapping!==F?Pa("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Wn.colorspace_pars_fragment,Da("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Na).join("\n")),c=Qa(c),c=Oa(c,i),c=ka(c,i),h=Qa(h),h=Oa(h,i),h=ka(h,i),c=Wa(c),h=Wa(h),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(A="#version 300 es\n",y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,_=["precision mediump sampler2DArray;","#define varying in",i.glslVersion===Ft?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===Ft?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+_);const x=A+y+c,E=A+_+h,C=Fa(s,s.VERTEX_SHADER,x),M=Fa(s,s.FRAGMENT_SHADER,E);function w(e){if(t.debug.checkShaderErrors){const i=s.getProgramInfoLog(v).trim(),n=s.getShaderInfoLog(C).trim(),r=s.getShaderInfoLog(M).trim();let a=!0,o=!0;if(!1===s.getProgramParameter(v,s.LINK_STATUS))if(a=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(s,v,C,M);else{const t=La(s,C,"vertex"),e=La(s,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(v,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+i+"\n"+t+"\n"+e)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):""!==n&&""!==r||(o=!1);o&&(e.diagnostics={runnable:a,programLog:i,vertexShader:{log:n,prefix:y},fragmentShader:{log:r,prefix:_}})}s.deleteShader(C),s.deleteShader(M),S=new Ua(s,v),B=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r),a=n.name;let o=1;n.type===t.FLOAT_MAT2&&(o=2),n.type===t.FLOAT_MAT3&&(o=3),n.type===t.FLOAT_MAT4&&(o=4),i[a]={type:n.type,location:t.getAttribLocation(e,a),locationSize:o}}return i}(s,v)}let S,B;s.attachShader(v,C),s.attachShader(v,M),void 0!==i.index0AttributeName?s.bindAttribLocation(v,0,i.index0AttributeName):!0===i.morphTargets&&s.bindAttribLocation(v,0,"position"),s.linkProgram(v),this.getUniforms=function(){return void 0===S&&w(this),S},this.getAttributes=function(){return void 0===B&&w(this),B};let R=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===R&&(R=s.getProgramParameter(v,Ba)),R},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(v),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=Ra++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=C,this.fragmentShader=M,this}let Za=0;class Ya{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(t);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new Ja(t),e.set(t,i)),i}}class Ja{constructor(t){this.id=Za++,this.code=t,this.usedTimes=0}}function Ka(t,e,i,n,r,a,o){const s=new si,l=new Ya,c=[],h=r.isWebGL2,d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const f={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 g(t){return 0===t?"uv":`uv${t}`}return{getParameters:function(a,s,c,m,b){const v=m.fog,y=b.geometry,_=a.isMeshStandardMaterial?m.environment:null,A=(a.isMeshStandardMaterial?i:e).get(a.envMap||_),x=A&&A.mapping===k?A.image.height:null,E=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead."));const C=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,M=void 0!==C?C.length:0;let w,S,I,T,U=0;if(void 0!==y.morphAttributes.position&&(U=1),void 0!==y.morphAttributes.normal&&(U=2),void 0!==y.morphAttributes.color&&(U=3),E){const t=Xn[E];w=t.vertexShader,S=t.fragmentShader}else w=a.vertexShader,S=a.fragmentShader,l.update(a),I=l.getVertexShaderID(a),T=l.getFragmentShaderID(a);const B=t.getRenderTarget(),R=!0===b.isInstancedMesh,L=!0===b.isBatchedMesh,D=!!a.map,P=!!a.matcap,N=!!A,O=!!a.aoMap,z=!!a.lightMap,Q=!!a.bumpMap,V=!!a.normalMap,H=!!a.displacementMap,G=!!a.emissiveMap,W=!!a.metalnessMap,j=!!a.roughnessMap,X=a.anisotropy>0,q=a.clearcoat>0,Z=a.iridescence>0,Y=a.sheen>0,J=a.transmission>0,K=X&&!!a.anisotropyMap,$=q&&!!a.clearcoatMap,tt=q&&!!a.clearcoatNormalMap,et=q&&!!a.clearcoatRoughnessMap,it=Z&&!!a.iridescenceMap,nt=Z&&!!a.iridescenceThicknessMap,rt=Y&&!!a.sheenColorMap,at=Y&&!!a.sheenRoughnessMap,ot=!!a.specularMap,st=!!a.specularColorMap,lt=!!a.specularIntensityMap,ct=J&&!!a.transmissionMap,ht=J&&!!a.thicknessMap,dt=!!a.gradientMap,ut=!!a.alphaMap,pt=a.alphaTest>0,ft=!!a.alphaHash,mt=!!a.extensions,bt=!!y.attributes.uv1,vt=!!y.attributes.uv2,_t=!!y.attributes.uv3;let At=F;return a.toneMapped&&(null!==B&&!0!==B.isXRRenderTarget||(At=t.toneMapping)),{isWebGL2:h,shaderID:E,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:S,defines:a.defines,customVertexShaderID:I,customFragmentShaderID:T,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:L,instancing:R,instancingColor:R&&null!==b.instanceColor,supportsVertexTextures:u,outputColorSpace:null===B?t.outputColorSpace:!0===B.isXRRenderTarget?B.texture.colorSpace:gt,map:D,matcap:P,envMap:N,envMapMode:N&&A.mapping,envMapCubeUVHeight:x,aoMap:O,lightMap:z,bumpMap:Q,normalMap:V,displacementMap:u&&H,emissiveMap:G,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:W,roughnessMap:j,anisotropy:X,anisotropyMap:K,clearcoat:q,clearcoatMap:$,clearcoatNormalMap:tt,clearcoatRoughnessMap:et,iridescence:Z,iridescenceMap:it,iridescenceThicknessMap:nt,sheen:Y,sheenColorMap:rt,sheenRoughnessMap:at,specularMap:ot,specularColorMap:st,specularIntensityMap:lt,transmission:J,transmissionMap:ct,thicknessMap:ht,gradientMap:dt,opaque:!1===a.transparent&&1===a.blending,alphaMap:ut,alphaTest:pt,alphaHash:ft,combine:a.combine,mapUv:D&&g(a.map.channel),aoMapUv:O&&g(a.aoMap.channel),lightMapUv:z&&g(a.lightMap.channel),bumpMapUv:Q&&g(a.bumpMap.channel),normalMapUv:V&&g(a.normalMap.channel),displacementMapUv:H&&g(a.displacementMap.channel),emissiveMapUv:G&&g(a.emissiveMap.channel),metalnessMapUv:W&&g(a.metalnessMap.channel),roughnessMapUv:j&&g(a.roughnessMap.channel),anisotropyMapUv:K&&g(a.anisotropyMap.channel),clearcoatMapUv:$&&g(a.clearcoatMap.channel),clearcoatNormalMapUv:tt&&g(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&g(a.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&g(a.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&g(a.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&g(a.sheenColorMap.channel),sheenRoughnessMapUv:at&&g(a.sheenRoughnessMap.channel),specularMapUv:ot&&g(a.specularMap.channel),specularColorMapUv:st&&g(a.specularColorMap.channel),specularIntensityMapUv:lt&&g(a.specularIntensityMap.channel),transmissionMapUv:ct&&g(a.transmissionMap.channel),thicknessMapUv:ht&&g(a.thicknessMap.channel),alphaMapUv:ut&&g(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(V||X),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUv1s:bt,vertexUv2s:vt,vertexUv3s:_t,pointsUvs:!0===b.isPoints&&!!y.attributes.uv&&(D||ut),fog:!!v,useFog:!0===a.fog,fogExp2:v&&v.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===b.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:M,morphTextureStride:U,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:At,useLegacyLights:t._useLegacyLights,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&re.getTransfer(a.map.colorSpace)===yt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:mt&&!0===a.extensions.derivatives,extensionFragDepth:mt&&!0===a.extensions.fragDepth,extensionDrawBuffers:mt&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:mt&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){s.disableAll(),e.isWebGL2&&s.enable(0),e.supportsVertexTextures&&s.enable(1),e.instancing&&s.enable(2),e.instancingColor&&s.enable(3),e.matcap&&s.enable(4),e.envMap&&s.enable(5),e.normalMapObjectSpace&&s.enable(6),e.normalMapTangentSpace&&s.enable(7),e.clearcoat&&s.enable(8),e.iridescence&&s.enable(9),e.alphaTest&&s.enable(10),e.vertexColors&&s.enable(11),e.vertexAlphas&&s.enable(12),e.vertexUv1s&&s.enable(13),e.vertexUv2s&&s.enable(14),e.vertexUv3s&&s.enable(15),e.vertexTangents&&s.enable(16),e.anisotropy&&s.enable(17),e.alphaHash&&s.enable(18),e.batching&&s.enable(19),t.push(s.mask),s.disableAll(),e.fog&&s.enable(0),e.useFog&&s.enable(1),e.flatShading&&s.enable(2),e.logarithmicDepthBuffer&&s.enable(3),e.skinning&&s.enable(4),e.morphTargets&&s.enable(5),e.morphNormals&&s.enable(6),e.morphColors&&s.enable(7),e.premultipliedAlpha&&s.enable(8),e.shadowMapEnabled&&s.enable(9),e.useLegacyLights&&s.enable(10),e.doubleSided&&s.enable(11),e.flipSided&&s.enable(12),e.useDepthPacking&&s.enable(13),e.dithering&&s.enable(14),e.transmission&&s.enable(15),e.sheen&&s.enable(16),e.opaque&&s.enable(17),e.pointsUvs&&s.enable(18),e.decodeVideoTexture&&s.enable(19),t.push(s.mask)}(i,e),i.push(t.outputColorSpace)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=f[t.type];let i;if(e){const t=Xn[e];i=Sn.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new qa(t,i,e,a),c.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=c.indexOf(t);c[e]=c[c.length-1],c.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:c,dispose:function(){l.dispose()}}}function $a(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function to(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 eo(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 io(){const t=[];let e=0;const i=[],n=[],r=[];function a(i,n,r,a,o,s){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:a,renderOrder:i.renderOrder,z:o,group:s},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=o,l.group=s),e++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){e=0,i.length=0,n.length=0,r.length=0},push:function(t,e,o,s,l,c){const h=a(t,e,o,s,l,c);o.transmission>0?n.push(h):!0===o.transparent?r.push(h):i.push(h)},unshift:function(t,e,o,s,l,c){const h=a(t,e,o,s,l,c);o.transmission>0?n.unshift(h):!0===o.transparent?r.unshift(h):i.unshift(h)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||to),n.length>1&&n.sort(e||eo),r.length>1&&r.sort(e||eo)}}}function no(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let r;return void 0===n?(r=new io,t.set(e,[r])):i>=n.length?(r=new io,n.push(r)):r=n[i],r},dispose:function(){t=new WeakMap}}}function ro(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new _e,color:new Oi};break;case"SpotLight":i={position:new _e,direction:new _e,color:new Oi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new _e,color:new Oi,distance:0,decay:0};break;case"HemisphereLight":i={direction:new _e,skyColor:new Oi,groundColor:new Oi};break;case"RectAreaLight":i={color:new Oi,position:new _e,halfWidth:new _e,halfHeight:new _e}}return t[e.id]=i,i}}}let ao=0;function oo(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function so(t,e){const i=new ro,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)r.probe.push(new _e);const a=new _e,o=new Ye,s=new Ye;return{setup:function(a,o){let s=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,d=0,u=0,p=0,f=0,g=0,m=0,b=0,v=0,y=0,_=0;a.sort(oo);const A=!0===o?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],o=e.color,x=e.intensity,E=e.distance,C=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=o.r*x*A,l+=o.g*x*A,c+=o.b*x*A;else if(e.isLightProbe){for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],x);_++}else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*A),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[h]=i,r.directionalShadowMap[h]=C,r.directionalShadowMatrix[h]=e.shadow.matrix,g++}r.directional[h]=t,h++}else if(e.isSpotLight){const t=i.get(e);t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(o).multiplyScalar(x*A),t.distance=E,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,r.spot[u]=t;const a=e.shadow;if(e.map&&(r.spotLightMap[v]=e.map,v++,a.updateMatrices(e),e.castShadow&&y++),r.spotLightMatrix[u]=a.matrix,e.castShadow){const t=n.get(e);t.shadowBias=a.bias,t.shadowNormalBias=a.normalBias,t.shadowRadius=a.radius,t.shadowMapSize=a.mapSize,r.spotShadow[u]=t,r.spotShadowMap[u]=C,b++}u++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(o).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*A),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[d]=i,r.pointShadowMap[d]=C,r.pointShadowMatrix[d]=e.shadow.matrix,m++}r.point[d]=t,d++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(x*A),t.groundColor.copy(e.groundColor).multiplyScalar(x*A),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=jn.LTC_FLOAT_1,r.rectAreaLTC2=jn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=jn.LTC_HALF_1,r.rectAreaLTC2=jn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=l,r.ambient[2]=c;const x=r.hash;x.directionalLength===h&&x.pointLength===d&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===f&&x.numDirectionalShadows===g&&x.numPointShadows===m&&x.numSpotShadows===b&&x.numSpotMaps===v&&x.numLightProbes===_||(r.directional.length=h,r.spot.length=u,r.rectArea.length=p,r.point.length=d,r.hemi.length=f,r.directionalShadow.length=g,r.directionalShadowMap.length=g,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=g,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=b+v-y,r.spotLightMap.length=v,r.numSpotLightShadowsWithMaps=y,r.numLightProbes=_,x.directionalLength=h,x.pointLength=d,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=f,x.numDirectionalShadows=g,x.numPointShadows=m,x.numSpotShadows=b,x.numSpotMaps=v,x.numLightProbes=_,r.version=ao++)},setupView:function(t,e){let i=0,n=0,l=0,c=0,h=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(u.matrixWorld),a.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(d),i++}else if(u.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(u.matrixWorld),a.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const t=r.rectArea[c];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),s.identity(),o.copy(u.matrixWorld),o.premultiply(d),s.extractRotation(o),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),c++}else if(u.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),n++}else if(u.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(d),h++}}},state:r}}function lo(t,e){const i=new so(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(t){i.setup(n,t)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function co(t,e){let i=new WeakMap;return{get:function(n,r=0){const a=i.get(n);let o;return void 0===a?(o=new lo(t,e),i.set(n,[o])):r>=a.length?(o=new lo(t,e),a.push(o)):o=a[r],o},dispose:function(){i=new WeakMap}}}class ho extends Qi{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class uo extends Qi{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function po(t,e,i){let n=new Qn;const a=new jt,h=new jt,d=new fe,u=new ho({depthPacking:3201}),p=new uo,f={},g=i.maxTextureSize,m={[s]:1,[l]:0,[c]:2},b=new In({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new jt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=b.clone();v.defines.HORIZONTAL_PASS=1;const y=new nn;y.setAttribute("position",new Wi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new An(y,b),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=r;let x=this.type;function E(i,n){const r=e.update(_);b.defines.VSM_SAMPLES!==i.blurSamples&&(b.defines.VSM_SAMPLES=i.blurSamples,v.defines.VSM_SAMPLES=i.blurSamples,b.needsUpdate=!0,v.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new me(a.x,a.y)),b.uniforms.shadow_pass.value=i.map.texture,b.uniforms.resolution.value=i.mapSize,b.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,b,_,null),v.uniforms.shadow_pass.value=i.mapPass.texture,v.uniforms.resolution.value=i.mapSize,v.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,v,_,null)}function C(e,i,n,r){let a=null;const s=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===n.isPointLight?p:u,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){const t=a.uuid,e=i.uuid;let n=f[t];void 0===n&&(n={},f[t]=n);let r=n[e];void 0===r&&(r=a.clone(),n[e]=r),a=r}return a.visible=i.visible,a.wireframe=i.wireframe,a.side=r===o?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:m[i.side],a.alphaMap=i.alphaMap,a.alphaTest=i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial&&(t.properties.get(a).light=n),a}function M(i,r,a,s,l){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);const n=e.update(i),o=i.material;if(Array.isArray(o)){const e=n.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],d=o[h.materialIndex];if(d&&d.visible){const e=C(i,d,s,l);i.onBeforeShadow(t,i,r,a,n,e,h),t.renderBufferDirect(a,null,n,e,i,h),i.onAfterShadow(t,i,r,a,n,e,h)}}}else if(o.visible){const e=C(i,o,s,l);i.onBeforeShadow(t,i,r,a,n,e,null),t.renderBufferDirect(a,null,n,e,i,null),i.onAfterShadow(t,i,r,a,n,e,null)}}const c=i.children;for(let t=0,e=c.length;t<e;t++)M(c[t],r,a,s,l)}this.render=function(e,i,r){if(!1===A.enabled)return;if(!1===A.autoUpdate&&!1===A.needsUpdate)return;if(0===e.length)return;const s=t.getRenderTarget(),l=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),u=t.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const p=x!==o&&this.type===o,f=x===o&&this.type!==o;for(let s=0,l=e.length;s<l;s++){const l=e[s],c=l.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;a.copy(c.mapSize);const m=c.getFrameExtents();if(a.multiply(m),h.copy(c.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(h.x=Math.floor(g/m.x),a.x=h.x*m.x,c.mapSize.x=h.x),a.y>g&&(h.y=Math.floor(g/m.y),a.y=h.y*m.y,c.mapSize.y=h.y)),null===c.map||!0===p||!0===f){const t=this.type!==o?{minFilter:H,magFilter:H}:{};null!==c.map&&c.map.dispose(),c.map=new me(a.x,a.y,t),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const b=c.getViewportCount();for(let t=0;t<b;t++){const e=c.getViewport(t);d.set(h.x*e.x,h.y*e.y,h.x*e.z,h.y*e.w),u.viewport(d),c.updateMatrices(l,t),n=c.getFrustum(),M(i,r,c.camera,l,this.type)}!0!==c.isPointLightShadow&&this.type===o&&E(c,r),c.needsUpdate=!1}x=this.type,A.needsUpdate=!1,t.setRenderTarget(s,l,c)}}function fo(t,e,i){const n=i.isWebGL2,r=new function(){let e=!1;const i=new fe;let n=null;const r=new fe(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,o,s){!0===s&&(e*=o,n*=o,a*=o),i.set(e,n,a,o),!1===r.equals(i)&&(t.clearColor(e,n,a,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},a=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(e){e?ot(t.DEPTH_TEST):st(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},o=new function(){let e=!1,i=null,n=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(i){e||(i?ot(t.STENCIL_TEST):st(t.STENCIL_TEST))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&a===o||(t.stencilFunc(e,i,o),n=e,r=i,a=o)},setOp:function(e,i,n){o===e&&s===i&&l===n||(t.stencilOp(e,i,n),o=e,s=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,o=null,s=null,l=null,c=null}}},s=new WeakMap,l=new WeakMap;let c={},I={},T=new WeakMap,U=[],F=null,B=!1,R=null,L=null,D=null,P=null,N=null,O=null,k=null,z=new Oi(0,0,0),Q=0,V=!1,H=null,G=null,W=null,j=null,X=null;const q=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Z=!1,Y=0;const J=t.getParameter(t.VERSION);-1!==J.indexOf("WebGL")?(Y=parseFloat(/^WebGL (\d)/.exec(J)[1]),Z=Y>=1):-1!==J.indexOf("OpenGL ES")&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),Z=Y>=2);let K=null,$={};const tt=t.getParameter(t.SCISSOR_BOX),et=t.getParameter(t.VIEWPORT),it=(new fe).fromArray(tt),nt=(new fe).fromArray(et);function rt(e,i,r,a){const o=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let s=0;s<r;s++)!n||e!==t.TEXTURE_3D&&e!==t.TEXTURE_2D_ARRAY?t.texImage2D(i+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,o):t.texImage3D(i,0,t.RGBA,1,1,a,0,t.RGBA,t.UNSIGNED_BYTE,o);return s}const at={};function ot(e){!0!==c[e]&&(t.enable(e),c[e]=!0)}function st(e){!1!==c[e]&&(t.disable(e),c[e]=!1)}at[t.TEXTURE_2D]=rt(t.TEXTURE_2D,t.TEXTURE_2D,1),at[t.TEXTURE_CUBE_MAP]=rt(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(at[t.TEXTURE_2D_ARRAY]=rt(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),at[t.TEXTURE_3D]=rt(t.TEXTURE_3D,t.TEXTURE_3D,1,1)),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ot(t.DEPTH_TEST),a.setFunc(3),dt(!1),ut(1),ot(t.CULL_FACE),ht(0);const lt={[h]:t.FUNC_ADD,[d]:t.FUNC_SUBTRACT,[u]:t.FUNC_REVERSE_SUBTRACT};if(n)lt[103]=t.MIN,lt[104]=t.MAX;else{const t=e.get("EXT_blend_minmax");null!==t&&(lt[103]=t.MIN_EXT,lt[104]=t.MAX_EXT)}const ct={[p]:t.ZERO,[f]:t.ONE,[g]:t.SRC_COLOR,[b]:t.SRC_ALPHA,[E]:t.SRC_ALPHA_SATURATE,[A]:t.DST_COLOR,[y]:t.DST_ALPHA,[m]:t.ONE_MINUS_SRC_COLOR,[v]:t.ONE_MINUS_SRC_ALPHA,[x]:t.ONE_MINUS_DST_COLOR,[_]:t.ONE_MINUS_DST_ALPHA,[C]:t.CONSTANT_COLOR,[M]:t.ONE_MINUS_CONSTANT_COLOR,[w]:t.CONSTANT_ALPHA,[S]:t.ONE_MINUS_CONSTANT_ALPHA};function ht(e,i,n,r,a,o,s,l,c,d){if(0!==e){if(!1===B&&(ot(t.BLEND),B=!0),5===e)a=a||i,o=o||n,s=s||r,i===L&&a===N||(t.blendEquationSeparate(lt[i],lt[a]),L=i,N=a),n===D&&r===P&&o===O&&s===k||(t.blendFuncSeparate(ct[n],ct[r],ct[o],ct[s]),D=n,P=r,O=o,k=s),!1!==l.equals(z)&&c===Q||(t.blendColor(l.r,l.g,l.b,c),z.copy(l),Q=c),R=e,V=!1;else if(e!==R||d!==V){if(L===h&&N===h||(t.blendEquation(t.FUNC_ADD),L=h,N=h),d)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}D=null,P=null,O=null,k=null,z.set(0,0,0),Q=0,R=e,V=d}}else!0===B&&(st(t.BLEND),B=!1)}function dt(e){H!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),H=e)}function ut(e){0!==e?(ot(t.CULL_FACE),e!==G&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):st(t.CULL_FACE),G=e}function pt(e,i,n){e?(ot(t.POLYGON_OFFSET_FILL),j===i&&X===n||(t.polygonOffset(i,n),j=i,X=n)):st(t.POLYGON_OFFSET_FILL)}return{buffers:{color:r,depth:a,stencil:o},enable:ot,disable:st,bindFramebuffer:function(e,i){return I[e]!==i&&(t.bindFramebuffer(e,i),I[e]=i,n&&(e===t.DRAW_FRAMEBUFFER&&(I[t.FRAMEBUFFER]=i),e===t.FRAMEBUFFER&&(I[t.DRAW_FRAMEBUFFER]=i)),!0)},drawBuffers:function(n,r){let a=U,o=!1;if(n)if(a=T.get(r),void 0===a&&(a=[],T.set(r,a)),n.isWebGLMultipleRenderTargets){const e=n.texture;if(a.length!==e.length||a[0]!==t.COLOR_ATTACHMENT0){for(let i=0,n=e.length;i<n;i++)a[i]=t.COLOR_ATTACHMENT0+i;a.length=e.length,o=!0}}else a[0]!==t.COLOR_ATTACHMENT0&&(a[0]=t.COLOR_ATTACHMENT0,o=!0);else a[0]!==t.BACK&&(a[0]=t.BACK,o=!0);o&&(i.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return F!==e&&(t.useProgram(e),F=e,!0)},setBlending:ht,setMaterial:function(e,i){2===e.side?st(t.CULL_FACE):ot(t.CULL_FACE);let n=1===e.side;i&&(n=!n),dt(n),1===e.blending&&!1===e.transparent?ht(0):ht(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);const s=e.stencilWrite;o.setTest(s),s&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),pt(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?ot(t.SAMPLE_ALPHA_TO_COVERAGE):st(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:dt,setCullFace:ut,setLineWidth:function(e){e!==W&&(Z&&t.lineWidth(e),W=e)},setPolygonOffset:pt,setScissorTest:function(e){e?ot(t.SCISSOR_TEST):st(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+q-1),K!==e&&(t.activeTexture(e),K=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===K?t.TEXTURE0+q-1:K);let r=$[n];void 0===r&&(r={type:void 0,texture:void 0},$[n]=r),r.type===e&&r.texture===i||(K!==n&&(t.activeTexture(n),K=n),t.bindTexture(e,i||at[e]),r.type=e,r.texture=i)},unbindTexture:function(){const e=$[K];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,i){let n=l.get(i);void 0===n&&(n=new WeakMap,l.set(i,n));let r=n.get(e);void 0===r&&(r=t.getUniformBlockIndex(i,e.name),n.set(e,r))},uniformBlockBinding:function(e,i){const n=l.get(i).get(e);s.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),s.set(i,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===it.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),it.copy(e))},viewport:function(e){!1===nt.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),nt.copy(e))},reset:function(){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),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),!0===n&&(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),c={},K=null,$={},I={},T=new WeakMap,U=[],F=null,B=!1,R=null,L=null,D=null,P=null,N=null,O=null,k=null,z=new Oi(0,0,0),Q=0,V=!1,H=null,G=null,W=null,j=null,X=null,it.set(0,0,t.canvas.width,t.canvas.height),nt.set(0,0,t.canvas.width,t.canvas.height),r.reset(),a.reset(),o.reset()}}}function go(t,e,i,n,r,a,o){const s=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,h=r.maxTextureSize,d=r.maxSamples,u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),f=new WeakMap;let g;const m=new WeakMap;let b=!1;try{b="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function v(t,e){return b?new OffscreenCanvas(t,e):Yt("canvas")}function y(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?Ht:Math.floor,a=n(r*t.width),o=n(r*t.height);void 0===g&&(g=v(a,o));const s=i?v(a,o):g;return s.width=a,s.height=o,s.getContext("2d").drawImage(t,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+o+")."),s}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function _(t){return Vt(t.width)&&Vt(t.height)}function A(t,e){return t.generateMipmaps&&e&&t.minFilter!==H&&t.minFilter!==j}function x(e){t.generateMipmap(e)}function E(i,n,r,a,o=!1){if(!1===s)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let l=n;if(n===t.RED&&(r===t.FLOAT&&(l=t.R32F),r===t.HALF_FLOAT&&(l=t.R16F),r===t.UNSIGNED_BYTE&&(l=t.R8)),n===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.R8UI),r===t.UNSIGNED_SHORT&&(l=t.R16UI),r===t.UNSIGNED_INT&&(l=t.R32UI),r===t.BYTE&&(l=t.R8I),r===t.SHORT&&(l=t.R16I),r===t.INT&&(l=t.R32I)),n===t.RG&&(r===t.FLOAT&&(l=t.RG32F),r===t.HALF_FLOAT&&(l=t.RG16F),r===t.UNSIGNED_BYTE&&(l=t.RG8)),n===t.RGBA){const e=o?vt:re.getTransfer(a);r===t.FLOAT&&(l=t.RGBA32F),r===t.HALF_FLOAT&&(l=t.RGBA16F),r===t.UNSIGNED_BYTE&&(l=e===yt?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)}return l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get("EXT_color_buffer_float"),l}function C(t,e,i){return!0===A(t,i)||t.isFramebufferTexture&&t.minFilter!==H&&t.minFilter!==j?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function M(e){return e===H||1004===e||e===W?t.NEAREST:t.LINEAR}function w(t){const e=t.target;e.removeEventListener("dispose",w),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,r=m.get(i);if(r){const n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&I(t),0===Object.keys(r).length&&m.delete(i)}n.remove(t)}(e),e.isVideoTexture&&f.delete(e)}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=e.texture,r=n.get(e),a=n.get(i);if(void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),o.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(r.__webglFramebuffer[e]))for(let i=0;i<r.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(r.__webglFramebuffer[e][i]);else t.deleteFramebuffer(r.__webglFramebuffer[e]);r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e])}else{if(Array.isArray(r.__webglFramebuffer))for(let e=0;e<r.__webglFramebuffer.length;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let e=0;e<r.__webglColorRenderbuffer.length;e++)r.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(r.__webglColorRenderbuffer[e]);r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),o.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}function I(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const r=e.source;delete m.get(r)[i.__cacheKey],o.memory.textures--}let T=0;function U(e,r){const a=n.get(e);if(e.isVideoTexture&&function(t){const e=o.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&a.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void P(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+r)}const F={[z]:t.REPEAT,[Q]:t.CLAMP_TO_EDGE,[V]:t.MIRRORED_REPEAT},B={[H]:t.NEAREST,[G]:t.NEAREST_MIPMAP_NEAREST,[W]:t.NEAREST_MIPMAP_LINEAR,[j]:t.LINEAR,[X]:t.LINEAR_MIPMAP_NEAREST,[q]:t.LINEAR_MIPMAP_LINEAR},R={[Et]:t.NEVER,[Ut]:t.ALWAYS,[Ct]:t.LESS,[wt]:t.LEQUAL,[Mt]:t.EQUAL,[Tt]:t.GEQUAL,[St]:t.GREATER,[It]:t.NOTEQUAL};function L(i,a,o){if(o?(t.texParameteri(i,t.TEXTURE_WRAP_S,F[a.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,F[a.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,F[a.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,B[a.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,B[a.minFilter])):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),a.wrapS===Q&&a.wrapT===Q||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,t.TEXTURE_MAG_FILTER,M(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,M(a.minFilter)),a.minFilter!==H&&a.minFilter!==j&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(t.texParameteri(i,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,R[a.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){const o=e.get("EXT_texture_filter_anisotropic");if(a.magFilter===H)return;if(a.minFilter!==W&&a.minFilter!==q)return;if(a.type===K&&!1===e.has("OES_texture_float_linear"))return;if(!1===s&&a.type===$&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function D(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",w));const r=i.source;let a=m.get(r);void 0===a&&(a={},m.set(r,a));const s=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(i);if(s!==e.__cacheKey){void 0===a[s]&&(a[s]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,n=!0),a[s].usedTimes++;const r=a[e.__cacheKey];void 0!==r&&(a[e.__cacheKey].usedTimes--,0===r.usedTimes&&I(i)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return n}function P(e,r,o){let l=t.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),r.isData3DTexture&&(l=t.TEXTURE_3D);const c=D(e,r),d=r.source;i.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const u=n.get(d);if(d.version!==u.__version||!0===c){i.activeTexture(t.TEXTURE0+o);const e=re.getPrimaries(re.workingColorSpace),n=r.colorSpace===pt?null:re.getPrimaries(r.colorSpace),p=r.colorSpace===pt||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);const f=function(t){return!s&&(t.wrapS!==Q||t.wrapT!==Q||t.minFilter!==H&&t.minFilter!==j)}(r)&&!1===_(r.image);let g=y(r.image,f,!1,h);g=ot(r,g);const m=_(g)||s,b=a.convert(r.format,r.colorSpace);let v,M=a.convert(r.type),w=E(r.internalFormat,b,M,r.colorSpace,r.isVideoTexture);L(l,r,m);const S=r.mipmaps,I=s&&!0!==r.isVideoTexture&&36196!==w,T=void 0===u.__version||!0===c,U=C(r,g,m);if(r.isDepthTexture)w=t.DEPTH_COMPONENT,s?w=r.type===K?t.DEPTH_COMPONENT32F:r.type===J?t.DEPTH_COMPONENT24:r.type===tt?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:r.type===K&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===it&&w===t.DEPTH_COMPONENT&&r.type!==Y&&r.type!==J&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=J,M=a.convert(r.type)),r.format===nt&&w===t.DEPTH_COMPONENT&&(w=t.DEPTH_STENCIL,r.type!==tt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=tt,M=a.convert(r.type))),T&&(I?i.texStorage2D(t.TEXTURE_2D,1,w,g.width,g.height):i.texImage2D(t.TEXTURE_2D,0,w,g.width,g.height,0,b,M,null));else if(r.isDataTexture)if(S.length>0&&m){I&&T&&i.texStorage2D(t.TEXTURE_2D,U,w,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)v=S[e],I?i.texSubImage2D(t.TEXTURE_2D,e,0,0,v.width,v.height,b,M,v.data):i.texImage2D(t.TEXTURE_2D,e,w,v.width,v.height,0,b,M,v.data);r.generateMipmaps=!1}else I?(T&&i.texStorage2D(t.TEXTURE_2D,U,w,g.width,g.height),i.texSubImage2D(t.TEXTURE_2D,0,0,0,g.width,g.height,b,M,g.data)):i.texImage2D(t.TEXTURE_2D,0,w,g.width,g.height,0,b,M,g.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){I&&T&&i.texStorage3D(t.TEXTURE_2D_ARRAY,U,w,S[0].width,S[0].height,g.depth);for(let e=0,n=S.length;e<n;e++)v=S[e],r.format!==et?null!==b?I?i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,v.width,v.height,g.depth,b,v.data,0,0):i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,w,v.width,v.height,g.depth,0,v.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,v.width,v.height,g.depth,b,M,v.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,w,v.width,v.height,g.depth,0,b,M,v.data)}else{I&&T&&i.texStorage2D(t.TEXTURE_2D,U,w,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)v=S[e],r.format!==et?null!==b?I?i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,v.width,v.height,b,v.data):i.compressedTexImage2D(t.TEXTURE_2D,e,w,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?i.texSubImage2D(t.TEXTURE_2D,e,0,0,v.width,v.height,b,M,v.data):i.texImage2D(t.TEXTURE_2D,e,w,v.width,v.height,0,b,M,v.data)}else if(r.isDataArrayTexture)I?(T&&i.texStorage3D(t.TEXTURE_2D_ARRAY,U,w,g.width,g.height,g.depth),i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,g.width,g.height,g.depth,b,M,g.data)):i.texImage3D(t.TEXTURE_2D_ARRAY,0,w,g.width,g.height,g.depth,0,b,M,g.data);else if(r.isData3DTexture)I?(T&&i.texStorage3D(t.TEXTURE_3D,U,w,g.width,g.height,g.depth),i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,g.width,g.height,g.depth,b,M,g.data)):i.texImage3D(t.TEXTURE_3D,0,w,g.width,g.height,g.depth,0,b,M,g.data);else if(r.isFramebufferTexture){if(T)if(I)i.texStorage2D(t.TEXTURE_2D,U,w,g.width,g.height);else{let e=g.width,n=g.height;for(let r=0;r<U;r++)i.texImage2D(t.TEXTURE_2D,r,w,e,n,0,b,M,null),e>>=1,n>>=1}}else if(S.length>0&&m){I&&T&&i.texStorage2D(t.TEXTURE_2D,U,w,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)v=S[e],I?i.texSubImage2D(t.TEXTURE_2D,e,0,0,b,M,v):i.texImage2D(t.TEXTURE_2D,e,w,b,M,v);r.generateMipmaps=!1}else I?(T&&i.texStorage2D(t.TEXTURE_2D,U,w,g.width,g.height),i.texSubImage2D(t.TEXTURE_2D,0,0,0,b,M,g)):i.texImage2D(t.TEXTURE_2D,0,w,b,M,g);A(r,m)&&x(l),u.__version=d.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}function N(e,r,o,s,l,c){const h=a.convert(o.format,o.colorSpace),d=a.convert(o.type),p=E(o.internalFormat,h,d,o.colorSpace);if(!n.get(r).__hasExternalTextures){const e=Math.max(1,r.width>>c),n=Math.max(1,r.height>>c);l===t.TEXTURE_3D||l===t.TEXTURE_2D_ARRAY?i.texImage3D(l,c,p,e,n,r.depth,0,h,d,null):i.texImage2D(l,c,p,e,n,0,h,d,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),at(r)?u.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,s,l,n.get(o).__webglTexture,0,rt(r)):(l===t.TEXTURE_2D||l>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,s,l,n.get(o).__webglTexture,c),i.bindFramebuffer(t.FRAMEBUFFER,null)}function O(e,i,n){if(t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer){let r=!0===s?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(n||at(i)){const e=i.depthTexture;e&&e.isDepthTexture&&(e.type===K?r=t.DEPTH_COMPONENT32F:e.type===J&&(r=t.DEPTH_COMPONENT24));const n=rt(i);at(i)?u.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,n,r,i.width,i.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,n,r,i.width,i.height)}else t.renderbufferStorage(t.RENDERBUFFER,r,i.width,i.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(i.depthBuffer&&i.stencilBuffer){const r=rt(i);n&&!1===at(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,i.width,i.height):at(i)?u.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let r=0;r<e.length;r++){const o=e[r],s=a.convert(o.format,o.colorSpace),l=a.convert(o.type),c=E(o.internalFormat,s,l,o.colorSpace),h=rt(i);n&&!1===at(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,h,c,i.width,i.height):at(i)?u.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,h,c,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,c,i.width,i.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function k(e){const r=n.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),U(r.depthTexture,0);const a=n.get(r.depthTexture).__webglTexture,o=rt(r);if(r.depthTexture.format===it)at(r)?u.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==nt)throw new Error("Unknown depthTexture format");at(r)?u.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),O(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),O(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(t.FRAMEBUFFER,null)}function rt(t){return Math.min(d,t.samples)}function at(t){const i=n.get(t);return s&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function ot(t,i){const n=t.colorSpace,r=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Bt||n!==gt&&n!==pt&&(re.getTransfer(n)===yt?!1===s?!0===e.has("EXT_sRGB")&&r===et?(t.format=Bt,t.minFilter=j,t.generateMipmaps=!1):i=le.sRGBToLinear(i):r===et&&a===Z||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),i}this.allocateTextureUnit=function(){const t=T;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),T+=1,t},this.resetTextureUnits=function(){T=0},this.setTexture2D=U,this.setTexture2DArray=function(e,r){const a=n.get(e);e.version>0&&a.__version!==e.version?P(a,e,r):i.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const a=n.get(e);e.version>0&&a.__version!==e.version?P(a,e,r):i.bindTexture(t.TEXTURE_3D,a.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,r){const o=n.get(e);e.version>0&&o.__version!==e.version?function(e,r,o){if(6!==r.image.length)return;const l=D(e,r),h=r.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const d=n.get(h);if(h.version!==d.__version||!0===l){i.activeTexture(t.TEXTURE0+o);const e=re.getPrimaries(re.workingColorSpace),n=r.colorSpace===pt?null:re.getPrimaries(r.colorSpace),u=r.colorSpace===pt||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const p=r.isCompressedTexture||r.image[0].isCompressedTexture,f=r.image[0]&&r.image[0].isDataTexture,g=[];for(let t=0;t<6;t++)g[t]=p||f?f?r.image[t].image:r.image[t]:y(r.image[t],!1,!0,c),g[t]=ot(r,g[t]);const m=g[0],b=_(m)||s,v=a.convert(r.format,r.colorSpace),M=a.convert(r.type),w=E(r.internalFormat,v,M,r.colorSpace),S=s&&!0!==r.isVideoTexture,I=void 0===d.__version||!0===l;let T,U=C(r,m,b);if(L(t.TEXTURE_CUBE_MAP,r,b),p){S&&I&&i.texStorage2D(t.TEXTURE_CUBE_MAP,U,w,m.width,m.height);for(let e=0;e<6;e++){T=g[e].mipmaps;for(let n=0;n<T.length;n++){const a=T[n];r.format!==et?null!==v?S?i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,a.width,a.height,v,a.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,w,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,a.width,a.height,v,M,a.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,w,a.width,a.height,0,v,M,a.data)}}}else{T=r.mipmaps,S&&I&&(T.length>0&&U++,i.texStorage2D(t.TEXTURE_CUBE_MAP,U,w,g[0].width,g[0].height));for(let e=0;e<6;e++)if(f){S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,g[e].width,g[e].height,v,M,g[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,g[e].width,g[e].height,0,v,M,g[e].data);for(let n=0;n<T.length;n++){const r=T[n].image[e].image;S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,r.width,r.height,v,M,r.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,w,r.width,r.height,0,v,M,r.data)}}else{S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,v,M,g[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,v,M,g[e]);for(let n=0;n<T.length;n++){const r=T[n];S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,v,M,r.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,w,v,M,r.image[e])}}}A(r,b)&&x(t.TEXTURE_CUBE_MAP),d.__version=h.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(o,e,r):i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+r)},this.rebindTextures=function(e,i,r){const a=n.get(e);void 0!==i&&N(a.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&k(e)},this.setupRenderTarget=function(e){const l=e.texture,c=n.get(e),h=n.get(l);e.addEventListener("dispose",S),!0!==e.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=l.version,o.memory.textures++);const d=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultipleRenderTargets,p=_(e)||s;if(d){c.__webglFramebuffer=[];for(let e=0;e<6;e++)if(s&&l.mipmaps&&l.mipmaps.length>0){c.__webglFramebuffer[e]=[];for(let i=0;i<l.mipmaps.length;i++)c.__webglFramebuffer[e][i]=t.createFramebuffer()}else c.__webglFramebuffer[e]=t.createFramebuffer()}else{if(s&&l.mipmaps&&l.mipmaps.length>0){c.__webglFramebuffer=[];for(let e=0;e<l.mipmaps.length;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else c.__webglFramebuffer=t.createFramebuffer();if(u)if(r.drawBuffers){const i=e.texture;for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&e.samples>0&&!1===at(e)){const n=u?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer);for(let i=0;i<n.length;i++){const r=n[i];c.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,c.__webglColorRenderbuffer[i]);const o=a.convert(r.format,r.colorSpace),s=a.convert(r.type),l=E(r.internalFormat,o,s,r.colorSpace,!0===e.isXRRenderTarget),h=rt(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+i,t.RENDERBUFFER,c.__webglColorRenderbuffer[i])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),O(c.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(d){i.bindTexture(t.TEXTURE_CUBE_MAP,h.__webglTexture),L(t.TEXTURE_CUBE_MAP,l,p);for(let i=0;i<6;i++)if(s&&l.mipmaps&&l.mipmaps.length>0)for(let n=0;n<l.mipmaps.length;n++)N(c.__webglFramebuffer[i][n],e,l,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else N(c.__webglFramebuffer[i],e,l,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);A(l,p)&&x(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){const r=e.texture;for(let a=0,o=r.length;a<o;a++){const o=r[a],s=n.get(o);i.bindTexture(t.TEXTURE_2D,s.__webglTexture),L(t.TEXTURE_2D,o,p),N(c.__webglFramebuffer,e,o,t.COLOR_ATTACHMENT0+a,t.TEXTURE_2D,0),A(o,p)&&x(t.TEXTURE_2D)}i.unbindTexture()}else{let n=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(s?n=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(n,h.__webglTexture),L(n,l,p),s&&l.mipmaps&&l.mipmaps.length>0)for(let i=0;i<l.mipmaps.length;i++)N(c.__webglFramebuffer[i],e,l,t.COLOR_ATTACHMENT0,n,i);else N(c.__webglFramebuffer,e,l,t.COLOR_ATTACHMENT0,n,0);A(l,p)&&x(n),i.unbindTexture()}e.depthBuffer&&k(e)},this.updateRenderTargetMipmap=function(e){const r=_(e)||s,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let o=0,s=a.length;o<s;o++){const s=a[o];if(A(s,r)){const r=e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=n.get(s).__webglTexture;i.bindTexture(r,a),x(r),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(s&&e.samples>0&&!1===at(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,o=e.height;let s=t.COLOR_BUFFER_BIT;const l=[],c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=n.get(e),d=!0===e.isWebGLMultipleRenderTargets;if(d)for(let e=0;e<r.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<r.length;i++){l.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&l.push(c);const u=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===u&&(e.depthBuffer&&(s|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&(s|=t.STENCIL_BUFFER_BIT)),d&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[i]),!0===u&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[c]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[c])),d){const e=n.get(r[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,a,o,0,0,a,o,s,t.NEAREST),p&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,l)}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),d)for(let e=0;e<r.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const a=n.get(r[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,a,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=k,this.setupFrameBufferTexture=N,this.useMultisampledRTT=at}function mo(t,e,i){const n=i.isWebGL2;return{convert:function(i,r=""){let a;const o=re.getTransfer(r);if(i===Z)return t.UNSIGNED_BYTE;if(1017===i)return t.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return t.UNSIGNED_SHORT_5_5_5_1;if(1010===i)return t.BYTE;if(1011===i)return t.SHORT;if(i===Y)return t.UNSIGNED_SHORT;if(1013===i)return t.INT;if(i===J)return t.UNSIGNED_INT;if(i===K)return t.FLOAT;if(i===$)return n?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(1021===i)return t.ALPHA;if(i===et)return t.RGBA;if(1024===i)return t.LUMINANCE;if(1025===i)return t.LUMINANCE_ALPHA;if(i===it)return t.DEPTH_COMPONENT;if(i===nt)return t.DEPTH_STENCIL;if(i===Bt)return a=e.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(1028===i)return t.RED;if(1029===i)return t.RED_INTEGER;if(1030===i)return t.RG;if(1031===i)return t.RG_INTEGER;if(1033===i)return t.RGBA_INTEGER;if(i===rt||i===at||i===ot||i===st)if(o===yt){if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(i===rt)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===at)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ot)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===st)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=e.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(i===rt)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===at)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ot)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===st)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(a=e.get("WEBGL_compressed_texture_pvrtc"),null===a)return null;if(35840===i)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return a=e.get("WEBGL_compressed_texture_etc1"),null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(a=e.get("WEBGL_compressed_texture_etc"),null===a)return null;if(37492===i)return o===yt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(a=e.get("WEBGL_compressed_texture_astc"),null===a)return null;if(37808===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===lt||36494===i||36495===i){if(a=e.get("EXT_texture_compression_bptc"),null===a)return null;if(i===lt)return o===yt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(a=e.get("EXT_texture_compression_rgtc"),null===a)return null;if(i===lt)return a.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===tt?n?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}class bo extends Un{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class vo extends Ai{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yo={type:"move"};class _o{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new vo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new vo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new _e,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new _e),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new vo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new _e,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new _e),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,a=null;const o=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){a=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i),r=this._getHandJoint(l,n);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=n.position.distanceTo(r.position),s=.02,c=.005;l.inputState.pinching&&o>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1));null!==o&&(n=e.getPose(t.targetRaySpace,i),null===n&&null!==r&&(n=r),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(yo)))}return null!==o&&(o.visible=null!==n),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new vo;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class Ao extends Dt{constructor(t,e){super();const i=this;let n=null,r=1,a=null,o="local-floor",s=1,l=null,c=null,h=null,d=null,u=null,p=null;const f=e.getContextAttributes();let g=null,m=null;const b=[],v=[],y=new jt;let _=null;const A=new Un;A.layers.enable(1),A.viewport=new fe;const x=new Un;x.layers.enable(2),x.viewport=new fe;const E=[A,x],C=new bo;C.layers.enable(1),C.layers.enable(2);let M=null,w=null;function S(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const i=b[e];void 0!==i&&(i.update(t.inputSource,t.frame,l||a),i.dispatchEvent({type:t.type,data:t.inputSource}))}function I(){n.removeEventListener("select",S),n.removeEventListener("selectstart",S),n.removeEventListener("selectend",S),n.removeEventListener("squeeze",S),n.removeEventListener("squeezestart",S),n.removeEventListener("squeezeend",S),n.removeEventListener("end",I),n.removeEventListener("inputsourceschange",T);for(let t=0;t<b.length;t++){const e=v[t];null!==e&&(v[t]=null,b[t].disconnect(e))}M=null,w=null,t.setRenderTarget(g),u=null,d=null,h=null,n=null,m=null,L.stop(),i.isPresenting=!1,t.setPixelRatio(_),t.setSize(y.width,y.height,!1),i.dispatchEvent({type:"sessionend"})}function T(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=v.indexOf(i);n>=0&&(v[n]=null,b[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=v.indexOf(i);if(-1===n){for(let t=0;t<b.length;t++){if(t>=v.length){v.push(i),n=t;break}if(null===v[t]){v[t]=i,n=t;break}}if(-1===n)break}const r=b[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=b[t];return void 0===e&&(e=new _o,b[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=b[t];return void 0===e&&(e=new _o,b[t]=e),e.getGripSpace()},this.getHand=function(t){let e=b[t];return void 0===e&&(e=new _o,b[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(n=c,null!==n){if(g=t.getRenderTarget(),n.addEventListener("select",S),n.addEventListener("selectstart",S),n.addEventListener("selectend",S),n.addEventListener("squeeze",S),n.addEventListener("squeezestart",S),n.addEventListener("squeezeend",S),n.addEventListener("end",I),n.addEventListener("inputsourceschange",T),!0!==f.xrCompatible&&await e.makeXRCompatible(),_=t.getPixelRatio(),t.getSize(y),void 0===n.renderState.layers||!1===t.capabilities.isWebGL2){const i={antialias:void 0!==n.renderState.layers||f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),t.setPixelRatio(1),t.setSize(u.framebufferWidth,u.framebufferHeight,!1),m=new me(u.framebufferWidth,u.framebufferHeight,{format:et,type:Z,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}else{let i=null,a=null,o=null;f.depth&&(o=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,i=f.stencil?nt:it,a=f.stencil?tt:J);const s={colorFormat:e.RGBA8,depthFormat:o,scaleFactor:r};h=new XRWebGLBinding(n,e),d=h.createProjectionLayer(s),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),m=new me(d.textureWidth,d.textureHeight,{format:et,type:Z,depthTexture:new Mr(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0}),t.properties.get(m).__ignoreDepthValues=d.ignoreDepthValues}m.isXRRenderTarget=!0,this.setFoveation(s),l=null,a=await n.requestReferenceSpace(o),L.setContext(n),L.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};const U=new _e,F=new _e;function B(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;C.near=x.near=A.near=t.near,C.far=x.far=A.far=t.far,M===C.near&&w===C.far||(n.updateRenderState({depthNear:C.near,depthFar:C.far}),M=C.near,w=C.far);const e=t.parent,i=C.cameras;B(C,e);for(let t=0;t<i.length;t++)B(i[t],e);2===i.length?function(t,e,i){U.setFromMatrixPosition(e.matrixWorld),F.setFromMatrixPosition(i.matrixWorld);const n=U.distanceTo(F),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],d=(a[8]+1)/a[0],u=o*h,p=o*d,f=n/(-h+d),g=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(g),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const m=o+f,b=s+f,v=u-g,y=p+(n-g),_=l*s/b*m,A=c*s/b*m;t.projectionMatrix.makePerspective(v,y,_,A,m,b),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(C,A,x):C.projectionMatrix.copy(A.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*Ot*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,C,e)},this.getCamera=function(){return C},this.getFoveation=function(){if(null!==d||null!==u)return s},this.setFoveation=function(t){s=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)};let R=null;const L=new Vn;L.setAnimationLoop((function(e,n){if(c=n.getViewerPose(l||a),p=n,null!==c){const e=c.views;null!==u&&(t.setRenderTargetFramebuffer(m,u.framebuffer),t.setRenderTarget(m));let i=!1;e.length!==C.cameras.length&&(C.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const r=e[n];let a=null;if(null!==u)a=u.getViewport(r);else{const e=h.getViewSubImage(d,r);a=e.viewport,0===n&&(t.setRenderTargetTextures(m,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(m))}let o=E[n];void 0===o&&(o=new Un,o.layers.enable(n),o.viewport=new fe,E[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),0===n&&(C.matrix.copy(o.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===i&&C.cameras.push(o)}}for(let t=0;t<b.length;t++){const e=v[t],i=b[t];null!==e&&void 0!==i&&i.update(e,n,l||a)}R&&R(e,n),n.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:n}),p=null})),this.setAnimationLoop=function(t){R=t},this.dispose=function(){}}}function xo(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map,i(r.map,n.mapTransform)),r.alphaMap&&(n.alphaMap.value=r.alphaMap,i(r.alphaMap,n.alphaMapTransform)),r.bumpMap&&(n.bumpMap.value=r.bumpMap,i(r.bumpMap,n.bumpMapTransform),n.bumpScale.value=r.bumpScale,1===r.side&&(n.bumpScale.value*=-1)),r.normalMap&&(n.normalMap.value=r.normalMap,i(r.normalMap,n.normalMapTransform),n.normalScale.value.copy(r.normalScale),1===r.side&&n.normalScale.value.negate()),r.displacementMap&&(n.displacementMap.value=r.displacementMap,i(r.displacementMap,n.displacementMapTransform),n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap,i(r.emissiveMap,n.emissiveMapTransform)),r.specularMap&&(n.specularMap.value=r.specularMap,i(r.specularMap,n.specularMapTransform)),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);const a=e.get(r).envMap;if(a&&(n.envMap.value=a,n.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;const e=!0===t._useLegacyLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*e,i(r.lightMap,n.lightMapTransform)}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity,i(r.aoMap,n.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,wn(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,r,a,o,s){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(t,r):r.isMeshToonMaterial?(n(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(n(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(n(t,r),function(t,n){t.metalness.value=n.metalness,n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap,i(n.metalnessMap,t.metalnessMapTransform)),t.roughness.value=n.roughness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap,i(n.roughnessMap,t.roughnessMapTransform));e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate())),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,i(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,s)):r.isMeshMatcapMaterial?(n(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?n(t,r):r.isMeshDistanceMaterial?(n(t,r),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?n(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,a,o):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Eo(t,e,i,n){let r={},a={},o=[];const s=i.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,i){const n=t.value;if(void 0===i[e]){if("number"==typeof n)i[e]=n;else{const t=Array.isArray(n)?n:[n],r=[];for(let e=0;e<t.length;e++)r.push(t[e].clone());i[e]=r}return!0}if("number"==typeof n){if(i[e]!==n)return i[e]=n,!0}else{const t=Array.isArray(i[e])?i[e]:[i[e]],r=Array.isArray(n)?n:[n];for(let e=0;e<t.length;e++){const i=t[e];if(!1===i.equals(r[e]))return i.copy(r[e]),!0}}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.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),e}function h(e){const i=e.target;i.removeEventListener("dispose",h);const n=o.indexOf(i.__bindingPointIndex);o.splice(n,1),t.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=r[i.id];void 0===u&&(function(t){const e=t.uniforms;let i=0;let n=0;for(let t=0,r=e.length;t<r;t++){const r=e[t],a={boundary:0,storage:0},o=Array.isArray(r.value)?r.value:[r.value];for(let t=0,e=o.length;t<e;t++){const e=c(o[t]);a.boundary+=e.boundary,a.storage+=e.storage}r.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),r.__offset=i,t>0&&(n=i%16,0!==n&&16-n-a.boundary<0&&(i+=16-n,r.__offset=i)),i+=a.storage}n=i%16,n>0&&(i+=16-n),t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<s;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,r,a),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,i,n),n}(i),r[i.id]=u,i.addEventListener("dispose",h));const p=d.program;n.updateUBOMapping(i,p);const f=e.render.frame;a[i.id]!==f&&(function(e){const i=r[e.id],n=e.uniforms,a=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,i);for(let e=0,i=n.length;e<i;e++){const i=n[e];if(!0===l(i,e,a)){const e=i.__offset,n=Array.isArray(i.value)?i.value:[i.value];let r=0;for(let a=0;a<n.length;a++){const o=n[a],s=c(o);"number"==typeof o?(i.__data[0]=o,t.bufferSubData(t.UNIFORM_BUFFER,e+r,i.__data)):o.isMatrix3?(i.__data[0]=o.elements[0],i.__data[1]=o.elements[1],i.__data[2]=o.elements[2],i.__data[3]=o.elements[0],i.__data[4]=o.elements[3],i.__data[5]=o.elements[4],i.__data[6]=o.elements[5],i.__data[7]=o.elements[0],i.__data[8]=o.elements[6],i.__data[9]=o.elements[7],i.__data[10]=o.elements[8],i.__data[11]=o.elements[0]):(o.toArray(i.__data,r),r+=s.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,i.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(i),a[i.id]=f)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);o=[],r={},a={}}}}class Co{constructor(t={}){const{canvas:e=Jt(),context:i=null,depth:r=!0,stencil:a=!0,alpha:o=!1,antialias:s=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=t;let u;this.isWebGLRenderer=!0,u=null!==i?i.getContextAttributes().alpha:o;const p=new Uint32Array(4),f=new Int32Array(4);let g=null,m=null;const b=[],v=[];this.domElement=e,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=ft,this._useLegacyLights=!1,this.toneMapping=F,this.toneMappingExposure=1;const y=this;let _=!1,A=0,x=0,E=null,C=-1,M=null;const w=new fe,S=new fe;let I=null;const T=new Oi(0);let U=0,B=e.width,R=e.height,L=1,D=null,P=null;const N=new fe(0,0,B,R),O=new fe(0,0,B,R);let k=!1;const z=new Qn;let Q=!1,V=!1,H=null;const G=new Ye,W=new jt,j=new _e,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function it(){return null===E?L:1}let nt,rt,at,ot,st,lt,ct,ht,dt,ut,pt,mt,bt,vt,yt,_t,At,xt,Et,Ct,Mt,wt,St,It,Tt=i;function Ut(t,i){for(let n=0;n<t.length;n++){const r=t[n],a=e.getContext(r,i);if(null!==a)return a}return null}try{const t={alpha:!0,depth:r,stencil:a,antialias:s,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${n}`),e.addEventListener("webglcontextlost",Rt,!1),e.addEventListener("webglcontextrestored",Lt,!1),e.addEventListener("webglcontextcreationerror",Dt,!1),null===Tt){const e=["webgl2","webgl","experimental-webgl"];if(!0===y.isWebGL1Renderer&&e.shift(),Tt=Ut(e,t),null===Tt)throw Ut(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}"undefined"!=typeof WebGLRenderingContext&&Tt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===Tt.getShaderPrecisionFormat&&(Tt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Ft(){nt=new br(Tt),rt=new Kn(Tt,nt,t),nt.init(rt),wt=new mo(Tt,nt,rt),at=new fo(Tt,nt,rt),ot=new _r(Tt),st=new $a,lt=new go(Tt,nt,at,st,rt,wt,ot),ct=new tr(y),ht=new mr(y),dt=new Hn(Tt,rt),St=new Yn(Tt,nt,dt,rt),ut=new vr(Tt,dt,ot,St),pt=new Cr(Tt,ut,dt,ot),Et=new Er(Tt,rt,lt),_t=new $n(st),mt=new Ka(y,ct,ht,nt,rt,St,_t),bt=new xo(y,st),vt=new no,yt=new co(nt,rt),xt=new Zn(y,ct,ht,at,pt,u,l),At=new po(y,pt,rt),It=new Eo(Tt,ot,rt,at),Ct=new Jn(Tt,nt,ot,rt),Mt=new yr(Tt,nt,ot,rt),ot.programs=mt.programs,y.capabilities=rt,y.extensions=nt,y.properties=st,y.renderLists=vt,y.shadowMap=At,y.state=at,y.info=ot}Ft();const Bt=new Ao(y,Tt);function Rt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function Lt(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const t=ot.autoReset,e=At.enabled,i=At.autoUpdate,n=At.needsUpdate,r=At.type;Ft(),ot.autoReset=t,At.enabled=e,At.autoUpdate=i,At.needsUpdate=n,At.type=r}function Dt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Pt(t){const e=t.target;e.removeEventListener("dispose",Pt),function(t){(function(t){const e=st.get(t).programs;void 0!==e&&(e.forEach((function(t){mt.releaseProgram(t)})),t.isShaderMaterial&&mt.releaseShaderCache(t))})(t),st.remove(t)}(e)}function Nt(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,qt(t,e,i),t.side=0,t.needsUpdate=!0,qt(t,e,i),t.side=2):qt(t,e,i)}this.xr=Bt,this.getContext=function(){return Tt},this.getContextAttributes=function(){return Tt.getContextAttributes()},this.forceContextLoss=function(){const t=nt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=nt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(t){void 0!==t&&(L=t,this.setSize(B,R,!1))},this.getSize=function(t){return t.set(B,R)},this.setSize=function(t,i,n=!0){Bt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(B=t,R=i,e.width=Math.floor(t*L),e.height=Math.floor(i*L),!0===n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(B*L,R*L).floor()},this.setDrawingBufferSize=function(t,i,n){B=t,R=i,L=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return t.copy(w)},this.getViewport=function(t){return t.copy(N)},this.setViewport=function(t,e,i,n){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,i,n),at.viewport(w.copy(N).multiplyScalar(L).floor())},this.getScissor=function(t){return t.copy(O)},this.setScissor=function(t,e,i,n){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,i,n),at.scissor(S.copy(O).multiplyScalar(L).floor())},this.getScissorTest=function(){return k},this.setScissorTest=function(t){at.setScissorTest(k=t)},this.setOpaqueSort=function(t){D=t},this.setTransparentSort=function(t){P=t},this.getClearColor=function(t){return t.copy(xt.getClearColor())},this.setClearColor=function(){xt.setClearColor.apply(xt,arguments)},this.getClearAlpha=function(){return xt.getClearAlpha()},this.setClearAlpha=function(){xt.setClearAlpha.apply(xt,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;if(t){let t=!1;if(null!==E){const e=E.texture.format;t=1033===e||1031===e||1029===e}if(t){const t=E.texture.type,e=t===Z||t===J||t===Y||t===tt||1017===t||1018===t,i=xt.getClearColor(),n=xt.getClearAlpha(),r=i.r,a=i.g,o=i.b;e?(p[0]=r,p[1]=a,p[2]=o,p[3]=n,Tt.clearBufferuiv(Tt.COLOR,0,p)):(f[0]=r,f[1]=a,f[2]=o,f[3]=n,Tt.clearBufferiv(Tt.COLOR,0,f))}else n|=Tt.COLOR_BUFFER_BIT}e&&(n|=Tt.DEPTH_BUFFER_BIT),i&&(n|=Tt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Tt.clear(n)},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(){e.removeEventListener("webglcontextlost",Rt,!1),e.removeEventListener("webglcontextrestored",Lt,!1),e.removeEventListener("webglcontextcreationerror",Dt,!1),vt.dispose(),yt.dispose(),st.dispose(),ct.dispose(),ht.dispose(),pt.dispose(),St.dispose(),It.dispose(),mt.dispose(),Bt.dispose(),Bt.removeEventListener("sessionstart",kt),Bt.removeEventListener("sessionend",zt),H&&(H.dispose(),H=null),Qt.stop()},this.renderBufferDirect=function(t,e,i,n,r,a){null===e&&(e=X);const o=r.isMesh&&r.matrixWorld.determinant()<0,s=function(t,e,i,n,r){!0!==e.isScene&&(e=X),lt.resetTextureUnits();const a=e.fog,o=n.isMeshStandardMaterial?e.environment:null,s=null===E?y.outputColorSpace:!0===E.isXRRenderTarget?E.texture.colorSpace:gt,l=(n.isMeshStandardMaterial?ht:ct).get(n.envMap||o),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,h=!!i.attributes.tangent&&(!!n.normalMap||n.anisotropy>0),d=!!i.morphAttributes.position,u=!!i.morphAttributes.normal,p=!!i.morphAttributes.color;let f=F;n.toneMapped&&(null!==E&&!0!==E.isXRRenderTarget||(f=y.toneMapping));const g=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,b=void 0!==g?g.length:0,v=st.get(n),_=m.state.lights;if(!0===Q&&(!0===V||t!==M)){const e=t===M&&n.id===C;_t.setState(n,t,e)}let A=!1;n.version===v.__version?v.needsLights&&v.lightsStateVersion!==_.state.version||v.outputColorSpace!==s||r.isBatchedMesh&&!1===v.batching?A=!0:r.isBatchedMesh||!0!==v.batching?r.isInstancedMesh&&!1===v.instancing?A=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?A=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||v.envMap!==l||!0===n.fog&&v.fog!==a?A=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===_t.numPlanes&&v.numIntersection===_t.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==h||v.morphTargets!==d||v.morphNormals!==u||v.morphColors!==p||v.toneMapping!==f||!0===rt.isWebGL2&&v.morphTargetsCount!==b)&&(A=!0):A=!0:A=!0:A=!0:A=!0:(A=!0,v.__version=n.version);let x=v.currentProgram;!0===A&&(x=qt(n,e,r));let w=!1,S=!1,I=!1;const T=x.getUniforms(),U=v.uniforms;if(at.useProgram(x.program)&&(w=!0,S=!0,I=!0),n.id!==C&&(C=n.id,S=!0),w||M!==t){T.setValue(Tt,"projectionMatrix",t.projectionMatrix),T.setValue(Tt,"viewMatrix",t.matrixWorldInverse);const e=T.map.cameraPosition;void 0!==e&&e.setValue(Tt,j.setFromMatrixPosition(t.matrixWorld)),rt.logarithmicDepthBuffer&&T.setValue(Tt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&T.setValue(Tt,"isOrthographic",!0===t.isOrthographicCamera),M!==t&&(M=t,S=!0,I=!0)}if(r.isSkinnedMesh){T.setOptional(Tt,r,"bindMatrix"),T.setOptional(Tt,r,"bindMatrixInverse");const t=r.skeleton;t&&(rt.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(Tt,"boneTexture",t.boneTexture,lt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}r.isBatchedMesh&&(T.setOptional(Tt,r,"batchingTexture"),T.setValue(Tt,"batchingTexture",r._matricesTexture,lt));const B=i.morphAttributes;var D,P;if((void 0!==B.position||void 0!==B.normal||void 0!==B.color&&!0===rt.isWebGL2)&&Et.update(r,i,x),(S||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,T.setValue(Tt,"receiveShadow",r.receiveShadow)),n.isMeshGouraudMaterial&&null!==n.envMap&&(U.envMap.value=l,U.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),S&&(T.setValue(Tt,"toneMappingExposure",y.toneMappingExposure),v.needsLights&&(P=I,(D=U).ambientLightColor.needsUpdate=P,D.lightProbe.needsUpdate=P,D.directionalLights.needsUpdate=P,D.directionalLightShadows.needsUpdate=P,D.pointLights.needsUpdate=P,D.pointLightShadows.needsUpdate=P,D.spotLights.needsUpdate=P,D.spotLightShadows.needsUpdate=P,D.rectAreaLights.needsUpdate=P,D.hemisphereLights.needsUpdate=P),a&&!0===n.fog&&bt.refreshFogUniforms(U,a),bt.refreshMaterialUniforms(U,n,L,R,H),Ua.upload(Tt,Zt(v),U,lt)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Ua.upload(Tt,Zt(v),U,lt),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&T.setValue(Tt,"center",r.center),T.setValue(Tt,"modelViewMatrix",r.modelViewMatrix),T.setValue(Tt,"normalMatrix",r.normalMatrix),T.setValue(Tt,"modelMatrix",r.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++)if(rt.isWebGL2){const i=t[e];It.update(i,x),It.bind(i,x)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return x}(t,e,i,n,r);at.setMaterial(n,o);let l=i.index,c=1;if(!0===n.wireframe){if(l=ut.getWireframeAttribute(i),void 0===l)return;c=2}const h=i.drawRange,d=i.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==a&&(u=Math.max(u,a.start*c),p=Math.min(p,(a.start+a.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const f=p-u;if(f<0||f===1/0)return;let g;St.setup(r,n,s,i,l);let b=Ct;if(null!==l&&(g=dt.get(l),b=Mt,b.setIndex(g)),r.isMesh)!0===n.wireframe?(at.setLineWidth(n.wireframeLinewidth*it()),b.setMode(Tt.LINES)):b.setMode(Tt.TRIANGLES);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),at.setLineWidth(t*it()),r.isLineSegments?b.setMode(Tt.LINES):r.isLineLoop?b.setMode(Tt.LINE_LOOP):b.setMode(Tt.LINE_STRIP)}else r.isPoints?b.setMode(Tt.POINTS):r.isSprite&&b.setMode(Tt.TRIANGLES);if(r.isBatchedMesh)b.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else if(r.isInstancedMesh)b.renderInstances(u,f,r.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);b.renderInstances(u,f,e)}else b.render(u,f)},this.compile=function(t,e,i=null){null===i&&(i=t),m=yt.get(i),m.init(),v.push(m),i.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(m.pushLight(t),t.castShadow&&m.pushShadow(t))})),t!==i&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(m.pushLight(t),t.castShadow&&m.pushShadow(t))})),m.setupLights(y._useLegacyLights);const n=new Set;return t.traverse((function(t){const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const a=e[r];Nt(a,i,t),n.add(a)}else Nt(e,i,t),n.add(e)})),v.pop(),m=null,n},this.compileAsync=function(t,e,i=null){const n=this.compile(t,e,i);return new Promise((e=>{function i(){n.forEach((function(t){st.get(t).currentProgram.isReady()&&n.delete(t)})),0!==n.size?setTimeout(i,10):e(t)}null!==nt.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)}))};let Ot=null;function kt(){Qt.stop()}function zt(){Qt.start()}const Qt=new Vn;function Vt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)m.pushLight(t),t.castShadow&&m.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||z.intersectsSprite(t)){n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(G);const e=pt.update(t),r=t.material;r.visible&&g.push(t,e,r,i,j.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||z.intersectsObject(t))){const e=pt.update(t),r=t.material;if(n&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),j.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),j.copy(e.boundingSphere.center)),j.applyMatrix4(t.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const n=e.groups;for(let a=0,o=n.length;a<o;a++){const o=n[a],s=r[o.materialIndex];s&&s.visible&&g.push(t,e,s,i,j.z,o)}}else r.visible&&g.push(t,e,r,i,j.z,null)}const r=t.children;for(let t=0,a=r.length;t<a;t++)Vt(r[t],e,i,n)}function Gt(t,e,i,n){const r=t.opaque,a=t.transmissive,o=t.transparent;m.setupLightsView(i),!0===Q&&_t.setGlobalState(y.clippingPlanes,i),a.length>0&&function(t,e,i,n){if(null!==(!0===i.isScene?i.overrideMaterial:null))return;const r=rt.isWebGL2;null===H&&(H=new me(1,1,{generateMipmaps:!0,type:nt.has("EXT_color_buffer_half_float")?$:Z,minFilter:q,samples:r?4:0})),y.getDrawingBufferSize(W),r?H.setSize(W.x,W.y):H.setSize(Ht(W.x),Ht(W.y));const a=y.getRenderTarget();y.setRenderTarget(H),y.getClearColor(T),U=y.getClearAlpha(),U<1&&y.setClearColor(16777215,.5),y.clear();const o=y.toneMapping;y.toneMapping=F,Wt(t,i,n),lt.updateMultisampleRenderTarget(H),lt.updateRenderTargetMipmap(H);let s=!1;for(let t=0,r=e.length;t<r;t++){const r=e[t],a=r.object,o=r.geometry,l=r.material,c=r.group;if(2===l.side&&a.layers.test(n.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,Xt(a,i,n,o,l,c),l.side=t,l.needsUpdate=!0,s=!0}}!0===s&&(lt.updateMultisampleRenderTarget(H),lt.updateRenderTargetMipmap(H)),y.setRenderTarget(a),y.setClearColor(T,U),y.toneMapping=o}(r,a,e,i),n&&at.viewport(w.copy(n)),r.length>0&&Wt(r,e,i),a.length>0&&Wt(a,e,i),o.length>0&&Wt(o,e,i),at.buffers.depth.setTest(!0),at.buffers.depth.setMask(!0),at.buffers.color.setMask(!0),at.setPolygonOffset(!1)}function Wt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],o=a.object,s=a.geometry,l=null===n?a.material:n,c=a.group;o.layers.test(i.layers)&&Xt(o,e,i,s,l,c)}}function Xt(t,e,i,n,r,a){t.onBeforeRender(y,e,i,n,r,a),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(y,e,i,n,t,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,y.renderBufferDirect(i,e,n,r,t,a),r.side=0,r.needsUpdate=!0,y.renderBufferDirect(i,e,n,r,t,a),r.side=2):y.renderBufferDirect(i,e,n,r,t,a),t.onAfterRender(y,e,i,n,r,a)}function qt(t,e,i){!0!==e.isScene&&(e=X);const n=st.get(t),r=m.state.lights,a=m.state.shadowsArray,o=r.state.version,s=mt.getParameters(t,r.state,a,e,i),l=mt.getProgramCacheKey(s);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?ht:ct).get(t.envMap||n.environment),void 0===c&&(t.addEventListener("dispose",Pt),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===o)return Yt(t,s),h}else s.uniforms=mt.getUniforms(t),t.onBuild(i,s,y),t.onBeforeCompile(s,y),h=mt.acquireProgram(s,l),c.set(l,h),n.uniforms=s.uniforms;const d=n.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=_t.uniform),Yt(t,s),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=o,n.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix),n.currentProgram=h,n.uniformsList=null,h}function Zt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=Ua.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function Yt(t,e){const i=st.get(t);i.outputColorSpace=e.outputColorSpace,i.batching=e.batching,i.instancing=e.instancing,i.instancingColor=e.instancingColor,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Qt.setAnimationLoop((function(t){Ot&&Ot(t)})),"undefined"!=typeof self&&Qt.setContext(self),this.setAnimationLoop=function(t){Ot=t,Bt.setAnimationLoop(t),null===t?Qt.stop():Qt.start()},Bt.addEventListener("sessionstart",kt),Bt.addEventListener("sessionend",zt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===_)return;!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Bt.enabled&&!0===Bt.isPresenting&&(!0===Bt.cameraAutoUpdate&&Bt.updateCamera(e),e=Bt.getCamera()),!0===t.isScene&&t.onBeforeRender(y,t,e,E),m=yt.get(t,v.length),m.init(),v.push(m),G.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(G),V=this.localClippingEnabled,Q=_t.init(this.clippingPlanes,V),g=vt.get(t,b.length),g.init(),b.push(g),Vt(t,e,0,y.sortObjects),g.finish(),!0===y.sortObjects&&g.sort(D,P),this.info.render.frame++,!0===Q&&_t.beginShadows();const i=m.state.shadowsArray;if(At.render(i,t,e),!0===Q&&_t.endShadows(),!0===this.info.autoReset&&this.info.reset(),xt.render(g,t),m.setupLights(y._useLegacyLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];Gt(g,t,n,n.viewport)}}else Gt(g,t,e);null!==E&&(lt.updateMultisampleRenderTarget(E),lt.updateRenderTargetMipmap(E)),!0===t.isScene&&t.onAfterRender(y,t,e),St.resetDefaultState(),C=-1,M=null,v.pop(),m=v.length>0?v[v.length-1]:null,b.pop(),g=b.length>0?b[b.length-1]:null},this.getActiveCubeFace=function(){return A},this.getActiveMipmapLevel=function(){return x},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(t,e,i){st.get(t.texture).__webglTexture=e,st.get(t.depthTexture).__webglTexture=i;const n=st.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===nt.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const i=st.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){E=t,A=e,x=i;let n=!0,r=null,a=!1,o=!1;if(t){const s=st.get(t);void 0!==s.__useDefaultFramebuffer?(at.bindFramebuffer(Tt.FRAMEBUFFER,null),n=!1):void 0===s.__webglFramebuffer?lt.setupRenderTarget(t):s.__hasExternalTextures&&lt.rebindTextures(t,st.get(t.texture).__webglTexture,st.get(t.depthTexture).__webglTexture);const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=st.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][i]:c[e],a=!0):r=rt.isWebGL2&&t.samples>0&&!1===lt.useMultisampledRTT(t)?st.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[i]:c,w.copy(t.viewport),S.copy(t.scissor),I=t.scissorTest}else w.copy(N).multiplyScalar(L).floor(),S.copy(O).multiplyScalar(L).floor(),I=k;if(at.bindFramebuffer(Tt.FRAMEBUFFER,r)&&rt.drawBuffers&&n&&at.drawBuffers(t,r),at.viewport(w),at.scissor(S),at.setScissorTest(I),a){const n=st.get(t.texture);Tt.framebufferTexture2D(Tt.FRAMEBUFFER,Tt.COLOR_ATTACHMENT0,Tt.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(o){const n=st.get(t.texture),r=e||0;Tt.framebufferTextureLayer(Tt.FRAMEBUFFER,Tt.COLOR_ATTACHMENT0,n.__webglTexture,i||0,r)}C=-1},this.readRenderTargetPixels=function(t,e,i,n,r,a,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=st.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){at.bindFramebuffer(Tt.FRAMEBUFFER,s);try{const o=t.texture,s=o.format,l=o.type;if(s!==et&&wt.convert(s)!==Tt.getParameter(Tt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===$&&(nt.has("EXT_color_buffer_half_float")||rt.isWebGL2&&nt.has("EXT_color_buffer_float"));if(!(l===Z||wt.convert(l)===Tt.getParameter(Tt.IMPLEMENTATION_COLOR_READ_TYPE)||l===K&&(rt.isWebGL2||nt.has("OES_texture_float")||nt.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Tt.readPixels(e,i,n,r,wt.convert(s),wt.convert(l),a)}finally{const t=null!==E?st.get(E).__webglFramebuffer:null;at.bindFramebuffer(Tt.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),a=Math.floor(e.image.height*n);lt.setTexture2D(e,0),Tt.copyTexSubImage2D(Tt.TEXTURE_2D,i,0,0,t.x,t.y,r,a),at.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,a=e.image.height,o=wt.convert(i.format),s=wt.convert(i.type);lt.setTexture2D(i,0),Tt.pixelStorei(Tt.UNPACK_FLIP_Y_WEBGL,i.flipY),Tt.pixelStorei(Tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Tt.pixelStorei(Tt.UNPACK_ALIGNMENT,i.unpackAlignment),e.isDataTexture?Tt.texSubImage2D(Tt.TEXTURE_2D,n,t.x,t.y,r,a,o,s,e.image.data):e.isCompressedTexture?Tt.compressedTexSubImage2D(Tt.TEXTURE_2D,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):Tt.texSubImage2D(Tt.TEXTURE_2D,n,t.x,t.y,o,s,e.image),0===n&&i.generateMipmaps&&Tt.generateMipmap(Tt.TEXTURE_2D),at.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(y.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,s=t.max.z-t.min.z+1,l=wt.convert(n.format),c=wt.convert(n.type);let h;if(n.isData3DTexture)lt.setTexture3D(n,0),h=Tt.TEXTURE_3D;else{if(!n.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");lt.setTexture2DArray(n,0),h=Tt.TEXTURE_2D_ARRAY}Tt.pixelStorei(Tt.UNPACK_FLIP_Y_WEBGL,n.flipY),Tt.pixelStorei(Tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Tt.pixelStorei(Tt.UNPACK_ALIGNMENT,n.unpackAlignment);const d=Tt.getParameter(Tt.UNPACK_ROW_LENGTH),u=Tt.getParameter(Tt.UNPACK_IMAGE_HEIGHT),p=Tt.getParameter(Tt.UNPACK_SKIP_PIXELS),f=Tt.getParameter(Tt.UNPACK_SKIP_ROWS),g=Tt.getParameter(Tt.UNPACK_SKIP_IMAGES),m=i.isCompressedTexture?i.mipmaps[0]:i.image;Tt.pixelStorei(Tt.UNPACK_ROW_LENGTH,m.width),Tt.pixelStorei(Tt.UNPACK_IMAGE_HEIGHT,m.height),Tt.pixelStorei(Tt.UNPACK_SKIP_PIXELS,t.min.x),Tt.pixelStorei(Tt.UNPACK_SKIP_ROWS,t.min.y),Tt.pixelStorei(Tt.UNPACK_SKIP_IMAGES,t.min.z),i.isDataTexture||i.isData3DTexture?Tt.texSubImage3D(h,r,e.x,e.y,e.z,a,o,s,l,c,m.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Tt.compressedTexSubImage3D(h,r,e.x,e.y,e.z,a,o,s,l,m.data)):Tt.texSubImage3D(h,r,e.x,e.y,e.z,a,o,s,l,c,m),Tt.pixelStorei(Tt.UNPACK_ROW_LENGTH,d),Tt.pixelStorei(Tt.UNPACK_IMAGE_HEIGHT,u),Tt.pixelStorei(Tt.UNPACK_SKIP_PIXELS,p),Tt.pixelStorei(Tt.UNPACK_SKIP_ROWS,f),Tt.pixelStorei(Tt.UNPACK_SKIP_IMAGES,g),0===r&&n.generateMipmaps&&Tt.generateMipmap(h),at.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?lt.setTextureCube(t,0):t.isData3DTexture?lt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?lt.setTexture2DArray(t,0):lt.setTexture2D(t,0),at.unbindTexture()},this.resetState=function(){A=0,x=0,E=null,at.reset(),St.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===mt?"display-p3":"srgb",e.unpackColorSpace=re.workingColorSpace===bt?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===ft?ut:3e3}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===ut?ft:gt}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}(class extends Co{}).prototype.isWebGL1Renderer=!0;class Mo extends Qi{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Oi(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const wo=new _e,So=new _e,Io=new Ye,To=new Ze,Uo=new Qe;class Fo extends Ai{constructor(t=new nn,e=new Mo){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)wo.fromBufferAttribute(e,t-1),So.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=wo.distanceTo(So);t.setAttribute("lineDistance",new qi(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Uo.copy(i.boundingSphere),Uo.applyMatrix4(n),Uo.radius+=r,!1===t.ray.intersectsSphere(Uo))return;Io.copy(n).invert(),To.copy(t.ray).applyMatrix4(Io);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new _e,c=new _e,h=new _e,d=new _e,u=this.isLineSegments?2:1,p=i.index,f=i.attributes.position;if(null!==p)for(let i=Math.max(0,a.start),n=Math.min(p.count,a.start+a.count)-1;i<n;i+=u){const n=p.getX(i),r=p.getX(i+1);if(l.fromBufferAttribute(f,n),c.fromBufferAttribute(f,r),To.distanceSqToSegment(l,c,d,h)>s)continue;d.applyMatrix4(this.matrixWorld);const a=t.ray.origin.distanceTo(d);a<t.near||a>t.far||e.push({distance:a,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}else for(let i=Math.max(0,a.start),n=Math.min(f.count,a.start+a.count)-1;i<n;i+=u){if(l.fromBufferAttribute(f,i),c.fromBufferAttribute(f,i+1),To.distanceSqToSegment(l,c,d,h)>s)continue;d.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(d);n<t.near||n>t.far||e.push({distance:n,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}class Bo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)i=this.getPoint(a/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let a;a=e||t*i[r-1];let o,s=0,l=r-1;for(;s<=l;)if(n=Math.floor(s+(l-s)/2),o=i[n]-a,o<0)s=n+1;else{if(!(o>0)){l=n;break}l=n-1}if(n=l,i[n]===a)return n/(r-1);const c=i[n];return(n+(a-c)/(i[n+1]-c))/(r-1)}getTangent(t,e){const i=1e-4;let n=t-i,r=t+i;n<0&&(n=0),r>1&&(r=1);const a=this.getPoint(n),o=this.getPoint(r),s=e||(a.isVector2?new jt:new _e);return s.copy(o).sub(a).normalize(),s}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new _e,n=[],r=[],a=[],o=new _e,s=new Ye;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new _e)}r[0]=new _e,a[0]=new _e;let l=Number.MAX_VALUE;const c=Math.abs(n[0].x),h=Math.abs(n[0].y),d=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),d<=l&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],o),a[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),a[e]=a[e-1].clone(),o.crossVectors(n[e-1],n[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(zt(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(s.makeRotationAxis(o,t))}a[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(zt(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(s.makeRotationAxis(n[i],e*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ro extends Bo{constructor(t=0,e=0,i=1,n=1,r=0,a=2*Math.PI,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(t,e){const i=e||new jt,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);const o=this.aStartAngle+t*r;let s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=s-this.aX,n=l-this.aY;s=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(s,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function Lo(){let t=0,e=0,i=0,n=0;function r(r,a,o,s){t=r,e=o,i=-3*r+3*a-2*o-s,n=2*r-2*a+o+s}return{initCatmullRom:function(t,e,i,n,a){r(e,i,a*(i-t),a*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,a,o,s){let l=(e-t)/a-(i-t)/(a+o)+(i-e)/o,c=(i-e)/o-(n-e)/(o+s)+(n-i)/s;l*=o,c*=o,r(e,i,l,c)},calc:function(r){const a=r*r;return t+e*r+i*a+n*(a*r)}}}const Do=new _e,Po=new Lo,No=new Lo,Oo=new Lo;function ko(t,e,i,n,r){const a=.5*(n-e),o=.5*(r-i),s=t*t;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function zo(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Qo(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}class Vo extends Bo{constructor(t=new jt,e=new jt,i=new jt,n=new jt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new jt){const i=e,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Qo(t,n.x,r.x,a.x,o.x),Qo(t,n.y,r.y,a.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Ho extends Bo{constructor(t=new _e,e=new _e,i=new _e,n=new _e){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new _e){const i=e,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Qo(t,n.x,r.x,a.x,o.x),Qo(t,n.y,r.y,a.y,o.y),Qo(t,n.z,r.z,a.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Go extends Bo{constructor(t=new jt,e=new jt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new jt){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new jt){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Wo extends Bo{constructor(t=new jt,e=new jt,i=new jt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new jt){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(zo(t,n.x,r.x,a.x),zo(t,n.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class jo extends Bo{constructor(t=new _e,e=new _e,i=new _e){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new _e){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(zo(t,n.x,r.x,a.x),zo(t,n.y,r.y,a.y),zo(t,n.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Xo extends Bo{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new jt){const i=e,n=this.points,r=(n.length-1)*t,a=Math.floor(r),o=r-a,s=n[0===a?a:a-1],l=n[a],c=n[a>n.length-2?n.length-1:a+1],h=n[a>n.length-3?n.length-1:a+2];return i.set(ko(o,s.x,l.x,c.x,h.x),ko(o,s.y,l.y,c.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new jt).fromArray(i))}return this}}var qo=Object.freeze({__proto__:null,ArcCurve:class extends Ro{constructor(t,e,i,n,r,a){super(t,e,i,i,n,r,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Bo{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new _e){const i=e,n=this.points,r=n.length,a=(r-(this.closed?0:1))*t;let o,s,l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=n[(l-1)%r]:(Do.subVectors(n[0],n[1]).add(n[0]),o=Do);const h=n[l%r],d=n[(l+1)%r];if(this.closed||l+2<r?s=n[(l+2)%r]:(Do.subVectors(n[r-1],n[r-2]).add(n[r-1]),s=Do),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(h),t),i=Math.pow(h.distanceToSquared(d),t),n=Math.pow(d.distanceToSquared(s),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Po.initNonuniformCatmullRom(o.x,h.x,d.x,s.x,e,i,n),No.initNonuniformCatmullRom(o.y,h.y,d.y,s.y,e,i,n),Oo.initNonuniformCatmullRom(o.z,h.z,d.z,s.z,e,i,n)}else"catmullrom"===this.curveType&&(Po.initCatmullRom(o.x,h.x,d.x,s.x,this.tension),No.initCatmullRom(o.y,h.y,d.y,s.y,this.tension),Oo.initCatmullRom(o.z,h.z,d.z,s.z,this.tension));return i.set(Po.calc(c),No.calc(c),Oo.calc(c)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new _e).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:Vo,CubicBezierCurve3:Ho,EllipseCurve:Ro,LineCurve:Go,LineCurve3:class extends Bo{constructor(t=new _e,e=new _e){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new _e){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new _e){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Wo,QuadraticBezierCurve3:jo,SplineCurve:Xo});class Zo extends Bo{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new qo[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=i){const t=n[r]-i,a=this.curves[r],o=a.getLength(),s=0===o?0:1-t/o;return a.getPointAt(s,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const a=r[n],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o);for(let t=0;t<s.length;t++){const n=s[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new qo[i.type]).fromJSON(i))}return this}}class Yo extends Zo{constructor(t){super(),this.type="Path",this.currentPoint=new jt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Go(this.currentPoint.clone(),new jt(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new Wo(this.currentPoint.clone(),new jt(t,e),new jt(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,a){const o=new Vo(this.currentPoint.clone(),new jt(t,e),new jt(i,n),new jt(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new Xo(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,a){const o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,i,n,r,a),this}absarc(t,e,i,n,r,a){return this.absellipse(t,e,i,i,n,r,a),this}ellipse(t,e,i,n,r,a,o,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,r,a,o,s),this}absellipse(t,e,i,n,r,a,o,s){const l=new Ro(t,e,i,n,r,a,o,s);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Jo extends nn{constructor(t=1,e=1,i=1,n=32,r=1,a=!1,o=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};const l=this;n=Math.floor(n),r=Math.floor(r);const c=[],h=[],d=[],u=[];let p=0;const f=[],g=i/2;let m=0;function b(i){const r=p,a=new jt,f=new _e;let b=0;const v=!0===i?t:e,y=!0===i?1:-1;for(let t=1;t<=n;t++)h.push(0,g*y,0),d.push(0,y,0),u.push(.5,.5),p++;const _=p;for(let t=0;t<=n;t++){const e=t/n*s+o,i=Math.cos(e),r=Math.sin(e);f.x=v*r,f.y=g*y,f.z=v*i,h.push(f.x,f.y,f.z),d.push(0,y,0),a.x=.5*i+.5,a.y=.5*r*y+.5,u.push(a.x,a.y),p++}for(let t=0;t<n;t++){const e=r+t,n=_+t;!0===i?c.push(n,n+1,e):c.push(n+1,n,e),b+=3}l.addGroup(m,b,!0===i?1:2),m+=b}!function(){const a=new _e,b=new _e;let v=0;const y=(e-t)/i;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*s+o,l=Math.sin(r),f=Math.cos(r);b.x=v*l,b.y=-m*i+g,b.z=v*f,h.push(b.x,b.y,b.z),a.set(l,y,f).normalize(),d.push(a.x,a.y,a.z),u.push(e,1-m),c.push(p++)}f.push(c)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=f[e][t],n=f[e+1][t],r=f[e+1][t+1],a=f[e][t+1];c.push(i,n,a),c.push(n,r,a),v+=6}l.addGroup(m,v,0),m+=v}(),!1===a&&(t>0&&b(!0),e>0&&b(!1)),this.setIndex(c),this.setAttribute("position",new qi(h,3)),this.setAttribute("normal",new qi(d,3)),this.setAttribute("uv",new qi(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Jo(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Ko extends Jo{constructor(t=1,e=1,i=32,n=1,r=!1,a=0,o=2*Math.PI){super(0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}static fromJSON(t){return new Ko(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class $o extends Yo{constructor(t){super(t),this.uuid=kt(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new Yo).fromJSON(i))}return this}}function ts(t,e,i,n,r){let a,o;if(r===function(t,e,i,n){let r=0;for(let a=e,o=i-n;a<i;a+=n)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}(t,e,i,n)>0)for(a=e;a<i;a+=n)o=As(a,t[a],t[a+1],o);else for(a=i-n;a>=e;a-=n)o=As(a,t[a],t[a+1],o);return o&&gs(o,o.next)&&(xs(o),o=o.next),o}function es(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!gs(n,n.next)&&0!==fs(n.prev,n,n.next))n=n.next;else{if(xs(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function is(t,e,i,n,r,a,o){if(!t)return;!o&&a&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=hs(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,a,o,s,l,c=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,n=i,s=0,e=0;e<c&&(s++,n=n.nextZ,n);e++);for(l=c;s>0||l>0&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,l--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,c*=2}while(o>1)}(r)}(t,n,r,a);let s,l,c=t;for(;t.prev!==t.next;)if(s=t.prev,l=t.next,a?rs(t,n,r,a):ns(t))e.push(s.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),xs(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?is(t=as(es(t),e,i),e,i,n,r,a,2):2===o&&os(t,e,i,n,r,a):is(es(t),e,i,n,r,a,1);break}}function ns(t){const e=t.prev,i=t,n=t.next;if(fs(e,i,n)>=0)return!1;const r=e.x,a=i.x,o=n.x,s=e.y,l=i.y,c=n.y,h=r<a?r<o?r:o:a<o?a:o,d=s<l?s<c?s:c:l<c?l:c,u=r>a?r>o?r:o:a>o?a:o,p=s>l?s>c?s:c:l>c?l:c;let f=n.next;for(;f!==e;){if(f.x>=h&&f.x<=u&&f.y>=d&&f.y<=p&&us(r,s,a,l,o,c,f.x,f.y)&&fs(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function rs(t,e,i,n){const r=t.prev,a=t,o=t.next;if(fs(r,a,o)>=0)return!1;const s=r.x,l=a.x,c=o.x,h=r.y,d=a.y,u=o.y,p=s<l?s<c?s:c:l<c?l:c,f=h<d?h<u?h:u:d<u?d:u,g=s>l?s>c?s:c:l>c?l:c,m=h>d?h>u?h:u:d>u?d:u,b=hs(p,f,e,i,n),v=hs(g,m,e,i,n);let y=t.prevZ,_=t.nextZ;for(;y&&y.z>=b&&_&&_.z<=v;){if(y.x>=p&&y.x<=g&&y.y>=f&&y.y<=m&&y!==r&&y!==o&&us(s,h,l,d,c,u,y.x,y.y)&&fs(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==o&&us(s,h,l,d,c,u,_.x,_.y)&&fs(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;y&&y.z>=b;){if(y.x>=p&&y.x<=g&&y.y>=f&&y.y<=m&&y!==r&&y!==o&&us(s,h,l,d,c,u,y.x,y.y)&&fs(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==o&&us(s,h,l,d,c,u,_.x,_.y)&&fs(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function as(t,e,i){let n=t;do{const r=n.prev,a=n.next.next;!gs(r,a)&&ms(r,n,n.next,a)&&ys(r,a)&&ys(a,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(a.i/i|0),xs(n),xs(n.next),n=t=a),n=n.next}while(n!==t);return es(n)}function os(t,e,i,n,r,a){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&ps(o,t)){let s=_s(o,t);return o=es(o,o.next),s=es(s,s.next),is(o,e,i,n,r,a,0),void is(s,e,i,n,r,a,0)}t=t.next}o=o.next}while(o!==t)}function ss(t,e){return t.x-e.x}function ls(t,e){const i=function(t,e){let i,n=e,r=-1/0;const a=t.x,o=t.y;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){const t=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=a&&t>r&&(r=t,i=n.x<n.next.x?n:n.next,t===a))return i}n=n.next}while(n!==e);if(!i)return null;const s=i,l=i.x,c=i.y;let h,d=1/0;n=i;do{a>=n.x&&n.x>=l&&a!==n.x&&us(o<c?a:r,o,l,c,o<c?r:a,o,n.x,n.y)&&(h=Math.abs(o-n.y)/(a-n.x),ys(n,t)&&(h<d||h===d&&(n.x>i.x||n.x===i.x&&cs(i,n)))&&(i=n,d=h)),n=n.next}while(n!==s);return i}(t,e);if(!i)return e;const n=_s(i,t);return es(n,n.next),es(i,i.next)}function cs(t,e){return fs(t.prev,t,e.prev)<0&&fs(e.next,t,t.next)<0}function hs(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ds(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function us(t,e,i,n,r,a,o,s){return(r-o)*(e-s)>=(t-o)*(a-s)&&(t-o)*(n-s)>=(i-o)*(e-s)&&(i-o)*(a-s)>=(r-o)*(n-s)}function ps(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ms(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(ys(t,e)&&ys(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(fs(t.prev,t,e.prev)||fs(t,e.prev,e))||gs(t,e)&&fs(t.prev,t,t.next)>0&&fs(e.prev,e,e.next)>0)}function fs(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function gs(t,e){return t.x===e.x&&t.y===e.y}function ms(t,e,i,n){const r=vs(fs(t,e,i)),a=vs(fs(t,e,n)),o=vs(fs(i,n,t)),s=vs(fs(i,n,e));return r!==a&&o!==s||!(0!==r||!bs(t,i,e))||!(0!==a||!bs(t,n,e))||!(0!==o||!bs(i,t,n))||!(0!==s||!bs(i,e,n))}function bs(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function vs(t){return t>0?1:t<0?-1:0}function ys(t,e){return fs(t.prev,t,t.next)<0?fs(t,e,t.next)>=0&&fs(t,t.prev,e)>=0:fs(t,e,t.prev)<0||fs(t,t.next,e)<0}function _s(t,e){const i=new Es(t.i,t.x,t.y),n=new Es(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function As(t,e,i,n){const r=new Es(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function xs(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Es(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Cs{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return Cs.area(t)<0}static triangulateShape(t,e){const i=[],n=[],r=[];Ms(t),ws(i,t);let a=t.length;e.forEach(Ms);for(let t=0;t<e.length;t++)n.push(a),a+=e[t].length,ws(i,e[t]);const o=function(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let a=ts(t,0,r,i,!0);const o=[];if(!a||a.next===a.prev)return o;let s,l,c,h,d,u,p;if(n&&(a=function(t,e,i,n){const r=[];let a,o,s,l,c;for(a=0,o=e.length;a<o;a++)s=e[a]*n,l=a<o-1?e[a+1]*n:t.length,c=ts(t,s,l,n,!1),c===c.next&&(c.steiner=!0),r.push(ds(c));for(r.sort(ss),a=0;a<r.length;a++)i=ls(r[a],i);return i}(t,e,a,i)),t.length>80*i){s=c=t[0],l=h=t[1];for(let e=i;e<r;e+=i)d=t[e],u=t[e+1],d<s&&(s=d),u<l&&(l=u),d>c&&(c=d),u>h&&(h=u);p=Math.max(c-s,h-l),p=0!==p?32767/p:0}return is(a,o,i,s,l,p,0),o}(i,n);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}}function Ms(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function ws(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class Ss extends nn{constructor(t=new $o([new jt(.5,.5),new jt(-.5,.5),new jt(-.5,-.5),new jt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++)a(t[e]);function a(t){const a=[],o=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,l=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,d=void 0!==e.bevelSize?e.bevelSize:h-.1,u=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,g=void 0!==e.UVGenerator?e.UVGenerator:Is;let m,b,v,y,_,A=!1;f&&(m=f.getSpacedPoints(s),A=!0,c=!1,b=f.computeFrenetFrames(s,!1),v=new _e,y=new _e,_=new _e),c||(p=0,h=0,d=0,u=0);const x=t.extractPoints(o);let E=x.shape;const C=x.holes;if(!Cs.isClockWise(E)){E=E.reverse();for(let t=0,e=C.length;t<e;t++){const e=C[t];Cs.isClockWise(e)&&(C[t]=e.reverse())}}const M=Cs.triangulateShape(E,C),w=E;for(let t=0,e=C.length;t<e;t++){const e=C[t];E=E.concat(e)}function S(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}const I=E.length,T=M.length;function U(t,e,i){let n,r,a;const o=t.x-e.x,s=t.y-e.y,l=i.x-t.x,c=i.y-t.y,h=o*o+s*s,d=o*c-s*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(h),u=Math.sqrt(l*l+c*c),p=e.x-s/d,f=e.y+o/d,g=((i.x-c/u-p)*c-(i.y+l/u-f)*l)/(o*c-s*l);n=p+o*g-t.x,r=f+s*g-t.y;const m=n*n+r*r;if(m<=2)return new jt(n,r);a=Math.sqrt(m/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(c)&&(t=!0),t?(n=-s,r=o,a=Math.sqrt(h)):(n=o,r=s,a=Math.sqrt(h/2))}return new jt(n/a,r/a)}const F=[];for(let t=0,e=w.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),F[t]=U(w[t],w[i],w[n]);const B=[];let R,L=F.concat();for(let t=0,e=C.length;t<e;t++){const e=C[t];R=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),R[t]=U(e[t],e[n],e[r]);B.push(R),L=L.concat(R)}for(let t=0;t<p;t++){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=w.length;t<e;t++){const e=S(w[t],F[t],n);N(e.x,e.y,-i)}for(let t=0,e=C.length;t<e;t++){const e=C[t];R=B[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],R[t],n);N(r.x,r.y,-i)}}}const D=d+u;for(let t=0;t<I;t++){const e=c?S(E[t],L[t],D):E[t];A?(y.copy(b.normals[0]).multiplyScalar(e.x),v.copy(b.binormals[0]).multiplyScalar(e.y),_.copy(m[0]).add(y).add(v),N(_.x,_.y,_.z)):N(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<I;e++){const i=c?S(E[e],L[e],D):E[e];A?(y.copy(b.normals[t]).multiplyScalar(i.x),v.copy(b.binormals[t]).multiplyScalar(i.y),_.copy(m[t]).add(y).add(v),N(_.x,_.y,_.z)):N(i.x,i.y,l/s*t)}for(let t=p-1;t>=0;t--){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=w.length;t<e;t++){const e=S(w[t],F[t],n);N(e.x,e.y,l+i)}for(let t=0,e=C.length;t<e;t++){const e=C[t];R=B[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],R[t],n);A?N(r.x,r.y+m[s-1].y,m[s-1].x+i):N(r.x,r.y,l+i)}}}function P(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=s+2*p;t<i;t++){const i=I*t,a=I*(t+1);k(e+n+i,e+r+i,e+r+a,e+n+a)}}}function N(t,e,i){a.push(t),a.push(e),a.push(i)}function O(t,e,r){z(t),z(e),z(r);const a=n.length/3,o=g.generateTopUV(i,n,a-3,a-2,a-1);Q(o[0]),Q(o[1]),Q(o[2])}function k(t,e,r,a){z(t),z(e),z(a),z(e),z(r),z(a);const o=n.length/3,s=g.generateSideWallUV(i,n,o-6,o-3,o-2,o-1);Q(s[0]),Q(s[1]),Q(s[3]),Q(s[1]),Q(s[2]),Q(s[3])}function z(t){n.push(a[3*t+0]),n.push(a[3*t+1]),n.push(a[3*t+2])}function Q(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=I*t;for(let t=0;t<T;t++){const i=M[t];O(i[2]+e,i[1]+e,i[0]+e)}t=s+2*p,e=I*t;for(let t=0;t<T;t++){const i=M[t];O(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<T;t++){const e=M[t];O(e[2],e[1],e[0])}for(let t=0;t<T;t++){const e=M[t];O(e[0]+I*s,e[1]+I*s,e[2]+I*s)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;P(w,e),e+=w.length;for(let t=0,i=C.length;t<i;t++){const i=C[t];P(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new qi(n,3)),this.setAttribute("uv",new qi(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);return i.options=Object.assign({},e),void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}const n=t.options.extrudePath;return void 0!==n&&(t.options.extrudePath=(new qo[n.type]).fromJSON(n)),new Ss(i,t.options)}}const Is={generateTopUV:function(t,e,i,n,r){const a=e[3*i],o=e[3*i+1],s=e[3*n],l=e[3*n+1],c=e[3*r],h=e[3*r+1];return[new jt(a,o),new jt(s,l),new jt(c,h)]},generateSideWallUV:function(t,e,i,n,r,a){const o=e[3*i],s=e[3*i+1],l=e[3*i+2],c=e[3*n],h=e[3*n+1],d=e[3*n+2],u=e[3*r],p=e[3*r+1],f=e[3*r+2],g=e[3*a],m=e[3*a+1],b=e[3*a+2];return Math.abs(s-h)<Math.abs(o-c)?[new jt(o,1-l),new jt(c,1-d),new jt(u,1-f),new jt(g,1-b)]:[new jt(s,1-l),new jt(h,1-d),new jt(p,1-f),new jt(m,1-b)]}};class Ts extends nn{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const s=Math.min(a+o,Math.PI);let l=0;const c=[],h=new _e,d=new _e,u=[],p=[],f=[],g=[];for(let u=0;u<=i;u++){const m=[],b=u/i;let v=0;0===u&&0===a?v=.5/e:u===i&&s===Math.PI&&(v=-.5/e);for(let i=0;i<=e;i++){const s=i/e;h.x=-t*Math.cos(n+s*r)*Math.sin(a+b*o),h.y=t*Math.cos(a+b*o),h.z=t*Math.sin(n+s*r)*Math.sin(a+b*o),p.push(h.x,h.y,h.z),d.copy(h).normalize(),f.push(d.x,d.y,d.z),g.push(s+v,1-b),m.push(l++)}c.push(m)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=c[t][n+1],r=c[t][n],o=c[t+1][n],l=c[t+1][n+1];(0!==t||a>0)&&u.push(e,r,l),(t!==i-1||s<Math.PI)&&u.push(r,o,l)}this.setIndex(u),this.setAttribute("position",new qi(p,3)),this.setAttribute("normal",new qi(f,3)),this.setAttribute("uv",new qi(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ts(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Us extends nn{constructor(t=new jo(new _e(-1,-1,0),new _e(-1,1,0),new _e(1,1,0)),e=64,i=1,n=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r};const a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new _e,s=new _e,l=new jt;let c=new _e;const h=[],d=[],u=[],p=[];function f(r){c=t.getPointAt(r/e,c);const l=a.normals[r],u=a.binormals[r];for(let t=0;t<=n;t++){const e=t/n*Math.PI*2,r=Math.sin(e),a=-Math.cos(e);s.x=a*l.x+r*u.x,s.y=a*l.y+r*u.y,s.z=a*l.z+r*u.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=c.x+i*s.x,o.y=c.y+i*s.y,o.z=c.z+i*s.z,h.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=n;i++)l.x=t/e,l.y=i/n,u.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=n;e++){const i=(n+1)*(t-1)+(e-1),r=(n+1)*t+(e-1),a=(n+1)*t+e,o=(n+1)*(t-1)+e;p.push(i,r,o),p.push(r,a,o)}}()}(),this.setIndex(p),this.setAttribute("position",new qi(h,3)),this.setAttribute("normal",new qi(d,3)),this.setAttribute("uv",new qi(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Us((new qo[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Fs extends Qi{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Oi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Oi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new jt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=I,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}function Bs(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}class Rs{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let a;i:{n:if(!(t<n)){for(let a=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}if(t>=r)break t;{const o=e[1];t<o&&(i=2,r=o);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){const n=i+a>>>1;t<e[n]?a=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ls extends Rs{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-i;break;case 2402:r=n.length-2,o=e+n[r]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=t,s=2*i-e;break;case 2402:a=1,s=i+n[1]-n[0];break;default:a=t-1,s=e}const l=.5*(i-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(s-i),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(i-e)/(n-e),f=p*p,g=f*p,m=-d*g+2*d*f-d*p,b=(1+d)*g+(-1.5-2*d)*f+(-.5+d)*p+1,v=(-1-u)*g+(1.5+u)*f+.5*p,y=u*g-u*f;for(let t=0;t!==o;++t)r[t]=m*a[c+t]+b*a[l+t]+v*a[s+t]+y*a[h+t];return r}}class Ds extends Rs{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=(i-e)/(n-e),h=1-c;for(let t=0;t!==o;++t)r[t]=a[l+t]*h+a[s+t]*c;return r}}class Ps extends Rs{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class Ns{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Bs(e,this.TimeBufferType),this.values=Bs(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Bs(t.times,Array),values:Bs(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Ps(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ds(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ls(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ct:e=this.InterpolantFactoryMethodDiscrete;break;case ht:e=this.InterpolantFactoryMethodLinear;break;case dt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ct;case this.InterpolantFactoryMethodLinear:return ht;case this.InterpolantFactoryMethodSmooth:return dt}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,a=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=i.slice(r,a),this.values=this.values.slice(r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==a&&a>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,a),t=!1;break}a=n}if(void 0!==n&&(o=n,ArrayBuffer.isView(o)&&!(o instanceof DataView)))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}var o;return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===dt,r=t.length-1;let a=1;for(let o=1;o<r;++o){let r=!1;const s=t[o];if(s!==t[o+1]&&(1!==o||s!==t[0]))if(n)r=!0;else{const t=o*i,n=t-i,a=t+i;for(let o=0;o!==i;++o){const i=e[t+o];if(i!==e[n+o]||i!==e[a+o]){r=!0;break}}}if(r){if(o!==a){t[a]=t[o];const n=o*i,r=a*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++a}}if(r>0){t[a]=t[r];for(let t=r*i,n=a*i,o=0;o!==i;++o)e[n+o]=e[t+o];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}Ns.prototype.TimeBufferType=Float32Array,Ns.prototype.ValueBufferType=Float32Array,Ns.prototype.DefaultInterpolation=ht;class Os extends Ns{}Os.prototype.ValueTypeName="bool",Os.prototype.ValueBufferType=Array,Os.prototype.DefaultInterpolation=ct,Os.prototype.InterpolantFactoryMethodLinear=void 0,Os.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends Ns{}).prototype.ValueTypeName="color";(class extends Ns{}).prototype.ValueTypeName="number";class ks extends Rs{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(i-e)/(n-e);let l=t*o;for(let t=l+o;l!==t;l+=4)ye.slerpFlat(r,0,a,l-o,a,l,s);return r}}class zs extends Ns{InterpolantFactoryMethodLinear(t){return new ks(this.times,this.values,this.getValueSize(),t)}}zs.prototype.ValueTypeName="quaternion",zs.prototype.DefaultInterpolation=ht,zs.prototype.InterpolantFactoryMethodSmooth=void 0;class Qs extends Ns{}Qs.prototype.ValueTypeName="string",Qs.prototype.ValueBufferType=Array,Qs.prototype.DefaultInterpolation=ct,Qs.prototype.InterpolantFactoryMethodLinear=void 0,Qs.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends Ns{}).prototype.ValueTypeName="vector";const Vs={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Hs{constructor(t,e,i){const n=this;let r,a=!1,o=0,s=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){s++,!1===a&&void 0!==n.onStart&&n.onStart(t,o,s),a=!0},this.itemEnd=function(t){o++,void 0!==n.onProgress&&n.onProgress(t,o,s),o===s&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Gs=new Hs;class Ws{constructor(t){this.manager=void 0!==t?t:Gs,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ws.DEFAULT_MATERIAL_NAME="__DEFAULT";const js={};class Xs extends Error{constructor(t,e){super(t),this.response=e}}class qs extends Ws{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Vs.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==js[t])return void js[t].push({onLoad:e,onProgress:i,onError:n});js[t]=[],js[t].push({onLoad:e,onProgress:i,onError:n});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,s=this.responseType;fetch(a).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=js[t],n=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),a=r?parseInt(r):0,o=0!==a;let s=0;const l=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:r})=>{if(n)t.close();else{s+=r.byteLength;const n=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(r),e()}}))}()}});return new Response(l)}throw new Xs(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(s){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,o)));case"json":return t.json();default:if(void 0===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(o),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{Vs.add(t,e);const i=js[t];delete js[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=js[t];if(void 0===i)throw this.manager.itemError(t),e;delete js[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}const Zs="\\[\\]\\.:\\/",Ys=new RegExp("["+Zs+"]","g"),Js="[^"+Zs+"]",Ks="[^"+Zs.replace("\\.","")+"]",$s=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Js)+/(WCOD+)?/.source.replace("WCOD",Ks)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Js)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Js)+"$"),tl=["material","materials","bones","map"];class el{constructor(t,e,i){this.path=e,this.parsedPath=i||el.parseTrackName(e),this.node=el.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new el.Composite(t,e,i):new el(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ys,"")}static parseTrackName(t){const e=$s.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==tl.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const a=i(r.children);if(a)return a}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=el.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const a=t[n];if(void 0===a){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}s=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(s=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}el.Composite=class{constructor(t,e,i){const n=i||el.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},el.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},el.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},el.prototype.GetterByBindingType=[el.prototype._getValue_direct,el.prototype._getValue_array,el.prototype._getValue_arrayElement,el.prototype._getValue_toArray],el.prototype.SetterByBindingTypeAndVersioning=[[el.prototype._setValue_direct,el.prototype._setValue_direct_setNeedsUpdate,el.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[el.prototype._setValue_array,el.prototype._setValue_array_setNeedsUpdate,el.prototype._setValue_array_setMatrixWorldNeedsUpdate],[el.prototype._setValue_arrayElement,el.prototype._setValue_arrayElement_setNeedsUpdate,el.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[el.prototype._setValue_fromArray,el.prototype._setValue_fromArray_setNeedsUpdate,el.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1);class il{constructor(){this.type="ShapePath",this.color=new Oi,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Yo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,a){return this.currentPath.bezierCurveTo(t,e,i,n,r,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let n=!1;for(let r=i-1,a=0;a<i;r=a++){let i=e[r],o=e[a],s=o.x-i.x,l=o.y-i.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(i=e[a],s=-s,o=e[r],l=-l),t.y<i.y||t.y>o.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=l*(t.x-i.x)-s*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(o.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=o.x)return!0}}return n}const i=Cs.isClockWise,n=this.subPaths;if(0===n.length)return[];let r,a,o;const s=[];if(1===n.length)return a=n[0],o=new $o,o.curves=a.curves,s.push(o),s;let l=!i(n[0].getPoints());l=t?!l:l;const c=[],h=[];let d,u,p=[],f=0;h[f]=void 0,p[f]=[];for(let e=0,o=n.length;e<o;e++)a=n[e],d=a.getPoints(),r=i(d),r=t?!r:r,r?(!l&&h[f]&&f++,h[f]={s:new $o,p:d},h[f].s.curves=a.curves,l&&f++,p[f]=[]):p[f].push({h:a,p:d[0]});if(!h[0])return function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new $o;r.curves=n.curves,e.push(r)}return e}(n);if(h.length>1){let t=!1,i=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let n=0,r=h.length;n<r;n++){const r=p[n];for(let a=0;a<r.length;a++){const o=r[a];let s=!0;for(let r=0;r<h.length;r++)e(o.p,h[r].p)&&(n!==r&&i++,s?(s=!1,c[r].push(o)):t=!0);s&&c[n].push(o)}}i>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){o=h[t].s,s.push(o),u=p[t];for(let t=0,e=u.length;t<e;t++)o.holes.push(u[t].h)}return s}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:n}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=n)},4385:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TextGeometry:()=>r});var n=i(9437);class r extends n.QCA{constructor(t,e={}){const i=e.font;if(void 0===i)super();else{const n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(n,e)}this.type="TextGeometry"}}},4264:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Font:()=>a,FontLoader:()=>r});var n=i(9437);class r extends n.aHM{constructor(t){super(t)}load(t,e,i,r){const a=this,o=new n.Y9S(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){const i=a.parse(JSON.parse(t));e&&e(i)}),i,r)}parse(t){return new a(t)}}class a{constructor(t){this.isFont=!0,this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),r=e/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,s=[];let l=0,c=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)l=0,c-=a;else{const t=o(e,r,l,c,i);l+=t.offsetX,s.push(t.path)}}return s}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)i.push(...n[t].toShapes());return i}}function o(t,e,i,r,a){const o=a.glyphs[t]||a.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+a.familyName+".");const s=new n.Ld9;let l,c,h,d,u,p,f,g;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let n=0,a=t.length;n<a;)switch(t[n++]){case"m":l=t[n++]*e+i,c=t[n++]*e+r,s.moveTo(l,c);break;case"l":l=t[n++]*e+i,c=t[n++]*e+r,s.lineTo(l,c);break;case"q":h=t[n++]*e+i,d=t[n++]*e+r,u=t[n++]*e+i,p=t[n++]*e+r,s.quadraticCurveTo(u,p,h,d);break;case"b":h=t[n++]*e+i,d=t[n++]*e+r,u=t[n++]*e+i,p=t[n++]*e+r,f=t[n++]*e+i,g=t[n++]*e+r,s.bezierCurveTo(u,p,f,g,h,d)}}return{offsetX:o.ha*e,path:s}}},8823:(t,e,i)=>{"use strict";i.r(e),i.d(e,{DEG2RAD:()=>a,MathUtils:()=>T,RAD2DEG:()=>o,ceilPowerOfTwo:()=>C,clamp:()=>l,damp:()=>p,degToRad:()=>A,denormalize:()=>S,euclideanModulo:()=>c,floorPowerOfTwo:()=>M,generateUUID:()=>s,inverseLerp:()=>d,isPowerOfTwo:()=>E,lerp:()=>u,mapLinear:()=>h,normalize:()=>I,pingpong:()=>f,radToDeg:()=>x,randFloat:()=>v,randFloatSpread:()=>y,randInt:()=>b,seededRandom:()=>_,setQuaternionFromProperEuler:()=>w,smootherstep:()=>m,smoothstep:()=>g});const n=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let r=1234567;const a=Math.PI/180,o=180/Math.PI;function s(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(n[255&t]+n[t>>8&255]+n[t>>16&255]+n[t>>24&255]+"-"+n[255&e]+n[e>>8&255]+"-"+n[e>>16&15|64]+n[e>>24&255]+"-"+n[63&i|128]+n[i>>8&255]+"-"+n[i>>16&255]+n[i>>24&255]+n[255&r]+n[r>>8&255]+n[r>>16&255]+n[r>>24&255]).toLowerCase()}function l(t,e,i){return Math.max(e,Math.min(i,t))}function c(t,e){return(t%e+e)%e}function h(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)}function d(t,e,i){return t!==e?(i-t)/(e-t):0}function u(t,e,i){return(1-i)*t+i*e}function p(t,e,i,n){return u(t,e,1-Math.exp(-i*n))}function f(t,e=1){return e-Math.abs(c(t,2*e)-e)}function g(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function m(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function b(t,e){return t+Math.floor(Math.random()*(e-t+1))}function v(t,e){return t+Math.random()*(e-t)}function y(t){return t*(.5-Math.random())}function _(t){void 0!==t&&(r=t);let e=r+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function A(t){return t*a}function x(t){return t*o}function E(t){return!(t&t-1)&&0!==t}function C(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function M(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function w(t,e,i,n,r){const a=Math.cos,o=Math.sin,s=a(i/2),l=o(i/2),c=a((e+n)/2),h=o((e+n)/2),d=a((e-n)/2),u=o((e-n)/2),p=a((n-e)/2),f=o((n-e)/2);switch(r){case"XYX":t.set(s*h,l*d,l*u,s*c);break;case"YZY":t.set(l*u,s*h,l*d,s*c);break;case"ZXZ":t.set(l*d,l*u,s*h,s*c);break;case"XZX":t.set(s*h,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*h,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function S(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 I(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const T={DEG2RAD:a,RAD2DEG:o,generateUUID:s,clamp:l,euclideanModulo:c,mapLinear:h,inverseLerp:d,lerp:u,damp:p,pingpong:f,smoothstep:g,smootherstep:m,randInt:b,randFloat:v,randFloatSpread:y,seededRandom:_,degToRad:A,radToDeg:x,isPowerOfTwo:E,ceilPowerOfTwo:C,floorPowerOfTwo:M,setQuaternionFromProperEuler:w,normalize:I,denormalize:S}}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.d=(t,e)=>{for(var i in e)__webpack_require__.o(e,i)&&!__webpack_require__.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__(7511),__webpack_require__(9522),__webpack_require__(662),__webpack_require__(6776),__webpack_require__(4601),__webpack_require__(2240),__webpack_require__(8394),__webpack_require__(5723),__webpack_require__(7619),__webpack_require__(3877),__webpack_require__(9722),__webpack_require__(9781),__webpack_require__(9530),__webpack_require__(7232),__webpack_require__(7040),__webpack_require__(575),__webpack_require__(7100),__webpack_require__(8550),__webpack_require__(1987),__webpack_require__(7552),__webpack_require__(647),__webpack_require__(8628),__webpack_require__(6173),__webpack_require__(6363),__webpack_require__(4483),__webpack_require__(9825),__webpack_require__(9632),__webpack_require__(577),__webpack_require__(3337),__webpack_require__(4330),__webpack_require__(1392),__webpack_require__(3773),__webpack_require__(7026),__webpack_require__(6110),__webpack_require__(4738),__webpack_require__(5852),__webpack_require__(8566),__webpack_require__(80),__webpack_require__(8630),__webpack_require__(4078),__webpack_require__(3285),__webpack_require__(4324),__webpack_require__(9590),pauseButton=__webpack_require__(5379),playButton=__webpack_require__(6457),skipButton=__webpack_require__(4906),rewindButton=__webpack_require__(5126),tooltip=__webpack_require__(5298),FontLoader=__webpack_require__(4264),TextGeometry=__webpack_require__(4385)})();
2
+ (()=>{var __webpack_modules__={9590:t=>{t.exports.NotiBuffer=class{constructor(t,e){this.currentId=0,this.notifiers={},this.data,this.function1=t,this.function2=e}set(t){console.log("produced",t),this.data=t;for(const t of Object.values(this.notifiers))t(this.data)}register(t,e){void 0!==this.data&&(console.log("Data was ready"),t(this.data));let i=this.currentId;return this.notifiers[i]=t,this.currentId++,e&&this.function1&&this.function1(e),i}unregister(t,e){delete this.notifiers[t],e&&this.function2&&this.function2(e)}}},4601:(t,e,i)=>{let n=i(1392).findProdComponent,r=i(1392).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const a=i(9590).NotiBuffer;AFRAME.registerComponent("babia-filter",{schema:{from:{type:"string"},filter:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new a},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.filter===t.filter)e.from===t.from&&e.filter===t.filter||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-filter"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=r(e.data);this.processData(t)}},remove:function(){},pause:function(){},play:function(){},prodComponent:void 0,notiBufferId:void 0,processData:function(t){let e,i=this.data.filter.split("=");i[0]&&i[1]?(e=t.filter((t=>t[i[0]]==i[1])),this.notiBuffer.set(e)):console.error("Error on filter, please use key=value syntax")}})},8394:(t,e,i)=>{let n=i(1392).findProdComponent,r=i(1392).findNavComponent,a=i(1392).parseJson;class o{constructor(t,e,i,n,r,a){this.field=t,this.step=i||1,this.speed=n||1,this.current=-2==e?0:e,this.state=r||"play",this.direction=a||"forward"}updateData(t){this.data={};for(let e of t){let t=e[this.field];this.data[t]?this.data[t].push(e):this.data[t]=[e]}this.selectors=Object.keys(this.data).sort(),this.length=this.selectors.length}next(){let t=this.data[this.selectors[this.current]];return this.current+this.step<=this.length-1?this.current+=this.step:(this.current=this.length-1,this.current=this.length),t}prev(){let t=this.data[this.selectors[this.current]];return this.current-this.step>=0?this.current-=this.step:this.current=-1,t}setValue(t){let e=this.data[this.selectors[t]];return"rewind"!=this.direction?t>this.length?this.current=this.length:this.current=t<1?1:t+1:t>this.length-2?this.current=this.length-2:this.current=t<-1?-1:t-1,e}}if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const s=i(9590).NotiBuffer;AFRAME.registerComponent("babia-selector",{schema:{from:{type:"string"},controller:{type:"string",default:""},select:{type:"string",default:"date"},timeout:{type:"number",default:6e3},data:{type:"string"},current_value:{type:"number",default:-2},speed:{type:"number",default:0},step:{type:"number",default:0},direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,interval:void 0,init:function(){this.notiBuffer=new s,this.navNotiBuffer=new s,this.selectable=new o(this.data.select,this.data.current_value,this.data.step,this.data.speed)},babiaMetadata:{id:0},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from&&(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-selector"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));if(e.controller&&e.controller!=t.controller&&(this.selectorController=document.querySelector("#"+e.controller),this.navComponent&&(this.navComponent.notiBuffer.unregister(this.navNotiBufferId,this),i.components.networked&&this.removeOldNavListener(this.navComponent.el)),this.navComponent=r(e,i),this.navComponent.notiBuffer&&(this.navNotiBufferId=this.navComponent.notiBuffer.register(this.processEvent.bind(this),this)),i.components.networked&&this.addMultiuserMode(this.navComponent.el)),e.direction&&e.direction!=t.direction&&("rewind"!=e.direction?(this.selectable.current!=this.selectable.length&&(this.selectable.current+=2),this.navNotiBuffer&&this.navNotiBuffer.set("forward")):(this.selectable.current<1?this.selectable.current=0:this.selectable.current-=2,this.navNotiBuffer&&this.navNotiBuffer.set("rewind"))),e.step&&e.step!=this.selectable.step&&(this.selectable.step=e.step,this.navNotiBuffer.set({type:"step",value:e.step}),"rewind"!=this.data.direction?this.selectable.current+e.step>this.selectable.length?this.selectable.current=this.selectable.length:this.selectable.current+=e.step-1:this.selectable.current-e.step<=0?this.selectable.current=-1:this.selectable.current-=e.step+1),e.speed&&e.speed!=this.selectable.speed){this.selectable.speed=e.speed;let t=this.data.timeout/e.speed;this.navNotiBuffer.set({type:"speed",value:e.speed});let i=this;clearInterval(this.interval),this.interval=window.setInterval((function(){i.loop()}),t)}i.components.networked&&i.components.networked.data.owner!=NAF.clientId&&"scene"!=i.components.networked.data.owner&&(-2!=e.current_value&&e.current_value!=t.current_value&&("rewind"!=e.direction?(this.navNotiBuffer.set({type:"position",value:e.current_value-1,label:this.selectable.selectors[e.current_value-1]}),this.setSelect(e.current_value-1)):(this.navNotiBuffer.set({type:"position",value:e.current_value+1,label:this.selectable.selectors[e.current_value+1]}),this.setSelect(e.current_value+1))),"pause"==e.state&&e.state!=t.state&&this.navNotiBuffer.set("pause"))},nextSelect:function(){this.selectable.current>this.selectable.length-1?(this.selectable.current=this.selectable.length,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause")):(this.newData=this.selectable.next(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]}),this.babiaMetadata={id:this.selectable.current})},prevSelect:function(){this.selectable.current>=0?(this.newData=this.selectable.prev(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current+1]}),this.babiaMetadata={id:this.selectable.current}):(this.selectable.current=-1,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause"))},setSelect:function(t){if(t!=this.selectable.current-1&&"rewind"!=this.data.direction||t!=this.selectable.current+1&&"rewind"===this.data.direction){let e;this.newData=this.selectable.setValue(t),"rewind"!=this.data.direction?(this.babiaMetadata={id:t++},e=this.selectable.selectors[t-1]):(this.babiaMetadata={id:t--},this.selectable.current-=2,e=this.selectable.selectors[t+1]),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:t,label:e})}},loop:function(){"pause"!=this.data.state&&("rewind"!=this.data.direction?this.nextSelect():this.prevSelect())},prodComponent:void 0,navComponent:void 0,prodNotiBufferId:void 0,navNotiBufferId:void 0,newData:void 0,processData:function(t){this.selectable.updateData(t),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]});let e=this;this.nextSelect(),this.interval=window.setInterval((function(){e.loop()}),e.data.timeout*e.selectable.speed)},processEvent:function(t){if(t.includes("pause"))this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause");else if(t.includes("play"))this.selectable.state="play",this.el.setAttribute("babia-selector","state","play");else if(t.includes("forward"))this.selectable.direction="forward",this.el.setAttribute("babia-selector","direction","forward");else if(t.includes("rewind"))this.selectable.direction="rewind",this.el.setAttribute("babia-selector","direction","rewind");else if(t.includes("babiaSetPosition")){this.selectable.state="pause";let e=parseInt(t.substring(16),10);"rewind"!=this.data.direction?this.el.setAttribute("babia-selector",{state:"pause",current_value:e+1}):this.el.setAttribute("babia-selector",{state:"pause",current_value:e-1}),this.setSelect(e),this.navNotiBuffer.set("pause")}else t.includes("babiaSetStep")?this.el.setAttribute("babia-selector","step",parseInt(t.substring(12),10)):t.includes("babiaSetSpeed")&&this.el.setAttribute("babia-selector","speed",parseInt(t.substring(13),10))},removeOldNavListener:function(t){t.removeEventListener("click",(function(){NAF.utils.isMine(selector)||"scene"==selector.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(selector)}))},addMultiuserMode:function(t){let e=this.el;function i(){t.children[1].setAttribute("visible",!1),t.children[2].setAttribute("visible",!1),t.children[3].setAttribute("visible",!1)}document.body.addEventListener("clientConnected",(function(t){let n=t.detail.clientId;console.log("clientConnected event. clientId =",n),console.log("Selector owner: ",e.components.networked.data.owner);let r=!0;if("scene"==e.components.networked.data.owner){for(let t in NAF.connection.getConnectedClients()){let e=NAF.connection.getConnectedClients()[t].roomJoinTime,i=NAF.connection.adapter._myRoomJoinTime;console.log("Other: ",e),console.log("Mine: ",i),i>e&&(r=!1)}r?NAF.utils.takeOwnership(e):(console.log("I'm not first"),i())}else e.components.networked.data.owner!=NAF.clientId&&i()})),t.addEventListener("click",(function(){NAF.utils.isMine(e)||"scene"==e.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(e)})),e.addEventListener("ownership-gained",(e=>{console.log("Selector ownership gained"),t.children[1].setAttribute("visible",!0),t.children[2].setAttribute("visible",!0),t.children[3].setAttribute("visible",!0)})),e.addEventListener("ownership-lost",(t=>{console.log("Selector ownership lost"),i()}))}})},2240:(e,i,n)=>{let r=n(1392).findProdComponent,a=n(1392).parseJson;const o=n(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(e,i,n){for(t=0;t<e.length&&e[t][i]!==n;)t++;return t<e.length&&e[t]}AFRAME.registerComponent("babia-treebuilder",{schema:{from:{type:"string"},field:{type:"string"},split_by:{type:"string",default:"/"},build_root:{type:"boolean",default:!1},root_name:{type:"string",default:"Main"},data:{type:"string"}},multiple:!1,prodComponent:void 0,notiBufferId:void 0,init:function(){this.notiBuffer=new o},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.field===t.field&&e.split_by===t.split_by)e.from===t.from&&e.field===t.field&&e.split_by===t.split_by||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,i,"babia-treebuilder"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=a(e.data);this.processData(t)}},processData:function(t){let e=this.data,i=[],n=i;e.build_root&&(i=[{name:e.root_name,id:"",children:[]}],n=i[0].children);for(let i=0;i<t.length;i++){let r=t[i][e.field].split(e.split_by),a=n,o="";for(let n=0;n<r.length;n++){if(!r[n])continue;let l=r[n],c=s(a,"name",l);if(c)a=c.children,o=c.uid;else{let s={};n===r.length-1?s=t[i]:s.children=[],s.uid=o?o+e.split_by+l:l,s.name=l,a.push(s),a=s.children,o=s.uid}}}this.notiBuffer.set(i)}})},3285:(t,e,i)=>{i(1392).colors,AFRAME.registerComponent("babia-bar",{schema:{height:{type:"number"},width:{type:"number"},depth:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""},labelLookat:{type:"string",default:"[camera]"},labelScale:{type:"number",default:1}},init:function(){console.log("Starting bar:",this.data.height,this.data.color);let t=this.data;this.box=document.createElement("a-entity"),this.box.classList.add("babiaxraycasterclass"),this.el.appendChild(this.box);let e={};e=t.animation?{height:0,width:t.width,depth:t.depth}:{height:t.height,width:t.width,depth:t.depth},this.box.setAttribute("geometry",{primitive:"box",height:e.height,width:e.width,depth:e.depth}),this.box.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.box;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","width",e.animation,e.width,t.width),this.updateProperty(i,"geometry","depth",e.animation,e.depth,t.depth),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let o=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:o.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8),oldHeight=t.height||0,oldDepth=t.depth||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.6,z:.7*e.depth},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText}),e.labelLookat&&t.labelLookat!==e.labelLookat&&this.labelEl.setAttribute("babia-lookat",e.labelLookat),e.labelScale&&t.labelScale!==e.labelScale&&this.labelEl.setAttribute("scale",{x:e.labelScale,y:e.labelScale,z:e.labelScale})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},4324:(t,e,i)=>{i(1392).colors,AFRAME.registerComponent("babia-cyl",{schema:{height:{type:"number"},radius:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""},labelLookat:{type:"string",default:"[camera]"}},init:function(){console.log("Starting cyl:",this.data.height,this.data.color);let t=this.data;this.cylinder=document.createElement("a-entity"),this.cylinder.classList.add("babiaxraycasterclass"),this.el.appendChild(this.cylinder);let e={};e=t.animation?{height:0,radius:t.radius}:{height:t.height,radius:t.radius},this.cylinder.setAttribute("geometry",{primitive:"cylinder",height:e.height,radius:e.radius}),this.cylinder.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.cylinder;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","radius",e.animation,e.radius,t.radius),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let o=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:o.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8),oldHeight=t.height||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.7,z:.7*e.radius},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText}),e.labelLookat&&t.labelLookat!==e.labelLookat&&this.labelEl.setAttribute("babia-lookat",e.labelLookat),e.labelScale&&t.labelScale!==e.labelScale&&this.labelEl.setAttribute("scale",{x:e.labelScale,y:e.labelScale,z:e.labelScale})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},4330:(t,e,i)=>{const n=i(1392).colors;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");class r{constructor(t,e,i,n){this.el=t,this.axis=e,this.anim=i,this.dur=n}updateLine(t,e){const i=this.axis,n=this.el,r=this.anim,a=this.dur,o=`line__${i}axis`;let s=n.components[o],l={x:0,y:0,z:0};l[i]=t,r&&s?(n.setAttribute(`animation__${i}axis`,{property:`${o}.end`,to:l,dur:a}),n.setAttribute(o,{color:e})):n.setAttribute(o,{start:{x:0,y:0,z:0},end:l,color:e})}removeLabels(){const t=this.el,e=this.anim,i=this.dur;let n=t.querySelectorAll("[text]");for(const t of n)e?(t.addEventListener("animationcomplete",(function(t){t.target.remove()})),t.setAttribute("animation",{property:"text.opacity",to:0,dur:i})):t.remove()}updateLabels(t,e,i,r,a){const o=this.axis;let s=this.el;const l=this.anim,c=this.dur;for(let h=0;h<t.length;++h){let d,u=document.createElement("a-entity"),p=i;r&&(p=n.get(h,r)),u.setAttribute("text",{value:e[h],align:"right",width:10,color:p,opacity:0}),"behind"!=a&&"right"!=a||u.setAttribute("text",{align:"left"}),"x"===o?d="behind"==a?{x:t[h],y:0,z:-5.15}:{x:t[h],y:0,z:5.25}:"y"===o?d="right"==a?{x:5.2,y:t[h],z:0}:{x:-5.2,y:t[h],z:0}:"z"===o&&(d="right"==a?{x:5.2,y:0,z:t[h]}:{x:-5.2,y:0,z:t[h]}),u.setAttribute("position",d),"x"===o?u.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===o&&u.setAttribute("rotation",{x:-90,y:0,z:0}),l?u.setAttribute("animation",{property:"text.opacity",to:1,dur:c}):u.setAttribute("text",{opacity:1}),s.appendChild(u)}}updateName(t,e,i){const n=this.axis;let r=this.el;const a=this.anim,o=this.dur;let s,l=document.createElement("a-entity");l.setAttribute("text",{value:t,align:"right",width:10,color:"#000",opacity:0}),"behind"!=e&&"right"!=e||l.setAttribute("text",{align:"left"}),"x"===n?s="behind"==e?{x:i+.5,y:0,z:-5.15}:{x:i+.5,y:0,z:5.25}:"y"===n?s="right"==e?{x:5.2,y:i+.5,z:0}:{x:-5.2,y:i+.5,z:0}:"z"===n&&(s="right"==e?{x:5.2,y:0,z:i+.5}:{x:-5.2,y:0,z:i+.5}),l.setAttribute("position",s),"x"===n?l.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===n&&l.setAttribute("rotation",{x:-90,y:0,z:0}),a?l.setAttribute("animation",{property:"text.opacity",to:1,dur:o}):l.setAttribute("text",{opacity:1}),r.appendChild(l)}}AFRAME.registerComponent("babia-axis-y",{schema:{maxValue:{type:"number"},length:{type:"number"},minSteps:{type:"number",default:6},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"y",this.data.animation,this.data.dur)},update:function(t){const e=this.data;let i=this.data.maxValue,n=this.data.length,r=this.data.minSteps;this.data.animation,this.data.dur;let a=0;if(console.log("Starting babia-axis-y:",i,n,this.data.color),i!=t.maxValue||n!=t.maxValue||r!=t.minSteps){let t=Math.floor(Math.log10(i));t<=0&&(a=1-t);let o=n/i,s=Math.pow(10,t),l=i/s;for(;l<=r;)s/=2,l=i/s;this.axis.updateLine(n,e.color),this.axis.removeLabels();let c=[],h=[];for(let t=1;s*t<i;t++)vtick=s*t,c.push(vtick*o),h.push(vtick.toFixed(a));this.axis.updateLabels(c,h,e.color,e.palette,e.align)}e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-x",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"front"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"x",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-x:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-z",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"z",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-z:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}})},5852:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-camera",{schema:{raycasterMouse:{type:"string",default:".babiaxraycasterclass"},raycasterHand:{type:"string",default:".babiaxraycasterclass"},tipsOpened:{type:"boolean",default:!0},gripRLabel:{type:"string",default:"Open/Close \nTips"},gripLLabel:{type:"string",default:"Stop Audio"},triggerRLabel:{type:"string",default:"Click"},triggerLLabel:{type:"string",default:"Teleport"},teleportCollisions:{type:"string",default:".environmentGround"}},multiple:!1,init:function(){},update:function(t){this.data!=this.oldData&&((this.cursor||this.leftHand||this.rightHand)&&(this.el.parentElement.removeChild(this.cursor),this.el.parentElement.removeChild(this.leftHand),this.el.parentElement.removeChild(this.rightHand),this.cursor=void 0,this.leftHand=void 0,this.rightHand=void 0),this.addCursor(),this.setOculusConnected())},addCursor:function(){this.cursor=document.createElement("a-entity"),this.cursor.id="cursor",this.cursor.setAttribute("cursor",{rayOrigin:"mouse"}),this.cursor.setAttribute("raycaster",{objects:this.data.raycasterMouse}),this.el.parentElement.append(this.cursor)},createTip:function(t,e,i){let n=document.createElement("a-entity");return n.id=t,n.classList.add("tips"),n.setAttribute("tooltip",e),n.setAttribute("position",i),n},setOculusConnected:function(){let t=this;t.tooltips=[],t.leftHand=document.createElement("a-entity"),t.leftHand.id="babia-leftHand",t.leftHand.setAttribute("oculus-touch-controls",{hand:"left"}),t.el.parentElement.append(t.leftHand),t.rightHand=document.createElement("a-entity"),t.rightHand.id="babia-rightHand",t.rightHand.setAttribute("oculus-touch-controls",{hand:"right"}),t.el.parentElement.append(t.rightHand),document.addEventListener("controllerconnected",(e=>{let i=t.el.parentElement.object3D.position;t.el.parentElement.setAttribute("position",{x:i.x,y:0,z:i.z}),"babia-leftHand"===e.target.id&&(t.leftHand.setAttribute("teleport-controls",{cameraRig:`#${t.el.parentElement.id}`,teleportOrigin:`#${t.el.id}`,collisionEntities:t.data.teleportCollisions,hitCylinderColor:"#ff3468",curveHitColor:"#ff3468",curveMissColor:"#333333",curveLineWidth:.01,button:"trigger"}),tipTriggerLconfig={text:t.data.triggerLLabel,width:.07,height:.03,targetPosition:"0.002 -0.02 -0.014",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipTriggerLpos={x:-.09,y:-.04,z:-.08},t.tipTriggerL=this.createTip("babia-tooltip_trigger_L",tipTriggerLconfig,tipTriggerLpos),t.leftHand.append(t.tipTriggerL),t.tooltips.push(t.tipTriggerL),tipGripLconfig={text:t.data.gripLLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",rotation:"-90 0 0",src:tooltip.default},tipGripLpos={x:.085,y:-.01,z:.07},t.tipGripL=this.createTip("babia-tooltip_grip_L",tipGripLconfig,tipGripLpos),t.leftHand.append(t.tipGripL),t.tooltips.push(t.tipGripL)),"babia-rightHand"===e.target.id&&(t.rightHand.setAttribute("laser-controls",{hand:"right"}),t.rightHand.setAttribute("raycaster",{objects:this.data.raycasterHand,lineOpacity:1}),tipTriggerRconfig={text:t.data.triggerRLabel,width:.07,height:.03,targetPosition:"0.005 -0.02 -0.014",lineHorizontalAlign:"left",rotation:"-90 0 0",src:tooltip.default},tipTriggerRpos={x:-.09,y:-.04,z:-.08},t.tipTriggerR=this.createTip("babia-tooltip_trigger_R",tipTriggerRconfig,tipTriggerRpos),t.rightHand.append(t.tipTriggerR),t.tooltips.push(t.tipTriggerR),tipGripRconfig={text:t.data.gripRLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipGripRpos={x:-.085,y:-.01,z:.07},t.tipGripR=this.createTip("babia-tooltip_grip_R",tipGripRconfig,tipGripRpos),t.rightHand.append(t.tipGripR),t.tooltips.push(t.tipGripR)),this.tipsController(),this.data.networkedAudio&&this.setAudioController()}))},tipsController:function(){let t=this;this.tipsOpened=t.data.tipsOpened,t.tipsOpened||t.tooltips.forEach((t=>{t.setAttribute("visible",!1)})),t.rightHand.addEventListener("gripdown",(()=>{t.tipsOpened?(t.tipsOpened=!1,t.tooltips.forEach((t=>{t.setAttribute("visible",!1)}))):(t.tipsOpened=!0,t.tooltips.forEach((t=>{t.setAttribute("visible",!0)})))}))}})},3773:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function t(t,i){t.getObject3D("mesh")?e(t,i):t.addEventListener("model-loaded",(function(){t.color=i,e(t,i)}))}function e(t,e){t.object3D.traverse((function(t){last_material=t.material,last_material&&(t.material=new THREE.MeshBasicMaterial({color:e}))}))}AFRAME.registerComponent("babia-controls",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,init:function(){this.createPlayer()},update:function(e){let i=this.data;if(i.state&&i.state!=e.state){let t=document.getElementsByClassName("babiaPause")[0],e=document.getElementsByClassName("babiaPlay")[0];"pause"===i.state?(t&&this.el.children[0].removeChild(t),e||this.createButton("play","white")):(e&&this.el.children[0].removeChild(e),t||this.createButton("pause","white")),this.el.parentEl.setAttribute("babia-navigator","state",i.state)}if(i.direction&&i.direction!=e.direction){let e=document.getElementsByClassName("babiaRewind")[0],n=document.getElementsByClassName("babiaForward")[0];"rewind"===i.direction?(n.color="white",e.color="grey",t(n,"white"),t(e,"grey")):(n.color="grey",e.color="white",t(n,"grey"),t(e,"white")),this.el.parentEl.setAttribute("babia-navigator","direction",i.direction)}},player:void 0,createPlayer:function(){this.player=document.createElement("a-entity"),this.player.classList.add("babiaxrPlayer"),this.player.classList.add("babiaxraycasterclass"),this.el.appendChild(this.player),this.createButton("rewind","white"),this.createButton("skipPrev","white"),this.createButton("pause","white"),this.createButton("skipNext","white"),this.createButton("forward","grey")},createButton:function(e,i){let n,r,a,o=!1;if("play"===e)n=playButton.default,r=.2,a="babiaPlay";else if("pause"===e)n=pauseButton.default,r=0,a="babiaPause";else if("skipNext"===e)n=skipButton.default,r=3,a="babiaSkipNext",o=!0;else if("skipPrev"===e)n=skipButton.default,r=-3,a="babiaSkipPrev";else if("rewind"===e)n=rewindButton.default,r=-6,a="babiaRewind";else{if("forward"!==e)throw new Error("That button type doesn't exist.");n=rewindButton.default,r=6,a="babiaForward",o=!0}let s=document.createElement("a-entity");s.setAttribute("gltf-model","url("+n+")"),s.classList.add("babiaxraycasterclass"),s.classList.add(a),s.setAttribute("position",{x:r,y:0,z:0}),t(s,i),o&&s.setAttribute("rotation",{x:0,y:180,z:0}),this.player.appendChild(s),this.mouseOver(s),this.processEvents(s)},mouseOver:function(e){e.addEventListener("mouseenter",(function(){t(e,"grey")})),e.addEventListener("mouseleave",(function(){t(e,e.color)}))},processEvents:function(t){let e=this;t.addEventListener("click",(function(){if(t.classList.contains("babiaPlay"))this.parentEl.parentEl.setAttribute("babia-controls","state","play");else if(t.classList.contains("babiaPause"))this.parentEl.parentEl.setAttribute("babia-controls","state","pause");else if(t.classList.contains("babiaSkipNext")||t.classList.contains("babiaSkipPrev")){"pause"!=e.data.state&&this.parentEl.parentEl.setAttribute("babia-controls","state","pause");let i="skipPrev";t.classList.contains("babiaSkipNext")&&(i="skipNext"),e.el.parentEl.components["babia-navigator"].controlNavigator(i)}else t.classList.contains("babiaForward")?this.parentEl.parentEl.setAttribute("babia-controls","direction","forward"):t.classList.contains("babiaRewind")&&this.parentEl.parentEl.setAttribute("babia-controls","direction","rewind")}))}})},80:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function t(t){let e=t.el.sceneEl.camera.el;t.recordedData[Date.now()]={position:e.getAttribute("position"),rotation:e.getAttribute("rotation")}}function e(t,e){let i="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(t)),n=document.createElement("a");n.setAttribute("href",i),n.setAttribute("download",e+".json"),document.body.appendChild(n),n.click(),n.remove()}AFRAME.registerComponent("babia-experiment",{schema:{taskTitle:{type:"string",default:"Default task title"},taskDescription:{type:"string",default:"Default task text"},openTaskImg:{type:"string"},closeTaskImg:{type:"string"},timeLimitEnding:{type:"boolean",default:!1},timeLimitTime:{type:"number",default:300},forceFinishWhenTimeLimit:{type:"boolean",default:!1},finishButton:{type:"boolean",default:!0},recordDelta:{type:"number",default:3e3},recordAudio:{type:"boolean",default:!0},taskAudio:{type:"boolean",default:!1},taskAudioUrl:{type:"string",default:null},taskVideo:{type:"boolean",default:!1},taskVideoId:{type:"string",default:null},taskVideoWidth:{type:"number",default:3},taskVideoHeight:{type:"number",default:1.75},lookat:{type:"string",default:"[camera]"}},multiple:!0,recordedData:{},runningExperiment:!1,init:function(){},update:function(t){if(this.data!=this.oldData){let t=this.el.querySelectorAll("[babia-camera]");if(t.length>0){this.babiaCameraEl=t[0];let e=this.babiaCameraEl.getAttribute("babia-camera");this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:e.raycasterMouse+", #babiaTaskPopup, #babiaTaskPopup--close-icon, #babiaStartButton, #babiaFinishButton, #babiaTaskAudio, #babiaTaskVideo",raycasterHand:e.raycasterHand+", #babiaTaskPopup, #babiaTaskPopup--close-icon, #babiaStartButton, #babiaFinishButton, #babiaTaskAudio, #babiaTaskVideo"})}else this.babiaCameraEl=this.el.sceneEl.camera.el;this.findBabiaCharts(),this.hideCharts(),0==this.el.querySelectorAll("[babia-task]").length&&(this.data.taskAudio?this.addAudioTask():this.data.taskVideo?this.addVideoTask():this.addTask()),this.addStartButton(),this.data.finishButton&&this.addFinishButton()}},findBabiaCharts:function(){this.babiaCharts=this.el.querySelectorAll("[babia-pie], [babia-bars], [babia-barsmap], [babia-bubbles], [babia-city], [babia-cyls], [babia-cylsmap], [babia-doughnut], [babia-terrain], [babia-boats], [babia-network], [babiaxr-codecity]")},hideCharts:function(){for(let t of this.babiaCharts)t.setAttribute("visible",!1)},showCharts:function(){for(let t of this.babiaCharts)t.setAttribute("visible",!0)},addTask:function(){this.taskEntity=document.createElement("a-entity"),this.taskEntity.setAttribute("class","babiaxrayscasterclass"),this.taskEntity.setAttribute("id","babiaTaskPopup"),this.taskEntity.setAttribute("babia-poster",{openIconImage:"../assets/popups/info.jpg",closeIconImage:"../assets/popups/close.jpg",title:this.data.taskTitle,titleWrapCount:30,titleColor:"black",bodyColor:"black",posterBoxColor:"white",bodyFont:"roboto",posterBoxHeight:4.5,body:this.data.taskDescription}),this.taskEntity.setAttribute("scale",{x:.5,y:.5,z:.5}),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskEntity)},audioPlaying:!1,addAudioTask:function(){const t=this;this.taskAudioEntity=document.createElement("a-entity"),this.taskAudioEntity.setAttribute("class","babiaxrayscasterclass"),this.taskAudioEntity.setAttribute("geometry",{primitive:"plane",width:1.1,height:.5}),this.taskAudioEntity.setAttribute("text",{value:"Play audio!",color:"white",align:"center",wrapCount:30,width:3.6}),this.taskAudioEntity.setAttribute("id","babiaTaskAudio"),this.taskAudioEntity.setAttribute("sound",{src:`url(${t.data.taskAudioUrl})`}),this.taskAudioEntity.addEventListener("click",(function(e){t.audioPlaying?(t.audioPlaying=!1,t.taskAudioEntity.components.sound.stopSound(),t.taskAudioEntity.setAttribute("text","value","Play audio!")):(t.audioPlaying=!0,t.taskAudioEntity.components.sound.playSound(),t.taskAudioEntity.setAttribute("text","value","Stop audio!"))}),!1),this.taskAudioEntity.addEventListener("sound-ended",(function(e){t.audioPlaying=!1,t.taskAudioEntity.setAttribute("text","value","Play audio!")}),!1),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskAudioEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskAudioEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskAudioEntity)},videoPlaying:!1,addVideoTask:function(){const t=this;this.taskVideoEntity=document.createElement("a-video"),this.taskVideoEntity.setAttribute("class","babiaxrayscasterclass"),this.taskVideoEntity.setAttribute("id","babiaTaskVideo"),this.taskVideoEntity.setAttribute("src",t.data.taskVideoId),this.taskVideoStream=document.querySelector(t.data.taskVideoId),this.taskVideoEntity.setAttribute("width",t.data.taskVideoWidth),this.taskVideoEntity.setAttribute("height",t.data.taskVideoHeight),this.taskVideoEntity.addEventListener("click",(function(e){t.videoPlaying?(t.videoPlaying=!1,t.taskVideoStream.pause()):(t.videoPlaying=!0,t.taskVideoStream.play())}),!1),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.taskVideoEntity.setAttribute("position",{x:this.babiaCameraPosition.x,y:this.babiaCameraPosition.y+1.5,z:this.babiaCameraPosition.z-4}),this.taskVideoEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskVideoEntity)},addStartButton:function(){const e=this;this.startButtonEntity=document.createElement("a-plane"),this.startButtonEntity.setAttribute("id","babiaStartButton"),this.startButtonEntity.setAttribute("scale",{x:.4,y:.4,z:.4}),this.startButtonEntity.setAttribute("babia-lookat",this.data.lookat),this.startButtonEntity.setAttribute("class",".babiaxrayscasterclass"),this.startButtonEntity.setAttribute("color","#3ac961"),this.startButtonEntity.setAttribute("geometry",{primitive:"plane",width:1.8,height:.5}),this.startButtonEntity.setAttribute("text",{value:"Start!",color:"white",align:"center",wrapCount:30,width:3.6}),this.babiaCameraPosition=this.babiaCameraEl.getAttribute("position"),this.startButtonEntity.setAttribute("position",{x:this.babiaCameraPosition.x-.5,y:this.babiaCameraPosition.y+1,z:this.babiaCameraPosition.z-1.5}),this.startButtonEntity.addEventListener("click",(async function(n){e.showCharts(),e.runningExperiment=!0,e.recordingData=window.setInterval((function(){t(e)}),e.data.recordDelta),e.recordedData.startTime=Date.now(),e.data.recordAudio&&(e.audioRecorder=await i(),e.audioRecorder.start()),e.startButtonEntity.setAttribute("visible",!1),e.data.finishButton&&e.finishButtonEntity.setAttribute("visible",!0),e.data.timeLimitEnding&&(e.recordedData.maxTime=e.recordedData.startTime+1e3*e.data.timeLimitTime)}),!1),this.el.parentElement.append(this.startButtonEntity)},addFinishButton:function(){const i=this;this.finishButtonEntity=document.createElement("a-plane"),this.finishButtonEntity.setAttribute("id","babiaFinishButton"),this.finishButtonEntity.setAttribute("scale",{x:.4,y:.4,z:.4}),this.finishButtonEntity.setAttribute("babia-lookat",this.data.lookat),this.finishButtonEntity.setAttribute("class","babiaxrayscasterclass"),this.finishButtonEntity.setAttribute("color","#9e0000"),this.finishButtonEntity.setAttribute("visible",!1),this.finishButtonEntity.setAttribute("geometry",{primitive:"plane",width:1.8,height:.5}),this.finishButtonEntity.setAttribute("text",{value:"Finish!",color:"white",align:"center",wrapCount:30,width:3.6}),this.finishButtonEntity.setAttribute("position",{x:this.babiaCameraPosition.x+.5,y:this.babiaCameraPosition.y+1,z:this.babiaCameraPosition.z-1.5}),this.finishButtonEntity.addEventListener("click",(function(n){i.hideCharts(),i.runningExperiment=!1,t(i),clearInterval(this.recordingData),i.audioRecorder&&i.stopAndDownloadAudio(),i.recordedData.finishTime=Date.now(),i.recordedData.totalDuration=i.recordedData.finishTime-i.recordedData.startTime,e(i.recordedData,"experimentdetails"),i.finishButtonEntity.setAttribute("visible",!1)}),!1),this.el.parentElement.append(this.finishButtonEntity)},stopAndDownloadAudio:async function(){let t=await this.audioRecorder.stop();const e=document.createElement("a");document.body.appendChild(e),e.style="display: none",e.href=t.audioUrl,e.download="audio.webm",e.click(),window.URL.revokeObjectURL(t.audioUrl)},tick:function(){const i=this;this.runningExperiment&&this.data.timeLimitEnding&&Date.now()>this.recordedData.maxTime&&(this.recordedData.finishTime=this.recordedData.maxTime,this.recordedData.totalDuration=this.recordedData.finishTime-this.recordedData.startTime,this.runningExperiment=!1,this.data.forceFinishWhenTimeLimit?(alert("The time limit is done! Thank you!"),this.hideCharts(),e(i.recordedData,"experimentdetails"),i.finishButtonEntity.setAttribute("visible",!1),t(i),clearInterval(this.recordingData),i.audioRecorder&&i.stopAndDownloadAudio()):alert("The time limit is done, but you can continue doing the experiment, please, click on Finish when done!"))}});const i=()=>new Promise((t=>{navigator.mediaDevices.getUserMedia({audio:!0}).then((e=>{const i=new MediaRecorder(e),n=[];i.addEventListener("dataavailable",(t=>{n.push(t.data)})),t({start:()=>{i.start()},stop:()=>new Promise((t=>{i.addEventListener("stop",(()=>{const e=new Blob(n),i=URL.createObjectURL(e),r=new Audio(i);t({audioBlob:e,audioUrl:i,play:()=>{r.play()}})})),i.stop()}))})}))}))},3337:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-label",{schema:{text:{type:"string"},height:{type:"number",default:1},width:{type:"number",default:3},textWidth:{type:"number",default:6},color:{type:"color",default:"white"},font:{type:"string",default:"default"},background:{type:"color",default:"black"},align:{type:"string",default:"center"}},update:function(t){console.log("Starting label..."),this.el.setAttribute("geometry",{primitive:"plane",height:this.data.height,width:this.data.width}),this.el.setAttribute("material",{color:this.data.color}),this.el.setAttribute("text",{value:this.data.text,align:this.data.align,width:this.data.textWidth,color:this.data.background}),this.el.classList.add("babiaxrLegend")}})},577:()=>{var t,e=AFRAME.utils.debug,i=AFRAME.utils.coordinates,n=e("components:babia-lookat:warn"),r=i.isCoordinates||i.isCoordinate;delete AFRAME.components["babia-lookat"],AFRAME.registerComponent("babia-lookat",{schema:{default:"0 0 0",parse:function(t){return r(t)||"object"==typeof t?i.parse(t):t},stringify:function(t){return"object"==typeof t?i.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3,this.cameraListener=AFRAME.utils.bind(this.cameraListener,this),this.el.addEventListener("componentinitialized",this.cameraListener),this.el.addEventListener("componentremoved",this.cameraListener)},update:function(){var t,e=this,i=e.data;return!i||"object"==typeof i&&!Object.keys(i).length?e.remove():"object"==typeof i?this.lookAt(new THREE.Vector3(i.x,i.y,i.z)):(t=e.el.sceneEl.querySelector(i))?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",(function(){e.beginTracking(t)})):void n('"'+i+'" does not point to a valid entity to babia-lookat')},tick:(t=new THREE.Vector3,function(e){var i=this.target3D;i&&(i.getWorldPosition(t),this.lookAt(t))}),remove:function(){this.el.removeEventListener("componentinitialized",this.cameraListener),this.el.removeEventListener("componentremoved",this.cameraListener)},beginTracking:function(t){this.target3D=t.object3D},cameraListener:function(t){t.detail&&"camera"===t.detail.name&&this.update()},lookAt:function(t){var e=this.vector,i=this.el.object3D;this.el.getObject3D("camera")?e.subVectors(i.position,t).add(i.position):e.copy(t),i.lookAt(e)}})},7026:(t,e,i)=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const n=i(9590).NotiBuffer;AFRAME.registerComponent("babia-navigator",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,sliderEl:void 0,init:function(){this.notiBuffer=new n(this.registerBack.bind(this),this.unregisterBack.bind(this))},update:function(t){let e=this,i=this.data;if(i.state&&i.state!=t.state&&this.controlNavigator(i.state),i.direction&&i.direction!=t.direction&&this.controlNavigator(i.direction),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}document.addEventListener("controllerconnected",(t=>{controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))}))},initializeControls:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.min=0,this.sliderEl.max=this.selector.selectable.length-1,this.current=this.selector.selectable.current,this.sliderEl.setAttribute("babia-slider",{size:1.5,min:this.sliderEl.min,max:this.sliderEl.max,value:this.current}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="timeline",this.sliderEl.setAttribute("scale",{x:2.3,y:2.3,z:2.3}),this.el.appendChild(this.sliderEl),this.controlsEl=document.createElement("a-entity"),this.controlsEl.setAttribute("babia-controls",""),this.controlsEl.classList.add("babiaxraycasterclass"),this.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),this.controlsEl.object3D.position.y=-.5,this.el.appendChild(this.controlsEl),this.stepControllerEl=document.createElement("a-entity"),this.stepControllerEl.setAttribute("babia-step-controller",""),this.stepControllerEl.classList.add("babiaxraycasterclass"),this.stepControllerEl.object3D.position.x=2.5,this.el.appendChild(this.stepControllerEl),this.speedControllerEl=document.createElement("a-entity"),this.speedControllerEl.setAttribute("babia-speed-controller",""),this.speedControllerEl.classList.add("babiaxraycasterclass"),this.speedControllerEl.object3D.position.x=3,this.el.appendChild(this.speedControllerEl)},updateSlider:function(t){let e=this.sliderEl.getAttribute("babia-slider").value;"skipNext"===t?e++:"skipPrev"===t&&e--,"skipPrev"===t&&e>=0||"skipNext"===t&&e<=this.sliderEl.max?(this.current=e,this.notiBuffer.set("babiaSetPosition"+this.current)):this.controlsEl.querySelector(".babiaPause")&&(this.current=e,processData("pause"))},registerBack:function(t){this.selector=t,this.prodComponent=t,this.prodComponent.navNotiBuffer&&(this.navNotiBufferId=this.prodComponent.navNotiBuffer.register(this.processData.bind(this)))},unregisterBack:function(t){t.navNotiBuffer.unregister(this.navNotiBufferId)},processData:function(t){"pause"==t?this.controlsEl.setAttribute("babia-controls","state","pause"):"rewind"==t?this.el.setAttribute("babia-navigator","direction","rewind"):"forward"==t?this.el.setAttribute("babia-navigator","direction","forward"):t.type&&("position"===t.type?(this.sliderEl||this.initializeControls(),"rewind"!=this.data.direction?this.current=t.value-1:this.current=t.value+1,this.current>=this.sliderEl.min&&this.current<=this.sliderEl.max&&(t.label?this.sliderEl.setAttribute("babia-slider",{label:t.label,value:this.current}):this.sliderEl.setAttribute("babia-slider","value",this.current))):"step"===t.type?this.stepControllerEl.setAttribute("babia-step-controller","value",t.value):"speed"===t.type&&this.speedControllerEl.setAttribute("babia-speed-controller","value",t.value))},prodComponent:void 0,navNotiBufferId:void 0,sliderComp:void 0,controlsComp:void 0,stepComp:void 0,speedComp:void 0,controlNavigator:function(t,e){"skipNext"==t||"skipPrev"==t?this.updateSlider(t):this.notiBuffer.set(t+e)}});let r=(t,e)=>{let i=document.getElementById(e);t.el.setAttribute("scale",{x:.1,y:.1,z:.1}),t.el.setAttribute("position",{x:0,y:0,z:-.1}),t.el.setAttribute("rotation",{x:-60}),i.appendChild(t.el),t.el.removeChild(t.controlsEl),t.controlsEl=document.createElement("a-entity"),t.controlsEl.setAttribute("babia-controls",""),t.controlsEl.classList.add("babiaxraycasterclass"),t.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),t.controlsEl.object3D.position.y=-.5,t.el.appendChild(t.controlsEl),a(t.handController,t.el)},a=(t,e)=>{let i=!0;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},8630:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-poster",{schema:{title:{type:"string",default:"New Poster"},titleColor:{type:"string",default:"black"},titleFont:{type:"string",default:"mozillavr"},titleWrapCount:{type:"number",default:24},body:{type:"string",default:"This poster has no body yet."},bodyColor:{type:"string",default:"black"},bodyFont:{type:"string",default:"mozillavr"},bodyWrapCount:{type:"number",default:30},openOn:{type:"string",default:"click"},active:{type:"boolean",default:!0},openIconImage:{type:"asset",default:""},openIconRadius:{type:"number",default:.3},openIconColor:{type:"string",default:"white"},closeIconImage:{type:"asset",default:""},closeIconRadius:{type:"number",default:.3},closeIconColor:{type:"string",default:"white"},image:{type:"string",default:""},imageWidth:{type:"number",default:2},imageHeight:{type:"number",default:2},posterBoxWidth:{type:"number",default:4},posterBoxHeight:{type:"number",default:4},posterBoxColor:{type:"string",default:"white"},posterBoxPadding:{type:"number",default:.2}},multiple:!0,posterPlaneEl:null,closeIconEl:null,titleEl:null,bodyEl:null,imageEl:null,hasImage:!1,init(){this.cameraEl=document.querySelector("[camera]"),this.generateOpenIcon(),this.spawnEntities(),this.el.emit("loaded")},tick(){this.isOpen&&this.positionPosterPlane()},remove(){const{openOn:t}=this.data;this.el.removeEventListener(t,this.togglePosterOpen.bind(this)),this.closeIconEl.removeEventListener(t,this.togglePosterOpen.bind(this))},update(){this.generateTitle(),this.generateBody(),this.generateImage()},togglePosterOpen(t){t.target.getAttribute("id")===`${this.el.getAttribute("id")}--close-icon`&&(this.posterPlaneEl.setAttribute("visible",!1),this.isOpen=!1),this.data.active&&t.target.getAttribute("id")===this.el.getAttribute("id")&&(this.positionPosterPlane(),this.posterPlaneEl.setAttribute("visible",!0),this.isOpen=!0)},generateOpenIcon(){const{openIconRadius:t,openIconColor:e,openIconImage:i,openOn:n}=this.data;this.el.setAttribute("geometry",{primitive:"circle",radius:t}),this.el.setAttribute("material",{color:e,src:i}),this.el.addEventListener(n,this.togglePosterOpen.bind(this))},generateCloseIcon(){const{closeIconRadius:t,closeIconColor:e,closeIconImage:i,posterBoxWidth:n,posterBoxHeight:r,openOn:a}=this.data,o=document.createElement("a-entity");return o.setAttribute("id",`${this.el.getAttribute("id")}--close-icon`),o.setAttribute("position",{x:n/2,y:r/2,z:.01}),o.setAttribute("geometry",{primitive:"circle",radius:t}),o.setAttribute("material",{color:e,src:i}),o.addEventListener(a,this.togglePosterOpen.bind(this)),this.closeIconEl=o,o},generateTitle(){const{title:t,titleColor:e,titleFont:i,titleWrapCount:n,posterBoxWidth:r,posterBoxHeight:a,posterBoxPadding:o,imageHeight:s}=this.data,l=this.titleEl||document.createElement("a-entity");l.setAttribute("id",`${this.el.getAttribute("id")}--title`),l.setAttribute("text",{value:t.substring(0,n),color:e,font:i,wrapCount:n,width:r-2*o,baseline:"top",anchor:"left"});let c=a/2-o;return this.hasImage&&(c-=s/2),l.setAttribute("position",{x:-r/2+o,y:c,z:.01}),this.titleEl=l,l},generateBody(){const{body:t,bodyColor:e,bodyFont:i,bodyWrapCount:n,posterBoxWidth:r,posterBoxHeight:a,posterBoxPadding:o,imageHeight:s}=this.data,l=this.bodyEl||document.createElement("a-entity");l.setAttribute("id",`${this.el.getAttribute("id")}--title`),l.setAttribute("text",{value:t,color:e,font:i,wrapCount:n,width:r-2*o,baseline:"top",anchor:"left"});let c=a/2-3*o;return this.hasImage&&(c-=s/2),l.setAttribute("position",{x:-r/2+o,y:c,z:.01}),this.bodyEl=l,l},generateImage(){const{image:t,imageWidth:e,imageHeight:i,posterBoxHeight:n}=this.data;if(!t.length)return null;const r=this.imageEl||document.createElement("a-image");return r.setAttribute("id",`${this.el.getAttribute("id")}--image`),r.setAttribute("src",t),r.setAttribute("width",e),r.setAttribute("height",i),r.setAttribute("position",{x:0,y:n/2,z:.01}),this.hasImage=!0,this.imageEl=r,r},generatePosterPlane(){const{posterBoxWidth:t,posterBoxHeight:e,posterBoxPadding:i,posterBoxColor:n}=this.data,r=this.posterPlaneEl||document.createElement("a-entity");return r.setAttribute("id",`${this.el.getAttribute("id")}--poster-plane`),r.setAttribute("position",{x:0,y:0,z:.5}),r.setAttribute("visible",!1),r.setAttribute("geometry",{primitive:"plane",width:t+i,height:e+i}),this.generateImage()&&r.appendChild(this.generateImage()),r.setAttribute("material",{color:n}),r.appendChild(this.generateCloseIcon()),r.appendChild(this.generateTitle()),r.appendChild(this.generateBody()),this.posterPlaneEl=r,r},positionPosterPlane(){if(this.posterPlaneEl&&this.cameraEl){const t=new THREE.Vector3;this.cameraEl.object3D.getWorldPosition(t);const e=this.posterPlaneEl.object3D.parent.worldToLocal(t);this.posterPlaneEl.object3D.lookAt(e)}},spawnEntities(){this.el.appendChild(this.generatePosterPlane())}})},8566:(t,e,n)=>{if(n(1392).findTargetComponent,"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=n(9590).NotiBuffer;AFRAME.registerComponent("babia-range-selector",{schema:{from:{type:"string"},to:{type:"string"},defaultRange:{type:"string",default:"Last 5 years"}},multiple:!1,init:function(){this.notiBuffer=new r,this.options=[{label:"Last 15 minutes",time:9e5,interval:"30s"},{label:"Last 30 minutes",time:9e5,interval:"30s"},{label:"Last 1 hour",time:36e5,interval:"1m"},{label:"Last 4 hours",time:144e5,interval:"5m"},{label:"Last 12 hours",time:432e5,interval:"10m"},{label:"Last 24 hours",time:864e5,interval:"30m"},{label:"Last 7 days",time:6048e5,interval:"3h"},{label:"Last 30 days",time:2592e6,interval:"12h"},{label:"Last 60 days",time:5184e6,interval:"1d"},{label:"Last 90 days",time:7776e6,interval:"2d"},{label:"Last 6 months",time:15552e6,interval:"3d"},{label:"Last 1 year",time:31536e6,interval:"1w"},{label:"Last 2 years",time:63072e6,interval:"15d"},{label:"Last 5 years",time:15768e7,interval:"30d"}];let t=0;for(i=0;i<this.options.length;i++)if(this.data.defaultRange===this.options[i].label){t=i;break}this.label_select="babia-button-"+this.options[t].label.replaceAll(" ","-")},update:function(t){let e=this.data;this.updateInterface(e)},interface:void 0,options:void 0,handController:void 0,label_select:void 0,updateInterface:function(t){let e=this;for(;e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),a(e,e.handController)}else e.interface=o(e),e.el.appendChild(e.interface);document.addEventListener("controllerconnected",(t=>{for(;e.el.firstChild;)e.el.firstChild.remove();let i=t.detail.name;"left"!==t.target.getAttribute(i).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,e.interface=o(e),a(e,e.handController))}))}});let a=(t,e)=>{let i=document.getElementById(e),n=.03;t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:n,y:n,z:n}),t.interface.setAttribute("position",{x:-.05,y:-.05,z:-.1}),t.interface.setAttribute("rotation",{x:-60,y:0,z:0}),t.interface.setAttribute("visible",!1),i.appendChild(t.interface),c(e,t.interface)},o=t=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let e=7,i=0;return t.options.forEach((n=>{let r=s(t,n.label,i,e);t.interface.appendChild(r),e>1?--e:(i+=3.75,e=7)})),t.interface},s=(t,e,i,n)=>{let r=document.createElement("a-box");r.id="babia-button-"+e.replaceAll(" ","-"),r.classList.add("babiaxraycasterclass"),r.setAttribute("position",{x:i,y:n,z:0}),r.setAttribute("rotation",{x:0,y:0,z:0}),r.setAttribute("height",.8),r.setAttribute("width",3.5),r.setAttribute("depth",.01);let a=document.createElement("a-entity");return a.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),a.setAttribute("position","0 0 0.01"),r.appendChild(a),l(t,r),t.label_select==r.id&&r.emit("click"),r},l=(t,e)=>{e.addEventListener("mouseenter",(function(){e.children[0].setAttribute("text",{color:"#FFFFFF"}),e.setAttribute("color","#333333")})),e.addEventListener("mouseleave",(function(){e.children[0].setAttribute("text",{color:"black"}),t.label_select==e.id?e.setAttribute("color","#555555"):e.setAttribute("color","#FFFFFF")})),e.addEventListener("click",(function(){let i=document.getElementById(t.label_select);null!=i&&(i.children[0].setAttribute("text",{color:"black"}),i.setAttribute("color","#FFFFFF")),t.label_select=e.id,e.children[0].setAttribute("text",{color:"black"}),e.setAttribute("color","#555555");let n=t.label_select.slice(13).replaceAll("-"," ");t.options.forEach((e=>{if(e.label==n){let i=Date.now(),n={from:i-e.time,interval:e.interval,to:i};t.notiBuffer.set(n)}}))}))},c=(t,e)=>{let i=!1;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},6110:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-slider",{schema:{color:{type:"color",default:"#fff"},size:{type:"number",default:.5},min:{type:"number",default:-6},max:{type:"number",default:-4},value:{type:"number",default:-5},innerSize:{type:"number",default:.8},precision:{type:"number",default:2},vertical:{type:"boolean",default:!1},label:{type:"string"}},multiple:!0,init:function(){this.loader=new FontLoader.FontLoader;let t=new THREE.MeshBasicMaterial({color:this.data.color});this.material=t;let e=new THREE.Mesh(new THREE.BoxGeometry(.05,.15,.05),t),i=new THREE.Mesh(new THREE.CylinderGeometry(.03,.03,this.data.size,12),t);i.rotateZ(Math.PI/2);let n=new THREE.Group;this.lever=e,n.add(i),n.add(e),this.data.vertical&&n.rotateZ(Math.PI/2),this.el.setObject3D("mesh",n),this.el.classList.add("babiaxraycasterclass"),this.controllers=Array.prototype.slice.call(document.querySelectorAll("a-entity[hand-controls]")),this.fontURL="https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json",this.loader.load(this.fontURL,(t=>{this.font=t;let e=this.createTextGeometry(this.data.min,-this.data.size/2-.15,-.025),i=this.createTextGeometry(this.data.max,this.data.size/2+.08,-.025);n.add(e),n.add(i)}))},createTextGeometry:function(t,e,i){let n=new TextGeometry.TextGeometry(t.toString(),{font:this.font,size:.07,height:.01,curveSegments:12,bevelEnabled:!1}),r=new THREE.Mesh(n,this.material);return r.position.x=e,r.position.y=i,this.data.vertical&&(r.rotation.z=-Math.PI/2,r.position.y+=.05),r},setTextGeometry:function(t){this.textmesh&&(this.lever.children=[]),this.loader.load(this.fontURL,(e=>{this.font=e,this.data.vertical?this.textmesh=this.createTextGeometry(t,-.025,-.2):this.textmesh=this.createTextGeometry(t,-.025,.15),this.lever.add(this.textmesh)}))},play:function(){this.grabbed=!1,this.el.addEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.addEventListener("triggerdown",this.onTriggerDown.bind(this)),t.addEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},pause:function(){this.el.removeEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.removeEventListener("triggerdown",this.onTriggerDown.bind(this)),t.removeEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},onTriggerDown:function(t){var e=t.target.object3D,i=this.lever,n=(new THREE.Box3).setFromObject(e),r=(new THREE.Box3).setFromObject(i);if(n.intersectsBox(r)){let t=new THREE.Vector3;e.getWorldPosition(t);let n=new THREE.Vector3;i.getWorldPosition(n),t.distanceTo(n)<.1&&(this.grabbed=e,this.grabbed.visible=!1,this.knob.material=this.knobGrabbedMaterial)}},onTriggerUp:function(){this.grabbed&&(this.grabbed.visible=!0,this.grabbed=!1,this.knob.material=this.knobMaterial)},setValue:function(t){var e=this.lever;t<this.data.min?t=this.data.min:t>this.data.max&&(t=this.data.max),this.value=t,e.position.x=this.valueToLeverPosition(t),this.data.label?this.setTextGeometry(this.data.label):this.setTextGeometry(t)},valueToLeverPosition:function(t){var e=this.data.size*this.data.innerSize,i=Math.abs(this.data.max-this.data.min);let n=-1*e/2;return(t-this.data.min)*e/i+n},leverPositionToValue:function(t){var e=this.data.size*this.data.innerSize;return(t- -1*e/2)*Math.abs(this.data.max-this.data.min)/e+this.data.min},tick:function(){if(this.grabbed){var t=this.grabbed,e=this.lever,i=this.data.size*this.data.innerSize,n=(new THREE.Vector3).setFromMatrixPosition(t.matrixWorld);e.parent.worldToLocal(n),Math.abs(n.x)>i/2?e.position.x=i/2*Math.sign(e.position.x):e.position.x=n.x;var r=this.leverPositionToValue(e.position.x);Math.abs(this.value-r)>=Math.pow(10,-this.data.precision)&&(r=Math.round(r),this.value=r,this.setTextGeometry(r),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(r)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(r)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(r)))}},mousexPositionToValue:function(t){let e=new THREE.Vector3;this.el.object3D.getWorldPosition(e);let i=e.x,n=this.data.size*this.el.object3D.scale.x*this.el.parentEl.object3D.scale.x,r=Math.abs(this.data.max-this.data.min),a=i-n/2,o=i+n/2;if(t<a)return this.data.min;if(t>o)return this.data.max;let s=n/r,l=Math.floor((t-a)/s),c=this.data.min+l;return Math.min(Math.max(c,this.data.min),this.data.max)},mouseyPositionToValue:function(t){let e=new THREE.Vector3;this.el.object3D.getWorldPosition(e);let i=e.y,n=this.data.size*this.el.object3D.scale.y*this.el.parentEl.object3D.scale.y,r=Math.abs(this.data.max-this.data.min),a=i-n/2,o=i+n/2;if(t<a)return this.data.min;if(t>o)return this.data.max;let s=n/r,l=Math.floor((t-a)/s),c=this.data.min+l;return Math.min(Math.max(c,this.data.min),this.data.max)},update:function(t){this.data.value!==t.value&&this.setValue(this.data.value),this.el.addEventListener("click",_listener=t=>{let e,i=t.detail.intersection.point;e=this.data.vertical?this.mouseyPositionToValue(i.y):this.mousexPositionToValue(i.x),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(e)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(e)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(e))})}}),AFRAME.registerComponent("babia-step-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,step:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:10,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="step-controller",this.el.appendChild(this.sliderEl)},controlStep:function(t){this.step=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetStep",this.step)}}),AFRAME.registerComponent("babia-speed-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,speed:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:3,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="speed-controller",this.el.appendChild(this.sliderEl)},controlSpeed:function(t){this.speed=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetSpeed",this.speed)}})},4078:(t,e,i)=>{const{randFloatSpread:n}=i(8823);if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-task",{schema:{taskTitle:{type:"string",default:"Default task title"},taskDescription:{type:"string",default:"Default task text"},openTaskImg:{type:"string"},closeTaskImg:{type:"string"},taskAudio:{type:"boolean",default:!1},taskAudioUrl:{type:"string",default:null},taskVideo:{type:"boolean",default:!1},taskVideoId:{type:"string",default:null},taskVideoWidth:{type:"number",default:3},taskVideoHeight:{type:"number",default:1.75},offsetX:{type:"number",default:0},lookat:{type:"string",default:"[camera]"}},multiple:!0,recordedData:{},runningExperiment:!1,init:function(){},taskId:Math.random(),update:function(t){if(this.taskId=this.el.getAttribute("id"),this.data!=this.oldData){let t=this.el.sceneEl.querySelectorAll("[babia-camera]");if(t.length>0){this.babiaCameraEl=t[0];let e=this.babiaCameraEl.getAttribute("babia-camera");"string"==typeof e?this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:e.split("raycasterMouse:")[1].split(";")[0]+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,raycasterHand:e.split("raycasterHand:")[1].split(";")[0]+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,teleportCollision:e.split("teleportCollision:")[1].split(";")[0]}):null==e&&this.babiaCameraEl.setAttribute("babia-camera",{raycasterMouse:this.babiaCameraEl.components["babia-camera"].attrValue.raycasterMouse+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,raycasterHand:this.babiaCameraEl.components["babia-camera"].attrValue.raycasterHand+`, #babiaTaskPopup${this.taskId}, #babiaTaskPopup${this.taskId}--close-icon, #babiaStartButton${this.taskId}, #babiaFinishButton${this.taskId}, #babiaTaskAudio${this.taskId}, #babiaTaskVideo${this.taskId}`,teleportCollision:this.babiaCameraEl.components["babia-camera"].attrValue.teleportCollision})}else this.babiaCameraEl=this.el.sceneEl.camera.el;this.data.taskAudio?this.addAudioTask():this.data.taskVideo?this.addVideoTask():this.addTask()}},addTask:function(){let t,e,i;this.taskEntity=document.createElement("a-entity"),this.taskEntity.setAttribute("class","babiaxrayscasterclass"),this.taskEntity.setAttribute("id","babiaTaskPopup"+this.taskId),this.taskEntity.setAttribute("babia-poster",{openIconImage:"../assets/popups/info.jpg",closeIconImage:"../assets/popups/close.jpg",title:this.data.taskTitle,titleWrapCount:30,titleColor:"black",bodyColor:"black",posterBoxColor:"white",bodyFont:"roboto",posterBoxHeight:4.5,body:this.data.taskDescription}),this.babiaCameraEl.attributes.position?[t,e,i]=this.babiaCameraEl.attributes.position.value.split(" "):(t=0,e=0,i=0),this.taskEntity.setAttribute("position",{x:parseFloat(t)+this.data.offsetX,y:parseFloat(e)+1.5,z:parseFloat(i)-6}),this.taskEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskEntity)},audioPlaying:!1,addAudioTask:function(){const t=this;let e,i,n;this.taskAudioEntity=document.createElement("a-entity"),this.taskAudioEntity.setAttribute("class","babiaxrayscasterclass"),this.taskAudioEntity.setAttribute("geometry",{primitive:"plane",width:1.1,height:.5}),this.taskAudioEntity.setAttribute("text",{value:"Play audio!",color:"white",align:"center",wrapCount:30,width:3.6}),this.taskAudioEntity.setAttribute("id","babiaTaskAudio"+this.taskId),this.taskAudioEntity.setAttribute("sound",{src:`url(${t.data.taskAudioUrl})`}),this.taskAudioEntity.addEventListener("click",(function(e){t.audioPlaying?(t.audioPlaying=!1,t.taskAudioEntity.components.sound.stopSound(),t.taskAudioEntity.setAttribute("text","value","Play audio!")):(t.audioPlaying=!0,t.taskAudioEntity.components.sound.playSound(),t.taskAudioEntity.setAttribute("text","value","Stop audio!"))}),!1),this.taskAudioEntity.addEventListener("sound-ended",(function(e){t.audioPlaying=!1,t.taskAudioEntity.setAttribute("text","value","Play audio!")}),!1),this.babiaCameraEl.attributes.position?[e,i,n]=this.babiaCameraEl.attributes.position.value.split(" "):(e=0,i=0,n=0),this.taskAudioEntity.setAttribute("position",{x:parseFloat(e)+this.data.offsetX,y:parseFloat(i)+3,z:parseFloat(n)-6}),this.taskAudioEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskAudioEntity)},videoPlaying:!1,addVideoTask:function(){const t=this;let e,i,n;this.taskVideoEntity=document.createElement("a-video"),this.taskVideoEntity.setAttribute("class","babiaxrayscasterclass"),this.taskVideoEntity.setAttribute("id","babiaTaskVideo"+this.taskId),this.taskVideoEntity.setAttribute("src",t.data.taskVideoId),this.taskVideoStream=document.querySelector(t.data.taskVideoId),this.taskVideoEntity.setAttribute("width",t.data.taskVideoWidth),this.taskVideoEntity.setAttribute("height",t.data.taskVideoHeight),this.taskVideoEntity.addEventListener("click",(function(e){t.videoPlaying?(t.videoPlaying=!1,t.taskVideoStream.pause()):(t.videoPlaying=!0,t.taskVideoStream.play())}),!1),this.babiaCameraEl.attributes.position?[e,i,n]=this.babiaCameraEl.attributes.position.value.split(" "):(e=0,i=0,n=0),this.taskVideoEntity.setAttribute("position",{x:parseFloat(e)+this.data.offsetX,y:parseFloat(i)+3,z:parseFloat(n)-6}),this.taskVideoEntity.setAttribute("babia-lookat",this.data.lookat),this.el.parentElement.append(this.taskVideoEntity)},tick:function(){}})},4738:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui-link",{schema:{viz:{type:"string"},ui:{type:"string"}},linked_viz:void 0,ui_target:void 0,init:function(){this.createButton()},update:function(i){let n=this,r=this.data;e(r,n.el,n),t(r,n.el,n),console.log("VIZ",n.linked_viz)},createButton:function(){this.button=document.createElement("a-entity"),this.button.classList.add("babiaxraycasterclass"),this.button.setAttribute("geometry",{primitive:"plane",height:1,width:3}),this.button.setAttribute("material",{color:"#FFF"}),this.button.setAttribute("text",{value:"Manage me",align:"center",width:8,color:"#000"}),this.button.setAttribute("position",{x:0,y:-1,z:0}),this.addListeners(this.button,this),this.el.appendChild(this.button)},addListeners:function(t,e){t.addEventListener("mouseenter",(function(){t.setAttribute("text",{color:"#FFF"}),t.setAttribute("material",{color:"#333"})})),t.addEventListener("mouseleave",(function(){t.setAttribute("text",{color:"#000"}),t.setAttribute("material",{color:"#FFF"})})),t.addEventListener("click",(function(){let t=document.querySelector("#"+e.ui_target);console.log(e.linked_viz),t.setAttribute("babia-ui","target",e.linked_viz)}))}});let t=(t,e,i)=>t.ui?void(i.ui_target=t.ui):e.components["babia-ui"]?void(i.ui_target=e.components["babia-ui"]):document.querySelectorAll("[babia-ui]").length>0?void(i.ui_target=document.querySelectorAll("[babia-ui]")[0].id):void console.error("UI Component not found."),e=(t,e,i)=>{if(!t.viz)return e.components["babia-bars"]||e.components["babia-barsmap"]||e.components["babia-boats"]||e.components["babia-bubbles"]||e.components["babia-city"]||e.components["babia-cyls"]||e.components["babia-cylsmap"]||e.components["babia-doughnut"]||e.components["babia-network"]||e.components["babia-pie"]?void(i.linked_viz=e.id):void console.error("Visuzlizer not found.");i.linked_viz=t.viz}},6173:(t,e,i)=>{let n=i(1392).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui",{schema:{target:{type:"string"},hideFields:{type:"array"},hideRows:{type:"array"},showOnly:{type:"array"},maxPerRow:{type:"number",default:5},linesSeparation:{type:"number",default:.3},customQuerierLabel:{type:"string",default:"Data"},customAttributeSwitch:{type:"array"},customAttributeLabel:{type:"array"}},multiple:!1,init:function(){console.log("WELCOME TO UI: Control your data.")},update:function(t){let e=this.data;this.targetComponent&&this.targetComponent.notiBuffer.unregister(this.notiBufferId),this.targetComponent=n(e,this),this.findQuerierComponents(this),this.targetComponent.visProperties&&(this.targetComponentVisProperties=this.targetComponent.visProperties),this.targetComponent.notiBuffer&&(this.notiBufferId=this.targetComponent.notiBuffer.register(this.updateInterface.bind(this)))},targetComponent:void 0,targetComponentVisProperties:void 0,dataMetrics:void 0,interface:void 0,dataQueriers:void 0,handController:void 0,nodesQueriers:void 0,linksQueriers:void 0,updateInterface:function(t){let e=this;for(t&&a(e,t,e.targetComponentVisProperties);e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}else e.interface=s(e,e.dataMetrics,e.el);document.addEventListener("controllerconnected",(t=>{for(;e.el.firstChild;)e.el.firstChild.remove();controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))}))},findQuerierComponents:function(){this.targetComponent.el.components["babia-network"]&&(this.targetComponent.el.components["babia-network"].data.nodesFrom||this.targetComponent.el.components["babia-network"].data.nodes)?(console.log("nodesFrom or nodes"),this.nodesQueriers=[],this.linksQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach((t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&(this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id))})),document.querySelectorAll("[babia-queryes]").forEach((t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)})),document.querySelectorAll("[babia-querygithub]").forEach((t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)})),document.querySelectorAll("[babia-filter]").forEach((t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)}))):this.targetComponent.el.components["babia-boats"]?(this.dataQueriers=[],document.querySelectorAll("[babia-treebuilder]").forEach((t=>{this.dataQueriers.push(t.id)}))):(this.dataQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach((t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&this.dataQueriers.push(t.id)})),document.querySelectorAll("[babia-queryes]").forEach((t=>{this.dataQueriers.push(t.id)})),document.querySelectorAll("[babia-querygithub]").forEach((t=>{this.dataQueriers.push(t.id)})),document.querySelectorAll("[babia-filter]").forEach((t=>{this.dataQueriers.push(t.id)})))},hideAndInsertMetrics:function(t,e,i){const n=this;let r={property:e,metrics:i};if(0!=n.data.hideFields.length){let t=[];i.forEach((e=>{n.data.hideFields.includes(e)||t.push(e)})),r.metrics=t}if(n.data.showOnly.length>0){let t=[];for(let i=0;i<n.data.showOnly.length;i++){const r=n.data.showOnly[i].split(":");e==r[0]&&t.push(r[1])}r.metrics=t}n.data.hideRows.includes(e)||t.push(r)}});let r=(t,e)=>{let i=document.getElementById(e),n=.03;t.interface=s(t,t.dataMetrics,i),t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:n,y:n,z:n}),t.interface.setAttribute("position",{x:-.03*t.interface.width/2,y:n*t.interface.height/2,z:-.1}),t.interface.setAttribute("rotation",{x:-60}),p(t.handController,t.interface)},a=(t,e,i)=>{if("babia-network"==t.targetComponent.attrName)if(e.nodes){t.dataMetrics={nodes:[],links:[]};let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=o(e.nodes[0]),Object.keys(n).forEach((t=>{"number"==typeof n[t]&&a.push(t)})),i.nodes.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics.nodes,i,a):t.hideAndInsertMetrics(t.dataMetrics.nodes,i,Object.keys(e.nodes[0]))})),i.links1.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics.links,i,a):t.hideAndInsertMetrics(t.dataMetrics.links,i,Object.keys(e.links[0]))}))}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=o(e[0]),Object.keys(n).forEach((t=>{"number"==typeof n[t]&&a.push(t)})),i.nodes.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics,i,a):t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))})),i.links0.forEach((i=>{r.includes(i)?t.hideAndInsertMetrics(t.dataMetrics,i,a):t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))}))}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth","color"],a=[];n="babia-city"==t.targetComponent.attrName?o(e):"babia-boats"==t.targetComponent.attrName?o(e[0]):e[0],Object.keys(n).forEach((t=>{"number"==typeof n[t]&&a.push(t)})),i.forEach((i=>{if(r.includes(i)){if(t.hideAndInsertMetrics(t.dataMetrics,i,a),"color"===i&&"babia-boats"==t.targetComponent.attrName){let e=[];for(const[t,i]of Object.entries(n))"string"==typeof i&&e.push(t);t.data.showOnly||t.hideAndInsertMetrics(t.dataMetrics,i,e)}}else t.hideAndInsertMetrics(t.dataMetrics,i,Object.keys(e[0]))}))}},o=t=>(t.children?child=o(t.children[0]):child=t,child),s=(t,e,i)=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let n=0,r=0,a=0;if(t.data.customAttributeSwitch.length>0){t.data.customAttributeLabel&&(t.customAttributesLabel={},t.data.customAttributeLabel.forEach((e=>{let i=e.split(":");Object.defineProperty(t.customAttributesLabel,i[0],{value:i[1]})})));let e=h("Atrributes",r,n);t.interface.appendChild(e),t.data.customAttributeSwitch.forEach(((e,i)=>{let a=e.split(":");r+=3.25;let o=u(t,a,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(i+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,--n,a<r&&(a=r),r=0}if(t.targetComponent.el.components["babia-network"]&&(t.targetComponent.el.components["babia-network"].data.nodesFrom||t.targetComponent.el.components["babia-network"].data.nodes)){if(t.nodesQueriers.length>1){let e=h("Nodes",r,n);t.interface.appendChild(e),t.nodesQueriers.forEach(((e,i)=>{r+=3.25;let a=d(t,e,r,n,"nodes");a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a),(i+1)%t.data.maxPerRow==0&&(--n,r=0)}))}if(--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,t.linksQueriers.length>1){let e=h("Links",r,n);t.interface.appendChild(e),t.linksQueriers.forEach(((e,i)=>{r+=3.25;let a=d(t,e,r,n,"links");a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a),(i+1)%t.data.maxPerRow==0&&(--n,r=0)}))}--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,e.nodes.forEach((e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(((i,a)=>{r+=3.25;let o=l(t,e.property,i,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(a+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,a<r&&(a=r),r=0})),e.links.forEach((e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(((i,a)=>{r+=3.25;let o=l(t,e.property,i,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(a+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,a<r&&(a=r),r=0}))}else{if(t.dataQueriers.length>1){let e=h(t.data.customQuerierLabel,r,n);t.interface.appendChild(e),t.dataQueriers.forEach((e=>{r+=3.25;let i=d(t,e,r,n);i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)}))}--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0,e.forEach((e=>{let i=h(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(((i,a)=>{r+=3.25;let o=l(t,e.property,i,r,n);o.classList.add("babiaxraycasterclass"),t.interface.appendChild(o),(a+1)%t.data.maxPerRow==0&&(--n,r=0)})),--n,n-=t.data.linesSeparation,a<r&&(a=r),r=0}))}return t.interface.width=a+3,t.interface.height=Math.abs(n),t.interface.setAttribute("position",{x:-t.interface.width/2,y:t.interface.height,z:0}),i.appendChild(t.interface),t.interface},l=(t,e,i,n,r)=>{let a=document.createElement("a-box");a.property=e,a.metric=i,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:n,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let o=document.createElement("a-entity");return o.setAttribute("text",{value:i,align:"center",width:"10",color:"black"}),o.setAttribute("position","0 0 0.01"),a.appendChild(o),t.targetComponent.data[e]==i&&a.setAttribute("color","#555555"),c(a,t.targetComponent,!1),a},c=(t,e,i)=>{t.addEventListener("mouseenter",(function(){t.children[0].setAttribute("text",{color:"#FFFFFF"}),t.setAttribute("color","#333333")})),i?t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data.from==t.from?t.setAttribute("color","#555555"):""!=e.data.from&&e.data.from==t.from||t.setAttribute("color","#FFFFFF")})):t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data[t.property]==t.metric?t.setAttribute("color","#555555"):t.setAttribute("color","#FFFFFF")})),t.addEventListener("click",(function(){t.property&&t.metric?("babia-boats"==e.attrName&&"area"==t.property?(e.el.removeAttribute(e.attrName,"width"),e.el.removeAttribute(e.attrName,"depth")):"babia-boats"!=e.attrName||"width"!=t.property&&"depth"!=t.property||!e.el.getAttribute("babia-boats").area||(e.el.removeAttribute(e.attrName,"area"),"width"==t.property?e.el.setAttribute(e.attrName,"depth",t.metric):e.el.setAttribute(e.attrName,"width",t.metric)),e.el.setAttribute(e.attrName,t.property,t.metric)):t.from?e.el.setAttribute(e.attrName,"from",t.from):t.nodes?e.el.setAttribute(e.attrName,"nodesFrom",t.nodes):t.links&&e.el.setAttribute(e.attrName,"linksFrom",t.links)}))},h=(t,e,i)=>{let n=document.createElement("a-plane");return n.setAttribute("position",{x:e,y:i,z:0}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("height",.8),n.setAttribute("width",3),n.setAttribute("text",{value:t,align:"center",width:"10",color:"#FFFFFF"}),n.setAttribute("color","black"),n},d=(t,e,i,n,r)=>{let a=document.createElement("a-box");"nodes"==r?a.nodes=e:"links"==r?a.links=e:a.from=e,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:i,y:n,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let o=document.createElement("a-entity");return o.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),o.setAttribute("position","0 0 0.01"),a.appendChild(o),t.targetComponent.prodComponent&&t.targetComponent.prodComponent.el.id==e?a.setAttribute("color","#555555"):a.setAttribute("color","#FFFFFF"),c(a,t.targetComponent,!0),a},u=(t,[e,i],n,r)=>{let a=document.createElement("a-box");a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:n,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let o=document.createElement("a-entity"),s=e;return t.customAttributesLabel&&t.customAttributesLabel[e]&&(s=t.customAttributesLabel[e]),o.setAttribute("text",{value:s,align:"center",width:"10",color:"white"}),o.setAttribute("position","0 0 0.01"),a.appendChild(o),a.setAttribute("color","blue"),a.addEventListener("click",(function(){let n=t.targetComponent.el.getAttribute(t.targetComponent.attrName);n[e]&&n[e]==i?t.targetComponent.el.removeAttribute("babia-boats",e):t.targetComponent.el.setAttribute("babia-boats",e,i)})),a},p=(t,e)=>{let i=!0;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},4483:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-debug-data",{schema:{inputEvent:{type:"string"}},multiple:!1,init:function(){let e=this.data,i=this.el;e.input&&e.output&&t(e,i)},update:function(e){let i=this.data,n=this.el;i!==e&&i.inputEvent!==e.inputEvent&&(console.log("Change event because from has changed"),n.removeEventListener(i.inputEvent,(function(t){})),t(i,n))},remove:function(){},pause:function(){},play:function(){}});let t=(t,i)=>{i.addEventListener(t.inputEvent,(function(n){e(t,i)}))},e=(t,e)=>{if(!e.querySelector(".debug-data")){let t=function(t,e,i){let n=document.createElement("a-plane");n.setAttribute("color","white"),n.setAttribute("class","debug_data"),n.setAttribute("width",10),n.setAttribute("height",10);let r=e.getAttribute("position"),a=0,o=0;e.getAttribute("geometry")&&("box"===e.components.geometry.data.primitive?(a=e.getAttribute("geometry").width/2,o=e.getAttribute("geometry").height/2):"sphere"===e.components.geometry.data.primitive?a=e.getAttribute("geometry").radius:(a=0,o=0)),n.setAttribute("position",{x:r.x+a+5,y:0-o+5,z:r.z});let s=document.createElement("a-text");return s.setAttribute("value",JSON.stringify(i)),s.setAttribute("width",10),s.setAttribute("height",10),s.setAttribute("color","black"),s.setAttribute("position",{x:0-n.getAttribute("width")/2,y:0-e.getAttribute("height")/2,z:0}),n.appendChild(s),n}(0,e,e.getAttribute("babiaData"));e.appendChild(t)}}},9632:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let t,e,i;var n;AFRAME.registerComponent("babiaxr-event-controller",{schema:{navigation:{type:"string"},targets:{type:"string"}},multiple:!1,init:function(){},update:function(f){t=this.el;let g=this.data;e=g.navigation,i=JSON.parse(g.targets),function(e){let i=document.getElementById(e).getAttribute("babiaxr-navigation-bar").commits;if(i&&l){n=JSON.parse(i);for(let t in n)r.push(n[t]);if(r.reverse(),s){let t=n.length-1-c;a=r[c],o=t}else a=n[c],o=c;l=!1,h(s?r:n),document.addEventListener("babiaxrShow",(function(e){!function(t){for(let e in n)if(n[e].commit==t.commit){a=n[e],p(e),o=e;break}u()}(e.detail.data),t.emit("babiaxrStop")})),document.addEventListener("babiaxrContinue",(function(){console.log("PLAY"),h(s?r:n)})),document.addEventListener("babiaxrToPresent",(function(){console.log("TO PRESENT"),s=!1,t.emit("babiaxrStop"),h(n)})),document.addEventListener("babiaxrToPast",(function(){console.log("TO PAST"),s=!0,t.emit("babiaxrStop"),h(r)})),document.addEventListener("babiaxrSkipNext",(function(){console.log("SKIP NEXT"),t.emit("babiaxrStop"),d("next")})),document.addEventListener("babiaxrSkipPrev",(function(){console.log("SKIP PREV"),t.emit("babiaxrStop"),d("prev")}))}}(e)},remove:function(){},pause:function(){},play:function(){}});var r=[];let a,o,s=!1,l=!0,c=0;function h(e){let i=0;for(let t in e)e[t]==a&&(i=parseInt(t)+1);let n=setInterval((function(){if(i<e.length){if(a=e[i],s){let t=e.length-1-i;p(t),o=t}else p(i),o=i;u(),i++,document.addEventListener("babiaxrStop",(function(){clearInterval(n)})),i==e.length&&document.getElementsByClassName("babiaxrPause")[0].emit("click")}else t.emit("babiaxrStop")}),3e3)}function d(t){for(let e in n)if(n[e]==a){"next"==t&&e<n.length-1?e++:"prev"==t&&e>=1&&e--,a=n[e],p(e),o=e;break}u()}function u(){let t=document.getElementById(a.commit).getAttribute("babiadata");for(let e in i){let n=document.getElementById(i[e].id);n&&n.setAttribute("babiaxr-vismapper","dataToShow",t)}}function p(t){let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;(o||0==o)&&e[o].emit("removeinfo"),e[t].emit("showinfo")}},6363:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-interaction-mapper",{schema:{input:{type:"string"},output:{type:"string"}},multiple:!1,init:function(){let e=this.data,i=this.el;e.input&&e.output&&t(e,i)},update:function(e){let i=this.data,n=this.el;i!==e&&(i.input===e.input&&i.output===e.output||(console.log("Change event because from has changed"),n.removeEventListener(e.input,(function(t){})),t(i,n)))},remove:function(){},pause:function(){},play:function(){}});let t=(t,e)=>{e.addEventListener(t.input,(function(i){e.emit(t.output,i,!1)}))}},9825:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let t,e,n,r,a,o,s,l,c,h,d;function u(t){let e=document.createElement("a-sphere");var i;return e.setAttribute("radius",.05),e.setAttribute("material",{color:"#FF0000"}),function(t,e){let i,n;t.addEventListener("mouseenter",(function(){l=this.getAttribute("material").color,this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),this.setAttribute("material",{color:"#AAAA00"}),n=p(e),this.appendChild(n)})),t.addEventListener("showinfo",(function(){i=p(e),this.setAttribute("material",{color:"#00AA00"}),this.appendChild(i)})),t.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),this.setAttribute("material",{color:l}),this.removeChild(n)})),t.addEventListener("removeinfo",(function(){i&&(this.removeChild(i),this.setAttribute("material",{color:"#FF0000"}))}))}(e,t),i=t,e.addEventListener("click",(function(){this.setAttribute("material",{color:"#00AA00"}),l=this.getAttribute("material").color,o.emit("babiaxrShow",{data:i}),document.getElementsByClassName("babiaxrPause")[0]&&(a.removeChild(r),a.appendChild(n))})),e}function p(t){let e="",i=[];i.push("Date: "+t.date+"\n"),i.push("commit: "+t.commit+"\n");let n=1;for(let t of i)t.length>10&&n<t.length/2&&(n=t.length/7),e+=t;let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:.4,z:.1}),r.setAttribute("scale",{x:.5,y:.5,z:1}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e,align:"center",width:6,color:"black"}),r.setAttribute("material",{opacity:.6}),r}function f(t){let e=t.length,n=[];const r=.11;for(i=0;i<e;i++){let e=r*t[i][0],a=r*t[i][1],o=r*t[i][2],s=new THREE.Vector3(e,a,o);n.push(s)}let a=new THREE.Shape(n),o=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),s=new THREE.ExtrudeGeometry(a,{depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1});return new THREE.Mesh(s,o)}function g(t){t.addEventListener("mouseenter",(function(){s=Object.assign({},this.object3DMap.mesh.material.color),this.object3DMap.mesh.material.color={r:170/255,g:170/255,b:170/255}})),t.addEventListener("mouseleave",(function(){this.object3DMap.mesh.material.color=s}))}function m(t,e){t.addEventListener("click",(function(){t.classList.contains("babiaxrPlay")?(a.removeChild(t),a.appendChild(r)):t.classList.contains("babiaxrPause")?(a.removeChild(r),a.appendChild(n)):t.classList.contains("babiaxrSkipNext")||t.classList.contains("babiaxrSkipPrev")?document.getElementsByClassName("babiaxrPause")[0]&&(a.removeChild(r),a.appendChild(n)):t.classList.contains("babiaxrForward")?(s={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrRewind")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}):t.classList.contains("babiaxrRewind")&&(s={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrForward")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}),console.log("Emit..... "+e),o.emit(e)}))}AFRAME.registerComponent("babiaxr-navigation-bar",{schema:{commits:{type:"string"},size:{type:"number",default:"5"},points_by_line:{type:"number",default:"5"},to:{type:"string",default:"left"},start_point:{type:"number",default:"0"}},multiple:!1,init:function(){let s=this.data;o=this.el,t=JSON.parse(s.commits),e=s.size,c=s.to,h=s.start_point,d=s.points_by_line;let l=function(t,e,i){let n=document.createElement("a-entity");n.classList.add("babiaxrTimeBar");let r=0,a=Math.ceil(t.length/i)/5-.2,o=e/(i-1),s=0,l=1;for(let e in t){let c=u(t[e]);c.classList.add("babiaxraycasterclass"),c.setAttribute("position",{x:r,y:a,z:0}),n.appendChild(c),e%i==i-1&&e!=t.length-1?(l++,a-=.2,r=0):e!=t.length-1&&(r+=o),s=r}for(let t=0;t<l;t++){let i=document.createElement("a-entity");0!=s&&0==t||1==d||0==s&&0==t?i.setAttribute("line",{start:"0 "+a+" 0",end:s+" "+a+" 0",color:"#FF0000"}):i.setAttribute("line",{start:"0 "+a+" 0",end:e+" "+a+" 0",color:"#FF0000"}),a+=.2,n.appendChild(i)}return n}(t,e,d);this.el.appendChild(l),a=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPlayer"),t.setAttribute("position",{x:(e-5)/2,y:0,z:0}),t.classList.add("babiaxraycasterclass"),n=function(t){let e=document.createElement("a-entity");e.classList.add("babiaxrPlay");let i=f([[0,0,0],[0,3,0],[2.5,1.5,0],[0,0,0]]);return e.setObject3D("mesh",i),m(e,"babiaxrContinue"),g(e),e}(),n.setAttribute("position",{x:2.35,y:-.65,z:0}),n.classList.add("babiaxraycasterclass"),r=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPause");let e=function(t,e){let n=t.length,r=e.length,a=[],o=[];const s=.11;for(i=0;i<n;i++){let e=s*t[i][0],n=s*t[i][1],r=s*t[i][2],o=new THREE.Vector3(e,n,r);a.push(o)}for(i=0;i<r;i++){let t=s*e[i][0],n=s*e[i][1],r=s*e[i][2],a=new THREE.Vector3(t,n,r);o.push(a)}let l=new THREE.Shape(a),c=new THREE.Shape(o),h={depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1},d=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),u=new THREE.ExtrudeGeometry(l,h),p=new THREE.ExtrudeGeometry(c,h),f=new THREE.Mesh(u,d);return f.updateMatrix(),p.merge(f.geometry,f.matrix),new THREE.Mesh(p,d)}([[0,0,0],[0,3,0],[1,3,0],[1,0,0],[0,0,0]],[[1.5,0,0],[1.5,3,0],[2.5,3,0],[2.5,0,0],[1.5,0,0]]);return t.setObject3D("mesh",e),m(t,"babiaxrStop"),g(t),t}(),r.setAttribute("position",{x:2.35,y:-.65,z:0}),r.classList.add("babiaxraycasterclass"),t.appendChild(r);let a=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrRewind");let e=f([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),"left"==c&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255}),m(t,"babiaxrToPast"),g(t),t}();a.setAttribute("position",{x:1.25,y:-.65,z:0}),a.classList.add("babiaxraycasterclass"),t.appendChild(a);let o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrForward");let e=f([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),"right"==c&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255}),m(t,"babiaxrToPresent"),g(t),t}();o.setAttribute("position",{x:3.7,y:-.65,z:0}),o.classList.add("babiaxraycasterclass"),t.appendChild(o);let s=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipPrev");let e=f([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),m(t,"babiaxrSkipPrev"),g(t),t}();s.setAttribute("position",{x:1.95,y:-.65,z:0}),s.classList.add("babiaxraycasterclass"),t.appendChild(s);let l=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipNext");let e=f([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),m(t,"babiaxrSkipNext"),g(t),t}();return l.setAttribute("position",{x:3,y:-.65,z:0}),l.classList.add("babiaxraycasterclass"),t.appendChild(l),t}(),this.el.appendChild(a),function(){let t=document.getElementsByClassName("babiaxrTimeBar")[0].children;for(let e in t)e==h&&t[e].emit("showinfo")}()},update:function(t){},remove:function(){},pause:function(){},play:function(){}})},8628:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-totem",{schema:{charts_id:{type:"string"},data_list:{type:"string"}},multiple:!1,init:function(){let i=this.data,a=this.el;t=a.id,i&&(r.push({id:a.id,charts_id:JSON.parse(i.charts_id)}),i.data_list&&(e=JSON.parse(i.data_list),function(t){let e=new THREE.FileLoader;for(let i of t)if(i.from_querier){let t=document.getElementById(i.from_querier);if(t.getAttribute("babiaData")){let e=JSON.parse(t.getAttribute("babiaData"));n.push({file:e,path:i.from_querier})}else t.addEventListener("dataReady"+i.from_querier,(function(t){n.push({file:t.detail,path:i.from_querier})}))}else if(i.path){let t=i.path;e.load(t,(function(e){n.push({file:e,path:t})}),(function(e){console.log(t.toString()+": "+e.loaded/e.total*100+"% loaded")}),(function(t){console.error("An error happened")}))}}(e)))},update:function(t){let e=this.data;if(i=this.el,e!==t){for(;this.el.firstChild;)this.el.firstChild.remove();console.log("Generating totemchart..."),a(i)}},remove:function(){},pause:function(){},play:function(){}});let t,e,i,n=[],r=[],a=t=>{n&&function(t,e){console.log("Generating Totem...");let i=7.5;e.length%2==1&&(i+=Math.trunc(e.length/2));let n=function(t){let e=5;for(let i of t)i.data&&(i=i.data),i.length>10&&e<i.length/4&&(e=i.length/4);return e}(e);document.createElement,function(t,e,i,n,r,a,o){let s=document.createElement("a-plane");s.setAttribute("class","title"),s.setAttribute("position",{x:-3,y:i,z:6}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height",1),s.setAttribute("width",a),s.setAttribute("color","blue"),s.setAttribute("text",{value:"Select Data",align:"center",width:"10",color:"white"}),t.appendChild(s)}(t,0,i,0,0,n),i-=1,function(t,e,i,n,r,a,s,l){for(let e of s){e.data&&(e=e.data);let n=document.createElement("a-plane");n.setAttribute("position",{x:-3,y:i,z:6}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("height",1),n.setAttribute("width",a),n.setAttribute("text",{value:e,align:"center",width:"10"}),n.setAttribute("color","white"),n.setAttribute("text",{color:"black"}),t.appendChild(n),i-=1,n.classList.add("babiaxraycasterclass"),n.addEventListener("click",(function(){let t=n.parentElement.id,i=n.parentElement.children;l=e;for(let e of s)(e.path||e.from_querier)&&l==e.data&&o(e.path||e.from_querier,t);for(let t in i)i[t]===n?(n.setAttribute("color","black"),n.setAttribute("text",{color:"white"})):i[t].id||"title"!==i[t].className&&(i[t].setAttribute("color","white"),i[t].setAttribute("text",{color:"black"}))}))}}(t,0,i,0,0,n,e)}(t,e)};function o(t,e){var i;i=e,document.getElementById(i);for(let i in r)if(e==r[i].id){let e=r[i].charts_id;for(obj in e){let i,r=e[obj].type,a=e[obj].id;for(let e in n)n[e].path==t&&(i=n[e].file,"babiaxr-vismapper"===r?document.getElementById(a).setAttribute(r,"dataToShow",JSON.stringify(i)):document.getElementById(a).setAttribute(r,"data",i))}}}},1392:t=>{const e={palettes:{blues:["#142850","#27496d","#00909e","#dae1e7"],foxy:["#f79071","#fa744f","#16817a","#024249"],flat:["#120136","#035aa6","#40bad5","#fcbf1e"],sunset:["#202040","#543864","#ff6363","#ffbd69"],bussiness:["#de7119","#dee3e2","#116979","#18b0b0"],icecream:["#f76a8c","#f8dc88","#f8fab8","#ccf0e1"],ubuntu:["#511845","#900c3f","#c70039","#ff5733"],pearl:["#efa8e4","#f8e1f4","#fff0f5","#97e5ef"],commerce:["#222831","#30475e","#f2a365","#ececec"],bluesextra:["#00429d","#09459e","#1147a0","#174aa1","#1c4da2","#214fa3","#2552a5","#2855a6","#2c57a7","#2f5aa8","#335daa","#3660ab","#3962ac","#3b65ad","#3e68ae","#416bb0","#446eb1","#4670b2","#4973b3","#4c76b4","#4e79b6","#517cb7","#537eb8","#5681b9","#5884ba","#5b87bc","#5d8abd","#608dbe","#6290bf","#6593c0","#6895c1","#6a98c2","#6d9bc4","#6f9ec5","#72a1c6","#74a4c7","#77a7c8","#7aaac9","#7cadca","#7fb0cb","#82b3cc","#84b5cd","#87b8ce","#8abbcf","#8dbed0","#90c1d1","#93c4d2","#96c7d3","#99cad4","#9ccdd5","#9fd0d6","#a2d3d7","#a5d5d8","#a9d8d9","#acdbda","#b0dedb","#b4e1db","#b7e4dc","#bbe6dd","#c0e9de","#c4ecde","#c8efdf","#cdf1e0","#d2f4e0","#d7f6e1","#ddf9e1","#e4fbe1","#ebfde1","#f3fee1","#ffffe0"],ubuntuextra:["#511845","#541845","#581844","#5b1844","#5e1744","#621744","#651743","#681743","#6b1743","#6e1643","#711642","#741642","#771642","#7a1641","#7d1541","#801541","#831541","#861540","#891540","#8c1540","#8f1540","#92153f","#94163f","#97163f","#9a163f","#9d173e","#9f173e","#a2183e","#a5183e","#a7193d","#aa1a3d","#ac1a3d","#af1b3d","#b21c3d","#b41d3c","#b71e3c","#b9203c","#bb213c","#be223b","#c0233b","#c3253b","#c5263b","#c7273b","#ca293a","#cc2a3a","#ce2c3a","#d02e3a","#d32f39","#d53139","#d73239","#d93439","#db3638","#dd3738","#e03938","#e23b38","#e43d37","#e63e37","#e84037","#ea4236","#ec4436","#ee4636","#f04836","#f24a35","#f44b35","#f64d35","#f84f34","#f95134","#fb5334","#fd5533","#ff5733"],ubuntudiver:["#511845","#711643","#8d1640","#a81b3f","#c1253d","#d7333a","#ec4437","#ff5733","#ffdac4","#ffb3a7","#fb8a8c","#eb6574","#d5405e","#b81b4a","#93003a"],bluesdiver:["#00429d","#325da9","#4e78b5","#6694c1","#80b1cc","#9dced6","#c0eade","#ffffe0","#f2f0e4","#e5e1e8","#d7d3eb","#c8c5ed","#b8b7ef","#a5aaf0","#6ea9da"],categoric:["#ffb75f","#8e009a","#5c2800","#ff95ff","#a69fff","#da8800","#073479","#ffff00","#00d3ff","#b60026","#00a59d","#7e0000","#0099cc","#ff8080","#7491eb","#365e00","#743570","#00805e","#570000","#00629c","#6d4e00","#002c47","#95824d","#001b2b","#006020","#3d142e","#ffb75f","#8e009a"]},get:function(t,e){if(e in this.palettes){let i=this.palettes[e].length;return this.palettes[e][t%i]}try{let i=JSON.parse(e);return i[t%i.length]}catch(t){console.error(t)}let i=this.palettes.ubuntu.length;return this.palettes[e][t%i]}};let i=(t,e,i)=>{let n=null,r=null,a=null;if(t.from){let i=document.getElementById(t.from);for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub","babia-selector","babia-treebuilder"])if(i.components[t]){n=i.components[t];break}if(null==n)return void console.error("Problem registering to the querier",e)}else{if(t.nodesFrom){let i=document.getElementById(t.nodesFrom);for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub"])if(i.components[t]){r=i.components[t];break}if(null==r)return void console.error("Problem registering to the querier",e);let n=document.getElementById(t.linksFrom);for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub"])if(n.components[t]){a=n.components[t];break}return null==a?void console.error("Problem registering to the querier",e):{nodes:r,links:a}}for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub","babia-selector","babia-treebuilder"])if(e.components[t]&&i!=t){n=e.components[t];break}if(null==n){for(const t of["babia-filter","babia-queryjson","babia-querycsv","babia-queryes","babia-querygithub","babia-selector","babia-treebuilder"])if(document.querySelectorAll("["+t+"]").length>0){n=document.querySelectorAll("["+t+"]")[0].components[t];break}if(null==n)return void console.error("Error, querier not found",e,e.components,e.components["babia-querier"])}}return n},n=t=>{let e;return e="string"==typeof t||t instanceof String?JSON.parse(t):t,e};t.exports.findProdComponent=i,t.exports.findNavComponent=(t,e)=>{let i;if(t.controller){let n=document.getElementById(t.controller);if(!n.components["babia-navigator"])return void console.error("Problem registering to the navigator",e);i=n.components["babia-navigator"]}else if(e.components["babia-navigator"])i=e.components["babia-navigator"];else{if(!(document.querySelectorAll("[babia-navigator]").length>0))return void console.error("Error, navigator not found",e,e.components,e.components["babia-navigator"]);i=document.querySelectorAll("[babia-navigator]")[0].components["babia-navigator"]}return i},t.exports.findTargetComponent=(t,e)=>{let i;if(t.target){{let e=document.getElementById(t.target);if(null==e)return void console.error("Target not exist.");if(e.components["babia-bars"])i=e.components["babia-bars"];else if(e.components["babia-barsmap"])i=e.components["babia-barsmap"];else if(e.components["babia-cyls"])i=e.components["babia-cyls"];else if(e.components["babia-cylsmap"])i=e.components["babia-cylsmap"];else if(e.components["babia-pie"])i=e.components["babia-pie"];else if(e.components["babia-doughnut"])i=e.components["babia-doughnut"];else if(e.components["babia-bubbles"])i=e.components["babia-bubbles"];else if(e.components["babia-city"])i=e.components["babia-city"];else if(e.components["babia-boats"])i=e.components["babia-boats"];else{if(!e.components["babia-network"])return void console.error("Visualizer not found.");i=e.components["babia-network"]}}return i}console.error("Error: Target not inserted. ")},t.exports.colors=e,t.exports.updateTitle=(t,e)=>{let i=document.createElement("a-entity");return i.classList.add("babiaxrTitle"),i.setAttribute("text",{value:t.title}),t.titleColor&&i.setAttribute("material",{color:t.titleColor}),i.setAttribute("scale","10 10 10"),i.setAttribute("wrapCount","10"),i.setAttribute("position",t.titlePosition),i.setAttribute("rotation",e),i},t.exports.parseJson=n,t.exports.updateFunction=(t,e)=>{let r=t.data,a=t.el;if((a.components["babia-bars"]||a.components["babia-barsmap"]||a.components["babia-cyls"])&&(r.index||(r.index=r.x_axis),t.animation=r.animation,t.bar_array=[]),a.components["babia-boats"]&&(t.figures||(t.figures=[])),r.data&&e.data!==r.data){let e=n(r.data);t.processData(e)}else r.from!==e.from?(t.slice_array&&(t.slice_array=[]),t.prodComponent&&t.prodComponent.notiBuffer.unregister(t.notiBufferId),t.prodComponent=i(r,a),t.prodComponent.notiBuffer&&(t.notiBufferId=t.prodComponent.notiBuffer.register(t.processData.bind(t)))):r!==e&&t.newData&&(t.slice_array&&(t.slice_array=[]),t.bar_array&&(t.bar_array=[]),t.processData(t.newData))}},662:(t,e,i)=>{let n=i(4809).parse;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(9590).NotiBuffer;AFRAME.registerComponent("babia-querycsv",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data,{header:!0,dynamicTyping:!0,skipEmptyLines:!0});this.notiBuffer.set(t.data)}else t.url!==e.url&&this.getCSV(e.url)},remove:function(){},pause:function(){},play:function(){},getCSV:async function(t){let e=this.notiBuffer;n(t,{download:!0,header:!0,skipEmptyLines:!0,dynamicTyping:!0,complete:function(t){e.set(t.data)}})}})},6776:(t,e,i)=>{let n=i(1392).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(9590).NotiBuffer;AFRAME.registerComponent("babia-queryes",{schema:{elasticsearch_url:{type:"string"},index:{type:"string"},query:{type:"string"},size:{type:"int",default:10},request:{type:"string"},user:{type:"string"},password:{type:"string"},data:{type:"string"},tableBars:{type:"boolean",default:!1},rangeSelector:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r,this.tableBars=this.data.tableBars},update:function(t){this.oldData=t;let e="";if(this.data.rangeSelector){let t=document.getElementById(this.data.rangeSelector);t.components["babia-range-selector"]&&(this.prodComponent=t.components["babia-range-selector"]),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.updateQuerier.bind(this)),e=this.prodComponent.notiBuffer.data)}this.updateQuerier(e)},updateQuerier:function(t){let e=this.data,i=this.oldData;if(e.data&&i.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else if(e.elasticsearch_url!==i.elasticsearch_url||e.index!==i.index||e.query!==i.query||e.size!==i.size){if(!e.elasticsearch_url||!e.index)return void console.error("elasicsearch_url and index must be defined");this.getJSON(e,t)}else t&&this.getJSON(e,t)},getJSON:async function(t,e){let i,r;if(t.size&&t.query)if(i=`${t.elasticsearch_url}/${t.index}/_search?size=${t.size}&${t.query}`,t.user&&t.password){let e=new Headers;e.append("Authorization","Basic "+btoa(t.user+":"+t.password)),r=await fetch(i,{headers:e})}else r=await fetch(i);else if(t.request){i=`${t.elasticsearch_url}/${t.index}/_search`;let a=await fetch(t.request);if(200!=a.status)throw new Error(a.status);if(this.json=await a.json(),this.json=n(this.json),e){let t;for(let e=0;e<this.json.query.bool.must.length;e++)this.json.query.bool.must[e].range&&(t=e);let i=this.json.query.bool.must[t].range[Object.keys(this.json.query.bool.must[t].range)[0]];i.gte=e.from,i.lte=e.to,this.json.aggs[2]&&this.json.aggs[2].date_histogram&&(this.json.aggs[2].date_histogram.interval=e.interval)}r=t.user&&t.password?await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*",Authorization:"Basic "+btoa(t.user+":"+t.password)},body:JSON.stringify(this.json)}):await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(this.json)})}if(200==r.status){let t=await r.json();return t=this.parseDataES(t),void this.notiBuffer.set(t)}throw new Error(r.status)},parseDataES:function(t){let e=[];console.log("REQUEST:",this.json),console.log("REPLY:",t);let i=Object.keys(t.aggregations);if(this.json.aggs&&1==i.length&&!this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let i=0;i<t.length;i++)e.push(t[i])}else if(this.json.aggs&&1==i.length&&this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let n=0;n<t.length;n++)if(t[0][Object.keys(t[0])[0]].values)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].values[0].value});else if(t[0][Object.keys(t[0])[0]].value&&1==t[0][Object.keys(t[0])[0]].length)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(t[0][Object.keys(t[0])[0]].buckets&&t[0][Object.keys(t[0])[0]].buckets.length>0)for(let i=0;i<t[n][Object.keys(t[0])[0]].buckets.length;i++)e.push({key_as_string:t[n].key_as_string,key:t[n][Object.keys(t[0])[0]].buckets[i].key,count:t[n][Object.keys(t[0])[0]].buckets[i].doc_count,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(Object.keys(t[0]).length>1)if(1==this.tableBars){e.push({key_as_string:i[0],key:t[n].key,value:t[n].doc_count});for(let i=0;i<Object.keys(t[0]).length;i++)t[n][Object.keys(t[0])[i]].value&&e.push({key_as_string:Object.keys(t[0])[i],key:t[n].key,value:t[n][Object.keys(t[0])[i]].value})}else{let r={key:t[n].key,value:t[n].doc_count};t[n].key_as_string?r.key_as_string=t[n].key_as_string:r.key_as_string=i[0];for(let e=0;e<Object.keys(t[0]).length;e++)t[n][Object.keys(t[0])[e]].value&&(r[Object.keys(t[0])[e]]=t[n][Object.keys(t[0])[e]].value);if(t[0][Object.keys(t[0])[0]].buckets)for(let e=0;e<Object.keys(t[0][Object.keys(t[0])[0]].buckets).length;e++)t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value?r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value:r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]].doc_count;e.push(r)}else e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count})}else{t=t.hits.hits;for(let i=0;i<t.length;i++)e[i]=t[i]._source}return e}})},7511:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-querygithub",{schema:{user:{type:"string"},token:{type:"string"},repos:{type:"array"},data:{type:"string"}},multiple:!1,init:function(){},update:function(i){let r=this.data,a=this.el,o=this;r.data&&i.data!==r.data?n(r.data,a,o):i.user===r.user&&i.repos===r.repos&&i.token===r.token||(r.user&&0===r.repos.length?e(r,a,o):r.repos.length>0&&t(r,a,o))},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el,this.interestedElements.push(t),this.babiaData&&a(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let t=(t,e,i)=>{let n=[];t.repos.forEach(((i,r)=>{let a=new XMLHttpRequest,o="https://api.github.com/repos/"+t.user+"/"+i+"?_="+(new Date).getTime();a.open("get",o,!1),a.onload=function(){if(this.status>=200&&this.status<300){console.log("data OK in request.response",e.id);let t=JSON.parse(a.response);n.push(t)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()})),i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},r("babiaData",i)},e=(t,e,n)=>{let a=new XMLHttpRequest,o="https://api.github.com/users/"+t.user+"/repos?_="+(new Date).getTime();a.open("get",o),a.onload=function(){this.status>=200&&this.status<300?(console.log("data OK in request.response",e.id),n.babiaData=i(JSON.parse(a.response)),n.babiaMetadata={id:n.babiaMetadata.id++},r("babiaData",n)):(reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText))},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()},i=t=>{let e=[];return t.forEach(((t,i)=>{e.push(t)})),e},n=(t,e,i)=>{let n=JSON.parse(t);i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},r("babiaData",i)},r=(t,e)=>{e.interestedElements.forEach((e=>{a(e,t)}))},a=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},9522:(t,e,i)=>{let n=i(1392).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(9590).NotiBuffer;AFRAME.registerComponent("babia-queryjson",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else t.url!==e.url&&this.getJSON(e.url)},remove:function(){},pause:function(){},play:function(){},getJSON:async function(t){let e=await fetch(t);if(200!=e.status)throw new Error(e.status);{let t=await e.json(),i=n(t);this.notiBuffer.set(i)}}})},7619:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-bars",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","x_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,total_duration:3e3,proportion:void 0,valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:this.widthBars/2}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-bars:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let a=this.chartEl,o=a.querySelectorAll("a-entity[babia-bar]"),s={};for(let t of o)s[t.getAttribute("babia-name")]={el:t,found:!1};let l=[],c=[],h=0;for(let n=0;n<t.length;n++){let o,d=t[n],u=d[e.x_axis],p=n*this.widthBars*1.25;s[u]&&!d._not?(o=s[u].el,s[u].found=!0):(o=document.createElement("a-entity"),o.setAttribute("babia-name",u),o.id=d[e.index],o.object3D.position.x=p,a.appendChild(o)),o.setAttribute("babia-bar",{height:d[e.height]*this.lengthY/this.maxValue,width:this.widthBars,depth:this.widthBars,color:r.get(h,i),label:"events",animation:e.animation}),e.legend&&o.setAttribute("babia-bar",{labelText:u+": "+d[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),p!==o.object3D.position.x&&(e.animation?o.setAttribute("animation",{property:"object3D.position.x",to:p,dur:e.dur}):o.object3D.position.x=p),l.push(d[e.x_axis]),c.push(p),h++}for(let t in s)s[t].found||s[t].el.remove();const d=this.widthBars*(1.25*t.length);this.updateAxis(l,c,d,this.maxValue)},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach((t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.index]==t[e.index]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)})),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{this.newData.forEach((t=>{if(t._not)this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar","height",-.1);else if(this.chartEl.querySelector("#"+t[e.index]))this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.index]+": "+t[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale});else{let i=this.chartEl.querySelectorAll("[babia-bar]").length,n=this.chartEl.querySelectorAll("[babia-bar]")[i-1].getAttribute("position").x+this.widthBars+this.widthBars/4,r=s(this,e,t,i,e.palette,n);this.chartEl.appendChild(r),this.xLabels.push(r.id),this.xTicks.push(n)}}));let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let s=(t,e,i,n,a,o)=>{let s=document.createElement("a-entity");return s.setAttribute("babia-bar",{height:i[t.data.height]*e.chartHeight/t.maxValue,width:t.widthBars,depth:t.widthBars,color:r.get(n,a),label:"events",animation:e.animation}),e.legend&&s.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),s.setAttribute("position",{x:o,y:0,z:0}),s.id=i[t.data.index],s},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)}},3877:function(t,e,i){i(1392).findProdComponent;let n=i(1392).updateTitle;i(1392).parseJson;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-barsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string",default:"x_axis"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3}},visProperties:["height","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,proportion:void 0,valueMax:void 0,xLabels:[],zLabels:[],xTicks:[],zTicks:[],total_duration:3e3,updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n,r,a,o){const s=this.data;s.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:s.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:o,palette:s.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:0-this.widthBars/2,y:0,z:-this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),s.axis_name&&((s.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",s.index):this.xAxisEl.setAttribute("babia-axis-x","name",s.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",s.height),this.zAxisEl.setAttribute("babia-axis-z","name",s.z_axis)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-barsmap:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let a=[],o=[],s=[],l=[],c=this.chartEl;c.querySelectorAll("a-entity[babia-bar]").forEach((t=>{t.remove()}));for(let h=0;h<t.length;h++){let d,u,p=t[h],f=p[e.x_axis],g=p[e.z_axis];a.includes(f)||(a.push(f),d=(a.length-1)*this.widthBars*1.25,o.push(d+this.widthBars/2)),d||(d=a.indexOf(f)*this.widthBars*1.25),s.includes(g)||(s.push(g),u=(s.length-1)*this.widthBars*1.25,l.push(u+this.widthBars/2)),u||(u=s.indexOf(g)*this.widthBars*1.25),console.log(f+" "+g+" "+d+" "+u);let m,b=a.indexOf(f);m||(m=document.createElement("a-entity"),m.id=f+g,m.classList.add("babiaxraycasterclass"),m.object3D.position.x=d,m.object3D.position.z=u,c.appendChild(m)),p._not?m.setAttribute("babia-bar",{height:-.1,color:r.get(b,i)}):m.setAttribute("babia-bar",{height:p[e.height]*this.lengthY/n,width:this.widthBars,depth:this.widthBars,color:r.get(b,i),label:"events",animation:e.animation}),e.legend&&m.setAttribute("babia-bar",{labelText:f+", "+g+": "+p[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale})}const h=this.widthBars*(1.25*a.length+.75),d=this.widthBars*(1.25*s.length+.75);this.updateAxis(a,o,h,n,s,l,d),this.xLabels=a,this.xTicks=o,this.zLabels=s,this.zTicks=l},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach((t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.x_axis]==t[e.x_axis]&&this.currentData[n][e.z_axis]==t[e.z_axis]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)})),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{console.log("Keep ---\x3e Update"),this.newData.forEach((t=>{t._not?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar","height",-.1):this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis])?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.x_axis]+","+t[e.z_axis]+": "+t[e.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}):s(this,e,t,this.maxValue,r,this.xLabels,this.zLabels,this.xTicks,this.zTicks)}));let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4,i=this.zTicks[this.zTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue,this.zLabels,this.zTicks,i)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let s=(t,e,i,n,a,o,s,l,c)=>{let h,d,u=i[e.x_axis],p=i[e.z_axis];o.includes(u)||(o.push(u),h=(o.length-1)*this.widthBars*1.25,l.push(h+this.widthBars/2)),h||(h=o.indexOf(u)*this.widthBars*1.25),s.includes(p)||(s.push(p),d=(s.length-1)*this.widthBars*1.25,c.push(d+this.widthBars/2)),d||(d=s.indexOf(p)*this.widthBars*1.25);let f=o.indexOf(u),g=document.createElement("a-entity");return g.id=u+p,g.classList.add("babiaxraycasterclass"),g.setAttribute("babia-bar",{height:i[e.height]*this.lengthY/n,width:this.widthBars,depth:this.widthBars,color:r.get(f,a),label:"events",animation:e.animation}),g.object3D.position.x=h,g.object3D.position.z=d,chartEl.appendChild(g),e.legend&&g.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height],labelLookat:e.legend_lookat,labelScale:e.legend_scale}),this.xLabels=o,this.xTicks=l,this.zLabels=s,this.zTicks=c,bar}},8550:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{let findProdComponent=__webpack_require__(1392).findProdComponent,updateFunction=__webpack_require__(1392).updateFunction;const colorsArray=__webpack_require__(1392).colors.palettes.categoric,NotiBuffer=__webpack_require__(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-boats",{schema:{data:{type:"asset"},from:{type:"string"},border:{type:"number",default:.5},width:{type:"string",default:"width"},depth:{type:"string",default:"depth"},area:{type:"string"},color:{type:"string"},height:{type:"string",default:"height"},maxBuildingHeight:{type:"number",default:2},minBuildingHeight:{type:"number",default:.03},diffBuildingHeight:{type:"boolean",default:!1},zone_elevation:{type:"number",default:.01},separation:{type:"number",default:.1},extra:{type:"number",default:1},levels:{type:"number"},building_color:{type:"string",default:"#E6B9A1"},buildingAlpha:{type:"number",default:1},gradientBaseColor:{type:"boolean",default:!1},base_color:{type:"color",default:"#98e690"},baseAlpha:{type:"number",default:1},height_quarter_legend_box:{type:"number",default:11},height_quarter_legend_title:{type:"number",default:12},height_building_legend:{type:"number",default:0},legend_scale:{type:"number",default:1},legend_lookat:{type:"string",default:"[camera]"},legend_text:{type:"string",default:"{name}\n{fheight} (height): {height}\n{farea} (area): {area}\n{fwidth} (width): {width}\n{fdepth} (depth): {depth}\n{fcolor} (color): {color}"},legendsAsChildren:{type:"boolean",default:!1},legendsAsChildrenHeight:{type:"number",default:3},metricsInfoId:{type:"string",default:""},highlightQuarter:{type:"boolean",default:!1},hideQuarterBoxLegend:{type:"boolean",default:!1},highlightQuarterByClick:{type:"boolean",default:!1},field:{type:"string",default:"uid"},numericColorLegendId:{type:"string"},highlightBuildingByField:{type:"string"},highlightBuildingByFieldColor:{type:"string",default:"white"},wireframeByRepeatedField:{type:"string"},transparent80ByRepeatedField:{type:"string"},transparent20ByRepeatedField:{type:"string"},autoscale:{type:"boolean",default:!1},autoscaleSizeX:{type:"number",default:3},autoscaleSizeZ:{type:"number",default:3},treeLayout:{type:"boolean",default:!1},treeQuartersLevelHeight:{type:"number",default:.2},treeFixQuarterHeight:{type:"boolean",default:!1},treeHideOneSonQuarters:{type:"boolean",default:!1}},entitiesWithLegend:[],legendsActive:[],dataComponent:void 0,newData:void 0,babiaMetadata:{id:0},visProperties:["height","area","width","depth","color"],multiple:!1,duration:2e3,figures_del:[],figures_in:[],animation:!1,init:function(){this.notiBuffer=new NotiBuffer},update:function(t){updateFunction(this,t)},alreadyAutoscaled:!1,autoscaleBoats:function(){const self=this;let bbox=(new THREE.Box3).setFromObject(this.el.object3D),finalSizeX=bbox.max.x-bbox.min.x,finalSizeY=bbox.max.y-bbox.min.y,finalSizeZ=bbox.max.z-bbox.min.z,currentScale=this.el.getAttribute("scale");currentScale||(currentScale={x:1,y:1,z:1}),this.el.setAttribute("scale",{x:eval(this.data.autoscaleSizeX/finalSizeX)*currentScale.x,y:currentScale.y,z:eval(this.data.autoscaleSizeZ/finalSizeZ)*currentScale.z})},tick:function(t,e){let i=this;if(this.data.autoscale&&!this.alreadyAutoscaled&&(new THREE.Box3).setFromObject(this.el.object3D).min.x!==1/0&&(this.autoscaleBoats(),this.alreadyAutoscaled=!0),this.animation){let t={x:0,y:0,z:0};Date.now()-this.start_time>this.duration?(this.animation=!1,this.setFigures(this.figures,t),this.data.autoscale&&this.autoscaleBoats(),i.entitiesWithLegend=i.entitiesWithLegend.filter((t=>document.getElementById(t.entity.id))),i.entitiesWithLegend.forEach((t=>{let e=t.entity,n=t.figure;if(n.children){e.legend=generateLegend(e.babiaRawData||{},{name:n.name,scale:i.data.legend_scale,lookat:i.data.legend_lookat,template:i.data.legend_text||"{name}",colorPlane:"black",colorText:"white",isQuarter:!0,fields:{}});let t=(new THREE.Vector3).setFromMatrixPosition(e.object3D.matrixWorld),r={x:t.x,y:i.data.height_quarter_legend_title,z:t.z};i.data.legendsAsChildren?(e.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),e.legend.setAttribute("visible",!0),e.appendChild(e.legend)):(e.legend.setAttribute("position",r),e.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(e.legend)),i.legendsActive.push(e.legend),e.alreadyActive=!0}else{e.legend=e.legend=generateLegend(e.babiaRawData,{name:n.name,scale:i.data.legend_scale,lookat:i.data.legend_lookat,template:i.data.legend_text,colorPlane:"white",colorText:"black",isQuarter:!1,fields:{height:i.data.height,area:i.data.area,width:i.data.width,depth:i.data.depth,color:i.data.color}});let t=(new THREE.Vector3).setFromMatrixPosition(e.object3D.matrixWorld),r=(new THREE.Box3).setFromObject(e.object3D),a={x:t.x,y:r.max.y+1+i.data.height_building_legend,z:t.z};e.legend.setAttribute("position",a),e.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(e.legend),i.legendsActive.push(e.legend),e.alreadyActive=!0}}))):this.Animation(this.el,this.figures,this.figures_old,e,t,t)}},updateChart:function(t){let e={x:0,y:0,z:0};this.idsToNotRepeatWireframe=[],this.idsToNotRepeat20Transparent=[],this.idsToNotRepeat80Transparent=[],this.animation&&(this.figures_del.forEach((t=>{let e=document.getElementById(t.id);e&&e.remove()})),this.figures_in.forEach((t=>{let e=document.getElementById(t.id);e&&setOpacity(e,1)})),this.setFigures(this.figures,e),this.animation=!1,this.figures_del=[],this.figures_in=[]),this.figures_old=this.figures,this.figures=[];let i,n=this.el,r=t;if(this.data.levels)i=this.data.border*this.data.extra*this.data.levels;else{let t=getLevels(r,0);i=this.data.border*this.data.extra*(t+1)}if([x,y,e,this.figures]=this.generateElements(r,this.figures,e,i),e.x=0,e.z=0,0==this.figures_old.length){for(;this.el.firstChild;)this.el.firstChild.remove();this.drawElements(n,this.figures,e)}else this.figures_old!==this.figures&&(this.animation=!0,this.start_time=Date.now())},categoricColorIndex:0,categoricColorMaps:{},generateElements:function(t,e,i,n){const r=this,a=this.data;var o=n,s=0,l=0,c=0,h=0,d=0,u=0,p=0,f=0,g=0,m=0,b=0,v=0,y=!1,_=!1,A=!1,x=!0;for(let i=0;i<t.length;i++){let M={};if(a.width&&(M.width=t[i][a.width]||.5),a.depth&&(M.depth=t[i][a.depth]||.5),a.height){let e=0;a.diffBuildingHeight&&(e=r.babiaMetadata.heightMin),M.height=r.normalizeValues(e,r.babiaMetadata.heightMax,r.data.minBuildingHeight,r.data.maxBuildingHeight,t[i][a.height])||a.minBuildingHeight}if(a.area&&(M.area=t[i][a.area]||.5,M.width=M.depth=Math.sqrt(M.area)),t[i].children){M.children=t[i].children;var E,C=[];let e=r.el.getAttribute("scale");e||(e={x:1,y:1,z:1}),M.height=a.zone_elevation/e.y,o-=a.border*a.extra,a.treeLayout&&M.children.forEach((t=>{t.children||(M.treeMetaphorHeight=t[a.height])})),[M.width,M.depth,E,C]=this.generateElements(M.children,C,E,o),E.y=M.height,o=n}0==i?(a.area&&!t[i].children?(s+=Math.sqrt(M.area)/2,l-=Math.sqrt(M.area)/2,c+=Math.sqrt(M.area)/2,h-=Math.sqrt(M.area)/2):(s+=M.depth/2,l-=M.depth/2,c+=M.width/2,h-=M.width/2),v=s):M.height>0&&(console.log("Element: ",i),console.log("Directions (up, right, down, left):",y,x,_,A),console.log("Current (vertical, horizontal):",b,v),console.log("Limits (up, right, down, left):",s,c,l,h),console.log("Max (up, right, down, left):",m,p,g,f),console.log("Position (x, y):",d,u),y?([b,d,u,m]=this.UpSide(M,s,b,m),b>c&&(p=b,y=!1,x=!0,f<h&&(h=f),v=s)):x?([v,d,u,p]=this.RightSide(M,c,v,p),console.log("RIGHT",v,d,u,p),v<l&&(g=v,x=!1,_=!0,m>s&&(s=m),b=c),console.log("RIGHT2",v,b,d,u,p)):_?(console.log("DOWN1 (element, limit_down, current_vertical, max_down):",M,l,b,g),[b,d,u,g]=this.DownSide(M,l,b,g),console.log("DOWN2",b,d,u,g),b<h&&(f=b,_=!1,A=!0,p>c&&(c=p),v=l)):A&&([v,d,u,f]=this.LeftSide(M,h,v,f),v>s&&(m=v,A=!1,y=!0,g<l&&(l=g),b=h)));let w={id:"boat-"+t[i][a.field],posX:d,posY:u,height:M.height,translate_matrix:E};if(t[i].children){w.name=t[i][this.data.field]||"",w.width=M.width-this.data.separation,w.depth=M.depth-this.data.separation,w.children=C,w.alpha=r.data.baseAlpha,w.translate_matrix=E,a.treeLayout&&(w.treeMetaphorHeight=M.treeMetaphorHeight);let e=w.name.split("/").length-1;w.hierarchyLevel=e,w.renderOrder=e,w.color=r.getColorBase(e)}else w.name=t[i].name?t[i].name:t[i][this.data.field],w.alpha=r.data.buildingAlpha,w.width=M.width-a.separation,w.depth=M.depth-a.separation,"number"==typeof t[i][a.color]?w.color=heatMapColorforValue(t[i][a.color],r.babiaMetadata.color_max,r.babiaMetadata.color_min):"string"==typeof t[i][a.color]&&(t[i][a.color]in r.categoricColorMaps?w.color=r.categoricColorMaps[t[i][a.color]]:(r.categoricColorMaps[t[i][a.color]]=colorsArray[r.categoricColorIndex],w.color=colorsArray[r.categoricColorIndex],r.categoricColorIndex=r.categoricColorIndex+1,r.categoricColorIndex>=colorsArray.length&&(r.categoricColorIndex=0)));w.rawData=t[i],r.setTransparency(w),w.wireframe=this.getWireframe(w,a.wireframeByRepeatedField),e.push(w)}g<l&&(l=g),f<h&&(h=f),m>s&&(s=m),p>c&&(c=p);var M=Math.abs(h)+Math.abs(c),w=Math.abs(l)+Math.abs(s);return[M+=2*o,w+=2*o,{x:h+M/2-o,y:0,z:l+w/2-o},e]},idsToNotRepeatWireframe:[],idsToNotRepeat80Transparent:[],idsToNotRepeat20Transparent:[],drawElements:function(t,e,i){const n=this;for(let r in e){let a=e[r].height,o=e[r].posX,s=e[r].posY,l={x:o-i.x,y:a/2+i.y/2,z:-s+i.z};if(n.data.treeLayout)if(n.data.treeHideOneSonQuarters&&e[r].children&&1===e[r].children.length&&(e[r].alphaTest=1,e[r].dontAddEvents=!0,e[r].children[0].dontAddLine=!0),n.data.treeFixQuarterHeight){if(void 0!==e[r].treeMetaphorHeight)l.y=a/2+i.y/2+n.data.treeQuartersLevelHeight;else if(l.y=a/2+i.y/2-n.data.treeQuartersLevelHeight-n.data.zone_elevation,e[r].height<n.data.treeQuartersLevelHeight&&(!n.data.treeHideOneSonQuarters||!e[r].dontAddLine)){let e=l.y,i=l.y+(n.data.treeQuartersLevelHeight-a/2),r=document.createElement("a-entity");r.setAttribute("class","babiaboatstreelines"),r.setAttribute("line",{start:{x:l.x,y:e,z:l.z},end:{x:l.x,y:i,z:l.z},color:"yellow"}),t.appendChild(r)}}else if(void 0!==e[r].treeMetaphorHeight){let t=0;n.data.diffBuildingHeight&&(t=n.babiaMetadata.heightMin),l.y=n.normalizeValues(t,n.babiaMetadata.heightMax,n.data.minBuildingHeight,n.data.maxBuildingHeight,e[r].treeMetaphorHeight)}else l.y=a/2+i.y/2-a-.001;let c=this.createElement(e[r],l);this.addEvents(c,e[r]),t.appendChild(c)}},RightSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i-a/2,s=e+r;return s>n&&(n=s),[i-=a,e+r/2,o,n]},DownSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i-r/2,s=e-a;return s<n&&(n=s),[i-=r,o,e-a/2,n]},LeftSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i+a/2,s=e-r;return s<n&&(n=s),[i+=a,e-r/2,o,n]},UpSide:function(t,e,i,n){let r,a;this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)):(r=parseFloat(t.width),a=parseFloat(t.depth));let o=i+r/2,s=e+a;return s>n&&(n=s),[i+=r,o,e+a/2,n]},getColor:function(t,e){const i=this;let n,r=t[e];return"number"==typeof r?n=heatMapColorforValue(r,i.babiaMetadata.color_max,i.babiaMetadata.color_min):"string"==typeof r&&(r in i.categoricColorMaps?n=i.categoricColorMaps[r]:(i.categoricColorMaps[r]=colorsArray[i.categoricColorIndex],n=colorsArray[i.categoricColorIndex],i.categoricColorIndex=i.categoricColorIndex+1,i.categoricColorIndex>=colorsArray.length&&(i.categoricColorIndex=0))),n},getColorBase:function(t){let e;const i=this;if(i.data.gradientBaseColor){let n=i.babiaMetadata.maxLevels;e=greenColorsurface(Math.round(i.normalizeValues(1,n,15,100,t)))}else e=i.data.base_color;return e},setTransparency:function(t){const e=this,i=this.data,n=i.transparent80ByRepeatedField,r=i.transparent20ByRepeatedField;n&&!t.children&&e.idsToNotRepeat80Transparent.includes(t.rawData[n])?(t.alpha=.8,t.renderOrder=2e3):e.idsToNotRepeat80Transparent.push(t.rawData[n]),r&&!t.children&&e.idsToNotRepeat20Transparent.includes(t.rawData[r])?(t.alpha=.45,t.renderOrder=2e3):e.idsToNotRepeat20Transparent.push(t.rawData[r])},getWireframe:function(t,e){let i;return e&&!t.children&&this.idsToNotRepeatWireframe.includes(t.rawData[e])?i=!0:(i=!1,this.idsToNotRepeatWireframe.push(t.rawData[e])),i},Animation:function(t,e,i,n,r,a){let o,s=this,l=Date.now();s.legendsActive.forEach((t=>{t.remove()})),s.legendsActive=[];for(let c in e)if(document.getElementById(e[c].id))if(o=document.getElementById(e[c].id),e[c].inserted){let t="id="+e[c].id;findIndex(s.figures_in,t)<0&&s.figures_in.push(e[c])}else{let t="id="+e[c].id,h=findIndex(i,t);if(o.babiaRawData=e[c].rawData,h<0)e[c].inserted=!0,o.getAttribute("width")!=e[c].width&&o.setAttribute("width",e[c].width),o.getAttribute("height")!=e[c].height&&o.setAttribute("height",e[c].height),o.getAttribute("depth")!=e[c].depth&&o.setAttribute("depth",e[c].depth),o.getAttribute("color")!=e[c].color&&o.setAttribute("color",e[c].color),o.getAttribute("material").wireframe!=e[c].wireframe&&(o.setAttribute("material","wireframe",e[c].wireframe),o.setAttribute("material","wireframeLinewidth",.1));else if(this.resize(o,l,n,e[c],i[h]),this.traslate(o,l,n,e[c],i[h],r,a),o.getAttribute("color")==e[c].color||s.inEntitiesWithLegend(o)||o.setAttribute("color",e[c].color),o.getAttribute("material").wireframe!=e[c].wireframe&&(o.setAttribute("material","wireframe",e[c].wireframe),o.setAttribute("material","wireframeLinewidth",.1)),o.getAttribute("material").opacity!=e[c].alpha&&(o.setAttribute("material","opacity",e[c].alpha),o.object3D.renderOrder=e[c].renderOrder),e[c].children)this.Animation(o,e[c].children,i[h].children,n,e[c].translate_matrix,i[h].translate_matrix);else if(e[c].rawData[s.data.color]!==i[h].rawData[s.data.color]){let t;"number"==typeof e[c].rawData[s.data.color]?t=heatMapColorforValue(e[c].rawData[s.data.color],s.babiaMetadata.color_max,s.babiaMetadata.color_min):"string"==typeof e[c].rawData[s.data.color]&&(e[c].rawData[s.data.color]in s.categoricColorMaps?t=s.categoricColorMaps[e[c].rawData[s.data.color]]:(s.categoricColorMaps[e[c].rawData[s.data.color]]=colorsArray[s.categoricColorIndex],t=colorsArray[s.categoricColorIndex],s.categoricColorIndex=s.categoricColorIndex+1,s.categoricColorIndex>=colorsArray.length&&(s.categoricColorIndex=0))),t!==o.getAttribute("color")&&o.setAttribute("color",t)}}else{position={x:e[c].posX-r.x,y:e[c].height/2+r.y/2,z:-e[c].posY+r.z};let i=this.createElement(e[c],position);this.addEvents(i,e[c]),setOpacity(i,.5),t.appendChild(i),e[c].inserted=!0}this.duration;for(let t in i){let n="id="+i[t].id;if(findIndex(e,n)<0){findIndex(s.figures_del,n)<0&&s.figures_del.push(i[t]);let e=document.getElementById(i[t].id);e&&(e.object3D.visible=!1,e.remove())}}},inEntitiesWithLegend(t){let e;for(e=0;e<this.entitiesWithLegend.length;e++)if(this.entitiesWithLegend[e].entity===t)return!0;return!1},setFigures:function(t,e){const i=this;t.forEach((t=>{let n=document.getElementById(t.id);if(n){if(n.getAttribute("width")!=t.width&&n.setAttribute("width",t.width),n.getAttribute("height")!=t.height&&n.setAttribute("height",t.height),n.getAttribute("depth")!=t.depth&&n.setAttribute("depth",t.depth),i.inEntitiesWithLegend(n)?n.setAttribute("babiaxrFirstColor",t.color):n.getAttribute("color")!=t.color&&n.setAttribute("color",t.color),n.components.material.data.opacity<1&&setOpacity(n,1),n.getAttribute("material").opacity!=t.alpha&&n.setAttribute("material","opacity",t.alpha),i.data.treeLayout)if(i.data.treeHideOneSonQuarters&&t.children&&1===t.children.length&&(t.alphaTest=1,t.dontAddEvents=!0,t.children[0].dontAddLine=!0),i.data.treeFixQuarterHeight)if(void 0!==t.treeMetaphorHeight)n.object3D.position.set(t.posX-e.x,t.height/2+e.y/2+i.data.treeQuartersLevelHeight,-t.posY+e.z);else{let r=t.height/2+e.y/2-i.data.treeQuartersLevelHeight-i.data.zone_elevation,a=t.posX-e.x,o=-t.posY+e.z;if(n.object3D.position.set(a,r,o),t.height<i.data.treeQuartersLevelHeight&&(!i.data.treeHideOneSonQuarters||!t.dontAddLine)){let e=r,s=r+(i.treeQuartersLevelHeight-t.height/2),l=document.createElement("a-entity");l.setAttribute("class","babiaboatstreelines"),l.setAttribute("line",{start:{x:a,y:e,z:o},end:{x:a,y:s,z:o},color:"yellow"}),n.parentElement.appendChild(l)}}else if(void 0!==t.treeMetaphorHeight){let r=0;i.data.diffBuildingHeight&&(r=i.babiaMetadata.heightMin),n.object3D.position.set(t.posX-e.x,i.normalizeValues(r,i.babiaMetadata.heightMax,i.data.minBuildingHeight,i.data.maxBuildingHeight,t.treeMetaphorHeight),-t.posY+e.z)}else n.object3D.position.set(t.posX-e.x,t.height/2+e.y/2-t.height-.001,-t.posY+e.z);else n.object3D.position.set(t.posX-e.x,(parseFloat(t.height)+e.y)/2,-t.posY+e.z);t.children&&this.setFigures(t.children,t.translate_matrix)}}))},resize:function(t,e,i,n,r){if(e-this.start_time<this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)){let e,a,o,s=Math.abs(n.width-r.width),l=Math.abs(n.height-r.height),c=Math.abs(n.depth-r.depth),h=i*s/this.duration,d=i*l/this.duration,u=i*c/this.duration,p=parseFloat(t.getAttribute("width")),f=parseFloat(t.getAttribute("height")),g=parseFloat(t.getAttribute("depth"));e=n.width-r.width<0?p-h:p+h,a=n.height-r.height<0?f-d:f+d,o=n.depth-r.depth<0?g-u:g+u,t.setAttribute("width",e),t.setAttribute("height",a),t.setAttribute("depth",o),t.classList.contains("babiaquarterboxactivated")&&t.childNodes.forEach((t=>{t.classList.contains("babiaquarterlegendbox")&&(t.setAttribute("geometry","width",e),t.setAttribute("geometry","depth",o),t.setAttribute("material","opacity",.4))}))}else e-this.start_time>this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)&&(t.setAttribute("width",n.width),t.setAttribute("height",n.height),t.setAttribute("depth",n.depth),t.classList.contains("babiaquarterboxactivated")&&t.childNodes.forEach((t=>{t.classList.contains("babiaquarterlegendbox")&&(t.setAttribute("geometry","width",new_width),t.setAttribute("geometry","depth",new_depth),t.setAttribute("material","opacity",.4))})))},traslate:function(t,e,i,n,r,a,o){let s=r.posX-o.x-(n.posX-a.x),l=n.height-r.height,c=r.posY-o.z-(n.posY-a.z);if(0!=s||0!=l||0!=c)if(e-this.start_time<this.duration){let e=i*s/this.duration,n=i*l/(2*this.duration),r=i*c/this.duration,a=parseFloat(t.object3D.position.x)-e,o=parseFloat(t.object3D.position.y)+n,h=parseFloat(t.object3D.position.z)+r;t.object3D.position.set(a,o,h)}else e-this.start_time>this.duration&&t.object3D.position.set(n.posX-a.x,(parseFloat(n.height)+a.y)/2,-n.posY+a.z)},createElement:function(t,e){let i=this,n=document.createElement("a-box");n.id=t.id,n.setAttribute("class","babiaxraycasterclass");let r=t.width,a=t.height,o=t.depth;if(t.children){let e=t.name.split("/").length-1;t.hierarchyLevel=e,n.object3D.renderOrder=e,i.data.gradientBaseColor?color=greenColorsurface(Math.round(i.normalizeValues(1,i.babiaMetadata.maxLevels,15,100,e))):color=i.data.base_color}else i.data.color?"number"==typeof t.rawData[i.data.color]?color=heatMapColorforValue(t.rawData[i.data.color],i.babiaMetadata.color_max,i.babiaMetadata.color_min):"string"==typeof t.rawData[i.data.color]?t.rawData[i.data.color]in i.categoricColorMaps?color=i.categoricColorMaps[t.rawData[i.data.color]]:(i.categoricColorMaps[t.rawData[i.data.color]]=colorsArray[i.categoricColorIndex],color=colorsArray[i.categoricColorIndex],i.categoricColorIndex=i.categoricColorIndex+1,i.categoricColorIndex>=colorsArray.length&&(i.categoricColorIndex=0)):color=i.data.building_color:color=i.data.building_color;return n.setAttribute("color",color),n.setAttribute("babiaxrFirstColor",color),n.setAttribute("width",r),n.setAttribute("height",a),n.setAttribute("depth",o),n.object3D.renderOrder=t.renderOrder,t.rawData&&(n.babiaRawData=t.rawData),i.data.highlightBuildingByField&&t.rawData&&n.setAttribute("babia-highlightbuildingbyfield",String(t.rawData[i.data.highlightBuildingByField]).replace("/","").replace("@","")),n.setAttribute("position",{x:e.x,y:e.y,z:e.z}),n.setAttribute("material","opacity",t.alpha),n.setAttribute("material","wireframe",t.wireframe),n.setAttribute("material","wireframeLinewidth",.1),t.alphaTest&&(n.setAttribute("material","alphaTest",t.alphaTest),n.removeAttribute("class")),n},processData:function(t){const e=this;let i=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.categoricColorMaps={},this.categoricColorIndex=0,i.color){let[t,e,n]=getMaxMinValues(this.newData,i.color,[]);this.babiaMetadata.color_max=t,this.babiaMetadata.color_min=e;let r=Math.round(n.reduce(((t,e)=>t+e),0)/n.length);this.babiaMetadata.colorAvg=r}let[n,r,a]=getMaxMinValues(this.newData,i.height,[]);this.babiaMetadata.heightMax=n,this.babiaMetadata.heightMin=r;let o=Math.round(a.reduce(((t,e)=>t+e),0)/a.length);if(this.babiaMetadata.heightAvg=o,this.babiaMetadata.maxLevels=getLevels(this.newData,0),i.area){let[t,e,n]=getMaxMinValues(this.newData,i.area,[]);this.babiaMetadata.areaMax=t,this.babiaMetadata.areaMin=e,this.babiaMetadata.areaAvg=Math.round(n.reduce(((t,e)=>t+e),0)/n.length)}else{let[t,e,n]=getMaxMinValues(this.newData,i.width,[]);this.babiaMetadata.widthMax=t,this.babiaMetadata.widthMin=e,this.babiaMetadata.widthAvg=Math.round(n.reduce(((t,e)=>t+e),0)/n.length);let[r,a,o]=getMaxMinValues(this.newData,i.depth,[]);this.babiaMetadata.depthMax=r,this.babiaMetadata.depthMin=a,this.babiaMetadata.depthAvg=Math.round(o.reduce(((t,e)=>t+e),0)/o.length)}if(this.data.metricsInfoId){let t=`Metrics information\nMETRIC (FIELD): MIN - MAX - AVG\n\nHeight (${i.height}) - ${r} - ${n} - ${o}`;this.data.area?t+=`\nArea (${i.area}) - ${this.babiaMetadata.areaMin} - ${this.babiaMetadata.areaMax} - ${this.babiaMetadata.areaAvg}`:(t+=`\nWidth (${i.width}) - ${this.babiaMetadata.widthMin} - ${this.babiaMetadata.widthMax} - ${this.babiaMetadata.widthAvg}`,t+=`\nDepth (${i.depth}) - ${this.babiaMetadata.depthMin} - ${this.babiaMetadata.depthMax} - ${this.babiaMetadata.depthAvg}`),this.data.color&&"string"!=typeof this.babiaMetadata.color_max&&(document.getElementById(this.data.numericColorLegendId).setAttribute("visible",!0),t+=`\nColor (${i.color}) - ${this.babiaMetadata.color_min} - ${this.babiaMetadata.color_max} - ${this.babiaMetadata.colorAvg}`),document.getElementById(this.data.metricsInfoId).setAttribute("text",{value:t,align:"center",width:3,color:"black",alphaTest:6,opacity:6,transparent:!1})}if(this.notiBuffer.set(this.newData),this.data.treeLayout&&this.data.treeFixQuarterHeight&&this.removeTreeLines(),console.log("About to update chart...",this.newData),this.updateChart(this.newData),this.data.metricsInfoId&&"number"!=typeof this.babiaMetadata.color_max){document.getElementById(e.data.numericColorLegendId).setAttribute("visible",!1),e.entityCatColorLegend&&(e.entityCatColorLegend.remove(),e.entityCatColorLegend=void 0);let t=document.getElementById(this.data.metricsInfoId);e.entityCatColorLegend=document.createElement("a-plane"),e.entityCatColorLegend.setAttribute("position","-3 0 0"),e.entityCatColorLegend.setAttribute("width",2.8),e.entityCatColorLegend.setAttribute("height",5),e.entityCatColorLegend.setAttribute("position","-3 0 0"),e.entityCatColorLegend.setAttribute("material","color","#B7B7B7");let i=2.2,n=`COLOR LEGEND (${this.data.color})`,r=document.createElement("a-entity");r.setAttribute("text",{value:n,align:"center",width:3,color:"black"}),r.setAttribute("position",{x:0,y:i,z:0}),i-=.2,e.entityCatColorLegend.appendChild(r);for(const[t,n]of Object.entries(this.categoricColorMaps)){let r=`${t}: ${n}`,a=document.createElement("a-entity");a.setAttribute("text",{value:r,align:"center",width:3,color:n}),a.setAttribute("position",{x:0,y:i,z:0}),i-=.15,e.entityCatColorLegend.appendChild(a)}t.appendChild(e.entityCatColorLegend)}else this.data.metricsInfoId&&"number"==typeof this.babiaMetadata.color_max&&e.entityCatColorLegend&&(e.entityCatColorLegend.remove(),e.entityCatColorLegend=void 0)},removeTreeLines:function(){let t=this.el.querySelectorAll(".babiaboatstreelines");for(line of t)line.remove()},normalizeValues:function(t,e,i,n,r){return(r-t)/(e-t)*(n-i)+i},addEvents:function(t,e){let i=this;if(e.children){if(!e.dontAddEvents){let n;t.addEventListener("click",(function(r){if(r.target===this)if(t.legend){i.data.hideQuarterBoxLegend||i.el.parentElement.removeChild(n),i.data.highlightQuarterByClick&&(t.setAttribute("material","color",t.getAttribute("babiaxrFirstColor")),t.setAttribute("babiaxrHightlightedByClick",!1)),t.classList.remove("babiaquarterboxactivated"),i.data.legendsAsChildren?t.removeChild(t.legend):i.el.parentElement.removeChild(t.legend);const e=i.entitiesWithLegend.findIndex((e=>e.entity===t));e>-1&&i.entitiesWithLegend.splice(e,1);const r=i.legendsActive.indexOf(t.legend);e>-1&&i.legendsActive.splice(r,1),t.legend=void 0,n=void 0}else{let r=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld);if(!i.data.hideQuarterBoxLegend){n=document.createElement("a-entity"),n.setAttribute("class","babiaquarterlegendbox"),t.classList.add("babiaquarterboxactivated");let e=t.getAttribute("geometry"),a=i.el.getAttribute("scale")||{x:1,y:1,z:1},o=e.height*a.y+i.data.height_quarter_legend_box;n.setAttribute("geometry",{height:o,depth:e.depth*a.z,width:e.width*a.x}),n.setAttribute("material",{visible:!0,opacity:.4}),n.object3D.renderOrder=1e9,n.setAttribute("position",r),i.el.parentElement.appendChild(n)}i.data.highlightQuarterByClick&&t.setAttribute("material","color","#bfbfbf");let a={x:r.x,y:i.data.height_quarter_legend_title,z:r.z};t.legend=generateLegend(t.babiaRawData||{},{name:e.name,scale:i.data.legend_scale,lookat:i.data.legend_lookat,template:i.data.legend_text||"{name}",colorPlane:"black",colorText:"white",isQuarter:!0,fields:{}}),i.data.legendsAsChildren?(t.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),t.legend.setAttribute("visible",!0),t.appendChild(t.legend)):(t.legend.setAttribute("position",a),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend)),i.entitiesWithLegend.push({figure:e,entity:t}),i.legendsActive.push(t.legend)}}))}this.drawElements(t,e.children,e.translate_matrix)}else{let n;t.alreadyActive=!1,t.addEventListener("click",(function(r){if(r.target===this)if(t.alreadyActive){if(i.data.highlightQuarter)if(1==parseInt(t.parentElement.getAttribute("babiaxrHightlighted"))){let e=t.parentElement.getAttribute("position");t.parentElement.setAttribute("position",{x:e.x,y:t.parentElement.getAttribute("babiaxrFirstYPosition"),z:e.z}),t.parentElement.setAttribute("material",{color:t.parentElement.getAttribute("babiaxrFirstColor")}),t.parentElement.setAttribute("babiaxrHightlighted",0)}else{let e=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"));t.parentElement.setAttribute("babiaxrHightlighted",e-1)}t.legend.setAttribute("visible",!1),t.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.data.legendsAsChildren?t.removeChild(t.legend):i.el.parentElement.removeChild(t.legend);const e=i.entitiesWithLegend.findIndex((e=>e.entity===t));e>-1&&i.entitiesWithLegend.splice(e,1);const r=i.legendsActive.indexOf(t.legend);if(e>-1&&i.legendsActive.splice(r,1),i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{if(t!==e&&e.highlightbuildingbyfieldactive&&!e.alreadyActive){let t=e.getAttribute("babiaxrBeforeBuildingHighlight");e.setAttribute("material","color",t),e.highlightbuildingbyfieldactive=!1}}))}t.legend=void 0,t.alreadyActive=!1}else{if(t.highlightbuildingbyfieldactive)return;if(t.alreadyActive=!0,!t.legend){n=t.getAttribute("geometry");let r=t.getAttribute("position");t.setAttribute("position",r),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t.legend=generateLegend(t.babiaRawData,{name:e.name,scale:i.data.legend_scale,lookat:i.data.legend_lookat,template:i.data.legend_text,colorPlane:"white",colorText:"black",isQuarter:!1,fields:{height:i.data.height,area:i.data.area,width:i.data.width,depth:i.data.depth,color:i.data.color}});let a=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),o=(new THREE.Box3).setFromObject(t.object3D),s={x:a.x,y:o.max.y+1+i.data.height_building_legend,z:a.z};i.data.legendsAsChildren?(t.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),t.legend.setAttribute("visible",!0),t.appendChild(t.legend)):(t.legend.setAttribute("position",s),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend))}if(i.data.highlightQuarter)if(t.parentElement.getAttribute("babiaxrHightlighted")&&0!=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"))){let e=parseInt(t.parentElement.getAttribute("babiaxrHightlighted"));t.parentElement.setAttribute("babiaxrHightlighted",e+1)}else{let e=t.parentElement.getAttribute("position");t.parentElement.setAttribute("babiaxrFirstYPosition",e.y),t.parentElement.setAttribute("position",{x:e.x,y:e.y+.2,z:e.z}),t.parentElement.setAttribute("material","color","#bfbfbf"),t.parentElement.setAttribute("babiaxrHightlighted",1)}if(i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{t===e||e.highlightbuildingbyfieldactive||e.alreadyActive||(e.highlightbuildingbyfieldactive=!0,e.setAttribute("babiaxrBeforeBuildingHighlight",e.getAttribute("material").color),e.setAttribute("material","color",i.data.highlightBuildingByFieldColor))}))}i.entitiesWithLegend.push({figure:e,entity:t}),i.legendsActive.push(t.legend)}})),t.addEventListener("mouseenter",(function(){if(!t.alreadyActive){n=t.getAttribute("geometry");let r=t.getAttribute("position");t.setAttribute("position",r);let a="undefined"!==t.getAttribute("material").color?t.getAttribute("material").color:i.data.building_color;t.setAttribute("babiaxrFirstColor",a),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t.legend=generateLegend(t.babiaRawData,{name:e.name,scale:i.data.legend_scale,lookat:i.data.legend_lookat,template:i.data.legend_text,colorPlane:"white",colorText:"black",isQuarter:!1,fields:{height:i.data.height,area:i.data.area,width:i.data.width,depth:i.data.depth,color:i.data.color}});let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),s=(new THREE.Box3).setFromObject(t.object3D),l={x:o.x,y:s.max.y+1+i.data.height_building_legend,z:o.z};if(i.data.legendsAsChildren?(t.legend.setAttribute("position",{x:0,y:i.data.legendsAsChildrenHeight,z:0}),t.legend.setAttribute("visible",!0),t.appendChild(t.legend)):(t.legend.setAttribute("position",l),t.legend.setAttribute("visible",!0),i.el.parentElement.appendChild(t.legend)),i.data.highlightBuildingByField){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{t===e||e.highlightbuildingbyfieldactive||e.alreadyActive||(e.highlightbuildingbyfieldactive=!0,e.setAttribute("babiaxrBeforeBuildingHighlight",e.getAttribute("material").color),e.setAttribute("material","color",i.data.highlightBuildingByFieldColor))}))}}})),t.addEventListener("mouseleave",(function(){if(!t.alreadyActive&&t.legend&&(t.legend.setAttribute("visible",!1),t.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.data.legendsAsChildren?t.removeChild(t.legend):i.el.parentElement.removeChild(t.legend),t.legend=void 0),i.data.highlightBuildingByField&&!t.alreadyActive&&!t.highlightbuildingbyfieldactive){let e=t.getAttribute("babia-highlightbuildingbyfield");document.querySelectorAll(`[babia-highlightbuildingbyfield=${e}]`).forEach((e=>{if(t!==e&&e.highlightbuildingbyfieldactive&&!e.alreadyActive){let t=e.getAttribute("babiaxrBeforeBuildingHighlight");e.setAttribute("material","color",t),e.highlightbuildingbyfieldactive=!1}}))}}))}}});let generateLegend=(t,{name:e,scale:i,lookat:n,template:r="{name}",colorPlane:a="white",colorText:o="black",isQuarter:s=!1,fields:l={}})=>{const c=(t,e="")=>void 0!==t?t:e,h=t=>"number"==typeof t?Math.round(100*t)/100:t,d=l.height||"",u=l.area||"",p=l.width||"",f=l.depth||"",g=l.color||"",m=h(c(t?.[d])),b=h(c(t?.[u])),v=h(c(t?.[p])),y=h(c(t?.[f])),_=c(t?.[g]),A=s?e:r.replaceAll("{name}",e).replaceAll("{fheight}",d).replaceAll("{farea}",u).replaceAll("{fwidth}",p).replaceAll("{fdepth}",f).replaceAll("{fcolor}",g).replaceAll("{height}",m).replaceAll("{area}",b).replaceAll("{width}",v).replaceAll("{depth}",y).replaceAll("{color}",_),x=A.split("\n"),E=Math.max(...x.map((t=>t.length)))/5,C=.3*x.length+.3,M=document.createElement("a-plane");return M.setAttribute("babia-lookat",n),M.setAttribute("rotation",{x:0,y:0,z:0}),M.setAttribute("height",C),M.setAttribute("width",E),M.setAttribute("color",a),M.setAttribute("material",{side:"double"}),M.setAttribute("text",{value:A,align:"center",width:6,color:o,alphaTest:6,opacity:6,transparent:!1}),M.setAttribute("visible",!1),M.setAttribute("class","babialegend"),M.setAttribute("scale",{x:i,y:i,z:i}),M};function setOpacity(t,e){if(t.setAttribute("material","opacity",e),t.childNodes)for(let i=0;i<t.childNodes.length;i++)setOpacity(t.childNodes[i],e)}let getLevels=(t,e)=>{let i=e,n=e;for(let r in t)t[r].children&&(i++,n<(e=getLevels(t[r].children,i))&&(n=e),i--);return n},getMaxMinValues=(t,e,i,n,r)=>{for(let a=0;a<t.length;a++)t[a].children?[n,r]=getMaxMinValues(t[a].children,e,i,n,r):(("null"!==t[a][e]&&!n||t[a][e]>n)&&(n=t[a][e]),("null"!==t[a][e]&&void 0===r||t[a][e]<r)&&(r=t[a][e]),i.push(t[a][e]));return[n,r,i]};function heatMapColorforValue(t,e,i){let n=[19,82,138],r=[255,94,83];var a=((((t||0)-i)/(e-i)*2-1)/1+1)/2,o=1-a,s=[Math.round(r[0]*a+n[0]*o),Math.round(r[1]*a+n[1]*o),Math.round(r[2]*a+n[2]*o)];return"rgb("+s[0]+","+s[1]+","+s[2]+")"}let findIndex=(t,e)=>{for(e=e.split("="),i=0;i<t.length;i++)if(t[i][e[0]]===e[1])return i;return-1},greenColorsurface=t=>"hsl(140, 100%,"+t+"%)"},9722:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(t,e,i,n,a,o,s,l,c,h){let d=r.get(i,n);console.log("Generating bubble..."),l?(t/=l,e/=l):(c||h)&&(c&&(t*=c),h&&(e*=h));let u=document.createElement("a-sphere");if(u.setAttribute("color",d),u.setAttribute("radius",e),s){let i=a.toString()+" "+e.toString()+" "+o.toString(),n=a.toString()+" "+(e+t).toString()+" "+o.toString();u.setAttribute("animation__position",{property:"position",from:i,to:n,dur:"3000",easing:"linear"})}else u.setAttribute("position",{x:a,y:e+t,z:o});return u}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,i){let n=e[t.x_axis]+": \n Radius:"+e[t.radius]+"\nHeight:"+e[t.height],r=2;n.length>16&&(r=n.length/8);let a=i.getAttribute("position"),o=parseFloat(i.getAttribute("radius")),s=document.createElement("a-plane");return s.setAttribute("position",{x:a.x,y:a.y+o+1,z:a.z+.1}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",r),s.setAttribute("color","white"),s.setAttribute("text",{value:n,align:"center",width:6,color:"black"}),s.classList.add("babiaxrLegend"),s.setAttribute("babia-lookat",t.legend_lookat),s.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),s}(t,i,e),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-bubbles",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=n(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-bubbles:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette,a=e.scale;let o=e.heightMax,c=e.radiusMax,h=[],d=[],u=[],p=[],f=0,g=0,m=0,b=0,v=0,y=0,_={},A={},x=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),E=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(x/=a,E/=a),o||(o=x),proportion=o/x,c||(c=E),radius_scale=c/E,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl),a?(v=E/a,y=E/a):(v=E*radius_scale,y=E*radius_scale);for(let o of t){let t=o[e.x_axis],c=o[e.z_axis],x=o[e.height],C=o[e.radius];_[t]?(m=_[t].posX,f=_[t].colorId):(m+=a?2*E/a+.5:2*E*radius_scale+.5,f=g,_[t]={posX:m,colorId:f},h.push(t),d.push(m),g++),A[c]?b=A[c].posZ:(b=a?y+2*E/a+.5:y+2*E*radius_scale+.5,A[c]={posZ:b},u.push(c),p.push(b)),m>v&&(v=m),b>y&&(y=b);let M=s(x,C,f,r,m,b,n,a,proportion,radius_scale);M.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(M),e.legend&&l(e,M,o,i)}if(e.axis){const t=v,e=y,i=o;this.updateAxis(h,d,t,u,p,e,x,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,o,s){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-y",{maxValue:o,length:s}),c.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-z",{labels:n,ticks:r,length:a}),h.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),c.setAttribute("babia-axis-y","name",this.data.height),h.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating bubbles..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},9530:(t,e,i)=>{let n=i(1392).findProdComponent;const r=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-city",{schema:{from:{type:"string"},absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string"},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else if(e.from!==t.from)this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)));else if(e!==t&&this.newData){for(console.log("Generating city...");this.el.firstChild;)this.el.firstChild.remove();this.processData(this.newData)}},dataComponent:void 0,dataComponentDataPropertyName:"babiaData",dataComponentEventName:void 0,babiaData:void 0,babiaMetadata:{id:0},visProperties:["fheight","farea"],processData:function(t){let e;console.log("processData",t),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e=this.newData.length>0?{id:"init",children:this.newData}:this.newData.length<=0?this.newData[0]:this.newData,console.log("toSave",e),this.notiBuffer.set(e),a(this,e)}});let a=(t,e)=>{t.loader=new THREE.FileLoader;let i=t.data,n=t.el;c=i.building_color;let r=n;n.emit("babiaxr-dataLoaded",{data:e,codecity:!0}),h=i.time_evolution_delta,t.zone_data=e;let a,s,d=new o({data:t.zone_data,extra:function(t){return t*i.extra},farea:i.farea,fheight:i.fheight,fmaxarea:i.fmaxarea});1==i.absolute?(a=Math.sqrt(d.areas.canvas)*i.width/i.depth,s=d.areas.canvas/a):(a=i.width,s=i.depth);let u=!1,p=new l({width:a,depth:s,x:0,z:0});d.add_rects({rect:p,split:i.split,relative:u});let f=document.createElement("a-entity");t.base=f,d.draw_rects({ground:p,el:f,base:i.base,level:0,elevation:0,relative:u,base_thick:i.base_thick,wireframe:i.wireframe,building_color:i.building_color,base_color:i.base_color,model:i.building_model,visible:!0,titles:i.titles,rootCodecityEntity:r}),n.appendChild(f)},o=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea]||.5,n.max_area=i[this.fmaxarea]||.5,n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new s(e.children.map((t=>t.canvas)),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:n=0,elevation:r=0,relative:a=!0,base_thick:o=.2,wireframe:s=!1,building_color:l="red",base_color:c="green",model:h=null,visible:u=!0,titles:p=!0,rootCodecityEntity:f}){let g=this;if(0===n&&(this.el=e),this.pending_rects,"children"in i){let t=i.rect.box({elevation:r,height:o,color:c,inner:!1,wireframe:s,visible:u,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)f.removeChild(i),f.parentElement.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let n=t.getAttribute("geometry"),r=t.getAttribute("position"),a=f.getAttribute("scale"),o=n.height+11;a&&(o=(n.height+11)/a.y),i.setAttribute("geometry",{height:o,depth:n.depth,width:n.width}),i.setAttribute("position",r),i.setAttribute("material",{visible:!0,opacity:.4}),f.appendChild(i),e=d(this.getAttribute("id"),"black","white");let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l={x:s.x,y:12,z:s.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let g=t;a||(g=e);for(const t of i.children){let e=o/2;a||(e=r+o),this.draw_rects({ground:i.rect,el:g,area:t,level:n+1,elevation:e,relative:a,building_color:l,base_color:c,model:h,base_thick:o,wireframe:s,visible:u,titles:p,rootCodecityEntity:f})}}else{let t=i.rect.box({height:i.data[this.fheight],elevation:r,wireframe:s,color:l,model:h,visible:u,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,n,r=!1;t.addEventListener("click",(function(){r?(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=d(this.getAttribute("id"),"white","black",i.data,g.fheight,g.farea);let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),s=(new THREE.Box3).setFromObject(t.object3D),l={x:o.x,y:s.max.y+1,z:o.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e),f.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0)}))}}}},s=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce(((t,e)=>t+e),0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new s(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:s.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:s.range(0,r),a2:[r+1],a3:[]};let a=t*e,o=this.scaled_area(a,r),l=Math.sqrt(o)*e-o,c=0,h=c,d=r+1;for(;c<l&&d<this.items.length;)h=c,c+=this.scaled_area(a,d),d++;let u=d;return d-1>r&&Math.abs(c-l)>Math.abs(h-l)&&(u=d-1),i=u-r-1,n=this.items.length-u,{pivot:r,a1:s.range(0,r),a2:s.range(r+1,i),a3:s.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},l=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,o]=this.idims_as_laying(),s=i/t.total,c=-i/2,h=0;e||(c+=r,h=a);let d=[];for(const e of t.items){let t=e*s,i=new l({width:t,depth:n,x:c+t/2,z:h});o&&i.reflect(),d.push(i),c+=t}return d}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,o]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:s,a1:c,a2:h,a3:d}=t.pivot_regions(i,n),u=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(s),i),f=t.pivot_region_width(d,i),g=r-i/2+u/2,m=r-i/2+u+p/2,b=r-i/2+u+p+f/2,v=[],y=t.scaled_area(i*n,s)/p;v[s]=new l({width:p,depth:y,x:m,z:a+n/2-y/2});let _=[[c,u,n,g,a],[h,p,n-y,m,a-y/2],[d,f,n,b,a]];for(const[e,i,n,r,a]of _)if(e.length>0){let o=new l({width:i,depth:n,x:r,z:a});o.inner();let s=t.values_i(e),c=o.split_pivot(s,!1),h=0;for(const t of e)v[t]=c[h],h++}if(o)for(const t of v)t.reflect();return v}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:o=!0,id:s="",rawarea:l=0,inner_real:c=!1}){let h,d;[h,d]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let u=document.createElement("a-entity");return u.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:d,height:t}),u.setAttribute("material",{color:i}),u.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),u.setAttribute("id",s),u.setAttribute("babiaxr-rawarea",l),u}};t.exports={Values:s,Rectangle:l,Zone:o};let c,h=8e3,d=(t,e,i,n,r,a)=>{let o=2;if(t.length>16&&(o=t.length/8),n){let e="\n "+r+" (height): "+n[r];e.length>16&&(o=e.length/8),t+=e;let i="\n "+a+" (area): "+n[a];i.length>16&&i>e&&(o=i.length/8),t+=i}let s=document.createElement("a-plane");return s.setAttribute("babia-lookat","[camera]"),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",o),s.setAttribute("color",e),s.setAttribute("material",{side:"double"}),s.setAttribute("text",{value:t,align:"center",width:6,color:i}),s.setAttribute("visible",!1),s}},7232:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cyls",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},radiusMax:{type:"number",default:2},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","radius","x_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateChart:function(){let t=this.newData;t=this.currentData?this.currentData:this.newData,console.log("Data babia-cyls:",t);const e=this.data;this.el,this.updateTitle();let i=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=i;let n=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));this.radius_scale=e.radiusMax/n;let r=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),a={};for(let t of r)a[t.getAttribute("babia-name")]={el:t,found:!1};let o,l=[],c=[],h=0;for(let i=0;i<t.length;i++){let n,r,d=t[i],u=d[e.x_axis];n=0==i?.5+d[e.radius]*this.radius_scale:c[i-1]+o+.5+d[e.radius]*this.radius_scale,a[u]&&!d._not?(r=a[u].el,a[u].found=!0):(r=document.createElement("a-entity"),r.setAttribute("babia-name",u),r.id=d[e.index],r.object3D.position.x=n,this.chartEl.appendChild(r)),s(this,r,e,d,h,u,n,0),l.push(u),c.push(n),h++,o=d[e.radius]*this.radius_scale}for(let t in a)a[t].found||a[t].el.remove();if(e.axis){const i=c[c.length-1]+(t[0][e.radius]+t[t.length-1][e.radius])*this.radius_scale/2;this.updateAxis(l,c,i,this.maxValue)}},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cyls..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let s=(t,e,i,n,a,o,s,l,c)=>{e.setAttribute("babia-cyl",{height:n[i.height]*t.lengthY/t.maxValue,radius:n[i.radius]*t.radius_scale,color:r.get(a,i.palette),label:"events",animation:i.animation}),i.legend&&(c?e.setAttribute("babia-cyl",{labelText:o+" | "+c+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius],labelLookat:i.legend_lookat,labelScale:i.legend_scale}):e.setAttribute("babia-cyl",{labelText:o+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius],labelLookat:i.legend_lookat,labelScale:i.legend_scale})),s!==e.object3D.position.x&&(i.animation?e.setAttribute("animation",{property:"object3D.position.x",to:s,dur:i.dur}):e.object3D.position.x=s),l!==e.object3D.position.z&&(i.animation?e.setAttribute("animation",{property:"object3D.position.z",to:l,dur:i.dur}):e.object3D.position.z=l)},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)};t.exports.createCylinder=s},7040:(t,e,n)=>{let r=n(1392).updateTitle;n(1392).colors;let a=n(1392).updateFunction,o=n(7232).createCylinder;const s=n(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cylsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number",default:2},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new s,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateChart:function(){const t=this.newData,e=this.data;let n=[],r=[],a=new Array,s=0,c=[],h=[];for(i=0;i<t.length;i++){let o=t[i][e.x_axis],s=t[i][e.z_axis];n.includes(o)||n.push(o),r.includes(s)||r.push(s);let l=n.indexOf(o),c=r.indexOf(s);if(a[l])a[l][c]=t[i][e.radius];else{let n=new Array;n[c]=t[i][e.radius],a[l]=n}}let d=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*this.maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=d;let u=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));for(this.radius_scale=e.radiusMax/u,i=0;i<n.length;i++){let t=Math.max.apply(Math,a[i].filter((function(t){if(""!=t)return t})));if(0==i)c.push(t*this.radius_scale);else{let e=Math.max.apply(Math,a[i-1].filter((function(t){if(""!=t)return t})));c.push(c[i-1]+t*this.radius_scale+.5+e*this.radius_scale)}}for(j=0;j<r.length;j++)rad_0=l(a,n.length,j),0==j?h.push(rad_0*this.radius_scale):(rad_1=l(a,n.length,j-1),h.push(h[j-1]+rad_1*this.radius_scale+.5+rad_0*this.radius_scale));let p=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),f={};for(let t of p)f[t.getAttribute("babia-name")]={el:t,found:!1};for(let i=0;i<t.length;i++){let a,l=t[i],d=l[e.x_axis],u=l[e.z_axis],p=d+"-"+u,g=c[n.indexOf(d)],m=h[r.indexOf(u)];f[p]&&!l._not?(a=f[p].el,f[p].found=!0):(a=document.createElement("a-entity"),a.setAttribute("babia-name",p),a.id=p,a.object3D.position.x=g,a.object3D.position.z=m,this.chartEl.appendChild(a)),s=n.indexOf(d),o(this,a,e,l,s,d,g,m,u)}for(let t in f)f[t].found||f[t].el.remove();if(e.axis){let t=Math.max.apply(Math,a[n.length-1].filter((function(t){if(""!=t)return t})));const e=c[c.length-1]+t*this.radius_scale+.5,i=h[h.length-1]+l(a,n.length,r.length-1)*this.radius_scale+.5;c+=.25,h+=.25,this.updateAxis(n,c,e,d,r,h,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,o){const s=this.data;s.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:s.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:o,palette:s.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),s.axis_name&&((s.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",s.index):this.xAxisEl.setAttribute("babia-axis-x","name",s.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",s.height),this.zAxisEl.setAttribute("babia-axis-z","name",s.z_axis)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cylsmap..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let l=(t,e,n)=>{let r=0;for(i=0;i<e;i++)t[i][n]&&r<t[i][n]&&(r=t[i][n]);return r}},575:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(t,e,i,n,a){let o=r.get(n,a);console.log("Generating slice...");let s=document.createElement("a-torus");return s.setAttribute("color",o),s.setAttribute("rotation",{x:90,y:0,z:t}),s.setAttribute("arc",e),s.setAttribute("side","double"),s.setAttribute("radius",i),s.setAttribute("radius-tubular",i/4),s}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:1,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r.setAttribute("babia-lookat",t.legend_lookat),r.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-doughnut",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){a(this,t)},tick:function(t,e){let i=this;if(this.data.animation&&this.loaded){let n=i.el.children[0].children;for(let i in this.slice_array){let r=this.slice_array[i].delay,a=this.slice_array[i].arc,o=parseFloat(n[i].getAttribute("arc"));t>=r&&o<a&&(o+=360*e/this.total_duration,o>a&&(o=a),n[i].setAttribute("arc",o))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-doughnut",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,o=0,c=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.chartEl.setAttribute("rotation",{y:90}),i.appendChild(this.chartEl);let d=0;for(let u of t){let t;if(o=360*u[e.size]/h,n){let e=this.total_duration*o/360;this.slice_array.push({arc:o,duration:e,delay:d}),d+=e,t=s(a,.01,1,c,r)}else t=s(a,o,1,c,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=o,e.legend&&l(e,t,u,i),c++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating doughnut..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},7552:()=>{AFRAME.registerComponent("babia-html",{schema:{html:{type:"string"},distanceLevels:{type:"float",default:.7},renderHTML:{type:"boolean",default:!1},renderHTMLOnlyLeafs:{type:"boolean",default:!1}},babiaDiv:null,clickedBoxes:new Map,init:function(){const t=this.data;this.observer=new MutationObserver((t=>{t.forEach((t=>{t.addedNodes&&t.addedNodes.forEach((t=>{if("babiaHtmlDiv"===t.id){console.log('A div with id "babiaHtmlDiv" has been rendered in the DOM');for(let e=0;e<t.children.length;e++)this.processNodeNoOffset(t.children[e],null,0);this.observer.disconnect()}}))}))})),this.observer.observe(document.body,{childList:!0,subtree:!0}),babiaDiv=document.createElement("div"),babiaDiv.setAttribute("id","babiaHtmlDiv"),babiaDiv.innerHTML=t.html,document.body.appendChild(babiaDiv)},processNodeNoOffset:function(t,e,i){const n=this.el,r=t.getBoundingClientRect(),a=.01;e||(e={x:r.left*a,y:r.top*a});const o=r.right*a-r.width*a/2-e.x,s=-r.bottom*a+r.height*a/2+e.y,l=document.createElement("a-box");if(l.setAttribute("position",`${o} ${s} ${i*this.data.distanceLevels}`),l.setAttribute("width",r.width*a),l.setAttribute("height",r.height*a),l.setAttribute("depth",.01),l.classList.add("babiaxraycasterclass"),l.setAttribute("html-content",t.outerHTML),l.addEventListener("mouseenter",(()=>{l.classList.contains("clicked")||this.showHtmlContent(l,t.outerHTML,"temp")})),l.addEventListener("mouseleave",(()=>{l.classList.contains("clicked")||this.removeHtmlContent("temp")})),l.addEventListener("click",(e=>{e.stopPropagation(),l.classList.contains("clicked")?(l.classList.remove("clicked"),this.removeHtmlContent("permanent",l)):(l.classList.add("clicked"),this.showHtmlContent(l,t.outerHTML,"permanent"))})),this.data.renderHTML&&"undefined"!=typeof html2canvas?this.data.renderHTMLOnlyLeafs?0==t.children.length?html2canvas(t).then((function(t){l.setAttribute("material",{shader:"flat",src:t.toDataURL()})})):l.setAttribute("color",this.colors_grad[i%this.colors_grad.length]):html2canvas(t).then((function(t){l.setAttribute("material",{shader:"flat",src:t.toDataURL()})})):l.setAttribute("color",this.colors_grad[i%this.colors_grad.length]),n.appendChild(l),i>0){let t=document.createElement("a-entity");t.setAttribute("line",{start:`${o} ${s} ${i*this.data.distanceLevels}`,end:`${o} ${s} ${i*this.data.distanceLevels-this.data.distanceLevels}`,color:"yellow"}),n.appendChild(t)}for(let n=0;n<t.children.length;n++)this.processNodeNoOffset(t.children[n],e,i+1)},showHtmlContent:function(t,e,i){"temp"===i&&this.removeHtmlContent("temp");const n=document.createElement("a-plane");n.setAttribute("class",`${i}-plane`);let r=t.getAttribute("position");n.setAttribute("position",{x:r.x,y:r.y+1,z:r.z+.2}),n.setAttribute("width","3");const a=e.split("\n").length,o=Math.max(.15*a,.2);n.setAttribute("height",o),n.setAttribute("color","white");const s=document.createElement("a-text");s.setAttribute("value",e),s.setAttribute("color","black"),s.setAttribute("align","left"),s.setAttribute("width","2.5"),s.setAttribute("position","-1 0 0.01"),n.appendChild(s),this.el.appendChild(n),"permanent"===i&&(t.permanentPlane=n)},removeHtmlContent:function(t,e){if("temp"===t){const t=document.querySelector(".temp-plane");t&&t.parentNode.removeChild(t)}else"permanent"===t&&e&&(e.permanentPlane&&(e.permanentPlane.parentNode.removeChild(e.permanentPlane),e.permanentPlane=null),this.clickedBoxes.delete(e))},colors_grad:["#4B0082","#800080","#B22222","#A0522D","#CD5C5C","#8B008B","#9932CC","#FF4500","#FF8C00","#B8860B","#D2691E","#DAA520","#ADFF2F","#7FFF00","#32CD32","#00FF00","#00FA9A","#40E0D0","#4682B4","#1E90FF","#0000FF","#4169E1","#8A2BE2","#FF00FF","#FF1493","#FF69B4","#FF6347","#FFA07A","#FFA500","#FFD700","#FFFF00","#FFFACD","#F0E68C","#E6E6FA","#F0F8FF","#E0FFFF","#AFEEEE","#ADD8E6","#87CEFA","#B0C4DE","#D3D3D3","#DDA0DD","#EE82EE","#F5DEB3","#FAFAD2","#FFE4E1","#FFF0F5","#F5F5DC","#FFFFE0","#FFF8DC","#F8F8FF","#FFFFFF"],update:function(){let t=this.data,e=this.previousOldData;if(t.html!=e.html||t.distanceLevels!=e.distanceLevels){for(this.observer&&this.observer.disconnect();this.el.firstChild;)this.el.removeChild(this.el.firstChild);this.init()}}})},647:()=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function t(t,i,n,r,a,o,s){o.forEach((i=>{const n=e(`primitive: plane; height: ${i.height}; width: ${i.width}`,i.label,i.color,i.position,i.rotation,i.textSize,[i.className]);t.appendChild(n)})),n.forEach((t=>{const n=e(`primitive: plane; height: ${t.height}; width: ${t.width}`,t.label,t.color,t.position,t.rotation,t.textSize,[t.className]);i.appendChild(n)}));let l=document.createElement("a-entity");l.setAttribute("rotation",r.rotation),l.setAttribute("position",r.position),l.classList.add("cross"),i.appendChild(l),a.forEach((t=>{const i=e(`primitive: plane; height: ${t.height}; width: ${t.width}`,t.label,t.color,t.position,t.rotation,t.textSize,[t.className]);l.appendChild(i)}));let c=document.createElement("a-text");c.setAttribute("value",s.label),c.setAttribute("color",s.color),c.setAttribute("position",s.position),c.setAttribute("rotation",s.rotation),c.setAttribute("width",s.textSize),c.classList.add("coordinates-text"),t.appendChild(c)}function e(t,e,i,n,r=null,a=.5,o=[]){const s=document.createElement("a-text");return s.setAttribute("geometry",t),s.setAttribute("material",`color: ${i}`),s.setAttribute("value",e),s.setAttribute("align","center"),s.setAttribute("width",a),s.setAttribute("position",n),r&&s.setAttribute("rotation",r),s.classList.add("collidable","interactive-button",...o),s}AFRAME.registerComponent("babia-map",{dependencies:["raycaster"],schema:{width:{type:"number",default:1e3},height:{type:"number",default:1e3},horTexture:{type:"number",default:2},vertTexture:{type:"number",default:2},widthSegments:{type:"int",default:200},heightSegments:{type:"int",default:200},bumpScale:{type:"number",default:300},wireframe:{type:"boolean",default:!1},token:{type:"string"},zoom:{type:"number",default:4},x:{type:"number",default:0},y:{type:"number",default:0},subdomain:{type:"string",default:"a"},textureType:{type:"string",default:"Standard"},coordinates:{type:"vec2"},handsUi:{type:"boolean",default:!0},entityRightButton:{type:"string",default:JSON.stringify({position:"0.25 201.5 -0.5",rotation:"-30 0 0"})},entityLeftButton:{type:"string",default:JSON.stringify({position:"-0.25 201.5 -0.5",rotation:"-30 0 0"})},rightButtons:{type:"string",default:JSON.stringify([{height:"0.075",width:"0.2",label:"Zoom In",color:"blue",position:"0 0.15 -0.3",rotation:"0 0 0",textSize:.6,className:"zoomInBtn"},{height:"0.075",width:"0.2",label:"Zoom Out",color:"purple",position:"0 0.05 -0.3",rotation:"-0 0 0",textSize:.6,className:"zoomOutBtn"}])},crossEntity:{type:"string",default:JSON.stringify({position:"0 -0.15 -0.25",rotation:"0 0 0"})},crossButtons:{type:"string",default:JSON.stringify([{height:"0.06",width:"0.06",label:"^",color:"darkgray",position:"0 0.1 0",textSize:.6,className:"dpadUp"},{height:"0.06",width:"0.06",label:"v",color:"darkgray",position:"0 -0.1 0",textSize:.6,className:"dpadDown"},{height:"0.06",width:"0.06",label:"<",color:"darkgray",position:"-0.125 0 0",textSize:.6,className:"dpadLeft"},{height:"0.06",width:"0.06",label:">",color:"darkgray",position:"0.125 0 0",textSize:.6,className:"dpadRight"}])},leftButtons:{type:"string",default:JSON.stringify([{height:"0.075",width:"0.2",label:"Next Layer",color:"green",position:"0 0.05 -0.3",rotation:"0 0 0",textSize:.6,className:"layerUpBtn"},{height:"0.075",width:"0.2",label:"Previous Layer",color:"orange",position:"0 -0.05 -0.3",rotation:"0 0 0",textSize:.6,className:"layerDownBtn"}])},coordinatesText:{type:"string",default:JSON.stringify({label:"Coordinates: ",color:"black",position:"-0.15 0.1 -0.2",rotation:"0 0 0",textSize:.6})}},init:function(){const e=this.data,i=this.el,n=["Coloured","Cycle","Transport","Standard","Satellite","Hot"];let r=n.indexOf(i.getAttribute("babia-map").textureType);-1===r&&(r=0);const a=[{height:"0.075",width:"0.2",label:"Zoom In",color:"blue",position:"-0.2 0.1 -0.3",rotation:"-30 0 0",textSize:.6,className:"zoomInBtn"},{height:"0.075",width:"0.2",label:"Zoom Out",color:"purple",position:"-0.2 0 -0.25",rotation:"-30 0 0",textSize:.6,className:"zoomOutBtn"}],o={position:"0.2 0 -0.2",rotation:"-30 0 0"},s=[{height:"0.06",width:"0.06",label:"^",color:"darkgray",position:"-0.125 0.175 0",textSize:.6,className:"dpadUp"},{height:"0.06",width:"0.06",label:"v",color:"darkgray",position:"-0.125 0.025 0",textSize:.6,className:"dpadDown"},{height:"0.06",width:"0.06",label:"<",color:"darkgray",position:"-0.2 0.1 0",textSize:.6,className:"dpadLeft"},{height:"0.06",width:"0.06",label:">",color:"darkgray",position:"-0.05 0.1 0",textSize:.6,className:"dpadRight"}],l=[{height:"0.075",width:"0.2",label:"Next Layer",color:"green",position:"0 0.2 -0.3",rotation:"-30 0 0",textSize:.6,className:"layerUpBtn"},{height:"0.075",width:"0.2",label:"Previous Layer",color:"orange",position:"0 0.1 -0.25",rotation:"-30 0 0",textSize:.6,className:"layerDownBtn"}],c={label:"Coordinates: ",color:"black",position:"-0.15 0 -0.2",rotation:"-30 0 0",textSize:.6};let h=[],d=[],u=[],p=[],f=[],g=[],m=[];try{const y=document.querySelector("a-scene");function b(t){const e=`#${t}Hand`;let i=document.querySelector(e);return i||(i=document.querySelector(`[laser-controls][hand="${t}"]`),i||(i=document.querySelector(`[oculus-touch-controls][hand="${t}"]`),i||null))}const _=b("left"),A=b("right");let x=!1;const E={layerUp:()=>{r<n.length-1&&(r++,S())},layerDown:()=>{r>0&&(r--,S())},zoomIn:()=>I(!0),zoomOut:()=>I(!1),mouseEnter:t=>{t.target.setAttribute("material","color","yellow")},mouseLeave:t=>{const e=t.target,i=e.classList.contains("zoomInBtn")?"blue":e.classList.contains("zoomOutBtn")?"purple":e.classList.contains("layerUpBtn")?"green":e.classList.contains("layerDownBtn")?"orange":"darkgray";e.setAttribute("material","color",i)},moveUp:()=>T("up"),moveDown:()=>T("down"),moveRight:()=>T("right"),moveLeft:()=>T("left")};function v(t,...e){const i=(e,i,n)=>{e[t?"addEventListener":"removeEventListener"](i,n)};e.forEach((t=>{const e={".layerUpBtn":E.layerUp,".layerDownBtn":E.layerDown,".zoomInBtn":E.zoomIn,".zoomOutBtn":E.zoomOut,".dpadUp":E.moveUp,".dpadDown":E.moveDown,".dpadLeft":E.moveLeft,".dpadRight":E.moveRight};[t,...t.querySelectorAll(".cross")].forEach((t=>{for(const[n,r]of Object.entries(e))t.querySelectorAll(n).forEach((t=>i(t,"click",r)))})),t.querySelectorAll(".interactive-button").forEach((t=>{i(t,"mouseenter",E.mouseEnter),i(t,"mouseleave",E.mouseLeave)}))}))}let C=t=>{t.addEventListener("gripdown",(function(){const e=t.children;x=!x;for(let t=0;t<e.length;t++)e[t].setAttribute&&e[t].setAttribute("visible",x)}))};h=JSON.parse(e.crossButtons),d=JSON.parse(e.entityRightButton),u=JSON.parse(e.entityLeftButton),p=JSON.parse(e.rightButtons),f=JSON.parse(e.crossEntity),g=JSON.parse(e.leftButtons),m=JSON.parse(e.coordinatesText);let M=document.createElement("a-entity");M.setAttribute("position",u.position),M.setAttribute("rotation",u.rotation),M.classList.add("left-desktop-ui-position"),i.appendChild(M);let w=document.createElement("a-entity");w.setAttribute("position",d.position),w.setAttribute("rotation",d.rotation),w.classList.add("right-desktop-ui-position"),i.appendChild(w),t(M,w,p,f,h,g,m),e.handsUi&&(t(_,A,a,o,s,l,c),y.addEventListener("enter-vr",(()=>{console.log("Conectado a VR"),x=!0,M.setAttribute("visible",!1),w.setAttribute("visible",!1),_.setAttribute("visible",!0),A.setAttribute("visible",!0),C(_),C(A),v(!0,_,A),v(!1,M,w)})),y.addEventListener("exit-vr",(()=>{console.log("Saliendo de VR"),x=!1,M.setAttribute("visible",!0),w.setAttribute("visible",!0),_.setAttribute("visible",!1),A.setAttribute("visible",!1),v(!1,_,A),v(!0,M,w)})));const S=()=>{const t=n[r];console.log("Cambiando a capa:",t),i.setAttribute("babia-map","textureType",t),this.buildMesh(e,i)},I=t=>{let n=i.getAttribute("babia-map").zoom,r=i.getAttribute("babia-map").x,a=i.getAttribute("babia-map").y;!0===t&&n<19?(n+=1,r=Math.min(2*r,Math.pow(2,n)-1),a=Math.min(2*a,Math.pow(2,n)-1)):!t&&n>0&&(n-=1,r=Math.max(0,Math.trunc(r/2)),a=Math.max(0,Math.trunc(a/2))),i.setAttribute("babia-map","zoom",n),i.setAttribute("babia-map","x",r),i.setAttribute("babia-map","y",a),this.buildMesh(e,i)},T=t=>{let n=i.getAttribute("babia-map").zoom,r=i.getAttribute("babia-map").x,a=i.getAttribute("babia-map").y;const o=Math.pow(2,n)-1,s=o;switch(console.log(t),t){case"up":a>0&&(a-=1);break;case"down":a<s&&(a+=1);break;case"right":r<o&&(r+=1);break;case"left":r>0&&(r-=1);break;default:console.error("Opción de movimiento no permitida.")}i.setAttribute("babia-map","x",r),i.setAttribute("babia-map","y",a),this.buildMesh(e,i)};_.addEventListener("click",(t=>{const n=t.detail.intersection;if(!n)return;if(n.object.el!==i)return;const r=n.point.clone(),a=i.object3D.worldToLocal(r),o=a.x,s=a.y,l=a.z,c=function(t,e,i){const n=i.getAttribute("babia-map").zoom,r=i.getAttribute("babia-map").x,a=i.getAttribute("babia-map").y,o=i.getAttribute("babia-map").width,s=i.getAttribute("babia-map").height,l=(t+o/2)/o,c=1-(e+s/2)/s,h=Math.pow(2,n),d=r+l,u=a+c;console.log(`Global: ${d}, ${u}`);const p=d/h*360-180;return{lat:Math.atan(Math.sinh(Math.PI*(1-2*u/h)))*(180/Math.PI),lon:p}}(o,l,i);i.setAttribute("babia-map","coordinates",{x:c.lat,y:c.lon});let h=i.querySelector(".marker");h?(h.object3D.position.set(o,s+e.bumpScale/1.5,l),h.setAttribute("visible","true")):(h=document.createElement("a-entity"),h.setAttribute("geometry",{primitive:"sphere",radius:e.width/100}),h.setAttribute("material",{color:"red"}),h.setAttribute("position",{x:o,y:s+e.bumpScale/1.5,z:l}),h.classList.add("marker"),i.appendChild(h));const d=i.getAttribute("babia-map").coordinates;console.log(`Coordenadas: ${d.x.toFixed(2)}, ${d.y.toFixed(2)}`),i.querySelectorAll(".coordinates-text").forEach((t=>{t.setAttribute("value",`Coordenadas: ${d.x.toFixed(2)}, ${d.y.toFixed(2)}`)})),e.handsUi&&_.querySelector(".coordinates-text").setAttribute("value",`Coordenadas: ${d.x.toFixed(2)}, ${d.y.toFixed(2)}`)})),v(!0,M,w);const U=document.querySelector("#token-form"),F=document.querySelector("#token-input"),B=localStorage.getItem("babia-map-token");B&&(F.value=B,e.token=B,this.buildMesh(e,i)),U&&F?U.addEventListener("submit",(t=>{t.preventDefault();const n=F.value.trim();n?(e.token=n,localStorage.setItem("babia-map-token",n),console.log("Token actualizado:",n),this.buildMesh(e,i)):alert("Por favor, introduce un token válido.")})):console.warn("Formulario de token no encontrado en el DOM.")}catch(R){console.warn("Error:",R)}},remove:function(){this.el.removeObject3D("mesh")},update:function(t){const e=this.data,i=this.el;e.token===t.token&&e.textureType===t.textureType||(i.removeObject3D("mesh"),this.buildMesh(e,i))},buildMesh:function(t,e){let i,n,r=`https://api.mapbox.com/v4/mapbox.terrain-rgb/${t.zoom}/${t.x}/${t.y}@2x.pngraw?access_token=${t.token}`;(async function(t){let e=new Image;return e.src=t,e.crossOrigin="Anonymous",new Promise(((t,r)=>{e.onload=()=>{const r=document.createElement("canvas");r.width=e.width,r.height=e.height;const a=r.getContext("2d");a.translate(0,r.height),a.scale(1,-1),a.drawImage(e,0,0);const o=a.getImageData(0,0,e.width,e.height).data,s=new Float32Array(e.width*e.height);let l,c=1,h=0;for(let t=0;t<o.length;t+=4)l=.1*(256*o[t]*256+256*o[t+1]+o[t+2])-1e4,l=(l+1e4)/2e4,l<c&&(c=l),l>h&&(h=l),s[t/4]=l;i=c,n=h;const d=new THREE.DataTexture(s,e.width,e.height,THREE.RedFormat,THREE.FloatType);d.needsUpdate=!0,t(d)},e.onerror=r}))})(r).then((a=>{let o,s;if(console.log("Displacement map cargado:",r),a.wrapS=a.wrapT=THREE.RepeatWrapping,a.repeat.set(t.horTexture,t.vertTexture),"Coloured"===t.textureType)o={bumpTexture:{type:"t",value:a},bumpScale:{type:"f",value:t.bumpScale},minHeight:{value:i},maxHeight:{value:n}},console.log("Uniforms:",o),s=new THREE.ShaderMaterial({uniforms:o,vertexShader:"\n uniform sampler2D bumpTexture;\n uniform float bumpScale;\n varying float vAmount;\n void main() {\n vec4 bumpData = texture2D(bumpTexture, uv);\n vAmount = bumpData.r;\n vec3 newPosition = position + normal * bumpScale * vAmount;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n }\n ",fragmentShader:"\n uniform float minHeight;\n uniform float maxHeight;\n varying float vAmount;\n void main() {\n float totalHeight = maxHeight - minHeight;\n float maxWater = minHeight + totalHeight * 0.55;\n float minSand = minHeight + totalHeight * 0.54;\n float maxSand = minHeight + totalHeight * 0.57;\n float minGrass = minHeight + totalHeight * 0.56;\n float maxGrass = minHeight + totalHeight * 0.7;\n float minRock = minHeight + totalHeight * 0.60;\n float maxRock = minHeight + totalHeight * 0.80;\n float minSnow = minHeight + totalHeight * 0.65;\n\n vec3 water = (smoothstep(0.00, maxWater, vAmount) - smoothstep(minSand, maxWater, vAmount)) * vec3(0.0, 0.0, 1.0);\n vec3 sand = (smoothstep(minSand, maxSand, vAmount) - smoothstep(minGrass, maxSand, vAmount)) * vec3(0.76, 0.7, 0.5);\n vec3 grass = (smoothstep(minGrass, maxGrass, vAmount) - smoothstep(minRock, maxGrass, vAmount)) * vec3(0.0, 0.6, 0.01);\n vec3 rock = (smoothstep(minRock, maxRock, vAmount) - smoothstep(minSnow, maxRock, vAmount)) * vec3(0.28, 0.25, 0.23);\n vec3 snow = (smoothstep(minSnow, 1.0, vAmount)) * vec3(1.0, 1.0, 1.0);\n\n gl_FragColor = vec4(water + sand + grass + rock + snow, 1.0);\n }\n "});else{let e;switch(t.textureType){case"Standard":e=`https://tile.openstreetmap.org/${t.zoom}/${t.x}/${t.y}.png`;break;case"Satellite":e=`https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/256/${t.zoom}/${t.x}/${t.y}?access_token=${t.token}`;break;case"Hot":e=`https://tile-a.openstreetmap.fr/hot/${t.zoom}/${t.x}/${t.y}.png`;break;case"Cycle":e=`https://${t.subdomain}.tile.thunderforest.com/cycle/${t.zoom}/${t.x}/${t.y}.png`;break;case"Transport":e=`https://${t.subdomain}.tile.thunderforest.com/transport/${t.zoom}/${t.x}/${t.y}.png`;break;default:console.error("Tipo de textura no soportado")}const i=(new THREE.TextureLoader).load(e);o={bumpTexture:{type:"t",value:a},bumpScale:{type:"f",value:t.bumpScale},mapTexture:{value:i}},console.log("Uniforms:",o),s=new THREE.ShaderMaterial({uniforms:o,vertexShader:"\n uniform sampler2D bumpTexture;\n uniform float bumpScale;\n varying vec2 vUv;\n\n varying float vAmount;\n void main() {\n vUv = uv;\n vec4 bumpData = texture2D(bumpTexture, uv);\n vAmount = bumpData.r; // Solo canal rojo\n vec3 newPosition = position + normal * bumpScale * vAmount;\n\n // Posición final del vértice con transformación del modelo, vista y proyección\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D mapTexture;\n varying vec2 vUv;\n\n void main() {\n vec3 textureColor = texture2D(mapTexture, vUv).rgb;\n gl_FragColor = vec4(textureColor, 1.0);\n }\n "})}const l=new THREE.PlaneGeometry(t.width,t.height,t.widthSegments,t.heightSegments);let c=new THREE.Mesh(l,s);c.rotation.x=-Math.PI/2,c.position.y=0,e.setObject3D("mesh",c),console.log(t)}),(t=>{console.error("Error al cargar el displacement map:",t)}))}})},1987:(t,e,i)=>{let n=i(1392).findProdComponent,r=i(1392).parseJson;const a=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let o=i(4468);"default"in o&&(o=o.default);let s=i(8524);"default"in s&&(s=s.default);let l=function(t){if("function"==typeof t)return t;let e=eval;try{return e("("+t+")")}catch(t){}return null},c=function(t){return isNaN(parseFloat(t))?l(t)?l(t):t:parseFloat(t)},h="";AFRAME.registerComponent("babia-network",{schema:{nodeLegend:{type:"boolean",default:!1},linkLegend:{type:"boolean",default:!1},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},from:{type:"string"},nodesFrom:{type:"string"},linksFrom:{type:"string"},data:{type:"string",default:""},nodes:{type:"string",default:""},links:{type:"string",default:""},nodeId:{type:"string",default:"id"},nodeLabel:{parse:c,default:"id"},linkId:{type:"string",default:""},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},nodeVal:{type:"string",default:""},nodeRelSize:{type:"number",default:4},nodeColor:{parse:c,default:"color"},nodeAutoColorBy:{parse:c,default:""},nodeResolution:{type:"number",default:8},linkColor:{parse:c,default:"color"},linkAutoColorBy:{parse:c,default:""},linkWidth:{parse:c,default:0},linkResolution:{type:"number",default:6},linkLabel:{parse:c,default:""},nodeDesc:{parse:c,default:"desc"},linkDesc:{parse:c,default:"desc"},nodeVisibility:{parse:c,default:!0},nodeOpacity:{type:"number",default:1},linkVisibility:{parse:c,default:!0},linkOpacity:{type:"number",default:1},nodeThreeObject:{parse:c,default:null},nodeThreeObjectExtend:{parse:c,default:!1},linkCurvature:{parse:c,default:0},linkCurveRotation:{parse:c,default:0},linkMaterial:{parse:c,default:null},linkThreeObject:{parse:c,default:null},linkThreeObjectExtend:{parse:c,default:!1},linkPositionUpdate:{parse:l,default:null},linkDirectionalArrowLength:{parse:c,default:0},linkDirectionalArrowColor:{parse:c,default:null},linkDirectionalArrowRelPos:{parse:c,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:c,default:0},linkDirectionalParticleSpeed:{parse:c,default:.01},linkDirectionalParticleWidth:{parse:c,default:.5},linkDirectionalParticleColor:{parse:c,default:null},linkDirectionalParticleResolution:{type:"number",default:4},linkDistance:{type:"number",default:30},linkHoverPrecision:{type:"number",default:2},onNodeCenterHover:{parse:l,default:function(){}},onLinkCenterHover:{parse:l,default:function(){}},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:l,function:()=>!0},onDagError:{parse:l,default:void 0},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:r,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:l,default:function(){}},onEngineStop:{parse:l,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new s),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new s);const t=this.forceGraph,e=t.emitParticle.apply(t,arguments);return e===t?this:e},d3Force:function(){this.forceGraph||(this.forceGraph=new s);const t=this.forceGraph,e=t.d3Force.apply(t,arguments);return e===t?this:e},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},visProperties:{nodes:["nodeId"],links0:["linkId"],links1:["linkSource","linkTarget"]},init:function(){const t=this;this.isFirstTimeNodes=!0,this.isFirstTimeLinks=!0,this.notiBuffer=new a;let e=this.state={},i=document.querySelector("a-entity[camera], a-camera");e.cameraObj=i.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(t){e.cameraObj=t.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new s),this.el.object3D.add(this.forceGraph),this.data.linkDistance&&this.forceGraph.d3Force("link").distance((function(){return t.data.linkDistance})),h=document.querySelector("[cursor]"),document.addEventListener("controllerconnected",(t=>{h=document.querySelector("[laser-controls]")}))},update:function(t){let e=this.el,i=this.data;if(this.currentData=t,i.data&&t.data!==i.data){let t=r(i.data);this.processData(t)}else if(i.nodes){if(t.nodes!==i.nodes){let t=r(i.nodes);this.processNodes(t)}if(t.links!==i.links){let t=r(i.links);this.processLinks(t)}}else if(i.from===t.from||i.nodesFrom){if(i.nodesFrom!==t.nodesFrom||i.linksFrom!==t.linksFrom){this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId);let t=n(i,e);this.nodesProdComponent=t.nodes,this.nodesProdComponent.notiBuffer&&(this.notiBufferId=this.nodesProdComponent.notiBuffer.register(this.processNodes.bind(this))),this.linksProdComponent=t.links,this.linksProdComponent.notiBuffer&&(this.notiBufferId=this.linksProdComponent.notiBuffer.register(this.processLinks.bind(this)))}else if(i!==t)if(this.newData){let t=r(this.newData);this.processData(t,!0)}else if(this.newNodes)if(i.linkSource!=t.linkSource||i.linkTarget!=t.linkTarget){let t=r(this.newLinks);this.processLinks(t,!0)}else{let t=r(this.newNodes);this.processNodes(t,!0)}}else this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(i,e),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))},tick:function(t,e){if(h){if(h.components.raycaster.raycaster){let t=h.components.raycaster.raycaster.intersectObjects(this.forceGraph.children).filter((function(t){return-1!==["node","link"].indexOf(t.object.__graphObjType)})).sort((function(t,e){return i(e)-i(t);function i(t){return"node"===t.object.__graphObjType}})),e=t.length?t[0].object:null;if(e!==this.state.hoverObj){const t=this.state.hoverObj?this.state.hoverObj.__graphObjType:null,i=this.state.hoverObj?this.state.hoverObj.__data:null,n=e?e.__graphObjType:null,r=e?e.__data:null;t&&t!==n&&this.data["on"+("node"===t?"Node":"Link")+"CenterHover"](null,i),(this.data.nodeLegend&&"node"===t||this.data.linkLegend&&""!=this.data.linkLabel&&"link"===t)&&this.removeLegend(this),n&&this.data["on"+("node"===n?"Node":"Link")+"CenterHover"](r,t===n?i:null),this.state.hoverObj=e,e&&(this.data.nodeLegend&&"node"===e.__graphObjType?this.showLegend(e,e.__data,this.data.nodeLabel,this.el.getAttribute("scale")):this.data.linkLegend&&"link"===e.__graphObjType&&""!=this.data.linkLabel&&this.showLinkLegend(e,e.__data,this.data.linkLabel,this.el.getAttribute("scale")))}}}else h=document.querySelector("[cursor]");this.forceGraph.tickFrame()},prodComponent:void 0,nodesProdComponent:void 0,linksProdComponent:void 0,notiBufferId:void 0,newData:void 0,newNodes:void 0,newLinks:void 0,isFirstTimeNodes:void 0,isFirstTimeLinks:void 0,nodeFields:void 0,linkFields:void 0,currentData:void 0,babiaMetadata:{id:0},legend:"",updateChart:function(t,e){if(e.currentData){let i=[];for(let t in this.data)i[t]=this.data[t];i.nodes=t.nodes,i.links=t.links;let n=AFRAME.utils.diff(i,e.currentData);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(t){return t in n})).forEach((function(t){e.forceGraph[t](""!==i[t]?i[t]:null)})),("nodes"in n||"links"in n)&&e.forceGraph.graphData({nodes:i.nodes,links:i.links})}},processData:function(t,e){if(console.log("processData",this),this.newData!=t||e){this.newData=t;let e=this.elDataFromData(t);this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set(t)}},processNodes:function(t,e){if(console.log("processNodes",this),this.newNodes!=t||e){this.newNodes=t;let e=this.elDataFromNodesAndLinks(t,this.newLinks);if(e)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set({nodes:e.nodes,links:e.links});else if(this.data.links){let t=r(this.data.links);this.processLinks(t)}else this.data.linksFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},processLinks:function(t,e){console.log("processLinks",this);let i=r(t);if(this.newLinks!=i||e){this.newLinks=i;let t=this.elDataFromNodesAndLinks(this.newNodes,i);if(t)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(t,this),this.notiBuffer.set({nodes:t.nodes,links:t.links});else if(this.data.nodes){let t=r(this.data.nodes);this.processNodes(t)}else this.data.nodesFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},elDataFromData:function(t){let e=[],i=[];const n=this.data.nodeId,r=this.data.linkId,a=this.data.nodeVal,o=this.data.linkSource,s=this.data.linkTarget,l=this.data.linkLabel;return t.forEach((t=>{let i={};Object.keys(t).forEach((function(e){e===n&&(i[n]=t[e]),e===r&&(i.linkId=t[e]),e===a&&(i[a]=t[e])})),e.push(i)})),e.forEach((t=>{e.forEach((e=>{if(t[n]!==e[n]&&t.linkId===e.linkId)if(i.length>0){let r=!1;if(i.forEach((i=>{(i[o]===t[n]&&i[s]===e[n]||i[o]===e[n]&&i[s]===t[n])&&(r=!0)})),!r){let r={};r[l]=t[l],r[o]=t[n],r[s]=e[n],i.push(r)}}else{let r={};r[l]=t[l],r[o]=t[n],r[s]=e[n],i.push(r)}}))})),{nodes:e,links:i}},elDataFromNodesAndLinks:function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;this.isFirstTimeNodes&&(this.nodeFields=[],Object.keys(t[0]).forEach((t=>{this.nodeFields.push(t)})),this.isFirstTimeNodes=!1),this.isFirstTimeLinks&&(this.linkFields=[],Object.keys(e[0]).forEach((t=>{this.linkFields.push(t)})),this.isFirstTimeLinks=!1),"object"==typeof e[0].source&&e.forEach((t=>{t.source=t.source[this.data.nodeId],t.target=t.target[this.data.nodeId]}));let i=[];t.forEach((t=>{let e={};Object.keys(t).forEach((i=>{for(let n in this.nodeFields)i==this.nodeFields[n]&&(e[i]=t[i])})),i.push(e)}));let n=[];return e.forEach((t=>{let e={};Object.keys(t).forEach((i=>{for(let n in this.linkFields)i==this.linkFields[n]&&i!=this.data.linkId&&(e[i]=t[i])})),n.push(e)})),{nodes:i,links:n}},showLegend:function(t,e,i,n){let r=new THREE.Vector3;t.getWorldPosition(r);let a=t.geometry.boundingSphere.radius,o=document.querySelector("a-scene");this.legend=function(t,e,i,n,r,a){let o=e[i];if(o){let i=2,s=1;if(o.length>16&&(i=o.length/5),t){let n="\n "+t.nodeVal+" (radius): "+Math.round(100*e[t.nodeVal])/100;if(n.length>16&&(i=n.length/5),o+=n,t.nodeAutoColorBy){let r="\n "+t.nodeAutoColorBy+" (color): "+e[t.nodeAutoColorBy];r.length>16&&r>n&&(i=r.length/5),o+=r}else{let r="\n "+t.nodeAutoColorBy+" (color): "+e[t.nodeAutoColorBy];r.length>16&&r>n&&(i=r.length/5),o+=r}}let l=3,c=3,h=3;o.length>16&&(i=o.length/16),a&&(l=l*a.x*t.legend_scale,c=c*a.y*t.legend_scale,h=h*a.z*t.legend_scale,r=(r+3)*a.y*t.legend_scale);let d=document.createElement("a-plane");return d.setAttribute("position",{x:n.x,y:n.y+r,z:n.z}),d.setAttribute("babia-lookat",t.legend_lookat),d.setAttribute("width",i),d.setAttribute("height",s),d.setAttribute("color","white"),d.setAttribute("scale",{x:l*t.legend_scale,y:c*t.legend_scale,z:h*t.legend_scale}),d.setAttribute("material",{side:"double"}),d.setAttribute("text",{value:o,align:"center",width:6,color:"black",alphaTest:6,opacity:6,transparent:!1}),d.classList.add("babiaxrLegend"),d}}(this.data,e,i,r,a,n),this.legend&&o.appendChild(this.legend)},showLinkLegend:function(t,e,i,n){let r=new THREE.Vector3,a=t.geometry.boundingSphere.radius,o=new THREE.Vector3,s=new THREE.Vector3;this.forceGraph.children.filter((t=>"node"==t.__graphObjType)).forEach((t=>{t.__data[this.data.nodeId]==e.source[this.data.nodeId]&&t.getWorldPosition(o),t.__data[this.data.nodeId]==e.target[this.data.nodeId]&&t.getWorldPosition(s)})),r.x=(o.x+s.x)/2,r.y=(o.y+s.y)/2,r.z=(o.z+s.z)/2;let l=document.querySelector("a-scene");this.legend=function(t,e,i,n,r,a){let o=e[i];if(o){let s=2,l=3,c=3,h=3;o.length>16&&(s=o.length/8),a&&(l*=a.x,c*=a.y,h*=a.z,r=(r+3)*a.y);let d=document.createElement("a-plane");return d.setAttribute("position",{x:n.x,y:n.y+r,z:n.z}),d.setAttribute("babia-lookat",t.legend_lookat),d.setAttribute("width",s),d.setAttribute("height","1"),d.setAttribute("color","white"),d.setAttribute("scale",{x:l*t.legend_scale,y:c*t.legend_scale,z:h*t.legend_scale}),d.setAttribute("material",{side:"double"}),d.setAttribute("text",{value:e[i],align:"center",width:6,color:"black",alphaTest:6,opacity:6,transparent:!1}),d.classList.add("babiaxrLegend"),d}}(this.data,e,i,r,a,n),this.legend&&l.appendChild(this.legend)},removeLegend:function(){this.legend&&document.querySelector("a-scene").removeChild(this.legend)}})},5723:(t,e,i)=>{let n=i(1392).updateTitle;const r=i(1392).colors;let a=i(1392).updateFunction;const o=i(9590).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function s(t,e,i,n,a){let o=r.get(n,a);console.log("Generating slice...");let s=document.createElement("a-cylinder");return s.setAttribute("color",o),s.setAttribute("theta-start",t),s.setAttribute("theta-length",e),s.setAttribute("side","double"),s.setAttribute("radius",i),s}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:0,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r.setAttribute("babia-lookat",t.legend_lookat),r.setAttribute("scale",{x:t.legend_scale,y:t.legend_scale,z:t.legend_scale}),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-pie",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},legend_lookat:{type:"string",default:"[camera]"},legend_scale:{type:"number",default:1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){a(this,t)},tick:function(t,e){let i=this;if(this.data.animation&&this.loaded){let n=i.el.children[0].children;for(let i in this.slice_array){let r=this.slice_array[i].delay,a=this.slice_array[i].degreeLenght,o=parseFloat(n[i].getAttribute("theta-length"));t>=r&&o<a&&(o+=360*e/this.total_duration,o>a&&(o=a),n[i].setAttribute("theta-length",o))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-pie:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,o=0,c=0,h=0;for(let i of t)h+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl);let d=0;for(let u of t){let t;if(o=360*u[e.size]/h,n){let e=this.total_duration*o/360;this.slice_array.push({degreeLenght:o,duration:e,delay:d}),d+=e,t=s(a,.01,1,c,r)}else t=s(a,o,1,c,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=o,e.legend&&l(e,t,u,i),c++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating pie..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},7100:()=>{AFRAME.registerComponent("babia-terrain",{schema:{width:{type:"number",default:1},height:{type:"number",default:1},segmentsHeight:{type:"number",default:1},segmentsWidth:{type:"number",default:1},data:{type:"array"},color:{type:"string",default:"0xdddddd"},filled:{type:"boolean",default:!1}},init:function(){var t=this.data,e=this.el,i=t.data;console.log("Vertices:"),console.log(i),this.geometry=new THREE.PlaneGeometry(t.width,t.height,t.segmentsHeight,t.segmentsWidth);for(var n=0,r=this.geometry.vertices.length;n<r;n++)this.geometry.vertices[n].z=i[n];var a=t.color;t.filled?this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!1}):this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!0}),this.mesh=new THREE.Mesh(this.geometry,this.material),e.setObject3D("mesh",this.mesh)}})},9781:t=>{if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let e;AFRAME.registerComponent("babiaxr-codecity",{schema:{absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string",default:JSON.stringify({id:"CodeCity",area:1,height:1})},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){},update:function(t){this.loader=new THREE.FileLoader;let n=this.data,s=this.el;h=n.building_color,e=s,"string"==typeof n.data?n.data.endsWith("json")?raw_items=d(n):raw_items=JSON.parse(n.data):raw_items=n.data,s.emit("babiaxr-dataLoaded",{data:raw_items,codecity:!0}),b=n.time_evolution_delta,this.zone_data=raw_items;let l,g,v=new i({data:this.zone_data,extra:function(t){return t*n.extra},farea:n.farea,fheight:n.fheight,fmaxarea:n.fmaxarea});1==n.absolute?(l=Math.sqrt(v.areas.canvas)*n.width/n.depth,g=v.areas.canvas/l):(l=n.width,g=n.depth);let y=!1,x=new r({width:l,depth:g,x:0,z:0});v.add_rects({rect:x,split:n.split,relative:y});let M=document.createElement("a-entity");this.base=M,v.draw_rects({ground:x,el:M,base:n.base,level:0,elevation:0,relative:y,base_thick:n.base_thick,wireframe:n.wireframe,building_color:n.building_color,base_color:n.base_color,model:n.building_model,visible:!0,titles:n.titles}),s.appendChild(M),u&&(time_evolution_past_present=n.time_evolution_past_present,p=n.time_evolution_animation,f=n.time_evolution_color,A(n),function(){const t=Object.keys(m).length;let e=0;a&&(document.addEventListener("babiaxrToPast",(function(){time_evolution_past_present=!1})),document.addEventListener("babiaxrToPresent",(function(){time_evolution_past_present=!0})),document.addEventListener("babiaxrStop",(function(){clearInterval(c)})),document.addEventListener("babiaxrContinue",(function(){c=setTimeout((function(){E(t,e),e<t-1&&i()}),b)})),document.addEventListener("babiaxrSkipNext",(function(){time_evolution_past_present=!1,clearInterval(c),B(t-_-1),o=t-_-1,e--,_--,C()})),document.addEventListener("babiaxrSkipPrev",(function(){time_evolution_past_present=!0,clearInterval(c),B(t-_-3),o=t-_-3,e++,_++,C()})),document.addEventListener("babiaxrShow",(function(i){clearInterval(c),eventData=i.detail.data,e=eventData.data,B(t-e-1),o=t-e-1,_=e-1,C(!0)})));let i=()=>{c=setTimeout((function(){a&&B(t-_-2),o=t-_-2,E(t,e),e<t-1&&i()}),b)};i()}())},remove:function(){},play:function(){}});let i=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea],n.max_area=i[this.fmaxarea],n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:r="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,a=new n(e.children.map((t=>t.canvas)),e.inner);if("naive"===r)t=e.rect.split(a,i);else{if("pivot"!==r)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(a,i)}for(const n in e.children)this.add_rects({rect:t[n],area:e.children[n],relative:i,split:r})}}draw_rects({ground:t,el:i,area:n=this.areas,level:r=0,elevation:a=0,relative:o=!0,base_thick:s=.2,wireframe:l=!1,building_color:c="red",base_color:h="green",model:d=null,visible:u=!0,titles:p=!0}){if(0===r&&(this.el=i),this.pending_rects,"children"in n){let t=n.rect.box({elevation:a,height:s,color:h,inner:!1,wireframe:l,visible:u,id:n.data.id,rawarea:0});if(p){let i,n;t.addEventListener("click",(function(){if(i)e.removeChild(n),e.removeChild(i),i=void 0,n=void 0;else{n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("geometry",{height:r.height+10,depth:r.depth,width:r.width}),n.setAttribute("position",a),n.setAttribute("material",{visible:!0,opacity:.4}),i=x(this.getAttribute("id"),r.height+10,a,null,e),e.appendChild(i),e.appendChild(n)}}))}t.setAttribute("class","babiaxraycasterclass"),i.appendChild(t);let f=t;o||(f=i);for(const t of n.children){let e=s/2;o||(e=a+s),this.draw_rects({ground:n.rect,el:f,area:t,level:r+1,elevation:e,relative:o,building_color:c,base_color:h,model:d,base_thick:s,wireframe:l,visible:u,titles:p})}}else{n.data[this.fheight];let t=n.rect.box({height:n.data[this.fheight],elevation:a,wireframe:l,color:c,model:d,visible:u,id:n.data.id,rawarea:n.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),i.appendChild(t),p){let i,n,r=!1;t.addEventListener("click",(function(){r?(e.removeChild(i),e.removeChild(n),i=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),i=x(this.getAttribute("id"),r.height+.1,a,null,e),e.appendChild(i),e.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&i&&(e.removeChild(i),e.removeChild(n),i=void 0,n=void 0)}))}}}},n=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce(((t,e)=>t+e),0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new n(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,r,a=this.imax();if(this.items.lenght==a+1)return{pivot:a,a1:n.range(0,a),a2:[],a3:[]};if(this.items.length==a+2)return{pivot:a,a1:n.range(0,a),a2:[a+1],a3:[]};let o=t*e,s=this.scaled_area(o,a),l=Math.sqrt(s)*e-s,c=0,h=c,d=a+1;for(;c<l&&d<this.items.length;)h=c,c+=this.scaled_area(o,d),d++;let u=d;return d-1>a&&Math.abs(c-l)>Math.abs(h-l)&&(u=d-1),i=u-a-1,r=this.items.length-u,{pivot:a,a1:n.range(0,a),a2:n.range(a+1,i),a3:n.range(a+1+i,r)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},r=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,a,o,s]=this.idims_as_laying(),l=i/t.total,c=-i/2,h=0;e||(c+=a,h=o);let d=[];for(const e of t.items){let t=e*l,i=new r({width:t,depth:n,x:c+t/2,z:h});s&&i.reflect(),d.push(i),c+=t}return d}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,a,o,s]=this.idims_as_laying();e&&(a=0,o=0);let{pivot:l,a1:c,a2:h,a3:d}=t.pivot_regions(i,n),u=t.pivot_region_width(c,i),p=t.pivot_region_width(h.concat(l),i),f=t.pivot_region_width(d,i),g=a-i/2+u/2,m=a-i/2+u+p/2,b=a-i/2+u+p+f/2,v=[],y=t.scaled_area(i*n,l)/p;v[l]=new r({width:p,depth:y,x:m,z:o+n/2-y/2});let _=[[c,u,n,g,o],[h,p,n-y,m,o-y/2],[d,f,n,b,o]];for(const[e,i,n,a,o]of _)if(e.length>0){let s=new r({width:i,depth:n,x:a,z:o});s.inner();let l=t.values_i(e),c=s.split_pivot(l,!1),h=0;for(const t of e)v[t]=c[h],h++}if(s)for(const t of v)t.reflect();return v}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:o=!0,id:s="",rawarea:l=0,inner_real:c=!1}){let h,d;[h,d]=c?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let u=document.createElement("a-entity");return u.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:h,width:d,height:t}),u.setAttribute("material",{color:i}),u.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),u.setAttribute("id",s),u.setAttribute("babiaxr-rawarea",l),u}};t.exports={Values:n,Rectangle:r,Zone:i};let a,o,s,l,c,h,d=t=>{let e,i=t.data,n=new XMLHttpRequest;if(n.open("get",i,!1),n.onload=function(){this.status>=200&&this.status<300?e="string"==typeof n.response||n.response instanceof String?JSON.parse(n.response):n.response:reject({status:this.status,statusText:xhr.statusText})},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText})},n.send(),e.time_evolution){v=e,u=!0,g=e.time_evolution_commit_by_commit;let i=e.data_files.find((t=>"data_0_tree"===t.key_tree));e=i.data_0_tree,l=i.data_0;let n=[];for(let t=0;t<v.data_files.length;t++)m["data_"+t]=v.data_files[t],n.push({date:new Date(1e3*v.data_files[t].date).toLocaleDateString(),commit:v.data_files[t].commit_sha,data:t});if(t.ui_navbar&&(o=t.time_evolution_past_present?parseInt(t.time_evolution_init.split("_")[1]):v.data_files.length-1,a=t.ui_navbar,document.getElementById(a).setAttribute("babiaxr-navigation-bar","commits",JSON.stringify(n.reverse()))),"data_0"!==t.time_evolution_init){let i;i=m[t.time_evolution_init][t.time_evolution_init+"_allfiles"]?t.time_evolution_init+"_allfiles":t.time_evolution_init;let n=F(e.children,{});m[t.time_evolution_init][i].forEach((t=>{n[t.id]&&(n[t.id].height=t.height,n[t.id].area=t.area,n[t.id].max_area=t.max_area)})),_=parseInt(t.time_evolution_init.split("_")[1])}}return e},u=!1,p=!0,f=!1,g=!1,m={},b=8e3,v={},y=[],_=0,A=t=>{let e;document.getElementById("scene")?e=document.getElementById("scene"):(e=document.getElementsByTagName("a-scene"),document.getElementsByTagName("a-entity"));let i=document.createElement("a-entity");i.classList.add("babiaxrDateBar"),i.setAttribute("position",{x:-13,y:10,z:-3}),i.setAttribute("rotation",{x:0,y:0,z:0}),i.setAttribute("material",{color:"black"}),i.setAttribute("height",.5),i.setAttribute("width",2),i.setAttribute("scale",{x:1,y:1,z:1});let n="Date: "+new Date(1e3*m[t.time_evolution_init].date).toLocaleDateString();m[t.time_evolution_init].commit_sha&&(n+="\n\nCommit: "+m[t.time_evolution_init].commit_sha),i.setAttribute("text-geometry",{value:n}),s=i,e.appendChild(i)},x=(t,e,i,n,r)=>{let a=2;t.length>16&&(a=t.length/8);let o=e,s=document.createElement("a-plane");s.setAttribute("babia-lookat","[camera]"),s.setAttribute("position",{x:i.x,y:i.y+o/2+1,z:i.z}),s.setAttribute("rotation",{x:0,y:0,z:0}),s.setAttribute("height","1"),s.setAttribute("width",a),s.setAttribute("color","white"),s.setAttribute("material",{side:"double"}),s.setAttribute("text",{value:t,align:"center",width:6,color:"black"});let l=r.getAttribute("scale");return!l||l.x===l.y&&l.x===l.z||s.setAttribute("scale",{x:1/l.x,y:1/l.y,z:1/l.z}),s},E=(t,e)=>{console.log("Loop number",e),C(),time_evolution_past_present?(_--,0==_&&console.log("finished"),e--):(_++,e++,_>t-1&&(_=0))},C=t=>{let e,i="data_"+(_+1);e=t?"data_"+(_+1)+"_allfiles":time_evolution_past_present?"data_reverse_"+(_+1):"data_"+(_+1);let n="Date: "+new Date(1e3*m[i].date).toLocaleDateString();m[i].commit_sha&&(n+="\n\nCommit: "+m[i].commit_sha),s.setAttribute("text-geometry","value",n),y=[],f&&(M+=5,80!==M?h=function(t,e){let i,n=function(t,e,i){t/=255,e/=255,i/=255;let n,r,a=Math.max(t,e,i),o=Math.min(t,e,i),s=(a+o)/2;if(a==o)n=r=0;else{let l=a-o;switch(r=s>.5?l/(2-a-o):l/(a+o),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return[n,r,s]}(parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16));return i=function(t,e,i){let n,r,a;if(0==e)n=r=a=i;else{function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}let s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=o(l,s,t+1/3),r=o(l,s,t),a=o(l,s,t-1/3)}return[255*n,255*r,255*a]}(n[0],n[1],e/100),"#"+R(i[0])+R(i[1])+R(i[2])}(h,M):(S++,S>w.length-1&&(S=0),h=w[S],M=20)),m[i][e]?m[i][e].forEach((t=>{I(t)})):m[i][i].forEach((t=>{I(t)})),g||l.forEach((t=>{y.includes(t.id)||T(t.id)})),U()},M=20,w=["#000066","#006600","#666600","#660000"],S=0,I=t=>{if(null!=document.getElementById(t.id)&&0!=t.area){y.push(t.id);let e=document.getElementById(t.id).getAttribute("position"),i=document.getElementById(t.id).getAttribute("position").x,n=document.getElementById(t.id).getAttribute("position").y,r=document.getElementById(t.id).getAttribute("position").z,a=document.getElementById(t.id).getAttribute("geometry").width,o=document.getElementById(t.id).getAttribute("geometry").depth,s=document.getElementById(t.id).getAttribute("geometry").height,l=parseFloat(document.getElementById(t.id).getAttribute("babiaxr-rawarea"));if(s.toFixed(6)!==t.height.toFixed(6)||l.toFixed(6)!==t.area.toFixed(6)){f&&document.getElementById(t.id).setAttribute("material",{color:h});let c=!1,d=a/o;d<1&&(c=!0,d=o/a);let u=t.area*(o*a)/l,g=Math.sqrt(u*d),m=Math.sqrt(u/d);if(c&&(m=Math.sqrt(u*d),g=Math.sqrt(u/d)),document.getElementById(t.id).setAttribute("babiaxr-rawarea",t.area),p){let e=500;if(g>a||m>o){let i=20*(g-a)/e,n=20*(m-o)/e,r=a,s=o,l=setInterval((function(){r>=g||s>=m?(document.getElementById(t.id).setAttribute("geometry","width",g),document.getElementById(t.id).setAttribute("geometry","depth",m),clearInterval(l)):(r+=i,s+=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",s))}),1)}else if(g<a||m<o){let i=20*(a-g)/e,n=20*(o-m)/e,r=a,s=o,l=setInterval((function(){r<=g||s<=m?(document.getElementById(t.id).setAttribute("geometry","width",g),document.getElementById(t.id).setAttribute("geometry","depth",m),clearInterval(l)):(r-=i,s-=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",s))}),1)}if(t.height<0)T(t.id);else if(t.height>s){let a=20*(t.height-s)/e,o=s,l=setInterval((function(){o>=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+t.height/2,z:r}),clearInterval(l)):(o+=a,document.getElementById(t.id).setAttribute("geometry","height",o),document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+o/2,z:r}))}),1)}else if(t.height<s){let a=20*(s-t.height)/e,o=s,l=setInterval((function(){o<=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+t.height/2,z:r}),clearInterval(l)):(o-=a,document.getElementById(t.id).setAttribute("geometry","height",o),document.getElementById(t.id).setAttribute("position",{x:i,y:n-s/2+o/2,z:r}))}),1)}}else document.getElementById(t.id).setAttribute("geometry","width",g),document.getElementById(t.id).setAttribute("geometry","depth",m),document.getElementById(t.id).setAttribute("geometry","height",t.height),document.getElementById(t.id).setAttribute("position",{x:e.x,y:e.y-s/2+t.height/2,z:e.z})}}},T=t=>{let e=document.getElementById(t).getAttribute("material").color;document.getElementById(t).setAttribute("material",{color:"black"}),document.getElementById(t).setAttribute("material",{opacity:"0.3"});let i=setInterval((function(){!function(){let n=document.getElementById(t).getAttribute("position"),r=document.getElementById(t).getAttribute("geometry").height;document.getElementById(t).setAttribute("geometry","height",-.1),document.getElementById(t).setAttribute("position",{x:n.x,y:n.y-r/2-.05,z:n.z}),document.getElementById(t).setAttribute("material",{color:e}),document.getElementById(t).setAttribute("material",{opacity:"1.0"}),clearInterval(i)}()}),1e3)},U=()=>{console.log("Changing city")},F=(t,e)=>(t.forEach((t=>{t.children?F(t.children,e):e[t.id]=t})),e),B=t=>{let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;(o||0==o)&&e[o].emit("removeinfo"),e[t].emit("showinfo")};function R(t){let e=Math.round(t).toString(16);return e.length>1||(e="0"+e),e}},1790:t=>{t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],i=0;i<e.length;++i)if(t.hasOwnProperty(e[i]))throw new Error("Subject cannot be eventified, since it already has property '"+e[i]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(i,n,r){if("function"!=typeof n)throw new Error("callback is expected to be a function");var a=e[i];return a||(a=e[i]=[]),a.push({callback:n,ctx:r}),t},off:function(i,n){if(void 0===i)return e=Object.create(null),t;if(e[i])if("function"!=typeof n)delete e[i];else for(var r=e[i],a=0;a<r.length;++a)r[a].callback===n&&r.splice(a,1);return t},fire:function(i){var n,r=e[i];if(!r)return t;arguments.length>1&&(n=Array.prototype.splice.call(arguments,1));for(var a=0;a<r.length;++a){var o=r[a];o.callback.apply(o.ctx,n)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},7348:(t,e,i)=>{t.exports=function(t,e){if(!t)throw new Error("Graph structure cannot be undefined");var a=(e&&e.createSimulator||i(6571))(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var o=t.version>19?function(e){var i=t.getLinks(e);return i?1+i.size/3:1}:function(e){var i=t.getLinks(e);return i?1+i.length/3:1};e&&"function"==typeof e.nodeMass&&(o=e.nodeMass);var s=new Map,l={},c=0,h=a.settings.springTransform||r;c=0,t.forEachNode((function(t){m(t.id),c+=1})),t.forEachLink(b),t.on("changed",g);var d=!1,u={step:function(){if(0===c)return p(!0),!0;var t=a.step();u.lastMove=t,u.fire("step");var e=t/c<=.01;return p(e),e},getNodePosition:function(t){return _(t).pos},setNodePosition:function(t){var e=_(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=l[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return a.getBBox()},forEachBody:f,pinNode:function(t,e){_(t.id).isPinned=!!e},isNodePinned:function(t){return _(t.id).isPinned},dispose:function(){t.off("changed",g),u.fire("disposed")},getBody:function(t){return s.get(t)},getSpring:function(e,i){var n;if(void 0===i)n="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,i);if(!r)return;n=r.id}return l[n]},getForceVectorLength:function(){var t=0,e=0;return f((function(i){t+=Math.abs(i.force.x),e+=Math.abs(i.force.y)})),Math.sqrt(t*t+e*e)},simulator:a,graph:t,lastMove:0};return n(u),u;function p(t){var e;d!==t&&(d=t,e=t,u.fire("stable",e))}function f(t){s.forEach(t)}function g(e){for(var i=0;i<e.length;++i){var n=e[i];"add"===n.changeType?(n.node&&m(n.node.id),n.link&&b(n.link)):"remove"===n.changeType&&(n.node&&(r=n.node,o=void 0,l=void 0,o=r.id,(l=s.get(o))&&(s.delete(o),a.removeBody(l))),n.link&&v(n.link))}var r,o,l;c=t.getNodesCount()}function m(e){var i=s.get(e);if(!i){var n=t.getNode(e);if(!n)throw new Error("initBody() was called with unknown node id");var r=n.position;if(!r){var o=function(t){var e=[];if(!t.links)return e;for(var i=Math.min(t.links.length,2),n=0;n<i;++n){var r=t.links[n],a=r.fromId!==t.id?s.get(r.fromId):s.get(r.toId);a&&a.pos&&e.push(a)}return e}(n);r=a.getBestNewBodyPosition(o)}(i=a.addBodyAt(r)).id=e,s.set(e,i),y(e),function(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}(n)&&(i.isPinned=!0)}}function b(t){y(t.fromId),y(t.toId);var e=s.get(t.fromId),i=s.get(t.toId),n=a.addSpring(e,i,t.length);h(t,n),l[t.id]=n}function v(e){var i=l[e.id];if(i){var n=t.getNode(e.fromId),r=t.getNode(e.toId);n&&y(n.id),r&&y(r.id),delete l[e.id],a.removeSpring(i)}}function y(t){var e=s.get(t);if(e.mass=o(t),Number.isNaN(e.mass))throw new Error("Node mass should be a number")}function _(t){var e=s.get(t);return e||(m(t),e=s.get(t)),e}},t.exports.simulator=i(6571);var n=i(1790);function r(){}},3789:(t,e,i)=>{const n=i(9169);t.exports=function(t){return function(e,i){let r=i&&i.indent||0,a=i&&void 0!==i.join?i.join:"\n",o=Array(r+1).join(" "),s=[];for(let i=0;i<t;++i){let t=n(i),r=0===i?"":o;s.push(r+e.replace(/{var}/g,t))}return s.join(a)}}},2758:(t,e,i)=>{t.exports=function(t){let e=r(t);return new Function("bodies","settings","random",e)},t.exports.generateFunctionBody=r;const n=i(3789);function r(t){let e=n(t);return`\n var boundingBox = {\n ${e("min_{var}: 0, max_{var}: 0,",{indent:4})}\n };\n\n return {\n box: boundingBox,\n\n update: updateBoundingBox,\n\n reset: resetBoundingBox,\n\n getBestNewPosition: function (neighbors) {\n var ${e("base_{var} = 0",{join:", "})};\n\n if (neighbors.length) {\n for (var i = 0; i < neighbors.length; ++i) {\n let neighborPos = neighbors[i].pos;\n ${e("base_{var} += neighborPos.{var};",{indent:10})}\n }\n\n ${e("base_{var} /= neighbors.length;",{indent:8})}\n } else {\n ${e("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}\n }\n\n var springLength = settings.springLength;\n return {\n ${e("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}\n };\n }\n };\n\n function updateBoundingBox() {\n var i = bodies.length;\n if (i === 0) return; // No bodies - no borders.\n\n ${e("var max_{var} = -Infinity;",{indent:4})}\n ${e("var min_{var} = Infinity;",{indent:4})}\n\n while(i--) {\n // this is O(n), it could be done faster with quadtree, if we check the root node bounds\n var bodyPos = bodies[i].pos;\n ${e("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}\n ${e("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}\n }\n\n ${e("boundingBox.min_{var} = min_{var};",{indent:4})}\n ${e("boundingBox.max_{var} = max_{var};",{indent:4})}\n }\n\n function resetBoundingBox() {\n ${e("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}\n }\n`}},8379:(t,e,i)=>{const n=i(3789);function r(t,e){return`\n${o(t,e)}\n${a(t)}\nreturn {Body: Body, Vector: Vector};\n`}function a(t){let e=n(t),i=e("{var}",{join:", "});return`\nfunction Body(${i}) {\n this.isPinned = false;\n this.pos = new Vector(${i});\n this.force = new Vector();\n this.velocity = new Vector();\n this.mass = 1;\n\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.reset = function() {\n this.force.reset();\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.setPosition = function (${i}) {\n ${e("this.pos.{var} = {var} || 0;",{indent:2})}\n};`}function o(t,e){let i=n(t),r="";return e&&(r=`${i("\n var v{var};\nObject.defineProperty(this, '{var}', {\n set: function(v) { \n if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');\n v{var} = v; \n },\n get: function() { return v{var}; }\n});")}`),`function Vector(${i("{var}",{join:", "})}) {\n ${r}\n if (typeof arguments[0] === 'object') {\n // could be another vector\n let v = arguments[0];\n ${i('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}\n ${i("this.{var} = v.{var};",{indent:4})}\n } else {\n ${i('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}\n }\n }\n \n Vector.prototype.reset = function () {\n ${i("this.{var} = ",{join:""})}0;\n };`}t.exports=function(t,e){let i=r(t,e),{Body:n}=new Function(i)();return n},t.exports.generateCreateBodyFunctionBody=r,t.exports.getVectorCode=o,t.exports.getBodyCode=a},5226:(t,e,i)=>{const n=i(3789);function r(t){return`\n if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');\n\n return {\n update: function(body) {\n ${n(t)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options",e)},t.exports.generateCreateDragForceFunctionBody=r},2843:(t,e,i)=>{const n=i(3789);function r(t){let e=n(t);return`\n if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');\n if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');\n\n return {\n /**\n * Updates forces acting on a spring\n */\n update: function (spring) {\n var body1 = spring.from;\n var body2 = spring.to;\n var length = spring.length < 0 ? options.springLength : spring.length;\n ${e("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}\n var r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n var d = r - length;\n var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;\n\n ${e("body1.force.{var} += coefficient * d{var}",{indent:6})};\n body1.springCount += 1;\n body1.springLength += r;\n\n ${e("body2.force.{var} -= coefficient * d{var}",{indent:6})};\n body2.springCount += 1;\n body2.springLength += r;\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options","random",e)},t.exports.generateCreateSpringForceFunctionBody=r},8222:(t,e,i)=>{const n=i(3789);function r(t){let e=n(t);return`\n var length = bodies.length;\n if (length === 0) return 0;\n\n ${e("var d{var} = 0, t{var} = 0;",{indent:2})}\n\n for (var i = 0; i < length; ++i) {\n var body = bodies[i];\n if (body.isPinned) continue;\n\n if (adaptiveTimeStepWeight && body.springCount) {\n timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);\n }\n\n var coeff = timeStep / body.mass;\n\n ${e("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}\n ${e("var v{var} = body.velocity.{var};",{indent:4})}\n var v = Math.sqrt(${e("v{var} * v{var}",{join:" + "})});\n\n if (v > 1) {\n // We normalize it so that we move within timeStep range. \n // for the case when v <= 1 - we let velocity to fade out.\n ${e("body.velocity.{var} = v{var} / v;",{indent:6})}\n }\n\n ${e("d{var} = timeStep * body.velocity.{var};",{indent:4})}\n\n ${e("body.pos.{var} += d{var};",{indent:4})}\n\n ${e("t{var} += Math.abs(d{var});",{indent:4})}\n }\n\n return (${e("t{var} * t{var}",{join:" + "})})/length;\n`}t.exports=function(t){let e=r(t);return new Function("bodies","timeStep","adaptiveTimeStepWeight",e)},t.exports.generateIntegratorFunctionBody=r},1756:(t,e,i)=>{const n=i(3789),r=i(9169);function a(t){let e=n(t),i=Math.pow(2,t);return`\n\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n\n${c(t)}\n${o(t)}\n${l(t)}\n${s(t)}\n\nfunction createQuadTree(options, random) {\n options = options || {};\n options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;\n options.theta = typeof options.theta === 'number' ? options.theta : 0.8;\n\n var gravity = options.gravity;\n var updateQueue = [];\n var insertStack = new InsertStack();\n var theta = options.theta;\n\n var nodesCache = [];\n var currentInCache = 0;\n var root = newNode();\n\n return {\n insertBodies: insertBodies,\n\n /**\n * Gets root node if it is present\n */\n getRoot: function() {\n return root;\n },\n\n updateBodyForce: update,\n\n options: function(newOptions) {\n if (newOptions) {\n if (typeof newOptions.gravity === 'number') {\n gravity = newOptions.gravity;\n }\n if (typeof newOptions.theta === 'number') {\n theta = newOptions.theta;\n }\n\n return this;\n }\n\n return {\n gravity: gravity,\n theta: theta\n };\n }\n };\n\n function newNode() {\n // To avoid pressure on GC we reuse nodes.\n var node = nodesCache[currentInCache];\n if (node) {\n${function(t){let e=[];for(let t=0;t<i;++t)e.push(` node.quad${t} = null;`);return e.join("\n")}()}\n node.body = null;\n node.mass = ${e("node.mass_{var} = ",{join:""})}0;\n ${e("node.min_{var} = node.max_{var} = ",{join:""})}0;\n } else {\n node = new QuadNode();\n nodesCache[currentInCache] = node;\n }\n\n ++currentInCache;\n return node;\n }\n\n function update(sourceBody) {\n var queue = updateQueue;\n var v;\n ${e("var d{var};",{indent:4})}\n var r; \n ${e("var f{var} = 0;",{indent:4})}\n var queueLength = 1;\n var shiftIdx = 0;\n var pushIdx = 1;\n\n queue[0] = root;\n\n while (queueLength) {\n var node = queue[shiftIdx];\n var body = node.body;\n\n queueLength -= 1;\n shiftIdx += 1;\n var differentBody = (body !== sourceBody);\n if (body && differentBody) {\n // If the current node is a leaf node (and it is not source body),\n // calculate the force exerted by the current node on body, and add this\n // amount to body's net force.\n ${e("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Poor man's protection against zero distance.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n // This is standard gravitation force calculation but we divide\n // by r^3 to save two operations when normalizing force vector.\n v = gravity * body.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:8})}\n } else if (differentBody) {\n // Otherwise, calculate the ratio s / r, where s is the width of the region\n // represented by the internal node, and r is the distance between the body\n // and the node's center-of-mass\n ${e("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Sorry about code duplication. I don't want to create many functions\n // right away. Just want to see performance first.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n // If s / r < θ, treat this internal node as a single body, and calculate the\n // force it exerts on sourceBody, and add this amount to sourceBody's net force.\n if ((node.max_${r(0)} - node.min_${r(0)}) / r < theta) {\n // in the if statement above we consider node's width only\n // because the region was made into square during tree creation.\n // Thus there is no difference between using width or height.\n v = gravity * node.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:10})}\n } else {\n // Otherwise, run the procedure recursively on each of the current node's children.\n\n // I intentionally unfolded this loop, to save several CPU cycles.\n${function(){let t=Array(11).join(" "),e=[];for(let n=0;n<i;++n)e.push(t+`if (node.quad${n}) {`),e.push(t+` queue[pushIdx] = node.quad${n};`),e.push(t+" queueLength += 1;"),e.push(t+" pushIdx += 1;"),e.push(t+"}");return e.join("\n")}()}\n }\n }\n }\n\n ${e("sourceBody.force.{var} += f{var};",{indent:4})}\n }\n\n function insertBodies(bodies) {\n ${e("var {var}min = Number.MAX_VALUE;",{indent:4})}\n ${e("var {var}max = Number.MIN_VALUE;",{indent:4})}\n var i = bodies.length;\n\n // To reduce quad tree depth we are looking for exact bounding box of all particles.\n while (i--) {\n var pos = bodies[i].pos;\n ${e("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}\n ${e("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}\n }\n\n // Makes the bounds square.\n var maxSideLength = -Infinity;\n ${e("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}\n\n currentInCache = 0;\n root = newNode();\n ${e("root.min_{var} = {var}min;",{indent:4})}\n ${e("root.max_{var} = {var}min + maxSideLength;",{indent:4})}\n\n i = bodies.length - 1;\n if (i >= 0) {\n root.body = bodies[i];\n }\n while (i--) {\n insert(bodies[i], root);\n }\n }\n\n function insert(newBody) {\n insertStack.reset();\n insertStack.push(root, newBody);\n\n while (!insertStack.isEmpty()) {\n var stackItem = insertStack.pop();\n var node = stackItem.node;\n var body = stackItem.body;\n\n if (!node.body) {\n // This is internal node. Update the total mass of the node and center-of-mass.\n ${e("var {var} = body.pos.{var};",{indent:8})}\n node.mass += body.mass;\n ${e("node.mass_{var} += body.mass * {var};",{indent:8})}\n\n // Recursively insert the body in the appropriate quadrant.\n // But first find the appropriate quadrant.\n var quadIdx = 0; // Assume we are in the 0's quad.\n ${e("var min_{var} = node.min_{var};",{indent:8})}\n ${e("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}\n\n${function(e){let i=[],n=Array(9).join(" ");for(let e=0;e<t;++e)i.push(n+`if (${r(e)} > max_${r(e)}) {`),i.push(n+` quadIdx = quadIdx + ${Math.pow(2,e)};`),i.push(n+` min_${r(e)} = max_${r(e)};`),i.push(n+` max_${r(e)} = node.max_${r(e)};`),i.push(n+"}");return i.join("\n")}()}\n\n var child = getChild(node, quadIdx);\n\n if (!child) {\n // The node is internal but this quadrant is not taken. Add\n // subnode to it.\n child = newNode();\n ${e("child.min_{var} = min_{var};",{indent:10})}\n ${e("child.max_{var} = max_{var};",{indent:10})}\n child.body = body;\n\n setChild(node, quadIdx, child);\n } else {\n // continue searching in this quadrant.\n insertStack.push(child, body);\n }\n } else {\n // We are trying to add to the leaf node.\n // We have to convert current leaf into internal node\n // and continue adding two nodes.\n var oldBody = node.body;\n node.body = null; // internal nodes do not cary bodies\n\n if (isSamePosition(oldBody.pos, body.pos)) {\n // Prevent infinite subdivision by bumping one node\n // anywhere in this quadrant\n var retriesCount = 3;\n do {\n var offset = random.nextDouble();\n ${e("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}\n\n ${e("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}\n retriesCount -= 1;\n // Make sure we don't bump it out of the box. If we do, next iteration should fix it\n } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));\n\n if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {\n // This is very bad, we ran out of precision.\n // if we do not return from the method we'll get into\n // infinite loop here. So we sacrifice correctness of layout, and keep the app running\n // Next layout iteration should get larger bounding box in the first step and fix this\n return;\n }\n }\n // Next iteration should subdivide node further.\n insertStack.push(node, oldBody);\n insertStack.push(node, body);\n }\n }\n }\n}\nreturn createQuadTree;\n\n`}function o(t){let e=n(t);return`\n function isSamePosition(point1, point2) {\n ${e("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}\n \n return ${e("d{var} < 1e-8",{join:" && "})};\n } \n`}function s(t){var e=Math.pow(2,t);return`\nfunction setChild(node, idx, child) {\n ${function(){let t=[];for(let i=0;i<e;++i){let e=0===i?" ":" else ";t.push(`${e}if (idx === ${i}) node.quad${i} = child;`)}return t.join("\n")}()}\n}`}function l(t){return`function getChild(node, idx) {\n${function(){let e=[],i=Math.pow(2,t);for(let t=0;t<i;++t)e.push(` if (idx === ${t}) return node.quad${t};`);return e.join("\n")}()}\n return null;\n}`}function c(t){let e=n(t),i=Math.pow(2,t);return`\nfunction QuadNode() {\n // body stored inside this node. In quad tree only leaf nodes (by construction)\n // contain bodies:\n this.body = null;\n\n // Child nodes are stored in quads. Each quad is presented by number:\n // 0 | 1\n // -----\n // 2 | 3\n${function(t){let e=[];for(let t=0;t<i;++t)e.push(` this.quad${t} = null;`);return e.join("\n")}()}\n\n // Total mass of current node\n this.mass = 0;\n\n // Center of mass coordinates\n ${e("this.mass_{var} = 0;",{indent:2})}\n\n // bounding box coordinates\n ${e("this.min_{var} = 0;",{indent:2})}\n ${e("this.max_{var} = 0;",{indent:2})}\n}\n`}function h(){return"\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n"}t.exports=function(t){let e=a(t);return new Function(e)()},t.exports.generateQuadTreeFunctionBody=a,t.exports.getInsertStackCode=h,t.exports.getQuadNodeCode=c,t.exports.isSamePosition=o,t.exports.getChildBodyCode=l,t.exports.setChildBodyCode=s},9169:t=>{t.exports=function(t){return 0===t?"x":1===t?"y":2===t?"z":"c"+(t+1)}},6571:(t,e,i)=>{t.exports=function(t){var e=i(8787),d=i(1277),u=i(1790);if(t){if(void 0!==t.springCoeff)throw new Error("springCoeff was renamed to springCoefficient");if(void 0!==t.dragCoeff)throw new Error("dragCoeff was renamed to dragCoefficient")}t=d(t,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var p=c[t.dimensions];if(!p){var f=t.dimensions;p={Body:n(f,t.debug),createQuadTree:r(f),createBounds:a(f),createDragForce:o(f),createSpringForce:s(f),integrate:l(f)},c[f]=p}var g=p.Body,m=p.createQuadTree,b=p.createBounds,v=p.createDragForce,y=p.createSpringForce,_=p.integrate,A=i(1304).random(42),x=[],E=[],C=m(t,A),M=b(x,t,A),w=y(t,A),S=v(t),I=[],T=new Map,U=0;R("nbody",(function(){if(0!==x.length){C.insertBodies(x);for(var t=x.length;t--;){var e=x[t];e.isPinned||(e.reset(),C.updateBodyForce(e),S.update(e))}}})),R("spring",(function(){for(var t=E.length;t--;)w.update(E[t])}));var F={bodies:x,quadTree:C,springs:E,settings:t,addForce:R,removeForce:function(t){var e=I.indexOf(T.get(t));e<0||(I.splice(e,1),T.delete(t))},getForces:function(){return T},step:function(){for(var e=0;e<I.length;++e)I[e](U);var i=_(x,t.timeStep,t.adaptiveTimeStepWeight);return U+=1,i},addBody:function(t){if(!t)throw new Error("Body is required");return x.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=(t=>new g(t))(t);return x.push(e),e},removeBody:function(t){if(t){var e=x.indexOf(t);if(!(e<0))return x.splice(e,1),0===x.length&&M.reset(),!0}},addSpring:function(t,i,n,r){if(!t||!i)throw new Error("Cannot add null spring to force simulator");"number"!=typeof n&&(n=-1);var a=new e(t,i,n,r>=0?r:-1);return E.push(a),a},getTotalMovement:function(){return 0},removeSpring:function(t){if(t){var e=E.indexOf(t);return e>-1?(E.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return M.getBestNewPosition(t)},getBBox:B,getBoundingBox:B,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(e){return void 0!==e?(t.gravity=e,C.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,C.options({theta:e}),this):t.theta},random:A};return function(t,e){for(var i in t)h(t,e,i)}(t,F),u(F),F;function B(){return M.update(),M.box}function R(t,e){if(T.has(t))throw new Error("Force "+t+" is already added");T.set(t,e),I.push(e)}};var n=i(8379),r=i(1756),a=i(2758),o=i(5226),s=i(2843),l=i(8222),c={};function h(t,e,i){if(t.hasOwnProperty(i)&&"function"!=typeof e[i]){var n=Number.isFinite(t[i]);e[i]=n?function(n){if(void 0!==n){if(!Number.isFinite(n))throw new Error("Value of "+i+" should be a valid number.");return t[i]=n,e}return t[i]}:function(n){return void 0!==n?(t[i]=n,e):t[i]}}}},8787:t=>{t.exports=function(t,e,i,n){this.from=t,this.to=e,this.length=i,this.coefficient=n}},5261:(t,e,i)=>{t.exports=function(t){if("uniqueLinkId"in(t=t||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),t.multigraph=t.uniqueLinkId),void 0===t.multigraph&&(t.multigraph=!1),"function"!=typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e,i=new Map,l=new Map,c={},h=0,d=t.multigraph?function(t,e,i){var n=s(t,e),r=c.hasOwnProperty(n);if(r||w(t,e)){r||(c[n]=0);var a="@"+ ++c[n];n=s(t+a,e+a)}return new o(t,e,i,n)}:function(t,e,i){var n=s(t,e),r=l.get(n);return r?(r.data=i,r):new o(t,e,i,n)},u=[],p=S,f=S,g=S,m=S,b={version:20,addNode:_,addLink:function(t,e,i){g();var n=A(t)||_(t),r=A(e)||_(e),o=d(t,e,i),s=l.has(o.id);return l.set(o.id,o),a(n,o),t!==e&&a(r,o),p(o,s?"update":"add"),m(),o},removeLink:function(t,e){return void 0!==e&&(t=w(t,e)),M(t)},removeNode:x,getNode:A,getNodeCount:E,getLinkCount:C,getEdgeCount:C,getLinksCount:C,getNodesCount:E,getLinks:function(t){var e=A(t);return e?e.links:null},forEachNode:U,forEachLinkedNode:function(t,e,n){var r=A(t);if(r&&r.links&&"function"==typeof e)return n?function(t,e,n){for(var r=t.values(),a=r.next();!a.done;){var o=a.value;if(o.fromId===e&&n(i.get(o.toId),o))return!0;a=r.next()}}(r.links,t,e):function(t,e,n){for(var r=t.values(),a=r.next();!a.done;){var o=a.value,s=o.fromId===e?o.toId:o.fromId;if(n(i.get(s),o))return!0;a=r.next()}}(r.links,t,e)},forEachLink:function(t){if("function"==typeof t)for(var e=l.values(),i=e.next();!i.done;){if(t(i.value))return!0;i=e.next()}},beginUpdate:g,endUpdate:m,clear:function(){g(),U((function(t){x(t.id)})),m()},hasLink:w,hasNode:A,getLink:w};return n(b),e=b.on,b.on=function(){return b.beginUpdate=g=I,b.endUpdate=m=T,p=v,f=y,b.on=e,e.apply(b,arguments)},b;function v(t,e){u.push({link:t,changeType:e})}function y(t,e){u.push({node:t,changeType:e})}function _(t,e){if(void 0===t)throw new Error("Invalid node identifier");g();var n=A(t);return n?(n.data=e,f(n,"update")):(n=new r(t,e),f(n,"add")),i.set(t,n),m(),n}function A(t){return i.get(t)}function x(t){var e=A(t);if(!e)return!1;g();var n=e.links;return n&&(n.forEach(M),e.links=null),i.delete(t),f(e,"remove"),m(),!0}function E(){return i.size}function C(){return l.size}function M(t){if(!t)return!1;if(!l.get(t.id))return!1;g(),l.delete(t.id);var e=A(t.fromId),i=A(t.toId);return e&&e.links.delete(t),i&&i.links.delete(t),p(t,"remove"),m(),!0}function w(t,e){if(void 0!==t&&void 0!==e)return l.get(s(t,e))}function S(){}function I(){h+=1}function T(){0==(h-=1)&&u.length>0&&(b.fire("changed",u),u.length=0)}function U(t){if("function"!=typeof t)throw new Error("Function is expected to iterate over graph nodes. You passed "+t);for(var e=i.values(),n=e.next();!n.done;){if(t(n.value))return!0;n=e.next()}}};var n=i(1790);function r(t,e){this.id=t,this.links=null,this.data=e}function a(t,e){t.links?t.links.add(e):t.links=new Set([e])}function o(t,e,i,n){this.fromId=t,this.toId=e,this.data=i,this.id=n}function s(t,e){return t.toString()+"👉 "+e.toString()}},1277:t=>{t.exports=function t(e,i){var n;if(e||(e={}),i)for(n in i)if(i.hasOwnProperty(n)){var r=e.hasOwnProperty(n),a=typeof i[n];r&&typeof e[n]===a?"object"===a&&(e[n]=t(e[n],i[n])):e[n]=i[n]}return e}},1304:t=>{function e(t){return new i("number"==typeof t?t:+new Date)}function i(t){this.seed=t}function n(t){return Math.sqrt(2*Math.PI/t)*Math.pow(1/Math.E*(t+1/(12*t-1/(10*t))),t)}function r(){var t=this.seed;return t=4294967295&(3042594569^(t=4251993797+(t=4294967295&(3550635116+(t=374761393+(t=4294967295&(3345072700^(t=t+2127912214+(t<<12)&4294967295)^t>>>19))+(t<<5)&4294967295)^t<<9))+(t<<3)&4294967295)^t>>>16),this.seed=t,(268435455&t)/268435456}t.exports=e,t.exports.random=e,t.exports.randomIterator=function(t,i){var n=i||e();if("function"!=typeof n.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var i,r,a;for(i=t.length-1;i>0;--i)r=n.next(i+1),a=t[r],t[r]=t[i],t[i]=a,e(a);t.length&&e(t[0])},shuffle:function(){var e,i,r;for(e=t.length-1;e>0;--e)i=n.next(e+1),r=t[i],t[i]=t[e],t[e]=r;return t}}},i.prototype.next=function(t){return Math.floor(this.nextDouble()*t)},i.prototype.nextDouble=r,i.prototype.uniform=r,i.prototype.gaussian=function(){var t,e,i;do{t=(e=2*this.nextDouble()-1)*e+(i=2*this.nextDouble()-1)*i}while(t>=1||0===t);return e*Math.sqrt(-2*Math.log(t)/t)},i.prototype.levy=function(){var t=1.5,e=Math.pow(n(2.5)*Math.sin(Math.PI*t/2)/(n(1.25)*t*Math.pow(2,.25)),1/t);return this.gaussian()*e/Math.pow(Math.abs(this.gaussian()),1/t)}},4809:function(t,e){var i,n;i=function t(){"use strict";var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,n=e.IS_PAPA_WORKER||!1,r={},a=0,o={parse:function(i,n){var s=(n=n||{}).dynamicTyping||!1;if(A(s)&&(n.dynamicTypingFunction=s,s={}),n.dynamicTyping=s,n.transform=!!A(n.transform)&&n.transform,n.worker&&o.WORKERS_SUPPORTED){var l=function(){if(!o.WORKERS_SUPPORTED)return!1;var i,n,s=(i=e.URL||e.webkitURL||null,n=t.toString(),o.BLOB_URL||(o.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",n,")();"],{type:"text/javascript"})))),l=new e.Worker(s);return l.onmessage=m,l.id=a++,r[l.id]=l}();return l.userStep=n.step,l.userChunk=n.chunk,l.userComplete=n.complete,l.userError=n.error,n.step=A(n.step),n.chunk=A(n.chunk),n.complete=A(n.complete),n.error=A(n.error),delete n.worker,void l.postMessage({input:i,config:n,workerId:l.id})}var p=null;return o.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=n.download?new c(n):new d(n)):!0===i.readable&&A(i.read)&&A(i.on)?p=new u(n):(e.File&&i instanceof File||i instanceof Object)&&(p=new h(n)),p.stream(i)},unparse:function(t,e){var i=!1,n=!0,r=",",a="\r\n",s='"',l=s+s,c=!1,h=null,d=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||o.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(c=e.skipEmptyLines),"string"==typeof e.newline&&(a=e.newline),"string"==typeof e.quoteChar&&(s=e.quoteChar),"boolean"==typeof e.header&&(n=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");h=e.columns}void 0!==e.escapeChar&&(l=e.escapeChar+s),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(d=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var u=new RegExp(f(s),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,c);if("object"==typeof t[0])return p(h||Object.keys(t[0]),t,c)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||h),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],c);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var o="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var s=Array.isArray(t)&&0<t.length,l=!Array.isArray(e[0]);if(s&&n){for(var c=0;c<t.length;c++)0<c&&(o+=r),o+=g(t[c],c);0<e.length&&(o+=a)}for(var h=0;h<e.length;h++){var d=s?t.length:e[h].length,u=!1,p=s?0===Object.keys(e[h]).length:0===e[h].length;if(i&&!s&&(u="greedy"===i?""===e[h].join("").trim():1===e[h].length&&0===e[h][0].length),"greedy"===i&&s){for(var f=[],m=0;m<d;m++){var b=l?t[m]:m;f.push(e[h][b])}u=""===f.join("").trim()}if(!u){for(var v=0;v<d;v++){0<v&&!p&&(o+=r);var y=s&&l?t[v]:v;o+=g(e[h][y],v)}h<e.length-1&&(!i||0<d&&!p)&&(o+=a)}}return o}function g(t,e){if(null==t)return"";if(t.constructor===Date)return JSON.stringify(t).slice(1,25);var n=!1;d&&"string"==typeof t&&d.test(t)&&(t="'"+t,n=!0);var a=t.toString().replace(u,l);return(n=n||!0===i||"function"==typeof i&&i(t,e)||Array.isArray(i)&&i[e]||function(t,e){for(var i=0;i<e.length;i++)if(-1<t.indexOf(e[i]))return!0;return!1}(a,o.BAD_DELIMITERS)||-1<a.indexOf(r)||" "===a.charAt(0)||" "===a.charAt(a.length-1))?s+a+s:a}}};if(o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\ufeff",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!i&&!!e.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=g,o.ParserHandle=p,o.NetworkStreamer=c,o.FileStreamer=h,o.StringStreamer=d,o.ReadableStreamStreamer=u,e.jQuery){var s=e.jQuery;s.fn.parse=function(t){var i=t.config||{},n=[];return this.each((function(t){if("INPUT"!==s(this).prop("tagName").toUpperCase()||"file"!==s(this).attr("type").toLowerCase()||!e.FileReader||!this.files||0===this.files.length)return!0;for(var r=0;r<this.files.length;r++)n.push({file:this.files[r],inputElem:this,instanceConfig:s.extend({},i)})})),r(),this;function r(){if(0!==n.length){var e,i,r,l=n[0];if(A(t.before)){var c=t.before(l.file,l.inputElem);if("object"==typeof c){if("abort"===c.action)return"AbortError",e=l.file,i=l.inputElem,r=c.reason,void(A(t.error)&&t.error({name:"AbortError"},e,i,r));if("skip"===c.action)return void a();"object"==typeof c.config&&(l.instanceConfig=s.extend(l.instanceConfig,c.config))}else if("skip"===c)return void a()}var h=l.instanceConfig.complete;l.instanceConfig.complete=function(t){A(h)&&h(t,l.file,l.inputElem),a()},o.parse(l.file,l.instanceConfig)}else A(t.complete)&&t.complete()}function a(){n.splice(0,1),r()}}}function l(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(t){var e=y(t);e.chunkSize=parseInt(e.chunkSize),t.step||t.chunk||(e.chunkSize=null),this._handle=new p(e),(this._handle.streamer=this)._config=e}.call(this,t),this.parseChunk=function(t,i){if(this.isFirstChunk&&A(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(t);void 0!==r&&(t=r)}this.isFirstChunk=!1,this._halted=!1;var a=this._partialLine+t;this._partialLine="";var s=this._handle.parse(a,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=s.meta.cursor;this._finished||(this._partialLine=a.substring(l-this._baseIndex),this._baseIndex=l),s&&s.data&&(this._rowCount+=s.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(n)e.postMessage({results:s,workerId:o.WORKER_ID,finished:c});else if(A(this._config.chunk)&&!i){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);s=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!c||!A(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(t){A(this._config.error)?this._config.error(t):n&&this._config.error&&e.postMessage({workerId:o.WORKER_ID,error:t,finished:!1})}}function c(t){var e;(t=t||{}).chunkSize||(t.chunkSize=o.RemoteChunkSize),l.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=_(this._chunkLoaded,this),e.onerror=_(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var n in t)e.setRequestHeader(n,t[n])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function h(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=o.LocalChunkSize),l.call(this,t);var n="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,n?((e=new FileReader).onload=_(this._chunkLoaded,this),e.onerror=_(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var t=this._input;if(this._config.chunkSize){var r=Math.min(this._start+this._config.chunkSize,this._input.size);t=i.call(t,this._start,r)}var a=e.readAsText(t,this._config.encoding);n||this._chunkLoaded({target:{result:a}})},this._chunkLoaded=function(t){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function d(t){var e;l.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function u(t){l.call(this,t=t||{});var e=[],i=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=_((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=_((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=_((function(){this._streamCleanUp(),n=!0,this._streamData("")}),this),this._streamCleanUp=_((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,n,r=Math.pow(2,53),a=-r,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,c=this,h=0,d=0,u=!1,p=!1,m=[],b={data:[],errors:[],meta:{}};if(A(t.step)){var v=t.step;t.step=function(e){if(b=e,E())x();else{if(x(),0===b.data.length)return;h+=e.data.length,t.preview&&h>t.preview?i.abort():(b.data=b.data[0],v(b,c))}}}function _(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function x(){return b&&n&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),n=!1),t.skipEmptyLines&&(b.data=b.data.filter((function(t){return!_(t)}))),E()&&function(){if(b)if(Array.isArray(b.data[0])){for(var e=0;E()&&e<b.data.length;e++)b.data[e].forEach(i);b.data.splice(0,1)}else b.data.forEach(i);function i(e,i){A(t.transformHeader)&&(e=t.transformHeader(e,i)),m.push(e)}}(),function(){if(!b||!t.header&&!t.dynamicTyping&&!t.transform)return b;function e(e,i){var n,r=t.header?{}:[];for(n=0;n<e.length;n++){var a=n,o=e[n];t.header&&(a=n>=m.length?"__parsed_extra":m[n]),t.transform&&(o=t.transform(o,a)),o=C(a,o),"__parsed_extra"===a?(r[a]=r[a]||[],r[a].push(o)):r[a]=o}return t.header&&(n>m.length?M("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+n,d+i):n<m.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+n,d+i)),r}var i=1;return!b.data.length||Array.isArray(b.data[0])?(b.data=b.data.map(e),i=b.data.length):b.data=e(b.data,0),t.header&&b.meta&&(b.meta.fields=m),d+=i,b}()}function E(){return t.header&&0===m.length}function C(e,i){return n=e,t.dynamicTypingFunction&&void 0===t.dynamicTyping[n]&&(t.dynamicTyping[n]=t.dynamicTypingFunction(n)),!0===(t.dynamicTyping[n]||t.dynamicTyping)?"true"===i||"TRUE"===i||"false"!==i&&"FALSE"!==i&&(function(t){if(s.test(t)){var e=parseFloat(t);if(a<e&&e<r)return!0}return!1}(i)?parseFloat(i):l.test(i)?new Date(i):""===i?null:i):i;var n}function M(t,e,i,n){var r={type:t,code:e,message:i};void 0!==n&&(r.row=n),b.errors.push(r)}this.parse=function(r,a,s){var l=t.quoteChar||'"';if(t.newline||(t.newline=function(t,e){t=t.substring(0,1048576);var i=new RegExp(f(e)+"([^]*?)"+f(e),"gm"),n=(t=t.replace(i,"")).split("\r"),r=t.split("\n"),a=1<r.length&&r[0].length<n[0].length;if(1===n.length||a)return"\n";for(var o=0,s=0;s<n.length;s++)"\n"===n[s][0]&&o++;return o>=n.length/2?"\r\n":"\r"}(r,l)),n=!1,t.delimiter)A(t.delimiter)&&(t.delimiter=t.delimiter(r),b.meta.delimiter=t.delimiter);else{var c=function(e,i,n,r,a){var s,l,c,h;a=a||[",","\t","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var d=0;d<a.length;d++){var u=a[d],p=0,f=0,m=0;c=void 0;for(var b=new g({comments:r,delimiter:u,newline:i,preview:10}).parse(e),v=0;v<b.data.length;v++)if(n&&_(b.data[v]))m++;else{var y=b.data[v].length;f+=y,void 0!==c?0<y&&(p+=Math.abs(y-c),c=y):c=y}0<b.data.length&&(f/=b.data.length-m),(void 0===l||p<=l)&&(void 0===h||h<f)&&1.99<f&&(l=p,s=u,h=f)}return{successful:!!(t.delimiter=s),bestDelimiter:s}}(r,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess);c.successful?t.delimiter=c.bestDelimiter:(n=!0,t.delimiter=o.DefaultDelimiter),b.meta.delimiter=t.delimiter}var h=y(t);return t.preview&&t.header&&h.preview++,e=r,i=new g(h),b=i.parse(e,a,s),x(),u?{meta:{paused:!0}}:b||{meta:{paused:!1}}},this.paused=function(){return u},this.pause=function(){u=!0,i.abort(),e=A(t.chunk)?"":e.substring(i.getCharIndex())},this.resume=function(){c.streamer._halted?(u=!1,c.streamer.parseChunk(e,!0)):setTimeout(c.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,i.abort(),b.meta.aborted=!0,A(t.complete)&&t.complete(b),e=""}}function f(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(t){var e,i=(t=t||{}).delimiter,n=t.newline,r=t.comments,a=t.step,s=t.preview,l=t.fastMode,c=e=void 0===t.quoteChar||null===t.quoteChar?'"':t.quoteChar;if(void 0!==t.escapeChar&&(c=t.escapeChar),("string"!=typeof i||-1<o.BAD_DELIMITERS.indexOf(i))&&(i=","),r===i)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<o.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var h=0,d=!1;this.parse=function(o,u,p){if("string"!=typeof o)throw new Error("Input must be a string");var g=o.length,m=i.length,b=n.length,v=r.length,y=A(a),_=[],x=[],E=[],C=h=0;if(!o)return j();if(t.header&&!u){var M=o.split(n)[0].split(i),w=[],S={},I=!1;for(var T in M){var U=M[T];A(t.transformHeader)&&(U=t.transformHeader(U,T));var F=U,B=S[U]||0;for(0<B&&(I=!0,F=U+"_"+B),S[U]=B+1;w.includes(F);)F=F+"_"+B;w.push(F)}if(I){var R=o.split(n);R[0]=w.join(i),o=R.join(n)}}if(l||!1!==l&&-1===o.indexOf(e)){for(var L=o.split(n),D=0;D<L.length;D++){if(E=L[D],h+=E.length,D!==L.length-1)h+=n.length;else if(p)return j();if(!r||E.substring(0,v)!==r){if(y){if(_=[],V(E.split(i)),X(),d)return j()}else V(E.split(i));if(s&&s<=D)return _=_.slice(0,s),j(!0)}}return j()}for(var P=o.indexOf(i,h),N=o.indexOf(n,h),O=new RegExp(f(c)+f(e),"g"),k=o.indexOf(e,h);;)if(o[h]!==e)if(r&&0===E.length&&o.substring(h,h+v)===r){if(-1===N)return j();h=N+b,N=o.indexOf(n,h),P=o.indexOf(i,h)}else if(-1!==P&&(P<N||-1===N))E.push(o.substring(h,P)),h=P+m,P=o.indexOf(i,h);else{if(-1===N)break;if(E.push(o.substring(h,N)),W(N+b),y&&(X(),d))return j();if(s&&_.length>=s)return j(!0)}else for(k=h,h++;;){if(-1===(k=o.indexOf(e,k+1)))return p||x.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:_.length,index:h}),G();if(k===g-1)return G(o.substring(h,k).replace(O,e));if(e!==c||o[k+1]!==c){if(e===c||0===k||o[k-1]!==c){-1!==P&&P<k+1&&(P=o.indexOf(i,k+1)),-1!==N&&N<k+1&&(N=o.indexOf(n,k+1));var z=H(-1===N?P:Math.min(P,N));if(o.substr(k+1+z,m)===i){E.push(o.substring(h,k).replace(O,e)),o[h=k+1+z+m]!==e&&(k=o.indexOf(e,h)),P=o.indexOf(i,h),N=o.indexOf(n,h);break}var Q=H(N);if(o.substring(k+1+Q,k+1+Q+b)===n){if(E.push(o.substring(h,k).replace(O,e)),W(k+1+Q+b),P=o.indexOf(i,h),k=o.indexOf(e,h),y&&(X(),d))return j();if(s&&_.length>=s)return j(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:_.length,index:h}),k++}}else k++}return G();function V(t){_.push(t),C=h}function H(t){var e=0;if(-1!==t){var i=o.substring(k+1,t);i&&""===i.trim()&&(e=i.length)}return e}function G(t){return p||(void 0===t&&(t=o.substring(h)),E.push(t),h=g,V(E),y&&X()),j()}function W(t){h=t,V(E),E=[],N=o.indexOf(n,h)}function j(t){return{data:_,errors:x,meta:{delimiter:i,linebreak:n,aborted:d,truncated:!!t,cursor:C+(u||0)}}}function X(){a(j()),_=[],x=[]}},this.abort=function(){d=!0},this.getCharIndex=function(){return h}}function m(t){var e=t.data,i=r[e.workerId],n=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var a={abort:function(){n=!0,b(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(A(i.userStep)){for(var o=0;o<e.results.data.length&&(i.userStep({data:e.results.data[o],errors:e.results.errors,meta:e.results.meta},a),!n);o++);delete e.results}else A(i.userChunk)&&(i.userChunk(e.results,a,e.file),delete e.results)}e.finished&&!n&&b(e.workerId,e.results)}function b(t,e){var i=r[t];A(i.userComplete)&&i.userComplete(e),i.terminate(),delete r[t]}function v(){throw new Error("Not implemented.")}function y(t){if("object"!=typeof t||null===t)return t;var e=Array.isArray(t)?[]:{};for(var i in t)e[i]=y(t[i]);return e}function _(t,e){return function(){t.apply(e,arguments)}}function A(t){return"function"==typeof t}return n&&(e.onmessage=function(t){var i=t.data;if(void 0===o.WORKER_ID&&i&&(o.WORKER_ID=i.workerId),"string"==typeof i.input)e.postMessage({workerId:o.WORKER_ID,results:o.parse(i.input,i.config),finished:!0});else if(e.File&&i.input instanceof File||i.input instanceof Object){var n=o.parse(i.input,i.config);n&&e.postMessage({workerId:o.WORKER_ID,results:n,finished:!0})}}),(c.prototype=Object.create(l.prototype)).constructor=c,(h.prototype=Object.create(l.prototype)).constructor=h,(d.prototype=Object.create(d.prototype)).constructor=d,(u.prototype=Object.create(l.prototype)).constructor=u,o},void 0===(n=i.apply(e,[]))||(t.exports=n)},5298:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAC70lEQVR42u3by04TURzH8W+nFx0kMUBbE6eNiSCXjQlxZQKU2qUbSERfwUQQ0ATfwATYGCPxHSwoLtzZ9ObWGIMRSDDRlFlIW1xIUuxtXHQ0gC1MTRM6nfNPupmeaef3OTNnziRzbJqmcUy5gDH9cx24qG9r5toDtoEPwCvgNZCv1dh2DMA4sAD0YO7aAh4BL6t9KVXZZgfm9R3MHh49w4qeyX4SgB14DMzRejWnZ7PXAmjl8DURDo4B8y0e/mAt6OPCX4BbQBhr1QSwbNM0zQV8AXwWA1CBy5IuYbXwAApwW9InOVatMZumaV+BS0b3KBSK5XgyqcYSSXXt01o2k87k8sVi+TSOvk2WHV6vV+7r7e0IBoaVkaFhxel0SHX8xDebpmn7wBkjrWPxhPp06fnHlLq914zd6Vd87VP37l4NBgJGL+m8TTvhYeBgz49P3HnzPb2Ta+Zz2uv2yKvLL24aPRMMny6RaDTV7OEBdjLp3NtIJGW0vWGAWDyhmmVkiyXfqQ0H+LyxvmsWgPU6jtUwQDa7u28WgGwmu99wgHyhUDYLQD23ZQmLlwAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAByqc22ywyyhXA7jL0oZbtjV6ZbNAtDl7jrbcIArPd3nzQIw0D/Q2XCA0cCIYhaA0eEhpeEAoWDQf8HjbfrLwOv2yKHQDX89AD+NNHQ6HdLs9NSgX/G1N2t4v+Jrfzhzf9DldBrt2LxN07RNoNfonxQKxXIkGk1F4wl1Y3PjR3onkyuUTudVWafdIXm8brm/r78jGBhRQsGg/39elQ1TWS9gxVqRgFULz4NWrb5goluisqjwgQV7fxb49WfACAOLFgq/qGc+tGrMDjwBJls8/BIwDZSOToRKwAzwzCrhq80EWxnhn/C1psIlYEqfG2y1QPAtKivjJo+GPzoGVH201nceB65RWWrmbPLABf0W957K8vkwxyyf/w0kIOOe2pS1LAAAAABJRU5ErkJggg=="},5379:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInBhdXNlIiwKICAgICAgICAgICAgInJvdGF0aW9uIiA6IFsKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgIm1lc2hlcyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAibmFtZSIgOiAiUGxhbmUiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNTYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMC44MDk2NzM1NDc3NDQ3NTEsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMQogICAgICAgICAgICBdLAogICAgICAgICAgICAibWluIiA6IFsKICAgICAgICAgICAgICAgIC0wLjc5NjU0NzUzMjA4MTYwNCwKICAgICAgICAgICAgICAgIC0wLjE5Njg4OTQ2MDA4NjgyMjUsCiAgICAgICAgICAgICAgICAtMQogICAgICAgICAgICBdLAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMSwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMiwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMywKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyMywKICAgICAgICAgICAgImNvdW50IiA6IDcyLAogICAgICAgICAgICAidHlwZSIgOiAiU0NBTEFSIgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVyVmlld3MiIDogWwogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDY3MgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDQ0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTM0NAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE0NCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTc5MgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxOTM2LAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy82RlZRdmdBQUFBQUFBSUMvNkZWUXZnQUFBQUFBQUlBL3hFWlBQMlNkU2I0QUFJQS94RVpQUDJTZFNiNEFBSUMvYkoxSlBtU2RTYjRBQUlDL2NKMUpQbVNkU2I0QUFJQS82RlZRdm1TZFNiNEFBSUEvNkZWUXZtU2RTYjRBQUlDL2l1cEx2MlNkU2I0QUFJQy9pdXBMdjJTZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy94RVpQUHdBQUFBQUFBSUMveEVaUFB3QUFBQUFBQUlBLzZGVlF2Z0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS94RVpQUHdBQUFBQUFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQMlNkU2I0QUFJQS94RVpQUHdBQUFBQUFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2MlNkU2I0QUFJQS9pdXBMdjJTZFNiNEFBSUMvaXVwTHZ3QUFBQUFBQUlDL2NKMUpQZ0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvYkoxSlBtU2RTYjRBQUlDL2NKMUpQZ0FBQUFBQUFJQS9iSjFKUG1TZFNiNEFBSUMvYkoxSlBnQUFBQUFBQUlDLzZGVlF2Z0FBQUFBQUFJQS82RlZRdm1TZFNiNEFBSUEvaXVwTHYyU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS9pdXBMdjJTZFNiNEFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy9pdXBMdjJTZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlDL2l1cEx2d0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZnQUFBQUFBQUlDL3hFWlBQd0FBQUFBQUFJQS94RVpQUDJTZFNiNEFBSUEvY0oxSlBtU2RTYjRBQUlBL3hFWlBQd0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy9iSjFKUG1TZFNiNEFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQd0FBQUFBQUFJQy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFhaDZLeUFBQ0FQd0FBQUFBYWg2S3lBQUNBUHdBQUFBQWFoNkt5QUFDQVB3QUFBQUFhaHlLekFBQ0FQd0FBQUFBYWh5S3pBQUNBUHdBQUFBQWFoeUt6QUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUQvLzM4L0FBQUFBQUFBQUFELy8zOC9BQUFBQUFBQUFBRC8vMzgvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUFBQUJEVmx6NEFBQUFBRU5XWFBnQUFnRDhBQUlBL0FBQ0FQd0FBZ0Q4QUFBQUFUSkF4UHdBQUFBQk1rREUvQUFDQVB4RFZsejRBQUlBL0VOV1hQZ0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBSUEvVEpBeFB3QUFnRDlNa0RFL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOFExWmMrQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBZ0Q4UTFaYytBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFCTWtERS9BQUNBUDB5UU1UOEFBSUEvVEpBeFB3QUFBQUJNa0RFL0FBQ0FQMHlRTVQ4QUFBQUFUSkF4UHdBQUFBQVExWmMrQUFDQVB4RFZsejRBQUlBL0FBQUFBQUFBZ0Q4UTFaYytBQUNBUHdBQUFBQUFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBQUFBQUFBQUFFTldYUGdBQUFBQUFBQUFBQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBQUFBQUFJQS9BQUNBUHdBQWdEOEFBSUEvVEpBeFB3QUFnRDhBQUlBL0FBQ0FQMHlRTVQ4QUFJQS9USkF4UHdBQWdEOU1rREUvQUFBQUFFeVFNVDhBQUFBQUFBQ0FQd0FBQUFBQUFJQS9BQUFBQUFBQUFRQUNBQUFBQWdBREFBUUFCUUFHQUFRQUJnQUhBQWdBQ1FBS0FBZ0FDZ0FMQUF3QURRQU9BQXdBRGdBUEFCQUFFUUFTQUJBQUVnQVRBQlFBRlFBV0FCUUFGZ0FYQUJnQUdRQWFBQmdBR2dBYkFCd0FIUUFlQUI4QUlBQWhBQ0lBSXdBa0FDVUFKZ0FuQUNnQUtRQXFBQ3NBTEFBdEFDNEFMd0F3QURFQU1nQXpBRFFBTlFBMkFEUUFOZ0EzQUE9PSIKICAgICAgICB9CiAgICBdCn0K"},6457:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogIlBsYXkiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDEiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4xOTY4ODk0NzQ5ODc5ODM3LAogICAgICAgICAgICAgICAgLTAuOTk0OTY1NjcyNDkyOTgxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogMjQsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMjE2CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0MzIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTc2CiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDYyNCwKICAgICAgICAgICAgInVyaSIgOiAiZGF0YTphcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07YmFzZTY0LEFBQ0F2MldkU2I0U3RuNi9BQUNBdjJXZFNiNEFBSUEvQUFDQVAyV2RTYjRBR2txOEFBQ0FQd0FBQUFBQUdrcThBQUNBUDJXZFNiNEFHa3E4QUFDQXYyV2RTYjRBQUlBL0FBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQVB3QUFBQUFBR2txOEFBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQXYyV2RTYjRTdG42L0FBQ0FQMldkU2I0QUdrcThBQUNBUHdBQUFBQUFHa3E4QUFDQXZ3QUFBQUFBQUlBL0FBQ0F2MldkU2I0QUFJQS9BQUNBdjJXZFNiNFN0bjYvQUFDQXZ3QUFBQUFTdG42L0FBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQWZqbm52Z0FBQUFBNGFHUy9mam5udmdBQUFBQTRhR1MvZmpubnZnQUFBQUE0YUdTL2Zqbm52Z0FBQUFBNGFHUy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FhY2JodmdBQUFBQVh4R1UvYWNiaHZnQUFBQUFYeEdVL2FjYmh2Z0FBQUFBWHhHVS9hY2JodmdBQUFBQVh4R1UvQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQUFBQUQzSkRzQUFBQUFBQUNBUHdBQWdEK1kxL3crQUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFnRCtZMS93K0FBQUFBQUFBZ0Q4QUFBQUFBUGNrT3dBQUFBQUE5eVE3QUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFBQUFBOXlRN0FBQUJBQUlBQXdBRUFBVUFBd0FGQUFZQUJ3QUlBQWtBQ2dBTEFBd0FDZ0FNQUEwQURnQVBBQkFBRGdBUUFCRUEiCiAgICAgICAgfQogICAgXQp9Cg=="},5126:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInJld2luZCIsCiAgICAgICAgICAgICJyb3RhdGlvbiIgOiBbCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNAogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXSwKICAgICJtZXNoZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlBsYW5lLjAwMyIsCiAgICAgICAgICAgICJwcmltaXRpdmVzIiA6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiYXR0cmlidXRlcyIgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJQT1NJVElPTiIgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAiTk9STUFMIiA6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICJURVhDT09SRF8wIiA6IDIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICJpbmRpY2VzIiA6IDMKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAiYWNjZXNzb3JzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDAsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgIm1heCIgOiBbCiAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgIm1pbiIgOiBbCiAgICAgICAgICAgICAgICAtMSwKICAgICAgICAgICAgICAgIC0wLjE5NzQ5NzA4NDczNjgyNDA0LAogICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDEsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDIsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzIiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDMsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjMsCiAgICAgICAgICAgICJjb3VudCIgOiA2MCwKICAgICAgICAgICAgInR5cGUiIDogIlNDQUxBUiIKICAgICAgICB9CiAgICBdLAogICAgImJ1ZmZlclZpZXdzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAwCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0ODAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAzMjAsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDk2MAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDEyMCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTI4MAogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxNDAwLAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsQUFDQVB3QUFBQUFBQUlBL0FBQ0FQNjA4U3I0QUFJQS9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQNjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3QUFDQVA2MDhTcjRBQUlBL0FBQ0F2d0FBQUFBQTZQaTdBQUNBdjYwOFNyNEE2UGk3QUNDcnU2MDhTcjRBQUlDL0FDQ3J1d0FBQUFBQUFJQy9BQUNBdndBQUFBQUE2UGk3QUNDcnV3QUFBQUFBQUlDL0p4WTd1d0FBQUFBQUtuZzdBR0FFdWdBQUFBQUFBSUEvQUNDcnV3QUFBQUFBQUlDL0FDQ3J1NjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHdBQUFBQUFBSUEvQUNDcnU2MDhTcjRBQUlDL0FBQ0F2NjA4U3I0QTZQaTdBR0FFdXEwOFNyNEFBSUEvSnhZN3V3QUFBQUFBS25nN0p4WTd1NjA4U3I0QUtuZzdBR0FFdXEwOFNyNEFBSUEvQUdBRXVnQUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUDYwOFNyNEFBSUMvQUFDQVA2MDhTcjRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9KeFk3dXdBQUFBQUFLbmc3SnhZN3U2MDhTcjRBS25nN0FBQ0FQNjA4U3I0QUFJQy9BQUNBUHdBQUFBQUFBSUMvQUdBRXVnQUFBQUFBQUlBL0FHQUV1cTA4U3I0QUFJQS9BQUNBdjYwOFNyNEE2UGk3QUFDQXZ3QUFBQUFBNlBpN3ZXbzBQd0FBQUFDbm5qVy92V28wUHdBQUFBQ25ualcvdldvMFB3QUFBQUNubmpXL3ZXbzBQd0FBQUFDbm5qVy9BQUFBQUFBQWdEOEFBQUFBQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBZ0Q4QUFBQUFrTTAwUHdBQUFBQkZQRFUva00wMFB3QUFBQUJGUERVL2tNMDBQd0FBQUFCRlBEVS9rTTAwUHdBQUFBQkZQRFUvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQTB2OS92d0FBQUFEbGt4bzcwdjkvdndBQUFBRGxreG83MHY5L3Z3QUFBQURsa3hvNzB2OS92d0FBQUFEbGt4bzdBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQTBQOS92d0FBQUFEamt4bzcwUDkvdndBQUFBRGpreG83MFA5L3Z3QUFBQURqa3hvNzBQOS92d0FBQUFEamt4bzdBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBZHhvMVB3QUFBQUJyN3pRL2R4bzFQd0FBQUFCcjd6US9keG8xUHdBQUFBQnI3elEvZHhvMVB3QUFBQUJyN3pRL25iODFQd0FBQUFDSlNUUy9uYjgxUHdBQUFBQ0pTVFMvbmI4MVB3QUFBQUNKU1RTL25iODFQd0FBQUFDSlNUUy9BQUNBUHdBQWdEOEFBSUEvQUFDQVArcEUvejRWZkFBLzZrVC9QaFY4QUQ4QUFJQS9BQUFBQU9wRS96NFZmQUEvQUFDQVB3QUFnRDhBQUFBQU1BNytQZ0FBQUFBd0R2NCt3S24rUGdBQUFBREFxZjQrQUFBQUFBQUFBQUF3RHY0K3dLbitQZ0FBQUFEcVJQOCtGWHdBUCtqZS96NEFBSUEvd0tuK1BnQUFBQURBcWY0K0FBQUFBT3BFL3o0VmZBQS82a1QvUGhWOEFEOEFBSUEvQUFBQUFBQUFnRDhBQUlBL3dLbitQZ0FBQUFBQUFBQUFNQTcrUHVqZS96NEFBSUEvNmtUL1BoVjhBRC9xUlA4K0ZYd0FQK2plL3o0QUFJQS82TjcvUGdBQWdEOEFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQ0FQd0FBZ0Q4QUFJQS9BQUNBUCtwRS96NFZmQUEvNmtUL1BoVjhBRDhBQUlBL0FBQUFBQUFBZ0Q4QUFBQUE2TjcvUGdBQWdEL28zdjgrQUFDQVB3QUFBQUF3RHY0K0FBQUFBREFPL2o0QUFBRUFBZ0FBQUFJQUF3QUVBQVVBQmdBSEFBZ0FDUUFIQUFrQUNnQUxBQXdBRFFBT0FBc0FEUUFQQUJBQUVRQVBBQkVBRWdBVEFCUUFEUUFGQUJVQUZnQUZBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FnQUNFQUlnQWdBQ0lBSXdBa0FDVUFKZ0FrQUNZQUp3QT0iCiAgICAgICAgfQogICAgXQp9Cg=="},4906:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});const n="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInNraXAiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDIiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4yMDIzNTg2MDM0Nzc0NzgwMywKICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogNzIsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTUyCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMzY4LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxMTA0CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxNDcyCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE2MTYsCiAgICAgICAgICAgICJ1cmkiIDogImRhdGE6YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtO2Jhc2U2NCxBQUNBdndBQUFBQUFBSUEvQUFDQXZ3QUFBQUFBQUlDLzVBSWF2d0FBQUFBQUFJQy81QUlhdndBQUFBQUFOck83NUFJYXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBUHhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBUHhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPN0FBQ0FQeGczVDc0QUFJQS9BQUNBUHdBQUFBQUFBSUMvQUFDQVB3QUFBQUFBQUlBLzVBSWF2d0FBQUFBQU5yTzc1QUlhdnhnM1Q3NEFOck83NUFJYXZ4ZzNUNzRBQUlDL0FBQ0F2eGczVDc0QUFJQy9BQUNBdnhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBQUlBLzVBSWF2d0FBQUFBQUFJQy81QUlhdnhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBdndBQUFBQUFBSUMvQUFDQXZ4ZzNUNzRBQUlDLzVBSWF2eGczVDc0QUFJQy81QUlhdndBQUFBQUFBSUMvNUFJYXZ3QUFBQUFBTnJPNzVBSWF2eGczVDc0QU5yTzdBQUNBUHhnM1Q3NEFBSUMvQUFDQVB3QUFBQUFBQUlDLzVBSWF2eGczVDc0QUFJQS81QUlhdndBQUFBQUFBSUEvNUFJYXZ3QUFBQUFBQUlBLzVBSWF2eGczVDc0QUFJQS9BQUNBdnhnM1Q3NEFBSUEvQUFDQXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHhnM1Q3NEFBSUMvQUFDQVB4ZzNUNzRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBdndBQUFBQUFBSUEvQUFDQXZ4ZzNUNzRBQUlBL0FBQ0F2eGczVDc0QUFJQy9BQUNBdndBQUFBQUFBSUMvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FOUjBJUHdBQUFBREQwRmkvTlIwSVB3QUFBQUREMEZpL05SMElQd0FBQUFERDBGaS9OUjBJUHdBQUFBREQwRmkvQUFBQUFQLy9mejhBQUFBQUFBQUFBUC8vZno4QUFBQUFBQUFBQVAvL2Z6OEFBQUFBQUFBQUFQLy9mNzhBQUFDQUFBQUFBUC8vZjc4QUFBQ0FBQUFBQVAvL2Y3OEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0RRd0hQd0FBQUFCUmUxay9EUXdIUHdBQUFBQlJlMWsvRFF3SFB3QUFBQUJSZTFrL0RRd0hQd0FBQUFCUmUxay9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQUFBQUFBQUlBQUFJQy9BQUFBQUFBQUFJQUFBSUMvQUFBQUFBQUFBSUFBQUlDL0FBQUFBQUFBQUlBQUFJQy9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQ0FQd0FBQUlBQUFBQ0FBQUNBUHdBQUFJQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQUFBQUFBZ0Q4QUFBQUFBQUFBQURqNlN6NEFBQUFBT1BwTFBwU1ovajQ0K2tzK0FBQ0FQd0FBZ0Q4QUFJQS9BQUNBUHdBQWdEODQra3MrbEpuK1BqajZTejZVbWY0K0FBQ0FQd0FBQUFBNCtrcytsSm4rUGdBQWdEOEFBSUEvQUFDQVB3QUFBQUFBQUlBL0FBQ0FQemo2U3o2VW1mNCtPUHBMUHBTWi9qNDQra3MrQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBZ0Q4NCtrcytBQUNBUHpqNlN6NEFBQUFBT1BwTFBnQUFBQUE0K2tzK2xKbitQamo2U3o2VW1mNCtBQUFBQUFBQUFBQUFBQUFBQUFBQUFEajZTejRBQUFBQU9QcExQZ0FBQUFBNCtrcytsSm4rUGpqNlN6NlVtZjQrQUFDQVB3QUFBQUFBQUlBL0FBQUFBRGo2U3o0QUFJQS9PUHBMUGdBQWdEODQra3MrQUFDQVB6ajZTejRBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBRUFBZ0FBQUFJQUF3QUFBQU1BQkFBRkFBWUFCd0FGQUFjQUNBQUpBQW9BQ3dBTUFBMEFEZ0FQQUJBQUVRQVBBQkVBRWdBVEFBOEFFZ0FVQUJVQUZnQVVBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FYQUJZQUlBQVhBQ0FBSVFBaUFDTUFKQUFpQUNRQUpRQW1BQ2NBS0FBbUFDZ0FLUUFxQUNzQUxBQXFBQ3dBTFFBPSIKICAgICAgICB9CiAgICBdCn0K"},4468:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});var n=function(t){return"function"==typeof t?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}}},8524:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>Ui});var n=i(9437),r={value:()=>{}};function a(){for(var t,e=0,i=arguments.length,n={};e<i;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new o(n)}function o(t){this._=t}function s(t,e){for(var i,n=0,r=t.length;n<r;++n)if((i=t[n]).name===e)return i.value}function l(t,e,i){for(var n=0,a=t.length;n<a;++n)if(t[n].name===e){t[n]=r,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=i&&t.push({name:e,value:i}),t}o.prototype=a.prototype={constructor:o,on:function(t,e){var i,n,r=this._,a=(n=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",i=t.indexOf(".");if(i>=0&&(e=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),o=-1,c=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<c;)if(i=(t=a[o]).type)r[i]=l(r[i],t.name,e);else if(null==e)for(i in r)r[i]=l(r[i],t.name,null);return this}for(;++o<c;)if((i=(t=a[o]).type)&&(i=s(r[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new o(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,n,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(n=this._[t]).length;a<i;++a)n[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,a=n.length;r<a;++r)n[r].value.apply(e,i)}};const c=a;var h,d,u=0,p=0,f=0,g=1e3,m=0,b=0,v=0,y="object"==typeof performance&&performance.now?performance:Date,_="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function A(){return b||(_(x),b=y.now()+v)}function x(){b=0}function E(){this._call=this._time=this._next=null}function C(t,e,i){var n=new E;return n.restart(t,e,i),n}function M(){b=(m=y.now())+v,u=p=0;try{!function(){A(),++u;for(var t,e=h;e;)(t=b-e._time)>=0&&e._call.call(void 0,t),e=e._next;--u}()}finally{u=0,function(){for(var t,e,i=h,n=1/0;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:h=e);d=t,S(n)}(),b=0}}function w(){var t=y.now(),e=t-m;e>g&&(v-=e,m=t)}function S(t){u||(p&&(p=clearTimeout(p)),t-b>24?(t<1/0&&(p=setTimeout(M,t-y.now()-v)),f&&(f=clearInterval(f))):(f||(m=y.now(),f=setInterval(w,g)),u=1,_(M)))}E.prototype=C.prototype={constructor:E,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?A():+i)+(null==e?0:+e),this._next||d===this||(d?d._next=this:h=this,d=this),this._call=t,this._time=i,S()},stop:function(){this._call&&(this._call=null,this._time=1/0,S())}};const I=4294967296;function T(t){return t.x}function U(t){return t.y}function F(t){return t.z}var B=Math.PI*(3-Math.sqrt(5)),R=20*Math.PI/(9+Math.sqrt(221));function L(t,e){e=e||2;var i,n=Math.min(3,Math.max(1,Math.round(e))),r=1,a=.001,o=1-Math.pow(a,1/300),s=0,l=.6,h=new Map,d=C(f),u=c("tick","end"),p=function(){let t=1;return()=>(t=(1664525*t+1013904223)%I)/I}();function f(){g(),u.call("tick",i),r<a&&(d.stop(),u.call("end",i))}function g(e){var a,c,d=t.length;void 0===e&&(e=1);for(var u=0;u<e;++u)for(r+=(s-r)*o,h.forEach((function(t){t(r)})),a=0;a<d;++a)null==(c=t[a]).fx?c.x+=c.vx*=l:(c.x=c.fx,c.vx=0),n>1&&(null==c.fy?c.y+=c.vy*=l:(c.y=c.fy,c.vy=0)),n>2&&(null==c.fz?c.z+=c.vz*=l:(c.z=c.fz,c.vz=0));return i}function m(){for(var e,i=0,r=t.length;i<r;++i){if((e=t[i]).index=i,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var a=10*(n>2?Math.cbrt(.5+i):n>1?Math.sqrt(.5+i):i),o=i*B,s=i*R;1===n?e.x=a:2===n?(e.x=a*Math.cos(o),e.y=a*Math.sin(o)):(e.x=a*Math.sin(o)*Math.cos(s),e.y=a*Math.cos(o),e.z=a*Math.sin(o)*Math.sin(s))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function b(e){return e.initialize&&e.initialize(t,p,n),e}return null==t&&(t=[]),m(),i={tick:g,restart:function(){return d.restart(f),i},stop:function(){return d.stop(),i},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(b),i):n},nodes:function(e){return arguments.length?(t=e,m(),h.forEach(b),i):t},alpha:function(t){return arguments.length?(r=+t,i):r},alphaMin:function(t){return arguments.length?(a=+t,i):a},alphaDecay:function(t){return arguments.length?(o=+t,i):+o},alphaTarget:function(t){return arguments.length?(s=+t,i):s},velocityDecay:function(t){return arguments.length?(l=1-t,i):1-l},randomSource:function(t){return arguments.length?(p=t,h.forEach(b),i):p},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,b(e)),i):h.get(t)},find:function(){var e,i,r,a,o,s,l=Array.prototype.slice.call(arguments),c=l.shift()||0,h=(n>1?l.shift():null)||0,d=(n>2?l.shift():null)||0,u=l.shift()||1/0,p=0,f=t.length;for(u*=u,p=0;p<f;++p)(a=(e=c-(o=t[p]).x)*e+(i=h-(o.y||0))*i+(r=d-(o.z||0))*r)<u&&(s=o,u=a);return s},on:function(t,e){return arguments.length>1?(u.on(t,e),i):u.on(t)}}}function D(t){return function(){return t}}function P(t){return 1e-6*(t()-.5)}function N(t){return t.index}function O(t,e){var i=t.get(e);if(!i)throw new Error("node not found: "+e);return i}function k(t){var e,i,n,r,a,o,s,l=N,c=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},h=D(30),d=1;function u(n){for(var a=0,l=t.length;a<d;++a)for(var c,h,u,p,f,g=0,m=0,b=0,v=0;g<l;++g)h=(c=t[g]).source,m=(u=c.target).x+u.vx-h.x-h.vx||P(s),r>1&&(b=u.y+u.vy-h.y-h.vy||P(s)),r>2&&(v=u.z+u.vz-h.z-h.vz||P(s)),m*=p=((p=Math.sqrt(m*m+b*b+v*v))-i[g])/p*n*e[g],b*=p,v*=p,u.vx-=m*(f=o[g]),r>1&&(u.vy-=b*f),r>2&&(u.vz-=v*f),h.vx+=m*(f=1-f),r>1&&(h.vy+=b*f),r>2&&(h.vz+=v*f)}function p(){if(n){var r,s,c=n.length,h=t.length,d=new Map(n.map(((t,e)=>[l(t,e,n),t])));for(r=0,a=new Array(c);r<h;++r)(s=t[r]).index=r,"object"!=typeof s.source&&(s.source=O(d,s.source)),"object"!=typeof s.target&&(s.target=O(d,s.target)),a[s.source.index]=(a[s.source.index]||0)+1,a[s.target.index]=(a[s.target.index]||0)+1;for(r=0,o=new Array(h);r<h;++r)s=t[r],o[r]=a[s.source.index]/(a[s.source.index]+a[s.target.index]);e=new Array(h),f(),i=new Array(h),g()}}function f(){if(n)for(var i=0,r=t.length;i<r;++i)e[i]=+c(t[i],i,t)}function g(){if(n)for(var e=0,r=t.length;e<r;++e)i[e]=+h(t[e],e,t)}return null==t&&(t=[]),u.initialize=function(t,...e){n=t,s=e.find((t=>"function"==typeof t))||Math.random,r=e.find((t=>[1,2,3].includes(t)))||2,p()},u.links=function(e){return arguments.length?(t=e,p(),u):t},u.id=function(t){return arguments.length?(l=t,u):l},u.iterations=function(t){return arguments.length?(d=+t,u):d},u.strength=function(t){return arguments.length?(c="function"==typeof t?t:D(+t),f(),u):c},u.distance=function(t){return arguments.length?(h="function"==typeof t?t:D(+t),g(),u):h},u}function z(t,e,i){if(isNaN(e))return t;var n,r,a,o,s,l,c=t._root,h={data:i},d=t._x0,u=t._x1;if(!c)return t._root=h,t;for(;c.length;)if((o=e>=(r=(d+u)/2))?d=r:u=r,n=c,!(c=c[s=+o]))return n[s]=h,t;if(e===(a=+t._x.call(null,c.data)))return h.next=c,n?n[s]=h:t._root=h,t;do{n=n?n[s]=new Array(2):t._root=new Array(2),(o=e>=(r=(d+u)/2))?d=r:u=r}while((s=+o)==(l=+(a>=r)));return n[l]=c,n[s]=h,t}function Q(t,e,i){this.node=t,this.x0=e,this.x1=i}function V(t){return t[0]}function H(t,e){var i=new G(null==e?V:e,NaN,NaN);return null==t?i:i.addAll(t)}function G(t,e,i){this._x=t,this._x0=e,this._x1=i,this._root=void 0}function W(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var j=H.prototype=G.prototype;function X(t,e,i,n){if(isNaN(e)||isNaN(i))return t;var r,a,o,s,l,c,h,d,u,p=t._root,f={data:n},g=t._x0,m=t._y0,b=t._x1,v=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((c=e>=(a=(g+b)/2))?g=a:b=a,(h=i>=(o=(m+v)/2))?m=o:v=o,r=p,!(p=p[d=h<<1|c]))return r[d]=f,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&i===l)return f.next=p,r?r[d]=f:t._root=f,t;do{r=r?r[d]=new Array(4):t._root=new Array(4),(c=e>=(a=(g+b)/2))?g=a:b=a,(h=i>=(o=(m+v)/2))?m=o:v=o}while((d=h<<1|c)==(u=(l>=o)<<1|s>=a));return r[u]=p,r[d]=f,t}function q(t,e,i,n,r){this.node=t,this.x0=e,this.y0=i,this.x1=n,this.y1=r}function Z(t){return t[0]}function Y(t){return t[1]}function J(t,e,i){var n=new K(null==e?Z:e,null==i?Y:i,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function K(t,e,i,n,r,a){this._x=t,this._y=e,this._x0=i,this._y0=n,this._x1=r,this._y1=a,this._root=void 0}function $(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}j.copy=function(){var t,e,i=new G(this._x,this._x0,this._x1),n=this._root;if(!n)return i;if(!n.length)return i._root=W(n),i;for(t=[{source:n,target:i._root=new Array(2)}];n=t.pop();)for(var r=0;r<2;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(2)}):n.target[r]=W(e));return i},j.add=function(t){const e=+this._x.call(null,t);return z(this.cover(e),e,t)},j.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,i=new Float64Array(e);let n=1/0,r=-1/0;for(let a,o=0;o<e;++o)isNaN(a=+this._x.call(null,t[o]))||(i[o]=a,a<n&&(n=a),a>r&&(r=a));if(n>r)return this;this.cover(n).cover(r);for(let n=0;n<e;++n)z(this,i[n],t[n]);return this},j.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,i=this._x1;if(isNaN(e))i=(e=Math.floor(t))+1;else{for(var n,r,a=i-e||1,o=this._root;e>t||t>=i;)switch(r=+(t<e),(n=new Array(2))[r]=o,o=n,a*=2,r){case 0:i=e+a;break;case 1:e=i-a}this._root&&this._root.length&&(this._root=o)}return this._x0=e,this._x1=i,this},j.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},j.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},j.find=function(t,e){var i,n,r,a,o,s=this._x0,l=this._x1,c=[],h=this._root;for(h&&c.push(new Q(h,s,l)),null==e?e=1/0:(s=t-e,l=t+e);a=c.pop();)if(!(!(h=a.node)||(n=a.x0)>l||(r=a.x1)<s))if(h.length){var d=(n+r)/2;c.push(new Q(h[1],d,r),new Q(h[0],n,d)),(o=+(t>=d))&&(a=c[c.length-1],c[c.length-1]=c[c.length-1-o],c[c.length-1-o]=a)}else{var u=Math.abs(t-+this._x.call(null,h.data));u<e&&(e=u,s=t-u,l=t+u,i=h.data)}return i},j.remove=function(t){if(isNaN(a=+this._x.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h=this._root,d=this._x0,u=this._x1;if(!h)return this;if(h.length)for(;;){if((s=a>=(o=(d+u)/2))?d=o:u=o,e=h,!(h=h[l=+s]))return this;if(!h.length)break;e[l+1&1]&&(i=e,c=l)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,n?(r?n.next=r:delete n.next,this):e?(r?e[l]=r:delete e[l],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(i?i[c]=h:this._root=h),this):(this._root=r,this)},j.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},j.root=function(){return this._root},j.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},j.visit=function(t){var e,i,n,r,a=[],o=this._root;for(o&&a.push(new Q(o,this._x0,this._x1));e=a.pop();)if(!t(o=e.node,n=e.x0,r=e.x1)&&o.length){var s=(n+r)/2;(i=o[1])&&a.push(new Q(i,s,r)),(i=o[0])&&a.push(new Q(i,n,s))}return this},j.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new Q(this._root,this._x0,this._x1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.x1,l=(o+s)/2;(a=r[0])&&i.push(new Q(a,o,l)),(a=r[1])&&i.push(new Q(a,l,s))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},j.x=function(t){return arguments.length?(this._x=t,this):this._x};var tt=J.prototype=K.prototype;function et(t,e,i,n,r){if(isNaN(e)||isNaN(i)||isNaN(n))return t;var a,o,s,l,c,h,d,u,p,f,g,m,b=t._root,v={data:r},y=t._x0,_=t._y0,A=t._z0,x=t._x1,E=t._y1,C=t._z1;if(!b)return t._root=v,t;for(;b.length;)if((u=e>=(o=(y+x)/2))?y=o:x=o,(p=i>=(s=(_+E)/2))?_=s:E=s,(f=n>=(l=(A+C)/2))?A=l:C=l,a=b,!(b=b[g=f<<2|p<<1|u]))return a[g]=v,t;if(c=+t._x.call(null,b.data),h=+t._y.call(null,b.data),d=+t._z.call(null,b.data),e===c&&i===h&&n===d)return v.next=b,a?a[g]=v:t._root=v,t;do{a=a?a[g]=new Array(8):t._root=new Array(8),(u=e>=(o=(y+x)/2))?y=o:x=o,(p=i>=(s=(_+E)/2))?_=s:E=s,(f=n>=(l=(A+C)/2))?A=l:C=l}while((g=f<<2|p<<1|u)==(m=(d>=l)<<2|(h>=s)<<1|c>=o));return a[m]=b,a[g]=v,t}function it(t,e,i,n,r,a,o){this.node=t,this.x0=e,this.y0=i,this.z0=n,this.x1=r,this.y1=a,this.z1=o}function nt(t){return t[0]}function rt(t){return t[1]}function at(t){return t[2]}function ot(t,e,i,n){var r=new st(null==e?nt:e,null==i?rt:i,null==n?at:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function st(t,e,i,n,r,a,o,s,l){this._x=t,this._y=e,this._z=i,this._x0=n,this._y0=r,this._z0=a,this._x1=o,this._y1=s,this._z1=l,this._root=void 0}function lt(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}tt.copy=function(){var t,e,i=new K(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return i;if(!n.length)return i._root=$(n),i;for(t=[{source:n,target:i._root=new Array(4)}];n=t.pop();)for(var r=0;r<4;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(4)}):n.target[r]=$(e));return i},tt.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t);return X(this.cover(e,i),e,i,t)},tt.addAll=function(t){var e,i,n,r,a=t.length,o=new Array(a),s=new Array(a),l=1/0,c=1/0,h=-1/0,d=-1/0;for(i=0;i<a;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||(o[i]=n,s[i]=r,n<l&&(l=n),n>h&&(h=n),r<c&&(c=r),r>d&&(d=r));if(l>h||c>d)return this;for(this.cover(l,c).cover(h,d),i=0;i<a;++i)X(this,o[i],s[i],t[i]);return this},tt.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var i=this._x0,n=this._y0,r=this._x1,a=this._y1;if(isNaN(i))r=(i=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{for(var o,s,l=r-i||1,c=this._root;i>t||t>=r||n>e||e>=a;)switch(s=(e<n)<<1|t<i,(o=new Array(4))[s]=c,c=o,l*=2,s){case 0:r=i+l,a=n+l;break;case 1:i=r-l,a=n+l;break;case 2:r=i+l,n=a-l;break;case 3:i=r-l,n=a-l}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=n,this._x1=r,this._y1=a,this},tt.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},tt.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},tt.find=function(t,e,i){var n,r,a,o,s,l,c,h=this._x0,d=this._y0,u=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new q(g,h,d,u,p)),null==i?i=1/0:(h=t-i,d=e-i,u=t+i,p=e+i,i*=i);l=f.pop();)if(!(!(g=l.node)||(r=l.x0)>u||(a=l.y0)>p||(o=l.x1)<h||(s=l.y1)<d))if(g.length){var m=(r+o)/2,b=(a+s)/2;f.push(new q(g[3],m,b,o,s),new q(g[2],r,b,m,s),new q(g[1],m,a,o,b),new q(g[0],r,a,m,b)),(c=(e>=b)<<1|t>=m)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-c],f[f.length-1-c]=l)}else{var v=t-+this._x.call(null,g.data),y=e-+this._y.call(null,g.data),_=v*v+y*y;if(_<i){var A=Math.sqrt(i=_);h=t-A,d=e-A,u=t+A,p=e+A,n=g.data}}return n},tt.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h,d,u,p=this._root,f=this._x0,g=this._y0,m=this._x1,b=this._y1;if(!p)return this;if(p.length)for(;;){if((c=a>=(s=(f+m)/2))?f=s:m=s,(h=o>=(l=(g+b)/2))?g=l:b=l,e=p,!(p=p[d=h<<1|c]))return this;if(!p.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(i=e,u=d)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,n?(r?n.next=r:delete n.next,this):e?(r?e[d]=r:delete e[d],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(i?i[u]=p:this._root=p),this):(this._root=r,this)},tt.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},tt.root=function(){return this._root},tt.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},tt.visit=function(t){var e,i,n,r,a,o,s=[],l=this._root;for(l&&s.push(new q(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,n=e.x0,r=e.y0,a=e.x1,o=e.y1)&&l.length){var c=(n+a)/2,h=(r+o)/2;(i=l[3])&&s.push(new q(i,c,h,a,o)),(i=l[2])&&s.push(new q(i,n,h,c,o)),(i=l[1])&&s.push(new q(i,c,r,a,h)),(i=l[0])&&s.push(new q(i,n,r,c,h))}return this},tt.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new q(this._root,this._x0,this._y0,this._x1,this._y1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.y0,l=e.x1,c=e.y1,h=(o+l)/2,d=(s+c)/2;(a=r[0])&&i.push(new q(a,o,s,h,d)),(a=r[1])&&i.push(new q(a,h,s,l,d)),(a=r[2])&&i.push(new q(a,o,d,h,c)),(a=r[3])&&i.push(new q(a,h,d,l,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},tt.x=function(t){return arguments.length?(this._x=t,this):this._x},tt.y=function(t){return arguments.length?(this._y=t,this):this._y};var ct=ot.prototype=st.prototype;function ht(){var t,e,i,n,r,a,o=D(-30),s=1,l=1/0,c=.81;function h(n){var a,o=t.length,s=(1===e?H(t,T):2===e?J(t,T,U):3===e?ot(t,T,U,F):null).visitAfter(u);for(r=n,a=0;a<o;++a)i=t[a],s.visit(p)}function d(){if(t){var e,i,n=t.length;for(a=new Array(n),e=0;e<n;++e)i=t[e],a[i.index]=+o(i,e,t)}}function u(t){var i,n,r,o,s,l,c=0,h=0,d=t.length;if(d){for(r=o=s=l=0;l<d;++l)(i=t[l])&&(n=Math.abs(i.value))&&(c+=i.value,h+=n,r+=n*(i.x||0),o+=n*(i.y||0),s+=n*(i.z||0));c*=Math.sqrt(4/d),t.x=r/h,e>1&&(t.y=o/h),e>2&&(t.z=s/h)}else{(i=t).x=i.data.x,e>1&&(i.y=i.data.y),e>2&&(i.z=i.data.z);do{c+=a[i.data.index]}while(i=i.next)}t.value=c}function p(t,o,h,d,u){if(!t.value)return!0;var p=[h,d,u][e-1],f=t.x-i.x,g=e>1?t.y-i.y:0,m=e>2?t.z-i.z:0,b=p-o,v=f*f+g*g+m*m;if(b*b/c<v)return v<l&&(0===f&&(v+=(f=P(n))*f),e>1&&0===g&&(v+=(g=P(n))*g),e>2&&0===m&&(v+=(m=P(n))*m),v<s&&(v=Math.sqrt(s*v)),i.vx+=f*t.value*r/v,e>1&&(i.vy+=g*t.value*r/v),e>2&&(i.vz+=m*t.value*r/v)),!0;if(!(t.length||v>=l)){(t.data!==i||t.next)&&(0===f&&(v+=(f=P(n))*f),e>1&&0===g&&(v+=(g=P(n))*g),e>2&&0===m&&(v+=(m=P(n))*m),v<s&&(v=Math.sqrt(s*v)));do{t.data!==i&&(b=a[t.data.index]*r/v,i.vx+=f*b,e>1&&(i.vy+=g*b),e>2&&(i.vz+=m*b))}while(t=t.next)}}return h.initialize=function(i,...r){t=i,n=r.find((t=>"function"==typeof t))||Math.random,e=r.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(o="function"==typeof t?t:D(+t),d(),h):o},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(l=t*t,h):Math.sqrt(l)},h.theta=function(t){return arguments.length?(c=t*t,h):Math.sqrt(c)},h}function dt(t,e,i){var n,r=1;function a(){var a,o,s=n.length,l=0,c=0,h=0;for(a=0;a<s;++a)l+=(o=n[a]).x||0,c+=o.y||0,h+=o.z||0;for(l=(l/s-t)*r,c=(c/s-e)*r,h=(h/s-i)*r,a=0;a<s;++a)o=n[a],l&&(o.x-=l),c&&(o.y-=c),h&&(o.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==i&&(i=0),a.initialize=function(t){n=t},a.x=function(e){return arguments.length?(t=+e,a):t},a.y=function(t){return arguments.length?(e=+t,a):e},a.z=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a}ct.copy=function(){var t,e,i=new st(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return i;if(!n.length)return i._root=lt(n),i;for(t=[{source:n,target:i._root=new Array(8)}];n=t.pop();)for(var r=0;r<8;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(8)}):n.target[r]=lt(e));return i},ct.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t),n=+this._z.call(null,t);return et(this.cover(e,i,n),e,i,n,t)},ct.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,i=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e);let a=1/0,o=1/0,s=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d,u,p,f,g=0;g<e;++g)isNaN(u=+this._x.call(null,d=t[g]))||isNaN(p=+this._y.call(null,d))||isNaN(f=+this._z.call(null,d))||(i[g]=u,n[g]=p,r[g]=f,u<a&&(a=u),u>l&&(l=u),p<o&&(o=p),p>c&&(c=p),f<s&&(s=f),f>h&&(h=f));if(a>l||o>c||s>h)return this;this.cover(a,o,s).cover(l,c,h);for(let a=0;a<e;++a)et(this,i[a],n[a],r[a],t[a]);return this},ct.cover=function(t,e,i){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(i=+i))return this;var n=this._x0,r=this._y0,a=this._z0,o=this._x1,s=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(t))+1,s=(r=Math.floor(e))+1,l=(a=Math.floor(i))+1;else{for(var c,h,d=o-n||1,u=this._root;n>t||t>=o||r>e||e>=s||a>i||i>=l;)switch(h=(i<a)<<2|(e<r)<<1|t<n,(c=new Array(8))[h]=u,u=c,d*=2,h){case 0:o=n+d,s=r+d,l=a+d;break;case 1:n=o-d,s=r+d,l=a+d;break;case 2:o=n+d,r=s-d,l=a+d;break;case 3:n=o-d,r=s-d,l=a+d;break;case 4:o=n+d,s=r+d,a=l-d;break;case 5:n=o-d,s=r+d,a=l-d;break;case 6:o=n+d,r=s-d,a=l-d;break;case 7:n=o-d,r=s-d,a=l-d}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=a,this._x1=o,this._y1=s,this._z1=l,this},ct.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},ct.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},ct.find=function(t,e,i,n){var r,a,o,s,l,c,h,d,u,p=this._x0,f=this._y0,g=this._z0,m=this._x1,b=this._y1,v=this._z1,y=[],_=this._root;for(_&&y.push(new it(_,p,f,g,m,b,v)),null==n?n=1/0:(p=t-n,f=e-n,g=i-n,m=t+n,b=e+n,v=i+n,n*=n);d=y.pop();)if(!(!(_=d.node)||(a=d.x0)>m||(o=d.y0)>b||(s=d.z0)>v||(l=d.x1)<p||(c=d.y1)<f||(h=d.z1)<g))if(_.length){var A=(a+l)/2,x=(o+c)/2,E=(s+h)/2;y.push(new it(_[7],A,x,E,l,c,h),new it(_[6],a,x,E,A,c,h),new it(_[5],A,o,E,l,x,h),new it(_[4],a,o,E,A,x,h),new it(_[3],A,x,s,l,c,E),new it(_[2],a,x,s,A,c,E),new it(_[1],A,o,s,l,x,E),new it(_[0],a,o,s,A,x,E)),(u=(i>=E)<<2|(e>=x)<<1|t>=A)&&(d=y[y.length-1],y[y.length-1]=y[y.length-1-u],y[y.length-1-u]=d)}else{var C=t-+this._x.call(null,_.data),M=e-+this._y.call(null,_.data),w=i-+this._z.call(null,_.data),S=C*C+M*M+w*w;if(S<n){var I=Math.sqrt(n=S);p=t-I,f=e-I,g=i-I,m=t+I,b=e+I,v=i+I,r=_.data}}return r},ct.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,i,n,r,a,o,s,l,c,h,d,u,p,f,g,m=this._root,b=this._x0,v=this._y0,y=this._z0,_=this._x1,A=this._y1,x=this._z1;if(!m)return this;if(m.length)for(;;){if((d=a>=(l=(b+_)/2))?b=l:_=l,(u=o>=(c=(v+A)/2))?v=c:A=c,(p=s>=(h=(y+x)/2))?y=h:x=h,e=m,!(m=m[f=p<<2|u<<1|d]))return this;if(!m.length)break;(e[f+1&7]||e[f+2&7]||e[f+3&7]||e[f+4&7]||e[f+5&7]||e[f+6&7]||e[f+7&7])&&(i=e,g=f)}for(;m.data!==t;)if(n=m,!(m=m.next))return this;return(r=m.next)&&delete m.next,n?(r?n.next=r:delete n.next,this):e?(r?e[f]=r:delete e[f],(m=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&m===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!m.length&&(i?i[g]=m:this._root=m),this):(this._root=r,this)},ct.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},ct.root=function(){return this._root},ct.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},ct.visit=function(t){var e,i,n,r,a,o,s,l,c=[],h=this._root;for(h&&c.push(new it(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(h=e.node,n=e.x0,r=e.y0,a=e.z0,o=e.x1,s=e.y1,l=e.z1)&&h.length){var d=(n+o)/2,u=(r+s)/2,p=(a+l)/2;(i=h[7])&&c.push(new it(i,d,u,p,o,s,l)),(i=h[6])&&c.push(new it(i,n,u,p,d,s,l)),(i=h[5])&&c.push(new it(i,d,r,p,o,u,l)),(i=h[4])&&c.push(new it(i,n,r,p,d,u,l)),(i=h[3])&&c.push(new it(i,d,u,a,o,s,p)),(i=h[2])&&c.push(new it(i,n,u,a,d,s,p)),(i=h[1])&&c.push(new it(i,d,r,a,o,u,p)),(i=h[0])&&c.push(new it(i,n,r,a,d,u,p))}return this},ct.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new it(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=i.pop();){var r=e.node;if(r.length){var a,o=e.x0,s=e.y0,l=e.z0,c=e.x1,h=e.y1,d=e.z1,u=(o+c)/2,p=(s+h)/2,f=(l+d)/2;(a=r[0])&&i.push(new it(a,o,s,l,u,p,f)),(a=r[1])&&i.push(new it(a,u,s,l,c,p,f)),(a=r[2])&&i.push(new it(a,o,p,l,u,h,f)),(a=r[3])&&i.push(new it(a,u,p,l,c,h,f)),(a=r[4])&&i.push(new it(a,o,s,f,u,p,d)),(a=r[5])&&i.push(new it(a,u,s,f,c,p,d)),(a=r[6])&&i.push(new it(a,o,p,f,u,h,d)),(a=r[7])&&i.push(new it(a,u,p,f,c,h,d))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},ct.x=function(t){return arguments.length?(this._x=t,this):this._x},ct.y=function(t){return arguments.length?(this._y=t,this):this._y},ct.z=function(t){return arguments.length?(this._z=t,this):this._z};var ut=i(5261),pt=i(7348);const ft=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},gt="object"==typeof global&&global&&global.Object===Object&&global;var mt="object"==typeof self&&self&&self.Object===Object&&self;const bt=gt||mt||Function("return this")(),vt=function(){return bt.Date.now()};var yt=/\s/;var _t=/^\s+/;const At=function(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&yt.test(t.charAt(e)););return e}(t)+1).replace(_t,""):t},xt=bt.Symbol;var Et=Object.prototype,Ct=Et.hasOwnProperty,Mt=Et.toString,wt=xt?xt.toStringTag:void 0;var St=Object.prototype.toString;var It=xt?xt.toStringTag:void 0;const Tt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":It&&It in Object(t)?function(t){var e=Ct.call(t,wt),i=t[wt];try{t[wt]=void 0;var n=!0}catch(t){}var r=Mt.call(t);return n&&(e?t[wt]=i:delete t[wt]),r}(t):function(t){return St.call(t)}(t)};var Ut=/^[-+]0x[0-9a-f]+$/i,Ft=/^0b[01]+$/i,Bt=/^0o[0-7]+$/i,Rt=parseInt;const Lt=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return null!=t&&"object"==typeof t}(t)&&"[object Symbol]"==Tt(t)}(t))return NaN;if(ft(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ft(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=At(t);var i=Ft.test(t);return i||Bt.test(t)?Rt(t.slice(2),i?2:8):Ut.test(t)?NaN:+t};var Dt=Math.max,Pt=Math.min;function Nt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(void 0,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(n.key))?r:String(r)),n)}var r}function Ot(t,e,i){return e&&Nt(t.prototype,e),i&&Nt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var zt=Ot((function t(e,i){var n=i.default,r=void 0===n?null:n,a=i.triggerUpdate,o=void 0===a||a,s=i.onChange,l=void 0===s?function(t,e){}:s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l})),Qt=i(4468);function Vt(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i>r||void 0===i&&r>=r)&&(i=r)}return i}function Ht(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i<e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i<r||void 0===i&&r>=r)&&(i=r)}return i}function Gt(t,e){if(t){if("string"==typeof t)return Wt(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Wt(t,e):void 0}}function Wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function jt(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var Xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=(e instanceof Array?e.length?e:[void 0]:[e]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),a=t.reduce((function(t,e){var n=t,a=e;return r.forEach((function(t,e){var o,s=t.keyAccessor;if(t.isProp){var l=a,c=l[s],h=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(l,[s].map(jt));o=c,a=h}else o=s(a,e);e+1<r.length?(n.hasOwnProperty(o)||(n[o]={}),n=n[o]):i?(n.hasOwnProperty(o)||(n[o]=[]),n[o].push(a)):n[o]=a})),t}),{});i instanceof Function&&function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;n===r.length?Object.keys(e).forEach((function(t){return e[t]=i(e[t])})):Object.values(e).forEach((function(e){return t(e,n+1)}))}(a);var o=a;return n&&(o=[],function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];i.length===r.length?o.push({keys:i,vals:e}):Object.entries(e).forEach((function(e){var n,r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||Gt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e,2),a=r[0],o=r[1];return t(o,[].concat(function(t){if(Array.isArray(t))return Wt(t)}(n=i)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Gt(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[a]))}))}(a),e instanceof Array&&0===e.length&&1===o.length&&(o[0].keys=[])),o};function qt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Zt(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Yt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||Kt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jt(t){return function(t){if(Array.isArray(t))return $t(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Kt(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kt(t,e){if(t){if("string"==typeof t)return $t(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?$t(t,e):void 0}}function $t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var te=["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"];function ee(t,e,i,n,r){var a=r.createObj,o=void 0===a?function(t){return{}}:a,s=r.updateObj,l=void 0===s?function(t,e){}:s,c=r.exitObj,h=void 0===c?function(t){}:c,d=r.objBindAttr,u=void 0===d?"__obj":d,p=r.dataBindAttr,f=void 0===p?"__data":p,g=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(r,te),m=function(t,e,i){var n=i.objBindAttr,r=void 0===n?"__obj":n,a=i.dataBindAttr,o=void 0===a?"__data":a,s=i.idAccessor,l=i.purge,c=void 0!==l&&l,h=function(t){return t.hasOwnProperty(o)},d=e.filter((function(t){return!h(t)})),u=e.filter(h).map((function(t){return t[o]})),p=c?{enter:t,exit:u,update:[]}:function(t,e,i){var n={enter:[],update:[],exit:[]};if(i){var r=Xt(t,i,!1),a=Xt(e,i,!1),o=Object.assign({},r,a);Object.entries(o).forEach((function(t){var e=Yt(t,2),i=e[0],o=e[1],s=r.hasOwnProperty(i)?a.hasOwnProperty(i)?"update":"exit":"enter";n[s].push("update"===s?[r[i],a[i]]:o)}))}else{var s=new Set(t),l=new Set(e);new Set([].concat(Jt(s),Jt(l))).forEach((function(t){var e=s.has(t)?l.has(t)?"update":"exit":"enter";n[e].push("update"===e?[t,t]:t)}))}return n}(u,t,s);return p.update=p.update.map((function(t){var e=Yt(t,2),i=e[0],n=e[1];return i!==n&&(n[r]=i[r],n[r][o]=n),n})),p.exit=p.exit.concat(d.map((function(t){return Zt({},r,t)}))),p}(t,e,function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?qt(Object(i),!0).forEach((function(e){Zt(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):qt(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({objBindAttr:u,dataBindAttr:f},g)),b=m.enter,v=m.update;m.exit.forEach((function(t){var e=t[u];delete t[u],h(e),n(e)}));var y=function(t){var e=[];return t.forEach((function(t){var i=o(t);i&&(i[f]=t,t[u]=i,e.push(i))})),e}(b);!function(t){t.forEach((function(t){var e=t[u];e&&(e[f]=t,l(e,t))}))}([].concat(Jt(b),Jt(v))),y.forEach(i)}class ie extends Map{constructor(t,e=re){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,i]of t)this.set(e,i)}get(t){return super.get(ne(this,t))}has(t){return super.has(ne(this,t))}set(t,e){return super.set(function({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):(t.set(n,i),i)}(this,t),e)}delete(t){return super.delete(function({_intern:t,_key:e},i){const n=e(i);return t.has(n)&&(i=t.get(n),t.delete(n)),i}(this,t))}}function ne({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):i}function re(t){return null!==t&&"object"==typeof t?t.valueOf():t}function ae(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}Set;const oe=Symbol("implicit"),se=function(t){for(var e=new Array(12),i=0;i<12;)e[i]="#"+t.slice(6*i,6*++i);return e}("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}var ce=/^\s+/,he=/\s+$/;function de(t,e){if(e=e||{},(t=t||"")instanceof de)return t;if(!(this instanceof de))return new de(t,e);var i=function(t){var e,i,n,r={r:0,g:0,b:0},a=1,o=null,s=null,l=null,c=!1,h=!1;return"string"==typeof t&&(t=function(t){t=t.replace(ce,"").replace(he,"").toLowerCase();var e,i=!1;if(Ie[t])t=Ie[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(e=Qe.rgb.exec(t))?{r:e[1],g:e[2],b:e[3]}:(e=Qe.rgba.exec(t))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Qe.hsl.exec(t))?{h:e[1],s:e[2],l:e[3]}:(e=Qe.hsla.exec(t))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Qe.hsv.exec(t))?{h:e[1],s:e[2],v:e[3]}:(e=Qe.hsva.exec(t))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Qe.hex8.exec(t))?{r:Re(e[1]),g:Re(e[2]),b:Re(e[3]),a:Ne(e[4]),format:i?"name":"hex8"}:(e=Qe.hex6.exec(t))?{r:Re(e[1]),g:Re(e[2]),b:Re(e[3]),format:i?"name":"hex"}:(e=Qe.hex4.exec(t))?{r:Re(e[1]+""+e[1]),g:Re(e[2]+""+e[2]),b:Re(e[3]+""+e[3]),a:Ne(e[4]+""+e[4]),format:i?"name":"hex8"}:!!(e=Qe.hex3.exec(t))&&{r:Re(e[1]+""+e[1]),g:Re(e[2]+""+e[2]),b:Re(e[3]+""+e[3]),format:i?"name":"hex"}}(t)),"object"==le(t)&&(Ve(t.r)&&Ve(t.g)&&Ve(t.b)?(e=t.r,i=t.g,n=t.b,r={r:255*Fe(e,255),g:255*Fe(i,255),b:255*Fe(n,255)},c=!0,h="%"===String(t.r).substr(-1)?"prgb":"rgb"):Ve(t.h)&&Ve(t.s)&&Ve(t.v)?(o=De(t.s),s=De(t.v),r=function(t,e,i){t=6*Fe(t,360),e=Fe(e,100),i=Fe(i,100);var n=Math.floor(t),r=t-n,a=i*(1-e),o=i*(1-r*e),s=i*(1-(1-r)*e),l=n%6;return{r:255*[i,o,a,a,s,i][l],g:255*[s,i,i,o,a,a][l],b:255*[a,a,s,i,i,o][l]}}(t.h,o,s),c=!0,h="hsv"):Ve(t.h)&&Ve(t.s)&&Ve(t.l)&&(o=De(t.s),l=De(t.l),r=function(t,e,i){var n,r,a;function o(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=Fe(t,360),e=Fe(e,100),i=Fe(i,100),0===e)n=r=a=i;else{var s=i<.5?i*(1+e):i+e-i*e,l=2*i-s;n=o(l,s,t+1/3),r=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*n,g:255*r,b:255*a}}(t.h,o,l),c=!0,h="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=Ue(a),{ok:c,format:t.format||h,r:Math.min(255,Math.max(r.r,0)),g:Math.min(255,Math.max(r.g,0)),b:Math.min(255,Math.max(r.b,0)),a}}(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||i.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}function ue(t,e,i){t=Fe(t,255),e=Fe(e,255),i=Fe(i,255);var n,r,a=Math.max(t,e,i),o=Math.min(t,e,i),s=(a+o)/2;if(a==o)n=r=0;else{var l=a-o;switch(r=s>.5?l/(2-a-o):l/(a+o),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,l:s}}function pe(t,e,i){t=Fe(t,255),e=Fe(e,255),i=Fe(i,255);var n,r,a=Math.max(t,e,i),o=Math.min(t,e,i),s=a,l=a-o;if(r=0===a?0:l/a,a==o)n=0;else{switch(a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,v:s}}function fe(t,e,i,n){var r=[Le(Math.round(t).toString(16)),Le(Math.round(e).toString(16)),Le(Math.round(i).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function ge(t,e,i,n){return[Le(Pe(n)),Le(Math.round(t).toString(16)),Le(Math.round(e).toString(16)),Le(Math.round(i).toString(16))].join("")}function me(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.s-=e/100,i.s=Be(i.s),de(i)}function be(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.s+=e/100,i.s=Be(i.s),de(i)}function ve(t){return de(t).desaturate(100)}function ye(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.l+=e/100,i.l=Be(i.l),de(i)}function _e(t,e){e=0===e?0:e||10;var i=de(t).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(-e/100*255))),i.g=Math.max(0,Math.min(255,i.g-Math.round(-e/100*255))),i.b=Math.max(0,Math.min(255,i.b-Math.round(-e/100*255))),de(i)}function Ae(t,e){e=0===e?0:e||10;var i=de(t).toHsl();return i.l-=e/100,i.l=Be(i.l),de(i)}function xe(t,e){var i=de(t).toHsl(),n=(i.h+e)%360;return i.h=n<0?360+n:n,de(i)}function Ee(t){var e=de(t).toHsl();return e.h=(e.h+180)%360,de(e)}function Ce(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var i=de(t).toHsl(),n=[de(t)],r=360/e,a=1;a<e;a++)n.push(de({h:(i.h+a*r)%360,s:i.s,l:i.l}));return n}function Me(t){var e=de(t).toHsl(),i=e.h;return[de(t),de({h:(i+72)%360,s:e.s,l:e.l}),de({h:(i+216)%360,s:e.s,l:e.l})]}function we(t,e,i){e=e||6,i=i||30;var n=de(t).toHsl(),r=360/i,a=[de(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,a.push(de(n));return a}function Se(t,e){e=e||6;for(var i=de(t).toHsv(),n=i.h,r=i.s,a=i.v,o=[],s=1/e;e--;)o.push(de({h:n,s:r,v:a})),a=(a+s)%1;return o}de.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,n=this.toRgb();return t=n.r/255,e=n.g/255,i=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=Ue(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=pe(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=pe(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=ue(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ue(this._r,this._g,this._b),e=Math.round(360*t.h),i=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+n+"%)":"hsla("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return fe(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,n,r){var a=[Le(Math.round(t).toString(16)),Le(Math.round(e).toString(16)),Le(Math.round(i).toString(16)),Le(Pe(n))];return r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*Fe(this._r,255))+"%",g:Math.round(100*Fe(this._g,255))+"%",b:Math.round(100*Fe(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*Fe(this._r,255))+"%, "+Math.round(100*Fe(this._g,255))+"%, "+Math.round(100*Fe(this._b,255))+"%)":"rgba("+Math.round(100*Fe(this._r,255))+"%, "+Math.round(100*Fe(this._g,255))+"%, "+Math.round(100*Fe(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Te[fe(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+ge(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var r=de(t);i="#"+ge(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return de(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(ye,arguments)},brighten:function(){return this._applyModification(_e,arguments)},darken:function(){return this._applyModification(Ae,arguments)},desaturate:function(){return this._applyModification(me,arguments)},saturate:function(){return this._applyModification(be,arguments)},greyscale:function(){return this._applyModification(ve,arguments)},spin:function(){return this._applyModification(xe,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(we,arguments)},complement:function(){return this._applyCombination(Ee,arguments)},monochromatic:function(){return this._applyCombination(Se,arguments)},splitcomplement:function(){return this._applyCombination(Me,arguments)},triad:function(){return this._applyCombination(Ce,[3])},tetrad:function(){return this._applyCombination(Ce,[4])}},de.fromRatio=function(t,e){if("object"==le(t)){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]="a"===n?t[n]:De(t[n]));t=i}return de(t,e)},de.equals=function(t,e){return!(!t||!e)&&de(t).toRgbString()==de(e).toRgbString()},de.random=function(){return de.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},de.mix=function(t,e,i){i=0===i?0:i||50;var n=de(t).toRgb(),r=de(e).toRgb(),a=i/100;return de({r:(r.r-n.r)*a+n.r,g:(r.g-n.g)*a+n.g,b:(r.b-n.b)*a+n.b,a:(r.a-n.a)*a+n.a})},de.readability=function(t,e){var i=de(t),n=de(e);return(Math.max(i.getLuminance(),n.getLuminance())+.05)/(Math.min(i.getLuminance(),n.getLuminance())+.05)},de.isReadable=function(t,e,i){var n,r,a,o,s,l=de.readability(t,e);switch(r=!1,"AA"!==(o=((a=(a=i)||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==o&&(o="AA"),"small"!==(s=(a.size||"small").toLowerCase())&&"large"!==s&&(s="small"),(n={level:o,size:s}).level+n.size){case"AAsmall":case"AAAlarge":r=l>=4.5;break;case"AAlarge":r=l>=3;break;case"AAAsmall":r=l>=7}return r},de.mostReadable=function(t,e,i){var n,r,a,o,s=null,l=0;r=(i=i||{}).includeFallbackColors,a=i.level,o=i.size;for(var c=0;c<e.length;c++)(n=de.readability(t,e[c]))>l&&(l=n,s=de(e[c]));return de.isReadable(t,s,{level:a,size:o})||!r?s:(i.includeFallbackColors=!1,de.mostReadable(t,["#fff","#000"],i))};var Ie=de.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Te=de.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(Ie);function Ue(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Fe(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Be(t){return Math.min(1,Math.max(0,t))}function Re(t){return parseInt(t,16)}function Le(t){return 1==t.length?"0"+t:""+t}function De(t){return t<=1&&(t=100*t+"%"),t}function Pe(t){return Math.round(255*parseFloat(t)).toString(16)}function Ne(t){return Re(t)/255}var Oe,ke,ze,Qe=(ke="[\\s|\\(]+("+(Oe="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Oe+")[,|\\s]+("+Oe+")\\s*\\)?",ze="[\\s|\\(]+("+Oe+")[,|\\s]+("+Oe+")[,|\\s]+("+Oe+")[,|\\s]+("+Oe+")\\s*\\)?",{CSS_UNIT:new RegExp(Oe),rgb:new RegExp("rgb"+ke),rgba:new RegExp("rgba"+ze),hsl:new RegExp("hsl"+ke),hsla:new RegExp("hsla"+ze),hsv:new RegExp("hsv"+ke),hsva:new RegExp("hsva"+ze),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function Ve(t){return!!Qe.CSS_UNIT.exec(t)}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(He=function(){return!!t})()}function Ge(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function We(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ge(Object(i),!0).forEach((function(e){qe(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ge(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function je(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}function Xe(t){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xe(t)}function qe(t,e,i){return(e=je(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ze(t){return Ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ze(t)}function Ye(t,e){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ye(t,e)}function Je(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ke(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||ti(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $e(t){return function(t){if(Array.isArray(t))return ei(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ti(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ti(t,e){if(t){if("string"==typeof t)return ei(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ei(t,e):void 0}}function ei(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var ii=function t(e){e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())},ni=function t(e){e.geometry&&e.geometry.dispose(),e.material&&ii(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(t)},ri=function(t){for(;t.children.length;){var e=t.children[0];t.remove(e),ni(e)}},ai=["objFilter"];function oi(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.objFilter,r=void 0===n?function(){return!0}:n,a=function(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(i,ai);return ee(t,e.children.filter(r),(function(t){return e.add(t)}),(function(t){e.remove(t),ri(t)}),We({objBindAttr:"__threeObj"},a))}var si=function(t){return isNaN(t)?parseInt(de(t).toHex(),16):t},li=function(t){return isNaN(t)?de(t).getAlpha():1},ci=function t(){var e=new ie,i=[],n=[],r=oe;function a(t){let a=e.get(t);if(void 0===a){if(r!==oe)return r;e.set(t,a=i.push(t)-1)}return n[a%n.length]}return a.domain=function(t){if(!arguments.length)return i.slice();i=[],e=new ie;for(const n of t)e.has(n)||e.set(n,i.push(n)-1);return a},a.range=function(t){return arguments.length?(n=Array.from(t),a):n.slice()},a.unknown=function(t){return arguments.length?(r=t,a):r},a.copy=function(){return t(i,n).unknown(r)},ae.apply(a,arguments),a}(se);function hi(t,e,i){e&&"string"==typeof i&&t.filter((function(t){return!t[i]})).forEach((function(t){t[i]=ci(e(t))}))}var di,ui,pi,fi,gi,mi,bi,vi,yi,_i,Ai,xi,Ei,Ci,Mi=window.THREE?window.THREE:{Group:n.YJl,Mesh:n.eaF,MeshLambertMaterial:n.G_z,Color:n.Q1f,BufferGeometry:n.LoY,BufferAttribute:n.THS,Matrix4:n.kn4,Vector3:n.Pq0,SphereGeometry:n.Gu$,CylinderGeometry:n.Ho_,TubeGeometry:n.j6,ConeGeometry:n.qFE,Line:n.N1A,LineBasicMaterial:n.mrM,QuadraticBezierCurve3:n.CV9,CubicBezierCurve3:n.s0K,Box3:n.NRn},wi={graph:ut,forcelayout:pt},Si=(new Mi.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Ii=(new Mi.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix",Ti=(di={props:{jsonUrl:{onChange:function(t,e){var i=this;t&&!e.fetchingJson&&(e.fetchingJson=!0,e.onLoading(),fetch(t).then((function(t){return t.json()})).then((function(t){e.fetchingJson=!1,e.onFinishLoading(t),i.graphData(t)})))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,e){e.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,e){var i=e.d3ForceLayout.force("charge");function n(t,e){t.forEach((function(t){delete t[e],delete t["v".concat(e)]}))}i&&i.strength(t>2?-60:-30),t<3&&n(e.graphData.nodes,"z"),t<2&&n(e.graphData.nodes,"y")}},dagMode:{onChange:function(t,e){!t&&"d3"===e.forceEngine&&(e.graphData.nodes||[]).forEach((function(t){return t.fx=t.fy=t.fz=void 0}))}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,e,i){return void 0===i?t.d3ForceLayout.force(e):(t.d3ForceLayout.force(e,i),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var e,i,n,r,a="ngraph"!==t.forceEngine;return t.engineRunning&&function(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||a&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[a?"tick":"step"](),t.onEngineTick());var e=(0,Qt.default)(t.nodeThreeObjectExtend);t.graphData.nodes.forEach((function(i){var n=i.__threeObj;if(n){var r=a?i:t.layout.getNodePosition(i[t.nodeId]),o=e(i);t.nodePositionUpdate&&t.nodePositionUpdate(o?n.children[0]:n,{x:r.x,y:r.y,z:r.z},i)&&!o||(n.position.x=r.x,n.position.y=r.y||0,n.position.z=r.z||0)}}));var i=(0,Qt.default)(t.linkWidth),n=(0,Qt.default)(t.linkCurvature),r=(0,Qt.default)(t.linkCurveRotation),o=(0,Qt.default)(t.linkThreeObjectExtend);t.graphData.links.forEach((function(e){var s=e.__lineObj;if(s){var l=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),c=l[a?"source":"from"],h=l[a?"target":"to"];if(c&&h&&c.hasOwnProperty("x")&&h.hasOwnProperty("x")){!function(e){var i=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),o=i[a?"source":"from"],s=i[a?"target":"to"];if(o&&s&&o.hasOwnProperty("x")&&s.hasOwnProperty("x")){var l=n(e);if(l){var c,h=new Mi.Vector3(o.x,o.y||0,o.z||0),d=new Mi.Vector3(s.x,s.y||0,s.z||0),u=h.distanceTo(d),p=r(e);if(u>0){var f=s.x-o.x,g=s.y-o.y||0,m=(new Mi.Vector3).subVectors(d,h),b=m.clone().multiplyScalar(l).cross(0!==f||0!==g?new Mi.Vector3(0,0,1):new Mi.Vector3(0,1,0)).applyAxisAngle(m.normalize(),p).add((new Mi.Vector3).addVectors(h,d).divideScalar(2));c=new Mi.QuadraticBezierCurve3(h,b,d)}else{var v=70*l,y=-p,_=y+Math.PI/2;c=new Mi.CubicBezierCurve3(h,new Mi.Vector3(v*Math.cos(_),v*Math.sin(_),0).add(h),new Mi.Vector3(v*Math.cos(y),v*Math.sin(y),0).add(h),d)}e.__curve=c}else e.__curve=null}}(e);var d=o(e);if(!t.linkPositionUpdate||!t.linkPositionUpdate(d?s.children[1]:s,{start:{x:c.x,y:c.y,z:c.z},end:{x:h.x,y:h.y,z:h.z}},e)||d){var u=e.__curve,p=s.children.length?s.children[0]:s;if("Line"===p.type){if(u)p.geometry.setFromPoints(u.getPoints(30));else{var f=p.geometry.getAttribute("position");f&&f.array&&6===f.array.length||p.geometry[Si]("position",f=new Mi.BufferAttribute(new Float32Array(6),3)),f.array[0]=c.x,f.array[1]=c.y||0,f.array[2]=c.z||0,f.array[3]=h.x,f.array[4]=h.y||0,f.array[5]=h.z||0,f.needsUpdate=!0}p.geometry.computeBoundingSphere()}else if("Mesh"===p.type)if(u){p.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(p.position.set(0,0,0),p.rotation.set(0,0,0),p.scale.set(1,1,1));var g=Math.ceil(10*i(e))/10/2,m=new Mi.TubeGeometry(u,30,g,t.linkResolution,!1);p.geometry.dispose(),p.geometry=m}else{if(!p.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var b=Math.ceil(10*i(e))/10/2,v=new Mi.CylinderGeometry(b,b,1,t.linkResolution,1,!1);v[Ii]((new Mi.Matrix4).makeTranslation(0,.5,0)),v[Ii]((new Mi.Matrix4).makeRotationX(Math.PI/2)),p.geometry.dispose(),p.geometry=v}var y=new Mi.Vector3(c.x,c.y||0,c.z||0),_=new Mi.Vector3(h.x,h.y||0,h.z||0),A=y.distanceTo(_);p.position.x=y.x,p.position.y=y.y,p.position.z=y.z,p.scale.z=A,p.parent.localToWorld(_),p.lookAt(_)}}}}}))}(),e=(0,Qt.default)(t.linkDirectionalArrowRelPos),i=(0,Qt.default)(t.linkDirectionalArrowLength),n=(0,Qt.default)(t.nodeVal),t.graphData.links.forEach((function(r){var o=r.__arrowObj;if(o){var s=a?r:t.layout.getLinkPosition(t.layout.graph.getLink(r.source,r.target).id),l=s[a?"source":"from"],c=s[a?"target":"to"];if(l&&c&&l.hasOwnProperty("x")&&c.hasOwnProperty("x")){var h=Math.cbrt(Math.max(0,n(l)||1))*t.nodeRelSize,d=Math.cbrt(Math.max(0,n(c)||1))*t.nodeRelSize,u=i(r),p=e(r),f=r.__curve?function(t){return r.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",l,c,t),y:e("y",l,c,t),z:e("z",l,c,t)}},g=r.__curve?r.__curve.getLength():Math.sqrt(["x","y","z"].map((function(t){return Math.pow((c[t]||0)-(l[t]||0),2)})).reduce((function(t,e){return t+e}),0)),m=h+u+(g-h-d-u)*p,b=f(m/g),v=f((m-u)/g);["x","y","z"].forEach((function(t){return o.position[t]=v[t]}));var y=function(t,e,i){if(He())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(t.bind.apply(t,n));return i&&Ye(r,i.prototype),r}(Mi.Vector3,$e(["x","y","z"].map((function(t){return b[t]}))));o.parent.localToWorld(y),o.lookAt(y)}}})),r=(0,Qt.default)(t.linkDirectionalParticleSpeed),t.graphData.links.forEach((function(e){var i=e.__photonsObj&&e.__photonsObj.children,n=e.__singleHopPhotonsObj&&e.__singleHopPhotonsObj.children;if(n&&n.length||i&&i.length){var o=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),s=o[a?"source":"from"],l=o[a?"target":"to"];if(s&&l&&s.hasOwnProperty("x")&&l.hasOwnProperty("x")){var c=r(e),h=e.__curve?function(t){return e.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",s,l,t),y:e("y",s,l,t),z:e("z",s,l,t)}};[].concat($e(i||[]),$e(n||[])).forEach((function(t,e){var n="singleHopPhotons"===t.parent.__linkThreeObjType;if(t.hasOwnProperty("__progressRatio")||(t.__progressRatio=n?0:e/i.length),t.__progressRatio+=c,t.__progressRatio>=1){if(n)return t.parent.remove(t),void ri(t);t.__progressRatio=t.__progressRatio%1}var r=t.__progressRatio,a=h(r);["x","y","z"].forEach((function(e){return t.position[e]=a[e]}))}))}}})),this},emitParticle:function(t,e){if(e&&t.graphData.links.includes(e)){if(!e.__singleHopPhotonsObj){var i=new Mi.Group;i.__linkThreeObjType="singleHopPhotons",e.__singleHopPhotonsObj=i,t.graphScene.add(i)}var n=(0,Qt.default)(t.linkDirectionalParticleWidth),r=Math.ceil(10*n(e))/10/2,a=t.linkDirectionalParticleResolution,o=new Mi.SphereGeometry(r,a,a),s=(0,Qt.default)(t.linkColor),l=(0,Qt.default)(t.linkDirectionalParticleColor)(e)||s(e)||"#f0f0f0",c=new Mi.Color(si(l)),h=3*t.linkOpacity,d=new Mi.MeshLambertMaterial({color:c,transparent:!0,opacity:h});e.__singleHopPhotonsObj.add(new Mi.Mesh(o,d))}return this},getGraphBbox:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(!t.initialised)return null;var i=function t(i){var n=[];if(i.geometry){i.geometry.computeBoundingBox();var r=new Mi.Box3;r.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),n.push(r)}return n.concat.apply(n,$e((i.children||[]).filter((function(t){return!t.hasOwnProperty("__graphObjType")||"node"===t.__graphObjType&&e(t.__data)})).map(t)))}(t.graphScene);return i.length?Object.assign.apply(Object,$e(["x","y","z"].map((function(t){return qe({},t,[Vt(i,(function(e){return e.min[t]})),Ht(i,(function(e){return e.max[t]}))])})))):null}},stateInit:function(){return{d3ForceLayout:L().force("link",k()).force("charge",ht()).force("center",dt()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,e){e.graphScene=t},update:function(t,e){var i=function(t){return t.some((function(t){return e.hasOwnProperty(t)}))};if(t.engineRunning=!1,t.onUpdate(),null!==t.nodeAutoColorBy&&i(["nodeAutoColorBy","graphData","nodeColor"])&&hi(t.graphData.nodes,(0,Qt.default)(t.nodeAutoColorBy),t.nodeColor),null!==t.linkAutoColorBy&&i(["linkAutoColorBy","graphData","linkColor"])&&hi(t.graphData.links,(0,Qt.default)(t.linkAutoColorBy),t.linkColor),t._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var n=(0,Qt.default)(t.nodeThreeObject),r=(0,Qt.default)(t.nodeThreeObjectExtend),a=(0,Qt.default)(t.nodeVal),o=(0,Qt.default)(t.nodeColor),s=(0,Qt.default)(t.nodeVisibility),l={},c={};oi(t.graphData.nodes.filter(s),t.graphScene,{purge:t._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]),objFilter:function(t){return"node"===t.__graphObjType},createObj:function(e){var i,a=n(e),o=r(e);return a&&t.nodeThreeObject===a&&(a=a.clone()),a&&!o?i=a:((i=new Mi.Mesh).__graphDefaultObj=!0,a&&o&&i.add(a)),i.__graphObjType="node",i},updateObj:function(e,i){if(e.__graphDefaultObj){var n=a(i)||1,r=Math.cbrt(n)*t.nodeRelSize,s=t.nodeResolution;e.geometry.type.match(/^Sphere(Buffer)?Geometry$/)&&e.geometry.parameters.radius===r&&e.geometry.parameters.widthSegments===s||(l.hasOwnProperty(n)||(l[n]=new Mi.SphereGeometry(r,s,s)),e.geometry.dispose(),e.geometry=l[n]);var h=o(i),d=new Mi.Color(si(h||"#ffffaa")),u=t.nodeOpacity*li(h);"MeshLambertMaterial"===e.material.type&&e.material.color.equals(d)&&e.material.opacity===u||(c.hasOwnProperty(h)||(c[h]=new Mi.MeshLambertMaterial({color:d,transparent:!0,opacity:u})),e.material.dispose(),e.material=c[h])}}})}if(t._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var h=(0,Qt.default)(t.linkThreeObject),d=(0,Qt.default)(t.linkThreeObjectExtend),u=(0,Qt.default)(t.linkMaterial),p=(0,Qt.default)(t.linkVisibility),f=(0,Qt.default)(t.linkColor),g=(0,Qt.default)(t.linkWidth),m={},b={},v={},y=t.graphData.links.filter(p);if(oi(y,t.graphScene,{objBindAttr:"__lineObj",purge:t._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]),objFilter:function(t){return"link"===t.__graphObjType},exitObj:function(t){var e=t.__data&&t.__data.__singleHopPhotonsObj;e&&(e.parent.remove(e),ri(e),delete t.__data.__singleHopPhotonsObj)},createObj:function(e){var i,n,r=h(e),a=d(e);if(r&&t.linkThreeObject===r&&(r=r.clone()),!r||a)if(g(e))i=new Mi.Mesh;else{var o=new Mi.BufferGeometry;o[Si]("position",new Mi.BufferAttribute(new Float32Array(6),3)),i=new Mi.Line(o)}return r?a?((n=new Mi.Group).__graphDefaultObj=!0,n.add(i),n.add(r)):n=r:(n=i).__graphDefaultObj=!0,n.renderOrder=10,n.__graphObjType="link",n},updateObj:function(e,i){if(e.__graphDefaultObj){var n=e.children.length?e.children[0]:e,r=Math.ceil(10*g(i))/10,a=!!r;if(a){var o=r/2,s=t.linkResolution;if(!n.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||n.geometry.parameters.radiusTop!==o||n.geometry.parameters.radialSegments!==s){if(!m.hasOwnProperty(r)){var l=new Mi.CylinderGeometry(o,o,1,s,1,!1);l[Ii]((new Mi.Matrix4).makeTranslation(0,.5,0)),l[Ii]((new Mi.Matrix4).makeRotationX(Math.PI/2)),m[r]=l}n.geometry.dispose(),n.geometry=m[r]}}var c=u(i);if(c)n.material=c;else{var h=f(i),d=new Mi.Color(si(h||"#f0f0f0")),p=t.linkOpacity*li(h),y=a?"MeshLambertMaterial":"LineBasicMaterial";if(n.material.type!==y||!n.material.color.equals(d)||n.material.opacity!==p){var _=a?b:v;_.hasOwnProperty(h)||(_[h]=new Mi[y]({color:d,transparent:p<1,opacity:p,depthWrite:p>=1})),n.material.dispose(),n.material=_[h]}}}}}),t.linkDirectionalArrowLength||e.hasOwnProperty("linkDirectionalArrowLength")){var _=(0,Qt.default)(t.linkDirectionalArrowLength),A=(0,Qt.default)(t.linkDirectionalArrowColor);oi(y.filter(_),t.graphScene,{objBindAttr:"__arrowObj",objFilter:function(t){return"arrow"===t.__linkThreeObjType},createObj:function(){var t=new Mi.Mesh(void 0,new Mi.MeshLambertMaterial({transparent:!0}));return t.__linkThreeObjType="arrow",t},updateObj:function(e,i){var n=_(i),r=t.linkDirectionalArrowResolution;if(!e.geometry.type.match(/^Cone(Buffer)?Geometry$/)||e.geometry.parameters.height!==n||e.geometry.parameters.radialSegments!==r){var a=new Mi.ConeGeometry(.25*n,n,r);a.translate(0,n/2,0),a.rotateX(Math.PI/2),e.geometry.dispose(),e.geometry=a}var o=A(i)||f(i)||"#f0f0f0";e.material.color=new Mi.Color(si(o)),e.material.opacity=3*t.linkOpacity*li(o)}})}if(t.linkDirectionalParticles||e.hasOwnProperty("linkDirectionalParticles")){var x=(0,Qt.default)(t.linkDirectionalParticles),E=(0,Qt.default)(t.linkDirectionalParticleWidth),C=(0,Qt.default)(t.linkDirectionalParticleColor),M={},w={};oi(y.filter(x),t.graphScene,{objBindAttr:"__photonsObj",objFilter:function(t){return"photons"===t.__linkThreeObjType},createObj:function(){var t=new Mi.Group;return t.__linkThreeObjType="photons",t},updateObj:function(e,i){var n,r=Math.round(Math.abs(x(i))),a=!!e.children.length&&e.children[0],o=Math.ceil(10*E(i))/10/2,s=t.linkDirectionalParticleResolution;a&&a.geometry.parameters.radius===o&&a.geometry.parameters.widthSegments===s?n=a.geometry:(w.hasOwnProperty(o)||(w[o]=new Mi.SphereGeometry(o,s,s)),n=w[o],a&&a.geometry.dispose());var l,c=C(i)||f(i)||"#f0f0f0",h=new Mi.Color(si(c)),d=3*t.linkOpacity;a&&a.material.color.equals(h)&&a.material.opacity===d?l=a.material:(M.hasOwnProperty(c)||(M[c]=new Mi.MeshLambertMaterial({color:h,transparent:!0,opacity:d})),l=M[c],a&&a.material.dispose()),oi($e(new Array(r)).map((function(t,e){return{idx:e}})),e,{idAccessor:function(t){return t.idx},createObj:function(){return new Mi.Mesh(n,l)},updateObj:function(t){t.geometry=n,t.material=l}})}})}}if(t._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach((function(e){e.source=e[t.linkSource],e.target=e[t.linkTarget]}));var S,I="ngraph"!==t.forceEngine;if(I){(S=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var T=t.d3ForceLayout.force("link");T&&T.id((function(e){return e[t.nodeId]})).links(t.graphData.links);var U=t.dagMode&&function(t,e){var i=t.nodes,n=t.links,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.nodeFilter,o=void 0===a?function(){return!0}:a,s=r.onLoopError,l=void 0===s?function(t){throw"Invalid DAG structure! Found cycle in node path: ".concat(t.join(" -> "),".")}:s,c={};i.forEach((function(t){return c[e(t)]={data:t,out:[],depth:-1,skip:!o(t)}})),n.forEach((function(t){var i=t.source,n=t.target,r=l(i),a=l(n);if(!c.hasOwnProperty(r))throw"Missing source node with id: ".concat(r);if(!c.hasOwnProperty(a))throw"Missing target node with id: ".concat(a);var o=c[r],s=c[a];function l(t){return"object"===Xe(t)?e(t):t}o.out.push(s)}));var h=[];return function t(i){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=function(){var a=i[o];if(-1!==n.indexOf(a)){var s=[].concat($e(n.slice(n.indexOf(a))),[a]).map((function(t){return e(t.data)}));return h.some((function(t){return t.length===s.length&&t.every((function(t,e){return t===s[e]}))}))||(h.push(s),l(s)),1}r>a.depth&&(a.depth=r,t(a.out,[].concat($e(n),[a]),r+(a.skip?0:1)))},o=0,s=i.length;o<s;o++)a()}(Object.values(c)),Object.assign.apply(Object,[{}].concat($e(Object.entries(c).filter((function(t){return!Ke(t,2)[1].skip})).map((function(t){var e=Ke(t,2);return qe({},e[0],e[1].depth)})))))}(t.graphData,(function(e){return e[t.nodeId]}),{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),F=Math.max.apply(Math,$e(Object.values(U||[]))),B=t.dagLevelDistance||t.graphData.nodes.length/(F||1)*2*(-1!==["radialin","radialout"].indexOf(t.dagMode)?.7:1);if(t.dagMode){var R=function(e,i){return function(n){return e?(U[n[t.nodeId]]-F/2)*B*(i?-1:1):void 0}},L=R(-1!==["lr","rl"].indexOf(t.dagMode),"rl"===t.dagMode),P=R(-1!==["td","bu"].indexOf(t.dagMode),"td"===t.dagMode),N=R(-1!==["zin","zout"].indexOf(t.dagMode),"zout"===t.dagMode);t.graphData.nodes.filter(t.dagNodeFilter).forEach((function(t){t.fx=L(t),t.fy=P(t),t.fz=N(t)}))}t.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(t.dagMode)?function(t,e,i,n){var r,a,o,s,l=D(.1);function c(t){for(var l=0,c=r.length;l<c;++l){var h=r[l],d=h.x-e||1e-6,u=(h.y||0)-i||1e-6,p=(h.z||0)-n||1e-6,f=Math.sqrt(d*d+u*u+p*p),g=(s[l]-f)*o[l]*t/f;h.vx+=d*g,a>1&&(h.vy+=u*g),a>2&&(h.vz+=p*g)}}function h(){if(r){var e,i=r.length;for(o=new Array(i),s=new Array(i),e=0;e<i;++e)s[e]=+t(r[e],e,r),o[e]=isNaN(s[e])?0:+l(r[e],e,r)}}return"function"!=typeof t&&(t=D(+t)),null==e&&(e=0),null==i&&(i=0),null==n&&(n=0),c.initialize=function(t,...e){r=t,a=e.find((t=>[1,2,3].includes(t)))||2,h()},c.strength=function(t){return arguments.length?(l="function"==typeof t?t:D(+t),h(),c):l},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:D(+e),h(),c):t},c.x=function(t){return arguments.length?(e=+t,c):e},c.y=function(t){return arguments.length?(i=+t,c):i},c.z=function(t){return arguments.length?(n=+t,c):n},c}((function(e){var i=U[e[t.nodeId]]||-1;return("radialin"===t.dagMode?F-i:i)*B})).strength((function(e){return t.dagNodeFilter(e)?1:0})):null)}else{var O=wi.graph();t.graphData.nodes.forEach((function(e){O.addNode(e[t.nodeId])})),t.graphData.links.forEach((function(t){O.addLink(t.source,t.target)})),(S=wi.forcelayout(O,We({dimensions:t.numDimensions},t.ngraphPhysics))).graph=O}for(var k=0;k<t.warmupTicks&&!(I&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);k++)S[I?"tick":"step"]();t.layout=S,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}},pi=void 0===(ui=di.stateInit)?function(){return{}}:ui,gi=void 0===(fi=di.props)?{}:fi,bi=void 0===(mi=di.methods)?{}:mi,yi=void 0===(vi=di.aliases)?{}:vi,Ai=void 0===(_i=di.init)?function(){}:_i,Ei=void 0===(xi=di.update)?function(){}:xi,Ci=Object.keys(gi).map((function(t){return new zt(t,gi[t])})),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},pi instanceof Function?pi(t):pi,{initialised:!1}),i={};function n(e){return r(e,t),a(),n}var r=function(t,i){Ai.call(n,t,e,i),e.initialised=!0},a=function(t,e,i){var n,r,a,o,s,l,c=0,h=!1,d=!1,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var i=n,a=r;return n=r=void 0,c=e,o=t.apply(a,i)}function f(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-c>=a}function g(){var t=vt();if(f(t))return m(t);s=setTimeout(g,function(t){var i=e-(t-l);return d?Pt(i,a-(t-c)):i}(t))}function m(t){return s=void 0,u&&n?p(t):(n=r=void 0,o)}function b(){var t=vt(),i=f(t);if(n=arguments,r=this,l=t,i){if(void 0===s)return function(t){return c=t,s=setTimeout(g,e),h?p(t):o}(l);if(d)return clearTimeout(s),s=setTimeout(g,e),p(l)}return void 0===s&&(s=setTimeout(g,e)),o}return e=Lt(e)||0,ft(i)&&(h=!!i.leading,a=(d="maxWait"in i)?Dt(Lt(i.maxWait)||0,e):a,u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=r=s=void 0},b.flush=function(){return void 0===s?o:m(vt())},b}((function(){e.initialised&&(Ei.call(n,e,i),i={})}),1);return Ci.forEach((function(t){n[t.name]=function(t){var r=t.name,o=t.triggerUpdate,s=void 0!==o&&o,l=t.onChange,c=void 0===l?function(t,e){}:l,h=t.defaultVal,d=void 0===h?null:h;return function(t){var o=e[r];if(!arguments.length)return o;var l=void 0===t?d:t;return e[r]=l,c.call(n,l,e,o),!i.hasOwnProperty(r)&&(i[r]=o),s&&a(),n}}(t)})),Object.keys(bi).forEach((function(t){n[t]=function(){for(var i,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return(i=bi[t]).call.apply(i,[n,e].concat(a))}})),Object.entries(yi).forEach((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,a,o,s=[],l=!0,c=!1;try{if(a=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(s.push(n.value),s.length!==e);l=!0);}catch(t){c=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return kt(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?kt(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),i=e[0],r=e[1];return n[i]=n[r]})),n.resetProps=function(){return Ci.forEach((function(t){n[t.name](t.defaultVal)})),n},n.resetProps(),e._rerender=a,n}),Ui=function(t){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=function(i){function n(){var i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return(i=function(t,e,i){return e=Ze(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Je(t)}(t,He()?Reflect.construct(e,i||[],Ze(t).constructor):e.apply(t,i))}(this,n,[].concat(a))).__kapsuleInstance=t().apply(void 0,[].concat($e(e?[Je(i)]:[]),a)),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ye(t,e)}(n,i),r=n,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object);return Object.keys(t()).forEach((function(t){return i.prototype[t]=function(){var e,i=(e=this.__kapsuleInstance)[t].apply(e,arguments);return i===this.__kapsuleInstance?this:i}})),i}(Ti,(window.THREE?window.THREE:{Group:n.YJl}).Group,!0)},9437:(t,e,i)=>{"use strict";i.d(e,{CV9:()=>jo,G_z:()=>Fs,Gu$:()=>Ts,Ho_:()=>Jo,Ld9:()=>il,LoY:()=>nn,N1A:()=>Fo,NRn:()=>Ee,Pq0:()=>_e,Q1f:()=>Oi,QCA:()=>Ss,THS:()=>Wi,Y9S:()=>qs,YJl:()=>vo,aHM:()=>Ws,eaF:()=>An,j6:()=>Us,kn4:()=>Ye,mrM:()=>Mo,qFE:()=>Ko,s0K:()=>Ho});const n="159",r=1,a=2,o=3,s=0,l=1,c=2,h=100,d=101,u=102,p=200,f=201,g=202,m=203,b=204,v=205,y=206,_=207,A=208,x=209,E=210,C=211,M=212,w=213,S=214,I=0,T=1,U=2,F=0,B=1,R=2,L=3,D=4,P=5,N=301,O=302,k=306,z=1e3,Q=1001,V=1002,H=1003,G=1004,W=1005,j=1006,X=1007,q=1008,Z=1009,Y=1012,J=1014,K=1015,$=1016,tt=1020,et=1023,it=1026,nt=1027,rt=33776,at=33777,ot=33778,st=33779,lt=36492,ct=2300,ht=2301,dt=2302,ut=3001,pt="",ft="srgb",gt="srgb-linear",mt="display-p3",bt="display-p3-linear",vt="linear",yt="srgb",_t="rec709",At="p3",xt=7680,Et=512,Ct=513,Mt=514,wt=515,St=516,It=517,Tt=518,Ut=519,Ft="300 es",Bt=1035,Rt=2e3,Lt=2001;class Dt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const Pt=["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"],Nt=Math.PI/180,Ot=180/Math.PI;function kt(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Pt[255&t]+Pt[t>>8&255]+Pt[t>>16&255]+Pt[t>>24&255]+"-"+Pt[255&e]+Pt[e>>8&255]+"-"+Pt[e>>16&15|64]+Pt[e>>24&255]+"-"+Pt[63&i|128]+Pt[i>>8&255]+"-"+Pt[i>>16&255]+Pt[i>>24&255]+Pt[255&n]+Pt[n>>8&255]+Pt[n>>16&255]+Pt[n>>24&255]).toLowerCase()}function zt(t,e,i){return Math.max(e,Math.min(i,t))}function Qt(t,e,i){return(1-i)*t+i*e}function Vt(t){return!(t&t-1)&&0!==t}function Ht(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Gt(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 Wt(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class jt{constructor(t=0,e=0){jt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(zt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Xt{constructor(t,e,i,n,r,a,o,s,l){Xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,r,a,o,s,l)}set(t,e,i,n,r,a,o,s,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=o,c[3]=e,c[4]=r,c[5]=s,c[6]=i,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],l=i[1],c=i[4],h=i[7],d=i[2],u=i[5],p=i[8],f=n[0],g=n[3],m=n[6],b=n[1],v=n[4],y=n[7],_=n[2],A=n[5],x=n[8];return r[0]=a*f+o*b+s*_,r[3]=a*g+o*v+s*A,r[6]=a*m+o*y+s*x,r[1]=l*f+c*b+h*_,r[4]=l*g+c*v+h*A,r[7]=l*m+c*y+h*x,r[2]=d*f+u*b+p*_,r[5]=d*g+u*v+p*A,r[8]=d*m+u*y+p*x,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8];return e*a*c-e*o*l-i*r*c+i*o*s+n*r*l-n*a*s}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],h=c*a-o*l,d=o*s-c*r,u=l*r-a*s,p=e*h+i*d+n*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(n*l-c*i)*f,t[2]=(o*i-n*a)*f,t[3]=d*f,t[4]=(c*e-n*s)*f,t[5]=(n*r-o*e)*f,t[6]=u*f,t[7]=(i*s-l*e)*f,t[8]=(a*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,a,o){const s=Math.cos(r),l=Math.sin(r);return this.set(i*s,i*l,-i*(s*a+l*o)+a+t,-n*l,n*s,-n*(-l*a+s*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(qt.makeScale(t,e)),this}rotate(t){return this.premultiply(qt.makeRotation(-t)),this}translate(t,e){return this.premultiply(qt.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const qt=new Xt;function Zt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Yt(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Jt(){const t=Yt("canvas");return t.style.display="block",t}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const Kt={};function $t(t){t in Kt||(Kt[t]=!0,console.warn(t))}const te=(new Xt).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),ee=(new Xt).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ie={[gt]:{transfer:vt,primaries:_t,toReference:t=>t,fromReference:t=>t},[ft]:{transfer:yt,primaries:_t,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[bt]:{transfer:vt,primaries:At,toReference:t=>t.applyMatrix3(ee),fromReference:t=>t.applyMatrix3(te)},[mt]:{transfer:yt,primaries:At,toReference:t=>t.convertSRGBToLinear().applyMatrix3(ee),fromReference:t=>t.applyMatrix3(te).convertLinearToSRGB()}},ne=new Set([gt,bt]),re={enabled:!0,_workingColorSpace:gt,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!ne.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,i){if(!1===this.enabled||e===i||!e||!i)return t;const n=ie[e].toReference;return(0,ie[i].fromReference)(n(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 ie[t].primaries},getTransfer:function(t){return t===pt?vt:ie[t].transfer}};function ae(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function oe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let se;class le{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===se&&(se=Yt("canvas")),se.width=t.width,se.height=t.height;const i=se.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=se}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Yt("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t<r.length;t++)r[t]=255*ae(r[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*ae(e[t]/255)):e[t]=ae(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let ce=0;class he{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ce++}),this.uuid=kt(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(de(n[e].image)):t.push(de(n[e]))}else t=de(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function de(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?le.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 ue=0;class pe extends Dt{constructor(t=pe.DEFAULT_IMAGE,e=pe.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,o=1023,s=1009,l=pe.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ue++}),this.uuid=kt(),this.name="",this.source=new he(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=s,this.offset=new jt(0,0),this.repeat=new jt(1,1),this.center=new jt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,"string"==typeof c?this.colorSpace=c:($t("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=c===ut?ft:pt),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case z:t.x=t.x-Math.floor(t.x);break;case Q:t.x=t.x<0?0:1;break;case V:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case z:t.y=t.y-Math.floor(t.y);break;case Q:t.y=t.y<0?0:1;break;case V:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return $t("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ft?ut:3e3}set encoding(t){$t("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===ut?ft:pt}}pe.DEFAULT_IMAGE=null,pe.DEFAULT_MAPPING=300,pe.DEFAULT_ANISOTROPY=1;class fe{constructor(t=0,e=0,i=0,n=1){fe.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const a=.01,o=.1,s=t.elements,l=s[0],c=s[4],h=s[8],d=s[1],u=s[5],p=s[9],f=s[2],g=s[6],m=s[10];if(Math.abs(c-d)<a&&Math.abs(h-f)<a&&Math.abs(p-g)<a){if(Math.abs(c+d)<o&&Math.abs(h+f)<o&&Math.abs(p+g)<o&&Math.abs(l+u+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,s=(u+1)/2,b=(m+1)/2,v=(c+d)/4,y=(h+f)/4,_=(p+g)/4;return t>s&&t>b?t<a?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=v/i,r=y/i):s>b?s<a?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(s),i=v/n,r=_/n):b<a?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(b),i=y/r,n=_/r),this.set(i,n,r,e),this}let b=Math.sqrt((g-p)*(g-p)+(h-f)*(h-f)+(d-c)*(d-c));return Math.abs(b)<.001&&(b=1),this.x=(g-p)/b,this.y=(h-f)/b,this.z=(d-c)/b,this.w=Math.acos((l+u+m-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ge extends Dt{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new fe(0,0,t,e),this.scissorTest=!1,this.viewport=new fe(0,0,t,e);const n={width:t,height:e,depth:1};void 0!==i.encoding&&($t("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===ut?ft:pt),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:j,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new pe(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new he(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class me extends ge{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class be extends pe{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=H,this.minFilter=H,this.wrapR=Q,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ve extends pe{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=H,this.minFilter=H,this.wrapR=Q,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ye{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,a,o){let s=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3];const d=r[a+0],u=r[a+1],p=r[a+2],f=r[a+3];if(0===o)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=d,t[e+1]=u,t[e+2]=p,void(t[e+3]=f);if(h!==f||s!==d||l!==u||c!==p){let t=1-o;const e=s*d+l*u+c*p+h*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),a=Math.atan2(r,e*i);t=Math.sin(t*a)/r,o=Math.sin(o*a)/r}const r=o*i;if(s=s*t+d*r,l=l*t+u*r,c=c*t+p*r,h=h*t+f*r,t===1-o){const t=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=t,l*=t,c*=t,h*=t}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,r,a){const o=i[n],s=i[n+1],l=i[n+2],c=i[n+3],h=r[a],d=r[a+1],u=r[a+2],p=r[a+3];return t[e]=o*p+c*h+s*u-l*d,t[e+1]=s*p+c*d+l*h-o*u,t[e+2]=l*p+c*u+o*d-s*h,t[e+3]=c*p-o*h-s*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const i=t._x,n=t._y,r=t._z,a=t._order,o=Math.cos,s=Math.sin,l=o(i/2),c=o(n/2),h=o(r/2),d=s(i/2),u=s(n/2),p=s(r/2);switch(a){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],a=e[1],o=e[5],s=e[9],l=e[2],c=e[6],h=e[10],d=i+o+h;if(d>0){const t=.5/Math.sqrt(d+1);this._w=.25/t,this._x=(c-s)*t,this._y=(r-l)*t,this._z=(a-n)*t}else if(i>o&&i>h){const t=2*Math.sqrt(1+i-o-h);this._w=(c-s)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(r+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-i-h);this._w=(r-l)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(s+c)/t}else{const t=2*Math.sqrt(1+h-i-o);this._w=(a-n)/t,this._x=(r+l)/t,this._y=(s+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(zt(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,l=e._z,c=e._w;return this._x=i*c+a*o+n*l-r*s,this._y=n*c+a*s+r*o-i*l,this._z=r*c+a*l+i*s-n*o,this._w=a*c-i*o-n*s-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,a=this._w;let o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;const s=1-o*o;if(s<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this._w=a*h+this._w*d,this._x=i*h+this._x*d,this._y=n*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class _e{constructor(t=0,e=0,i=0){_e.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(xe.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(xe.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,l=2*(a*n-o*i),c=2*(o*e-r*n),h=2*(r*i-a*e);return this.x=e+s*l+a*h-o*c,this.y=i+s*c+o*l-r*h,this.z=n+s*h+r*c-a*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Ae.copy(this).projectOnVector(t),this.sub(Ae)}reflect(t){return this.sub(Ae.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(zt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ae=new _e,xe=new ye;class Ee{constructor(t=new _e(1/0,1/0,1/0),e=new _e(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Me.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Me.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Me.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Me):Me.fromBufferAttribute(n,e),Me.applyMatrix4(t.matrixWorld),this.expandByPoint(Me);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),we.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),we.copy(i.boundingBox)),we.applyMatrix4(t.matrixWorld),this.union(we)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Me),Me.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Re),Le.subVectors(this.max,Re),Se.subVectors(t.a,Re),Ie.subVectors(t.b,Re),Te.subVectors(t.c,Re),Ue.subVectors(Ie,Se),Fe.subVectors(Te,Ie),Be.subVectors(Se,Te);let e=[0,-Ue.z,Ue.y,0,-Fe.z,Fe.y,0,-Be.z,Be.y,Ue.z,0,-Ue.x,Fe.z,0,-Fe.x,Be.z,0,-Be.x,-Ue.y,Ue.x,0,-Fe.y,Fe.x,0,-Be.y,Be.x,0];return!!Ne(e,Se,Ie,Te,Le)&&(e=[1,0,0,0,1,0,0,0,1],!!Ne(e,Se,Ie,Te,Le)&&(De.crossVectors(Ue,Fe),e=[De.x,De.y,De.z],Ne(e,Se,Ie,Te,Le)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Me).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Me).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ce[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ce[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ce[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ce[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ce[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ce[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ce[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ce[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ce)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ce=[new _e,new _e,new _e,new _e,new _e,new _e,new _e,new _e],Me=new _e,we=new Ee,Se=new _e,Ie=new _e,Te=new _e,Ue=new _e,Fe=new _e,Be=new _e,Re=new _e,Le=new _e,De=new _e,Pe=new _e;function Ne(t,e,i,n,r){for(let a=0,o=t.length-3;a<=o;a+=3){Pe.fromArray(t,a);const o=r.x*Math.abs(Pe.x)+r.y*Math.abs(Pe.y)+r.z*Math.abs(Pe.z),s=e.dot(Pe),l=i.dot(Pe),c=n.dot(Pe);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>o)return!1}return!0}const Oe=new Ee,ke=new _e,ze=new _e;class Qe{constructor(t=new _e,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):Oe.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ke.subVectors(t,this.center);const e=ke.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(ke,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(ze.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ke.copy(t.center).add(ze)),this.expandByPoint(ke.copy(t.center).sub(ze))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Ve=new _e,He=new _e,Ge=new _e,We=new _e,je=new _e,Xe=new _e,qe=new _e;class Ze{constructor(t=new _e,e=new _e(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ve)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Ve.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ve.copy(this.origin).addScaledVector(this.direction,e),Ve.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){He.copy(t).add(e).multiplyScalar(.5),Ge.copy(e).sub(t).normalize(),We.copy(this.origin).sub(He);const r=.5*t.distanceTo(e),a=-this.direction.dot(Ge),o=We.dot(this.direction),s=-We.dot(Ge),l=We.lengthSq(),c=Math.abs(1-a*a);let h,d,u,p;if(c>0)if(h=a*s-o,d=a*o-s,p=r*c,h>=0)if(d>=-p)if(d<=p){const t=1/c;h*=t,d*=t,u=h*(h+a*d+2*o)+d*(a*h+d+2*s)+l}else d=r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;else d=-r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;else d<=-p?(h=Math.max(0,-(-a*r+o)),d=h>0?-r:Math.min(Math.max(-r,-s),r),u=-h*h+d*(d+2*s)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-s),r),u=d*(d+2*s)+l):(h=Math.max(0,-(a*r+o)),d=h>0?r:Math.min(Math.max(-r,-s),r),u=-h*h+d*(d+2*s)+l);else d=a>0?-r:r,h=Math.max(0,-(a*d+o)),u=-h*h+d*(d+2*s)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),n&&n.copy(He).addScaledVector(Ge,d),u}intersectSphere(t,e){Ve.subVectors(t.center,this.origin);const i=Ve.dot(this.direction),n=Ve.dot(Ve)-i*i,r=t.radius*t.radius;if(n>r)return null;const a=Math.sqrt(r-n),o=i-a,s=i+a;return s<0?null:o<0?this.at(s,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,a,o,s;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),c>=0?(r=(t.min.y-d.y)*c,a=(t.max.y-d.y)*c):(r=(t.max.y-d.y)*c,a=(t.min.y-d.y)*c),i>a||r>n?null:((r>i||isNaN(i))&&(i=r),(a<n||isNaN(n))&&(n=a),h>=0?(o=(t.min.z-d.z)*h,s=(t.max.z-d.z)*h):(o=(t.max.z-d.z)*h,s=(t.min.z-d.z)*h),i>s||o>n?null:((o>i||i!=i)&&(i=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,Ve)}intersectTriangle(t,e,i,n,r){je.subVectors(e,t),Xe.subVectors(i,t),qe.crossVectors(je,Xe);let a,o=this.direction.dot(qe);if(o>0){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}We.subVectors(this.origin,t);const s=a*this.direction.dot(Xe.crossVectors(We,Xe));if(s<0)return null;const l=a*this.direction.dot(je.cross(We));if(l<0)return null;if(s+l>o)return null;const c=-a*We.dot(qe);return c<0?null:this.at(c/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ye{constructor(t,e,i,n,r,a,o,s,l,c,h,d,u,p,f,g){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,n,r,a,o,s,l,c,h,d,u,p,f,g)}set(t,e,i,n,r,a,o,s,l,c,h,d,u,p,f,g){const m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=c,m[10]=h,m[14]=d,m[3]=u,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Ye).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/Je.setFromMatrixColumn(t,0).length(),r=1/Je.setFromMatrixColumn(t,1).length(),a=1/Je.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=a*c,i=a*h,n=o*c,r=o*h;e[0]=s*c,e[4]=-s*h,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-o*s,e[2]=r-t*l,e[6]=n+i*l,e[10]=a*s}else if("YXZ"===t.order){const t=s*c,i=s*h,n=l*c,r=l*h;e[0]=t+r*o,e[4]=n*o-i,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-o,e[2]=i*o-n,e[6]=r+t*o,e[10]=a*s}else if("ZXY"===t.order){const t=s*c,i=s*h,n=l*c,r=l*h;e[0]=t-r*o,e[4]=-a*h,e[8]=n+i*o,e[1]=i+n*o,e[5]=a*c,e[9]=r-t*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){const t=a*c,i=a*h,n=o*c,r=o*h;e[0]=s*c,e[4]=n*l-i,e[8]=t*l+r,e[1]=s*h,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){const t=a*s,i=a*l,n=o*s,r=o*l;e[0]=s*c,e[4]=r-t*h,e[8]=n*h+i,e[1]=h,e[5]=a*c,e[9]=-o*c,e[2]=-l*c,e[6]=i*h+n,e[10]=t-r*h}else if("XZY"===t.order){const t=a*s,i=a*l,n=o*s,r=o*l;e[0]=s*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=a*c,e[9]=i*h-n,e[2]=n*h-i,e[6]=o*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose($e,t,ti)}lookAt(t,e,i){const n=this.elements;return ni.subVectors(t,e),0===ni.lengthSq()&&(ni.z=1),ni.normalize(),ei.crossVectors(i,ni),0===ei.lengthSq()&&(1===Math.abs(i.z)?ni.x+=1e-4:ni.z+=1e-4,ni.normalize(),ei.crossVectors(i,ni)),ei.normalize(),ii.crossVectors(ni,ei),n[0]=ei.x,n[4]=ii.x,n[8]=ni.x,n[1]=ei.y,n[5]=ii.y,n[9]=ni.y,n[2]=ei.z,n[6]=ii.z,n[10]=ni.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],l=i[12],c=i[1],h=i[5],d=i[9],u=i[13],p=i[2],f=i[6],g=i[10],m=i[14],b=i[3],v=i[7],y=i[11],_=i[15],A=n[0],x=n[4],E=n[8],C=n[12],M=n[1],w=n[5],S=n[9],I=n[13],T=n[2],U=n[6],F=n[10],B=n[14],R=n[3],L=n[7],D=n[11],P=n[15];return r[0]=a*A+o*M+s*T+l*R,r[4]=a*x+o*w+s*U+l*L,r[8]=a*E+o*S+s*F+l*D,r[12]=a*C+o*I+s*B+l*P,r[1]=c*A+h*M+d*T+u*R,r[5]=c*x+h*w+d*U+u*L,r[9]=c*E+h*S+d*F+u*D,r[13]=c*C+h*I+d*B+u*P,r[2]=p*A+f*M+g*T+m*R,r[6]=p*x+f*w+g*U+m*L,r[10]=p*E+f*S+g*F+m*D,r[14]=p*C+f*I+g*B+m*P,r[3]=b*A+v*M+y*T+_*R,r[7]=b*x+v*w+y*U+_*L,r[11]=b*E+v*S+y*F+_*D,r[15]=b*C+v*I+y*B+_*P,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],l=t[13],c=t[2],h=t[6],d=t[10],u=t[14];return t[3]*(+r*s*h-n*l*h-r*o*d+i*l*d+n*o*u-i*s*u)+t[7]*(+e*s*u-e*l*d+r*a*d-n*a*u+n*l*c-r*s*c)+t[11]*(+e*l*h-e*o*u-r*a*h+i*a*u+r*o*c-i*l*c)+t[15]*(-n*o*c-e*s*h+e*o*d+n*a*h-i*a*d+i*s*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],h=t[9],d=t[10],u=t[11],p=t[12],f=t[13],g=t[14],m=t[15],b=h*g*l-f*d*l+f*s*u-o*g*u-h*s*m+o*d*m,v=p*d*l-c*g*l-p*s*u+a*g*u+c*s*m-a*d*m,y=c*f*l-p*h*l+p*o*u-a*f*u-c*o*m+a*h*m,_=p*h*s-c*f*s-p*o*d+a*f*d+c*o*g-a*h*g,A=e*b+i*v+n*y+r*_;if(0===A)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/A;return t[0]=b*x,t[1]=(f*d*r-h*g*r-f*n*u+i*g*u+h*n*m-i*d*m)*x,t[2]=(o*g*r-f*s*r+f*n*l-i*g*l-o*n*m+i*s*m)*x,t[3]=(h*s*r-o*d*r-h*n*l+i*d*l+o*n*u-i*s*u)*x,t[4]=v*x,t[5]=(c*g*r-p*d*r+p*n*u-e*g*u-c*n*m+e*d*m)*x,t[6]=(p*s*r-a*g*r-p*n*l+e*g*l+a*n*m-e*s*m)*x,t[7]=(a*d*r-c*s*r+c*n*l-e*d*l-a*n*u+e*s*u)*x,t[8]=y*x,t[9]=(p*h*r-c*f*r-p*i*u+e*f*u+c*i*m-e*h*m)*x,t[10]=(a*f*r-p*o*r+p*i*l-e*f*l-a*i*m+e*o*m)*x,t[11]=(c*o*r-a*h*r-c*i*l+e*h*l+a*i*u-e*o*u)*x,t[12]=_*x,t[13]=(c*f*n-p*h*n+p*i*d-e*f*d-c*i*g+e*h*g)*x,t[14]=(p*o*n-a*f*n-p*i*s+e*f*s+a*i*g-e*o*g)*x,t[15]=(a*h*n-c*o*n+c*i*s-e*h*s-a*i*d+e*o*d)*x,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,l=r*a,c=r*o;return this.set(l*a+i,l*o-n*s,l*s+n*o,0,l*o+n*s,c*o+i,c*s-n*a,0,l*s-n*o,c*s+n*a,r*s*s+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,a){return this.set(1,i,r,0,t,1,a,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,a=e._y,o=e._z,s=e._w,l=r+r,c=a+a,h=o+o,d=r*l,u=r*c,p=r*h,f=a*c,g=a*h,m=o*h,b=s*l,v=s*c,y=s*h,_=i.x,A=i.y,x=i.z;return n[0]=(1-(f+m))*_,n[1]=(u+y)*_,n[2]=(p-v)*_,n[3]=0,n[4]=(u-y)*A,n[5]=(1-(d+m))*A,n[6]=(g+b)*A,n[7]=0,n[8]=(p+v)*x,n[9]=(g-b)*x,n[10]=(1-(d+f))*x,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=Je.set(n[0],n[1],n[2]).length();const a=Je.set(n[4],n[5],n[6]).length(),o=Je.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],Ke.copy(this);const s=1/r,l=1/a,c=1/o;return Ke.elements[0]*=s,Ke.elements[1]*=s,Ke.elements[2]*=s,Ke.elements[4]*=l,Ke.elements[5]*=l,Ke.elements[6]*=l,Ke.elements[8]*=c,Ke.elements[9]*=c,Ke.elements[10]*=c,e.setFromRotationMatrix(Ke),i.x=r,i.y=a,i.z=o,this}makePerspective(t,e,i,n,r,a,o=2e3){const s=this.elements,l=2*r/(e-t),c=2*r/(i-n),h=(e+t)/(e-t),d=(i+n)/(i-n);let u,p;if(o===Rt)u=-(a+r)/(a-r),p=-2*a*r/(a-r);else{if(o!==Lt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-a/(a-r),p=-a*r/(a-r)}return s[0]=l,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=c,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,i,n,r,a,o=2e3){const s=this.elements,l=1/(e-t),c=1/(i-n),h=1/(a-r),d=(e+t)*l,u=(i+n)*c;let p,f;if(o===Rt)p=(a+r)*h,f=-2*h;else{if(o!==Lt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,f=-1*h}return s[0]=2*l,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=f,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Je=new _e,Ke=new Ye,$e=new _e(0,0,0),ti=new _e(1,1,1),ei=new _e,ii=new _e,ni=new _e,ri=new Ye,ai=new ye;class oi{constructor(t=0,e=0,i=0,n=oi.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],a=n[4],o=n[8],s=n[1],l=n[5],c=n[9],h=n[2],d=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(zt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-zt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(zt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-zt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(zt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-zt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ri.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ri,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ai.setFromEuler(this),this.setFromQuaternion(ai,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}oi.DEFAULT_ORDER="XYZ";class si{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let li=0;const ci=new _e,hi=new ye,di=new Ye,ui=new _e,pi=new _e,fi=new _e,gi=new ye,mi=new _e(1,0,0),bi=new _e(0,1,0),vi=new _e(0,0,1),yi={type:"added"},_i={type:"removed"};class Ai extends Dt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:li++}),this.uuid=kt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ai.DEFAULT_UP.clone();const t=new _e,e=new oi,i=new ye,n=new _e(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ye},normalMatrix:{value:new Xt}}),this.matrix=new Ye,this.matrixWorld=new Ye,this.matrixAutoUpdate=Ai.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ai.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new si,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return hi.setFromAxisAngle(t,e),this.quaternion.multiply(hi),this}rotateOnWorldAxis(t,e){return hi.setFromAxisAngle(t,e),this.quaternion.premultiply(hi),this}rotateX(t){return this.rotateOnAxis(mi,t)}rotateY(t){return this.rotateOnAxis(bi,t)}rotateZ(t){return this.rotateOnAxis(vi,t)}translateOnAxis(t,e){return ci.copy(t).applyQuaternion(this.quaternion),this.position.add(ci.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(mi,t)}translateY(t){return this.translateOnAxis(bi,t)}translateZ(t){return this.translateOnAxis(vi,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(di.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?ui.copy(t):ui.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),pi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?di.lookAt(pi,ui,this.up):di.lookAt(ui,pi,this.up),this.quaternion.setFromRotationMatrix(di),n&&(di.extractRotation(n.matrixWorld),hi.setFromRotationMatrix(di),this.quaternion.premultiply(hi.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(yi)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(_i)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),di.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),di.multiply(t.parent.matrixWorld)),t.applyMatrix4(di),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pi,t,fi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pi,gi,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){const n=e[i];!0!==n.matrixWorldAutoUpdate&&!0!==t||n.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){const i=t[e];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),n.maxGeometryCount=this._maxGeometryCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(t),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=a(t.geometries),n=a(t.materials),r=a(t.textures),o=a(t.images),s=a(t.shapes),l=a(t.skeletons),c=a(t.animations),h=a(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),o.length>0&&(i.images=o),s.length>0&&(i.shapes=s),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),h.length>0&&(i.nodes=h)}return i.object=n,i;function a(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Ai.DEFAULT_UP=new _e(0,1,0),Ai.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ai.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const xi=new _e,Ei=new _e,Ci=new _e,Mi=new _e,wi=new _e,Si=new _e,Ii=new _e,Ti=new _e,Ui=new _e,Fi=new _e;let Bi=!1;class Ri{constructor(t=new _e,e=new _e,i=new _e){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),xi.subVectors(t,e),n.cross(xi);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){xi.subVectors(n,e),Ei.subVectors(i,e),Ci.subVectors(t,e);const a=xi.dot(xi),o=xi.dot(Ei),s=xi.dot(Ci),l=Ei.dot(Ei),c=Ei.dot(Ci),h=a*l-o*o;if(0===h)return r.set(-2,-1,-1);const d=1/h,u=(l*s-o*c)*d,p=(a*c-o*s)*d;return r.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Mi),Mi.x>=0&&Mi.y>=0&&Mi.x+Mi.y<=1}static getUV(t,e,i,n,r,a,o,s){return!1===Bi&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Bi=!0),this.getInterpolation(t,e,i,n,r,a,o,s)}static getInterpolation(t,e,i,n,r,a,o,s){return this.getBarycoord(t,e,i,n,Mi),s.setScalar(0),s.addScaledVector(r,Mi.x),s.addScaledVector(a,Mi.y),s.addScaledVector(o,Mi.z),s}static isFrontFacing(t,e,i,n){return xi.subVectors(i,e),Ei.subVectors(t,e),xi.cross(Ei).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return xi.subVectors(this.c,this.b),Ei.subVectors(this.a,this.b),.5*xi.cross(Ei).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ri.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ri.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return!1===Bi&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Bi=!0),Ri.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}getInterpolation(t,e,i,n,r){return Ri.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Ri.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ri.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let a,o;wi.subVectors(n,i),Si.subVectors(r,i),Ti.subVectors(t,i);const s=wi.dot(Ti),l=Si.dot(Ti);if(s<=0&&l<=0)return e.copy(i);Ui.subVectors(t,n);const c=wi.dot(Ui),h=Si.dot(Ui);if(c>=0&&h<=c)return e.copy(n);const d=s*h-c*l;if(d<=0&&s>=0&&c<=0)return a=s/(s-c),e.copy(i).addScaledVector(wi,a);Fi.subVectors(t,r);const u=wi.dot(Fi),p=Si.dot(Fi);if(p>=0&&u<=p)return e.copy(r);const f=u*l-s*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(i).addScaledVector(Si,o);const g=c*p-u*h;if(g<=0&&h-c>=0&&u-p>=0)return Ii.subVectors(r,n),o=(h-c)/(h-c+(u-p)),e.copy(n).addScaledVector(Ii,o);const m=1/(g+f+d);return a=f*m,o=d*m,e.copy(i).addScaledVector(wi,a).addScaledVector(Si,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Li={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},Di={h:0,s:0,l:0},Pi={h:0,s:0,l:0};function Ni(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Oi{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ft){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,re.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=re.workingColorSpace){return this.r=t,this.g=e,this.b=i,re.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=re.workingColorSpace){if(t=(t%(r=1)+r)%r,e=zt(e,0,1),i=zt(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Ni(r,n,t+1/3),this.g=Ni(r,n,t),this.b=Ni(r,n,t-1/3)}var r;return re.toWorkingColorSpace(this,n),this}setStyle(t,e=ft){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const a=n[1],o=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(i,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ft){const i=Li[t.toLowerCase()];return void 0!==i?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ae(t.r),this.g=ae(t.g),this.b=ae(t.b),this}copyLinearToSRGB(t){return this.r=oe(t.r),this.g=oe(t.g),this.b=oe(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ft){return re.fromWorkingColorSpace(ki.copy(this),t),65536*Math.round(zt(255*ki.r,0,255))+256*Math.round(zt(255*ki.g,0,255))+Math.round(zt(255*ki.b,0,255))}getHexString(t=ft){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=re.workingColorSpace){re.fromWorkingColorSpace(ki.copy(this),e);const i=ki.r,n=ki.g,r=ki.b,a=Math.max(i,n,r),o=Math.min(i,n,r);let s,l;const c=(o+a)/2;if(o===a)s=0,l=0;else{const t=a-o;switch(l=c<=.5?t/(a+o):t/(2-a-o),a){case i:s=(n-r)/t+(n<r?6:0);break;case n:s=(r-i)/t+2;break;case r:s=(i-n)/t+4}s/=6}return t.h=s,t.s=l,t.l=c,t}getRGB(t,e=re.workingColorSpace){return re.fromWorkingColorSpace(ki.copy(this),e),t.r=ki.r,t.g=ki.g,t.b=ki.b,t}getStyle(t=ft){re.fromWorkingColorSpace(ki.copy(this),t);const e=ki.r,i=ki.g,n=ki.b;return t!==ft?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(Di),this.setHSL(Di.h+t,Di.s+e,Di.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Di),t.getHSL(Pi);const i=Qt(Di.h,Pi.h,e),n=Qt(Di.s,Pi.s,e),r=Qt(Di.l,Pi.l,e);return this.setHSL(i,n,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*n,this.g=r[1]*e+r[4]*i+r[7]*n,this.b=r[2]*e+r[5]*i+r[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ki=new Oi;Oi.NAMES=Li;let zi=0;class Qi extends Dt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zi++}),this.uuid=kt(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=h,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Oi(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=xt,this.stencilZFail=xt,this.stencilZPass=xt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),this.blendEquation!==h&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==xt&&(i.stencilFail=this.stencilFail),this.stencilZFail!==xt&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==xt&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Vi extends Qi{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Oi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=I,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Hi=new _e,Gi=new jt;class Wi{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=K,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Gi.fromBufferAttribute(this,e),Gi.applyMatrix3(t),this.setXY(e,Gi.x,Gi.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.applyMatrix3(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.applyMatrix4(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.applyNormalMatrix(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Hi.fromBufferAttribute(this,e),Hi.transformDirection(t),this.setXYZ(e,Hi.x,Hi.y,Hi.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Gt(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Wt(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Gt(e,this.array)),e}setX(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Gt(e,this.array)),e}setY(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Gt(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Gt(e,this.array)),e}setW(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),i=Wt(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),i=Wt(i,this.array),n=Wt(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),i=Wt(i,this.array),n=Wt(n,this.array),r=Wt(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),t}}class ji extends Wi{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Xi extends Wi{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class qi extends Wi{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Zi=0;const Yi=new Ye,Ji=new Ai,Ki=new _e,$i=new Ee,tn=new Ee,en=new _e;class nn extends Dt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zi++}),this.uuid=kt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Zt(t)?Xi:ji)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new Xt).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Yi.makeRotationFromQuaternion(t),this.applyMatrix4(Yi),this}rotateX(t){return Yi.makeRotationX(t),this.applyMatrix4(Yi),this}rotateY(t){return Yi.makeRotationY(t),this.applyMatrix4(Yi),this}rotateZ(t){return Yi.makeRotationZ(t),this.applyMatrix4(Yi),this}translate(t,e,i){return Yi.makeTranslation(t,e,i),this.applyMatrix4(Yi),this}scale(t,e,i){return Yi.makeScale(t,e,i),this.applyMatrix4(Yi),this}lookAt(t){return Ji.lookAt(t),Ji.updateMatrix(),this.applyMatrix4(Ji.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ki).negate(),this.translate(Ki.x,Ki.y,Ki.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new qi(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ee);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new _e(-1/0,-1/0,-1/0),new _e(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];$i.setFromBufferAttribute(i),this.morphTargetsRelative?(en.addVectors(this.boundingBox.min,$i.min),this.boundingBox.expandByPoint(en),en.addVectors(this.boundingBox.max,$i.max),this.boundingBox.expandByPoint(en)):(this.boundingBox.expandByPoint($i.min),this.boundingBox.expandByPoint($i.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(){null===this.boundingSphere&&(this.boundingSphere=new Qe);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new _e,1/0);if(t){const i=this.boundingSphere.center;if($i.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];tn.setFromBufferAttribute(i),this.morphTargetsRelative?(en.addVectors($i.min,tn.min),$i.expandByPoint(en),en.addVectors($i.max,tn.max),$i.expandByPoint(en)):($i.expandByPoint(tn.min),$i.expandByPoint(tn.max))}$i.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)en.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(en));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],o=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)en.fromBufferAttribute(a,e),o&&(Ki.fromBufferAttribute(t,e),en.add(Ki)),n=Math.max(n,i.distanceToSquared(en))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,a=e.uv.array,o=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Wi(new Float32Array(4*o),4));const s=this.getAttribute("tangent").array,l=[],c=[];for(let t=0;t<o;t++)l[t]=new _e,c[t]=new _e;const h=new _e,d=new _e,u=new _e,p=new jt,f=new jt,g=new jt,m=new _e,b=new _e;function v(t,e,i){h.fromArray(n,3*t),d.fromArray(n,3*e),u.fromArray(n,3*i),p.fromArray(a,2*t),f.fromArray(a,2*e),g.fromArray(a,2*i),d.sub(h),u.sub(h),f.sub(p),g.sub(p);const r=1/(f.x*g.y-g.x*f.y);isFinite(r)&&(m.copy(d).multiplyScalar(g.y).addScaledVector(u,-f.y).multiplyScalar(r),b.copy(u).multiplyScalar(f.x).addScaledVector(d,-g.x).multiplyScalar(r),l[t].add(m),l[e].add(m),l[i].add(m),c[t].add(b),c[e].add(b),c[i].add(b))}let y=this.groups;0===y.length&&(y=[{start:0,count:i.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)v(i[t+0],i[t+1],i[t+2])}const _=new _e,A=new _e,x=new _e,E=new _e;function C(t){x.fromArray(r,3*t),E.copy(x);const e=l[t];_.copy(e),_.sub(x.multiplyScalar(x.dot(e))).normalize(),A.crossVectors(E,e);const i=A.dot(c[t])<0?-1:1;s[4*t]=_.x,s[4*t+1]=_.y,s[4*t+2]=_.z,s[4*t+3]=i}for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)C(i[t+0]),C(i[t+1]),C(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Wi(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new _e,r=new _e,a=new _e,o=new _e,s=new _e,l=new _e,c=new _e,h=new _e;if(t)for(let d=0,u=t.count;d<u;d+=3){const u=t.getX(d+0),p=t.getX(d+1),f=t.getX(d+2);n.fromBufferAttribute(e,u),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),o.fromBufferAttribute(i,u),s.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),o.add(c),s.add(c),l.add(c),i.setXYZ(u,o.x,o.y,o.z),i.setXYZ(p,s.x,s.y,s.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,o=e.count;t<o;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),i.setXYZ(t+0,c.x,c.y,c.z),i.setXYZ(t+1,c.x,c.y,c.z),i.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)en.fromBufferAttribute(t,e),en.normalize(),t.setXYZ(e,en.x,en.y,en.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,a=new i.constructor(e.length*n);let o=0,s=0;for(let r=0,l=e.length;r<l;r++){o=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)a[s++]=i[o++]}return new Wi(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new nn,i=this.index.array,n=this.attributes;for(const r in n){const a=t(n[r],i);e.setAttribute(r,a)}const r=this.morphAttributes;for(const n in r){const a=[],o=r[n];for(let e=0,n=o.length;e<n;e++){const n=t(o[e],i);a.push(n)}e.morphAttributes[n]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,i=a.length;t<i;t++){const i=a[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],a=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];a.push(n.toJSON(t.data))}a.length>0&&(n[e]=a,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const rn=new Ye,an=new Ze,on=new Qe,sn=new _e,ln=new _e,cn=new _e,hn=new _e,dn=new _e,un=new _e,pn=new jt,fn=new jt,gn=new jt,mn=new _e,bn=new _e,vn=new _e,yn=new _e,_n=new _e;class An extends Ai{constructor(t=new nn,e=new Vi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,a=i.morphTargetsRelative;e.fromBufferAttribute(n,t);const o=this.morphTargetInfluences;if(r&&o){un.set(0,0,0);for(let i=0,n=r.length;i<n;i++){const n=o[i],s=r[i];0!==n&&(dn.fromBufferAttribute(s,t),a?un.addScaledVector(dn,n):un.addScaledVector(dn.sub(e),n))}e.add(un)}return e}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),on.copy(i.boundingSphere),on.applyMatrix4(r),an.copy(t.ray).recast(t.near),!1===on.containsPoint(an.origin)){if(null===an.intersectSphere(on,sn))return;if(an.origin.distanceToSquared(sn)>(t.far-t.near)**2)return}rn.copy(r).invert(),an.copy(t.ray).applyMatrix4(rn),null!==i.boundingBox&&!1===an.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,an)}}_computeIntersections(t,e,i){let n;const r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(a))for(let r=0,s=d.length;r<s;r++){const s=d[r],p=a[s.materialIndex];for(let r=Math.max(s.start,u.start),a=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));r<a;r+=3)n=xn(this,p,t,i,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),n&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=s.materialIndex,e.push(n))}else for(let r=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);r<s;r+=3)n=xn(this,a,t,i,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),n&&(n.faceIndex=Math.floor(r/3),e.push(n));else if(void 0!==s)if(Array.isArray(a))for(let r=0,o=d.length;r<o;r++){const o=d[r],p=a[o.materialIndex];for(let r=Math.max(o.start,u.start),a=Math.min(s.count,Math.min(o.start+o.count,u.start+u.count));r<a;r+=3)n=xn(this,p,t,i,l,c,h,r,r+1,r+2),n&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=o.materialIndex,e.push(n))}else for(let r=Math.max(0,u.start),o=Math.min(s.count,u.start+u.count);r<o;r+=3)n=xn(this,a,t,i,l,c,h,r,r+1,r+2),n&&(n.faceIndex=Math.floor(r/3),e.push(n))}}function xn(t,e,i,n,r,a,o,s,l,c){t.getVertexPosition(s,ln),t.getVertexPosition(l,cn),t.getVertexPosition(c,hn);const h=function(t,e,i,n,r,a,o,s){let l;if(l=1===e.side?n.intersectTriangle(o,a,r,!0,s):n.intersectTriangle(r,a,o,0===e.side,s),null===l)return null;_n.copy(s),_n.applyMatrix4(t.matrixWorld);const c=i.ray.origin.distanceTo(_n);return c<i.near||c>i.far?null:{distance:c,point:_n.clone(),object:t}}(t,e,i,n,ln,cn,hn,yn);if(h){r&&(pn.fromBufferAttribute(r,s),fn.fromBufferAttribute(r,l),gn.fromBufferAttribute(r,c),h.uv=Ri.getInterpolation(yn,ln,cn,hn,pn,fn,gn,new jt)),a&&(pn.fromBufferAttribute(a,s),fn.fromBufferAttribute(a,l),gn.fromBufferAttribute(a,c),h.uv1=Ri.getInterpolation(yn,ln,cn,hn,pn,fn,gn,new jt),h.uv2=h.uv1),o&&(mn.fromBufferAttribute(o,s),bn.fromBufferAttribute(o,l),vn.fromBufferAttribute(o,c),h.normal=Ri.getInterpolation(yn,ln,cn,hn,mn,bn,vn,new _e),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const t={a:s,b:l,c,normal:new _e,materialIndex:0};Ri.getNormal(ln,cn,hn,t.normal),h.face=t}return h}class En extends nn{constructor(t=1,e=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const o=this;n=Math.floor(n),r=Math.floor(r),a=Math.floor(a);const s=[],l=[],c=[],h=[];let d=0,u=0;function p(t,e,i,n,r,a,p,f,g,m,b){const v=a/g,y=p/m,_=a/2,A=p/2,x=f/2,E=g+1,C=m+1;let M=0,w=0;const S=new _e;for(let a=0;a<C;a++){const o=a*y-A;for(let s=0;s<E;s++){const d=s*v-_;S[t]=d*n,S[e]=o*r,S[i]=x,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[i]=f>0?1:-1,c.push(S.x,S.y,S.z),h.push(s/g),h.push(1-a/m),M+=1}}for(let t=0;t<m;t++)for(let e=0;e<g;e++){const i=d+e+E*t,n=d+e+E*(t+1),r=d+(e+1)+E*(t+1),a=d+(e+1)+E*t;s.push(i,n,a),s.push(n,r,a),w+=6}o.addGroup(u,w,b),u+=w,d+=M}p("z","y","x",-1,-1,i,e,t,a,r,0),p("z","y","x",1,-1,i,e,-t,a,r,1),p("x","z","y",1,1,t,i,e,n,a,2),p("x","z","y",1,-1,t,i,-e,n,a,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(s),this.setAttribute("position",new qi(l,3)),this.setAttribute("normal",new qi(c,3)),this.setAttribute("uv",new qi(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new En(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Cn(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];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[i][n]=null):e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Mn(t){const e={};for(let i=0;i<t.length;i++){const n=Cn(t[i]);for(const t in n)e[t]=n[t]}return e}function wn(t){return null===t.getRenderTarget()?t.outputColorSpace:re.workingColorSpace}const Sn={clone:Cn,merge:Mn};class In extends Qi{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Cn(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Tn extends Ai{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye,this.coordinateSystem=Rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class Un extends Tn{constructor(t=50,e=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Ot*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Nt*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Ot*Math.atan(Math.tan(.5*Nt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Nt*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,o=a.fullHeight;r+=a.offsetX*n/t,e-=a.offsetY*i/o,n*=a.width/t,i*=a.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Fn=-90;class Bn extends Ai{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new Un(Fn,1,t,e);n.layers=this.layers,this.add(n);const r=new Un(Fn,1,t,e);r.layers=this.layers,this.add(r);const a=new Un(Fn,1,t,e);a.layers=this.layers,this.add(a);const o=new Un(Fn,1,t,e);o.layers=this.layers,this.add(o);const s=new Un(Fn,1,t,e);s.layers=this.layers,this.add(s);const l=new Un(Fn,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,n,r,a,o,s]=e;for(const t of e)this.remove(t);if(t===Rt)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.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),s.up.set(0,1,0),s.lookAt(0,0,-1);else{if(t!==Lt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.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),s.up.set(0,-1,0),s.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,s,l,c]=this.children,h=t.getRenderTarget(),d=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,n),t.render(e,r),t.setRenderTarget(i,1,n),t.render(e,a),t.setRenderTarget(i,2,n),t.render(e,o),t.setRenderTarget(i,3,n),t.render(e,s),t.setRenderTarget(i,4,n),t.render(e,l),i.texture.generateMipmaps=f,t.setRenderTarget(i,5,n),t.render(e,c),t.setRenderTarget(h,d,u),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class Rn extends pe{constructor(t,e,i,n,r,a,o,s,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:N,i,n,r,a,o,s,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Ln extends me{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];void 0!==e.encoding&&($t("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===ut?ft:pt),this.texture=new Rn(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:j}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={tEquirect:{value:null}},n="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new En(5,5,5),o=new In({name:"CubemapFromEquirect",uniforms:Cn(i),vertexShader:n,fragmentShader:r,side:1,blending:0});o.uniforms.tEquirect.value=e;const s=new An(a,o),l=e.minFilter;return e.minFilter===q&&(e.minFilter=j),new Bn(1,10,this).update(t,s),e.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}const Dn=new _e,Pn=new _e,Nn=new Xt;class On{constructor(t=new _e(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=Dn.subVectors(i,e).cross(Pn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(Dn),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Nn.getNormalMatrix(t),n=this.coplanarPoint(Dn).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const kn=new Qe,zn=new _e;class Qn{constructor(t=new On,e=new On,i=new On,n=new On,r=new On,a=new On){this.planes=[t,e,i,n,r,a]}set(t,e,i,n,r,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3){const i=this.planes,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],h=n[6],d=n[7],u=n[8],p=n[9],f=n[10],g=n[11],m=n[12],b=n[13],v=n[14],y=n[15];if(i[0].setComponents(s-r,d-l,g-u,y-m).normalize(),i[1].setComponents(s+r,d+l,g+u,y+m).normalize(),i[2].setComponents(s+a,d+c,g+p,y+b).normalize(),i[3].setComponents(s-a,d-c,g-p,y-b).normalize(),i[4].setComponents(s-o,d-h,g-f,y-v).normalize(),e===Rt)i[5].setComponents(s+o,d+h,g+f,y+v).normalize();else{if(e!==Lt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(o,h,f,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),kn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),kn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(kn)}intersectsSprite(t){return kn.center.set(0,0,0),kn.radius=.7071067811865476,kn.applyMatrix4(t.matrixWorld),this.intersectsSphere(kn)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(i)<n)return!1;return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(zn.x=n.normal.x>0?t.max.x:t.min.x,zn.y=n.normal.y>0?t.max.y:t.min.y,zn.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(zn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Vn(){let t=null,e=!1,i=null,n=null;function r(e,a){i(e,a),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Hn(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=n.get(e);if(void 0===a)n.set(e,function(e,n){const r=e.array,a=e.usage,o=r.byteLength,s=t.createBuffer();let l;if(t.bindBuffer(n,s),t.bufferData(n,r,a),e.onUploadCallback(),r instanceof Float32Array)l=t.FLOAT;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!i)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");l=t.HALF_FLOAT}else l=t.UNSIGNED_SHORT;else if(r instanceof Int16Array)l=t.SHORT;else if(r instanceof Uint32Array)l=t.UNSIGNED_INT;else if(r instanceof Int32Array)l=t.INT;else if(r instanceof Int8Array)l=t.BYTE;else if(r instanceof Uint8Array)l=t.UNSIGNED_BYTE;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);l=t.UNSIGNED_BYTE}return{buffer:s,type:l,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,size:o}}(e,r));else if(a.version<e.version){if(a.size!==e.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.");!function(e,n,r){const a=n.array,o=n._updateRange,s=n.updateRanges;if(t.bindBuffer(r,e),-1===o.count&&0===s.length&&t.bufferSubData(r,0,a),0!==s.length){for(let e=0,n=s.length;e<n;e++){const n=s[e];i?t.bufferSubData(r,n.start*a.BYTES_PER_ELEMENT,a,n.start,n.count):t.bufferSubData(r,n.start*a.BYTES_PER_ELEMENT,a.subarray(n.start,n.start+n.count))}n.clearUpdateRanges()}-1!==o.count&&(i?t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),n.onUploadCallback()}(a.buffer,e,r),a.version=e.version}}}}class Gn extends nn{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,a=e/2,o=Math.floor(i),s=Math.floor(n),l=o+1,c=s+1,h=t/o,d=e/s,u=[],p=[],f=[],g=[];for(let t=0;t<c;t++){const e=t*d-a;for(let i=0;i<l;i++){const n=i*h-r;p.push(n,-e,0),f.push(0,0,1),g.push(i/o),g.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<o;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;u.push(i,n,a),u.push(n,r,a)}this.setIndex(u),this.setAttribute("position",new qi(p,3)),this.setAttribute("normal",new qi(f,3)),this.setAttribute("uv",new qi(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Gn(t.width,t.height,t.widthSegments,t.heightSegments)}}const Wn={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},jn={common:{diffuse:{value:new Oi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new jt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Oi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Oi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new Oi(16777215)},opacity:{value:1},center:{value:new jt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},Xn={basic:{uniforms:Mn([jn.common,jn.specularmap,jn.envmap,jn.aomap,jn.lightmap,jn.fog]),vertexShader:Wn.meshbasic_vert,fragmentShader:Wn.meshbasic_frag},lambert:{uniforms:Mn([jn.common,jn.specularmap,jn.envmap,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)}}]),vertexShader:Wn.meshlambert_vert,fragmentShader:Wn.meshlambert_frag},phong:{uniforms:Mn([jn.common,jn.specularmap,jn.envmap,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)},specular:{value:new Oi(1118481)},shininess:{value:30}}]),vertexShader:Wn.meshphong_vert,fragmentShader:Wn.meshphong_frag},standard:{uniforms:Mn([jn.common,jn.envmap,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.roughnessmap,jn.metalnessmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wn.meshphysical_vert,fragmentShader:Wn.meshphysical_frag},toon:{uniforms:Mn([jn.common,jn.aomap,jn.lightmap,jn.emissivemap,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.gradientmap,jn.fog,jn.lights,{emissive:{value:new Oi(0)}}]),vertexShader:Wn.meshtoon_vert,fragmentShader:Wn.meshtoon_frag},matcap:{uniforms:Mn([jn.common,jn.bumpmap,jn.normalmap,jn.displacementmap,jn.fog,{matcap:{value:null}}]),vertexShader:Wn.meshmatcap_vert,fragmentShader:Wn.meshmatcap_frag},points:{uniforms:Mn([jn.points,jn.fog]),vertexShader:Wn.points_vert,fragmentShader:Wn.points_frag},dashed:{uniforms:Mn([jn.common,jn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wn.linedashed_vert,fragmentShader:Wn.linedashed_frag},depth:{uniforms:Mn([jn.common,jn.displacementmap]),vertexShader:Wn.depth_vert,fragmentShader:Wn.depth_frag},normal:{uniforms:Mn([jn.common,jn.bumpmap,jn.normalmap,jn.displacementmap,{opacity:{value:1}}]),vertexShader:Wn.meshnormal_vert,fragmentShader:Wn.meshnormal_frag},sprite:{uniforms:Mn([jn.sprite,jn.fog]),vertexShader:Wn.sprite_vert,fragmentShader:Wn.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Wn.background_vert,fragmentShader:Wn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Wn.backgroundCube_vert,fragmentShader:Wn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Wn.cube_vert,fragmentShader:Wn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wn.equirect_vert,fragmentShader:Wn.equirect_frag},distanceRGBA:{uniforms:Mn([jn.common,jn.displacementmap,{referencePosition:{value:new _e},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wn.distanceRGBA_vert,fragmentShader:Wn.distanceRGBA_frag},shadow:{uniforms:Mn([jn.lights,jn.fog,{color:{value:new Oi(0)},opacity:{value:1}}]),vertexShader:Wn.shadow_vert,fragmentShader:Wn.shadow_frag}};Xn.physical={uniforms:Mn([Xn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new jt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new Oi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new jt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new Oi(0)},specularColor:{value:new Oi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new jt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:Wn.meshphysical_vert,fragmentShader:Wn.meshphysical_frag};const qn={r:0,b:0,g:0};function Zn(t,e,i,n,r,a,o){const s=new Oi(0);let l,c,h=!0===a?0:1,d=null,u=0,p=null;function f(e,i){e.getRGB(qn,wn(t)),n.buffers.color.setClear(qn.r,qn.g,qn.b,i,o)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),h=e,f(s,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(s,h)},render:function(a,g){let m=!1,b=!0===g.isScene?g.background:null;b&&b.isTexture&&(b=(g.backgroundBlurriness>0?i:e).get(b)),null===b?f(s,h):b&&b.isColor&&(f(b,1),m=!0);const v=t.xr.getEnvironmentBlendMode();"additive"===v?n.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===v&&n.buffers.color.setClear(0,0,0,0,o),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),b&&(b.isCubeTexture||b.mapping===k)?(void 0===c&&(c=new An(new En(1,1,1),new In({name:"BackgroundCubeMaterial",uniforms:Cn(Xn.backgroundCube.uniforms),vertexShader:Xn.backgroundCube.vertexShader,fragmentShader:Xn.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=b,c.material.uniforms.flipEnvMap.value=b.isCubeTexture&&!1===b.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=re.getTransfer(b.colorSpace)!==yt,d===b&&u===b.version&&p===t.toneMapping||(c.material.needsUpdate=!0,d=b,u=b.version,p=t.toneMapping),c.layers.enableAll(),a.unshift(c,c.geometry,c.material,0,0,null)):b&&b.isTexture&&(void 0===l&&(l=new An(new Gn(2,2),new In({name:"BackgroundMaterial",uniforms:Cn(Xn.background.uniforms),vertexShader:Xn.background.vertexShader,fragmentShader:Xn.background.fragmentShader,side:0,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=b,l.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,l.material.toneMapped=re.getTransfer(b.colorSpace)!==yt,!0===b.matrixAutoUpdate&&b.updateMatrix(),l.material.uniforms.uvTransform.value.copy(b.matrix),d===b&&u===b.version&&p===t.toneMapping||(l.material.needsUpdate=!0,d=b,u=b.version,p=t.toneMapping),l.layers.enableAll(),a.unshift(l,l.geometry,l.material,0,0,null))}}}function Yn(t,e,i,n){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),a=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||null!==a,s={},l=p(null);let c=l,h=!1;function d(e){return n.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function p(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function f(){const t=c.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function g(t){m(t,0)}function m(i,r){const a=c.newAttributes,o=c.enabledAttributes,s=c.attributeDivisors;a[i]=1,0===o[i]&&(t.enableVertexAttribArray(i),o[i]=1),s[i]!==r&&((n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),s[i]=r)}function b(){const e=c.newAttributes,i=c.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function v(e,i,n,r,a,o,s){!0===s?t.vertexAttribIPointer(e,i,n,a,o):t.vertexAttribPointer(e,i,n,r,a,o)}function y(){_(),h=!0,c!==l&&(c=l,d(c.object))}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,y,_){let A=!1;if(o){const e=function(e,i,r){const o=!0===r.wireframe;let l=s[e.id];void 0===l&&(l={},s[e.id]=l);let c=l[i.id];void 0===c&&(c={},l[i.id]=c);let h=c[o];return void 0===h&&(h=p(n.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),c[o]=h),h}(y,u,l);c!==e&&(c=e,d(c.object)),A=function(t,e,i,n){const r=c.attributes,a=e.attributes;let o=0;const s=i.getAttributes();for(const e in s)if(s[e].location>=0){const i=r[e];let n=a[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;o++}return c.attributesNum!==o||c.index!==n}(r,y,u,_),A&&function(t,e,i,n){const r={},a=e.attributes;let o=0;const s=i.getAttributes();for(const e in s)if(s[e].location>=0){let i=a[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[e]=n,o++}c.attributes=r,c.attributesNum=o,c.index=n}(r,y,u,_)}else{const t=!0===l.wireframe;c.geometry===y.id&&c.program===u.id&&c.wireframe===t||(c.geometry=y.id,c.program=u.id,c.wireframe=t,A=!0)}null!==_&&i.update(_,t.ELEMENT_ARRAY_BUFFER),(A||h)&&(h=!1,function(r,a,o,s){if(!1===n.isWebGL2&&(r.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;f();const l=s.attributes,c=o.getAttributes(),h=a.defaultAttributeValues;for(const e in c){const a=c[e];if(a.location>=0){let o=l[e];if(void 0===o&&("instanceMatrix"===e&&r.instanceMatrix&&(o=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(o=r.instanceColor)),void 0!==o){const e=o.normalized,l=o.itemSize,c=i.get(o);if(void 0===c)continue;const h=c.buffer,d=c.type,u=c.bytesPerElement,p=!0===n.isWebGL2&&(d===t.INT||d===t.UNSIGNED_INT||1013===o.gpuType);if(o.isInterleavedBufferAttribute){const i=o.data,n=i.stride,c=o.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t<a.locationSize;t++)m(a.location+t,i.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<a.locationSize;t++)g(a.location+t);t.bindBuffer(t.ARRAY_BUFFER,h);for(let t=0;t<a.locationSize;t++)v(a.location+t,l/a.locationSize,d,e,n*u,(c+l/a.locationSize*t)*u,p)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<a.locationSize;t++)m(a.location+t,o.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<a.locationSize;t++)g(a.location+t);t.bindBuffer(t.ARRAY_BUFFER,h);for(let t=0;t<a.locationSize;t++)v(a.location+t,l/a.locationSize,d,e,l*u,l/a.locationSize*t*u,p)}}else if(void 0!==h){const i=h[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(a.location,i);break;case 3:t.vertexAttrib3fv(a.location,i);break;case 4:t.vertexAttrib4fv(a.location,i);break;default:t.vertexAttrib1fv(a.location,i)}}}}b()}(r,l,u,y),null!==_&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i.get(_).buffer))},reset:y,resetDefaultState:_,dispose:function(){y();for(const t in s){const e=s[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const i=s[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:f,enableAttribute:g,disableUnusedAttributes:b}}function Jn(t,e,i,n){const r=n.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,n){t.drawArrays(a,e,n),i.update(n,a,1)},this.renderInstances=function(n,o,s){if(0===s)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](a,n,o,s),i.update(o,a,s)},this.renderMultiDraw=function(t,n,r){if(0===r)return;const o=e.get("WEBGL_multi_draw");if(null===o)for(let e=0;e<r;e++)this.render(t[e],n[e]);else{o.multiDrawArraysWEBGL(a,t,0,n,0,r);let e=0;for(let t=0;t<r;t++)e+=n[t];i.update(e,a,1)}}}function Kn(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name;let o=void 0!==i.precision?i.precision:"highp";const s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=a||e.has("WEBGL_draw_buffers"),c=!0===i.logarithmicDepthBuffer,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),g=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),b=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=d>0,y=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:b,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?t.getParameter(t.MAX_SAMPLES):0}}function $n(t){const e=this;let i=null,n=0,r=!1,a=!1;const o=new On,s=new Xt,l={value:null,needsUpdate:!1};function c(t,i,n,r){const a=null!==t?t.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const e=n+4*a,r=i.matrixWorldInverse;s.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,i=n;e!==a;++e,i+=4)o.copy(t[e]).applyMatrix4(r,s),o.normal.toArray(c,i),c[i+3]=o.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const i=0!==t.length||e||0!==n||r;return r=e,n=t.length,i},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(t,e){i=c(t,e,0)},this.setState=function(o,s,h){const d=o.clippingPlanes,u=o.clipIntersection,p=o.clipShadows,f=t.get(o);if(!r||null===d||0===d.length||a&&!p)a?c(null):(l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0);else{const t=a?0:n,e=4*t;let r=f.clippingState||null;l.value=r,r=c(d,s,e,h);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function tr(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=N:304===e&&(t.mapping=O),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r))return i(e.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const o=new Ln(a.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),r.addEventListener("dispose",n),i(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class er extends Tn{constructor(t=-1,e=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,a=i+t,o=n+e,s=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,o-=e*this.view.offsetY,s=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const ir=[.125,.215,.35,.446,.526,.582],nr=new er,rr=new Oi;let ar=null,or=0,sr=0;const lr=(1+Math.sqrt(5))/2,cr=1/lr,hr=[new _e(1,1,1),new _e(-1,1,1),new _e(1,1,-1),new _e(-1,1,-1),new _e(0,lr,cr),new _e(0,lr,-cr),new _e(cr,0,lr),new _e(-cr,0,lr),new _e(lr,cr,0),new _e(-lr,cr,0)];class dr{constructor(t){this._renderer=t,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(t,e=0,i=.1,n=100){ar=this._renderer.getRenderTarget(),or=this._renderer.getActiveCubeFace(),sr=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=gr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=fr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(ar,or,sr),t.scissorTest=!1,pr(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===N||t.mapping===O?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ar=this._renderer.getRenderTarget(),or=this._renderer.getActiveCubeFace(),sr=this._renderer.getActiveMipmapLevel();const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:j,minFilter:j,generateMipmaps:!1,type:$,format:et,colorSpace:gt,depthBuffer:!1},n=ur(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=ur(t,e,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let r=t;const a=t-4+1+ir.length;for(let o=0;o<a;o++){const a=Math.pow(2,r);i.push(a);let s=1/a;o>t-4?s=ir[o-t+4-1]:0===o&&(s=0),n.push(s);const l=1/(a-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,f=3,g=2,m=1,b=new Float32Array(f*p*u),v=new Float32Array(g*p*u),y=new Float32Array(m*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];b.set(n,f*p*t),v.set(d,g*p*t);const r=[t,t,t,t,t,t];y.set(r,m*p*t)}const _=new nn;_.setAttribute("position",new Wi(b,f)),_.setAttribute("uv",new Wi(v,g)),_.setAttribute("faceIndex",new Wi(y,m)),e.push(_),r>4&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(20),r=new _e(0,1,0);return new In({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(n,t,e)}return n}_compileMaterial(t){const e=new An(this._lodPlanes[0],t);this._renderer.compile(e,nr)}_sceneToCubeUV(t,e,i,n){const r=new Un(90,1,e,i),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.toneMapping;s.getClearColor(rr),s.toneMapping=F,s.autoClear=!1;const h=new Vi({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new An(new En,h);let u=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,u=!0):(h.color.copy(rr),u=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(r.up.set(0,a[e],0),r.lookAt(o[e],0,0)):1===i?(r.up.set(0,0,a[e]),r.lookAt(0,o[e],0)):(r.up.set(0,a[e],0),r.lookAt(0,0,o[e]));const l=this._cubeSize;pr(n,i*l,e>2?l:0,l,l),s.setRenderTarget(n),u&&s.render(d,r),s.render(t,r)}d.geometry.dispose(),d.material.dispose(),s.toneMapping=c,s.autoClear=l,t.background=p}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===N||t.mapping===O;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=gr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=fr());const r=n?this._cubemapMaterial:this._equirectMaterial,a=new An(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const o=this._cubeSize;pr(e,0,0,3*o,2*o),i.setRenderTarget(e),i.render(a,nr)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),n=hr[(e-1)%hr.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,i,n,"latitudinal",r),this._halfBlur(a,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new An(this._lodPlanes[n],l),h=l.uniforms,d=this._sizeLods[i]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const g=[];let m=0;for(let t=0;t<20;++t){const e=t/p,i=Math.exp(-e*e/2);g.push(i),0===t?m+=i:t<f&&(m+=2*i)}for(let t=0;t<g.length;t++)g[t]=g[t]/m;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=g,h.latitudinal.value="latitudinal"===a,o&&(h.poleAxis.value=o);const{_lodMax:b}=this;h.dTheta.value=u,h.mipInt.value=b-i;const v=this._sizeLods[n];pr(e,3*v*(n>b-4?n-b+4:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(e),s.render(c,nr)}}function ur(t,e,i){const n=new me(t,e,i);return n.texture.mapping=k,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function pr(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function fr(){return new In({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function gr(){return new In({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function mr(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,o=303===a||304===a,s=a===N||a===O;if(o||s){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=e.get(r);return null===i&&(i=new dr(t)),n=o?i.fromEquirectangular(r,n):i.fromCubemap(r,n),e.set(r,n),n.texture}if(e.has(r))return e.get(r).texture;{const a=r.image;if(o&&a&&a.height>0||s&&a&&function(t){let e=0;for(let i=0;i<6;i++)void 0!==t[i]&&e++;return 6===e}(a)){null===i&&(i=new dr(t));const a=o?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,a),r.addEventListener("dispose",n),a.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function br(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=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":n=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":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function vr(t,e,i,n){const r={},a=new WeakMap;function o(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);for(const t in s.morphAttributes){const i=s.morphAttributes[t];for(let t=0,n=i.length;t<n;t++)e.remove(i[t])}s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(e.remove(l),a.delete(s)),n.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,i.memory.geometries--}function s(t){const i=[],n=t.index,r=t.attributes.position;let o=0;if(null!==n){const t=n.array;o=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],a=t[e+2];i.push(n,r,r,a,a,n)}}else{if(void 0===r)return;{const t=r.array;o=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}}const s=new(Zt(i)?Xi:ji)(i,1);s.version=o;const l=a.get(t);l&&e.remove(l),a.set(t,s)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,i.memory.geometries++),e},update:function(i){const n=i.attributes;for(const i in n)e.update(n[i],t.ARRAY_BUFFER);const r=i.morphAttributes;for(const i in r){const n=r[i];for(let i=0,r=n.length;i<r;i++)e.update(n[i],t.ARRAY_BUFFER)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&s(t)}else s(t);return a.get(t)}}}function yr(t,e,i,n){const r=n.isWebGL2;let a,o,s;this.setMode=function(t){a=t},this.setIndex=function(t){o=t.type,s=t.bytesPerElement},this.render=function(e,n){t.drawElements(a,n,o,e*s),i.update(n,a,1)},this.renderInstances=function(n,l,c){if(0===c)return;let h,d;if(r)h=t,d="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](a,l,o,n*s,c),i.update(l,a,c)},this.renderMultiDraw=function(t,n,r){if(0===r)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<r;e++)this.render(t[e]/s,n[e]);else{l.multiDrawElementsWEBGL(a,n,0,o,t,0,r);let e=0;for(let t=0;t<r;t++)e+=n[t];i.update(e,a,1)}}}function _r(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(i,n,r){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=r*(i/3);break;case t.LINES:e.lines+=r*(i/2);break;case t.LINE_STRIP:e.lines+=r*(i-1);break;case t.LINE_LOOP:e.lines+=r*i;break;case t.POINTS:e.points+=r*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Ar(t,e){return t[0]-e[0]}function xr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Er(t,e,i){const n={},r=new Float32Array(8),a=new WeakMap,o=new fe,s=[];for(let t=0;t<8;t++)s[t]=[t,0];return{update:function(l,c,h){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const u=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,p=void 0!==u?u.length:0;let f=a.get(c);if(void 0===f||f.count!==p){void 0!==f&&f.texture.dispose();const b=void 0!==c.morphAttributes.position,v=void 0!==c.morphAttributes.normal,y=void 0!==c.morphAttributes.color,_=c.morphAttributes.position||[],A=c.morphAttributes.normal||[],x=c.morphAttributes.color||[];let E=0;!0===b&&(E=1),!0===v&&(E=2),!0===y&&(E=3);let C=c.attributes.position.count*E,M=1;C>e.maxTextureSize&&(M=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const w=new Float32Array(C*M*4*p),S=new be(w,C,M,p);S.type=K,S.needsUpdate=!0;const I=4*E;for(let U=0;U<p;U++){const F=_[U],B=A[U],R=x[U],L=C*M*4*U;for(let D=0;D<F.count;D++){const P=D*I;!0===b&&(o.fromBufferAttribute(F,D),w[L+P+0]=o.x,w[L+P+1]=o.y,w[L+P+2]=o.z,w[L+P+3]=0),!0===v&&(o.fromBufferAttribute(B,D),w[L+P+4]=o.x,w[L+P+5]=o.y,w[L+P+6]=o.z,w[L+P+7]=0),!0===y&&(o.fromBufferAttribute(R,D),w[L+P+8]=o.x,w[L+P+9]=o.y,w[L+P+10]=o.z,w[L+P+11]=4===R.itemSize?o.w:1)}}function T(){S.dispose(),a.delete(c),c.removeEventListener("dispose",T)}f={count:p,texture:S,size:new jt(C,M)},a.set(c,f),c.addEventListener("dispose",T)}let g=0;for(let N=0;N<d.length;N++)g+=d[N];const m=c.morphTargetsRelative?1:1-g;h.getUniforms().setValue(t,"morphTargetBaseInfluence",m),h.getUniforms().setValue(t,"morphTargetInfluences",d),h.getUniforms().setValue(t,"morphTargetsTexture",f.texture,i),h.getUniforms().setValue(t,"morphTargetsTextureSize",f.size)}else{const O=void 0===d?0:d.length;let k=n[c.id];if(void 0===k||k.length!==O){k=[];for(let G=0;G<O;G++)k[G]=[G,0];n[c.id]=k}for(let W=0;W<O;W++){const j=k[W];j[0]=W,j[1]=d[W]}k.sort(xr);for(let X=0;X<8;X++)X<O&&k[X][1]?(s[X][0]=k[X][0],s[X][1]=k[X][1]):(s[X][0]=Number.MAX_SAFE_INTEGER,s[X][1]=0);s.sort(Ar);const z=c.morphAttributes.position,Q=c.morphAttributes.normal;let V=0;for(let q=0;q<8;q++){const Z=s[q],Y=Z[0],J=Z[1];Y!==Number.MAX_SAFE_INTEGER&&J?(z&&c.getAttribute("morphTarget"+q)!==z[Y]&&c.setAttribute("morphTarget"+q,z[Y]),Q&&c.getAttribute("morphNormal"+q)!==Q[Y]&&c.setAttribute("morphNormal"+q,Q[Y]),r[q]=J,V+=J):(z&&!0===c.hasAttribute("morphTarget"+q)&&c.deleteAttribute("morphTarget"+q),Q&&!0===c.hasAttribute("morphNormal"+q)&&c.deleteAttribute("morphNormal"+q),r[q]=0)}const H=c.morphTargetsRelative?1:1-V;h.getUniforms().setValue(t,"morphTargetBaseInfluence",H),h.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function Cr(t,e,i,n){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(o){const s=n.render.frame,l=o.geometry,c=e.get(o,l);if(r.get(c)!==s&&(e.update(c),r.set(c,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),r.get(o)!==s&&(i.update(o.instanceMatrix,t.ARRAY_BUFFER),null!==o.instanceColor&&i.update(o.instanceColor,t.ARRAY_BUFFER),r.set(o,s))),o.isSkinnedMesh){const t=o.skeleton;r.get(t)!==s&&(t.update(),r.set(t,s))}return c},dispose:function(){r=new WeakMap}}}class Mr extends pe{constructor(t,e,i,n,r,a,o,s,l,c){if((c=void 0!==c?c:it)!==it&&c!==nt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&c===it&&(i=J),void 0===i&&c===nt&&(i=tt),super(null,n,r,a,o,s,c,i,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==o?o:H,this.minFilter=void 0!==s?s:H,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}const wr=new pe,Sr=new Mr(1,1);Sr.compareFunction=515;const Ir=new be,Tr=new ve,Ur=new Rn,Fr=[],Br=[],Rr=new Float32Array(16),Lr=new Float32Array(9),Dr=new Float32Array(4);function Pr(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let a=Fr[r];if(void 0===a&&(a=new Float32Array(r),Fr[r]=a),0!==e){n.toArray(a,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(a,r)}return a}function Nr(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Or(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function kr(t,e){let i=Br[e];void 0===i&&(i=new Int32Array(e),Br[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function zr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Qr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Nr(i,e))return;t.uniform2fv(this.addr,e),Or(i,e)}}function Vr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Nr(i,e))return;t.uniform3fv(this.addr,e),Or(i,e)}}function Hr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Nr(i,e))return;t.uniform4fv(this.addr,e),Or(i,e)}}function Gr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Nr(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Or(i,e)}else{if(Nr(i,n))return;Dr.set(n),t.uniformMatrix2fv(this.addr,!1,Dr),Or(i,n)}}function Wr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Nr(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Or(i,e)}else{if(Nr(i,n))return;Lr.set(n),t.uniformMatrix3fv(this.addr,!1,Lr),Or(i,n)}}function jr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Nr(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Or(i,e)}else{if(Nr(i,n))return;Rr.set(n),t.uniformMatrix4fv(this.addr,!1,Rr),Or(i,n)}}function Xr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function qr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Nr(i,e))return;t.uniform2iv(this.addr,e),Or(i,e)}}function Zr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Nr(i,e))return;t.uniform3iv(this.addr,e),Or(i,e)}}function Yr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Nr(i,e))return;t.uniform4iv(this.addr,e),Or(i,e)}}function Jr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Kr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Nr(i,e))return;t.uniform2uiv(this.addr,e),Or(i,e)}}function $r(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Nr(i,e))return;t.uniform3uiv(this.addr,e),Or(i,e)}}function ta(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Nr(i,e))return;t.uniform4uiv(this.addr,e),Or(i,e)}}function ea(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r);const a=this.type===t.SAMPLER_2D_SHADOW?Sr:wr;i.setTexture2D(e||a,r)}function ia(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||Tr,r)}function na(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||Ur,r)}function ra(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||Ir,r)}function aa(t,e){t.uniform1fv(this.addr,e)}function oa(t,e){const i=Pr(e,this.size,2);t.uniform2fv(this.addr,i)}function sa(t,e){const i=Pr(e,this.size,3);t.uniform3fv(this.addr,i)}function la(t,e){const i=Pr(e,this.size,4);t.uniform4fv(this.addr,i)}function ca(t,e){const i=Pr(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function ha(t,e){const i=Pr(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function da(t,e){const i=Pr(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function ua(t,e){t.uniform1iv(this.addr,e)}function pa(t,e){t.uniform2iv(this.addr,e)}function fa(t,e){t.uniform3iv(this.addr,e)}function ga(t,e){t.uniform4iv(this.addr,e)}function ma(t,e){t.uniform1uiv(this.addr,e)}function ba(t,e){t.uniform2uiv(this.addr,e)}function va(t,e){t.uniform3uiv(this.addr,e)}function ya(t,e){t.uniform4uiv(this.addr,e)}function _a(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTexture2D(e[t]||wr,a[t])}function Aa(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTexture3D(e[t]||Tr,a[t])}function xa(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTextureCube(e[t]||Ur,a[t])}function Ea(t,e,i){const n=this.cache,r=e.length,a=kr(i,r);Nr(n,a)||(t.uniform1iv(this.addr,a),Or(n,a));for(let t=0;t!==r;++t)i.setTexture2DArray(e[t]||Ir,a[t])}class Ca{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return zr;case 35664:return Qr;case 35665:return Vr;case 35666:return Hr;case 35674:return Gr;case 35675:return Wr;case 35676:return jr;case 5124:case 35670:return Xr;case 35667:case 35671:return qr;case 35668:case 35672:return Zr;case 35669:case 35673:return Yr;case 5125:return Jr;case 36294:return Kr;case 36295:return $r;case 36296:return ta;case 35678:case 36198:case 36298:case 36306:case 35682:return ea;case 35679:case 36299:case 36307:return ia;case 35680:case 36300:case 36308:case 36293:return na;case 36289:case 36303:case 36311:case 36292:return ra}}(e.type)}}class Ma{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return aa;case 35664:return oa;case 35665:return sa;case 35666:return la;case 35674:return ca;case 35675:return ha;case 35676:return da;case 5124:case 35670:return ua;case 35667:case 35671:return pa;case 35668:case 35672:return fa;case 35669:case 35673:return ga;case 5125:return ma;case 36294:return ba;case 36295:return va;case 36296:return ya;case 35678:case 36198:case 36298:case 36306:case 35682:return _a;case 35679:case 36299:case 36307:return Aa;case 35680:case 36300:case 36308:case 36293:return xa;case 36289:case 36303:case 36311:case 36292:return Ea}}(e.type)}}class wa{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const n=this.seq;for(let r=0,a=n.length;r!==a;++r){const a=n[r];a.setValue(t,e[a.id],i)}}}const Sa=/(\w+)(\])?(\[|\.)?/g;function Ia(t,e){t.seq.push(e),t.map[e.id]=e}function Ta(t,e,i){const n=t.name,r=n.length;for(Sa.lastIndex=0;;){const a=Sa.exec(n),o=Sa.lastIndex;let s=a[1];const l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){Ia(i,void 0===c?new Ca(s,t,e):new Ma(s,t,e));break}{let t=i.map[s];void 0===t&&(t=new wa(s),Ia(i,t)),i=t}}}class Ua{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Ta(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let r=0,a=e.length;r!==a;++r){const a=e[r],o=i[a.id];!1!==o.needsUpdate&&a.setValue(t,o.value,n)}}static seqWithValue(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i}}function Fa(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}const Ba=37297;let Ra=0;function La(t,e,i){const n=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const n=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const i=t.split("\n"),n=[],r=Math.max(e-6,0),a=Math.min(e+6,i.length);for(let t=r;t<a;t++){const r=t+1;n.push(`${r===e?">":" "} ${r}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return r}function Da(t,e){const i=function(t){const e=re.getPrimaries(re.workingColorSpace),i=re.getPrimaries(t);let n;switch(e===i?n="":e===At&&i===_t?n="LinearDisplayP3ToLinearSRGB":e===_t&&i===At&&(n="LinearSRGBToLinearDisplayP3"),t){case gt:case bt:return[n,"LinearTransferOETF"];case ft:case mt:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[n,"LinearTransferOETF"]}}(e);return`vec4 ${t}( vec4 value ) { return ${i[0]}( ${i[1]}( value ) ); }`}function Pa(t,e){let i;switch(e){case B:i="Linear";break;case R:i="Reinhard";break;case L:i="OptimizedCineon";break;case D:i="ACESFilmic";break;case P:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Na(t){return""!==t}function Oa(t,e){const i=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,i).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 ka(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const za=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qa(t){return t.replace(za,Ha)}const Va=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Ha(t,e){let i=Wn[e];if(void 0===i){const t=Va.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");i=Wn[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Qa(i)}const Ga=/#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 Wa(t){return t.replace(Ga,ja)}function ja(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Xa(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function qa(t,e,i,n){const s=t.getContext(),l=i.defines;let c=i.vertexShader,h=i.fragmentShader;const d=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===r?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===a?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===o&&(e="SHADOWMAP_TYPE_VSM"),e}(i),u=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case N:case O:e="ENVMAP_TYPE_CUBE";break;case k:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),p=function(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===O&&(e="ENVMAP_MODE_REFRACTION"),e}(i),f=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case I:e="ENVMAP_BLENDING_MULTIPLY";break;case T:e="ENVMAP_BLENDING_MIX";break;case U:e="ENVMAP_BLENDING_ADD"}return e}(i),g=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),m=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Na).join("\n")}(i),b=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(l),v=s.createProgram();let y,_,A=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(y=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b].filter(Na).join("\n"),y.length>0&&(y+="\n"),_=[m,"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b].filter(Na).join("\n"),_.length>0&&(_+="\n")):(y=[Xa(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b,i.batching?"#define USE_BATCHING":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+p:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Na).join("\n"),_=[m,Xa(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.envMap?"#define "+p:"",i.envMap?"#define "+f:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==F?"#define TONE_MAPPING":"",i.toneMapping!==F?Wn.tonemapping_pars_fragment:"",i.toneMapping!==F?Pa("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Wn.colorspace_pars_fragment,Da("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Na).join("\n")),c=Qa(c),c=Oa(c,i),c=ka(c,i),h=Qa(h),h=Oa(h,i),h=ka(h,i),c=Wa(c),h=Wa(h),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(A="#version 300 es\n",y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,_=["precision mediump sampler2DArray;","#define varying in",i.glslVersion===Ft?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===Ft?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+_);const x=A+y+c,E=A+_+h,C=Fa(s,s.VERTEX_SHADER,x),M=Fa(s,s.FRAGMENT_SHADER,E);function w(e){if(t.debug.checkShaderErrors){const i=s.getProgramInfoLog(v).trim(),n=s.getShaderInfoLog(C).trim(),r=s.getShaderInfoLog(M).trim();let a=!0,o=!0;if(!1===s.getProgramParameter(v,s.LINK_STATUS))if(a=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(s,v,C,M);else{const t=La(s,C,"vertex"),e=La(s,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(v,s.VALIDATE_STATUS)+"\n\nProgram Info Log: "+i+"\n"+t+"\n"+e)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):""!==n&&""!==r||(o=!1);o&&(e.diagnostics={runnable:a,programLog:i,vertexShader:{log:n,prefix:y},fragmentShader:{log:r,prefix:_}})}s.deleteShader(C),s.deleteShader(M),S=new Ua(s,v),B=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r),a=n.name;let o=1;n.type===t.FLOAT_MAT2&&(o=2),n.type===t.FLOAT_MAT3&&(o=3),n.type===t.FLOAT_MAT4&&(o=4),i[a]={type:n.type,location:t.getAttribLocation(e,a),locationSize:o}}return i}(s,v)}let S,B;s.attachShader(v,C),s.attachShader(v,M),void 0!==i.index0AttributeName?s.bindAttribLocation(v,0,i.index0AttributeName):!0===i.morphTargets&&s.bindAttribLocation(v,0,"position"),s.linkProgram(v),this.getUniforms=function(){return void 0===S&&w(this),S},this.getAttributes=function(){return void 0===B&&w(this),B};let R=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===R&&(R=s.getProgramParameter(v,Ba)),R},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(v),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=Ra++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=C,this.fragmentShader=M,this}let Za=0;class Ya{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(t);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new Ja(t),e.set(t,i)),i}}class Ja{constructor(t){this.id=Za++,this.code=t,this.usedTimes=0}}function Ka(t,e,i,n,r,a,o){const s=new si,l=new Ya,c=[],h=r.isWebGL2,d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const f={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 g(t){return 0===t?"uv":`uv${t}`}return{getParameters:function(a,s,c,m,b){const v=m.fog,y=b.geometry,_=a.isMeshStandardMaterial?m.environment:null,A=(a.isMeshStandardMaterial?i:e).get(a.envMap||_),x=A&&A.mapping===k?A.image.height:null,E=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead."));const C=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,M=void 0!==C?C.length:0;let w,S,I,T,U=0;if(void 0!==y.morphAttributes.position&&(U=1),void 0!==y.morphAttributes.normal&&(U=2),void 0!==y.morphAttributes.color&&(U=3),E){const t=Xn[E];w=t.vertexShader,S=t.fragmentShader}else w=a.vertexShader,S=a.fragmentShader,l.update(a),I=l.getVertexShaderID(a),T=l.getFragmentShaderID(a);const B=t.getRenderTarget(),R=!0===b.isInstancedMesh,L=!0===b.isBatchedMesh,D=!!a.map,P=!!a.matcap,N=!!A,O=!!a.aoMap,z=!!a.lightMap,Q=!!a.bumpMap,V=!!a.normalMap,H=!!a.displacementMap,G=!!a.emissiveMap,W=!!a.metalnessMap,j=!!a.roughnessMap,X=a.anisotropy>0,q=a.clearcoat>0,Z=a.iridescence>0,Y=a.sheen>0,J=a.transmission>0,K=X&&!!a.anisotropyMap,$=q&&!!a.clearcoatMap,tt=q&&!!a.clearcoatNormalMap,et=q&&!!a.clearcoatRoughnessMap,it=Z&&!!a.iridescenceMap,nt=Z&&!!a.iridescenceThicknessMap,rt=Y&&!!a.sheenColorMap,at=Y&&!!a.sheenRoughnessMap,ot=!!a.specularMap,st=!!a.specularColorMap,lt=!!a.specularIntensityMap,ct=J&&!!a.transmissionMap,ht=J&&!!a.thicknessMap,dt=!!a.gradientMap,ut=!!a.alphaMap,pt=a.alphaTest>0,ft=!!a.alphaHash,mt=!!a.extensions,bt=!!y.attributes.uv1,vt=!!y.attributes.uv2,_t=!!y.attributes.uv3;let At=F;return a.toneMapped&&(null!==B&&!0!==B.isXRRenderTarget||(At=t.toneMapping)),{isWebGL2:h,shaderID:E,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:S,defines:a.defines,customVertexShaderID:I,customFragmentShaderID:T,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:L,instancing:R,instancingColor:R&&null!==b.instanceColor,supportsVertexTextures:u,outputColorSpace:null===B?t.outputColorSpace:!0===B.isXRRenderTarget?B.texture.colorSpace:gt,map:D,matcap:P,envMap:N,envMapMode:N&&A.mapping,envMapCubeUVHeight:x,aoMap:O,lightMap:z,bumpMap:Q,normalMap:V,displacementMap:u&&H,emissiveMap:G,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:W,roughnessMap:j,anisotropy:X,anisotropyMap:K,clearcoat:q,clearcoatMap:$,clearcoatNormalMap:tt,clearcoatRoughnessMap:et,iridescence:Z,iridescenceMap:it,iridescenceThicknessMap:nt,sheen:Y,sheenColorMap:rt,sheenRoughnessMap:at,specularMap:ot,specularColorMap:st,specularIntensityMap:lt,transmission:J,transmissionMap:ct,thicknessMap:ht,gradientMap:dt,opaque:!1===a.transparent&&1===a.blending,alphaMap:ut,alphaTest:pt,alphaHash:ft,combine:a.combine,mapUv:D&&g(a.map.channel),aoMapUv:O&&g(a.aoMap.channel),lightMapUv:z&&g(a.lightMap.channel),bumpMapUv:Q&&g(a.bumpMap.channel),normalMapUv:V&&g(a.normalMap.channel),displacementMapUv:H&&g(a.displacementMap.channel),emissiveMapUv:G&&g(a.emissiveMap.channel),metalnessMapUv:W&&g(a.metalnessMap.channel),roughnessMapUv:j&&g(a.roughnessMap.channel),anisotropyMapUv:K&&g(a.anisotropyMap.channel),clearcoatMapUv:$&&g(a.clearcoatMap.channel),clearcoatNormalMapUv:tt&&g(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:et&&g(a.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&g(a.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&g(a.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&g(a.sheenColorMap.channel),sheenRoughnessMapUv:at&&g(a.sheenRoughnessMap.channel),specularMapUv:ot&&g(a.specularMap.channel),specularColorMapUv:st&&g(a.specularColorMap.channel),specularIntensityMapUv:lt&&g(a.specularIntensityMap.channel),transmissionMapUv:ct&&g(a.transmissionMap.channel),thicknessMapUv:ht&&g(a.thicknessMap.channel),alphaMapUv:ut&&g(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(V||X),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUv1s:bt,vertexUv2s:vt,vertexUv3s:_t,pointsUvs:!0===b.isPoints&&!!y.attributes.uv&&(D||ut),fog:!!v,useFog:!0===a.fog,fogExp2:v&&v.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===b.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:M,morphTextureStride:U,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:At,useLegacyLights:t._useLegacyLights,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&re.getTransfer(a.map.colorSpace)===yt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:mt&&!0===a.extensions.derivatives,extensionFragDepth:mt&&!0===a.extensions.fragDepth,extensionDrawBuffers:mt&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:mt&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){s.disableAll(),e.isWebGL2&&s.enable(0),e.supportsVertexTextures&&s.enable(1),e.instancing&&s.enable(2),e.instancingColor&&s.enable(3),e.matcap&&s.enable(4),e.envMap&&s.enable(5),e.normalMapObjectSpace&&s.enable(6),e.normalMapTangentSpace&&s.enable(7),e.clearcoat&&s.enable(8),e.iridescence&&s.enable(9),e.alphaTest&&s.enable(10),e.vertexColors&&s.enable(11),e.vertexAlphas&&s.enable(12),e.vertexUv1s&&s.enable(13),e.vertexUv2s&&s.enable(14),e.vertexUv3s&&s.enable(15),e.vertexTangents&&s.enable(16),e.anisotropy&&s.enable(17),e.alphaHash&&s.enable(18),e.batching&&s.enable(19),t.push(s.mask),s.disableAll(),e.fog&&s.enable(0),e.useFog&&s.enable(1),e.flatShading&&s.enable(2),e.logarithmicDepthBuffer&&s.enable(3),e.skinning&&s.enable(4),e.morphTargets&&s.enable(5),e.morphNormals&&s.enable(6),e.morphColors&&s.enable(7),e.premultipliedAlpha&&s.enable(8),e.shadowMapEnabled&&s.enable(9),e.useLegacyLights&&s.enable(10),e.doubleSided&&s.enable(11),e.flipSided&&s.enable(12),e.useDepthPacking&&s.enable(13),e.dithering&&s.enable(14),e.transmission&&s.enable(15),e.sheen&&s.enable(16),e.opaque&&s.enable(17),e.pointsUvs&&s.enable(18),e.decodeVideoTexture&&s.enable(19),t.push(s.mask)}(i,e),i.push(t.outputColorSpace)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=f[t.type];let i;if(e){const t=Xn[e];i=Sn.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new qa(t,i,e,a),c.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=c.indexOf(t);c[e]=c[c.length-1],c.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:c,dispose:function(){l.dispose()}}}function $a(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function to(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 eo(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 io(){const t=[];let e=0;const i=[],n=[],r=[];function a(i,n,r,a,o,s){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:a,renderOrder:i.renderOrder,z:o,group:s},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=o,l.group=s),e++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){e=0,i.length=0,n.length=0,r.length=0},push:function(t,e,o,s,l,c){const h=a(t,e,o,s,l,c);o.transmission>0?n.push(h):!0===o.transparent?r.push(h):i.push(h)},unshift:function(t,e,o,s,l,c){const h=a(t,e,o,s,l,c);o.transmission>0?n.unshift(h):!0===o.transparent?r.unshift(h):i.unshift(h)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||to),n.length>1&&n.sort(e||eo),r.length>1&&r.sort(e||eo)}}}function no(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let r;return void 0===n?(r=new io,t.set(e,[r])):i>=n.length?(r=new io,n.push(r)):r=n[i],r},dispose:function(){t=new WeakMap}}}function ro(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new _e,color:new Oi};break;case"SpotLight":i={position:new _e,direction:new _e,color:new Oi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new _e,color:new Oi,distance:0,decay:0};break;case"HemisphereLight":i={direction:new _e,skyColor:new Oi,groundColor:new Oi};break;case"RectAreaLight":i={color:new Oi,position:new _e,halfWidth:new _e,halfHeight:new _e}}return t[e.id]=i,i}}}let ao=0;function oo(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function so(t,e){const i=new ro,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)r.probe.push(new _e);const a=new _e,o=new Ye,s=new Ye;return{setup:function(a,o){let s=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,d=0,u=0,p=0,f=0,g=0,m=0,b=0,v=0,y=0,_=0;a.sort(oo);const A=!0===o?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],o=e.color,x=e.intensity,E=e.distance,C=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=o.r*x*A,l+=o.g*x*A,c+=o.b*x*A;else if(e.isLightProbe){for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],x);_++}else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*A),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[h]=i,r.directionalShadowMap[h]=C,r.directionalShadowMatrix[h]=e.shadow.matrix,g++}r.directional[h]=t,h++}else if(e.isSpotLight){const t=i.get(e);t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(o).multiplyScalar(x*A),t.distance=E,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,r.spot[u]=t;const a=e.shadow;if(e.map&&(r.spotLightMap[v]=e.map,v++,a.updateMatrices(e),e.castShadow&&y++),r.spotLightMatrix[u]=a.matrix,e.castShadow){const t=n.get(e);t.shadowBias=a.bias,t.shadowNormalBias=a.normalBias,t.shadowRadius=a.radius,t.shadowMapSize=a.mapSize,r.spotShadow[u]=t,r.spotShadowMap[u]=C,b++}u++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(o).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*A),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[d]=i,r.pointShadowMap[d]=C,r.pointShadowMatrix[d]=e.shadow.matrix,m++}r.point[d]=t,d++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(x*A),t.groundColor.copy(e.groundColor).multiplyScalar(x*A),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=jn.LTC_FLOAT_1,r.rectAreaLTC2=jn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=jn.LTC_HALF_1,r.rectAreaLTC2=jn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=l,r.ambient[2]=c;const x=r.hash;x.directionalLength===h&&x.pointLength===d&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===f&&x.numDirectionalShadows===g&&x.numPointShadows===m&&x.numSpotShadows===b&&x.numSpotMaps===v&&x.numLightProbes===_||(r.directional.length=h,r.spot.length=u,r.rectArea.length=p,r.point.length=d,r.hemi.length=f,r.directionalShadow.length=g,r.directionalShadowMap.length=g,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=g,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=b+v-y,r.spotLightMap.length=v,r.numSpotLightShadowsWithMaps=y,r.numLightProbes=_,x.directionalLength=h,x.pointLength=d,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=f,x.numDirectionalShadows=g,x.numPointShadows=m,x.numSpotShadows=b,x.numSpotMaps=v,x.numLightProbes=_,r.version=ao++)},setupView:function(t,e){let i=0,n=0,l=0,c=0,h=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(u.matrixWorld),a.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(d),i++}else if(u.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(u.matrixWorld),a.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const t=r.rectArea[c];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),s.identity(),o.copy(u.matrixWorld),o.premultiply(d),s.extractRotation(o),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),c++}else if(u.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),n++}else if(u.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(d),h++}}},state:r}}function lo(t,e){const i=new so(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(t){i.setup(n,t)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function co(t,e){let i=new WeakMap;return{get:function(n,r=0){const a=i.get(n);let o;return void 0===a?(o=new lo(t,e),i.set(n,[o])):r>=a.length?(o=new lo(t,e),a.push(o)):o=a[r],o},dispose:function(){i=new WeakMap}}}class ho extends Qi{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class uo extends Qi{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function po(t,e,i){let n=new Qn;const a=new jt,h=new jt,d=new fe,u=new ho({depthPacking:3201}),p=new uo,f={},g=i.maxTextureSize,m={[s]:1,[l]:0,[c]:2},b=new In({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new jt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=b.clone();v.defines.HORIZONTAL_PASS=1;const y=new nn;y.setAttribute("position",new Wi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new An(y,b),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=r;let x=this.type;function E(i,n){const r=e.update(_);b.defines.VSM_SAMPLES!==i.blurSamples&&(b.defines.VSM_SAMPLES=i.blurSamples,v.defines.VSM_SAMPLES=i.blurSamples,b.needsUpdate=!0,v.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new me(a.x,a.y)),b.uniforms.shadow_pass.value=i.map.texture,b.uniforms.resolution.value=i.mapSize,b.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,b,_,null),v.uniforms.shadow_pass.value=i.mapPass.texture,v.uniforms.resolution.value=i.mapSize,v.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,v,_,null)}function C(e,i,n,r){let a=null;const s=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===n.isPointLight?p:u,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){const t=a.uuid,e=i.uuid;let n=f[t];void 0===n&&(n={},f[t]=n);let r=n[e];void 0===r&&(r=a.clone(),n[e]=r),a=r}return a.visible=i.visible,a.wireframe=i.wireframe,a.side=r===o?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:m[i.side],a.alphaMap=i.alphaMap,a.alphaTest=i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial&&(t.properties.get(a).light=n),a}function M(i,r,a,s,l){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);const n=e.update(i),o=i.material;if(Array.isArray(o)){const e=n.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],d=o[h.materialIndex];if(d&&d.visible){const e=C(i,d,s,l);i.onBeforeShadow(t,i,r,a,n,e,h),t.renderBufferDirect(a,null,n,e,i,h),i.onAfterShadow(t,i,r,a,n,e,h)}}}else if(o.visible){const e=C(i,o,s,l);i.onBeforeShadow(t,i,r,a,n,e,null),t.renderBufferDirect(a,null,n,e,i,null),i.onAfterShadow(t,i,r,a,n,e,null)}}const c=i.children;for(let t=0,e=c.length;t<e;t++)M(c[t],r,a,s,l)}this.render=function(e,i,r){if(!1===A.enabled)return;if(!1===A.autoUpdate&&!1===A.needsUpdate)return;if(0===e.length)return;const s=t.getRenderTarget(),l=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),u=t.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const p=x!==o&&this.type===o,f=x===o&&this.type!==o;for(let s=0,l=e.length;s<l;s++){const l=e[s],c=l.shadow;if(void 0===c){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===c.autoUpdate&&!1===c.needsUpdate)continue;a.copy(c.mapSize);const m=c.getFrameExtents();if(a.multiply(m),h.copy(c.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(h.x=Math.floor(g/m.x),a.x=h.x*m.x,c.mapSize.x=h.x),a.y>g&&(h.y=Math.floor(g/m.y),a.y=h.y*m.y,c.mapSize.y=h.y)),null===c.map||!0===p||!0===f){const t=this.type!==o?{minFilter:H,magFilter:H}:{};null!==c.map&&c.map.dispose(),c.map=new me(a.x,a.y,t),c.map.texture.name=l.name+".shadowMap",c.camera.updateProjectionMatrix()}t.setRenderTarget(c.map),t.clear();const b=c.getViewportCount();for(let t=0;t<b;t++){const e=c.getViewport(t);d.set(h.x*e.x,h.y*e.y,h.x*e.z,h.y*e.w),u.viewport(d),c.updateMatrices(l,t),n=c.getFrustum(),M(i,r,c.camera,l,this.type)}!0!==c.isPointLightShadow&&this.type===o&&E(c,r),c.needsUpdate=!1}x=this.type,A.needsUpdate=!1,t.setRenderTarget(s,l,c)}}function fo(t,e,i){const n=i.isWebGL2,r=new function(){let e=!1;const i=new fe;let n=null;const r=new fe(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,o,s){!0===s&&(e*=o,n*=o,a*=o),i.set(e,n,a,o),!1===r.equals(i)&&(t.clearColor(e,n,a,o),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},a=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(e){e?ot(t.DEPTH_TEST):st(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},o=new function(){let e=!1,i=null,n=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(i){e||(i?ot(t.STENCIL_TEST):st(t.STENCIL_TEST))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,o){n===e&&r===i&&a===o||(t.stencilFunc(e,i,o),n=e,r=i,a=o)},setOp:function(e,i,n){o===e&&s===i&&l===n||(t.stencilOp(e,i,n),o=e,s=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,o=null,s=null,l=null,c=null}}},s=new WeakMap,l=new WeakMap;let c={},I={},T=new WeakMap,U=[],F=null,B=!1,R=null,L=null,D=null,P=null,N=null,O=null,k=null,z=new Oi(0,0,0),Q=0,V=!1,H=null,G=null,W=null,j=null,X=null;const q=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Z=!1,Y=0;const J=t.getParameter(t.VERSION);-1!==J.indexOf("WebGL")?(Y=parseFloat(/^WebGL (\d)/.exec(J)[1]),Z=Y>=1):-1!==J.indexOf("OpenGL ES")&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),Z=Y>=2);let K=null,$={};const tt=t.getParameter(t.SCISSOR_BOX),et=t.getParameter(t.VIEWPORT),it=(new fe).fromArray(tt),nt=(new fe).fromArray(et);function rt(e,i,r,a){const o=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let s=0;s<r;s++)!n||e!==t.TEXTURE_3D&&e!==t.TEXTURE_2D_ARRAY?t.texImage2D(i+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,o):t.texImage3D(i,0,t.RGBA,1,1,a,0,t.RGBA,t.UNSIGNED_BYTE,o);return s}const at={};function ot(e){!0!==c[e]&&(t.enable(e),c[e]=!0)}function st(e){!1!==c[e]&&(t.disable(e),c[e]=!1)}at[t.TEXTURE_2D]=rt(t.TEXTURE_2D,t.TEXTURE_2D,1),at[t.TEXTURE_CUBE_MAP]=rt(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(at[t.TEXTURE_2D_ARRAY]=rt(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),at[t.TEXTURE_3D]=rt(t.TEXTURE_3D,t.TEXTURE_3D,1,1)),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ot(t.DEPTH_TEST),a.setFunc(3),dt(!1),ut(1),ot(t.CULL_FACE),ht(0);const lt={[h]:t.FUNC_ADD,[d]:t.FUNC_SUBTRACT,[u]:t.FUNC_REVERSE_SUBTRACT};if(n)lt[103]=t.MIN,lt[104]=t.MAX;else{const t=e.get("EXT_blend_minmax");null!==t&&(lt[103]=t.MIN_EXT,lt[104]=t.MAX_EXT)}const ct={[p]:t.ZERO,[f]:t.ONE,[g]:t.SRC_COLOR,[b]:t.SRC_ALPHA,[E]:t.SRC_ALPHA_SATURATE,[A]:t.DST_COLOR,[y]:t.DST_ALPHA,[m]:t.ONE_MINUS_SRC_COLOR,[v]:t.ONE_MINUS_SRC_ALPHA,[x]:t.ONE_MINUS_DST_COLOR,[_]:t.ONE_MINUS_DST_ALPHA,[C]:t.CONSTANT_COLOR,[M]:t.ONE_MINUS_CONSTANT_COLOR,[w]:t.CONSTANT_ALPHA,[S]:t.ONE_MINUS_CONSTANT_ALPHA};function ht(e,i,n,r,a,o,s,l,c,d){if(0!==e){if(!1===B&&(ot(t.BLEND),B=!0),5===e)a=a||i,o=o||n,s=s||r,i===L&&a===N||(t.blendEquationSeparate(lt[i],lt[a]),L=i,N=a),n===D&&r===P&&o===O&&s===k||(t.blendFuncSeparate(ct[n],ct[r],ct[o],ct[s]),D=n,P=r,O=o,k=s),!1!==l.equals(z)&&c===Q||(t.blendColor(l.r,l.g,l.b,c),z.copy(l),Q=c),R=e,V=!1;else if(e!==R||d!==V){if(L===h&&N===h||(t.blendEquation(t.FUNC_ADD),L=h,N=h),d)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}D=null,P=null,O=null,k=null,z.set(0,0,0),Q=0,R=e,V=d}}else!0===B&&(st(t.BLEND),B=!1)}function dt(e){H!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),H=e)}function ut(e){0!==e?(ot(t.CULL_FACE),e!==G&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):st(t.CULL_FACE),G=e}function pt(e,i,n){e?(ot(t.POLYGON_OFFSET_FILL),j===i&&X===n||(t.polygonOffset(i,n),j=i,X=n)):st(t.POLYGON_OFFSET_FILL)}return{buffers:{color:r,depth:a,stencil:o},enable:ot,disable:st,bindFramebuffer:function(e,i){return I[e]!==i&&(t.bindFramebuffer(e,i),I[e]=i,n&&(e===t.DRAW_FRAMEBUFFER&&(I[t.FRAMEBUFFER]=i),e===t.FRAMEBUFFER&&(I[t.DRAW_FRAMEBUFFER]=i)),!0)},drawBuffers:function(n,r){let a=U,o=!1;if(n)if(a=T.get(r),void 0===a&&(a=[],T.set(r,a)),n.isWebGLMultipleRenderTargets){const e=n.texture;if(a.length!==e.length||a[0]!==t.COLOR_ATTACHMENT0){for(let i=0,n=e.length;i<n;i++)a[i]=t.COLOR_ATTACHMENT0+i;a.length=e.length,o=!0}}else a[0]!==t.COLOR_ATTACHMENT0&&(a[0]=t.COLOR_ATTACHMENT0,o=!0);else a[0]!==t.BACK&&(a[0]=t.BACK,o=!0);o&&(i.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return F!==e&&(t.useProgram(e),F=e,!0)},setBlending:ht,setMaterial:function(e,i){2===e.side?st(t.CULL_FACE):ot(t.CULL_FACE);let n=1===e.side;i&&(n=!n),dt(n),1===e.blending&&!1===e.transparent?ht(0):ht(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);const s=e.stencilWrite;o.setTest(s),s&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),pt(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?ot(t.SAMPLE_ALPHA_TO_COVERAGE):st(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:dt,setCullFace:ut,setLineWidth:function(e){e!==W&&(Z&&t.lineWidth(e),W=e)},setPolygonOffset:pt,setScissorTest:function(e){e?ot(t.SCISSOR_TEST):st(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+q-1),K!==e&&(t.activeTexture(e),K=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===K?t.TEXTURE0+q-1:K);let r=$[n];void 0===r&&(r={type:void 0,texture:void 0},$[n]=r),r.type===e&&r.texture===i||(K!==n&&(t.activeTexture(n),K=n),t.bindTexture(e,i||at[e]),r.type=e,r.texture=i)},unbindTexture:function(){const e=$[K];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,i){let n=l.get(i);void 0===n&&(n=new WeakMap,l.set(i,n));let r=n.get(e);void 0===r&&(r=t.getUniformBlockIndex(i,e.name),n.set(e,r))},uniformBlockBinding:function(e,i){const n=l.get(i).get(e);s.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),s.set(i,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===it.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),it.copy(e))},viewport:function(e){!1===nt.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),nt.copy(e))},reset:function(){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),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),!0===n&&(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),c={},K=null,$={},I={},T=new WeakMap,U=[],F=null,B=!1,R=null,L=null,D=null,P=null,N=null,O=null,k=null,z=new Oi(0,0,0),Q=0,V=!1,H=null,G=null,W=null,j=null,X=null,it.set(0,0,t.canvas.width,t.canvas.height),nt.set(0,0,t.canvas.width,t.canvas.height),r.reset(),a.reset(),o.reset()}}}function go(t,e,i,n,r,a,o){const s=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,h=r.maxTextureSize,d=r.maxSamples,u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),f=new WeakMap;let g;const m=new WeakMap;let b=!1;try{b="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function v(t,e){return b?new OffscreenCanvas(t,e):Yt("canvas")}function y(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?Ht:Math.floor,a=n(r*t.width),o=n(r*t.height);void 0===g&&(g=v(a,o));const s=i?v(a,o):g;return s.width=a,s.height=o,s.getContext("2d").drawImage(t,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+o+")."),s}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function _(t){return Vt(t.width)&&Vt(t.height)}function A(t,e){return t.generateMipmaps&&e&&t.minFilter!==H&&t.minFilter!==j}function x(e){t.generateMipmap(e)}function E(i,n,r,a,o=!1){if(!1===s)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let l=n;if(n===t.RED&&(r===t.FLOAT&&(l=t.R32F),r===t.HALF_FLOAT&&(l=t.R16F),r===t.UNSIGNED_BYTE&&(l=t.R8)),n===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.R8UI),r===t.UNSIGNED_SHORT&&(l=t.R16UI),r===t.UNSIGNED_INT&&(l=t.R32UI),r===t.BYTE&&(l=t.R8I),r===t.SHORT&&(l=t.R16I),r===t.INT&&(l=t.R32I)),n===t.RG&&(r===t.FLOAT&&(l=t.RG32F),r===t.HALF_FLOAT&&(l=t.RG16F),r===t.UNSIGNED_BYTE&&(l=t.RG8)),n===t.RGBA){const e=o?vt:re.getTransfer(a);r===t.FLOAT&&(l=t.RGBA32F),r===t.HALF_FLOAT&&(l=t.RGBA16F),r===t.UNSIGNED_BYTE&&(l=e===yt?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)}return l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get("EXT_color_buffer_float"),l}function C(t,e,i){return!0===A(t,i)||t.isFramebufferTexture&&t.minFilter!==H&&t.minFilter!==j?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function M(e){return e===H||1004===e||e===W?t.NEAREST:t.LINEAR}function w(t){const e=t.target;e.removeEventListener("dispose",w),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,r=m.get(i);if(r){const n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&I(t),0===Object.keys(r).length&&m.delete(i)}n.remove(t)}(e),e.isVideoTexture&&f.delete(e)}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=e.texture,r=n.get(e),a=n.get(i);if(void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),o.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(r.__webglFramebuffer[e]))for(let i=0;i<r.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(r.__webglFramebuffer[e][i]);else t.deleteFramebuffer(r.__webglFramebuffer[e]);r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e])}else{if(Array.isArray(r.__webglFramebuffer))for(let e=0;e<r.__webglFramebuffer.length;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let e=0;e<r.__webglColorRenderbuffer.length;e++)r.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(r.__webglColorRenderbuffer[e]);r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),o.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}function I(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const r=e.source;delete m.get(r)[i.__cacheKey],o.memory.textures--}let T=0;function U(e,r){const a=n.get(e);if(e.isVideoTexture&&function(t){const e=o.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&a.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void P(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+r)}const F={[z]:t.REPEAT,[Q]:t.CLAMP_TO_EDGE,[V]:t.MIRRORED_REPEAT},B={[H]:t.NEAREST,[G]:t.NEAREST_MIPMAP_NEAREST,[W]:t.NEAREST_MIPMAP_LINEAR,[j]:t.LINEAR,[X]:t.LINEAR_MIPMAP_NEAREST,[q]:t.LINEAR_MIPMAP_LINEAR},R={[Et]:t.NEVER,[Ut]:t.ALWAYS,[Ct]:t.LESS,[wt]:t.LEQUAL,[Mt]:t.EQUAL,[Tt]:t.GEQUAL,[St]:t.GREATER,[It]:t.NOTEQUAL};function L(i,a,o){if(o?(t.texParameteri(i,t.TEXTURE_WRAP_S,F[a.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,F[a.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,F[a.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,B[a.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,B[a.minFilter])):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),a.wrapS===Q&&a.wrapT===Q||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,t.TEXTURE_MAG_FILTER,M(a.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,M(a.minFilter)),a.minFilter!==H&&a.minFilter!==j&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(t.texParameteri(i,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,R[a.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){const o=e.get("EXT_texture_filter_anisotropic");if(a.magFilter===H)return;if(a.minFilter!==W&&a.minFilter!==q)return;if(a.type===K&&!1===e.has("OES_texture_float_linear"))return;if(!1===s&&a.type===$&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function D(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",w));const r=i.source;let a=m.get(r);void 0===a&&(a={},m.set(r,a));const s=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(i);if(s!==e.__cacheKey){void 0===a[s]&&(a[s]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,n=!0),a[s].usedTimes++;const r=a[e.__cacheKey];void 0!==r&&(a[e.__cacheKey].usedTimes--,0===r.usedTimes&&I(i)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return n}function P(e,r,o){let l=t.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),r.isData3DTexture&&(l=t.TEXTURE_3D);const c=D(e,r),d=r.source;i.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const u=n.get(d);if(d.version!==u.__version||!0===c){i.activeTexture(t.TEXTURE0+o);const e=re.getPrimaries(re.workingColorSpace),n=r.colorSpace===pt?null:re.getPrimaries(r.colorSpace),p=r.colorSpace===pt||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);const f=function(t){return!s&&(t.wrapS!==Q||t.wrapT!==Q||t.minFilter!==H&&t.minFilter!==j)}(r)&&!1===_(r.image);let g=y(r.image,f,!1,h);g=ot(r,g);const m=_(g)||s,b=a.convert(r.format,r.colorSpace);let v,M=a.convert(r.type),w=E(r.internalFormat,b,M,r.colorSpace,r.isVideoTexture);L(l,r,m);const S=r.mipmaps,I=s&&!0!==r.isVideoTexture&&36196!==w,T=void 0===u.__version||!0===c,U=C(r,g,m);if(r.isDepthTexture)w=t.DEPTH_COMPONENT,s?w=r.type===K?t.DEPTH_COMPONENT32F:r.type===J?t.DEPTH_COMPONENT24:r.type===tt?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:r.type===K&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===it&&w===t.DEPTH_COMPONENT&&r.type!==Y&&r.type!==J&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=J,M=a.convert(r.type)),r.format===nt&&w===t.DEPTH_COMPONENT&&(w=t.DEPTH_STENCIL,r.type!==tt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=tt,M=a.convert(r.type))),T&&(I?i.texStorage2D(t.TEXTURE_2D,1,w,g.width,g.height):i.texImage2D(t.TEXTURE_2D,0,w,g.width,g.height,0,b,M,null));else if(r.isDataTexture)if(S.length>0&&m){I&&T&&i.texStorage2D(t.TEXTURE_2D,U,w,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)v=S[e],I?i.texSubImage2D(t.TEXTURE_2D,e,0,0,v.width,v.height,b,M,v.data):i.texImage2D(t.TEXTURE_2D,e,w,v.width,v.height,0,b,M,v.data);r.generateMipmaps=!1}else I?(T&&i.texStorage2D(t.TEXTURE_2D,U,w,g.width,g.height),i.texSubImage2D(t.TEXTURE_2D,0,0,0,g.width,g.height,b,M,g.data)):i.texImage2D(t.TEXTURE_2D,0,w,g.width,g.height,0,b,M,g.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){I&&T&&i.texStorage3D(t.TEXTURE_2D_ARRAY,U,w,S[0].width,S[0].height,g.depth);for(let e=0,n=S.length;e<n;e++)v=S[e],r.format!==et?null!==b?I?i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,v.width,v.height,g.depth,b,v.data,0,0):i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,w,v.width,v.height,g.depth,0,v.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,v.width,v.height,g.depth,b,M,v.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,w,v.width,v.height,g.depth,0,b,M,v.data)}else{I&&T&&i.texStorage2D(t.TEXTURE_2D,U,w,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)v=S[e],r.format!==et?null!==b?I?i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,v.width,v.height,b,v.data):i.compressedTexImage2D(t.TEXTURE_2D,e,w,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?i.texSubImage2D(t.TEXTURE_2D,e,0,0,v.width,v.height,b,M,v.data):i.texImage2D(t.TEXTURE_2D,e,w,v.width,v.height,0,b,M,v.data)}else if(r.isDataArrayTexture)I?(T&&i.texStorage3D(t.TEXTURE_2D_ARRAY,U,w,g.width,g.height,g.depth),i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,g.width,g.height,g.depth,b,M,g.data)):i.texImage3D(t.TEXTURE_2D_ARRAY,0,w,g.width,g.height,g.depth,0,b,M,g.data);else if(r.isData3DTexture)I?(T&&i.texStorage3D(t.TEXTURE_3D,U,w,g.width,g.height,g.depth),i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,g.width,g.height,g.depth,b,M,g.data)):i.texImage3D(t.TEXTURE_3D,0,w,g.width,g.height,g.depth,0,b,M,g.data);else if(r.isFramebufferTexture){if(T)if(I)i.texStorage2D(t.TEXTURE_2D,U,w,g.width,g.height);else{let e=g.width,n=g.height;for(let r=0;r<U;r++)i.texImage2D(t.TEXTURE_2D,r,w,e,n,0,b,M,null),e>>=1,n>>=1}}else if(S.length>0&&m){I&&T&&i.texStorage2D(t.TEXTURE_2D,U,w,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)v=S[e],I?i.texSubImage2D(t.TEXTURE_2D,e,0,0,b,M,v):i.texImage2D(t.TEXTURE_2D,e,w,b,M,v);r.generateMipmaps=!1}else I?(T&&i.texStorage2D(t.TEXTURE_2D,U,w,g.width,g.height),i.texSubImage2D(t.TEXTURE_2D,0,0,0,b,M,g)):i.texImage2D(t.TEXTURE_2D,0,w,b,M,g);A(r,m)&&x(l),u.__version=d.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}function N(e,r,o,s,l,c){const h=a.convert(o.format,o.colorSpace),d=a.convert(o.type),p=E(o.internalFormat,h,d,o.colorSpace);if(!n.get(r).__hasExternalTextures){const e=Math.max(1,r.width>>c),n=Math.max(1,r.height>>c);l===t.TEXTURE_3D||l===t.TEXTURE_2D_ARRAY?i.texImage3D(l,c,p,e,n,r.depth,0,h,d,null):i.texImage2D(l,c,p,e,n,0,h,d,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),at(r)?u.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,s,l,n.get(o).__webglTexture,0,rt(r)):(l===t.TEXTURE_2D||l>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,s,l,n.get(o).__webglTexture,c),i.bindFramebuffer(t.FRAMEBUFFER,null)}function O(e,i,n){if(t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer){let r=!0===s?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(n||at(i)){const e=i.depthTexture;e&&e.isDepthTexture&&(e.type===K?r=t.DEPTH_COMPONENT32F:e.type===J&&(r=t.DEPTH_COMPONENT24));const n=rt(i);at(i)?u.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,n,r,i.width,i.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,n,r,i.width,i.height)}else t.renderbufferStorage(t.RENDERBUFFER,r,i.width,i.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(i.depthBuffer&&i.stencilBuffer){const r=rt(i);n&&!1===at(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,i.width,i.height):at(i)?u.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let r=0;r<e.length;r++){const o=e[r],s=a.convert(o.format,o.colorSpace),l=a.convert(o.type),c=E(o.internalFormat,s,l,o.colorSpace),h=rt(i);n&&!1===at(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,h,c,i.width,i.height):at(i)?u.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,h,c,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,c,i.width,i.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function k(e){const r=n.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),U(r.depthTexture,0);const a=n.get(r.depthTexture).__webglTexture,o=rt(r);if(r.depthTexture.format===it)at(r)?u.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==nt)throw new Error("Unknown depthTexture format");at(r)?u.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),O(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),O(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(t.FRAMEBUFFER,null)}function rt(t){return Math.min(d,t.samples)}function at(t){const i=n.get(t);return s&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function ot(t,i){const n=t.colorSpace,r=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Bt||n!==gt&&n!==pt&&(re.getTransfer(n)===yt?!1===s?!0===e.has("EXT_sRGB")&&r===et?(t.format=Bt,t.minFilter=j,t.generateMipmaps=!1):i=le.sRGBToLinear(i):r===et&&a===Z||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),i}this.allocateTextureUnit=function(){const t=T;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),T+=1,t},this.resetTextureUnits=function(){T=0},this.setTexture2D=U,this.setTexture2DArray=function(e,r){const a=n.get(e);e.version>0&&a.__version!==e.version?P(a,e,r):i.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const a=n.get(e);e.version>0&&a.__version!==e.version?P(a,e,r):i.bindTexture(t.TEXTURE_3D,a.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,r){const o=n.get(e);e.version>0&&o.__version!==e.version?function(e,r,o){if(6!==r.image.length)return;const l=D(e,r),h=r.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const d=n.get(h);if(h.version!==d.__version||!0===l){i.activeTexture(t.TEXTURE0+o);const e=re.getPrimaries(re.workingColorSpace),n=r.colorSpace===pt?null:re.getPrimaries(r.colorSpace),u=r.colorSpace===pt||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const p=r.isCompressedTexture||r.image[0].isCompressedTexture,f=r.image[0]&&r.image[0].isDataTexture,g=[];for(let t=0;t<6;t++)g[t]=p||f?f?r.image[t].image:r.image[t]:y(r.image[t],!1,!0,c),g[t]=ot(r,g[t]);const m=g[0],b=_(m)||s,v=a.convert(r.format,r.colorSpace),M=a.convert(r.type),w=E(r.internalFormat,v,M,r.colorSpace),S=s&&!0!==r.isVideoTexture,I=void 0===d.__version||!0===l;let T,U=C(r,m,b);if(L(t.TEXTURE_CUBE_MAP,r,b),p){S&&I&&i.texStorage2D(t.TEXTURE_CUBE_MAP,U,w,m.width,m.height);for(let e=0;e<6;e++){T=g[e].mipmaps;for(let n=0;n<T.length;n++){const a=T[n];r.format!==et?null!==v?S?i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,a.width,a.height,v,a.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,w,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,a.width,a.height,v,M,a.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,w,a.width,a.height,0,v,M,a.data)}}}else{T=r.mipmaps,S&&I&&(T.length>0&&U++,i.texStorage2D(t.TEXTURE_CUBE_MAP,U,w,g[0].width,g[0].height));for(let e=0;e<6;e++)if(f){S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,g[e].width,g[e].height,v,M,g[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,g[e].width,g[e].height,0,v,M,g[e].data);for(let n=0;n<T.length;n++){const r=T[n].image[e].image;S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,r.width,r.height,v,M,r.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,w,r.width,r.height,0,v,M,r.data)}}else{S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,v,M,g[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,v,M,g[e]);for(let n=0;n<T.length;n++){const r=T[n];S?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,v,M,r.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,w,v,M,r.image[e])}}}A(r,b)&&x(t.TEXTURE_CUBE_MAP),d.__version=h.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(o,e,r):i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+r)},this.rebindTextures=function(e,i,r){const a=n.get(e);void 0!==i&&N(a.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&k(e)},this.setupRenderTarget=function(e){const l=e.texture,c=n.get(e),h=n.get(l);e.addEventListener("dispose",S),!0!==e.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=l.version,o.memory.textures++);const d=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultipleRenderTargets,p=_(e)||s;if(d){c.__webglFramebuffer=[];for(let e=0;e<6;e++)if(s&&l.mipmaps&&l.mipmaps.length>0){c.__webglFramebuffer[e]=[];for(let i=0;i<l.mipmaps.length;i++)c.__webglFramebuffer[e][i]=t.createFramebuffer()}else c.__webglFramebuffer[e]=t.createFramebuffer()}else{if(s&&l.mipmaps&&l.mipmaps.length>0){c.__webglFramebuffer=[];for(let e=0;e<l.mipmaps.length;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else c.__webglFramebuffer=t.createFramebuffer();if(u)if(r.drawBuffers){const i=e.texture;for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(s&&e.samples>0&&!1===at(e)){const n=u?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer);for(let i=0;i<n.length;i++){const r=n[i];c.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,c.__webglColorRenderbuffer[i]);const o=a.convert(r.format,r.colorSpace),s=a.convert(r.type),l=E(r.internalFormat,o,s,r.colorSpace,!0===e.isXRRenderTarget),h=rt(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+i,t.RENDERBUFFER,c.__webglColorRenderbuffer[i])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),O(c.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(d){i.bindTexture(t.TEXTURE_CUBE_MAP,h.__webglTexture),L(t.TEXTURE_CUBE_MAP,l,p);for(let i=0;i<6;i++)if(s&&l.mipmaps&&l.mipmaps.length>0)for(let n=0;n<l.mipmaps.length;n++)N(c.__webglFramebuffer[i][n],e,l,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else N(c.__webglFramebuffer[i],e,l,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);A(l,p)&&x(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){const r=e.texture;for(let a=0,o=r.length;a<o;a++){const o=r[a],s=n.get(o);i.bindTexture(t.TEXTURE_2D,s.__webglTexture),L(t.TEXTURE_2D,o,p),N(c.__webglFramebuffer,e,o,t.COLOR_ATTACHMENT0+a,t.TEXTURE_2D,0),A(o,p)&&x(t.TEXTURE_2D)}i.unbindTexture()}else{let n=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(s?n=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(n,h.__webglTexture),L(n,l,p),s&&l.mipmaps&&l.mipmaps.length>0)for(let i=0;i<l.mipmaps.length;i++)N(c.__webglFramebuffer[i],e,l,t.COLOR_ATTACHMENT0,n,i);else N(c.__webglFramebuffer,e,l,t.COLOR_ATTACHMENT0,n,0);A(l,p)&&x(n),i.unbindTexture()}e.depthBuffer&&k(e)},this.updateRenderTargetMipmap=function(e){const r=_(e)||s,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let o=0,s=a.length;o<s;o++){const s=a[o];if(A(s,r)){const r=e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=n.get(s).__webglTexture;i.bindTexture(r,a),x(r),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(s&&e.samples>0&&!1===at(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,o=e.height;let s=t.COLOR_BUFFER_BIT;const l=[],c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=n.get(e),d=!0===e.isWebGLMultipleRenderTargets;if(d)for(let e=0;e<r.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<r.length;i++){l.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&l.push(c);const u=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===u&&(e.depthBuffer&&(s|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&(s|=t.STENCIL_BUFFER_BIT)),d&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[i]),!0===u&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[c]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[c])),d){const e=n.get(r[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,a,o,0,0,a,o,s,t.NEAREST),p&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,l)}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),d)for(let e=0;e<r.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const a=n.get(r[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,a,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=k,this.setupFrameBufferTexture=N,this.useMultisampledRTT=at}function mo(t,e,i){const n=i.isWebGL2;return{convert:function(i,r=""){let a;const o=re.getTransfer(r);if(i===Z)return t.UNSIGNED_BYTE;if(1017===i)return t.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return t.UNSIGNED_SHORT_5_5_5_1;if(1010===i)return t.BYTE;if(1011===i)return t.SHORT;if(i===Y)return t.UNSIGNED_SHORT;if(1013===i)return t.INT;if(i===J)return t.UNSIGNED_INT;if(i===K)return t.FLOAT;if(i===$)return n?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),null!==a?a.HALF_FLOAT_OES:null);if(1021===i)return t.ALPHA;if(i===et)return t.RGBA;if(1024===i)return t.LUMINANCE;if(1025===i)return t.LUMINANCE_ALPHA;if(i===it)return t.DEPTH_COMPONENT;if(i===nt)return t.DEPTH_STENCIL;if(i===Bt)return a=e.get("EXT_sRGB"),null!==a?a.SRGB_ALPHA_EXT:null;if(1028===i)return t.RED;if(1029===i)return t.RED_INTEGER;if(1030===i)return t.RG;if(1031===i)return t.RG_INTEGER;if(1033===i)return t.RGBA_INTEGER;if(i===rt||i===at||i===ot||i===st)if(o===yt){if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===a)return null;if(i===rt)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===at)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ot)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===st)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(a=e.get("WEBGL_compressed_texture_s3tc"),null===a)return null;if(i===rt)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===at)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ot)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===st)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(a=e.get("WEBGL_compressed_texture_pvrtc"),null===a)return null;if(35840===i)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return a=e.get("WEBGL_compressed_texture_etc1"),null!==a?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(a=e.get("WEBGL_compressed_texture_etc"),null===a)return null;if(37492===i)return o===yt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(a=e.get("WEBGL_compressed_texture_astc"),null===a)return null;if(37808===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return o===yt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===lt||36494===i||36495===i){if(a=e.get("EXT_texture_compression_bptc"),null===a)return null;if(i===lt)return o===yt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(a=e.get("EXT_texture_compression_rgtc"),null===a)return null;if(i===lt)return a.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===tt?n?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),null!==a?a.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}class bo extends Un{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class vo extends Ai{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yo={type:"move"};class _o{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new vo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new vo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new _e,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new _e),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new vo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new _e,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new _e),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,a=null;const o=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){a=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i),r=this._getHandJoint(l,n);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=n.position.distanceTo(r.position),s=.02,c=.005;l.inputState.pinching&&o>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1));null!==o&&(n=e.getPose(t.targetRaySpace,i),null===n&&null!==r&&(n=r),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(yo)))}return null!==o&&(o.visible=null!==n),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new vo;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class Ao extends Dt{constructor(t,e){super();const i=this;let n=null,r=1,a=null,o="local-floor",s=1,l=null,c=null,h=null,d=null,u=null,p=null;const f=e.getContextAttributes();let g=null,m=null;const b=[],v=[],y=new jt;let _=null;const A=new Un;A.layers.enable(1),A.viewport=new fe;const x=new Un;x.layers.enable(2),x.viewport=new fe;const E=[A,x],C=new bo;C.layers.enable(1),C.layers.enable(2);let M=null,w=null;function S(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const i=b[e];void 0!==i&&(i.update(t.inputSource,t.frame,l||a),i.dispatchEvent({type:t.type,data:t.inputSource}))}function I(){n.removeEventListener("select",S),n.removeEventListener("selectstart",S),n.removeEventListener("selectend",S),n.removeEventListener("squeeze",S),n.removeEventListener("squeezestart",S),n.removeEventListener("squeezeend",S),n.removeEventListener("end",I),n.removeEventListener("inputsourceschange",T);for(let t=0;t<b.length;t++){const e=v[t];null!==e&&(v[t]=null,b[t].disconnect(e))}M=null,w=null,t.setRenderTarget(g),u=null,d=null,h=null,n=null,m=null,L.stop(),i.isPresenting=!1,t.setPixelRatio(_),t.setSize(y.width,y.height,!1),i.dispatchEvent({type:"sessionend"})}function T(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=v.indexOf(i);n>=0&&(v[n]=null,b[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=v.indexOf(i);if(-1===n){for(let t=0;t<b.length;t++){if(t>=v.length){v.push(i),n=t;break}if(null===v[t]){v[t]=i,n=t;break}}if(-1===n)break}const r=b[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=b[t];return void 0===e&&(e=new _o,b[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=b[t];return void 0===e&&(e=new _o,b[t]=e),e.getGripSpace()},this.getHand=function(t){let e=b[t];return void 0===e&&(e=new _o,b[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(n=c,null!==n){if(g=t.getRenderTarget(),n.addEventListener("select",S),n.addEventListener("selectstart",S),n.addEventListener("selectend",S),n.addEventListener("squeeze",S),n.addEventListener("squeezestart",S),n.addEventListener("squeezeend",S),n.addEventListener("end",I),n.addEventListener("inputsourceschange",T),!0!==f.xrCompatible&&await e.makeXRCompatible(),_=t.getPixelRatio(),t.getSize(y),void 0===n.renderState.layers||!1===t.capabilities.isWebGL2){const i={antialias:void 0!==n.renderState.layers||f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),t.setPixelRatio(1),t.setSize(u.framebufferWidth,u.framebufferHeight,!1),m=new me(u.framebufferWidth,u.framebufferHeight,{format:et,type:Z,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}else{let i=null,a=null,o=null;f.depth&&(o=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,i=f.stencil?nt:it,a=f.stencil?tt:J);const s={colorFormat:e.RGBA8,depthFormat:o,scaleFactor:r};h=new XRWebGLBinding(n,e),d=h.createProjectionLayer(s),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),m=new me(d.textureWidth,d.textureHeight,{format:et,type:Z,depthTexture:new Mr(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0}),t.properties.get(m).__ignoreDepthValues=d.ignoreDepthValues}m.isXRRenderTarget=!0,this.setFoveation(s),l=null,a=await n.requestReferenceSpace(o),L.setContext(n),L.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};const U=new _e,F=new _e;function B(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;C.near=x.near=A.near=t.near,C.far=x.far=A.far=t.far,M===C.near&&w===C.far||(n.updateRenderState({depthNear:C.near,depthFar:C.far}),M=C.near,w=C.far);const e=t.parent,i=C.cameras;B(C,e);for(let t=0;t<i.length;t++)B(i[t],e);2===i.length?function(t,e,i){U.setFromMatrixPosition(e.matrixWorld),F.setFromMatrixPosition(i.matrixWorld);const n=U.distanceTo(F),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],d=(a[8]+1)/a[0],u=o*h,p=o*d,f=n/(-h+d),g=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(g),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const m=o+f,b=s+f,v=u-g,y=p+(n-g),_=l*s/b*m,A=c*s/b*m;t.projectionMatrix.makePerspective(v,y,_,A,m,b),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(C,A,x):C.projectionMatrix.copy(A.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*Ot*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,C,e)},this.getCamera=function(){return C},this.getFoveation=function(){if(null!==d||null!==u)return s},this.setFoveation=function(t){s=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)};let R=null;const L=new Vn;L.setAnimationLoop((function(e,n){if(c=n.getViewerPose(l||a),p=n,null!==c){const e=c.views;null!==u&&(t.setRenderTargetFramebuffer(m,u.framebuffer),t.setRenderTarget(m));let i=!1;e.length!==C.cameras.length&&(C.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const r=e[n];let a=null;if(null!==u)a=u.getViewport(r);else{const e=h.getViewSubImage(d,r);a=e.viewport,0===n&&(t.setRenderTargetTextures(m,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(m))}let o=E[n];void 0===o&&(o=new Un,o.layers.enable(n),o.viewport=new fe,E[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),0===n&&(C.matrix.copy(o.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===i&&C.cameras.push(o)}}for(let t=0;t<b.length;t++){const e=v[t],i=b[t];null!==e&&void 0!==i&&i.update(e,n,l||a)}R&&R(e,n),n.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:n}),p=null})),this.setAnimationLoop=function(t){R=t},this.dispose=function(){}}}function xo(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map,i(r.map,n.mapTransform)),r.alphaMap&&(n.alphaMap.value=r.alphaMap,i(r.alphaMap,n.alphaMapTransform)),r.bumpMap&&(n.bumpMap.value=r.bumpMap,i(r.bumpMap,n.bumpMapTransform),n.bumpScale.value=r.bumpScale,1===r.side&&(n.bumpScale.value*=-1)),r.normalMap&&(n.normalMap.value=r.normalMap,i(r.normalMap,n.normalMapTransform),n.normalScale.value.copy(r.normalScale),1===r.side&&n.normalScale.value.negate()),r.displacementMap&&(n.displacementMap.value=r.displacementMap,i(r.displacementMap,n.displacementMapTransform),n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap,i(r.emissiveMap,n.emissiveMapTransform)),r.specularMap&&(n.specularMap.value=r.specularMap,i(r.specularMap,n.specularMapTransform)),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);const a=e.get(r).envMap;if(a&&(n.envMap.value=a,n.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;const e=!0===t._useLegacyLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*e,i(r.lightMap,n.lightMapTransform)}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity,i(r.aoMap,n.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,wn(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,r,a,o,s){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(t,r):r.isMeshToonMaterial?(n(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(n(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(n(t,r),function(t,n){t.metalness.value=n.metalness,n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap,i(n.metalnessMap,t.metalnessMapTransform)),t.roughness.value=n.roughness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap,i(n.roughnessMap,t.roughnessMapTransform));e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate())),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,i(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,s)):r.isMeshMatcapMaterial?(n(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?n(t,r):r.isMeshDistanceMaterial?(n(t,r),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?n(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,a,o):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Eo(t,e,i,n){let r={},a={},o=[];const s=i.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,i){const n=t.value;if(void 0===i[e]){if("number"==typeof n)i[e]=n;else{const t=Array.isArray(n)?n:[n],r=[];for(let e=0;e<t.length;e++)r.push(t[e].clone());i[e]=r}return!0}if("number"==typeof n){if(i[e]!==n)return i[e]=n,!0}else{const t=Array.isArray(i[e])?i[e]:[i[e]],r=Array.isArray(n)?n:[n];for(let e=0;e<t.length;e++){const i=t[e];if(!1===i.equals(r[e]))return i.copy(r[e]),!0}}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.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),e}function h(e){const i=e.target;i.removeEventListener("dispose",h);const n=o.indexOf(i.__bindingPointIndex);o.splice(n,1),t.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=r[i.id];void 0===u&&(function(t){const e=t.uniforms;let i=0;let n=0;for(let t=0,r=e.length;t<r;t++){const r=e[t],a={boundary:0,storage:0},o=Array.isArray(r.value)?r.value:[r.value];for(let t=0,e=o.length;t<e;t++){const e=c(o[t]);a.boundary+=e.boundary,a.storage+=e.storage}r.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),r.__offset=i,t>0&&(n=i%16,0!==n&&16-n-a.boundary<0&&(i+=16-n,r.__offset=i)),i+=a.storage}n=i%16,n>0&&(i+=16-n),t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<s;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,r,a),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,i,n),n}(i),r[i.id]=u,i.addEventListener("dispose",h));const p=d.program;n.updateUBOMapping(i,p);const f=e.render.frame;a[i.id]!==f&&(function(e){const i=r[e.id],n=e.uniforms,a=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,i);for(let e=0,i=n.length;e<i;e++){const i=n[e];if(!0===l(i,e,a)){const e=i.__offset,n=Array.isArray(i.value)?i.value:[i.value];let r=0;for(let a=0;a<n.length;a++){const o=n[a],s=c(o);"number"==typeof o?(i.__data[0]=o,t.bufferSubData(t.UNIFORM_BUFFER,e+r,i.__data)):o.isMatrix3?(i.__data[0]=o.elements[0],i.__data[1]=o.elements[1],i.__data[2]=o.elements[2],i.__data[3]=o.elements[0],i.__data[4]=o.elements[3],i.__data[5]=o.elements[4],i.__data[6]=o.elements[5],i.__data[7]=o.elements[0],i.__data[8]=o.elements[6],i.__data[9]=o.elements[7],i.__data[10]=o.elements[8],i.__data[11]=o.elements[0]):(o.toArray(i.__data,r),r+=s.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,i.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(i),a[i.id]=f)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);o=[],r={},a={}}}}class Co{constructor(t={}){const{canvas:e=Jt(),context:i=null,depth:r=!0,stencil:a=!0,alpha:o=!1,antialias:s=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=t;let u;this.isWebGLRenderer=!0,u=null!==i?i.getContextAttributes().alpha:o;const p=new Uint32Array(4),f=new Int32Array(4);let g=null,m=null;const b=[],v=[];this.domElement=e,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=ft,this._useLegacyLights=!1,this.toneMapping=F,this.toneMappingExposure=1;const y=this;let _=!1,A=0,x=0,E=null,C=-1,M=null;const w=new fe,S=new fe;let I=null;const T=new Oi(0);let U=0,B=e.width,R=e.height,L=1,D=null,P=null;const N=new fe(0,0,B,R),O=new fe(0,0,B,R);let k=!1;const z=new Qn;let Q=!1,V=!1,H=null;const G=new Ye,W=new jt,j=new _e,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function it(){return null===E?L:1}let nt,rt,at,ot,st,lt,ct,ht,dt,ut,pt,mt,bt,vt,yt,_t,At,xt,Et,Ct,Mt,wt,St,It,Tt=i;function Ut(t,i){for(let n=0;n<t.length;n++){const r=t[n],a=e.getContext(r,i);if(null!==a)return a}return null}try{const t={alpha:!0,depth:r,stencil:a,antialias:s,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${n}`),e.addEventListener("webglcontextlost",Rt,!1),e.addEventListener("webglcontextrestored",Lt,!1),e.addEventListener("webglcontextcreationerror",Dt,!1),null===Tt){const e=["webgl2","webgl","experimental-webgl"];if(!0===y.isWebGL1Renderer&&e.shift(),Tt=Ut(e,t),null===Tt)throw Ut(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}"undefined"!=typeof WebGLRenderingContext&&Tt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===Tt.getShaderPrecisionFormat&&(Tt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Ft(){nt=new br(Tt),rt=new Kn(Tt,nt,t),nt.init(rt),wt=new mo(Tt,nt,rt),at=new fo(Tt,nt,rt),ot=new _r(Tt),st=new $a,lt=new go(Tt,nt,at,st,rt,wt,ot),ct=new tr(y),ht=new mr(y),dt=new Hn(Tt,rt),St=new Yn(Tt,nt,dt,rt),ut=new vr(Tt,dt,ot,St),pt=new Cr(Tt,ut,dt,ot),Et=new Er(Tt,rt,lt),_t=new $n(st),mt=new Ka(y,ct,ht,nt,rt,St,_t),bt=new xo(y,st),vt=new no,yt=new co(nt,rt),xt=new Zn(y,ct,ht,at,pt,u,l),At=new po(y,pt,rt),It=new Eo(Tt,ot,rt,at),Ct=new Jn(Tt,nt,ot,rt),Mt=new yr(Tt,nt,ot,rt),ot.programs=mt.programs,y.capabilities=rt,y.extensions=nt,y.properties=st,y.renderLists=vt,y.shadowMap=At,y.state=at,y.info=ot}Ft();const Bt=new Ao(y,Tt);function Rt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function Lt(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const t=ot.autoReset,e=At.enabled,i=At.autoUpdate,n=At.needsUpdate,r=At.type;Ft(),ot.autoReset=t,At.enabled=e,At.autoUpdate=i,At.needsUpdate=n,At.type=r}function Dt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Pt(t){const e=t.target;e.removeEventListener("dispose",Pt),function(t){(function(t){const e=st.get(t).programs;void 0!==e&&(e.forEach((function(t){mt.releaseProgram(t)})),t.isShaderMaterial&&mt.releaseShaderCache(t))})(t),st.remove(t)}(e)}function Nt(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,qt(t,e,i),t.side=0,t.needsUpdate=!0,qt(t,e,i),t.side=2):qt(t,e,i)}this.xr=Bt,this.getContext=function(){return Tt},this.getContextAttributes=function(){return Tt.getContextAttributes()},this.forceContextLoss=function(){const t=nt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=nt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(t){void 0!==t&&(L=t,this.setSize(B,R,!1))},this.getSize=function(t){return t.set(B,R)},this.setSize=function(t,i,n=!0){Bt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(B=t,R=i,e.width=Math.floor(t*L),e.height=Math.floor(i*L),!0===n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(B*L,R*L).floor()},this.setDrawingBufferSize=function(t,i,n){B=t,R=i,L=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return t.copy(w)},this.getViewport=function(t){return t.copy(N)},this.setViewport=function(t,e,i,n){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,i,n),at.viewport(w.copy(N).multiplyScalar(L).floor())},this.getScissor=function(t){return t.copy(O)},this.setScissor=function(t,e,i,n){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,i,n),at.scissor(S.copy(O).multiplyScalar(L).floor())},this.getScissorTest=function(){return k},this.setScissorTest=function(t){at.setScissorTest(k=t)},this.setOpaqueSort=function(t){D=t},this.setTransparentSort=function(t){P=t},this.getClearColor=function(t){return t.copy(xt.getClearColor())},this.setClearColor=function(){xt.setClearColor.apply(xt,arguments)},this.getClearAlpha=function(){return xt.getClearAlpha()},this.setClearAlpha=function(){xt.setClearAlpha.apply(xt,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;if(t){let t=!1;if(null!==E){const e=E.texture.format;t=1033===e||1031===e||1029===e}if(t){const t=E.texture.type,e=t===Z||t===J||t===Y||t===tt||1017===t||1018===t,i=xt.getClearColor(),n=xt.getClearAlpha(),r=i.r,a=i.g,o=i.b;e?(p[0]=r,p[1]=a,p[2]=o,p[3]=n,Tt.clearBufferuiv(Tt.COLOR,0,p)):(f[0]=r,f[1]=a,f[2]=o,f[3]=n,Tt.clearBufferiv(Tt.COLOR,0,f))}else n|=Tt.COLOR_BUFFER_BIT}e&&(n|=Tt.DEPTH_BUFFER_BIT),i&&(n|=Tt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Tt.clear(n)},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(){e.removeEventListener("webglcontextlost",Rt,!1),e.removeEventListener("webglcontextrestored",Lt,!1),e.removeEventListener("webglcontextcreationerror",Dt,!1),vt.dispose(),yt.dispose(),st.dispose(),ct.dispose(),ht.dispose(),pt.dispose(),St.dispose(),It.dispose(),mt.dispose(),Bt.dispose(),Bt.removeEventListener("sessionstart",kt),Bt.removeEventListener("sessionend",zt),H&&(H.dispose(),H=null),Qt.stop()},this.renderBufferDirect=function(t,e,i,n,r,a){null===e&&(e=X);const o=r.isMesh&&r.matrixWorld.determinant()<0,s=function(t,e,i,n,r){!0!==e.isScene&&(e=X),lt.resetTextureUnits();const a=e.fog,o=n.isMeshStandardMaterial?e.environment:null,s=null===E?y.outputColorSpace:!0===E.isXRRenderTarget?E.texture.colorSpace:gt,l=(n.isMeshStandardMaterial?ht:ct).get(n.envMap||o),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,h=!!i.attributes.tangent&&(!!n.normalMap||n.anisotropy>0),d=!!i.morphAttributes.position,u=!!i.morphAttributes.normal,p=!!i.morphAttributes.color;let f=F;n.toneMapped&&(null!==E&&!0!==E.isXRRenderTarget||(f=y.toneMapping));const g=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,b=void 0!==g?g.length:0,v=st.get(n),_=m.state.lights;if(!0===Q&&(!0===V||t!==M)){const e=t===M&&n.id===C;_t.setState(n,t,e)}let A=!1;n.version===v.__version?v.needsLights&&v.lightsStateVersion!==_.state.version||v.outputColorSpace!==s||r.isBatchedMesh&&!1===v.batching?A=!0:r.isBatchedMesh||!0!==v.batching?r.isInstancedMesh&&!1===v.instancing?A=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?A=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||v.envMap!==l||!0===n.fog&&v.fog!==a?A=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===_t.numPlanes&&v.numIntersection===_t.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==h||v.morphTargets!==d||v.morphNormals!==u||v.morphColors!==p||v.toneMapping!==f||!0===rt.isWebGL2&&v.morphTargetsCount!==b)&&(A=!0):A=!0:A=!0:A=!0:A=!0:(A=!0,v.__version=n.version);let x=v.currentProgram;!0===A&&(x=qt(n,e,r));let w=!1,S=!1,I=!1;const T=x.getUniforms(),U=v.uniforms;if(at.useProgram(x.program)&&(w=!0,S=!0,I=!0),n.id!==C&&(C=n.id,S=!0),w||M!==t){T.setValue(Tt,"projectionMatrix",t.projectionMatrix),T.setValue(Tt,"viewMatrix",t.matrixWorldInverse);const e=T.map.cameraPosition;void 0!==e&&e.setValue(Tt,j.setFromMatrixPosition(t.matrixWorld)),rt.logarithmicDepthBuffer&&T.setValue(Tt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&T.setValue(Tt,"isOrthographic",!0===t.isOrthographicCamera),M!==t&&(M=t,S=!0,I=!0)}if(r.isSkinnedMesh){T.setOptional(Tt,r,"bindMatrix"),T.setOptional(Tt,r,"bindMatrixInverse");const t=r.skeleton;t&&(rt.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(Tt,"boneTexture",t.boneTexture,lt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}r.isBatchedMesh&&(T.setOptional(Tt,r,"batchingTexture"),T.setValue(Tt,"batchingTexture",r._matricesTexture,lt));const B=i.morphAttributes;var D,P;if((void 0!==B.position||void 0!==B.normal||void 0!==B.color&&!0===rt.isWebGL2)&&Et.update(r,i,x),(S||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,T.setValue(Tt,"receiveShadow",r.receiveShadow)),n.isMeshGouraudMaterial&&null!==n.envMap&&(U.envMap.value=l,U.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),S&&(T.setValue(Tt,"toneMappingExposure",y.toneMappingExposure),v.needsLights&&(P=I,(D=U).ambientLightColor.needsUpdate=P,D.lightProbe.needsUpdate=P,D.directionalLights.needsUpdate=P,D.directionalLightShadows.needsUpdate=P,D.pointLights.needsUpdate=P,D.pointLightShadows.needsUpdate=P,D.spotLights.needsUpdate=P,D.spotLightShadows.needsUpdate=P,D.rectAreaLights.needsUpdate=P,D.hemisphereLights.needsUpdate=P),a&&!0===n.fog&&bt.refreshFogUniforms(U,a),bt.refreshMaterialUniforms(U,n,L,R,H),Ua.upload(Tt,Zt(v),U,lt)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Ua.upload(Tt,Zt(v),U,lt),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&T.setValue(Tt,"center",r.center),T.setValue(Tt,"modelViewMatrix",r.modelViewMatrix),T.setValue(Tt,"normalMatrix",r.normalMatrix),T.setValue(Tt,"modelMatrix",r.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++)if(rt.isWebGL2){const i=t[e];It.update(i,x),It.bind(i,x)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return x}(t,e,i,n,r);at.setMaterial(n,o);let l=i.index,c=1;if(!0===n.wireframe){if(l=ut.getWireframeAttribute(i),void 0===l)return;c=2}const h=i.drawRange,d=i.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==a&&(u=Math.max(u,a.start*c),p=Math.min(p,(a.start+a.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const f=p-u;if(f<0||f===1/0)return;let g;St.setup(r,n,s,i,l);let b=Ct;if(null!==l&&(g=dt.get(l),b=Mt,b.setIndex(g)),r.isMesh)!0===n.wireframe?(at.setLineWidth(n.wireframeLinewidth*it()),b.setMode(Tt.LINES)):b.setMode(Tt.TRIANGLES);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),at.setLineWidth(t*it()),r.isLineSegments?b.setMode(Tt.LINES):r.isLineLoop?b.setMode(Tt.LINE_LOOP):b.setMode(Tt.LINE_STRIP)}else r.isPoints?b.setMode(Tt.POINTS):r.isSprite&&b.setMode(Tt.TRIANGLES);if(r.isBatchedMesh)b.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else if(r.isInstancedMesh)b.renderInstances(u,f,r.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);b.renderInstances(u,f,e)}else b.render(u,f)},this.compile=function(t,e,i=null){null===i&&(i=t),m=yt.get(i),m.init(),v.push(m),i.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(m.pushLight(t),t.castShadow&&m.pushShadow(t))})),t!==i&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(m.pushLight(t),t.castShadow&&m.pushShadow(t))})),m.setupLights(y._useLegacyLights);const n=new Set;return t.traverse((function(t){const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const a=e[r];Nt(a,i,t),n.add(a)}else Nt(e,i,t),n.add(e)})),v.pop(),m=null,n},this.compileAsync=function(t,e,i=null){const n=this.compile(t,e,i);return new Promise((e=>{function i(){n.forEach((function(t){st.get(t).currentProgram.isReady()&&n.delete(t)})),0!==n.size?setTimeout(i,10):e(t)}null!==nt.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)}))};let Ot=null;function kt(){Qt.stop()}function zt(){Qt.start()}const Qt=new Vn;function Vt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)m.pushLight(t),t.castShadow&&m.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||z.intersectsSprite(t)){n&&j.setFromMatrixPosition(t.matrixWorld).applyMatrix4(G);const e=pt.update(t),r=t.material;r.visible&&g.push(t,e,r,i,j.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||z.intersectsObject(t))){const e=pt.update(t),r=t.material;if(n&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),j.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),j.copy(e.boundingSphere.center)),j.applyMatrix4(t.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const n=e.groups;for(let a=0,o=n.length;a<o;a++){const o=n[a],s=r[o.materialIndex];s&&s.visible&&g.push(t,e,s,i,j.z,o)}}else r.visible&&g.push(t,e,r,i,j.z,null)}const r=t.children;for(let t=0,a=r.length;t<a;t++)Vt(r[t],e,i,n)}function Gt(t,e,i,n){const r=t.opaque,a=t.transmissive,o=t.transparent;m.setupLightsView(i),!0===Q&&_t.setGlobalState(y.clippingPlanes,i),a.length>0&&function(t,e,i,n){if(null!==(!0===i.isScene?i.overrideMaterial:null))return;const r=rt.isWebGL2;null===H&&(H=new me(1,1,{generateMipmaps:!0,type:nt.has("EXT_color_buffer_half_float")?$:Z,minFilter:q,samples:r?4:0})),y.getDrawingBufferSize(W),r?H.setSize(W.x,W.y):H.setSize(Ht(W.x),Ht(W.y));const a=y.getRenderTarget();y.setRenderTarget(H),y.getClearColor(T),U=y.getClearAlpha(),U<1&&y.setClearColor(16777215,.5),y.clear();const o=y.toneMapping;y.toneMapping=F,Wt(t,i,n),lt.updateMultisampleRenderTarget(H),lt.updateRenderTargetMipmap(H);let s=!1;for(let t=0,r=e.length;t<r;t++){const r=e[t],a=r.object,o=r.geometry,l=r.material,c=r.group;if(2===l.side&&a.layers.test(n.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,Xt(a,i,n,o,l,c),l.side=t,l.needsUpdate=!0,s=!0}}!0===s&&(lt.updateMultisampleRenderTarget(H),lt.updateRenderTargetMipmap(H)),y.setRenderTarget(a),y.setClearColor(T,U),y.toneMapping=o}(r,a,e,i),n&&at.viewport(w.copy(n)),r.length>0&&Wt(r,e,i),a.length>0&&Wt(a,e,i),o.length>0&&Wt(o,e,i),at.buffers.depth.setTest(!0),at.buffers.depth.setMask(!0),at.buffers.color.setMask(!0),at.setPolygonOffset(!1)}function Wt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],o=a.object,s=a.geometry,l=null===n?a.material:n,c=a.group;o.layers.test(i.layers)&&Xt(o,e,i,s,l,c)}}function Xt(t,e,i,n,r,a){t.onBeforeRender(y,e,i,n,r,a),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(y,e,i,n,t,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,y.renderBufferDirect(i,e,n,r,t,a),r.side=0,r.needsUpdate=!0,y.renderBufferDirect(i,e,n,r,t,a),r.side=2):y.renderBufferDirect(i,e,n,r,t,a),t.onAfterRender(y,e,i,n,r,a)}function qt(t,e,i){!0!==e.isScene&&(e=X);const n=st.get(t),r=m.state.lights,a=m.state.shadowsArray,o=r.state.version,s=mt.getParameters(t,r.state,a,e,i),l=mt.getProgramCacheKey(s);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?ht:ct).get(t.envMap||n.environment),void 0===c&&(t.addEventListener("dispose",Pt),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===o)return Yt(t,s),h}else s.uniforms=mt.getUniforms(t),t.onBuild(i,s,y),t.onBeforeCompile(s,y),h=mt.acquireProgram(s,l),c.set(l,h),n.uniforms=s.uniforms;const d=n.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=_t.uniform),Yt(t,s),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=o,n.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix),n.currentProgram=h,n.uniformsList=null,h}function Zt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=Ua.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function Yt(t,e){const i=st.get(t);i.outputColorSpace=e.outputColorSpace,i.batching=e.batching,i.instancing=e.instancing,i.instancingColor=e.instancingColor,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Qt.setAnimationLoop((function(t){Ot&&Ot(t)})),"undefined"!=typeof self&&Qt.setContext(self),this.setAnimationLoop=function(t){Ot=t,Bt.setAnimationLoop(t),null===t?Qt.stop():Qt.start()},Bt.addEventListener("sessionstart",kt),Bt.addEventListener("sessionend",zt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===_)return;!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Bt.enabled&&!0===Bt.isPresenting&&(!0===Bt.cameraAutoUpdate&&Bt.updateCamera(e),e=Bt.getCamera()),!0===t.isScene&&t.onBeforeRender(y,t,e,E),m=yt.get(t,v.length),m.init(),v.push(m),G.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(G),V=this.localClippingEnabled,Q=_t.init(this.clippingPlanes,V),g=vt.get(t,b.length),g.init(),b.push(g),Vt(t,e,0,y.sortObjects),g.finish(),!0===y.sortObjects&&g.sort(D,P),this.info.render.frame++,!0===Q&&_t.beginShadows();const i=m.state.shadowsArray;if(At.render(i,t,e),!0===Q&&_t.endShadows(),!0===this.info.autoReset&&this.info.reset(),xt.render(g,t),m.setupLights(y._useLegacyLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];Gt(g,t,n,n.viewport)}}else Gt(g,t,e);null!==E&&(lt.updateMultisampleRenderTarget(E),lt.updateRenderTargetMipmap(E)),!0===t.isScene&&t.onAfterRender(y,t,e),St.resetDefaultState(),C=-1,M=null,v.pop(),m=v.length>0?v[v.length-1]:null,b.pop(),g=b.length>0?b[b.length-1]:null},this.getActiveCubeFace=function(){return A},this.getActiveMipmapLevel=function(){return x},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(t,e,i){st.get(t.texture).__webglTexture=e,st.get(t.depthTexture).__webglTexture=i;const n=st.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===nt.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const i=st.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){E=t,A=e,x=i;let n=!0,r=null,a=!1,o=!1;if(t){const s=st.get(t);void 0!==s.__useDefaultFramebuffer?(at.bindFramebuffer(Tt.FRAMEBUFFER,null),n=!1):void 0===s.__webglFramebuffer?lt.setupRenderTarget(t):s.__hasExternalTextures&&lt.rebindTextures(t,st.get(t.texture).__webglTexture,st.get(t.depthTexture).__webglTexture);const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=st.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][i]:c[e],a=!0):r=rt.isWebGL2&&t.samples>0&&!1===lt.useMultisampledRTT(t)?st.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[i]:c,w.copy(t.viewport),S.copy(t.scissor),I=t.scissorTest}else w.copy(N).multiplyScalar(L).floor(),S.copy(O).multiplyScalar(L).floor(),I=k;if(at.bindFramebuffer(Tt.FRAMEBUFFER,r)&&rt.drawBuffers&&n&&at.drawBuffers(t,r),at.viewport(w),at.scissor(S),at.setScissorTest(I),a){const n=st.get(t.texture);Tt.framebufferTexture2D(Tt.FRAMEBUFFER,Tt.COLOR_ATTACHMENT0,Tt.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(o){const n=st.get(t.texture),r=e||0;Tt.framebufferTextureLayer(Tt.FRAMEBUFFER,Tt.COLOR_ATTACHMENT0,n.__webglTexture,i||0,r)}C=-1},this.readRenderTargetPixels=function(t,e,i,n,r,a,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=st.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){at.bindFramebuffer(Tt.FRAMEBUFFER,s);try{const o=t.texture,s=o.format,l=o.type;if(s!==et&&wt.convert(s)!==Tt.getParameter(Tt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===$&&(nt.has("EXT_color_buffer_half_float")||rt.isWebGL2&&nt.has("EXT_color_buffer_float"));if(!(l===Z||wt.convert(l)===Tt.getParameter(Tt.IMPLEMENTATION_COLOR_READ_TYPE)||l===K&&(rt.isWebGL2||nt.has("OES_texture_float")||nt.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Tt.readPixels(e,i,n,r,wt.convert(s),wt.convert(l),a)}finally{const t=null!==E?st.get(E).__webglFramebuffer:null;at.bindFramebuffer(Tt.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),a=Math.floor(e.image.height*n);lt.setTexture2D(e,0),Tt.copyTexSubImage2D(Tt.TEXTURE_2D,i,0,0,t.x,t.y,r,a),at.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,a=e.image.height,o=wt.convert(i.format),s=wt.convert(i.type);lt.setTexture2D(i,0),Tt.pixelStorei(Tt.UNPACK_FLIP_Y_WEBGL,i.flipY),Tt.pixelStorei(Tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Tt.pixelStorei(Tt.UNPACK_ALIGNMENT,i.unpackAlignment),e.isDataTexture?Tt.texSubImage2D(Tt.TEXTURE_2D,n,t.x,t.y,r,a,o,s,e.image.data):e.isCompressedTexture?Tt.compressedTexSubImage2D(Tt.TEXTURE_2D,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):Tt.texSubImage2D(Tt.TEXTURE_2D,n,t.x,t.y,o,s,e.image),0===n&&i.generateMipmaps&&Tt.generateMipmap(Tt.TEXTURE_2D),at.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(y.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,s=t.max.z-t.min.z+1,l=wt.convert(n.format),c=wt.convert(n.type);let h;if(n.isData3DTexture)lt.setTexture3D(n,0),h=Tt.TEXTURE_3D;else{if(!n.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");lt.setTexture2DArray(n,0),h=Tt.TEXTURE_2D_ARRAY}Tt.pixelStorei(Tt.UNPACK_FLIP_Y_WEBGL,n.flipY),Tt.pixelStorei(Tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Tt.pixelStorei(Tt.UNPACK_ALIGNMENT,n.unpackAlignment);const d=Tt.getParameter(Tt.UNPACK_ROW_LENGTH),u=Tt.getParameter(Tt.UNPACK_IMAGE_HEIGHT),p=Tt.getParameter(Tt.UNPACK_SKIP_PIXELS),f=Tt.getParameter(Tt.UNPACK_SKIP_ROWS),g=Tt.getParameter(Tt.UNPACK_SKIP_IMAGES),m=i.isCompressedTexture?i.mipmaps[0]:i.image;Tt.pixelStorei(Tt.UNPACK_ROW_LENGTH,m.width),Tt.pixelStorei(Tt.UNPACK_IMAGE_HEIGHT,m.height),Tt.pixelStorei(Tt.UNPACK_SKIP_PIXELS,t.min.x),Tt.pixelStorei(Tt.UNPACK_SKIP_ROWS,t.min.y),Tt.pixelStorei(Tt.UNPACK_SKIP_IMAGES,t.min.z),i.isDataTexture||i.isData3DTexture?Tt.texSubImage3D(h,r,e.x,e.y,e.z,a,o,s,l,c,m.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Tt.compressedTexSubImage3D(h,r,e.x,e.y,e.z,a,o,s,l,m.data)):Tt.texSubImage3D(h,r,e.x,e.y,e.z,a,o,s,l,c,m),Tt.pixelStorei(Tt.UNPACK_ROW_LENGTH,d),Tt.pixelStorei(Tt.UNPACK_IMAGE_HEIGHT,u),Tt.pixelStorei(Tt.UNPACK_SKIP_PIXELS,p),Tt.pixelStorei(Tt.UNPACK_SKIP_ROWS,f),Tt.pixelStorei(Tt.UNPACK_SKIP_IMAGES,g),0===r&&n.generateMipmaps&&Tt.generateMipmap(h),at.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?lt.setTextureCube(t,0):t.isData3DTexture?lt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?lt.setTexture2DArray(t,0):lt.setTexture2D(t,0),at.unbindTexture()},this.resetState=function(){A=0,x=0,E=null,at.reset(),St.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===mt?"display-p3":"srgb",e.unpackColorSpace=re.workingColorSpace===bt?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===ft?ut:3e3}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===ut?ft:gt}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}(class extends Co{}).prototype.isWebGL1Renderer=!0;class Mo extends Qi{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Oi(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const wo=new _e,So=new _e,Io=new Ye,To=new Ze,Uo=new Qe;class Fo extends Ai{constructor(t=new nn,e=new Mo){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)wo.fromBufferAttribute(e,t-1),So.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=wo.distanceTo(So);t.setAttribute("lineDistance",new qi(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Uo.copy(i.boundingSphere),Uo.applyMatrix4(n),Uo.radius+=r,!1===t.ray.intersectsSphere(Uo))return;Io.copy(n).invert(),To.copy(t.ray).applyMatrix4(Io);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new _e,c=new _e,h=new _e,d=new _e,u=this.isLineSegments?2:1,p=i.index,f=i.attributes.position;if(null!==p)for(let i=Math.max(0,a.start),n=Math.min(p.count,a.start+a.count)-1;i<n;i+=u){const n=p.getX(i),r=p.getX(i+1);if(l.fromBufferAttribute(f,n),c.fromBufferAttribute(f,r),To.distanceSqToSegment(l,c,d,h)>s)continue;d.applyMatrix4(this.matrixWorld);const a=t.ray.origin.distanceTo(d);a<t.near||a>t.far||e.push({distance:a,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}else for(let i=Math.max(0,a.start),n=Math.min(f.count,a.start+a.count)-1;i<n;i+=u){if(l.fromBufferAttribute(f,i),c.fromBufferAttribute(f,i+1),To.distanceSqToSegment(l,c,d,h)>s)continue;d.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(d);n<t.near||n>t.far||e.push({distance:n,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}class Bo{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)i=this.getPoint(a/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let a;a=e||t*i[r-1];let o,s=0,l=r-1;for(;s<=l;)if(n=Math.floor(s+(l-s)/2),o=i[n]-a,o<0)s=n+1;else{if(!(o>0)){l=n;break}l=n-1}if(n=l,i[n]===a)return n/(r-1);const c=i[n];return(n+(a-c)/(i[n+1]-c))/(r-1)}getTangent(t,e){const i=1e-4;let n=t-i,r=t+i;n<0&&(n=0),r>1&&(r=1);const a=this.getPoint(n),o=this.getPoint(r),s=e||(a.isVector2?new jt:new _e);return s.copy(o).sub(a).normalize(),s}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new _e,n=[],r=[],a=[],o=new _e,s=new Ye;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new _e)}r[0]=new _e,a[0]=new _e;let l=Number.MAX_VALUE;const c=Math.abs(n[0].x),h=Math.abs(n[0].y),d=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),d<=l&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],o),a[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),a[e]=a[e-1].clone(),o.crossVectors(n[e-1],n[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(zt(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(s.makeRotationAxis(o,t))}a[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(zt(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(s.makeRotationAxis(n[i],e*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ro extends Bo{constructor(t=0,e=0,i=1,n=1,r=0,a=2*Math.PI,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(t,e){const i=e||new jt,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);const o=this.aStartAngle+t*r;let s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=s-this.aX,n=l-this.aY;s=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(s,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function Lo(){let t=0,e=0,i=0,n=0;function r(r,a,o,s){t=r,e=o,i=-3*r+3*a-2*o-s,n=2*r-2*a+o+s}return{initCatmullRom:function(t,e,i,n,a){r(e,i,a*(i-t),a*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,a,o,s){let l=(e-t)/a-(i-t)/(a+o)+(i-e)/o,c=(i-e)/o-(n-e)/(o+s)+(n-i)/s;l*=o,c*=o,r(e,i,l,c)},calc:function(r){const a=r*r;return t+e*r+i*a+n*(a*r)}}}const Do=new _e,Po=new Lo,No=new Lo,Oo=new Lo;function ko(t,e,i,n,r){const a=.5*(n-e),o=.5*(r-i),s=t*t;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function zo(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Qo(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}class Vo extends Bo{constructor(t=new jt,e=new jt,i=new jt,n=new jt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new jt){const i=e,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Qo(t,n.x,r.x,a.x,o.x),Qo(t,n.y,r.y,a.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Ho extends Bo{constructor(t=new _e,e=new _e,i=new _e,n=new _e){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new _e){const i=e,n=this.v0,r=this.v1,a=this.v2,o=this.v3;return i.set(Qo(t,n.x,r.x,a.x,o.x),Qo(t,n.y,r.y,a.y,o.y),Qo(t,n.z,r.z,a.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Go extends Bo{constructor(t=new jt,e=new jt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new jt){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new jt){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Wo extends Bo{constructor(t=new jt,e=new jt,i=new jt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new jt){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(zo(t,n.x,r.x,a.x),zo(t,n.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class jo extends Bo{constructor(t=new _e,e=new _e,i=new _e){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new _e){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(zo(t,n.x,r.x,a.x),zo(t,n.y,r.y,a.y),zo(t,n.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Xo extends Bo{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new jt){const i=e,n=this.points,r=(n.length-1)*t,a=Math.floor(r),o=r-a,s=n[0===a?a:a-1],l=n[a],c=n[a>n.length-2?n.length-1:a+1],h=n[a>n.length-3?n.length-1:a+2];return i.set(ko(o,s.x,l.x,c.x,h.x),ko(o,s.y,l.y,c.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new jt).fromArray(i))}return this}}var qo=Object.freeze({__proto__:null,ArcCurve:class extends Ro{constructor(t,e,i,n,r,a){super(t,e,i,i,n,r,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Bo{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new _e){const i=e,n=this.points,r=n.length,a=(r-(this.closed?0:1))*t;let o,s,l=Math.floor(a),c=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=n[(l-1)%r]:(Do.subVectors(n[0],n[1]).add(n[0]),o=Do);const h=n[l%r],d=n[(l+1)%r];if(this.closed||l+2<r?s=n[(l+2)%r]:(Do.subVectors(n[r-1],n[r-2]).add(n[r-1]),s=Do),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(h),t),i=Math.pow(h.distanceToSquared(d),t),n=Math.pow(d.distanceToSquared(s),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Po.initNonuniformCatmullRom(o.x,h.x,d.x,s.x,e,i,n),No.initNonuniformCatmullRom(o.y,h.y,d.y,s.y,e,i,n),Oo.initNonuniformCatmullRom(o.z,h.z,d.z,s.z,e,i,n)}else"catmullrom"===this.curveType&&(Po.initCatmullRom(o.x,h.x,d.x,s.x,this.tension),No.initCatmullRom(o.y,h.y,d.y,s.y,this.tension),Oo.initCatmullRom(o.z,h.z,d.z,s.z,this.tension));return i.set(Po.calc(c),No.calc(c),Oo.calc(c)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new _e).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:Vo,CubicBezierCurve3:Ho,EllipseCurve:Ro,LineCurve:Go,LineCurve3:class extends Bo{constructor(t=new _e,e=new _e){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new _e){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new _e){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Wo,QuadraticBezierCurve3:jo,SplineCurve:Xo});class Zo extends Bo{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new qo[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=i){const t=n[r]-i,a=this.curves[r],o=a.getLength(),s=0===o?0:1-t/o;return a.getPointAt(s,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const a=r[n],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o);for(let t=0;t<s.length;t++){const n=s[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new qo[i.type]).fromJSON(i))}return this}}class Yo extends Zo{constructor(t){super(),this.type="Path",this.currentPoint=new jt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Go(this.currentPoint.clone(),new jt(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new Wo(this.currentPoint.clone(),new jt(t,e),new jt(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,a){const o=new Vo(this.currentPoint.clone(),new jt(t,e),new jt(i,n),new jt(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new Xo(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,a){const o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,i,n,r,a),this}absarc(t,e,i,n,r,a){return this.absellipse(t,e,i,i,n,r,a),this}ellipse(t,e,i,n,r,a,o,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,r,a,o,s),this}absellipse(t,e,i,n,r,a,o,s){const l=new Ro(t,e,i,n,r,a,o,s);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Jo extends nn{constructor(t=1,e=1,i=1,n=32,r=1,a=!1,o=0,s=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};const l=this;n=Math.floor(n),r=Math.floor(r);const c=[],h=[],d=[],u=[];let p=0;const f=[],g=i/2;let m=0;function b(i){const r=p,a=new jt,f=new _e;let b=0;const v=!0===i?t:e,y=!0===i?1:-1;for(let t=1;t<=n;t++)h.push(0,g*y,0),d.push(0,y,0),u.push(.5,.5),p++;const _=p;for(let t=0;t<=n;t++){const e=t/n*s+o,i=Math.cos(e),r=Math.sin(e);f.x=v*r,f.y=g*y,f.z=v*i,h.push(f.x,f.y,f.z),d.push(0,y,0),a.x=.5*i+.5,a.y=.5*r*y+.5,u.push(a.x,a.y),p++}for(let t=0;t<n;t++){const e=r+t,n=_+t;!0===i?c.push(n,n+1,e):c.push(n+1,n,e),b+=3}l.addGroup(m,b,!0===i?1:2),m+=b}!function(){const a=new _e,b=new _e;let v=0;const y=(e-t)/i;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*s+o,l=Math.sin(r),f=Math.cos(r);b.x=v*l,b.y=-m*i+g,b.z=v*f,h.push(b.x,b.y,b.z),a.set(l,y,f).normalize(),d.push(a.x,a.y,a.z),u.push(e,1-m),c.push(p++)}f.push(c)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=f[e][t],n=f[e+1][t],r=f[e+1][t+1],a=f[e][t+1];c.push(i,n,a),c.push(n,r,a),v+=6}l.addGroup(m,v,0),m+=v}(),!1===a&&(t>0&&b(!0),e>0&&b(!1)),this.setIndex(c),this.setAttribute("position",new qi(h,3)),this.setAttribute("normal",new qi(d,3)),this.setAttribute("uv",new qi(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Jo(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Ko extends Jo{constructor(t=1,e=1,i=32,n=1,r=!1,a=0,o=2*Math.PI){super(0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}static fromJSON(t){return new Ko(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class $o extends Yo{constructor(t){super(t),this.uuid=kt(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new Yo).fromJSON(i))}return this}}function ts(t,e,i,n,r){let a,o;if(r===function(t,e,i,n){let r=0;for(let a=e,o=i-n;a<i;a+=n)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}(t,e,i,n)>0)for(a=e;a<i;a+=n)o=As(a,t[a],t[a+1],o);else for(a=i-n;a>=e;a-=n)o=As(a,t[a],t[a+1],o);return o&&gs(o,o.next)&&(xs(o),o=o.next),o}function es(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!gs(n,n.next)&&0!==fs(n.prev,n,n.next))n=n.next;else{if(xs(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function is(t,e,i,n,r,a,o){if(!t)return;!o&&a&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=hs(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,a,o,s,l,c=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,n=i,s=0,e=0;e<c&&(s++,n=n.nextZ,n);e++);for(l=c;s>0||l>0&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,l--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,c*=2}while(o>1)}(r)}(t,n,r,a);let s,l,c=t;for(;t.prev!==t.next;)if(s=t.prev,l=t.next,a?rs(t,n,r,a):ns(t))e.push(s.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),xs(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?is(t=as(es(t),e,i),e,i,n,r,a,2):2===o&&os(t,e,i,n,r,a):is(es(t),e,i,n,r,a,1);break}}function ns(t){const e=t.prev,i=t,n=t.next;if(fs(e,i,n)>=0)return!1;const r=e.x,a=i.x,o=n.x,s=e.y,l=i.y,c=n.y,h=r<a?r<o?r:o:a<o?a:o,d=s<l?s<c?s:c:l<c?l:c,u=r>a?r>o?r:o:a>o?a:o,p=s>l?s>c?s:c:l>c?l:c;let f=n.next;for(;f!==e;){if(f.x>=h&&f.x<=u&&f.y>=d&&f.y<=p&&us(r,s,a,l,o,c,f.x,f.y)&&fs(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function rs(t,e,i,n){const r=t.prev,a=t,o=t.next;if(fs(r,a,o)>=0)return!1;const s=r.x,l=a.x,c=o.x,h=r.y,d=a.y,u=o.y,p=s<l?s<c?s:c:l<c?l:c,f=h<d?h<u?h:u:d<u?d:u,g=s>l?s>c?s:c:l>c?l:c,m=h>d?h>u?h:u:d>u?d:u,b=hs(p,f,e,i,n),v=hs(g,m,e,i,n);let y=t.prevZ,_=t.nextZ;for(;y&&y.z>=b&&_&&_.z<=v;){if(y.x>=p&&y.x<=g&&y.y>=f&&y.y<=m&&y!==r&&y!==o&&us(s,h,l,d,c,u,y.x,y.y)&&fs(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==o&&us(s,h,l,d,c,u,_.x,_.y)&&fs(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;y&&y.z>=b;){if(y.x>=p&&y.x<=g&&y.y>=f&&y.y<=m&&y!==r&&y!==o&&us(s,h,l,d,c,u,y.x,y.y)&&fs(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==o&&us(s,h,l,d,c,u,_.x,_.y)&&fs(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function as(t,e,i){let n=t;do{const r=n.prev,a=n.next.next;!gs(r,a)&&ms(r,n,n.next,a)&&ys(r,a)&&ys(a,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(a.i/i|0),xs(n),xs(n.next),n=t=a),n=n.next}while(n!==t);return es(n)}function os(t,e,i,n,r,a){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&ps(o,t)){let s=_s(o,t);return o=es(o,o.next),s=es(s,s.next),is(o,e,i,n,r,a,0),void is(s,e,i,n,r,a,0)}t=t.next}o=o.next}while(o!==t)}function ss(t,e){return t.x-e.x}function ls(t,e){const i=function(t,e){let i,n=e,r=-1/0;const a=t.x,o=t.y;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){const t=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=a&&t>r&&(r=t,i=n.x<n.next.x?n:n.next,t===a))return i}n=n.next}while(n!==e);if(!i)return null;const s=i,l=i.x,c=i.y;let h,d=1/0;n=i;do{a>=n.x&&n.x>=l&&a!==n.x&&us(o<c?a:r,o,l,c,o<c?r:a,o,n.x,n.y)&&(h=Math.abs(o-n.y)/(a-n.x),ys(n,t)&&(h<d||h===d&&(n.x>i.x||n.x===i.x&&cs(i,n)))&&(i=n,d=h)),n=n.next}while(n!==s);return i}(t,e);if(!i)return e;const n=_s(i,t);return es(n,n.next),es(i,i.next)}function cs(t,e){return fs(t.prev,t,e.prev)<0&&fs(e.next,t,t.next)<0}function hs(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ds(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function us(t,e,i,n,r,a,o,s){return(r-o)*(e-s)>=(t-o)*(a-s)&&(t-o)*(n-s)>=(i-o)*(e-s)&&(i-o)*(a-s)>=(r-o)*(n-s)}function ps(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ms(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(ys(t,e)&&ys(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(fs(t.prev,t,e.prev)||fs(t,e.prev,e))||gs(t,e)&&fs(t.prev,t,t.next)>0&&fs(e.prev,e,e.next)>0)}function fs(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function gs(t,e){return t.x===e.x&&t.y===e.y}function ms(t,e,i,n){const r=vs(fs(t,e,i)),a=vs(fs(t,e,n)),o=vs(fs(i,n,t)),s=vs(fs(i,n,e));return r!==a&&o!==s||!(0!==r||!bs(t,i,e))||!(0!==a||!bs(t,n,e))||!(0!==o||!bs(i,t,n))||!(0!==s||!bs(i,e,n))}function bs(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function vs(t){return t>0?1:t<0?-1:0}function ys(t,e){return fs(t.prev,t,t.next)<0?fs(t,e,t.next)>=0&&fs(t,t.prev,e)>=0:fs(t,e,t.prev)<0||fs(t,t.next,e)<0}function _s(t,e){const i=new Es(t.i,t.x,t.y),n=new Es(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function As(t,e,i,n){const r=new Es(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function xs(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Es(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Cs{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return Cs.area(t)<0}static triangulateShape(t,e){const i=[],n=[],r=[];Ms(t),ws(i,t);let a=t.length;e.forEach(Ms);for(let t=0;t<e.length;t++)n.push(a),a+=e[t].length,ws(i,e[t]);const o=function(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let a=ts(t,0,r,i,!0);const o=[];if(!a||a.next===a.prev)return o;let s,l,c,h,d,u,p;if(n&&(a=function(t,e,i,n){const r=[];let a,o,s,l,c;for(a=0,o=e.length;a<o;a++)s=e[a]*n,l=a<o-1?e[a+1]*n:t.length,c=ts(t,s,l,n,!1),c===c.next&&(c.steiner=!0),r.push(ds(c));for(r.sort(ss),a=0;a<r.length;a++)i=ls(r[a],i);return i}(t,e,a,i)),t.length>80*i){s=c=t[0],l=h=t[1];for(let e=i;e<r;e+=i)d=t[e],u=t[e+1],d<s&&(s=d),u<l&&(l=u),d>c&&(c=d),u>h&&(h=u);p=Math.max(c-s,h-l),p=0!==p?32767/p:0}return is(a,o,i,s,l,p,0),o}(i,n);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}}function Ms(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function ws(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class Ss extends nn{constructor(t=new $o([new jt(.5,.5),new jt(-.5,.5),new jt(-.5,-.5),new jt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++)a(t[e]);function a(t){const a=[],o=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,l=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,d=void 0!==e.bevelSize?e.bevelSize:h-.1,u=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,g=void 0!==e.UVGenerator?e.UVGenerator:Is;let m,b,v,y,_,A=!1;f&&(m=f.getSpacedPoints(s),A=!0,c=!1,b=f.computeFrenetFrames(s,!1),v=new _e,y=new _e,_=new _e),c||(p=0,h=0,d=0,u=0);const x=t.extractPoints(o);let E=x.shape;const C=x.holes;if(!Cs.isClockWise(E)){E=E.reverse();for(let t=0,e=C.length;t<e;t++){const e=C[t];Cs.isClockWise(e)&&(C[t]=e.reverse())}}const M=Cs.triangulateShape(E,C),w=E;for(let t=0,e=C.length;t<e;t++){const e=C[t];E=E.concat(e)}function S(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}const I=E.length,T=M.length;function U(t,e,i){let n,r,a;const o=t.x-e.x,s=t.y-e.y,l=i.x-t.x,c=i.y-t.y,h=o*o+s*s,d=o*c-s*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(h),u=Math.sqrt(l*l+c*c),p=e.x-s/d,f=e.y+o/d,g=((i.x-c/u-p)*c-(i.y+l/u-f)*l)/(o*c-s*l);n=p+o*g-t.x,r=f+s*g-t.y;const m=n*n+r*r;if(m<=2)return new jt(n,r);a=Math.sqrt(m/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(c)&&(t=!0),t?(n=-s,r=o,a=Math.sqrt(h)):(n=o,r=s,a=Math.sqrt(h/2))}return new jt(n/a,r/a)}const F=[];for(let t=0,e=w.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),F[t]=U(w[t],w[i],w[n]);const B=[];let R,L=F.concat();for(let t=0,e=C.length;t<e;t++){const e=C[t];R=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),R[t]=U(e[t],e[n],e[r]);B.push(R),L=L.concat(R)}for(let t=0;t<p;t++){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=w.length;t<e;t++){const e=S(w[t],F[t],n);N(e.x,e.y,-i)}for(let t=0,e=C.length;t<e;t++){const e=C[t];R=B[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],R[t],n);N(r.x,r.y,-i)}}}const D=d+u;for(let t=0;t<I;t++){const e=c?S(E[t],L[t],D):E[t];A?(y.copy(b.normals[0]).multiplyScalar(e.x),v.copy(b.binormals[0]).multiplyScalar(e.y),_.copy(m[0]).add(y).add(v),N(_.x,_.y,_.z)):N(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<I;e++){const i=c?S(E[e],L[e],D):E[e];A?(y.copy(b.normals[t]).multiplyScalar(i.x),v.copy(b.binormals[t]).multiplyScalar(i.y),_.copy(m[t]).add(y).add(v),N(_.x,_.y,_.z)):N(i.x,i.y,l/s*t)}for(let t=p-1;t>=0;t--){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=w.length;t<e;t++){const e=S(w[t],F[t],n);N(e.x,e.y,l+i)}for(let t=0,e=C.length;t<e;t++){const e=C[t];R=B[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],R[t],n);A?N(r.x,r.y+m[s-1].y,m[s-1].x+i):N(r.x,r.y,l+i)}}}function P(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=s+2*p;t<i;t++){const i=I*t,a=I*(t+1);k(e+n+i,e+r+i,e+r+a,e+n+a)}}}function N(t,e,i){a.push(t),a.push(e),a.push(i)}function O(t,e,r){z(t),z(e),z(r);const a=n.length/3,o=g.generateTopUV(i,n,a-3,a-2,a-1);Q(o[0]),Q(o[1]),Q(o[2])}function k(t,e,r,a){z(t),z(e),z(a),z(e),z(r),z(a);const o=n.length/3,s=g.generateSideWallUV(i,n,o-6,o-3,o-2,o-1);Q(s[0]),Q(s[1]),Q(s[3]),Q(s[1]),Q(s[2]),Q(s[3])}function z(t){n.push(a[3*t+0]),n.push(a[3*t+1]),n.push(a[3*t+2])}function Q(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=I*t;for(let t=0;t<T;t++){const i=M[t];O(i[2]+e,i[1]+e,i[0]+e)}t=s+2*p,e=I*t;for(let t=0;t<T;t++){const i=M[t];O(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<T;t++){const e=M[t];O(e[2],e[1],e[0])}for(let t=0;t<T;t++){const e=M[t];O(e[0]+I*s,e[1]+I*s,e[2]+I*s)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;P(w,e),e+=w.length;for(let t=0,i=C.length;t<i;t++){const i=C[t];P(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new qi(n,3)),this.setAttribute("uv",new qi(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);return i.options=Object.assign({},e),void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON()),i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}const n=t.options.extrudePath;return void 0!==n&&(t.options.extrudePath=(new qo[n.type]).fromJSON(n)),new Ss(i,t.options)}}const Is={generateTopUV:function(t,e,i,n,r){const a=e[3*i],o=e[3*i+1],s=e[3*n],l=e[3*n+1],c=e[3*r],h=e[3*r+1];return[new jt(a,o),new jt(s,l),new jt(c,h)]},generateSideWallUV:function(t,e,i,n,r,a){const o=e[3*i],s=e[3*i+1],l=e[3*i+2],c=e[3*n],h=e[3*n+1],d=e[3*n+2],u=e[3*r],p=e[3*r+1],f=e[3*r+2],g=e[3*a],m=e[3*a+1],b=e[3*a+2];return Math.abs(s-h)<Math.abs(o-c)?[new jt(o,1-l),new jt(c,1-d),new jt(u,1-f),new jt(g,1-b)]:[new jt(s,1-l),new jt(h,1-d),new jt(p,1-f),new jt(m,1-b)]}};class Ts extends nn{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const s=Math.min(a+o,Math.PI);let l=0;const c=[],h=new _e,d=new _e,u=[],p=[],f=[],g=[];for(let u=0;u<=i;u++){const m=[],b=u/i;let v=0;0===u&&0===a?v=.5/e:u===i&&s===Math.PI&&(v=-.5/e);for(let i=0;i<=e;i++){const s=i/e;h.x=-t*Math.cos(n+s*r)*Math.sin(a+b*o),h.y=t*Math.cos(a+b*o),h.z=t*Math.sin(n+s*r)*Math.sin(a+b*o),p.push(h.x,h.y,h.z),d.copy(h).normalize(),f.push(d.x,d.y,d.z),g.push(s+v,1-b),m.push(l++)}c.push(m)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=c[t][n+1],r=c[t][n],o=c[t+1][n],l=c[t+1][n+1];(0!==t||a>0)&&u.push(e,r,l),(t!==i-1||s<Math.PI)&&u.push(r,o,l)}this.setIndex(u),this.setAttribute("position",new qi(p,3)),this.setAttribute("normal",new qi(f,3)),this.setAttribute("uv",new qi(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ts(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Us extends nn{constructor(t=new jo(new _e(-1,-1,0),new _e(-1,1,0),new _e(1,1,0)),e=64,i=1,n=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r};const a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new _e,s=new _e,l=new jt;let c=new _e;const h=[],d=[],u=[],p=[];function f(r){c=t.getPointAt(r/e,c);const l=a.normals[r],u=a.binormals[r];for(let t=0;t<=n;t++){const e=t/n*Math.PI*2,r=Math.sin(e),a=-Math.cos(e);s.x=a*l.x+r*u.x,s.y=a*l.y+r*u.y,s.z=a*l.z+r*u.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=c.x+i*s.x,o.y=c.y+i*s.y,o.z=c.z+i*s.z,h.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)f(t);f(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=n;i++)l.x=t/e,l.y=i/n,u.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=n;e++){const i=(n+1)*(t-1)+(e-1),r=(n+1)*t+(e-1),a=(n+1)*t+e,o=(n+1)*(t-1)+e;p.push(i,r,o),p.push(r,a,o)}}()}(),this.setIndex(p),this.setAttribute("position",new qi(h,3)),this.setAttribute("normal",new qi(d,3)),this.setAttribute("uv",new qi(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Us((new qo[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Fs extends Qi{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Oi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Oi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new jt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=I,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}function Bs(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}class Rs{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let a;i:{n:if(!(t<n)){for(let a=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}if(t>=r)break t;{const o=e[1];t<o&&(i=2,r=o);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){const n=i+a>>>1;t<e[n]?a=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ls extends Rs{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-i;break;case 2402:r=n.length-2,o=e+n[r]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=t,s=2*i-e;break;case 2402:a=1,s=i+n[1]-n[0];break;default:a=t-1,s=e}const l=.5*(i-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(s-i),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(i-e)/(n-e),f=p*p,g=f*p,m=-d*g+2*d*f-d*p,b=(1+d)*g+(-1.5-2*d)*f+(-.5+d)*p+1,v=(-1-u)*g+(1.5+u)*f+.5*p,y=u*g-u*f;for(let t=0;t!==o;++t)r[t]=m*a[c+t]+b*a[l+t]+v*a[s+t]+y*a[h+t];return r}}class Ds extends Rs{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,c=(i-e)/(n-e),h=1-c;for(let t=0;t!==o;++t)r[t]=a[l+t]*h+a[s+t]*c;return r}}class Ps extends Rs{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class Ns{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Bs(e,this.TimeBufferType),this.values=Bs(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Bs(t.times,Array),values:Bs(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Ps(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ds(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ls(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ct:e=this.InterpolantFactoryMethodDiscrete;break;case ht:e=this.InterpolantFactoryMethodLinear;break;case dt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ct;case this.InterpolantFactoryMethodLinear:return ht;case this.InterpolantFactoryMethodSmooth:return dt}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,a=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=i.slice(r,a),this.values=this.values.slice(r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==a&&a>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,a),t=!1;break}a=n}if(void 0!==n&&(o=n,ArrayBuffer.isView(o)&&!(o instanceof DataView)))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}var o;return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===dt,r=t.length-1;let a=1;for(let o=1;o<r;++o){let r=!1;const s=t[o];if(s!==t[o+1]&&(1!==o||s!==t[0]))if(n)r=!0;else{const t=o*i,n=t-i,a=t+i;for(let o=0;o!==i;++o){const i=e[t+o];if(i!==e[n+o]||i!==e[a+o]){r=!0;break}}}if(r){if(o!==a){t[a]=t[o];const n=o*i,r=a*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++a}}if(r>0){t[a]=t[r];for(let t=r*i,n=a*i,o=0;o!==i;++o)e[n+o]=e[t+o];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}Ns.prototype.TimeBufferType=Float32Array,Ns.prototype.ValueBufferType=Float32Array,Ns.prototype.DefaultInterpolation=ht;class Os extends Ns{}Os.prototype.ValueTypeName="bool",Os.prototype.ValueBufferType=Array,Os.prototype.DefaultInterpolation=ct,Os.prototype.InterpolantFactoryMethodLinear=void 0,Os.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends Ns{}).prototype.ValueTypeName="color";(class extends Ns{}).prototype.ValueTypeName="number";class ks extends Rs{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(i-e)/(n-e);let l=t*o;for(let t=l+o;l!==t;l+=4)ye.slerpFlat(r,0,a,l-o,a,l,s);return r}}class zs extends Ns{InterpolantFactoryMethodLinear(t){return new ks(this.times,this.values,this.getValueSize(),t)}}zs.prototype.ValueTypeName="quaternion",zs.prototype.DefaultInterpolation=ht,zs.prototype.InterpolantFactoryMethodSmooth=void 0;class Qs extends Ns{}Qs.prototype.ValueTypeName="string",Qs.prototype.ValueBufferType=Array,Qs.prototype.DefaultInterpolation=ct,Qs.prototype.InterpolantFactoryMethodLinear=void 0,Qs.prototype.InterpolantFactoryMethodSmooth=void 0;(class extends Ns{}).prototype.ValueTypeName="vector";const Vs={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Hs{constructor(t,e,i){const n=this;let r,a=!1,o=0,s=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){s++,!1===a&&void 0!==n.onStart&&n.onStart(t,o,s),a=!0},this.itemEnd=function(t){o++,void 0!==n.onProgress&&n.onProgress(t,o,s),o===s&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Gs=new Hs;class Ws{constructor(t){this.manager=void 0!==t?t:Gs,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ws.DEFAULT_MATERIAL_NAME="__DEFAULT";const js={};class Xs extends Error{constructor(t,e){super(t),this.response=e}}class qs extends Ws{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Vs.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==js[t])return void js[t].push({onLoad:e,onProgress:i,onError:n});js[t]=[],js[t].push({onLoad:e,onProgress:i,onError:n});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,s=this.responseType;fetch(a).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=js[t],n=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),a=r?parseInt(r):0,o=0!==a;let s=0;const l=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:r})=>{if(n)t.close();else{s+=r.byteLength;const n=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(r),e()}}))}()}});return new Response(l)}throw new Xs(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(s){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,o)));case"json":return t.json();default:if(void 0===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(o),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{Vs.add(t,e);const i=js[t];delete js[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=js[t];if(void 0===i)throw this.manager.itemError(t),e;delete js[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}const Zs="\\[\\]\\.:\\/",Ys=new RegExp("["+Zs+"]","g"),Js="[^"+Zs+"]",Ks="[^"+Zs.replace("\\.","")+"]",$s=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Js)+/(WCOD+)?/.source.replace("WCOD",Ks)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Js)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Js)+"$"),tl=["material","materials","bones","map"];class el{constructor(t,e,i){this.path=e,this.parsedPath=i||el.parseTrackName(e),this.node=el.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new el.Composite(t,e,i):new el(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ys,"")}static parseTrackName(t){const e=$s.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==tl.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const a=i(r.children);if(a)return a}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=el.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const a=t[n];if(void 0===a){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}s=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(s=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}el.Composite=class{constructor(t,e,i){const n=i||el.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},el.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},el.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},el.prototype.GetterByBindingType=[el.prototype._getValue_direct,el.prototype._getValue_array,el.prototype._getValue_arrayElement,el.prototype._getValue_toArray],el.prototype.SetterByBindingTypeAndVersioning=[[el.prototype._setValue_direct,el.prototype._setValue_direct_setNeedsUpdate,el.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[el.prototype._setValue_array,el.prototype._setValue_array_setNeedsUpdate,el.prototype._setValue_array_setMatrixWorldNeedsUpdate],[el.prototype._setValue_arrayElement,el.prototype._setValue_arrayElement_setNeedsUpdate,el.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[el.prototype._setValue_fromArray,el.prototype._setValue_fromArray_setNeedsUpdate,el.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1);class il{constructor(){this.type="ShapePath",this.color=new Oi,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Yo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,a){return this.currentPath.bezierCurveTo(t,e,i,n,r,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let n=!1;for(let r=i-1,a=0;a<i;r=a++){let i=e[r],o=e[a],s=o.x-i.x,l=o.y-i.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(i=e[a],s=-s,o=e[r],l=-l),t.y<i.y||t.y>o.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=l*(t.x-i.x)-s*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(o.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=o.x)return!0}}return n}const i=Cs.isClockWise,n=this.subPaths;if(0===n.length)return[];let r,a,o;const s=[];if(1===n.length)return a=n[0],o=new $o,o.curves=a.curves,s.push(o),s;let l=!i(n[0].getPoints());l=t?!l:l;const c=[],h=[];let d,u,p=[],f=0;h[f]=void 0,p[f]=[];for(let e=0,o=n.length;e<o;e++)a=n[e],d=a.getPoints(),r=i(d),r=t?!r:r,r?(!l&&h[f]&&f++,h[f]={s:new $o,p:d},h[f].s.curves=a.curves,l&&f++,p[f]=[]):p[f].push({h:a,p:d[0]});if(!h[0])return function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],r=new $o;r.curves=n.curves,e.push(r)}return e}(n);if(h.length>1){let t=!1,i=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let n=0,r=h.length;n<r;n++){const r=p[n];for(let a=0;a<r.length;a++){const o=r[a];let s=!0;for(let r=0;r<h.length;r++)e(o.p,h[r].p)&&(n!==r&&i++,s?(s=!1,c[r].push(o)):t=!0);s&&c[n].push(o)}}i>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){o=h[t].s,s.push(o),u=p[t];for(let t=0,e=u.length;t<e;t++)o.holes.push(u[t].h)}return s}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:n}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=n)},4385:(t,e,i)=>{"use strict";i.r(e),i.d(e,{TextGeometry:()=>r});var n=i(9437);class r extends n.QCA{constructor(t,e={}){const i=e.font;if(void 0===i)super();else{const n=i.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),super(n,e)}this.type="TextGeometry"}}},4264:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Font:()=>a,FontLoader:()=>r});var n=i(9437);class r extends n.aHM{constructor(t){super(t)}load(t,e,i,r){const a=this,o=new n.Y9S(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(t){const i=a.parse(JSON.parse(t));e&&e(i)}),i,r)}parse(t){return new a(t)}}class a{constructor(t){this.isFont=!0,this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),r=e/i.resolution,a=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,s=[];let l=0,c=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)l=0,c-=a;else{const t=o(e,r,l,c,i);l+=t.offsetX,s.push(t.path)}}return s}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)i.push(...n[t].toShapes());return i}}function o(t,e,i,r,a){const o=a.glyphs[t]||a.glyphs["?"];if(!o)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+a.familyName+".");const s=new n.Ld9;let l,c,h,d,u,p,f,g;if(o.o){const t=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let n=0,a=t.length;n<a;)switch(t[n++]){case"m":l=t[n++]*e+i,c=t[n++]*e+r,s.moveTo(l,c);break;case"l":l=t[n++]*e+i,c=t[n++]*e+r,s.lineTo(l,c);break;case"q":h=t[n++]*e+i,d=t[n++]*e+r,u=t[n++]*e+i,p=t[n++]*e+r,s.quadraticCurveTo(u,p,h,d);break;case"b":h=t[n++]*e+i,d=t[n++]*e+r,u=t[n++]*e+i,p=t[n++]*e+r,f=t[n++]*e+i,g=t[n++]*e+r,s.bezierCurveTo(u,p,f,g,h,d)}}return{offsetX:o.ha*e,path:s}}},8823:(t,e,i)=>{"use strict";i.r(e),i.d(e,{DEG2RAD:()=>a,MathUtils:()=>T,RAD2DEG:()=>o,ceilPowerOfTwo:()=>C,clamp:()=>l,damp:()=>p,degToRad:()=>A,denormalize:()=>S,euclideanModulo:()=>c,floorPowerOfTwo:()=>M,generateUUID:()=>s,inverseLerp:()=>d,isPowerOfTwo:()=>E,lerp:()=>u,mapLinear:()=>h,normalize:()=>I,pingpong:()=>f,radToDeg:()=>x,randFloat:()=>v,randFloatSpread:()=>y,randInt:()=>b,seededRandom:()=>_,setQuaternionFromProperEuler:()=>w,smootherstep:()=>m,smoothstep:()=>g});const n=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let r=1234567;const a=Math.PI/180,o=180/Math.PI;function s(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(n[255&t]+n[t>>8&255]+n[t>>16&255]+n[t>>24&255]+"-"+n[255&e]+n[e>>8&255]+"-"+n[e>>16&15|64]+n[e>>24&255]+"-"+n[63&i|128]+n[i>>8&255]+"-"+n[i>>16&255]+n[i>>24&255]+n[255&r]+n[r>>8&255]+n[r>>16&255]+n[r>>24&255]).toLowerCase()}function l(t,e,i){return Math.max(e,Math.min(i,t))}function c(t,e){return(t%e+e)%e}function h(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)}function d(t,e,i){return t!==e?(i-t)/(e-t):0}function u(t,e,i){return(1-i)*t+i*e}function p(t,e,i,n){return u(t,e,1-Math.exp(-i*n))}function f(t,e=1){return e-Math.abs(c(t,2*e)-e)}function g(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function m(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function b(t,e){return t+Math.floor(Math.random()*(e-t+1))}function v(t,e){return t+Math.random()*(e-t)}function y(t){return t*(.5-Math.random())}function _(t){void 0!==t&&(r=t);let e=r+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function A(t){return t*a}function x(t){return t*o}function E(t){return!(t&t-1)&&0!==t}function C(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function M(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function w(t,e,i,n,r){const a=Math.cos,o=Math.sin,s=a(i/2),l=o(i/2),c=a((e+n)/2),h=o((e+n)/2),d=a((e-n)/2),u=o((e-n)/2),p=a((n-e)/2),f=o((n-e)/2);switch(r){case"XYX":t.set(s*h,l*d,l*u,s*c);break;case"YZY":t.set(l*u,s*h,l*d,s*c);break;case"ZXZ":t.set(l*d,l*u,s*h,s*c);break;case"XZX":t.set(s*h,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*h,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function S(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 I(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const T={DEG2RAD:a,RAD2DEG:o,generateUUID:s,clamp:l,euclideanModulo:c,mapLinear:h,inverseLerp:d,lerp:u,damp:p,pingpong:f,smoothstep:g,smootherstep:m,randInt:b,randFloat:v,randFloatSpread:y,seededRandom:_,degToRad:A,radToDeg:x,isPowerOfTwo:E,ceilPowerOfTwo:C,floorPowerOfTwo:M,setQuaternionFromProperEuler:w,normalize:I,denormalize:S}}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.d=(t,e)=>{for(var i in e)__webpack_require__.o(e,i)&&!__webpack_require__.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__(7511),__webpack_require__(9522),__webpack_require__(662),__webpack_require__(6776),__webpack_require__(4601),__webpack_require__(2240),__webpack_require__(8394),__webpack_require__(5723),__webpack_require__(7619),__webpack_require__(3877),__webpack_require__(9722),__webpack_require__(9781),__webpack_require__(9530),__webpack_require__(7232),__webpack_require__(7040),__webpack_require__(575),__webpack_require__(7100),__webpack_require__(8550),__webpack_require__(1987),__webpack_require__(7552),__webpack_require__(647),__webpack_require__(8628),__webpack_require__(6173),__webpack_require__(6363),__webpack_require__(4483),__webpack_require__(9825),__webpack_require__(9632),__webpack_require__(577),__webpack_require__(3337),__webpack_require__(4330),__webpack_require__(1392),__webpack_require__(3773),__webpack_require__(7026),__webpack_require__(6110),__webpack_require__(4738),__webpack_require__(5852),__webpack_require__(8566),__webpack_require__(80),__webpack_require__(8630),__webpack_require__(4078),__webpack_require__(3285),__webpack_require__(4324),__webpack_require__(9590),pauseButton=__webpack_require__(5379),playButton=__webpack_require__(6457),skipButton=__webpack_require__(4906),rewindButton=__webpack_require__(5126),tooltip=__webpack_require__(5298),FontLoader=__webpack_require__(4264),TextGeometry=__webpack_require__(4385)})();
3
3
  //# sourceMappingURL=aframe-babia-components.min.js.map