@panoramax/web-viewer 3.0.2-develop-a8ea8e60-develop-3c6e8805 → 3.0.2-develop-a8ea8e60-develop-f1bb641f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -1
- package/build/index.css +1 -1
- package/build/index.js +3 -3
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* @panoramax/web-viewer v3.0
|
|
3
|
+
* @panoramax/web-viewer v3.1.0
|
|
4
4
|
* https://gitlab.com/panoramax/clients/web-viewer
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) Panoramax team
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
!function(C,Rn){"object"===typeof exports&&"object"===typeof module?module.exports=Rn():"function"===typeof define&&define.amd?define("Panoramax",[],Rn):"object"===typeof exports?exports.Panoramax=Rn():C.Panoramax=Rn()}(this,(()=>(()=>{var C={2244:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Editor});or(2325);var So=or(6792),To=or(2093),Ro=or(2354),Uo=or(4133),Oo=or(7832),Ho=or(7457),qo=or(3406),dl=or(3114);const ml="sequence-headings";class Editor extends So.Z{constructor(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(C,Rn,Object.assign(or,{users:[]})),this._selectedSeqId||this._loader.dismiss({},"No sequence is selected"),this.psvContainer=document.createElement("div"),this.mapContainer=document.createElement("div"),this.container.appendChild(this.psvContainer),this.container.appendChild(this.mapContainer);try{this.psv=new Ro.ZP(this,this.psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(So){let C=dl.we.isWebGLSupported?this._t.gvs.error_psv:this._t.gvs.error_webgl;this._loader.dismiss(So,C)}this._api.onceReady().then((()=>{try{this.map=new To.Z(this,this.mapContainer,{raster:or.raster,background:or.background,supplementaryStyle:this._createMapStyle()}),(0,Ho.bk)(this),this._loadSequence(),this.map.once("load",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),or.raster&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const C=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=Rn=>(Rn=void 0===this._lastRelHeading?Rn:Rn+this._lastRelHeading-this.psv.getPictureRelativeHeading(),C(Rn))}catch(So){this._loader.dismiss(So,this._t.gvs.error_psv)}})),this.addEventListener("select",this._onSelect.bind(this))}getClassName(){return"Editor"}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...qo.lg.SEQUENCES.layout},paint:{...qo.lg.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...qo.lg.PICTURES.layout},paint:{...qo.lg.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this._api.getSequenceItems(this._selectedSeqId).then((C=>{this._sequenceData=C.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this._selectedSeqId},geometry:{type:"LineString",coordinates:C.features.map((C=>C.geometry.coordinates))}},...C.features.map((C=>(C.properties.id=C.id,C.properties.sequences=[this._selectedSeqId],C)))]});const onMapLoad=()=>{if(this._selectedPicId){const Rn=C.features.find((C=>C.id===this._selectedPicId));Rn?(this.select(this._selectedSeqId,this._selectedPicId,!0),this.map.jumpTo({center:Rn.geometry.coordinates,zoom:18})):console.log("Picture with ID",Rn,"was not found")}else{const Rn=[...C.features[0].geometry.coordinates,...C.features[0].geometry.coordinates];for(let or=1;or<C.features.length;or++){const So=C.features[or].geometry.coordinates;So[0]<Rn[0]&&(Rn[0]=So[0]),So[1]<Rn[1]&&(Rn[1]=So[1]),So[0]>Rn[2]&&(Rn[2]=So[0]),So[1]>Rn[3]&&(Rn[3]=So[1])}this.map.fitBounds(Rn,{animate:!1})}this._loader.dismiss()};this.map.loaded()?onMapLoad():this.map.once("load",onMapLoad)})).catch((C=>this._loader.dismiss(C,this._t.gvs.error_api)))}_getNode(C){const Rn=this._sequenceData.find((Rn=>Rn.properties.id===C)),or=Rn?(0,Ho.FF)(Rn,this._t,this._isInternetFast):null;return or&&delete or.links,or}_addMapBackgroundWidget(){const C=document.createElement("div");C.id="gvs-map-bg",C.classList.add("gvs-panel","gvs-widget-bg","gvs-input-group");const onBgChange=C=>this.map.setBackground(C.target.value),Rn=document.createElement("input");Rn.id="gvs-map-bg-streets",Rn.setAttribute("type","radio"),Rn.setAttribute("name","gvs-map-bg"),Rn.setAttribute("value","streets"),Rn.addEventListener("change",onBgChange),C.appendChild(Rn);const or=document.createElement("label");or.setAttribute("for",Rn.id);const So=document.createElement("img");So.src=Oo,or.appendChild(So),or.appendChild(document.createTextNode(this._t.gvs.map_background_streets)),C.appendChild(or);const To=document.createElement("input");To.id="gvs-map-bg-aerial",To.setAttribute("type","radio"),To.setAttribute("name","gvs-map-bg"),To.setAttribute("value","aerial"),To.addEventListener("change",onBgChange),C.appendChild(To);const Ro=document.createElement("label");Ro.setAttribute("for",To.id);const Ho=document.createElement("img");Ho.src=Uo,Ro.appendChild(Ho),Ro.appendChild(document.createTextNode(this._t.gvs.map_background_aerial)),C.appendChild(Ro),this.mapContainer.appendChild(C);const onMapBgChange=C=>{"aerial"===C?To.checked=!0:Rn.checked=!0};this.addEventListener("map:background-changed",(C=>onMapBgChange(C.detail.background))),onMapBgChange(this.map.getBackground())}previewSequenceHeadingChange(C){const Rn=void 0!==this.map.getLayer(ml);if(this.map._picMarkerPreview.remove(),void 0===C)return delete this._lastRelHeading,Rn&&this.map.setLayoutProperty(ml,"visibility","none"),void(this._selectedPicId&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=C,Rn||this.map.addLayer({id:ml,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"gvs-marker","icon-overlap":"always","icon-size":.8}});const or=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(ml,"visibility","visible"),this.map.setLayoutProperty(ml,"icon-rotate",["+",["get","view:azimuth"],or,C]);const So=[["==",["geometry-type"],"Point"]];this._selectedPicId&&So.push(["!=",["get","id"],this._selectedPicId]),this.map.setFilter(ml,["all",...So]),this._selectedPicId&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}},9323:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Oo});var So=or(6792),To=or(2093),Ro=or(3406),Uo=or(4307);class StandaloneMap extends So.Z{constructor(C,Rn){super(C,Rn,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this.mapContainer=document.createElement("div"),this.container.appendChild(this.mapContainer),this._api.onceReady().then((()=>this._initMap())),this.addEventListener("map:picture-click",(C=>this.select(C.detail.seqId,C.detail.picId))),this.addEventListener("map:sequence-click",(C=>this.select(C.detail.seqId))),this.addEventListener("select",this._onSelect.bind(this))}getClassName(){return"Map"}destroy(){super.destroy(),this.map.destroy(),delete this.map,this.mapContainer.remove(),this.container.innerHTML="",this.container.classList.remove(...[...this.container.classList].filter((C=>C.startsWith("gvs"))))}_initMap(){this._options.hash=!0;class MyMap extends To.Z{_getLayerStyleProperties(C){return"pictures_symbols"===C?{layout:{visibility:"none"}}:super._getLayerStyleProperties(C)}}this.map=new MyMap(this,this.mapContainer,this._options),this.map.addControl(new Uo.NavigationControl({showCompass:!1})),this.map.on("load",(()=>{this.map.reloadLayersStyles(),this._loader.dismiss()}))}_onSelect(C){if(C.detail.picId||C.detail.seqId){const Rn=C.detail.picId?"pictures":"sequences",or=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((C=>(0,Ro.lh)(C,Rn))),filter:["==",["get","id"],C.detail.picId||C.detail.seqId]});or.length>=0&&null!=or[0]&&this.map._attachPreviewToPictures({features:or},Rn)}}}const Oo=StandaloneMap},1707:(C,Rn,or)=>{"use strict";or.d(Rn,{O_:()=>Ho.O_,ZP:()=>Viewer,ns:()=>vl,q7:()=>Ho.q7});or(2411);var So=or(3114),To=or(9705),Ro=or(9204),Uo=or(7457),Oo=or(6792),Ho=or(2354),qo=or(2093),dl=or(3406),ml=or(4824),fl=or(6899);const vl=20,bl=Math.PI/6,kl=100,Ll="http://127.0.0.1:8111",Dl={DEFAULT:"default",AGE:"age",TYPE:"type"};class Viewer extends Oo.Z{constructor(C,Rn){var or;let Uo,Oo=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(super(C,Rn,Oo),null==this._options.map&&(this._options.map={}),null==this._options.widgets&&(this._options.widgets={}),this._sequencePlaying=!1,this._prevSequence=null,this._mapTheme=(null===Oo||void 0===Oo||null===(or=Oo.map)||void 0===or?void 0:or.theme)||Dl.DEFAULT,this._picNav=(null===Oo||void 0===Oo?void 0:Oo.picturesNavigation)||"any",this._options.testing)return;if(!0===this._options.hash||void 0===this._options.hash){if(this._hash=new Ro.Z(this),Uo=this._hash._getCurrentHash(),"none"===Uo.map&&(this._options.map=!1),"object"===typeof this._options.map&&(this._options.map.hash=!1),this._options.map&&Uo.focus&&(this._options.map.startWide="map"===Uo.focus),this._options.map&&Uo.background&&(this._options.map.background=Uo.background),this._options.map&&Uo.users&&(this._options.users=[...new Set(Uo.users.split(","))]),Uo.xyz){const C=this._hash.getXyzOptionsFromHashString(Uo.xyz);this.addEventListener("psv:picture-loaded",(()=>{this.psv.setXYZ(C.x,C.y,C.z)}),{once:!0})}if(this._options.map&&"string"===typeof Uo.map){const C=this._hash.getMapOptionsFromHashString(Uo.map);C&&(this._options.map=Object.assign({},this._options.map,C))}if(this._options.map&&this.setFilters(this._hash.getMapFiltersFromHashVals(Uo),!0),Uo.pic){const C=Uo.pic.split(";");C.length>1&&console.warn("Multiple picture IDs passed in URL, only first one kept"),this._options.selectedPicture=C[0]}"string"===typeof Uo.speed&&(this._options.transition=parseInt(Uo.speed)),Uo.nav&&(this._picNav=Uo.nav)}this._initContainerStructure();try{this.psv=new Ho.ZP(this,this.psvContainer,{transitionDuration:this._options.transition,shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...So.Of.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this.toggleFocus(),7:()=>this.toggleFocus(),End:()=>this.toggleUnfocusedVisible(),1:()=>this.toggleUnfocusedVisible()," ":()=>this.toggleSequencePlaying(),0:()=>this.toggleSequencePlaying()}}),this.psv.addEventListener("dblclick",(()=>{this.map&&this.isMapWide()&&this.setFocus("pic")}))}catch(qo){let C=So.we.isWebGLSupported?this._t.gvs.error_psv:this._t.gvs.error_webgl;this._loader.dismiss(qo,C)}const onceStuffReady=()=>{this._widgets=new To.Z(this,this._options.widgets),this.map&&this.isWidthSmall()&&this.setUnfocusedVisible(!1),this._options.selectedPicture?(this.select(null,this._options.selectedPicture,!0),this.addEventListener("psv:picture-loaded",(()=>{var C;this.map&&this._options.map&&this.map.jumpTo(this._options.map),"meta"===(null===(C=Uo)||void 0===C?void 0:C.focus)&&this._widgets._showPictureMetadataPopup(),this._loader.dismiss()}),{once:!0})):this._loader.dismiss(),this._options.position&&this.goToPosition(...this._options.position).catch((C=>this._loader.dismiss(C,this._t.gvs.error_nopic))),this._hash&&this.map&&(this.map._attribution._container.classList.add("gvs-hidden"),this._hash.bindMapEvents(),this._mapFilters&&this.setFilters(this._mapFilters,!0),Uo.users&&Promise.all(this.map.getVisibleUsers().filter((C=>"geovisio"!=C)).map((C=>this._api.getUserName(C)))).then((C=>{C=C.filter((C=>null!=C)).join(", ");const Rn=document.getElementById("gvs-filter-search-user").querySelector("input");Rn&&Rn.setItem(C)})).catch((C=>console.warn("Error when looking up for user names",C))))};this._api.onceReady().then((()=>{this._options.map?(void 0===this._options.map.doubleClickZoom&&(this._options.map.doubleClickZoom=!1),this._initMap().then(onceStuffReady).catch((C=>this._loader.dismiss(C,this._t.gvs.error_api_compatibility)))):onceStuffReady()}))}getClassName(){return"Viewer"}destroy(){super.destroy(),this._widgets.destroy(),delete this._widgets,this._hash.destroy(),delete this._hash,this.map.destroy(),delete this.map,delete this._mapFilters,this.psv.destroy(),delete this.psv,this.miniContainer.remove(),this.mainContainer.remove(),this.mapContainer.remove(),this.psvContainer.remove(),this.popupContainer.remove(),this.container.innerHTML="",this.container.classList.remove(...[...this.container.classList].filter((C=>C.startsWith("gvs"))))}_initContainerStructure(){this.miniContainer=document.createElement("div"),this.miniContainer.classList.add("gvs-mini"),this.mainContainer=document.createElement("div"),this.mainContainer.classList.add("gvs-main"),this.popupContainer=document.createElement("div"),this.popupContainer.classList.add("gvs-popup","gvs-hidden"),this.psvContainer=document.createElement("div"),this.mainContainer.appendChild(this.psvContainer),this.mapContainer=document.createElement("div"),this.miniContainer.appendChild(this.mapContainer),this.container.appendChild(this.mainContainer),this.container.appendChild(this.miniContainer),this.container.appendChild(this.popupContainer)}async _initMap(){await new Promise((C=>{this.map=new qo.Z(this,this.mapContainer,this._options.map),this.map._getLayerColorStyle=this._getLayerColorStyle.bind(this),this.map._getLayerSortStyle=this._getLayerSortStyle.bind(this),this.addEventListener("map:users-changed",C,{once:!0}),this.container.classList.add("gvs-has-mini"),this.map.on("dblclick",(()=>{this.isMapWide()||this.setFocus("map")})),"object"===typeof this._options.map&&this._options.map.startWide?this.setFocus("map",!0):this.setFocus("pic",!0)})),this._initMapKeyboardHandler(),(0,Uo.bk)(this)}_initMapKeyboardHandler(){const C=this;this.map.keyboard.keydown=function(Rn){if(Rn.altKey||Rn.ctrlKey||Rn.metaKey)return;switch(Rn.key){case"*":case"5":return void C.moveCenter();case"PageUp":case"9":return void C.psv.goToNextPicture();case"PageDown":case"3":return void C.psv.goToPrevPicture();case"Home":case"7":return Rn.stopPropagation(),void C.toggleFocus();case"End":case"1":return void C.toggleUnfocusedVisible();case" ":case"0":return void C.toggleSequencePlaying()}let or=0,So=0,To=0,Ro=0,Uo=0;switch(Rn.keyCode){case 61:case 107:case 171:case 187:or=1;break;case 189:case 109:case 173:or=-1;break;case 37:case 100:Rn.shiftKey?So=-1:(Rn.preventDefault(),Ro=-1);break;case 39:case 102:Rn.shiftKey?So=1:(Rn.preventDefault(),Ro=1);break;case 38:case 104:Rn.shiftKey?To=1:(Rn.preventDefault(),Uo=-1);break;case 40:case 98:Rn.shiftKey?To=-1:(Rn.preventDefault(),Uo=1);break;default:return}return this._rotationDisabled&&(So=0,To=0),{cameraAnimation:C=>{const Oo=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:C=>C*(2-C),zoom:or?Math.round(Oo.zoom)+or*(Rn.shiftKey?2:1):Oo.zoom,bearing:Oo.bearing+So*this._bearingStep,pitch:Oo.pitch+To*this._pitchStep,offset:[-Ro*this._panStep,-Uo*this._panStep],center:Oo.center},{originalEvent:Rn})}}}.bind(this.map.keyboard)}_psvShouldGoFast(){return this._sequencePlaying&&this.psv.getTransitionDuration()<1e3||this.map&&this.isMapWide()}refreshPSV(){var C;const Rn=this.psv._myVTour.getCurrentNode();if(Rn&&Rn.panorama.baseUrl!==(null===Rn||void 0===Rn||null===(C=Rn.panorama)||void 0===C?void 0:C.origBaseUrl)){const C=this.psv.getZoomLevel(),or=this.psv.getPosition();this.psv._myVTour.state.currentNode=null,this.psv._myVTour.setCurrentNode(Rn.id,{zoomTo:C,rotateTo:or,fadeIn:!1,speed:0,rotation:!1})}Rn&&Rn.panorama.rows>1&&this.psv.adapter.__refresh()}setPopup(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(C)if(Rn){this.psv.stopKeyboardControl(),this.popupContainer.innerHTML="";const C=document.createElement("div");C.classList.add("gvs-popup-backdrop"),C.addEventListener("click",(()=>this.setPopup(!1)));const or=document.createElement("div");or.classList.add("gvs-widget-bg"),"string"===typeof Rn?or.innerHTML=Rn:Array.isArray(Rn)&&Rn.forEach((C=>or.appendChild(C)));const So=document.createElement("button");So.id="gvs-popup-btn-close",So.classList.add("gvs-btn","gvs-widget-bg"),So.appendChild((0,ml.fa)(fl.g8)),So.addEventListener("click",(()=>this.setPopup(!1))),or.insertBefore(So,or.firstChild),this.popupContainer.appendChild(C),this.popupContainer.appendChild(or),this.popupContainer.classList.remove("gvs-hidden"),(0,ml.QO)(this.popupContainer,this._t)}else this.popupContainer.classList.remove("gvs-hidden");else this.popupContainer.classList.add("gvs-hidden"),this.setFocus("pic"),this.psv.startKeyboardControl()}playSequence(){this._sequencePlaying=!0;const C=new Event("sequence-playing");this.dispatchEvent(C);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("psv:picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.psv.getTransitionDuration())}),{once:!0});try{this.psv.goToNextPicture()}catch(C){this.stopSequence()}}};this.psv.addEventListener("click",(()=>{this.stopSequence()})),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.refreshPSV();const C=new Event("sequence-stopped");this.dispatchEvent(C)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}moveCenter(){const C=this.psv.getPictureMetadata();C&&(this.map&&this.isMapWide()?this.map.flyTo({center:C.gps,zoom:20}):this._psvAnimate({speed:Ho.O_,yaw:0,pitch:0,zoom:Ho.Se}))}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(C){if(this.map&&this.isMapWide()){let Rn;switch(C){case"up":Rn=[0,-100];break;case"left":Rn=[-100,0];break;case"down":Rn=[0,kl];break;case"right":Rn=[kl,0]}this.map.panBy(Rn)}else{let Rn=this.psv.getPosition();switch(C){case"up":Rn.pitch+=bl;break;case"left":Rn.yaw-=bl;break;case"down":Rn.pitch-=bl;break;case"right":Rn.yaw+=bl}this._psvAnimate({speed:Ho.O_,...Rn})}}_psvAnimate(C){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(C)}isMapWide(){if(!this.map)throw new Error("Map is not enabled");return this.mapContainer.parentNode==this.mainContainer}_getDatesForLayerColors(){const C=864e5,Rn=Date.now();return[Rn-30*C,Rn-365*C,Rn-730*C].map((C=>new Date(C).toISOString().split("T")[0]))}_getLayerColorStyle(C){var Rn,or,So,To,Ro;const Oo=["case",["==",["get","hidden"],!0],Uo.DM.HIDDEN],Ho=(null===(Rn=this.psv._myVTour)||void 0===Rn||null===(or=Rn.state)||void 0===or?void 0:or.loadingNode)||(null===(So=this.psv._myVTour)||void 0===So||null===(To=So.state)||void 0===To||null===(Ro=To.currentNode)||void 0===Ro?void 0:Ro.id),qo=Ho?this.psv._picturesSequences[Ho]:null;if("sequences"==C&&qo?Oo.push(["==",["get","id"],qo],Uo.DM.SELECTED):"pictures"==C&&qo&&Oo.push(["in",qo,["get","sequences"]],Uo.DM.SELECTED),this._mapTheme==Dl.AGE){const Rn="sequences"==C?"date":"ts",or=this._getDatesForLayerColors();Oo.push(["!",["has",Rn]],Uo.DM.BASE,[">=",["get",Rn],or[0]],Uo.DM.PALETTE_4,[">=",["get",Rn],or[1]],Uo.DM.PALETTE_3,[">=",["get",Rn],or[2]],Uo.DM.PALETTE_2,Uo.DM.PALETTE_1)}else this._mapTheme==Dl.TYPE?Oo.push(["!",["has","type"]],Uo.DM.BASE,["==",["get","type"],"equirectangular"],Uo.DM.QUALI_1,Uo.DM.QUALI_2):Oo.push(Uo.DM.BASE);return Oo}_getLayerSortStyle(C){var Rn,or,So,To,Ro;const Uo=["case",["==",["get","hidden"],!0],90],Oo=(null===(Rn=this.psv._myVTour)||void 0===Rn||null===(or=Rn.state)||void 0===or?void 0:or.loadingNode)||(null===(So=this.psv._myVTour)||void 0===So||null===(To=So.state)||void 0===To||null===(Ro=To.currentNode)||void 0===Ro?void 0:Ro.id),Ho=Oo?this.psv._picturesSequences[Oo]:null;if("sequences"==C&&Ho?Uo.push(["==",["get","id"],Ho],100):"pictures"==C&&Ho&&Uo.push(["in",Ho,["get","sequences"]],100),this._mapTheme==Dl.AGE){const Rn="sequences"==C?"date":"ts",or=this._getDatesForLayerColors();Uo.push(["!",["has",Rn]],0,[">=",["get",Rn],or[0]],50,[">=",["get",Rn],or[1]],49,[">=",["get",Rn],or[2]],48)}else this._mapTheme==Dl.TYPE&&Uo.push(["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50);return Uo.push(10),Uo}getPicturesNavigation(){return this._picNav}setPicturesNavigation(C){this._picNav=C;const Rn=new CustomEvent("pictures-navigation-changed",{detail:{value:C}});this.dispatchEvent(Rn)}_picturesNavFilter(C){switch(this._picNav){case"seq":return["next","prev"].includes(C.rel);case"pic":return!1;default:return!0}}toggleJOSMLive(C){if(C){const C=new CustomEvent("josm-live-enabled");return this.dispatchEvent(C),fetch(Ll+"/version").catch((C=>{throw this.dispatchEvent(new CustomEvent("josm-live-disabled")),C})).then((()=>{const C=(0,Uo.Iu)(this.psv.getPictureMetadata());if(C){const Rn="".concat(Ll,"/load_and_zoom?").concat(C);fetch(Rn).catch((C=>{console.warn(C),this.toggleJOSMLive(!1)}))}this._josmListener=()=>{const C=(0,Uo.Iu)(this.psv.getPictureMetadata());if(C){const Rn="".concat(Ll,"/zoom?").concat(C);fetch(Rn).catch((C=>{console.warn(C),this.toggleJOSMLive(!1)}))}},this.addEventListener("psv:picture-loaded",this._josmListener),this.addEventListener("psv:picture-loading",this._josmListener)}))}{const C=new CustomEvent("josm-live-disabled");return this.dispatchEvent(C),this._josmListener&&(this.removeEventListener("picture-loading",this._josmListener),this.removeEventListener("picture-loaded",this._josmListener),delete this._josmListener),Promise.resolve()}}setFocus(C){var Rn,or,So;let To=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("map"===C&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(C))throw new Error("Invalid focus value (should be pic or map)");if(("map"!==C||!this.map||!this.isMapWide())&&("pic"!==C||this.map&&this.isMapWide())){var Ro;if(null===(Rn=this.mapContainer.parentElement)||void 0===Rn||Rn.removeChild(this.mapContainer),null===(or=this.psvContainer.parentElement)||void 0===or||or.removeChild(this.psvContainer),"map"===C)this.psv.stopKeyboardControl(),this.map.keyboard.enable(),this.container.classList.add("gvs-focus-map"),this.mainContainer.appendChild(this.mapContainer),this.miniContainer.appendChild(this.psvContainer),this.map.getCanvas().focus();else null===this||void 0===this||null===(Ro=this.map)||void 0===Ro||Ro.keyboard.disable(),this.psv.startKeyboardControl(),this.container.classList.remove("gvs-focus-map"),this.mainContainer.appendChild(this.psvContainer),this.miniContainer.appendChild(this.mapContainer),this.psvContainer.focus();if(null===this||void 0===this||null===(So=this.map)||void 0===So||So.resize(),this.psv.autoSize(),this.refreshPSV(),!To){const Rn=new CustomEvent("focus-changed",{detail:{focus:C}});this.dispatchEvent(Rn)}}}toggleFocus(){if(!this.map)throw new Error("Map is not enabled");this.setFocus(this.isMapWide()?"pic":"map")}setUnfocusedVisible(C){if(!this.map)throw new Error("Map is not enabled");C?this.container.classList.remove("gvs-mini-hidden"):this.container.classList.add("gvs-mini-hidden"),this.map.resize(),this.psv.autoSize()}toggleUnfocusedVisible(){if(!this.map)throw new Error("Map is not enabled");this.setUnfocusedVisible(this.container.classList.contains("gvs-mini-hidden"))}setFilters(C){let Rn=arguments.length>1&&void 0!==arguments[1]&&arguments[1],or=[],So=[];if(this._mapFilters={},C.minDate&&""!==C.minDate&&(this._mapFilters.minDate=C.minDate,or.push([">=",["get","date"],C.minDate]),So.push([">=",["get","ts"],C.minDate])),C.maxDate&&""!==C.maxDate){this._mapFilters.maxDate=C.maxDate,or.push(["<=",["get","date"],C.maxDate]);let Rn=new Date(C.maxDate);Rn.setDate(Rn.getDate()+1),Rn=Rn.toISOString().split("T")[0],So.push(["<=",["get","ts"],Rn])}if(C.type&&""!==C.type&&(this._mapFilters.type=C.type,or.push(["==",["get","type"],C.type]),So.push(["==",["get","type"],C.type])),C.camera&&""!==C.camera){this._mapFilters.camera=C.camera;const Rn=C.camera.toLowerCase().trim()+" ",To=C.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",Ro=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];or.push([">=",["get","model"],Rn,Ro]),or.push(["<=",["get","model"],To,Ro]),So.push([">=",["get","model"],Rn,Ro]),So.push(["<=",["get","model"],To,Ro])}if(C.theme&&Object.values(Dl).includes(C.theme)&&(this._mapFilters.theme=C.theme,this.map&&(this._mapTheme=this._mapFilters.theme,this.map.reloadLayersStyles())),0==or.length?or=null:or.unshift("all"),0==So.length?So=null:(So.unshift("all"),So=["step",["zoom"],!0,dl.Lh,So]),this.map){const C=this.map.getVisibleUsers().includes("geovisio");or&&C&&(or=["step",["zoom"],!0,7,or]),this.map.filterUserLayersContent("sequences",or),this.map.filterUserLayersContent("pictures",So),!Rn&&(null!==or||null!==So||null!==this._mapFilters.theme&&this._mapFilters.theme!==Dl.DEFAULT)&&C&&this.map.getZoom()<7&&this.map.easeTo({zoom:7})}const To=new CustomEvent("filters-changed",{detail:Object.assign({},this._mapFilters)});this.dispatchEvent(To)}}},6792:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>CoreView});or(9835);var So=or(937),To=or(7586),Ro=or(3406),Uo=or(7457),Oo=or(4147),Ho=or(8152);class CoreView extends EventTarget{constructor(C,Rn){var or;let qo=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(super(),this._options=qo,null==this._options&&(this._options={}),this._options.users||(this._options.users=["geovisio"]),"string"===typeof this._options.users&&(this._options.users=[this._options.users]),this._options.style||(this._options.style=Ro.wL),this._options.testing||console.info("\ud83d\udcf7 Panoramax ".concat(this.getClassName()," - Version ").concat(Oo.i8," (").concat("3c6e880",")\n\n\ud83c\udd98 Issues can be reported at ").concat(Oo.cj.H)),this._t=(0,To.F)(this._options.lang),this._isInternetFast=null,(0,Uo.EF)().then((C=>this._isInternetFast=C)),this._selectedSeqId=this._options.selectedSequence||null,this._selectedPicId=this._options.selectedPicture||null,this.container="string"===typeof C?document.getElementById(C):C,!(this.container instanceof Element))throw new Error("Container is not a valid HTML element, does it exist in your page ?");this.container.classList.add("gvs","gvs-".concat(this.getClassName().toLocaleLowerCase())),(0,Uo.zd)()&&this.container.classList.add("gvs-iframed"),this.loaderContainer=document.createElement("div"),this.container.appendChild(this.loaderContainer),this._loader=new Ho.Z(this,this.loaderContainer),Rn=Rn.replace("/api/search","/api"),this._api=new So.Z(Rn,{users:this._options.users,fetch:null===(or=this._options)||void 0===or?void 0:or.fetchOptions,style:this._options.style}),this._api.onceReady().then((()=>console.info('\ud83c\udf10 Connected to API "'.concat(this._api._metadata.name,'" (').concat(this._api._endpoint,")\n\u2139\ufe0f API runs STAC ").concat(this._api._metadata.stac_version," & GeoVisio ").concat(this._api._metadata.geovisio_version)))).catch((C=>this._loader.dismiss(C,this._t.gvs.error_api)))}getClassName(){return"CoreView"}destroy(){delete this._options,delete this._t,delete this._api,delete this._loader,this.loaderContainer.remove(),delete this.loaderContainer}isWidthSmall(){var C;return(null===(C=this.container)||void 0===C?void 0:C.offsetWidth)<576}isHeightSmall(){var C;return(null===(C=this.container)||void 0===C?void 0:C.offsetHeight)<400}select(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,or=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const So=this._selectedSeqId||null,To=this._selectedPicId||null;(or||To!=Rn)&&(this._selectedSeqId=C,this._selectedPicId=Rn,this.dispatchEvent(new CustomEvent("select",{detail:{seqId:C,picId:Rn,prevSeqId:So,prevPicId:To}})))}}},8152:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Loader});or(2007);var So=or(3505),To=or(9836);class Loader{constructor(C,Rn){this._parent=C,this.container=Rn,this.container.classList.add("gvs-loader","gvs-loader-visible");const or=document.createElement("img");or.src=To,or.title=this._parent._t.map.loading,or.classList.add("gvs-loader-img"),this.container.appendChild(or);const So=document.createElement("div"),Ro=document.createElement("span"),nextLabelFun=()=>this._parent._t.gvs.loading_labels_fun[Math.floor(Math.random()*this._parent._t.gvs.loading_labels_fun.length)];Ro.innerHTML=this._parent._t.gvs.loading_labels_serious[Math.floor(Math.random()*this._parent._t.gvs.loading_labels_serious.length)];const nextLabelFct=()=>setTimeout((()=>{Ro.innerHTML=nextLabelFun(),this._loaderLabelChanger=nextLabelFct()}),500+1e3*Math.random());this._loaderLabelChanger=nextLabelFct(),So.appendChild(Ro),this.container.appendChild(So)}isVisible(){return this.container.classList.contains("gvs-loader-visible")}dismiss(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(clearTimeout(this._loaderLabelChanger),C){!0!==C&&console.error(C),this.container.children[0].src=So,this.container.children[0].style.width="200px",this.container.children[0].style.animation="unset";let To="<small>".concat(or?this._parent._t.gvs.error_click:this._parent._t.gvs.error_retry,"</small>");Rn&&(To=Rn+"<br />"+To),this.container.children[1].innerHTML="".concat(this._parent._t.gvs.error,"<br />").concat(To),or&&this.container.addEventListener("click",or);const Ro=Rn||"Panoramax JS had a blocking exception",Uo=new CustomEvent("broken",{detail:{error:Ro}});throw this._parent.dispatchEvent(Uo),new Error(Ro)}{this.container.classList.remove("gvs-loader-visible"),setTimeout((()=>this.container.remove()),2e3);const C=new CustomEvent("ready");this._parent.dispatchEvent(C),or&&or()}}}},2093:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Map});or(1786);var So=or(3406),To=or(7457),Ro=or(9836),Uo=or(2506),Oo=or(6812),Ho=or(3732),qo=(or(262),or(4307)),dl=or.n(qo),ml=or(2609),fl=or.n(ml),vl=or(6351);dl().workerClass=fl(),dl().addProtocol("pmtiles",(new vl.b$).tile);const bl=["antialias","attributionControl","bearing","bearingSnap","bounds","boxZoom","center","clickTolerance","collectResourceTiming","cooperativeGestures","crossSourceCollisions","doubleClickZoom","dragPan","dragRotate","fadeDuration","failIfMajorPerformanceCaveat","fitBoundsOptions","hash","interactive","keyboard","localIdeographFontFamily","locale","logoPosition","maplibreLogo","maxBounds","maxCanvasSize","maxPitch","maxTileCacheSize","maxTileCacheZoomLevels","maxZoom","minPitch","minZoom","pitch","pitchWithRotate","pixelRatio","preserveDrawingBuffer","refreshExpiredTiles","renderWorldCopies","scrollZoom","touchPitch","touchZoomRotate","trackResize","transformCameraUpdate","transformRequest","validateStyle","zoom"];class Map extends dl().Map{constructor(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var To;super({container:Rn,style:(0,So.Ec)(C,or),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,preserveDrawingBuffer:!C.isWidthSmall(),transformRequest:C._api._getMapRequestTransform(),locale:C._t.maplibre,...(To=or,Object.fromEntries(Object.entries(To).filter((C=>{let[Rn]=C;return bl.includes(Rn)}))))}),this._loadMarkerImages(),this._parent=C,this._options=or,this.getContainer().classList.add("gvs-map"),this._options.raster&&(this._options.background=this._options.background||"streets"),this._attribution=new(dl().AttributionControl)({compact:!1}),this.addControl(this._attribution),this._initGeocoder(),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picThumbUrl={},this._seqPictures={},this._userLayers=new Set,this.on("mousemove","sequences",this._onSequenceHover.bind(this)),this._parent.addEventListener("select",this.reloadLayersStyles.bind(this)),this.on("load",(async()=>{await this.setVisibleUsers(this._parent._options.users),this.reloadLayersStyles(),this.resize()}))}destroy(){this.remove(),delete this._parent,delete this._options,delete this._attribution,delete this._picMarker,delete this._picMarkerPreview,delete this._picThumbUrl,delete this._seqPictures,delete this._userLayers}_initMapPosition(){this._options.center&&this._options.center!=[0,0]||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent._api.onceReady().then((()=>{var C,Rn;let or=null===(C=this._parent)||void 0===C||null===(Rn=C._api)||void 0===Rn?void 0:Rn.getDataBbox();if(or)try{or=new(dl().LngLatBounds)(or),this.loaded()?this.fitBounds(or,{animate:!1}):this.on("load",(()=>this.fitBounds(or,{animate:!1})))}catch(So){console.warn("Received invalid bbox: "+or)}}))}_initGeocoder(){var C,Rn;const or={ban:So.uD,nominatim:So.g8},To=(null===(C=this._options)||void 0===C||null===(Rn=C.geocoder)||void 0===Rn?void 0:Rn.engine)||"nominatim";this.geocoder=or[To],this._geolocate=new(dl().GeolocateControl)({positionOptions:{enableHighAccuracy:!0,timeout:6e4,maximumAge:3e5},showAccuracyCircle:!0,showUserLocation:!0,trackUserLocation:!0}).onAdd(this)}_loadMarkerImages(){[{id:"gvs-marker",img:Ro},{id:"gvs-arrow-flat",img:Oo},{id:"gvs-arrow-360",img:Ho}].forEach((C=>{const Rn=new Image(64,64);Rn.onload=()=>this.addImage(C.id,Rn),Rn.src=C.img}))}reloadVectorTiles(){[...this._userLayers].forEach((C=>{const Rn=this.getSource((0,So.eY)(C));Rn.setTiles(Rn.tiles)}))}hasTwoBackgrounds(){return void 0!==this.getLayer(So.Ws)}getBackground(){if(!this.getLayer(So.Ws))return"streets";return"visible"==this.getLayoutProperty(So.Ws,"visibility")?"aerial":"streets"}setBackground(C){if(!this.getLayer(So.Ws)&&"aerial"===C)throw new Error("No aerial imagery available");if(this.getLayer(So.Ws)){this.setLayoutProperty(So.Ws,"visibility","aerial"===C?"visible":"none");const Rn=new CustomEvent("map:background-changed",{detail:{background:C||"streets"}});this._parent.dispatchEvent(Rn)}}getVisibleUsers(){return[...this._userLayers].filter((C=>"visible"===this.getLayoutProperty((0,So.lh)(C,"pictures"),"visibility")))}async setVisibleUsers(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"===typeof C&&(C=[C]),await Promise.all(C.filter((C=>""!=C&&!this._userLayers.has(C))).map((C=>this._createPicturesTilesLayer(C))));const Rn=["pictures","sequences","sequences_plus","grid","pictures_symbols"];[...this._userLayers].forEach((or=>{Rn.forEach((Rn=>{const To=(0,So.lh)(or,Rn);this.getLayer(To)&&this.setLayoutProperty(To,"visibility",C.includes(or)?"visible":"none")}))}));const or=new CustomEvent("map:users-changed",{detail:{usersIds:C}});this._parent.dispatchEvent(or)}filterUserLayersContent(C,Rn){[...this._userLayers].forEach((or=>{this.setFilter((0,So.lh)(or,C),Rn),"sequences"===C&&this.setFilter((0,So.lh)(or,"sequences_plus"),Rn),"pictures"===C&&this.setFilter((0,So.lh)(or,"pictures_symbols"),Rn)}))}displayPictureMarker(C,Rn,or){this._picMarkerPreview.remove(),this._picMarker.setLngLat([C,Rn]).setRotation(or).addTo(this),this.reloadLayersStyles(),this.flyTo({center:[C,Rn],zoom:this.getZoom()<So.Lh+2?So.Lh+2:this.getZoom(),maxDuration:2e3})}reloadLayersStyles(){const updateStyle=(C,Rn)=>{[...this._userLayers].forEach((or=>{for(let To in Rn.layout)this.setLayoutProperty((0,So.lh)(or,C),To,Rn.layout[To]);for(let To in Rn.paint)this.setPaintProperty((0,So.lh)(or,C),To,Rn.paint[To])}))};["pictures","pictures_symbols","sequences"].forEach((C=>{updateStyle(C,this._getLayerStyleProperties(C))}))}async _createPicturesTilesLayer(C){this._userLayers.add(C);const Rn=this.getStyle().layers.find(So.RF);if("geovisio"!==C&&!this.getSource("geovisio_".concat(C))){const or=await this._parent._api.getUserMapStyle(C);Object.entries(or.sources).forEach((C=>{let[Rn,or]=C;return this.addSource(Rn,or)})),or.layers=or.layers||[];or.layers.concat((0,So.FS)(or.sources,or.layers)).forEach((C=>this.addLayer(C,null===Rn||void 0===Rn?void 0:Rn.id)))}this._picPreviewTimer=null,this._picPopup=new(dl().Popup)({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:3}),this._picPopup.on("close",(()=>{delete this._picPopup._picId}));const or=(0,So.lh)(C,"pictures");this.on("mousemove",or,(C=>{this.getCanvas().style.cursor="pointer";const Rn=Object.assign({},C);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(Rn,or)),100)})),this.on("mouseleave",or,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",or,this._onPictureClick.bind(this));const To=(0,So.lh)(C,"sequences_plus");this.on("mousemove",To,(C=>{if(this.getZoom()<=So.Lh+1&&(this.getCanvas().style.cursor="pointer",C.features[0].properties.id)){const Rn=Object.assign({},C);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(Rn,To)),100)}})),this.on("mouseleave",To,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",To,(C=>{C.preventDefault(),this.getZoom()<=So.Lh+1&&this._onSequenceClick(C)})),"geovisio"===C&&this.getLayer("geovisio_grid")&&(this.on("mousemove","geovisio_grid",(C=>{if(this.getZoom()<=So.Lh+1){this.getCanvas().style.cursor="pointer";const Rn=Object.assign({},C);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(Rn,"geovisio_grid")),100)}})),this.on("mouseleave","geovisio_grid",(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click","geovisio_grid",(C=>{C.preventDefault(),this.flyTo({center:C.lngLat,zoom:So.Lh-6})}))),this.on("click",(C=>{!1===C.defaultPrevented&&(clearTimeout(this._picPreviewTimer),this._picPopup.remove())}))}_getLayerStyleProperties(C){if("pictures_symbols"===C)return{paint:{},layout:{"icon-image":["case",["==",["get","id"],this._parent._selectedPicId],"",["==",["get","type"],"equirectangular"],"gvs-arrow-360","gvs-arrow-flat"],"symbol-sort-key":this._getLayerSortStyle(C)}};{const Rn={pictures:"circle",sequences:"line"};return{paint:Object.assign({["".concat(Rn[C],"-color")]:this._getLayerColorStyle(C)},So.lg[C.toUpperCase()].paint),layout:Object.assign({["".concat(Rn[C],"-sort-key")]:this._getLayerSortStyle(C)},So.lg[C.toUpperCase()].layout)}}}_getLayerColorStyle(C){const Rn=["case",["==",["get","hidden"],!0],To.DM.HIDDEN,["==",["get","geovisio:status"],"hidden"],To.DM.HIDDEN],or=this._parent._selectedSeqId;return"sequences"==C&&or?Rn.push(["==",["get","id"],or],To.DM.SELECTED):C.startsWith("pictures")&&or&&Rn.push(["in",or,["get","sequences"]],To.DM.SELECTED),Rn.push(To.DM.BASE),Rn}_getLayerSortStyle(C){const Rn=["case",["==",["get","hidden"],!0],90],or=this._parent._selectedSeqId;return"sequences"==C&&or?Rn.push(["==",["get","id"],or],100):C.startsWith("pictures")&&or&&Rn.push(["in",or,["get","sequences"]],100),Rn.push(10),Rn}_attachPreviewToPictures(C,Rn){let or=C.features.pop();if(!or||or.properties.id==this._picPopup._picId)return;let To=null;if(Rn.endsWith("pictures")?To=or.geometry.coordinates.slice():C.lngLat&&(To=[C.lngLat.lng,C.lngLat.lat]),!To){const C="LineString"===or.geometry.type?[or.geometry.coordinates]:or.geometry.coordinates;let Rn=null;const So=this.getBounds(),Ro=So.getCenter();for(let or=0;or<C.length;or++)for(let Uo=0;Uo<C[or].length;Uo++)if(So.contains(C[or][Uo])){let So=Ro.distanceTo(new(dl().LngLat)(...C[or][Uo]));(null===Rn||So<Rn)&&(To=C[or][Uo],Rn=So)}if(!To)return}this._picPopup.setLngLat(To).addTo(this),this._picThumbUrl[or.properties.id]||this._picPopup.setDOMContent((0,So.sl)(this._parent._t)),this._picPopup._loading=or.properties.id,this._picPopup._picId=or.properties.id;const displayThumb=C=>{if(this._picPopup._loading===or.properties.id)if(delete this._picPopup._loading,C){let Rn=document.createElement("img");Rn.classList.add("gvs-map-thumb"),Rn.alt=this._parent._t.thumbnail;let So=new Image;if(So.src=C,So.addEventListener("load",(()=>{or.properties.hidden?Rn.children[0].src=So.src:Rn.src=So.src,this._picPopup.setDOMContent(Rn)})),or.properties.hidden){const C=document.createElement("div");C.classList.add("gvs-map-thumb-legend"),C.appendChild(document.createTextNode(this._parent._t.map.not_public));const or=document.createElement("div");or.appendChild(Rn),or.appendChild(C),Rn=or}}else this._picPopup.setHTML("<i>".concat(this._parent._t.no_thumbnail,"</i>"))};Rn.endsWith("pictures")?this._getPictureThumbURL(or.properties.id).then(displayThumb):Rn.endsWith("grid")?this._getThumbURL(To).then(displayThumb):this._getSequenceThumbURL(or.properties.id,new(dl().LngLat)(...To)).then(displayThumb)}_getThumbURL(C){return this._parent._api.getPicturesAroundCoordinates(C[1],C[0],.1,1).then((C=>{var Rn;const or=null===C||void 0===C||null===(Rn=C.features)||void 0===Rn?void 0:Rn.pop();return or?this._parent._api.findThumbnailInPictureFeature(or):null}))}_getSequenceThumbURL(C,Rn){return Rn?this._parent._api.getPicturesAroundCoordinates(Rn.lat,Rn.lng,1,1,C).then((Rn=>{var or;return(null===Rn||void 0===Rn||null===(or=Rn.features)||void 0===or?void 0:or.length)>0?this._parent._api.findThumbnailInPictureFeature(Rn.features[0]):this._parent._api.getPictureThumbnailURLForSequence(C)})):this._parent._api.getPictureThumbnailURLForSequence(C)}_getPictureThumbURL(C,Rn){let or=null;return C&&(void 0!==this._picThumbUrl[C]?or="string"===typeof this._picThumbUrl[C]?Promise.resolve(this._picThumbUrl[C]):this._picThumbUrl[C]:(this._picThumbUrl[C]=this._parent._api.getPictureThumbnailURL(C,Rn).then((Rn=>Rn?(this._picThumbUrl[C]=Rn,Rn):(this._picThumbUrl[C]=null,null))).catch((()=>{this._picThumbUrl[C]=null})),or=this._picThumbUrl[C])),or}_getPictureMarker(){let C=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const Rn=document.createElement("img");return Rn.src=C?Uo:Ro,new(dl().Marker)({element:Rn})}_onSequenceHover(C){var Rn;C.preventDefault(),C.features.length>0&&null!==(Rn=C.features[0].properties)&&void 0!==Rn&&Rn.id&&this._parent.dispatchEvent(new CustomEvent("map:sequence-hover",{detail:{seqId:C.features[0].properties.id}}))}_onSequenceClick(C){var Rn;C.preventDefault(),C.features.length>0&&null!==(Rn=C.features[0].properties)&&void 0!==Rn&&Rn.id&&this._parent.dispatchEvent(new CustomEvent("map:sequence-click",{detail:{seqId:C.features[0].properties.id,coordinates:C.lngLat}}))}_onPictureClick(C){var Rn,or;C.preventDefault();const So=(null===C||void 0===C||null===(Rn=C.features)||void 0===Rn?void 0:Rn.length)>0?C.features[0]:null;if(null!==So&&void 0!==So&&null!==(or=So.properties)&&void 0!==or&&or.id){let Rn=null;try{So.properties.sequences&&(Array.isArray(So.properties.sequences)||(So.properties.sequences=JSON.parse(So.properties.sequences)),Rn=So.properties.sequences.pop())}catch(C){console.log("Sequence ID is not available in vector tiles for picture "+So.properties.id)}this._parent.dispatchEvent(new CustomEvent("map:picture-click",{detail:{picId:So.properties.id,seqId:Rn,feature:So}}))}}}},2354:(C,Rn,or)=>{"use strict";or.d(Rn,{O_:()=>ml,Se:()=>dl,ZP:()=>Photo,q7:()=>fl});or(9154);var So=or(9364),To=or(3505),Ro=or(7457),Uo=(or(1066),or(8386),or(9254),or(2825),or(3114)),Oo=or(2188),Ho=or(5856);const qo={baseUrl:So,width:1280,cols:2,rows:1,tileUrl:()=>null},dl=30,ml=250,fl=3e3;Uo.AE.useNewAnglesOrder=!0;class Photo extends Uo.AE{constructor(C,Rn){var or,So,To,Ro;let Uo=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:Rn,adapter:[Ho.Z,{showErrorTile:!1,baseBlur:!1,resolution:C.isWidthSmall()?32:64,shouldGoFast:Uo.shouldGoFast}],withCredentials:"include"==(null===(or=C._options)||void 0===or||null===(So=or.fetchOptions)||void 0===So?void 0:So.credentials),requestHeaders:null===(To=C._options)||void 0===To||null===(Ro=To.fetchOptions)||void 0===Ro?void 0:Ro.headers,panorama:qo,lang:C._t.psv,minFov:5,loadingTxt:" ",navbar:null,rendererParameters:{preserveDrawingBuffer:!C.isWidthSmall()},plugins:[[Oo.P,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}]],...Uo}),this._parent=C,Rn.classList.add("gvs-psv"),this._shouldGoFast=(null===Uo||void 0===Uo?void 0:Uo.shouldGoFast)||(()=>!1),this._transitionDuration=(null===Uo||void 0===Uo?void 0:Uo.transitionDuration)||ml,this._myVTour=this.getPlugin(Oo.P),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent()}async _getNodeFromAPI(C){var Rn,or,So;if(!C)return;const To=await fetch(this._parent._api.getPictureMetadataUrl(C,this._picturesSequences[C]),this._parent._api._getFetchOptions());let Uo=await To.json();if(Uo.features&&(Uo=Uo.features.pop()),!Uo||0===Object.keys(Uo).length||!To.ok)throw this._parent._loader&&this._parent._loader.dismiss(!0,this._parent._t.gvs.error_pic),new Error("Picture with ID "+C+" was not found");this._picturesSequences[C]=Uo.collection;const Oo=(0,Ro.FF)(Uo,this._parent._t,this._parent._isInternetFast,null===(Rn=this._parent._picturesNavFilter)||void 0===Rn?void 0:Rn.bind(this._parent));var Ho,qo;null!==Oo&&void 0!==Oo&&null!==(or=Oo.sequence)&&void 0!==or&&or.prevPic&&(this._picturesSequences[null===Oo||void 0===Oo||null===(Ho=Oo.sequence)||void 0===Ho?void 0:Ho.prevPic]=Uo.collection);null!==Oo&&void 0!==Oo&&null!==(So=Oo.sequence)&&void 0!==So&&So.nextPic&&(this._picturesSequences[null===Oo||void 0===Oo||null===(qo=Oo.sequence)||void 0===qo?void 0:qo.nextPic]=Uo.collection);return Oo}_psvNodeTransition(C,Rn,or){var So,To;let Uo={};const Oo=this._shouldGoFast()?0:Math.min(ml,this._transitionDuration),Ho=Oo>100,qo=null!=(or||(null===Rn||void 0===Rn?void 0:Rn.links.find((Rn=>Rn.nodeId==C.id)))),fl=Rn&&C.sequence.id===Rn.sequence.id,vl=((null===Rn||void 0===Rn||null===(So=Rn.properties)||void 0===So?void 0:So["view:azimuth"])||0)*(Math.PI/180),bl=((null===C||void 0===C||null===(To=C.properties)||void 0===To?void 0:To["view:azimuth"])||0)*(Math.PI/180);this.setOption("maxFov",Math.min(3*C.horizontalFov/4,90));const kl={speed:0,fadeIn:!1,rotation:!1,rotateTo:{pitch:0,yaw:0},zoomTo:dl};if(360==C.horizontalFov)Rn?(0,Ro.Sp)(Rn.gps,C.gps)>=.001?Uo=kl:(Uo={speed:Oo,fadeIn:qo&&Ho,rotation:qo&&fl&&Ho,rotateTo:this.getPosition()},Uo.rotateTo.yaw+=vl-bl):Uo=kl;else if(fl){const C=this.getPosition().yaw,or=Rn.horizontalFov*(Math.PI/180)/2,So=C<=or||C>=2*Math.PI-or,To=Math.abs(vl-bl)<=Math.PI/4;Uo={speed:Oo,fadeIn:qo&&To&&Ho,rotation:qo&&To&&Ho,rotateTo:So?this.getPosition():{pitch:0,yaw:0},zoomTo:So?this.getZoomLevel():dl}}else Uo=kl;Uo.fadeIn&&Uo.speed>=150?setTimeout(this._clearArrows,Uo.speed-100):this._clearArrows();const Ll=new CustomEvent("psv:picture-loading",{detail:{...Object.assign({},this.getXYZ(),Uo.rotateTo?{x:180*(bl+Uo.rotateTo.yaw)/Math.PI}:null,Uo.zoomTo?{z:Uo.zoomTo}:null),picId:C.id,lon:C.gps[0],lat:C.gps[1]}});return this._parent.dispatchEvent(Ll),Uo}_onEnterArrow(C){const Rn=C.link,or=C.node;let So;or&&(So=360===or.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const To=new CustomEvent("psv:picture-preview-started",{detail:{picId:Rn.nodeId,coordinates:Rn.gps,direction:So}});this._parent.dispatchEvent(To)}_onLeaveArrow(C){const Rn=C.link,or=new CustomEvent("psv:picture-preview-stopped",{detail:{picId:Rn.nodeId}});this._parent.dispatchEvent(or)}_onPositionUpdated(C){let{position:Rn}=C;const or=(0,Ro.wW)(Rn,this.getZoomLevel());or.x+=this.getPictureOriginalHeading(),or.x=or.x%360;const So=new CustomEvent("psv:view-rotated",{detail:or});this._parent.dispatchEvent(So),this._onTilesStartLoading()}_onZoomUpdated(C){let{zoomLevel:Rn}=C;const or=new CustomEvent("psv:view-rotated",{detail:{...this.getXY(),z:Rn}});this._parent.dispatchEvent(or),this._onTilesStartLoading()}_onNodeChanged(C){for(let So of document.getElementsByClassName("gvs-psv-tour-arrows"))So.classList.remove("gvs-clicked");if(C.node.id){var Rn,or;this._parent.select(null===(Rn=C.node)||void 0===Rn||null===(or=Rn.sequence)||void 0===or?void 0:or.id,C.node.id);const So=this.getPictureMetadata();if(!So)return;this._prevSequence=So.sequence.id;const To=new CustomEvent("psv:picture-loaded",{detail:{...this.getXYZ(),picId:C.node.id,lon:So.gps[0],lat:So.gps[1]}});this._parent.dispatchEvent(To),So.panorama.hdUrl?(this.setOption("downloadUrl",So.panorama.hdUrl),this.setOption("downloadName",C.node.id+".jpg")):this.setOption("downloadUrl",null)}this._onTilesStartLoading()}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const C=new Event("psv:picture-tiles-loaded",{picId:this._myVTour.state.currentNode.id});this._parent.dispatchEvent(C)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){return this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}_onSelect(C){var Rn;C.detail.seqId&&(this._picturesSequences[C.detail.picId]=C.detail.seqId),(null===(Rn=this._myVTour.getCurrentNode())||void 0===Rn?void 0:Rn.id)!==C.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(C.detail.picId).catch((C=>{this.showErrorOverlay(C,this._parent._t.gvs.error_pic,!0)})))}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const C=this.getPictureMetadata().sequence.nextPic;if(!C)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,C)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const C=this.getPictureMetadata().sequence.prevPic;if(!C)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,C)}async goToPosition(C,Rn){return this._parent._api.getPicturesAroundCoordinates(C,Rn).then((C=>{if(C.features.length>0){const Rn=C.features.pop();return this._parent.select(null===Rn||void 0===Rn?void 0:Rn.collection,Rn.id),Rn.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const C=(0,Ro.wW)(this.getPosition());return C.x=(C.x+this.getPictureOriginalHeading())%360,C}getXYZ(){const C=this.getXY();return C.z=this.getZoomLevel(),C}getPictureOriginalHeading(){var C,Rn;return(null===(C=this.getPictureMetadata())||void 0===C||null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"])||0}getPictureRelativeHeading(){return(0,Ro.r)(this.getPictureMetadata())}clearPictureMetadataCache(){var C,Rn,or,So;const To=null===(C=this.getPictureMetadata())||void 0===C?void 0:C.id,Ro=null===(Rn=this.getPictureMetadata())||void 0===Rn||null===(or=Rn.sequence)||void 0===or?void 0:or.id;null===(So=this._myVTour.state.currentTooltip)||void 0===So||So.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},To&&this._parent.select(Ro,To)}setXYZ(C,Rn,or){const So=(0,Ro.J9)(C-this.getPictureOriginalHeading(),Rn,or);this.rotate({yaw:So.yaw,pitch:So.pitch}),this.zoom(So.zoom)}setHigherContrast(C){this.renderer.renderer.toneMapping=C?3:0,this.renderer.renderer.toneMappingExposure=C?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(C){if((C=parseFloat(C))<100||C>fl)throw new Error("Invalid transition duration (should be between 100 and "+fl+")");this._transitionDuration=C;const Rn=new CustomEvent("psv:transition-duration-changed",{detail:{value:C}});this._parent.dispatchEvent(Rn)}setPanorama(C,Rn){const onFailure=C=>this.showErrorOverlay(C,this._parent._t.gvs.error_pic,!0);try{return super.setPanorama(C,Rn).catch(onFailure)}catch(or){onFailure(or)}}showErrorOverlay(C,Rn,or){this._parent._loader.isVisible()||!this.overlay.isVisible()?this._parent._loader.dismiss(C,Rn,or?()=>{this._parent._loader.dismiss(),this.overlay.hide()}:void 0):(console.error(C),this.overlay.show({image:'<img style="width: 200px" src="'.concat(To,'" />'),title:this._parent._t.gvs.error,text:Rn+"<br />"+this._parent._t.gvs.error_click,dissmisable:or}))}}},937:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>API});var So=or(3406);class API{constructor(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null===C||void 0===C||"string"!==typeof C)throw new Error("endpoint parameter is empty or not a valid string");if(C.startsWith("/")&&(C=window.location.href.split("/").slice(0,3).join("/")+C),!API.isValidHttpUrl(C))throw new Error("endpoint parameter is not a valid URL: ".concat(C));this._endpoint=C,this._isReady=0,this._dataBbox=null,this._fetchOpts=(null===Rn||void 0===Rn?void 0:Rn.fetch)||{},this._metadata={},Rn.skipReadLanding||(this._readLanding=fetch(C,this._getFetchOptions()).then((C=>C.json())).then((C=>this._parseLanding(C,Rn))).catch((C=>(this._isReady=-1,console.error(C),Promise.reject("Viewer failed to communicate with API")))).then((()=>this._loadMapStyles(Rn.style,Rn.users))).then((()=>(this._isReady=1,"API is ready"))))}onceReady(){return-1==this._isReady?Promise.reject("Viewer failed to communicate with API"):1==this._isReady?Promise.resolve("API is ready"):this._readLanding}isReady(){return 1==this._isReady}_parseLanding(C,Rn){var or,So;if(this._endpoints={collections:null,search:null,style:null,user_style:null,tiles:(null===Rn||void 0===Rn?void 0:Rn.tiles)||null,user_tiles:null,user_search:null,collection_preview:null,item_preview:null,rss:null,report:null},!C||!C.links||!Array.isArray(C.links))throw new Error("API Landing page doesn't contain 'links' list");if(!C.stac_version.startsWith("1.0"))throw new Error("API is not in a supported STAC version (Panoramax viewer supports only 1.0, API is ".concat(C.stac_version,")"));this._metadata.name=C.title||"Unnamed",this._metadata.stac_version=C.stac_version,this._metadata.geovisio_version=C.geovisio_version||"Unknown";const To=[],Ro=[];if([{rel:"search",type:"application/geo+json",endpointId:"search",mandatory:!0,missingIssue:"No direct access to pictures metadata."},{rel:"data",type:"application/json",endpointId:"collections",mandatory:!0,missingIssue:"No way for viewer to access sequences."},{rel:"data",type:"application/rss+xml",endpointId:"rss"},{rel:"xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"tiles"},{rel:"xyz-style",type:"application/json",endpointId:"style"},{rel:"user-xyz-style",type:"application/json",endpointId:"user_style"},{rel:"user-xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"user_tiles"},{rel:"user-search",type:"application/json",endpointId:"user_search",missingIssue:"Filter map data by user name will not be available."},{rel:"collection-preview",type:"image/jpeg",endpointId:"collection_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"item-preview",type:"image/jpeg",endpointId:"item_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"report",type:"application/json",endpointId:"report"}].forEach((Rn=>{const or=C.links.find((C=>C.rel==Rn.rel&&C.type==Rn.type));if(or){if(!API.isValidHttpUrl(or.href))throw new Error("API endpoint '".concat(or.rel,"' (").concat(or.type,") is not a valid URL: ").concat(or.href));this._endpoints[Rn.endpointId]||(this._endpoints[Rn.endpointId]=or.href)}else if(!this._endpoints[Rn.endpointId]){let C="API doesn't offer a '".concat(Rn.rel,"' (").concat(Rn.type,") endpoint in its links");Rn.missingIssue&&(C+="\n".concat(Rn.missingIssue)),Rn.mandatory?To.push(C):Rn.missingIssue&&Ro.push(C)}})),this._endpoints.style||this._endpoints.tiles||Ro.push("API doesn't offer 'xyz' or 'xyz-style' endpoints in its links.\nMap widget will not be available."),this._endpoints.user_style||this._endpoints.user_tiles||Ro.push("API doesn't offer 'user-xyz' or 'user-xyz-style' endpoints in its links.\nFilter map data by user ID will not be available."),Ro.forEach((C=>console.warn(C))),To.length>0)throw new Error(To.join("\n"));const Uo=null===C||void 0===C||null===(or=C.extent)||void 0===or||null===(So=or.spatial)||void 0===So?void 0:So.bbox;this._dataBbox=Uo&&Array.isArray(Uo)&&Uo.length>0&&Array.isArray(Uo[0])&&4===Uo[0].length?[[Uo[0][0],Uo[0][1]],[Uo[0][2],Uo[0][3]]]:null}_loadMapStyles(C,Rn){const or=new Set(Rn||[]);this.mapStyle={version:8,sources:{},layers:[]};const So=[this.getMapStyle()];if("string"===typeof C){const Rn=C.startsWith(this._endpoint)?this._getFetchOptions():void 0;So.push(fetch(C,Rn).then((C=>C.json())))}else"object"===typeof C&&So.push(Promise.resolve(C));return[...or].filter((C=>"geovisio"!==C)).forEach((C=>{So.push(this.getUserMapStyle(C,!0))})),Promise.all(So).then((C=>{const Rn=["bearing","center","glyphs","light","metadata","name","pitch","sky","sprite","terrain","transition","zoom"];C.forEach((C=>{Rn.forEach((Rn=>{C[Rn]&&(this.mapStyle[Rn]=C[Rn]||this.mapStyle[Rn])})),Object.assign(this.mapStyle.sources,(null===C||void 0===C?void 0:C.sources)||{}),this.mapStyle.layers=this.mapStyle.layers.concat((null===C||void 0===C?void 0:C.layers)||[])}))})).catch((C=>console.error(C)))}_getFetchOptions(){return Object.assign({},this._fetchOpts)}_getMapRequestTransform(){if(Object.keys(this._getFetchOptions()).length>0)return C=>{if(C.startsWith(this._endpoint))return{url:C,...this._getFetchOptions()}}}async getSequenceItems(C){if(!this.isReady())throw new Error("API is not ready to use");try{return API.isIdValid(C),fetch("".concat(this._endpoints.collections,"/").concat(C,"/items"),this._getFetchOptions()).then((C=>C.json()))}catch(Rn){return Promise.reject(Rn)}}getPicturesAroundCoordinatesUrl(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e-4,So=arguments.length>3?arguments[3]:void 0,To=arguments.length>4?arguments[4]:void 0;if(!this.isReady())throw new Error("API is not ready to use");if(isNaN(parseFloat(C))||isNaN(parseFloat(Rn)))throw new Error("lat and lon parameters should be valid numbers");const Ro=[Rn-or,C-or,Rn+or,C+or].map((C=>C.toFixed(4))).join(","),Uo=So?"&limit=".concat(So):"",Oo=To?"&collections=".concat(To):"";return"".concat(this._endpoints.search,"?bbox=").concat(Ro).concat(Uo).concat(Oo)}getPicturesAroundCoordinates(C,Rn,or,So,To){return fetch(this.getPicturesAroundCoordinatesUrl(C,Rn,or,So,To),this._getFetchOptions()).then((C=>C.json()))}getPictureMetadataUrl(C,Rn){if(!this.isReady())throw new Error("API is not ready to use");if(API.isIdValid(C))return Rn?"".concat(this._endpoints.collections,"/").concat(Rn,"/items/").concat(C):"".concat(this._endpoints.search,"?ids=").concat(C)}getMapStyle(){if(this.isReady())return this.mapStyle;let C;return C=this._endpoints.style?this._endpoints.style:this._endpoints.tiles?{version:8,sources:{geovisio:{type:"vector",tiles:[this._endpoints.tiles],minzoom:0,maxzoom:So.Lh}}}:fetch("".concat(this._endpoint,"/map/14/0/0.mvt"),this._getFetchOptions()).then((()=>(this._endpoints.tiles="".concat(this._endpoint,"/map/{z}/{x}/{y}.mvt"),console.log("Using fallback endpoint for vector tiles"),this.getMapStyle()))).catch((C=>(console.error(C),Promise.reject(new Error("API doesn't offer a vector tiles endpoint"))))),"string"===typeof C?fetch(C,this._getFetchOptions()).then((C=>C.json())):Promise.resolve(C)}getUserMapStyle(C){let Rn;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]||this.isReady()?C?(this._endpoints.user_style?Rn=this._endpoints.user_style.replace(/\{userId\}/g,C):this._endpoints.user_tiles&&(Rn={version:8,sources:{["geovisio_".concat(C)]:{type:"vector",tiles:[this._endpoints.user_tiles.replace(/\{userId\}/g,C)],minzoom:0,maxzoom:So.Lh}}}),Rn?"string"===typeof Rn?fetch(Rn,this._getFetchOptions()).then((C=>C.json())):Promise.resolve(Rn):Promise.reject(new Error("API doesn't offer map style for specific user"))):Promise.reject(new Error("Parameter userId is empty")):Promise.reject(new Error("API is not ready to use"))}findThumbnailInPictureFeature(C){if(!this.isReady())throw new Error("API is not ready to use");if(!C||!C.assets)return null;let Rn=null;for(let or of Object.values(C.assets)){if(or.roles.includes("thumbnail")&&"image/jpeg"==or.type&&API.isValidHttpUrl(or.href))return or.href;or.roles.includes("visual")&&"image/jpeg"==or.type&&API.isValidHttpUrl(or.href)&&(Rn=or.href)}return Rn}getPictureThumbnailURLForSequence(C,Rn){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.collection_preview)return Promise.resolve(this._endpoints.collection_preview.replace("{id}",C));if(Rn&&Array.isArray(Rn.links)&&Rn.links.length>0){let C=Rn.links.find((C=>"preview"===C.rel&&"image/jpeg"===C.type));if(C&&API.isValidHttpUrl(C.href))return Promise.resolve(C.href)}const or="".concat(this._endpoints.search,"?limit=1&collections=").concat(C);return fetch(or,this._getFetchOptions()).then((C=>C.json())).then((C=>Array.isArray(C.features)&&0!=C.features.length?this.findThumbnailInPictureFeature(C.features.pop()):null))}getPictureThumbnailURL(C,Rn){if(!this.isReady())throw new Error("API is not ready to use");return C?this._endpoints.item_preview?Promise.resolve(this._endpoints.item_preview.replace("{id}",C)):C&&Rn?fetch("".concat(this._endpoints.collections,"/").concat(Rn,"/items/").concat(C),this._getFetchOptions()).then((C=>C.json())).then((C=>C?this.findThumbnailInPictureFeature(C):null)):fetch("".concat(this._endpoints.search,"?ids=").concat(C),this._getFetchOptions()).then((C=>C.json())).then((C=>C&&Array.isArray(C.features)&&0!=C.features.length?this.findThumbnailInPictureFeature(C.features.pop()):null)):Promise.resolve(null)}getRSSURL(C){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.rss){let Rn=this._endpoints.rss;return C&&(Rn+=Rn.includes("?")?"&":"?",Rn+="bbox="+[C.getWest(),C.getSouth(),C.getEast(),C.getNorth()].join(",")),Rn}return null}getSequenceMetadataUrl(C){if(!this.isReady())throw new Error("API is not ready to use");return"".concat(this._endpoints.collections,"/").concat(C)}getDataBbox(){if(!this.isReady())throw new Error("API is not ready to use");return this._dataBbox}searchUsers(C){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch("".concat(this._endpoints.user_search,"?q=").concat(C),this._getFetchOptions()).then((C=>C.json())).then((C=>(null===C||void 0===C?void 0:C.features)||null))}getUserName(C){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch(this._endpoints.user_search.replace(/\/search$/,"/".concat(C)),this._getFetchOptions()).then((C=>C.json())).then((C=>(null===C||void 0===C?void 0:C.name)||null))}sendReport(C){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.report)throw new Error("Report sending is not available");const Rn={...this._getFetchOptions(),method:"POST",body:JSON.stringify(C),headers:{"Content-Type":"application/json"}};return fetch(this._endpoints.report,Rn).then((async C=>{if(C.status>=400){let or=await C.text();try{or=JSON.parse(or).message}catch(Rn){}return Promise.reject(or)}return C.json()}))}static isValidHttpUrl(C){let Rn;try{Rn=new URL(C)}catch(or){return!1}return"http:"===Rn.protocol||"https:"===Rn.protocol}static isIdValid(C){if(!C||"string"!==typeof C||0===C.length)throw new Error("id should be a valid picture unique identifier");return!0}}},8139:(C,Rn,or)=>{"use strict";function getExifFloat(C){if(!([null,void 0,""].includes(C)||"string"===typeof C&&""===C.trim())){if("number"===typeof C)return C;if("string"!==typeof C);else{if(/^-?\d+(\.\d+)?\/-?\d+(\.\d+)?$/.test(C)){const Rn=C.split("/").map((C=>parseFloat(C)));return Rn[0]/Rn[1]}try{return parseFloat(C)}catch(Rn){}}}}function getGPSPrecision(C){var Rn,or,So,To;let Ro="unknown";const Uo=getExifFloat(null===C||void 0===C||null===(Rn=C.properties)||void 0===Rn||null===(or=Rn.exif)||void 0===or?void 0:or["Exif.GPSInfo.GPSHPositioningError"]),Oo=getExifFloat(null===C||void 0===C||null===(So=C.properties)||void 0===So||null===(To=So.exif)||void 0===To?void 0:To["Exif.GPSInfo.GPSDOP"]);return void 0!==Uo?Ro=Uo<.5?"ideal":Uo<1?"excellent":Uo<3?"good":Uo<7?"moderate":Uo<10?"fair":"poor":void 0!==Oo&&(Ro=Oo<1?"ideal":Oo<2?"excellent":Oo<5?"good":Oo<10?"moderate":Oo<20?"fair":"poor"),Ro}function getSphereCorrection(C){var Rn,or,So,To;let Ro=null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"];if(void 0===Ro){var Uo,Oo;const Rn=getExifFloat(null===(Uo=C.properties)||void 0===Uo||null===(Oo=Uo.exif)||void 0===Oo?void 0:Oo["Exif.GPSInfo.GPSImgDirection"]);void 0!==Rn&&(Ro=Rn)}Ro=Ro||0;let Ho=null===(or=C.properties)||void 0===or?void 0:or["pers:yaw"],qo=["Xmp.GPano.PoseHeadingDegrees","Xmp.Camera.Yaw","Exif.MpfInfo.MPFYawAngle"];if(void 0===Ho)for(let Nc of qo){var dl,ml;const Rn=getExifFloat(null===(dl=C.properties)||void 0===dl||null===(ml=dl.exif)||void 0===ml?void 0:ml[Nc]);if(void 0!==Rn){Ho=Rn;break}}Ho=Ho||0,Math.round(Ro)===Math.round(Ho)&&Ho>0&&console.warn("Picture with UUID",C.id,"has same GPS Image direction and Yaw, could cause rendering issues");let fl=null===(So=C.properties)||void 0===So?void 0:So["pers:pitch"];if(qo=["Xmp.GPano.PosePitchDegrees","Xmp.Camera.Pitch","Exif.MpfInfo.MPFPitchAngle"],void 0===fl)for(let Nc of qo){var vl,bl;const Rn=getExifFloat(null===(vl=C.properties)||void 0===vl||null===(bl=vl.exif)||void 0===bl?void 0:bl[Nc]);if(void 0!==Rn){fl=Rn;break}}fl=fl||0;let kl=null===(To=C.properties)||void 0===To?void 0:To["pers:roll"];if(qo=["Xmp.GPano.PoseRollDegrees","Xmp.Camera.Roll","Exif.MpfInfo.MPFRollAngle"],void 0===kl)for(let Nc of qo){var Ll,Dl;const Rn=getExifFloat(null===(Ll=C.properties)||void 0===Ll||null===(Dl=Ll.exif)||void 0===Dl?void 0:Dl[Nc]);if(void 0!==Rn){kl=Rn;break}}return kl=kl||0,{pan:Ho*Math.PI/180,tilt:fl*Math.PI/180,roll:kl*Math.PI/180}}function getCroppedPanoData(C){var Rn,or;let So;var To,Ro;if(null!==(Rn=C.properties)&&void 0!==Rn&&Rn["pers:interior_orientation"]&&(null!==(To=C.properties["pers:interior_orientation"])&&void 0!==To&&To.visible_area&&null!==(Ro=C.properties["pers:interior_orientation"])&&void 0!==Ro&&Ro.sensor_array_dimensions)){const Rn=C.properties["pers:interior_orientation"].visible_area,or=C.properties["pers:interior_orientation"].sensor_array_dimensions;try{So={fullWidth:parseInt(or[0]),fullHeight:parseInt(or[1]),croppedX:parseInt(Rn[0]),croppedY:parseInt(Rn[1]),croppedWidth:parseInt(or[0])-parseInt(Rn[2])-parseInt(Rn[0]),croppedHeight:parseInt(or[1])-parseInt(Rn[3])-parseInt(Rn[1])}}catch(fl){console.warn("Invalid pers:interior_orientation values for cropped panorama "+C.id)}}if(!So&&null!==(or=C.properties)&&void 0!==or&&or.exif)try{var Uo,Oo,Ho,qo,dl,ml;So={fullWidth:parseInt(null===(Uo=C.properties.exif)||void 0===Uo?void 0:Uo["Xmp.GPano.FullPanoWidthPixels"]),fullHeight:parseInt(null===(Oo=C.properties.exif)||void 0===Oo?void 0:Oo["Xmp.GPano.FullPanoHeightPixels"]),croppedX:parseInt(null===(Ho=C.properties.exif)||void 0===Ho?void 0:Ho["Xmp.GPano.CroppedAreaLeftPixels"]),croppedY:parseInt(null===(qo=C.properties.exif)||void 0===qo?void 0:qo["Xmp.GPano.CroppedAreaTopPixels"]),croppedWidth:parseInt(null===(dl=C.properties.exif)||void 0===dl?void 0:dl["Xmp.GPano.CroppedAreaImageWidthPixels"]),croppedHeight:parseInt(null===(ml=C.properties.exif)||void 0===ml?void 0:ml["Xmp.GPano.CroppedAreaImageHeightPixels"])}}catch(fl){console.warn("Invalid XMP.GPano values for cropped panorama "+C.id)}return So&&(So=Object.fromEntries(Object.entries(So||{}).filter((C=>!isNaN(C[1])))),So.fullWidth==So.croppedWidth&&So.fullHeight==So.croppedHeight&&(So={})),So||{}}or.d(Rn,{Cf:()=>getSphereCorrection,Z1:()=>getCroppedPanoData,j$:()=>getGPSPrecision})},7586:(C,Rn,or)=>{"use strict";or.d(Rn,{F:()=>getTranslations});var So=or(3517),To=or(1700),Ro=or(6980),Uo=or(6493),Oo=or(6254),Ho=or(1392);const qo={de:So,en:To,es:Ro,fr:Uo,hu:Oo,zh_Hant:Ho},autoDetectLocale=()=>{for(const C of window.navigator.languages){let Rn=C;switch(Rn){case"zh-TW":case"zh-HK":case"zh-MO":Rn="zh_Hant";break;case"zh-CN":case"zh-SG":Rn="zh_Hans";break;default:Rn.length>2&&(Rn=C.substring(0,2))}const or=Object.entries(qo).find((C=>C[0]===Rn));if(or)return or[0]}return"en"};function getTranslations(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const Rn=JSON.parse(JSON.stringify(To));let or;if(C||(C=autoDetectLocale()),qo[C]&&"en"!==C&&(or=qo[C]),C.length>2){const Rn=C.substring(0,2);qo[Rn]&&(or=qo[Rn])}return or&&Object.entries(or).forEach((C=>{let[or,So]=C;Object.assign(Rn[or],So)})),Rn}},3406:(C,Rn,or)=>{"use strict";or.d(Rn,{Ec:()=>combineStyles,FS:()=>getMissingLayerStyles,Lh:()=>qo,RF:()=>isLabelLayer,Ws:()=>Ho,eY:()=>getUserSourceId,g8:()=>forwardGeocodingNominatim,lg:()=>dl,lh:()=>getUserLayerId,sl:()=>getThumbGif,uD:()=>forwardGeocodingBAN,wL:()=>Oo});var So=or(4307),To=or.n(So),Ro=or(9836),Uo=or(7457);const Oo="https://panoramax.openstreetmap.fr/pmtiles/basic.json",Ho="gvs-aerial",qo=15,dl={PICTURES:{paint:{"circle-radius":["interpolate",["linear"],["zoom"],qo,4.5,18,6,24,12],"circle-opacity":["interpolate",["linear"],["zoom"],qo,0,qo+1,1],"circle-stroke-color":"#ffffff","circle-stroke-width":["interpolate",["linear"],["zoom"],qo+1,0,qo+2,1,18,1.5,24,3]},layout:{}},PICTURES_SYMBOLS:{paint:{"icon-opacity":["interpolate",["linear"],["zoom"],18,0,19,1]},layout:{"icon-image":["case",["==",["get","type"],"equirectangular"],"gvs-arrow-360","gvs-arrow-flat"],"icon-size":["interpolate",["linear"],["zoom"],18,.5,24,1],"icon-rotate":["to-number",["get","heading"]],"icon-allow-overlap":!0}},SEQUENCES:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,.5,10,2,14,4,16,5,22,3]},layout:{"line-cap":"square"}},SEQUENCES_PLUS:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,15,qo+1,30,qo+2,0],"line-opacity":0,"line-color":"#ff0000"},layout:{"line-cap":"square"}}};function getThumbGif(C){const Rn=document.createElement("img");return Rn.src=Ro,Rn.alt=C.loading,Rn.title=C.loading,Rn.classList.add("gvs-map-thumb","gvs-map-thumb-loader"),Rn}function isLabelLayer(C){var Rn;return"symbol"===C.type&&(null===C||void 0===C||null===(Rn=C.layout)||void 0===Rn?void 0:Rn["text-field"])&&(void 0===C.minzoom||C.minzoom<15)}function combineStyles(C,Rn){var or,So;const To=C._api.getMapStyle();return To.layers=To.layers.concat(getMissingLayerStyles(To.sources,To.layers)),Rn.supplementaryStyle&&(Object.assign(To.sources,Rn.supplementaryStyle.sources||{}),To.layers=To.layers.concat(Rn.supplementaryStyle.layers||[])),Rn.raster&&(To.sources["gvs-aerial"]=Rn.raster,To.layers.push({id:Ho,type:"raster",source:"gvs-aerial",layout:{visibility:"aerial"===Rn.background?"visible":"none"}})),null!==(or=C._options)&&void 0!==or&&null!==(So=or.users)&&void 0!==So&&So.includes("geovisio")||To.layers.forEach((C=>{"geovisio"===C.source&&(C.layout||(C.layout={}),C.layout.visibility="none")})),To.layers.sort(((C,Rn)=>isLabelLayer(C)&&!isLabelLayer(Rn)?1:!isLabelLayer(C)&&isLabelLayer(Rn)?-1:C.id.startsWith("geovisio")&&!Rn.id.startsWith("geovisio")?1:!C.id.startsWith("geovisio")&&Rn.id.startsWith("geovisio")?-1:C.id.endsWith("_pictures")&&!Rn.id.endsWith("_pictures")?1:!C.id.endsWith("_pictures")&&Rn.id.endsWith("_pictures")?-1:0)),To}function getMissingLayerStyles(C,Rn){const or=[];return Object.keys(C).filter((C=>void 0===Rn.find((Rn=>(null===Rn||void 0===Rn?void 0:Rn.source)===C)))).forEach((C=>{C.startsWith("geovisio")&&(or.push({id:"".concat(C,"_sequences"),type:"line",source:C,"source-layer":"sequences",layout:{...dl.SEQUENCES.layout},paint:{...dl.SEQUENCES.paint,"line-color":Uo.DM.BASE}}),or.push({id:"".concat(C,"_sequences_plus"),type:"line",source:C,"source-layer":"sequences",layout:{...dl.SEQUENCES_PLUS.layout},paint:{...dl.SEQUENCES_PLUS.paint}}),or.push({id:"".concat(C,"_pictures_symbols"),type:"symbol",source:C,"source-layer":"pictures",...dl.PICTURES_SYMBOLS}),or.push({id:"".concat(C,"_pictures_symbols"),type:"symbol",source:C,"source-layer":"pictures",...dl.PICTURES_SYMBOLS}),or.push({id:"".concat(C,"_pictures"),type:"circle",source:C,"source-layer":"pictures",layout:{...dl.PICTURES.layout},paint:{...dl.PICTURES.paint,"circle-color":Uo.DM.BASE}}))})),Rn.filter((C=>{var or;return(null===C||void 0===C||null===(or=C.id)||void 0===or?void 0:or.endsWith("_sequences"))&&void 0===Rn.find((Rn=>(null===Rn||void 0===Rn?void 0:Rn.id)===C.id+"_plus"))})).forEach((C=>{or.push({id:"".concat(C.id,"_plus"),type:"line",source:C.source,"source-layer":C["source-layer"],layout:{...dl.SEQUENCES_PLUS.layout},paint:{...dl.SEQUENCES_PLUS.paint}})})),Rn.filter((C=>{var or;return(null===C||void 0===C||null===(or=C.id)||void 0===or?void 0:or.endsWith("_pictures"))&&void 0===Rn.find((Rn=>(null===Rn||void 0===Rn?void 0:Rn.id)===C.id+"_symbols"))})).forEach((C=>{or.unshift({id:"".concat(C.id,"_symbols"),type:"symbol",source:C.source,"source-layer":"pictures",...dl.PICTURES_SYMBOLS}),C.paint=Object.assign(C.paint||{},dl.PICTURES.paint),C.layout=Object.assign(C.layout||{},dl.PICTURES.layout)})),or}function getUserLayerId(C,Rn){return"".concat(getUserSourceId(C),"_").concat(Rn)}function getUserSourceId(C){return"geovisio"===C?"geovisio":"geovisio_"+C}function geocoderParamsToURLString(C){let Rn={};return Object.entries(C).filter((C=>void 0!==C[1]&&null!==C[1])).forEach((C=>Rn[C[0]]=C[1])),new URLSearchParams(Rn).toString()}function forwardGeocodingNominatim(C){const Rn={q:C.query,countrycodes:C.countries,limit:C.limit,viewbox:C.bbox};return fetch("https://nominatim.openstreetmap.org/search?".concat(geocoderParamsToURLString(Rn),"&format=geojson&polygon_geojson=1&addressdetails=1")).then((C=>C.json())).then((C=>{const Rn={features:[]},or=[];return C.features.forEach((C=>{or.includes(C.properties.display_name)||(Rn.features.push({place_type:["place"],place_name:C.properties.display_name,bounds:new(To().LngLatBounds)(C.bbox)}),or.push(C.properties.display_name))})),Rn}))}function forwardGeocodingBAN(C){const Rn={q:C.query,limit:C.limit};if("string"===typeof C.proximity){const[or,So]=C.proximity.split(",").map((C=>parseFloat(C.trim())));Rn.lat=or,Rn.lon=So}const or={housenumber:20,street:18,locality:15,municipality:12};return fetch("https://api-adresse.data.gouv.fr/search/?".concat(geocoderParamsToURLString(Rn))).then((C=>C.json())).then((C=>(C.features=C.features.map((C=>{return{place_type:["place"],place_name:(Rn=C.properties,[Rn.name,Rn.district,Rn.city].filter((C=>C)).join(", ")),center:new(To().LngLat)(...C.geometry.coordinates),zoom:or[C.properties.type]};var Rn})),C)))}},5856:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>PhotoAdapter});var So=or(9771);class PhotoAdapter extends So.k{constructor(C,Rn){super(C,Rn),this._shouldGoFast=Rn.shouldGoFast||(()=>!0)}loadTexture(C,Rn){return C.origBaseUrl?C.baseUrl=C.origBaseUrl:C.origBaseUrl=C.baseUrl,this._shouldGoFast()&&C.thumbUrl&&!C.hdLoaded&&1==C.rows&&(C.baseUrl=C.thumbUrl),super.loadTexture(C,Rn).then((Rn=>(C.baseUrl===C.origBaseUrl&&(C.hdLoaded=!0),Rn)))}__loadTiles(C){this._shouldGoFast()||super.__loadTiles(C)}}},7457:(C,Rn,or)=>{"use strict";or.d(Rn,{DM:()=>Uo,EF:()=>isInternetFast,FF:()=>apiFeatureToPSVNode,Iu:()=>josmBboxParameters,J9:()=>xyzToPosition,Sp:()=>getDistance,bk:()=>linkMapAndPhoto,iE:()=>getUserAccount,r:()=>getRelativeHeading,wW:()=>positionToXYZ,zd:()=>isInIframe});var So=or(8139),To=or(9341),Ro=or(2893);const Uo={BASE:"#FF6F00",SELECTED:"#1E88E5",HIDDEN:"#34495E",NEXT:"#ffab40",QUALI_1:"#00695C",QUALI_2:"#fd8d3c",PALETTE_1:"#fecc5c",PALETTE_2:"#fd8d3c",PALETTE_3:"#f03b20",PALETTE_4:"#bd0026"},Oo=(Object.fromEntries(Object.entries(Uo).map((C=>(C[1]=parseInt(C[1].slice(1),16),C)))),svgToPSVLink(To,"white")),Ho=svgToPSVLink(Ro,Uo.NEXT);function getDistance(C,Rn){const or=C[0]-Rn[0],So=C[1]-Rn[1];return Math.sqrt(or*or+So*So)}function sortPicturesInDirection(C){return(Rn,or)=>"related"!=Rn.rel&&"related"!=or.rel?0:"related"!=Rn.rel?-1:"related"!=or.rel?1:Rn.date==or.date?getDistance(C,Rn.geometry.coordinates)-getDistance(C,or.geometry.coordinates):or.date.localeCompare(Rn.date)}function svgToPSVLink(C,Rn){try{const or=atob(C.replace(/^data:image\/svg\+xml;base64,/,"")),So=(new DOMParser).parseFromString(or,"image/svg+xml").childNodes[0],To=document.createElement("button");return To.appendChild(So),To.classList.add("gvs-psv-tour-arrows"),To.style.color=Rn,To}catch(or){const Rn=document.createElement("img");return Rn.src=C,Rn}}function getArrow(C){const Rn=C.cloneNode(!0);return Rn.addEventListener("pointerup",(()=>Rn.classList.add("gvs-clicked"))),Rn}function getAzimuth(C,Rn){return(Math.atan2(Rn[0]-C[0],Rn[1]-C[1])*(180/Math.PI)+360)%360}function getRelativeHeading(C){var Rn,or;if(!C)throw new Error("No picture selected");let So,To;const Ro=C.properties["view:azimuth"];if(null!==C&&void 0!==C&&null!==(Rn=C.sequence)&&void 0!==Rn&&Rn.prevPic){var Uo;const Rn=null===C||void 0===C||null===(Uo=C.links)||void 0===Uo?void 0:Uo.find((Rn=>Rn.nodeId===C.sequence.prevPic));Rn&&(So=(Ro-getAzimuth(Rn.gps,C.gps)+180)%360-180)}if(null!==C&&void 0!==C&&null!==(or=C.sequence)&&void 0!==or&&or.nextPic){var Oo;const Rn=null===C||void 0===C||null===(Oo=C.links)||void 0===Oo?void 0:Oo.find((Rn=>Rn.nodeId===C.sequence.nextPic));Rn&&(To=(Ro-getAzimuth(C.gps,Rn.gps)+180)%360-180)}return void 0!==So?So:void 0!==To?To:0}function getSimplifiedAngle(C,Rn){const or=Math.atan2(Rn[0]-C[0],Rn[1]-C[1])*(180/Math.PI);return Math.abs(or)<30?"N":or>=30&&or<90?"ENE":or>=90&&or<150?"ESE":Math.abs(or)>=150?"S":or<=-30&&or>-90?"WNW":or<=-90&&or>-150?"WSW":void 0}function positionToXYZ(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const or={x:C.yaw*(180/Math.PI),y:C.pitch*(180/Math.PI)};return void 0!==Rn&&(or.z=Rn),or}function xyzToPosition(C,Rn,or){return{yaw:C/(180/Math.PI),pitch:Rn/(180/Math.PI),zoom:or}}function getNodeCaption(C,Rn){var or,So,To;const Ro={};if(null!==C&&void 0!==C&&null!==(or=C.properties)&&void 0!==or&&or.datetimetz?Ro.date=new Date(C.properties.datetimetz):null!==C&&void 0!==C&&null!==(So=C.properties)&&void 0!==So&&So.datetime&&(Ro.date=new Date(C.properties.datetime)),null!==C&&void 0!==C&&C.providers){var Uo;const Rn=null===C||void 0===C||null===(Uo=C.providers)||void 0===Uo?void 0:Uo.filter((C=>{var Rn;return null===C||void 0===C||null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("producer")}));if((null===Rn||void 0===Rn?void 0:Rn.length)>=0){const C={};Rn.map((C=>C.name)).forEach((Rn=>{const or=Rn.toLowerCase().replace(/\s/g,"");C[or]?C[or].push(Rn):C[or]=[Rn]})),Ro.producer=[],Object.values(C).forEach((C=>{const Rn=C[0],or=C.find((C=>C.toLowerCase()!=C));Ro.producer.push(or||Rn)})),Ro.producer=Ro.producer.join(", ")}}if(null!==C&&void 0!==C&&null!==(To=C.properties)&&void 0!==To&&To.license&&(Ro.license=C.properties.license,null!==C&&void 0!==C&&C.links)){const or=C.links.find((C=>"license"===(null===C||void 0===C?void 0:C.rel)));or&&(Ro.license='<a href="'.concat(or.href,'" title="').concat(Rn.gvs.metadata_general_license_link,'" target="_blank">').concat(Ro.license,"</a>"))}return Ro}function linkMapAndPhoto(C){const onPicLoad=Rn=>C.map.displayPictureMarker(Rn.detail.lon,Rn.detail.lat,C.psv.getXY().x);C.addEventListener("psv:picture-loading",onPicLoad),C.addEventListener("psv:picture-loaded",onPicLoad),C.addEventListener("psv:view-rotated",(()=>{let Rn=C.psv.getPosition().yaw*(180/Math.PI);Rn+=C.psv.getPictureOriginalHeading(),C.map._picMarker.setRotation(Rn)})),C.addEventListener("psv:picture-preview-started",(Rn=>{C.map._picMarkerPreview.setLngLat(Rn.detail.coordinates).setRotation(Rn.detail.direction||0).addTo(C.map)})),C.addEventListener("psv:picture-preview-stopped",(()=>{C.map._picMarkerPreview.remove()})),C.addEventListener("psv:picture-loaded",(Rn=>{C.isWidthSmall()&&C._picPopup&&Rn.detail.picId==C._picPopup._picId&&C._picPopup.remove()})),C.addEventListener("map:picture-click",(Rn=>{C.select(Rn.detail.seqId,Rn.detail.picId),!C.psv._myVTour.state.currentNode&&null!==C&&void 0!==C&&C.setFocus&&C.setFocus("pic")})),C.addEventListener("map:sequence-click",(Rn=>{C._api.getPicturesAroundCoordinates(Rn.detail.coordinates.lat,Rn.detail.coordinates.lng,1,1,Rn.detail.seqId).then((Rn=>{var or,So;(null===Rn||void 0===Rn||null===(or=Rn.features)||void 0===or?void 0:or.length)>0&&(C.select(null===(So=Rn.features[0])||void 0===So?void 0:So.collection,Rn.features[0].id),!C.psv.getPictureMetadata()&&null!==C&&void 0!==C&&C.setFocus&&C.setFocus("pic"))}))}))}function apiFeatureToPSVNode(C,Rn){var or,To,Ro,Uo,Oo,Ho,qo;let dl=arguments.length>2&&void 0!==arguments[2]&&arguments[2],ml=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const fl=null!=(null===(or=C.properties)||void 0===or||null===(To=or["pers:interior_orientation"])||void 0===To?void 0:To.field_of_view);let vl=fl?parseInt(C.properties["pers:interior_orientation"].field_of_view):70;const bl=360===vl,kl=(Object.values(C.assets).find((C=>{var Rn;return null===C||void 0===C||null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("data")}))||{}).href,Ll=null===C||void 0===C||null===(Ro=C.properties)||void 0===Ro||null===(Uo=Ro["tiles:tile_matrix_sets"])||void 0===Uo?void 0:Uo.geovisio,Dl=C.links.find((C=>"prev"===(null===C||void 0===C?void 0:C.rel)&&"application/geo+json"===(null===C||void 0===C?void 0:C.type))),Nc=C.links.find((C=>"next"===(null===C||void 0===C?void 0:C.rel)&&"application/geo+json"===(null===C||void 0===C?void 0:C.type))),jc=Object.values(C.assets).find((C=>{var Rn;return(null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("visual"))&&"image/webp"===C.type})),Zc=Object.values(C.assets).find((C=>{var Rn;return(null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("visual"))&&"image/jpeg"===C.type})),eu=(jc||Zc).href,Ku=null===(Oo=Object.values(C.assets).find((C=>{var Rn;return(null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("thumbnail"))&&"image/jpeg"===C.type})))||void 0===Oo?void 0:Oo.href,Yu=(null===C||void 0===C||null===(Ho=C.asset_templates)||void 0===Ho?void 0:Ho.tiles_webp)||(null===C||void 0===C||null===(qo=C.asset_templates)||void 0===qo?void 0:qo.tiles),Eh=(0,So.Z1)(C);let Th;return Th=Object.keys(Eh).length>0?{baseUrl:dl?kl:eu,origBaseUrl:dl?kl:eu,hdUrl:kl,thumbUrl:Ku,basePanoData:Eh,cols:2,rows:1,width:2,tileUrl:()=>null}:bl?{baseUrl:eu,origBaseUrl:eu,basePanoData:C=>({fullWidth:C.width,fullHeight:C.height}),hdUrl:kl,thumbUrl:Ku,cols:Ll&&Ll.tileMatrix[0].matrixWidth,rows:Ll&&Ll.tileMatrix[0].matrixHeight,width:Ll&&Ll.tileMatrix[0].matrixWidth*Ll.tileMatrix[0].tileWidth,tileUrl:Ll&&((C,Rn)=>Yu.href.replace(/\{TileCol\}/g,C).replace(/\{TileRow\}/g,Rn))}:{baseUrl:dl?kl:eu,origBaseUrl:dl?kl:eu,hdUrl:kl,thumbUrl:Ku,basePanoData:C=>{C.width<C.height&&!fl&&(vl=35);const Rn=vl*C.height/C.width,or=360*C.width/vl,So=180*C.height/Rn;return{fullWidth:or,fullHeight:So,croppedWidth:C.width,croppedHeight:C.height,croppedX:(or-C.width)/2,croppedY:(So-C.height)/2}},cols:2,rows:1,width:2,tileUrl:()=>null},{id:C.id,caption:getNodeCaption(C,Rn),panorama:Th,links:filterRelatedPicsLinks(C,ml),gps:C.geometry.coordinates,sequence:{id:C.collection,nextPic:Nc?Nc.id:void 0,prevPic:Dl?Dl.id:void 0},sphereCorrection:(0,So.Cf)(C),horizontalFov:vl,properties:C.properties}}function filterRelatedPicsLinks(C){var Rn;let or=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const So=C.links.filter((C=>["next","prev","related"].includes(null===C||void 0===C?void 0:C.rel)&&"application/geo+json"===(null===C||void 0===C?void 0:C.type))).filter((C=>!or||or(C))).map((C=>(C.datetime&&(C.date=C.datetime.split("T")[0]),C))),To=C.geometry.coordinates,Ro=[],Uo={N:[],ENE:[],ESE:[],S:[],WSW:[],WNW:[]};for(let Oo of So){Uo[getSimplifiedAngle(To,Oo.geometry.coordinates)].push(Oo)}for(let Oo in Uo){const C=Uo[Oo];0!=C.length&&(C.sort(sortPicturesInDirection(To)),Ro.push(C.shift()))}let arrowStyle=C=>"related"===C.rel?{element:getArrow(Ho),size:{width:128/3,height:128}}:{element:getArrow(Oo),size:{width:75,height:75}};const qo=-((null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"])||0)*(Math.PI/180);return Ro.map((C=>({nodeId:C.id,gps:C.geometry.coordinates,arrowStyle:arrowStyle(C),linkOffset:{yaw:qo}})))}function josmBboxParameters(C){if(C){var Rn;const or=C.gps,So=null===C||void 0===C||null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"],To=2e-4,Ro={left:or[0]-(null===So||So>=180?To:0),right:or[0]+(null===So||So<=180?To:0),top:or[1]+(null===So||So<=90||So>=270?To:0),bottom:or[1]-(null===So||So>=90&&So<=270?To:0),changeset_source:"Panoramax"};return Object.entries(Ro).map((C=>C.join("="))).join("&")}return null}function isInIframe(){try{return window.self!==window.top}catch(C){return!0}}const qo=10,dl="gvs-internet-fast",ml="https://panoramax.openstreetmap.fr/images/05/ca/2c/98/0111-4baf-b6f3-587bb8847d2e.jpg";function isInternetFast(){try{const C=navigator.connection.downlink;return Promise.resolve(C>=qo)}catch(C){const Rn=sessionStorage.getItem(dl);if(["true","false"].includes(Rn))return Promise.resolve("true"===Rn);const or=(new Date).getTime();return fetch(ml+"?nocache="+or).then((async C=>[C,await C.blob()])).then((C=>{let[Rn,So]=C;const To=8*parseInt(Rn.headers.get("Content-Length")||So.size)/1024/1024/(((new Date).getTime()-or)/1e3)>=qo;return sessionStorage.setItem(dl,To?"true":"false"),To})).catch((C=>(console.warn("Failed to run speedtest",C),!1)))}}function getCookie(C){var Rn,or,So;const To=null===(Rn=document.cookie)||void 0===Rn||null===(or=Rn.split(";"))||void 0===or||null===(So=or.find((Rn=>Rn.trimStart().startsWith("".concat(C,"=")))))||void 0===So?void 0:So.split("=");if(To)return To.shift(),To.join("=")}function getUserAccount(){const C=getCookie("session"),Rn=getCookie("user_id"),or=getCookie("user_name");return C&&Rn&&or?{id:Rn,name:or}:null}},4824:(C,Rn,or)=>{"use strict";or.d(Rn,{C:()=>createButtonSpan,Fl:()=>createSearchBar,Mr:()=>enableButton,Nk:()=>fat,QO:()=>enableCopyButton,Qr:()=>disableButton,VQ:()=>closeOtherPanels,WD:()=>createExpandableButton,W_:()=>createTable,_:()=>createLabel,ax:()=>createButton,dc:()=>createHeader,fa:()=>fa,gJ:()=>createLinkCell,sS:()=>createGroup,wf:()=>createPanel});var So=or(942),To=or(6899),Ro=or(4671),Uo=or(7361),Oo=or(4666),Ho=or(8455),qo=or(6565),dl=or(6087);function createButton(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,So=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];const To=document.createElement("button");return Rn&&(Rn instanceof HTMLElement||Rn instanceof Node?To.appendChild(Rn):To.innerHTML=Rn),To.id=C,Array.isArray(So)&&(So=So.filter((C=>null!=C&&C.length>0))),To.classList.add("gvs-btn","gvs-widget-bg",...So),or&&(To.title=or),To}function createExpandableButton(C,Rn,or,So){let To=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const Ro=document.createElement("button");return Ro.id=C,Ro.appendChild(fa(Rn)),So._viewer.isWidthSmall()?Ro.title=or:(Ro.appendChild(document.createTextNode(or)),Ro.appendChild(fa(Uo.pt))),Ro.classList.add("gvs-btn","gvs-widget-bg","gvs-btn-expandable",...To),Ro}function createSearchBar(C,Rn,or,So,Uo){let qo=arguments.length>5&&void 0!==arguments[5]&&arguments[5],dl=arguments.length>6&&void 0!==arguments[6]&&arguments[6],ml=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;const fl=document.createElement("div");fl.classList.add("gvs-widget-bg","gvs-search-bar"),fl.id=C,dl&&fl.classList.add("gvs-search-bar-reducable"),ml&&fl.appendChild(ml);const vl=document.createElement("input");vl.type="text",vl.placeholder=Rn,fl.appendChild(vl);const extendInput=()=>{fl.classList.remove("gvs-search-bar-reduced")},reduceInput=()=>{fl.classList.add("gvs-search-bar-reduced")};dl&&reduceInput();const bl=document.createElement("span");bl.classList.add("gvs-search-bar-icon");const kl=fa(Oo.Y$),Ll=fa(Ho.IJ,{classes:["fa-spin"]}),Dl=fa(To.g8),Nc=fa(Ro.xH);bl.appendChild(kl),fl.appendChild(bl);const jc=createPanel(Uo,fl,[],["gvs-search-bar-results"],qo);fl.appendChild(jc);const switchIcon=C=>{bl.innerHTML="",bl.appendChild(C)},resetSearch=()=>{fl._throttler&&clearTimeout(fl._throttler),vl.value="",jc.innerHTML="",jc._toggle(!1),delete fl._lastSearch,switchIcon(kl),So(null),dl&&reduceInput()};fl.resetSearch=resetSearch;vl.setItem=C=>{fl._throttler&&clearTimeout(fl._throttler),vl.value=C,jc.innerHTML="",jc._toggle(!1),switchIcon(Dl),dl&&extendInput()};const goSearch=()=>{if(fl._throttler&&clearTimeout(fl._throttler),0===vl.value.length)return jc.innerHTML="",void jc._toggle(!1);fl._throttler=setTimeout((()=>{jc.innerHTML="",jc._toggle(!1),switchIcon(Ll),or(vl.value).then((C=>{switchIcon(Dl),jc._toggle(!0),C&&0!=C.length?!0!==C?C.forEach((C=>{const Rn=document.createElement("div");Rn.classList.add("gvs-search-bar-result"),Rn.innerHTML="".concat(C.title,"<br /><small>").concat((null===C||void 0===C?void 0:C.subtitle)||"","</small>"),jc.appendChild(Rn),Rn.addEventListener("click",(()=>(C=>{dl?(So(C),resetSearch()):(fl._throttler&&clearTimeout(fl._throttler),vl.value=C.title,jc.innerHTML="",jc._toggle(!1),So(C))})(C)))})):jc._toggle(!1):jc.innerHTML='<div class="gvs-search-empty">'.concat(Uo._t.gvs.search_empty,"</li>")})).catch((C=>{console.error(C),switchIcon(Nc)}))}),250)};return vl.addEventListener("change",goSearch),vl.addEventListener("keypress",goSearch),vl.addEventListener("paste",goSearch),vl.addEventListener("input",goSearch),bl.addEventListener("click",(()=>{bl.firstChild!=Dl&&bl.firstChild!=Nc||resetSearch(),dl&&bl.firstChild==kl&&(fl.classList.contains("gvs-search-bar-reduced")?extendInput():reduceInput())})),fl}function createPanel(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],So=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],To=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const Ro=document.createElement("div");Ro.id=Rn.id+"-panel",Array.isArray(So)&&(So=So.filter((C=>null!=C&&C.length>0))),Ro.classList.add("gvs-panel","gvs-widget-bg","gvs-hidden",...So);for(let Uo of or)Ro.appendChild(Uo);const togglePanel=(Rn,or)=>{Rn&&Rn.stopPropagation(),!0===or?Ro.classList.remove("gvs-hidden"):!1===or?Ro.classList.add("gvs-hidden"):(Ro.classList.toggle("gvs-hidden"),or=!Ro.classList.contains("gvs-hidden")),or&&!To&&closeOtherPanels(Ro,C._viewer.container)};return Ro._toggle=C=>togglePanel(null,C),"BUTTON"==Rn.tagName&&(Rn.addEventListener("click",togglePanel),Rn.addEventListener("hover",togglePanel)),Ro}function closeOtherPanels(C,Rn){var or;const isPanel=C=>C.classList.contains("gvs-panel")||C.classList.contains("gvs-search-bar-result")||C.classList.contains("gvs-search-empty")||C.classList.contains("gvs-search-bar-reducable");if(!isPanel(C)&&null!==(or=C)&&void 0!==or&&or.parentNode)for(C=C.parentNode;C instanceof Element&&!isPanel(C);)C=C.parentNode;for(const So of Rn.getElementsByClassName("gvs-panel"))So==C||So.contains(C)||So.classList.contains("gvs-hidden")||So.classList.add("gvs-hidden");for(const So of Rn.getElementsByClassName("gvs-search-bar-reducable"))So==C||So.contains(C)||So.classList.contains("gvs-search-bar-reduced")||So.resetSearch()}function createGroup(C,Rn,or){let So=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],To=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const Ro=document.createElement("div");Ro.id=C,Array.isArray(To)&&(To=To.filter((C=>null!=C&&C.length>0))),Ro.classList.add("gvs-group",...To);for(let Uo of So)Ro.appendChild(Uo);return or._corners[Rn].appendChild(Ro),Ro}function enableCopyButton(C,Rn){for(let or of C.getElementsByTagName("button")){const C=or.getAttribute("data-input"),So=or.getAttribute("data-copy");(C||So)&&or.addEventListener("click",(()=>{let To;if(C){const Rn=document.getElementById(C);To=Rn.innerText||Rn.value}else So&&(To=or.getAttribute("data-copy"));navigator.clipboard.writeText(To);const Ro=or.innerHTML;or.innerHTML="".concat(Rn.gvs.copied," ").concat(fat(qo.LE)),or.classList.add("gvs-btn-active"),setTimeout((()=>{or.innerHTML=Ro,or.classList.remove("gvs-btn-active")}),2e3)}))}}function enableButton(C){C.removeAttribute("disabled")}function disableButton(C){C.setAttribute("disabled","")}function fa(C,Rn){return(0,So.qv)(C,Rn).node[0]}function fat(C,Rn){return(0,So.qv)(C,Rn).html[0]}function createLinkCell(C,Rn,or,So){const To=document.createElement("a");To.href=Rn,To.target="_blank",To.title=or,To.textContent=C;return[To,createButtonSpan("".concat(fat(dl.kZ)," ").concat(So),C)]}function createTable(C,Rn){const or=document.createElement("table");return or.className=C,Rn.forEach((C=>{let{section:Rn,value:So,values:To,classes:Ro}=C;const Uo=document.createElement("tr"),Oo=document.createElement("th");Oo.scope="row",Oo.textContent=Rn,Uo.appendChild(Oo);const Ho=document.createElement("td");Ro&&Ho.classList.add(...Ro),To?To.forEach((C=>Ho.appendChild(C))):So instanceof HTMLElement?Ho.appendChild(So):Ho.innerHTML=So,Uo.appendChild(Ho),or.appendChild(Uo)})),or}function createHeader(C,Rn){const or=document.createElement(C);return or.innerHTML=Rn,or}function createButtonSpan(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const or=document.createElement("button");or.innerHTML=C,Rn&&or.setAttribute("data-copy",Rn);const So=document.createElement("span");return So.className="gvs-input-btn",So.appendChild(or),So}function createLabel(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const So=document.createElement("label");return So.htmlFor=C,or&&So.appendChild(fa(or)),So.appendChild(document.createTextNode(Rn)),So}},9204:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>URLHash});const So={minDate:"date_from",maxDate:"date_to",type:"pic_type",camera:"camera",theme:"theme"},To=Object.fromEntries(Object.entries(So).map((C=>[C[1],C[0]]))),Ro=["psv:view-rotated","psv:picture-loaded","focus-changed","filters-changed","psv:transition-duration-changed","map:background-changed","map:users-changed","pictures-navigation-changed"];class URLHash extends EventTarget{constructor(C){super(),this._viewer=C,this._delay=null,this._hashChangeHandler=this._onHashChange.bind(this),C.addEventListener("ready",(()=>{window.addEventListener("hashchange",this._hashChangeHandler,!1),Ro.forEach((C=>this._viewer.addEventListener(C,this._updateHash.bind(this))))}),{once:!0})}destroy(){var C,Rn;window.removeEventListener("hashchange",this._hashChangeHandler),delete this._hashChangeHandler,null===(C=this._viewer)||void 0===C||null===(Rn=C.map)||void 0===Rn||Rn.off("moveend",this._updateHash),Ro.forEach((C=>this._viewer.removeEventListener(C,this._updateHash))),delete this._viewer,this._updateHash()}bindMapEvents(){this._viewer.map.on("moveend",this._updateHash.bind(this))}getHashString(){let C="",Rn={};"number"==typeof this._viewer.psv.getTransitionDuration()&&(Rn.speed=this._viewer.psv.getTransitionDuration()),[null,"any"].includes(this._viewer.getPicturesNavigation())||(Rn.nav=this._viewer.getPicturesNavigation());const or=this._viewer.psv.getPictureMetadata();if(or&&(Rn.pic=or.id,Rn.xyz=this._getXyzHashString()),this._viewer.map){Rn.map=this._getMapHashString(),Rn.focus="pic",this._viewer.isMapWide()&&(Rn.focus="map"),this._viewer.popupContainer.classList.contains("gvs-hidden")||(Rn.focus="meta"),this._viewer.map.hasTwoBackgrounds()&&this._viewer.map.getBackground()&&(Rn.background=this._viewer.map.getBackground());const C=this._viewer.map.getVisibleUsers();if((C.length>1||!C.includes("geovisio"))&&(Rn.users=C.join(",")),this._viewer._mapFilters)for(let or in So)this._viewer._mapFilters[or]&&(Rn[So[or]]=this._viewer._mapFilters[or])}else Rn.map="none";return Object.entries(Rn).sort(((C,Rn)=>C[0].localeCompare(Rn[0]))).forEach((Rn=>{let[or,So]=Rn,To=!1;const Ro=C.split("&").map((C=>{const Rn=C.split("=")[0];return Rn===or?(To=!0,"".concat(Rn,"=").concat(So)):C})).filter((C=>C));To||Ro.push("".concat(or,"=").concat(So)),C="".concat(Ro.join("&"))})),"#".concat(C).replace(/^#+/,"#")}_getCurrentHash(){const C=window.location.hash.replace("#","");let Rn={};return C.split("&").map((C=>C.split("="))).filter((C=>void 0!==C[0]&&C[0].length>0)).forEach((C=>{Rn[C[0]]=C[1]})),Rn}_getMapHashString(){const C=this._viewer.map.getCenter(),Rn=Math.round(100*this._viewer.map.getZoom())/100,or=Math.ceil((Rn*Math.LN2+Math.log(512/360/.5))/Math.LN10),So=Math.pow(10,or),To=Math.round(C.lng*So)/So,Ro=Math.round(C.lat*So)/So,Uo=this._viewer.map.getBearing(),Oo=this._viewer.map.getPitch();let Ho="".concat(Rn,"/").concat(Ro,"/").concat(To);return(Uo||Oo)&&(Ho+="/".concat(Math.round(10*Uo)/10)),Oo&&(Ho+="/".concat(Math.round(Oo))),Ho}_getXyzHashString(){const C=this._viewer.psv.getXYZ(),Rn=C.x.toFixed(2),or=C.y.toFixed(2),So=Math.round(C.z||0);return"".concat(Rn,"/").concat(or,"/").concat(So)}_onHashChange(){const C=this._getCurrentHash();if(C.pic){const Rn=C.pic.split(";");Rn.length>1&&console.warn("Multiple picture IDs passed in URL, only first one kept"),this._viewer.select(null,Rn[0])}if(C.focus&&["map","pic"].includes(C.focus)&&this._viewer.setFocus(C.focus),C.focus&&"meta"==C.focus&&this._viewer._widgets._showPictureMetadataPopup(),void 0!==C.speed&&this._viewer.psv.setTransitionDuration(C.speed),C.map&&this._viewer.map){const Rn=this.getMapOptionsFromHashString(C.map);Rn&&this._viewer.map.jumpTo(Rn);let or=(C.users||"").split(",");(0===or.length||1===or.length&&""===or[0].trim())&&(or=["geovisio"]),this._viewer.map.setVisibleUsers(or)}if(C.xyz){const Rn=this.getXyzOptionsFromHashString(C.xyz);this._viewer.psv.setXYZ(Rn.x,Rn.y,Rn.z)}this._viewer.setFilters(this.getMapFiltersFromHashVals(C)),["aerial","streets"].includes(C.background)&&this._viewer.map.setBackground(C.background),["pic","any","seq"].includes(C.nav)&&this._viewer.setPicturesNavigation(C.nav)}getMapFiltersFromHashVals(C){const Rn={};for(let or in To)C[or]&&(Rn[To[or]]=C[or]);return Rn}getMapOptionsFromHashString(C){const Rn=C.split("/");if(Rn.length>=3&&!Rn.some((C=>isNaN(C)))){const C={center:[+Rn[2],+Rn[1]],zoom:+Rn[0],pitch:+(Rn[4]||0)};return this._viewer.map&&(C.bearing=this._viewer.map.dragRotate.isEnabled()&&this._viewer.map.touchZoomRotate.isEnabled()?+(Rn[3]||0):this._viewer.map.getBearing()),C}return null}getXyzOptionsFromHashString(C){const Rn=C.split("/");if(3!==Rn.length||Rn.some((C=>isNaN(C))))return null;return{x:+Rn[0],y:+Rn[1],z:+Rn[2]}}_updateHash(){this._delay&&(clearTimeout(this._delay),this._delay=null),this._delay=setTimeout((()=>{var C,Rn,or;const So=new URL(window.location.href),To=new URL(window.location.href);if(To.hash=this._viewer?this.getHashString():"",So.hash==To.hash)return;const Ro=this._getCurrentHash().pic||"",Uo=(null===(C=this._viewer)||void 0===C||null===(Rn=C.psv)||void 0===Rn||null===(or=Rn.getPictureMetadata())||void 0===or?void 0:or.id)||"";try{if(Ro!=Uo?window.history.pushState(window.history.state,null,To.href):window.history.replaceState(window.history.state,null,To.href),this._viewer){const C=new CustomEvent("url-changed",{detail:{url:To.href}});this.dispatchEvent(C)}}catch(Oo){}}),500)}}},9705:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Widgets});or(8193);var So=or(1707),To=or(4824),Ro=or(7457),Uo=or(1679),Oo=or(5608),Ho=or(4133),qo=or(7832),dl=or(8139),ml=or(4229),fl=or(5974),vl=or(8818),bl=or(3911),kl=or(8402),Ll=or(4422),Dl=or(4038),Nc=or(1788),jc=or(4056),Zc=or(5218),eu=or(2482),Ku=or(5163),Yu=or(4873),Eh=or(779),Th=or(625),Ch=or(6666),Lh=or(953),Dh=or(1445),Rh=or(8117),Nh=or(5088),Uh=or(4480),Bh=or(1658),Fh=or(4470),Oh=or(3650),Vh=or(2155),jh=or(3299),Gh=or(939),Hh=or(3701),Zh=or(5476),Wh=or(6580),qh=or(847),Kh=or(6087),Qh=or(8381),Xh=or(7711),Yh=or(3630),Jh=or(4411),$h=or(421);class Widgets{constructor(C){var Rn;let or=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null==or&&(or={}),null==or.editIdUrl&&(or.editIdUrl="https://www.openstreetmap.org/edit"),this._viewer=C,this._t=this._viewer._t,this._options=or;const So=void 0!==this._viewer.map;this._corners={};const Uo=So?["main","mini"]:["main"],Oo=["top","bottom"],Ho=["left","middle","right"];for(let To of Uo)for(let C of Oo){const Rn=document.createElement("div");Rn.id="gvs-corner-".concat(To,"-").concat(C),Rn.classList.add("gvs-corner-space");for(let or of Ho){const So=document.createElement("div");So.id="".concat(Rn.id,"-").concat(or),So.classList.add("gvs-corner"),this._corners["".concat(To,"-").concat(C,"-").concat(or)]=So,Rn.appendChild(So)}"main"==To?this._viewer.mainContainer.appendChild(Rn):"mini"==To&&this._viewer.miniContainer.appendChild(Rn)}if((0,Ro.zd)()||this._initWidgetPlayer(So),this._initWidgetLegend(So,null===(Rn=or)||void 0===Rn?void 0:Rn.mapAttribution),So&&(this._initWidgetMiniActions(),(0,Ro.zd)()||(this._initWidgetSearch(),this._initWidgetFilters(null!==this._viewer._api._endpoints.user_search&&null!==this._viewer._api._endpoints.user_tiles),this._initWidgetMapLayers(),this._listenMapFiltersChanges())),this._viewer.isWidthSmall()||this._initWidgetShare(),or.customWidget){const C=this._corners["main-bottom-right"];switch(typeof or.customWidget){case"string":for(let Rn of(new DOMParser).parseFromString(or.customWidget,"text/html").body.children)C.appendChild(Rn);break;case"object":Array.isArray(or.customWidget)?or.customWidget.forEach((Rn=>C.appendChild(Rn))):C.appendChild(or.customWidget)}}this._initWidgetZoom(So),this._viewer.container.addEventListener("click",(C=>(0,To.VQ)(C.target,this._viewer.container)))}destroy(){Object.values(this._corners).forEach((C=>C.remove())),delete this._corners,delete this._t,delete this._viewer}_initWidgetZoom(C){this._lastWantedZoom=this._viewer.psv.getZoomLevel();const Rn=(0,To.ax)("gvs-zoom-in",(0,To.fa)(ml.r8),this._t.gvs.zoomIn),or=(0,To.ax)("gvs-zoom-out",(0,To.fa)(fl.Kl),this._t.gvs.zoomOut);(0,To.sS)("gvs-widget-zoom","main-bottom-right",this,[Rn,or],["gvs-group-vertical","gvs-mobile-hidden","gvs-print-hidden"]);const zoomFct=(Rn,or)=>{if(C&&this._viewer.isMapWide())or?this._viewer.map.zoomIn({},{originalEvent:Rn}):this._viewer.map.zoomOut({},{originalEvent:Rn});else{this._viewer.lastPsvAnim&&this._viewer.lastPsvAnim.cancel();const C=or?Math.min(100,this._lastWantedZoom+So.ns):Math.max(0,this._lastWantedZoom-So.ns);this._viewer.lastPsvAnim=this._viewer.psv.animate({speed:So.O_,zoom:C}),this._lastWantedZoom=C}};Rn.addEventListener("click",(C=>zoomFct(C,!0))),or.addEventListener("click",(C=>zoomFct(C,!1)))}_initWidgetPlayer(C){const Rn=(0,To.ax)("gvs-player-prev",(0,To.fa)(jc.DY),this._t.gvs.sequence_prev),or=(0,To.ax)("gvs-player-play"),Ro=(0,To.ax)("gvs-player-next",(0,To.fa)(Zc.ir),this._t.gvs.sequence_next),Uo=(0,To.ax)("gvs-player-more",(0,To.fa)(Dh.Uw),this._t.gvs.sequence_more,["gvs-xs-hidden"]),Oo=(0,To.wf)(this,Uo,[],["gvs-player-options"]);Oo.innerHTML='\n\t\t\t<div class="gvs-input-range" title="'.concat(this._t.gvs.sequence_speed,'">\n\t\t\t\t').concat((0,To.Nk)(Bh.uY),'\n\t\t\t\t<input\n\t\t\t\t\tid="gvs-player-speed"\n\t\t\t\t\ttype="range" name="speed"\n\t\t\t\t\tmin="0" max="').concat(So.q7-100,'"\n\t\t\t\t\tvalue="').concat(So.q7-this._viewer.psv.getTransitionDuration(),'"\n\t\t\t\t\ttitle="').concat(this._t.gvs.sequence_speed,'"\n\t\t\t\t\tstyle="width: 100%;" />\n\t\t\t\t').concat((0,To.Nk)(Rh.tM),'\n\t\t\t</div>\n\t\t\t<button title="').concat(this._t.gvs.contrast,'" id="gvs-player-contrast">\n\t\t\t\t').concat((0,To.Nk)(Uh.X8),"\n\t\t\t</button>\n\t\t");const Ho=(0,To.sS)("gvs-widget-player",C?"main-top-middle":"main-top-left",this,[Rn,or,Ro].concat(this._viewer.isWidthSmall()?[]:[Oo,Uo]),["gvs-group-horizontal","gvs-only-psv","gvs-print-hidden",this._viewer.psv.getPictureMetadata()?"":"gvs-hidden"]),toggleBtnPlay=C=>{or.innerHTML=C?(0,To.Nk)(eu.XQ):(0,To.Nk)(Nc.zc),or.title=C?this._t.gvs.sequence_pause:this._t.gvs.sequence_play};toggleBtnPlay(!1);const updatePlayBtn=()=>{var C,So,Uo,Oo;"pic"===this._viewer.getPicturesNavigation()?((0,To.Qr)(Ro),(0,To.Qr)(or),(0,To.Qr)(Rn)):(null!=(null===(C=this._viewer.psv.getPictureMetadata())||void 0===C||null===(So=C.sequence)||void 0===So?void 0:So.prevPic)?(0,To.Mr)(Rn):(0,To.Qr)(Rn),null!=(null===(Uo=this._viewer.psv.getPictureMetadata())||void 0===Uo||null===(Oo=Uo.sequence)||void 0===Oo?void 0:Oo.nextPic)?((0,To.Mr)(Ro),(0,To.Mr)(or)):((0,To.Qr)(Ro),(0,To.Qr)(or)))};if(updatePlayBtn(),this._viewer.addEventListener("sequence-playing",(()=>toggleBtnPlay(!0))),this._viewer.addEventListener("sequence-stopped",(()=>toggleBtnPlay(!1))),this._viewer.addEventListener("psv:picture-loaded",(()=>Ho.classList.remove("gvs-hidden")),{once:!0}),this._viewer.addEventListener("psv:picture-loaded",updatePlayBtn),this._viewer.addEventListener("pictures-navigation-changed",updatePlayBtn),!this._viewer.isWidthSmall()){const C=Oo.children[0].children[1];this._viewer.addEventListener("psv:transition-duration-changed",(Rn=>{C.value=So.q7-Rn.detail.value})),C.addEventListener("change",(C=>{const Rn=So.q7-C.target.value;this._viewer.psv.setTransitionDuration(Rn)}))}Rn.addEventListener("click",(()=>this._viewer.psv.goToPrevPicture())),Ro.addEventListener("click",(()=>this._viewer.psv.goToNextPicture())),or.addEventListener("click",(()=>{this._viewer.isSequencePlaying()?(toggleBtnPlay(!1),this._viewer.stopSequence()):(toggleBtnPlay(!0),this._viewer.playSequence())}));const qo=document.getElementById("gvs-player-contrast");qo&&qo.addEventListener("click",(()=>{qo.classList.contains("gvs-btn-active")?(qo.classList.remove("gvs-btn-active"),this._viewer.psv.setHigherContrast(!1)):(qo.classList.add("gvs-btn-active"),this._viewer.psv.setHigherContrast(!0))}))}_initWidgetLegend(C,Rn){const or=(0,To.sS)("gvs-widget-legend",C?"main-bottom-right":"main-bottom-left",this,[],["gvs-widget-bg"]);let So,Uo,Oo;C&&(So=(0,To.sS)("gvs-widget-mini-legend","mini-bottom-right",this,[],["gvs-widget-bg","gvs-only-mini","gvs-mobile-hidden"])),this._viewer.isWidthSmall()&&(Uo=document.createElement("button"),Uo.id="gvs-legend-toggle",Uo.classList.add("gvs-btn","gvs-widget-bg","gvs-print-hidden"),Uo.appendChild((0,To.fa)(Gh.DB)),Oo=()=>{"hidden"===or.style.visibility?(or.style.visibility="visible",toggleLegend(!!C&&this._viewer.isMapWide())):(or.innerHTML="",or.style.visibility="hidden",or.appendChild(Uo))},Uo.addEventListener("click",(C=>{C.stopPropagation(),Oo()})));const toggleLegend=Oo=>{var Ho,qo,dl;let ml=Rn||(null===(Ho=this._viewer.map)||void 0===Ho||null===(qo=Ho._attribution)||void 0===qo?void 0:qo._attribHTML)||"",fl="<a href='https://panoramax.fr/' target='_blank'>Panoramax</a>";const vl=null===(dl=this._viewer.psv.getPictureMetadata())||void 0===dl?void 0:dl.caption;let bl;!(0,Ro.zd)()&&vl&&(fl="",vl.producer&&(fl+='<span style="font-weight: bold">© '.concat(vl.producer,"</span>")),vl.date&&(vl.producer&&(fl+=" - "),fl+=vl.date.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})),bl=(0,To.fa)(Xh.FD),bl.style.marginLeft="5px"),or.title="",Oo?(or.innerHTML=ml,(0,Ro.zd)()&&(or.innerHTML="<a href='https://panoramax.fr/' target='_blank'>Panoramax</a><br />"+or.innerHTML),or.style.cursor=null,or.onclick=null,So.innerHTML=fl):(or.innerHTML=fl,bl?(or.appendChild(bl),or.style.cursor="pointer",or.title=this._t.gvs.legend_title,or.onclick=(0,Ro.zd)()?()=>window.open(window.location.href,"_blank"):this._showPictureMetadataPopup.bind(this)):(or.style.cursor=null,or.onclick=null),C&&(So.innerHTML=ml)),Uo&&or.appendChild(Uo)};Uo?(or.appendChild(Uo),or.style.visibility="hidden"):toggleLegend(!!C&&this._viewer.isMapWide()),this._viewer.addEventListener("focus-changed",(C=>toggleLegend("map"==C.detail.focus))),this._viewer.addEventListener("psv:picture-loaded",(()=>toggleLegend(C&&this._viewer.isMapWide())))}_showPictureMetadataPopup(){var C,Rn,or,So,Ro,Uo,Oo,Ho,qo,ml,fl,vl,bl,kl,Ll,Dl,Nc;const jc=this._viewer.psv.getPictureMetadata();if(!jc)throw new Error("No picture currently selected");const Zc=[];if(Zc.push((0,To.dc)("h4","".concat((0,To.Nk)(Gh.DB)," ").concat(this._t.gvs.metadata))),this._viewer._api._endpoints.report){const C=(0,To.C)("".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report));C.firstChild.addEventListener("click",this._showReportForm.bind(this)),Zc.push(C)}const eu=[{section:this._t.gvs.metadata_general_picid,classes:["gvs-td-with-id"],values:(0,To.gJ)(jc.id,this._viewer._api.getPictureMetadataUrl(jc.id,null===jc||void 0===jc||null===(C=jc.sequence)||void 0===C?void 0:C.id),this._t.gvs.metadata_general_picid_link,this._t.gvs.copy)},{section:this._t.gvs.metadata_general_seqid,classes:["gvs-td-with-id"],values:(0,To.gJ)(null===jc||void 0===jc||null===(Rn=jc.sequence)||void 0===Rn?void 0:Rn.id,this._viewer._api.getSequenceMetadataUrl(null===jc||void 0===jc||null===(or=jc.sequence)||void 0===or?void 0:or.id),this._t.gvs.metadata_general_seqid_link,this._t.gvs.copy)},{section:this._t.gvs.metadata_general_author,value:null===jc||void 0===jc||null===(So=jc.caption)||void 0===So?void 0:So.producer},{section:this._t.gvs.metadata_general_license,value:null===jc||void 0===jc||null===(Ro=jc.caption)||void 0===Ro?void 0:Ro.license},{section:this._t.gvs.metadata_general_date,value:null===jc||void 0===jc||null===(Uo=jc.caption)||void 0===Uo||null===(Oo=Uo.date)||void 0===Oo?void 0:Oo.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZoneName:"short"})}];Zc.push((0,To.W_)("gvs-table-light",eu)),Zc.push((0,To.dc)("h4","".concat((0,To.Nk)(Eh._j)," ").concat(this._t.gvs.metadata_camera)));const Ku=null!==jc&&void 0!==jc&&null!==(Ho=jc.properties)&&void 0!==Ho&&null!==(qo=Ho["pers:interior_orientation"])&&void 0!==qo&&qo.focal_length?"".concat(null===jc||void 0===jc||null===(ml=jc.properties)||void 0===ml||null===(fl=ml["pers:interior_orientation"])||void 0===fl?void 0:fl.focal_length," mm"):"unknown",Yu=[{section:this._t.gvs.metadata_camera_make,value:null===jc||void 0===jc||null===(vl=jc.properties)||void 0===vl||null===(bl=vl["pers:interior_orientation"])||void 0===bl?void 0:bl.camera_manufacturer},{section:this._t.gvs.metadata_camera_model,value:null===jc||void 0===jc||null===(kl=jc.properties)||void 0===kl||null===(Ll=kl["pers:interior_orientation"])||void 0===Ll?void 0:Ll.camera_model},{section:this._t.gvs.metadata_camera_type,value:360===(null===jc||void 0===jc?void 0:jc.horizontalFov)?this._t.gvs.picture_360:this._t.gvs.picture_flat},{section:this._t.gvs.metadata_camera_focal_length,value:Ku}];Zc.push((0,To.W_)("gvs-table-light",Yu)),Zc.push((0,To.dc)("h4","".concat((0,To.Nk)(Zh.op)," ").concat(this._t.gvs.metadata_location)));const Th=void 0!==(null===jc||void 0===jc||null===(Dl=jc.properties)||void 0===Dl?void 0:Dl["view:azimuth"])?"".concat(jc.properties["view:azimuth"],"\xb0"):"unknown",Ch=(0,dl.j$)(jc),Lh=[{section:this._t.gvs.metadata_location_longitude,value:jc.gps[0]},{section:this._t.gvs.metadata_location_latitude,value:jc.gps[1]},{section:this._t.gvs.metadata_location_orientation,value:Th},{section:this._t.gvs.metadata_location_precision,value:Ch}];if(Zc.push((0,To.W_)("gvs-table-light",Lh)),null!==(Nc=jc.properties)&&void 0!==Nc&&Nc.exif){const C=document.createElement("details");C.appendChild((0,To.dc)("summary","".concat((0,To.Nk)(Hh.gr)," ").concat(this._t.gvs.metadata_exif)));const Rn=Object.entries(jc.properties.exif).sort().map((C=>{let[Rn,or]=C;return{section:Rn,value:or}}));C.appendChild((0,To.W_)("",Rn)),Zc.push(C)}this._viewer.setPopup(!0,Zc),this._viewer.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}_showReportForm(){const C=this._viewer.psv.getPictureMetadata();if(!C)throw new Error("No picture currently selected");const Rn=[];Rn.push((0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)));const or=(0,Ro.iE)();if(or){const C=document.createElement("p");C.appendChild(document.createTextNode(this._t.gvs.report_auth.replace("{a}",or.name))),Rn.push(C)}const So=document.createElement("form");Rn.push(So);const Uo=document.createElement("div");Uo.classList.add("gvs-input-group");const Oo=(0,To._)("gvs-report-issue",this._t.gvs.report_nature_label,Gh.DB),Ho=document.createElement("select");Ho.name="gvs-report-issue",Ho.required=!0;["","blur_missing","blur_excess","inappropriate","privacy","picture_low_quality","mislocated","copyright","other"].forEach((C=>{const Rn=document.createElement("option");Rn.value=C,Rn.textContent=this._t.gvs.report_nature[C],""===C&&(Rn.setAttribute("disabled",""),Rn.setAttribute("selected",""),Rn.setAttribute("hidden","")),Ho.appendChild(Rn)})),Uo.appendChild(Oo),Uo.appendChild(Ho),So.appendChild(Uo);const qo=document.createElement("div");qo.classList.add("gvs-input-group","gvs-input-group-inline");const dl=document.createElement("input");dl.id="gvs-report-whole-sequence",dl.name="gvs-report-whole-sequence",dl.type="checkbox";const ml=(0,To._)("gvs-report-whole-sequence",this._t.gvs.report_whole_sequence);qo.appendChild(dl),qo.appendChild(ml),So.appendChild(qo);const fl=document.createElement("div");fl.classList.add("gvs-input-group");const vl=(0,To._)("gvs-report-details",this._t.gvs.report_details,Yh.Z6),bl=document.createElement("textarea");let kl;if(bl.name="gvs-report-details",bl.placeholder=this._t.gvs.report_details_placeholder,fl.appendChild(vl),fl.appendChild(bl),So.appendChild(fl),!or){const C=document.createElement("div");C.classList.add("gvs-input-group");const Rn=(0,To._)("email",this._t.gvs.report_email,Jh.IB);kl=document.createElement("input"),kl.type="email",kl.name="email",kl.placeholder=this._t.gvs.report_email_placeholder,C.appendChild(Rn),C.appendChild(kl),So.appendChild(C)}const Ll=document.createElement("div");Ll.classList.add("gvs-input-btn");const Dl=document.createElement("button");Dl.type="submit",Dl.appendChild((0,To.fa)($h.XC)),Dl.appendChild(document.createTextNode(this._t.gvs.report_submit)),Ll.appendChild(Dl),So.appendChild(Ll),So.addEventListener("submit",(Rn=>{var or;Rn.preventDefault();const So={issue:Ho.value,picture_id:dl.checked?null:C.id,reporter_comments:bl.value,reporter_email:null===(or=kl)||void 0===or?void 0:or.value,sequence_id:C.sequence.id};this._viewer.setPopup(!0,[(0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)),document.createTextNode(this._t.gvs.report_wait)]),this._viewer._api.sendReport(So).then((()=>{this._viewer.setPopup(!0,[(0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)),document.createTextNode(this._t.gvs.report_success)])})).catch((C=>{console.error(C),this._viewer.setPopup(!0,[(0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)),document.createTextNode(this._t.gvs.report_failure.replace("{e}",C))])}))})),this._viewer.setPopup(!0,Rn),this._viewer.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}_initWidgetMiniActions(){const C=document.createElement("img");C.src=Uo;const Rn=document.createElement("span");Rn.classList.add("gvs-mobile-hidden"),Rn.appendChild(document.createTextNode(this._t.gvs.expand));const or=(0,To.ax)("gvs-mini-expand",Rn,this._t.gvs.expand_info,["gvs-only-mini","gvs-print-hidden"]);or.appendChild(C),this._corners["mini-top-right"].appendChild(or),or.addEventListener("click",(()=>{this._viewer.setFocus(this._viewer.isMapWide()?"pic":"map")}));const So=document.createElement("img");So.src=Oo;const Ho=(0,To.ax)("gvs-mini-hide",So,this._t.gvs.minimize,["gvs-only-mini","gvs-print-hidden"]);this._corners["mini-bottom-left"].appendChild(Ho),Ho.addEventListener("click",(()=>{this._viewer.setUnfocusedVisible(!1)}));const qo=(0,To.ax)("gvs-mini-show",null,null,["gvs-btn-large","gvs-only-mini-hidden","gvs-print-hidden"]);this._corners["main-bottom-left"].appendChild(qo),qo.addEventListener("click",(()=>{(0,Ro.zd)()?this._viewer.setFocus(this._viewer.isMapWide()?"pic":"map"):this._viewer.setUnfocusedVisible(!0)}));const miniBtnRendering=()=>{this._viewer.map&&this._viewer.isMapWide()?(qo.title=this._t.gvs.show_psv,qo.innerHTML=(0,To.Nk)(Dl.UH)):(qo.title=this._t.gvs.show_map,qo.innerHTML=(0,To.Nk)(kl.Wx))};miniBtnRendering(),this._viewer.addEventListener("focus-changed",miniBtnRendering)}_initWidgetSearch(){const C=(0,To.Fl)("gvs-widget-search-bar",this._t.gvs.search_address,(C=>{const Rn=C.match(/([-+]?\d{1,2}\.\d+),\s*([-+]?\d{1,3}\.\d+)/);if(Rn){const C=parseFloat(Rn[1]),or=parseFloat(Rn[2]);return this._viewer.map.flyTo({center:[or,C],zoom:16}),Promise.resolve(!0)}return this._viewer.map.geocoder({query:C,limit:3,bbox:this._viewer.map.getBounds().toArray().map((C=>C.join(","))).join(","),proximity:this._viewer.map.getCenter().lat+","+this._viewer.map.getCenter().lng}).then((C=>C=C.features.map((C=>({title:C.place_name.split(",")[0],subtitle:C.place_name.split(",").slice(1).join(", "),data:C})))))}),(C=>{C&&(C.data.bounds?this._viewer.map.fitBounds(C.data.bounds):this._viewer.map.flyTo({center:C.data.center,zoom:C.data.zoom||13}))}),this,void 0,this._viewer.isWidthSmall(),this._viewer.map._geolocate);(0,To.sS)("gvs-widget-search",this._viewer.isWidthSmall()?"main-top-right":"main-top-left",this,[C],["gvs-only-map","gvs-print-hidden"])}_initWidgetMapLayers(){const C=(0,To.WD)("gvs-map-layers",Oh.Kr,this._t.gvs.layers,this),Rn=(0,To.wf)(this,C,[]);(0,To.sS)("gvs-widget-map-layers","main-top-right",this,[C,Rn],["gvs-group-large","gvs-group-btnpanel","gvs-only-map","gvs-print-hidden"]),this._viewer.map.hasTwoBackgrounds()&&(Rn.innerHTML="\n\t\t\t\t<h4>".concat((0,To.Nk)(Vh.ye)," ").concat(this._t.gvs.map_background,'</h4>\n\t\t\t\t<div id="gvs-map-bg" class="gvs-input-group">\n\t\t\t\t\t<input type="radio" id="gvs-map-bg-streets" name="gvs-map-bg" value="streets" />\n\t\t\t\t\t<label for="gvs-map-bg-streets">\n\t\t\t\t\t\t<img id="gvs-map-bg-streets-img" />\n\t\t\t\t\t\t').concat(this._t.gvs.map_background_streets,'\n\t\t\t\t\t</label>\n\t\t\t\t\t<input type="radio" id="gvs-map-bg-aerial" name="gvs-map-bg" value="aerial" />\n\t\t\t\t\t<label for="gvs-map-bg-aerial">\n\t\t\t\t\t\t<img id="gvs-map-bg-aerial-img" />\n\t\t\t\t\t\t').concat(this._t.gvs.map_background_aerial,"\n\t\t\t\t\t</label>\n\t\t\t\t</div>")),Rn.innerHTML+="\n\t\t\t<h4>".concat((0,To.Nk)(Nh.q2)," ").concat(this._t.gvs.map_theme,'</h4>\n\t\t\t<div class="gvs-input-group">\n\t\t\t\t<select id="gvs-map-theme" style="width: 100%;">\n\t\t\t\t\t<option value="default">').concat(this._t.gvs.map_theme_default,'</option>\n\t\t\t\t\t<option value="age">').concat(this._t.gvs.map_theme_age,'</option>\n\t\t\t\t\t<option value="type">').concat(this._t.gvs.map_theme_type,'</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<div id="gvs-map-theme-legend-age" class="gvs-map-theme-legend gvs-hidden">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_4,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_4,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_3,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_3,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_2,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_2,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_1,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_1,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div id="gvs-map-theme-legend-type" class="gvs-map-theme-legend gvs-hidden">\n\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.QUALI_1,'"></span>\n\t\t\t\t\t\t').concat(this._t.gvs.picture_360,'\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.QUALI_2,'"></span>\n\t\t\t\t\t\t').concat(this._t.gvs.picture_flat,"\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>");const or=Rn.querySelector("#gvs-map-theme"),onChange=()=>{this._onMapThemeChange(),this._onMapFiltersChange()};if(or.addEventListener("change",onChange),or.addEventListener("keypress",onChange),or.addEventListener("paste",onChange),or.addEventListener("input",onChange),this._viewer.map.hasTwoBackgrounds()){Rn.querySelector("#gvs-map-bg-aerial-img").src=Ho;Rn.querySelector("#gvs-map-bg-streets-img").src=qo;const C=Rn.querySelector("#gvs-map-bg-aerial"),or=Rn.querySelector("#gvs-map-bg-streets"),onBgChange=C=>{this._viewer.map.setBackground(C.target.value)};C.addEventListener("change",onBgChange),or.addEventListener("change",onBgChange),this._viewer.addEventListener("map:background-changed",(C=>this._onMapBackgroundChange(C.detail.background))),this._onMapBackgroundChange(this._viewer.map.getBackground())}}_onMapBackgroundChange(C){const Rn=document.getElementById("gvs-map-bg-aerial"),or=document.getElementById("gvs-map-bg-streets");"aerial"===C?Rn.checked=!0:or.checked=!0}_onMapThemeChange(){const C=document.getElementById("gvs-map-theme").value;for(let Rn of document.getElementsByClassName("gvs-map-theme-legend"))Rn.id=="gvs-map-theme-legend-"+C?Rn.classList.remove("gvs-hidden"):Rn.classList.add("gvs-hidden")}_initWidgetFilters(C){const Rn=(0,To.WD)("gvs-filter",Fh.cR,this._t.gvs.filters,this),or=(0,To.wf)(this,Rn,[]);if(or.innerHTML='\n\t\t\t<form id="gvs-filter-form">\n\t\t\t\t<div id="gvs-filter-zoomin">'.concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.filter_zoom_in,"</div>\n\t\t\t\t<h4>").concat((0,To.Nk)(Ku.fT)," ").concat(this._t.gvs.filter_date,'</h4>\n\t\t\t\t<div class="gvs-input-group">\n\t\t\t\t\t<input type="date" id="gvs-filter-date-from" />\n\t\t\t\t\t').concat((0,To.Nk)(Yu.eF),'\n\t\t\t\t\t<input type="date" id="gvs-filter-date-end" />\n\t\t\t\t</div>\n\t\t\t\t<h4>').concat((0,To.Nk)(Ll.Vm)," ").concat(this._t.gvs.filter_picture,'</h4>\n\t\t\t\t<div class="gvs-input-group" style="justify-content: center;">\n\t\t\t\t\t<input type="checkbox" id="gvs-filter-type-flat" name="flat" checked />\n\t\t\t\t\t<label for="gvs-filter-type-flat" style="margin-right: 20px">').concat(this._t.gvs.picture_flat,'</label>\n\t\t\t\t\t<input type="checkbox" id="gvs-filter-type-360" name="360" checked />\n\t\t\t\t\t<label for="gvs-filter-type-360">').concat(this._t.gvs.picture_360,"</label>\n\t\t\t\t</div>\n\t\t\t\t\x3c!--h4>").concat((0,To.Nk)(Eh._j)," ").concat(this._t.gvs.filter_camera_model,'</h4>\n\t\t\t\t<div class="gvs-input-group" id="gvs-filter-model"></div--\x3e\n\t\t\t</form>\n\t\t'),(0,To.sS)("gvs-widget-filter",this._viewer.isWidthSmall()?"main-top-right":"main-top-left",this,[Rn,or],["gvs-group-large","gvs-group-btnpanel","gvs-only-map","gvs-print-hidden"]),this._viewer.isWidthSmall()&&(or.style.width="".concat(this._viewer.container.offsetWidth-70,"px")),C){const C=or.querySelector("#gvs-filter-form"),Rn=document.createElement("h4");Rn.innerHTML="".concat((0,To.Nk)(jh.IL)," ").concat(this._t.gvs.filter_user),C.appendChild(Rn);const So=document.createElement("div");So.id="gvs-filter-user",So.classList.add("gvs-input-group");const Ro=(0,To.Fl)("gvs-filter-search-user",this._t.gvs.search_user,(C=>this._viewer._api.searchUsers(C).then((C=>(C||[]).map((C=>({title:C.label,data:C})))))),(C=>this._viewer.map.setVisibleUsers(C?[C.data.id]:["geovisio"])),this,!0);So.appendChild(Ro),C.appendChild(So)}const So=or.children[0];this._formDelay=null;const onFormChange=()=>{this._formDelay&&clearTimeout(this._formDelay),this._formDelay=setTimeout((()=>{this._onMapFiltersChange()}),250)};So.addEventListener("change",onFormChange),So.addEventListener("reset",onFormChange),So.addEventListener("submit",(C=>(onFormChange(),C.preventDefault(),!1)),!0);for(let To of So.getElementsByTagName("input"))To.addEventListener("change",onFormChange),To.addEventListener("keypress",onFormChange),To.addEventListener("paste",onFormChange),To.addEventListener("input",onFormChange)}_onMapFiltersChange(){const C=document.getElementById("gvs-filter-date-from"),Rn=document.getElementById("gvs-filter-date-end"),or=document.getElementById("gvs-filter-type-flat"),So=document.getElementById("gvs-filter-type-360"),To=document.getElementById("gvs-map-theme");let Ro="";So.checked&&!or.checked&&(Ro="equirectangular"),!So.checked&&or.checked&&(Ro="flat");const Uo={minDate:C.value,maxDate:Rn.value,type:Ro,theme:To.value};this._viewer.setFilters(Uo)}_listenMapFiltersChanges(){const C=document.getElementById("gvs-filter-date-from"),Rn=document.getElementById("gvs-filter-date-end"),or=document.getElementById("gvs-filter-type-flat"),So=document.getElementById("gvs-filter-type-360"),To=document.getElementById("gvs-map-theme");this._viewer.addEventListener("filters-changed",(Ro=>{Ro.detail.minDate&&(C.value=Ro.detail.minDate),Ro.detail.maxDate&&(Rn.value=Ro.detail.maxDate),Ro.detail.theme&&(To.value=Ro.detail.theme),Ro.detail.type&&(So.checked=["","equirectangular"].includes(Ro.detail.type),or.checked=["","flat"].includes(Ro.detail.type)),this._onMapThemeChange()}));const Ro=document.getElementById("gvs-filter-zoomin"),changeLblZoomInDisplay=()=>{this._viewer.map.getZoom()<7?Ro.style.display=null:Ro.style.display="none"};changeLblZoomInDisplay(),this._viewer.map.on("zoomend",changeLblZoomInDisplay)}_initWidgetShare(){var C,Rn;const or=(0,To.ax)("gvs-share",(0,To.fa)(vl.M6),this._t.gvs.share,["gvs-btn-large"]),So=(0,To.wf)(this,or,[]);So.innerHTML='\n\t\t\t<div class="gvs-hidden">\n\t\t\t\t<p id="gvs-share-license" style="margin: 0 0 10px 0;"></p>\n\t\t\t</div>\n\t\t\t<h4 style="margin-top: 0">'.concat((0,To.Nk)(bl.nN)," ").concat(this._t.gvs.share_links,'</h4>\n\t\t\t<div id="gvs-share-links" class="gvs-input-btn">\n\t\t\t\t<a id="gvs-share-image" class="gvs-link-btn gvs-hidden" download target="_blank">').concat((0,To.Nk)(qh.zo)," ").concat(this._t.gvs.share_image,'</a>\n\t\t\t\t<button id="gvs-share-url" data-copy="true" style="flex-basis: 100%; flex-grow: 2; flex-shrink: 2;">').concat((0,To.Nk)(Kh.kZ)," ").concat(this._t.gvs.share_page,'</button>\n\t\t\t\t<button id="gvs-share-print" style="flex-basis: 100%; flex-grow: 2; flex-shrink: 2;">').concat((0,To.Nk)(Ch.wf)," ").concat(this._t.gvs.share_print,"</button>\n\t\t\t</div>\n\t\t\t<h4>\n\t\t\t\t").concat((0,To.Nk)(kl.Wx)," ").concat(this._t.gvs.share_embed,'\n\t\t\t\t<a href="https://docs.panoramax.fr/web-viewer/03_URL_settings/"\n\t\t\t\t\ttitle="').concat(this._t.gvs.share_embed_docs,'"\n\t\t\t\t\ttarget="_blank"\n\t\t\t\t\tstyle="vertical-align: middle">\n\t\t\t\t\t').concat((0,To.Nk)(Gh.DB),'\n\t\t\t\t</a>\n\t\t\t</h4>\n\t\t\t<div class="gvs-input-btn">\n\t\t\t\t<textarea id="gvs-share-iframe" readonly></textarea>\n\t\t\t\t<button data-input="gvs-share-iframe">').concat((0,To.Nk)(Kh.kZ)," ").concat(this._t.gvs.copy,'</button>\n\t\t\t</div>\n\t\t\t<h4 class="gvs-hidden">').concat((0,To.Nk)(Th.Iw)," ").concat(this._t.gvs.edit_osm,'</h4>\n\t\t\t<div class="gvs-input-btn gvs-hidden" style="justify-content: center">\n\t\t\t\t<a id="gvs-edit-id" class="gvs-link-btn" target="_blank">').concat((0,To.Nk)(Zh.op)," ").concat(this._t.gvs.id,'</a>\n\t\t\t\t<button id="gvs-edit-josm" title="').concat(this._t.gvs.josm_live,'">').concat((0,To.Nk)(Lh.QN)," ").concat(this._t.gvs.josm,"</button>\n\t\t\t</div>\n\t\t"),(0,To.sS)("gvs-widget-share","main-bottom-right",this,[or,So],["gvs-group-large","gvs-group-btnpanel","gvs-mobile-hidden","gvs-print-hidden"]);const Ro=document.getElementById("gvs-share-links"),Uo=document.getElementById("gvs-share-image"),Oo=document.getElementById("gvs-share-url");if(this._viewer._api.getRSSURL()){const C=document.createElement("a");C.id="gvs-share-rss",C.classList.add("gvs-link-btn"),C.setAttribute("target","_blank"),C.setAttribute("title",this._t.gvs.share_rss_title),C.appendChild((0,To.fa)(Wh.mW)),C.appendChild(document.createTextNode(this._t.gvs.share_rss)),Ro.insertBefore(C,Oo)}this._viewer.addEventListener("psv:picture-loaded",(()=>{var C;const Rn=this._viewer.psv.getPictureMetadata();Uo.href=Rn.panorama.hdUrl;for(document.getElementById("gvs-share-license").innerHTML=null!==Rn&&void 0!==Rn&&null!==(C=Rn.caption)&&void 0!==C&&C.license?this._t.gvs.legend_license.replace("{l}",Rn.caption.license):"";So.getElementsByClassName("gvs-hidden").length>0;){So.getElementsByClassName("gvs-hidden")[0].classList.remove("gvs-hidden")}}));const updateLinks=C=>{var Rn;const or=(null===C||void 0===C||null===(Rn=C.detail)||void 0===Rn?void 0:Rn.url)||window.location.href.replace(/\/$/,""),To=this._options.iframeBaseURL?this._options.iframeBaseURL+window.location.hash:or,Ro=So.querySelector("#gvs-share-url"),Uo=So.querySelector("#gvs-share-iframe"),Oo=So.querySelector("#gvs-edit-id"),Ho=So.querySelector("#gvs-share-rss");Ro.setAttribute("data-copy",or),Uo.innerText='<iframe src="'.concat(To,'" style="border: none; width: 500px; height: 300px"></iframe>');const qo=this._viewer.psv.getPictureMetadata();if(qo){const C={map:"19/".concat(qo.gps[1],"/").concat(qo.gps[0]),source:"Panoramax",photo_overlay:"panoramax",photo:"panoramax/".concat(qo.id)};Oo.setAttribute("href","".concat(this._options.editIdUrl,"#").concat(new URLSearchParams(C).toString()))}var dl,ml;Ho&&Ho.setAttribute("href",this._viewer._api.getRSSURL(null===(dl=this._viewer)||void 0===dl||null===(ml=dl.map)||void 0===ml?void 0:ml.getBounds()))};updateLinks(),null===(C=this._viewer)||void 0===C||null===(Rn=C._hash)||void 0===Rn||Rn.addEventListener("url-changed",updateLinks),(0,To.QO)(So,this._viewer._t);const Ho=So.querySelector("#gvs-edit-josm");Ho.addEventListener("click",(()=>{Ho.classList.contains("gvs-btn-active")?this._viewer.toggleJOSMLive(!1):this._viewer.toggleJOSMLive(!0).catch((C=>{console.warn(C),alert(this._t.gvs.error_josm)}))})),this._viewer.addEventListener("josm-live-enabled",(()=>Ho.classList.add("gvs-btn-active"))),this._viewer.addEventListener("josm-live-disabled",(()=>Ho.classList.remove("gvs-btn-active")));So.querySelector("#gvs-share-print").addEventListener("click",window.print.bind(window))}}},4873:(C,Rn)=>{"use strict";var or="arrow-right",So=[8594],To="f061",Ro="M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.eF=Rn.DF},4411:(C,Rn)=>{"use strict";var or=[61946],So="M256 64C150 64 64 150 64 256s86 192 192 192c17.7 0 32 14.3 32 32s-14.3 32-32 32C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256v32c0 53-43 96-96 96c-29.3 0-55.6-13.2-73.2-33.9C320 371.1 289.5 384 256 384c-70.7 0-128-57.3-128-128s57.3-128 128-128c27.9 0 53.7 8.9 74.7 24.1c5.7-5 13.1-8.1 21.3-8.1c17.7 0 32 14.3 32 32v80 32c0 17.7 14.3 32 32 32s32-14.3 32-32V256c0-106-86-192-192-192zm64 192a64 64 0 1 0 -128 0 64 64 0 1 0 128 0z";Rn.DF={prefix:"fas",iconName:"at",icon:[512,512,or,"40",So]},Rn.IB=Rn.DF},4056:(C,Rn)=>{"use strict";var or="backward",So=[9194],To="f04a",Ro="M459.5 440.6c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4L288 214.3V256v41.7L459.5 440.6zM256 352V256 128 96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4l-192 160C4.2 237.5 0 246.5 0 256s4.2 18.5 11.5 24.6l192 160c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V352z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.DY=Rn.DF},5163:(C,Rn)=>{"use strict";var or="calendar",So=[128197,128198],To="f133",Ro="M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.fT=Rn.DF},779:(C,Rn)=>{"use strict";var or="camera",So=[62258,"camera-alt"],To="f030",Ro="M149.1 64.8L138.7 96H64C28.7 96 0 124.7 0 160V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64H373.3L362.9 64.8C356.4 45.2 338.1 32 317.4 32H194.6c-20.7 0-39 13.2-45.5 32.8zM256 192a96 96 0 1 1 0 192 96 96 0 1 1 0-192z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn._j=Rn.DF},6565:(C,Rn)=>{"use strict";var or="check",So=[10003,10004],To="f00c",Ro="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.LE=Rn.DF},7361:(C,Rn)=>{"use strict";var or="chevron-down",So=[],To="f078",Ro="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.pt=Rn.DF},4671:(C,Rn)=>{"use strict";var or="circle-exclamation",So=["exclamation-circle"],To="f06a",Ro="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.xH=Rn.DF},939:(C,Rn)=>{"use strict";var or="circle-info",So=["info-circle"],To="f05a",Ro="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.DB=Rn.DF},8455:(C,Rn)=>{"use strict";var or="circle-notch",So=[],To="f1ce",Ro="M222.7 32.1c5 16.9-4.6 34.8-21.5 39.8C121.8 95.6 64 169.1 64 256c0 106 86 192 192 192s192-86 192-192c0-86.9-57.8-160.4-137.1-184.1c-16.9-5-26.6-22.9-21.5-39.8s22.9-26.6 39.8-21.5C434.9 42.1 512 140 512 256c0 141.4-114.6 256-256 256S0 397.4 0 256C0 140 77.1 42.1 182.9 10.6c16.9-5 34.8 4.6 39.8 21.5z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.IJ=Rn.DF},7711:(C,Rn)=>{"use strict";var or="circle-question",So=[62108,"question-circle"],To="f059",Ro="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.FD=Rn.DF},847:(C,Rn)=>{"use strict";var or="cloud-arrow-down",So=[62337,"cloud-download","cloud-download-alt"],To="f0ed",Ro="M144 480C64.5 480 0 415.5 0 336c0-62.8 40.2-116.2 96.2-135.9c-.1-2.7-.2-5.4-.2-8.1c0-88.4 71.6-160 160-160c59.3 0 111 32.2 138.7 80.2C409.9 102 428.3 96 448 96c53 0 96 43 96 96c0 12.2-2.3 23.8-6.4 34.6C596 238.4 640 290.1 640 352c0 70.7-57.3 128-128 128H144zm79-167l80 80c9.4 9.4 24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-39 39V184c0-13.3-10.7-24-24-24s-24 10.7-24 24V318.1l-39-39c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.zo=Rn.DF},3630:(C,Rn)=>{"use strict";var or="comment-dots",So=[128172,62075,"commenting"],To="f4ad",Ro="M256 448c141.4 0 256-93.1 256-208S397.4 32 256 32S0 125.1 0 240c0 45.1 17.7 86.8 47.7 120.9c-1.9 24.5-11.4 46.3-21.4 62.9c-5.5 9.2-11.1 16.6-15.2 21.6c-2.1 2.5-3.7 4.4-4.9 5.7c-.6 .6-1 1.1-1.3 1.4l-.3 .3 0 0 0 0 0 0 0 0c-4.6 4.6-5.9 11.4-3.4 17.4c2.5 6 8.3 9.9 14.8 9.9c28.7 0 57.6-8.9 81.6-19.3c22.9-10 42.4-21.9 54.3-30.6c31.8 11.5 67 17.9 104.1 17.9zM128 208a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm128 0a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm96 32a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.Z6=Rn.DF},6087:(C,Rn)=>{"use strict";var or="copy",So=[],To="f0c5",Ro="M272 0H396.1c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9V336c0 26.5-21.5 48-48 48H272c-26.5 0-48-21.5-48-48V48c0-26.5 21.5-48 48-48zM48 128H192v64H64V448H256V416h64v48c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V176c0-26.5 21.5-48 48-48z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.kZ=Rn.DF},2155:(C,Rn)=>{"use strict";var or="earth-europe",So=["globe-europe"],To="f7a2",Ro="M266.3 48.3L232.5 73.6c-5.4 4-8.5 10.4-8.5 17.1v9.1c0 6.8 5.5 12.3 12.3 12.3c2.4 0 4.8-.7 6.8-2.1l41.8-27.9c2-1.3 4.4-2.1 6.8-2.1h1c6.2 0 11.3 5.1 11.3 11.3c0 3-1.2 5.9-3.3 8l-19.9 19.9c-5.8 5.8-12.9 10.2-20.7 12.8l-26.5 8.8c-5.8 1.9-9.6 7.3-9.6 13.4c0 3.7-1.5 7.3-4.1 10l-17.9 17.9c-6.4 6.4-9.9 15-9.9 24v4.3c0 16.4 13.6 29.7 29.9 29.7c11 0 21.2-6.2 26.1-16l4-8.1c2.4-4.8 7.4-7.9 12.8-7.9c4.5 0 8.7 2.1 11.4 5.7l16.3 21.7c2.1 2.9 5.5 4.5 9.1 4.5c8.4 0 13.9-8.9 10.1-16.4l-1.1-2.3c-3.5-7 0-15.5 7.5-18l21.2-7.1c7.6-2.5 12.7-9.6 12.7-17.6c0-10.3 8.3-18.6 18.6-18.6H400c8.8 0 16 7.2 16 16s-7.2 16-16 16H379.3c-7.2 0-14.2 2.9-19.3 8l-4.7 4.7c-2.1 2.1-3.3 5-3.3 8c0 6.2 5.1 11.3 11.3 11.3h11.3c6 0 11.8 2.4 16 6.6l6.5 6.5c1.8 1.8 2.8 4.3 2.8 6.8s-1 5-2.8 6.8l-7.5 7.5C386 262 384 266.9 384 272s2 10 5.7 13.7L408 304c10.2 10.2 24.1 16 38.6 16H454c6.5-20.2 10-41.7 10-64c0-111.4-87.6-202.4-197.7-207.7zm172 307.9c-3.7-2.6-8.2-4.1-13-4.1c-6 0-11.8-2.4-16-6.6L396 332c-7.7-7.7-18-12-28.9-12c-9.7 0-19.2-3.5-26.6-9.8L314 287.4c-11.6-9.9-26.4-15.4-41.7-15.4H251.4c-12.6 0-25 3.7-35.5 10.7L188.5 301c-17.8 11.9-28.5 31.9-28.5 53.3v3.2c0 17 6.7 33.3 18.7 45.3l16 16c8.5 8.5 20 13.3 32 13.3H248c13.3 0 24 10.7 24 24c0 2.5 .4 5 1.1 7.3c71.3-5.8 132.5-47.6 165.2-107.2zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM187.3 100.7c-6.2-6.2-16.4-6.2-22.6 0l-32 32c-6.2 6.2-6.2 16.4 0 22.6s16.4 6.2 22.6 0l32-32c6.2-6.2 6.2-16.4 0-22.6z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.ye=Rn.DF},1445:(C,Rn)=>{"use strict";var or="ellipsis-vertical",So=["ellipsis-v"],To="f142",Ro="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z";Rn.DF={prefix:"fas",iconName:or,icon:[128,512,So,To,Ro]},Rn.Uw=Rn.DF},5218:(C,Rn)=>{"use strict";var or="forward",So=[9193],To="f04e",Ro="M52.5 440.6c-9.5 7.9-22.8 9.7-34.1 4.4S0 428.4 0 416V96C0 83.6 7.2 72.3 18.4 67s24.5-3.6 34.1 4.4L224 214.3V256v41.7L52.5 440.6zM256 352V256 128 96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4l192 160c7.3 6.1 11.5 15.1 11.5 24.6s-4.2 18.5-11.5 24.6l-192 160c-9.5 7.9-22.8 9.7-34.1 4.4s-18.4-16.6-18.4-29V352z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.ir=Rn.DF},3701:(C,Rn)=>{"use strict";var or="gear",So=[9881,"cog"],To="f013",Ro="M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.gr=Rn.DF},4422:(C,Rn)=>{"use strict";var or="image",So=[],To="f03e",Ro="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.Vm=Rn.DF},3650:(C,Rn)=>{"use strict";var or="layer-group",So=[],To="f5fd",Ro="M264.5 5.2c14.9-6.9 32.1-6.9 47 0l218.6 101c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 149.8C37.4 145.8 32 137.3 32 128s5.4-17.9 13.9-21.8L264.5 5.2zM476.9 209.6l53.2 24.6c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 277.8C37.4 273.8 32 265.3 32 256s5.4-17.9 13.9-21.8l53.2-24.6 152 70.2c23.4 10.8 50.4 10.8 73.8 0l152-70.2zm-152 198.2l152-70.2 53.2 24.6c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 405.8C37.4 401.8 32 393.3 32 384s5.4-17.9 13.9-21.8l53.2-24.6 152 70.2c23.4 10.8 50.4 10.8 73.8 0z";Rn.DF={prefix:"fas",iconName:or,icon:[576,512,So,To,Ro]},Rn.Kr=Rn.DF},4480:(C,Rn)=>{"use strict";var or="lightbulb",So=[128161],To="f0eb",Ro="M272 384c9.6-31.9 29.5-59.1 49.2-86.2l0 0c5.2-7.1 10.4-14.2 15.4-21.4c19.8-28.5 31.4-63 31.4-100.3C368 78.8 289.2 0 192 0S16 78.8 16 176c0 37.3 11.6 71.9 31.4 100.3c5 7.2 10.2 14.3 15.4 21.4l0 0c19.8 27.1 39.7 54.4 49.2 86.2H272zM192 512c44.2 0 80-35.8 80-80V416H112v16c0 44.2 35.8 80 80 80zM112 176c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-61.9 50.1-112 112-112c8.8 0 16 7.2 16 16s-7.2 16-16 16c-44.2 0-80 35.8-80 80z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.X8=Rn.DF},3911:(C,Rn)=>{"use strict";var or="link",So=[128279,"chain"],To="f0c1",Ro="M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.nN=Rn.DF},5476:(C,Rn)=>{"use strict";var or="location-dot",So=["map-marker-alt"],To="f3c5",Ro="M215.7 499.2C267 435 384 279.4 384 192C384 86 298 0 192 0S0 86 0 192c0 87.4 117 243 168.3 307.2c12.3 15.3 35.1 15.3 47.4 0zM192 128a64 64 0 1 1 0 128 64 64 0 1 1 0-128z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.op=Rn.DF},4666:(C,Rn)=>{"use strict";var or="magnifying-glass",So=[128269,"search"],To="f002",Ro="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.Y$=Rn.DF},8402:(C,Rn)=>{"use strict";var or=[128506,62072],So="f279",To="M384 476.1L192 421.2V35.9L384 90.8V476.1zm32-1.2V88.4L543.1 37.5c15.8-6.3 32.9 5.3 32.9 22.3V394.6c0 9.8-6 18.6-15.1 22.3L416 474.8zM15.1 95.1L160 37.2V423.6L32.9 474.5C17.1 480.8 0 469.2 0 452.2V117.4c0-9.8 6-18.6 15.1-22.3z";Rn.DF={prefix:"fas",iconName:"map",icon:[576,512,or,So,To]},Rn.Wx=Rn.DF},5974:(C,Rn)=>{"use strict";var or="minus",So=[8211,8722,10134,"subtract"],To="f068",Ro="M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.Kl=Rn.DF},5088:(C,Rn)=>{"use strict";var or="palette",So=[127912],To="f53f",Ro="M512 256c0 .9 0 1.8 0 2.7c-.4 36.5-33.6 61.3-70.1 61.3H344c-26.5 0-48 21.5-48 48c0 3.4 .4 6.7 1 9.9c2.1 10.2 6.5 20 10.8 29.9c6.1 13.8 12.1 27.5 12.1 42c0 31.8-21.6 60.7-53.4 62c-3.5 .1-7 .2-10.6 .2C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm0-96a32 32 0 1 0 0-64 32 32 0 1 0 0 64zM288 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm96 96a32 32 0 1 0 0-64 32 32 0 1 0 0 64z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.q2=Rn.DF},4038:(C,Rn)=>{"use strict";var or="panorama",So=[],To="e209",Ro="M45.6 32C20.4 32 0 52.4 0 77.6V434.4C0 459.6 20.4 480 45.6 480c5.1 0 10-.8 14.7-2.4C74.6 472.8 177.6 440 320 440s245.4 32.8 259.6 37.6c4.7 1.6 9.7 2.4 14.7 2.4c25.2 0 45.6-20.4 45.6-45.6V77.6C640 52.4 619.6 32 594.4 32c-5 0-10 .8-14.7 2.4C565.4 39.2 462.4 72 320 72S74.6 39.2 60.4 34.4C55.6 32.8 50.7 32 45.6 32zM96 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm272 0c7.9 0 15.4 3.9 19.8 10.5L512.3 353c5.4 8 5.6 18.4 .4 26.5s-14.7 12.3-24.2 10.7C442.7 382.4 385.2 376 320 376c-65.6 0-123.4 6.5-169.3 14.4c-9.8 1.7-19.7-2.9-24.7-11.5s-4.3-19.4 1.9-27.2L197.3 265c4.6-5.7 11.4-9 18.7-9s14.2 3.3 18.7 9l26.4 33.1 87-127.6c4.5-6.6 11.9-10.5 19.8-10.5z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.UH=Rn.DF},421:(C,Rn)=>{"use strict";var or="paper-plane",So=[61913],To="f1d8",Ro="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L284 427.7l-68.5 74.1c-8.9 9.7-22.9 12.9-35.2 8.1S160 493.2 160 480V396.4c0-4 1.5-7.8 4.2-10.7L331.8 202.8c5.8-6.3 5.6-16-.4-22s-15.7-6.4-22-.7L106 360.8 17.7 316.6C7.1 311.3 .3 300.7 0 288.9s5.9-22.8 16.1-28.7l448-256c10.7-6.1 23.9-5.5 34 1.4z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.XC=Rn.DF},2482:(C,Rn)=>{"use strict";var or="pause",So=[9208],To="f04c",Ro="M48 64C21.5 64 0 85.5 0 112V400c0 26.5 21.5 48 48 48H80c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H48zm192 0c-26.5 0-48 21.5-48 48V400c0 26.5 21.5 48 48 48h32c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H240z";Rn.DF={prefix:"fas",iconName:or,icon:[320,512,So,To,Ro]},Rn.XQ=Rn.DF},625:(C,Rn)=>{"use strict";var or=[128394],So="f304",To="M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z";Rn.DF={prefix:"fas",iconName:"pen",icon:[512,512,or,So,To]},Rn.Iw=Rn.DF},1658:(C,Rn)=>{"use strict";var or="person-biking",So=[128692,"biking"],To="f84a",Ro="M400 96a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm27.2 64l-61.8-48.8c-17.3-13.6-41.7-13.8-59.1-.3l-83.1 64.2c-30.7 23.8-28.5 70.8 4.3 91.6L288 305.1V416c0 17.7 14.3 32 32 32s32-14.3 32-32V288c0-10.7-5.3-20.7-14.2-26.6L295 232.9l60.3-48.5L396 217c5.7 4.5 12.7 7 20 7h64c17.7 0 32-14.3 32-32s-14.3-32-32-32H427.2zM56 384a72 72 0 1 1 144 0A72 72 0 1 1 56 384zm200 0A128 128 0 1 0 0 384a128 128 0 1 0 256 0zm184 0a72 72 0 1 1 144 0 72 72 0 1 1 -144 0zm200 0a128 128 0 1 0 -256 0 128 128 0 1 0 256 0z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.uY=Rn.DF},1788:(C,Rn)=>{"use strict";var or="play",So=[9654],To="f04b",Ro="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.zc=Rn.DF},4229:(C,Rn)=>{"use strict";var or="plus",So=[10133,61543,"add"],To="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,"2b",To]},Rn.r8=Rn.DF},6666:(C,Rn)=>{"use strict";var or="print",So=[128424,128438,9113],To="f02f",Ro="M128 0C92.7 0 64 28.7 64 64v96h64V64H354.7L384 93.3V160h64V93.3c0-17-6.7-33.3-18.7-45.3L400 18.7C388 6.7 371.7 0 354.7 0H128zM384 352v32 64H128V384 368 352H384zm64 32h32c17.7 0 32-14.3 32-32V256c0-35.3-28.7-64-64-64H64c-35.3 0-64 28.7-64 64v96c0 17.7 14.3 32 32 32H64v64c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V384zM432 248a24 24 0 1 1 0 48 24 24 0 1 1 0-48z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.wf=Rn.DF},8117:(C,Rn)=>{"use strict";var or="rocket",So=[],To="f135",Ro="M156.6 384.9L125.7 354c-8.5-8.5-11.5-20.8-7.7-32.2c3-8.9 7-20.5 11.8-33.8L24 288c-8.6 0-16.6-4.6-20.9-12.1s-4.2-16.7 .2-24.1l52.5-88.5c13-21.9 36.5-35.3 61.9-35.3l82.3 0c2.4-4 4.8-7.7 7.2-11.3C289.1-4.1 411.1-8.1 483.9 5.3c11.6 2.1 20.6 11.2 22.8 22.8c13.4 72.9 9.3 194.8-111.4 276.7c-3.5 2.4-7.3 4.8-11.3 7.2v82.3c0 25.4-13.4 49-35.3 61.9l-88.5 52.5c-7.4 4.4-16.6 4.5-24.1 .2s-12.1-12.2-12.1-20.9V380.8c-14.1 4.9-26.4 8.9-35.7 11.9c-11.2 3.6-23.4 .5-31.8-7.8zM384 168a40 40 0 1 0 0-80 40 40 0 1 0 0 80z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.tM=Rn.DF},953:(C,Rn)=>{"use strict";var or="satellite-dish",So=[128225],To="f7c0",Ro="M192 32c0-17.7 14.3-32 32-32C383.1 0 512 128.9 512 288c0 17.7-14.3 32-32 32s-32-14.3-32-32C448 164.3 347.7 64 224 64c-17.7 0-32-14.3-32-32zM60.6 220.6L164.7 324.7l28.4-28.4c-.7-2.6-1.1-5.4-1.1-8.3c0-17.7 14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32c-2.9 0-5.6-.4-8.3-1.1l-28.4 28.4L291.4 451.4c14.5 14.5 11.8 38.8-7.3 46.3C260.5 506.9 234.9 512 208 512C93.1 512 0 418.9 0 304c0-26.9 5.1-52.5 14.4-76.1c7.5-19 31.8-21.8 46.3-7.3zM224 96c106 0 192 86 192 192c0 17.7-14.3 32-32 32s-32-14.3-32-32c0-70.7-57.3-128-128-128c-17.7 0-32-14.3-32-32s14.3-32 32-32z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.QN=Rn.DF},8818:(C,Rn)=>{"use strict";var or="share-nodes",So=["share-alt"],To="f1e0",Ro="M352 224c53 0 96-43 96-96s-43-96-96-96s-96 43-96 96c0 4 .2 8 .7 11.9l-94.1 47C145.4 170.2 121.9 160 96 160c-53 0-96 43-96 96s43 96 96 96c25.9 0 49.4-10.2 66.6-26.9l94.1 47c-.5 3.9-.7 7.8-.7 11.9c0 53 43 96 96 96s96-43 96-96s-43-96-96-96c-25.9 0-49.4 10.2-66.6 26.9l-94.1-47c.5-3.9 .7-7.8 .7-11.9s-.2-8-.7-11.9l94.1-47C302.6 213.8 326.1 224 352 224z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.M6=Rn.DF},4470:(C,Rn)=>{"use strict";var or="sliders",So=["sliders-h"],To="f1de",Ro="M0 416c0 17.7 14.3 32 32 32l54.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 448c17.7 0 32-14.3 32-32s-14.3-32-32-32l-246.7 0c-12.3-28.3-40.5-48-73.3-48s-61 19.7-73.3 48L32 384c-17.7 0-32 14.3-32 32zm128 0a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zM320 256a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm32-80c-32.8 0-61 19.7-73.3 48L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l246.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48l54.7 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-54.7 0c-12.3-28.3-40.5-48-73.3-48zM192 128a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm73.3-64C253 35.7 224.8 16 192 16s-61 19.7-73.3 48L32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l86.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 128c17.7 0 32-14.3 32-32s-14.3-32-32-32L265.3 64z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.cR=Rn.DF},6580:(C,Rn)=>{"use strict";var or="square-rss",So=["rss-square"],To="f143",Ro="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM96 136c0-13.3 10.7-24 24-24c137 0 248 111 248 248c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-110.5-89.5-200-200-200c-13.3 0-24-10.7-24-24zm0 96c0-13.3 10.7-24 24-24c83.9 0 152 68.1 152 152c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-57.4-46.6-104-104-104c-13.3 0-24-10.7-24-24zm0 120a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.mW=Rn.DF},8381:(C,Rn)=>{"use strict";var or="triangle-exclamation",So=[9888,"exclamation-triangle","warning"],To="f071",Ro="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.ik=Rn.DF},3299:(C,Rn)=>{"use strict";var or="user",So=[128100,62144],To="f007",Ro="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.IL=Rn.DF},6899:(C,Rn)=>{"use strict";var or="xmark",So=[128473,10005,10006,10060,215,"close","multiply","remove","times"],To="f00d",Ro="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.g8=Rn.DF},3114:(C,Rn,or)=>{"use strict";or.d(Rn,{$N:()=>Hh,AE:()=>im,F6:()=>ep,Il:()=>Eh,Of:()=>Sp,P6:()=>Yu,U3:()=>Gh,Yc:()=>Mp,k8:()=>op,rq:()=>ap,tl:()=>Ro,we:()=>ip});var So=or(7760),To=Object.defineProperty,__export=(C,Rn)=>{for(var or in Rn)To(C,or,{get:Rn[or],enumerable:!0})},Ro={};
|
|
12
|
+
!function(C,Rn){"object"===typeof exports&&"object"===typeof module?module.exports=Rn():"function"===typeof define&&define.amd?define("Panoramax",[],Rn):"object"===typeof exports?exports.Panoramax=Rn():C.Panoramax=Rn()}(this,(()=>(()=>{var C={2244:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Editor});or(2325);var So=or(6792),To=or(2093),Ro=or(2354),Uo=or(4133),Oo=or(7832),Ho=or(7457),qo=or(3406),dl=or(3114);const ml="sequence-headings";class Editor extends So.Z{constructor(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(C,Rn,Object.assign(or,{users:[]})),this._selectedSeqId||this._loader.dismiss({},"No sequence is selected"),this.psvContainer=document.createElement("div"),this.mapContainer=document.createElement("div"),this.container.appendChild(this.psvContainer),this.container.appendChild(this.mapContainer);try{this.psv=new Ro.ZP(this,this.psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(So){let C=dl.we.isWebGLSupported?this._t.gvs.error_psv:this._t.gvs.error_webgl;this._loader.dismiss(So,C)}this._api.onceReady().then((()=>{try{this.map=new To.Z(this,this.mapContainer,{raster:or.raster,background:or.background,supplementaryStyle:this._createMapStyle()}),(0,Ho.bk)(this),this._loadSequence(),this.map.once("load",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),or.raster&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const C=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=Rn=>(Rn=void 0===this._lastRelHeading?Rn:Rn+this._lastRelHeading-this.psv.getPictureRelativeHeading(),C(Rn))}catch(So){this._loader.dismiss(So,this._t.gvs.error_psv)}})),this.addEventListener("select",this._onSelect.bind(this))}getClassName(){return"Editor"}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...qo.lg.SEQUENCES.layout},paint:{...qo.lg.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...qo.lg.PICTURES.layout},paint:{...qo.lg.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this._api.getSequenceItems(this._selectedSeqId).then((C=>{this._sequenceData=C.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this._selectedSeqId},geometry:{type:"LineString",coordinates:C.features.map((C=>C.geometry.coordinates))}},...C.features.map((C=>(C.properties.id=C.id,C.properties.sequences=[this._selectedSeqId],C)))]});const onMapLoad=()=>{if(this._selectedPicId){const Rn=C.features.find((C=>C.id===this._selectedPicId));Rn?(this.select(this._selectedSeqId,this._selectedPicId,!0),this.map.jumpTo({center:Rn.geometry.coordinates,zoom:18})):console.log("Picture with ID",Rn,"was not found")}else{const Rn=[...C.features[0].geometry.coordinates,...C.features[0].geometry.coordinates];for(let or=1;or<C.features.length;or++){const So=C.features[or].geometry.coordinates;So[0]<Rn[0]&&(Rn[0]=So[0]),So[1]<Rn[1]&&(Rn[1]=So[1]),So[0]>Rn[2]&&(Rn[2]=So[0]),So[1]>Rn[3]&&(Rn[3]=So[1])}this.map.fitBounds(Rn,{animate:!1})}this._loader.dismiss()};this.map.loaded()?onMapLoad():this.map.once("load",onMapLoad)})).catch((C=>this._loader.dismiss(C,this._t.gvs.error_api)))}_getNode(C){const Rn=this._sequenceData.find((Rn=>Rn.properties.id===C)),or=Rn?(0,Ho.FF)(Rn,this._t,this._isInternetFast):null;return or&&delete or.links,or}_addMapBackgroundWidget(){const C=document.createElement("div");C.id="gvs-map-bg",C.classList.add("gvs-panel","gvs-widget-bg","gvs-input-group");const onBgChange=C=>this.map.setBackground(C.target.value),Rn=document.createElement("input");Rn.id="gvs-map-bg-streets",Rn.setAttribute("type","radio"),Rn.setAttribute("name","gvs-map-bg"),Rn.setAttribute("value","streets"),Rn.addEventListener("change",onBgChange),C.appendChild(Rn);const or=document.createElement("label");or.setAttribute("for",Rn.id);const So=document.createElement("img");So.src=Oo,or.appendChild(So),or.appendChild(document.createTextNode(this._t.gvs.map_background_streets)),C.appendChild(or);const To=document.createElement("input");To.id="gvs-map-bg-aerial",To.setAttribute("type","radio"),To.setAttribute("name","gvs-map-bg"),To.setAttribute("value","aerial"),To.addEventListener("change",onBgChange),C.appendChild(To);const Ro=document.createElement("label");Ro.setAttribute("for",To.id);const Ho=document.createElement("img");Ho.src=Uo,Ro.appendChild(Ho),Ro.appendChild(document.createTextNode(this._t.gvs.map_background_aerial)),C.appendChild(Ro),this.mapContainer.appendChild(C);const onMapBgChange=C=>{"aerial"===C?To.checked=!0:Rn.checked=!0};this.addEventListener("map:background-changed",(C=>onMapBgChange(C.detail.background))),onMapBgChange(this.map.getBackground())}previewSequenceHeadingChange(C){const Rn=void 0!==this.map.getLayer(ml);if(this.map._picMarkerPreview.remove(),void 0===C)return delete this._lastRelHeading,Rn&&this.map.setLayoutProperty(ml,"visibility","none"),void(this._selectedPicId&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=C,Rn||this.map.addLayer({id:ml,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"gvs-marker","icon-overlap":"always","icon-size":.8}});const or=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(ml,"visibility","visible"),this.map.setLayoutProperty(ml,"icon-rotate",["+",["get","view:azimuth"],or,C]);const So=[["==",["geometry-type"],"Point"]];this._selectedPicId&&So.push(["!=",["get","id"],this._selectedPicId]),this.map.setFilter(ml,["all",...So]),this._selectedPicId&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}},9323:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Oo});var So=or(6792),To=or(2093),Ro=or(3406),Uo=or(4307);class StandaloneMap extends So.Z{constructor(C,Rn){super(C,Rn,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this.mapContainer=document.createElement("div"),this.container.appendChild(this.mapContainer),this._api.onceReady().then((()=>this._initMap())),this.addEventListener("map:picture-click",(C=>this.select(C.detail.seqId,C.detail.picId))),this.addEventListener("map:sequence-click",(C=>this.select(C.detail.seqId))),this.addEventListener("select",this._onSelect.bind(this))}getClassName(){return"Map"}destroy(){super.destroy(),this.map.destroy(),delete this.map,this.mapContainer.remove(),this.container.innerHTML="",this.container.classList.remove(...[...this.container.classList].filter((C=>C.startsWith("gvs"))))}_initMap(){this._options.hash=!0;class MyMap extends To.Z{_getLayerStyleProperties(C){return"pictures_symbols"===C?{layout:{visibility:"none"}}:super._getLayerStyleProperties(C)}}this.map=new MyMap(this,this.mapContainer,this._options),this.map.addControl(new Uo.NavigationControl({showCompass:!1})),this.map.on("load",(()=>{this.map.reloadLayersStyles(),this._loader.dismiss()}))}_onSelect(C){if(C.detail.picId||C.detail.seqId){const Rn=C.detail.picId?"pictures":"sequences",or=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((C=>(0,Ro.lh)(C,Rn))),filter:["==",["get","id"],C.detail.picId||C.detail.seqId]});or.length>=0&&null!=or[0]&&this.map._attachPreviewToPictures({features:or},Rn)}}}const Oo=StandaloneMap},1707:(C,Rn,or)=>{"use strict";or.d(Rn,{O_:()=>Ho.O_,ZP:()=>Viewer,ns:()=>vl,q7:()=>Ho.q7});or(2411);var So=or(3114),To=or(9705),Ro=or(9204),Uo=or(7457),Oo=or(6792),Ho=or(2354),qo=or(2093),dl=or(3406),ml=or(4824),fl=or(6899);const vl=20,bl=Math.PI/6,kl=100,Ll="http://127.0.0.1:8111",Dl={DEFAULT:"default",AGE:"age",TYPE:"type"};class Viewer extends Oo.Z{constructor(C,Rn){var or;let Uo,Oo=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(super(C,Rn,Oo),null==this._options.map&&(this._options.map={}),null==this._options.widgets&&(this._options.widgets={}),this._sequencePlaying=!1,this._prevSequence=null,this._mapTheme=(null===Oo||void 0===Oo||null===(or=Oo.map)||void 0===or?void 0:or.theme)||Dl.DEFAULT,this._picNav=(null===Oo||void 0===Oo?void 0:Oo.picturesNavigation)||"any",this._options.testing)return;if(!0===this._options.hash||void 0===this._options.hash){if(this._hash=new Ro.Z(this),Uo=this._hash._getCurrentHash(),"none"===Uo.map&&(this._options.map=!1),"object"===typeof this._options.map&&(this._options.map.hash=!1),this._options.map&&Uo.focus&&(this._options.map.startWide="map"===Uo.focus),this._options.map&&Uo.background&&(this._options.map.background=Uo.background),this._options.map&&Uo.users&&(this._options.users=[...new Set(Uo.users.split(","))]),Uo.xyz){const C=this._hash.getXyzOptionsFromHashString(Uo.xyz);this.addEventListener("psv:picture-loaded",(()=>{this.psv.setXYZ(C.x,C.y,C.z)}),{once:!0})}if(this._options.map&&"string"===typeof Uo.map){const C=this._hash.getMapOptionsFromHashString(Uo.map);C&&(this._options.map=Object.assign({},this._options.map,C))}if(this._options.map&&this.setFilters(this._hash.getMapFiltersFromHashVals(Uo),!0),Uo.pic){const C=Uo.pic.split(";");C.length>1&&console.warn("Multiple picture IDs passed in URL, only first one kept"),this._options.selectedPicture=C[0]}"string"===typeof Uo.speed&&(this._options.transition=parseInt(Uo.speed)),Uo.nav&&(this._picNav=Uo.nav)}this._initContainerStructure();try{this.psv=new Ho.ZP(this,this.psvContainer,{transitionDuration:this._options.transition,shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...So.Of.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this.toggleFocus(),7:()=>this.toggleFocus(),End:()=>this.toggleUnfocusedVisible(),1:()=>this.toggleUnfocusedVisible()," ":()=>this.toggleSequencePlaying(),0:()=>this.toggleSequencePlaying()}}),this.psv.addEventListener("dblclick",(()=>{this.map&&this.isMapWide()&&this.setFocus("pic")}))}catch(qo){let C=So.we.isWebGLSupported?this._t.gvs.error_psv:this._t.gvs.error_webgl;this._loader.dismiss(qo,C)}const onceStuffReady=()=>{this._widgets=new To.Z(this,this._options.widgets),this.map&&this.isWidthSmall()&&this.setUnfocusedVisible(!1),this._options.selectedPicture?(this.select(null,this._options.selectedPicture,!0),this.addEventListener("psv:picture-loaded",(()=>{var C;this.map&&this._options.map&&this.map.jumpTo(this._options.map),"meta"===(null===(C=Uo)||void 0===C?void 0:C.focus)&&this._widgets._showPictureMetadataPopup(),this._loader.dismiss()}),{once:!0})):this._loader.dismiss(),this._options.position&&this.goToPosition(...this._options.position).catch((C=>this._loader.dismiss(C,this._t.gvs.error_nopic))),this._hash&&this.map&&(this.map._attribution._container.classList.add("gvs-hidden"),this._hash.bindMapEvents(),this._mapFilters&&this.setFilters(this._mapFilters,!0),Uo.users&&Promise.all(this.map.getVisibleUsers().filter((C=>"geovisio"!=C)).map((C=>this._api.getUserName(C)))).then((C=>{C=C.filter((C=>null!=C)).join(", ");const Rn=document.getElementById("gvs-filter-search-user").querySelector("input");Rn&&Rn.setItem(C)})).catch((C=>console.warn("Error when looking up for user names",C))))};this._api.onceReady().then((()=>{this._options.map?(void 0===this._options.map.doubleClickZoom&&(this._options.map.doubleClickZoom=!1),this._initMap().then(onceStuffReady).catch((C=>this._loader.dismiss(C,this._t.gvs.error_api_compatibility)))):onceStuffReady()}))}getClassName(){return"Viewer"}destroy(){super.destroy(),this._widgets.destroy(),delete this._widgets,this._hash.destroy(),delete this._hash,this.map.destroy(),delete this.map,delete this._mapFilters,this.psv.destroy(),delete this.psv,this.miniContainer.remove(),this.mainContainer.remove(),this.mapContainer.remove(),this.psvContainer.remove(),this.popupContainer.remove(),this.container.innerHTML="",this.container.classList.remove(...[...this.container.classList].filter((C=>C.startsWith("gvs"))))}_initContainerStructure(){this.miniContainer=document.createElement("div"),this.miniContainer.classList.add("gvs-mini"),this.mainContainer=document.createElement("div"),this.mainContainer.classList.add("gvs-main"),this.popupContainer=document.createElement("div"),this.popupContainer.classList.add("gvs-popup","gvs-hidden"),this.psvContainer=document.createElement("div"),this.mainContainer.appendChild(this.psvContainer),this.mapContainer=document.createElement("div"),this.miniContainer.appendChild(this.mapContainer),this.container.appendChild(this.mainContainer),this.container.appendChild(this.miniContainer),this.container.appendChild(this.popupContainer)}async _initMap(){await new Promise((C=>{this.map=new qo.Z(this,this.mapContainer,this._options.map),this.map._getLayerColorStyle=this._getLayerColorStyle.bind(this),this.map._getLayerSortStyle=this._getLayerSortStyle.bind(this),this.addEventListener("map:users-changed",C,{once:!0}),this.container.classList.add("gvs-has-mini"),this.map.on("dblclick",(()=>{this.isMapWide()||this.setFocus("map")})),"object"===typeof this._options.map&&this._options.map.startWide?this.setFocus("map",!0):this.setFocus("pic",!0)})),this._initMapKeyboardHandler(),(0,Uo.bk)(this)}_initMapKeyboardHandler(){const C=this;this.map.keyboard.keydown=function(Rn){if(Rn.altKey||Rn.ctrlKey||Rn.metaKey)return;switch(Rn.key){case"*":case"5":return void C.moveCenter();case"PageUp":case"9":return void C.psv.goToNextPicture();case"PageDown":case"3":return void C.psv.goToPrevPicture();case"Home":case"7":return Rn.stopPropagation(),void C.toggleFocus();case"End":case"1":return void C.toggleUnfocusedVisible();case" ":case"0":return void C.toggleSequencePlaying()}let or=0,So=0,To=0,Ro=0,Uo=0;switch(Rn.keyCode){case 61:case 107:case 171:case 187:or=1;break;case 189:case 109:case 173:or=-1;break;case 37:case 100:Rn.shiftKey?So=-1:(Rn.preventDefault(),Ro=-1);break;case 39:case 102:Rn.shiftKey?So=1:(Rn.preventDefault(),Ro=1);break;case 38:case 104:Rn.shiftKey?To=1:(Rn.preventDefault(),Uo=-1);break;case 40:case 98:Rn.shiftKey?To=-1:(Rn.preventDefault(),Uo=1);break;default:return}return this._rotationDisabled&&(So=0,To=0),{cameraAnimation:C=>{const Oo=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:C=>C*(2-C),zoom:or?Math.round(Oo.zoom)+or*(Rn.shiftKey?2:1):Oo.zoom,bearing:Oo.bearing+So*this._bearingStep,pitch:Oo.pitch+To*this._pitchStep,offset:[-Ro*this._panStep,-Uo*this._panStep],center:Oo.center},{originalEvent:Rn})}}}.bind(this.map.keyboard)}_psvShouldGoFast(){return this._sequencePlaying&&this.psv.getTransitionDuration()<1e3||this.map&&this.isMapWide()}refreshPSV(){var C;const Rn=this.psv._myVTour.getCurrentNode();if(Rn&&Rn.panorama.baseUrl!==(null===Rn||void 0===Rn||null===(C=Rn.panorama)||void 0===C?void 0:C.origBaseUrl)){const C=this.psv.getZoomLevel(),or=this.psv.getPosition();this.psv._myVTour.state.currentNode=null,this.psv._myVTour.setCurrentNode(Rn.id,{zoomTo:C,rotateTo:or,fadeIn:!1,speed:0,rotation:!1})}Rn&&Rn.panorama.rows>1&&this.psv.adapter.__refresh()}setPopup(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(C)if(Rn){this.psv.stopKeyboardControl(),this.popupContainer.innerHTML="";const C=document.createElement("div");C.classList.add("gvs-popup-backdrop"),C.addEventListener("click",(()=>this.setPopup(!1)));const or=document.createElement("div");or.classList.add("gvs-widget-bg"),"string"===typeof Rn?or.innerHTML=Rn:Array.isArray(Rn)&&Rn.forEach((C=>or.appendChild(C)));const So=document.createElement("button");So.id="gvs-popup-btn-close",So.classList.add("gvs-btn","gvs-widget-bg"),So.appendChild((0,ml.fa)(fl.g8)),So.addEventListener("click",(()=>this.setPopup(!1))),or.insertBefore(So,or.firstChild),this.popupContainer.appendChild(C),this.popupContainer.appendChild(or),this.popupContainer.classList.remove("gvs-hidden"),(0,ml.QO)(this.popupContainer,this._t)}else this.popupContainer.classList.remove("gvs-hidden");else this.popupContainer.classList.add("gvs-hidden"),this.setFocus("pic"),this.psv.startKeyboardControl()}playSequence(){this._sequencePlaying=!0;const C=new Event("sequence-playing");this.dispatchEvent(C);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("psv:picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.psv.getTransitionDuration())}),{once:!0});try{this.psv.goToNextPicture()}catch(C){this.stopSequence()}}};this.psv.addEventListener("click",(()=>{this.stopSequence()})),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.refreshPSV();const C=new Event("sequence-stopped");this.dispatchEvent(C)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}moveCenter(){const C=this.psv.getPictureMetadata();C&&(this.map&&this.isMapWide()?this.map.flyTo({center:C.gps,zoom:20}):this._psvAnimate({speed:Ho.O_,yaw:0,pitch:0,zoom:Ho.Se}))}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(C){if(this.map&&this.isMapWide()){let Rn;switch(C){case"up":Rn=[0,-100];break;case"left":Rn=[-100,0];break;case"down":Rn=[0,kl];break;case"right":Rn=[kl,0]}this.map.panBy(Rn)}else{let Rn=this.psv.getPosition();switch(C){case"up":Rn.pitch+=bl;break;case"left":Rn.yaw-=bl;break;case"down":Rn.pitch-=bl;break;case"right":Rn.yaw+=bl}this._psvAnimate({speed:Ho.O_,...Rn})}}_psvAnimate(C){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(C)}isMapWide(){if(!this.map)throw new Error("Map is not enabled");return this.mapContainer.parentNode==this.mainContainer}_getDatesForLayerColors(){const C=864e5,Rn=Date.now();return[Rn-30*C,Rn-365*C,Rn-730*C].map((C=>new Date(C).toISOString().split("T")[0]))}_getLayerColorStyle(C){var Rn,or,So,To,Ro;const Oo=["case",["==",["get","hidden"],!0],Uo.DM.HIDDEN],Ho=(null===(Rn=this.psv._myVTour)||void 0===Rn||null===(or=Rn.state)||void 0===or?void 0:or.loadingNode)||(null===(So=this.psv._myVTour)||void 0===So||null===(To=So.state)||void 0===To||null===(Ro=To.currentNode)||void 0===Ro?void 0:Ro.id),qo=Ho?this.psv._picturesSequences[Ho]:null;if("sequences"==C&&qo?Oo.push(["==",["get","id"],qo],Uo.DM.SELECTED):"pictures"==C&&qo&&Oo.push(["in",qo,["get","sequences"]],Uo.DM.SELECTED),this._mapTheme==Dl.AGE){const Rn="sequences"==C?"date":"ts",or=this._getDatesForLayerColors();Oo.push(["!",["has",Rn]],Uo.DM.BASE,[">=",["get",Rn],or[0]],Uo.DM.PALETTE_4,[">=",["get",Rn],or[1]],Uo.DM.PALETTE_3,[">=",["get",Rn],or[2]],Uo.DM.PALETTE_2,Uo.DM.PALETTE_1)}else this._mapTheme==Dl.TYPE?Oo.push(["!",["has","type"]],Uo.DM.BASE,["==",["get","type"],"equirectangular"],Uo.DM.QUALI_1,Uo.DM.QUALI_2):Oo.push(Uo.DM.BASE);return Oo}_getLayerSortStyle(C){var Rn,or,So,To,Ro;const Uo=["case",["==",["get","hidden"],!0],90],Oo=(null===(Rn=this.psv._myVTour)||void 0===Rn||null===(or=Rn.state)||void 0===or?void 0:or.loadingNode)||(null===(So=this.psv._myVTour)||void 0===So||null===(To=So.state)||void 0===To||null===(Ro=To.currentNode)||void 0===Ro?void 0:Ro.id),Ho=Oo?this.psv._picturesSequences[Oo]:null;if("sequences"==C&&Ho?Uo.push(["==",["get","id"],Ho],100):"pictures"==C&&Ho&&Uo.push(["in",Ho,["get","sequences"]],100),this._mapTheme==Dl.AGE){const Rn="sequences"==C?"date":"ts",or=this._getDatesForLayerColors();Uo.push(["!",["has",Rn]],0,[">=",["get",Rn],or[0]],50,[">=",["get",Rn],or[1]],49,[">=",["get",Rn],or[2]],48)}else this._mapTheme==Dl.TYPE&&Uo.push(["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50);return Uo.push(10),Uo}getPicturesNavigation(){return this._picNav}setPicturesNavigation(C){this._picNav=C;const Rn=new CustomEvent("pictures-navigation-changed",{detail:{value:C}});this.dispatchEvent(Rn)}_picturesNavFilter(C){switch(this._picNav){case"seq":return["next","prev"].includes(C.rel);case"pic":return!1;default:return!0}}toggleJOSMLive(C){if(C){const C=new CustomEvent("josm-live-enabled");return this.dispatchEvent(C),fetch(Ll+"/version").catch((C=>{throw this.dispatchEvent(new CustomEvent("josm-live-disabled")),C})).then((()=>{const C=(0,Uo.Iu)(this.psv.getPictureMetadata());if(C){const Rn="".concat(Ll,"/load_and_zoom?").concat(C);fetch(Rn).catch((C=>{console.warn(C),this.toggleJOSMLive(!1)}))}this._josmListener=()=>{const C=(0,Uo.Iu)(this.psv.getPictureMetadata());if(C){const Rn="".concat(Ll,"/zoom?").concat(C);fetch(Rn).catch((C=>{console.warn(C),this.toggleJOSMLive(!1)}))}},this.addEventListener("psv:picture-loaded",this._josmListener),this.addEventListener("psv:picture-loading",this._josmListener)}))}{const C=new CustomEvent("josm-live-disabled");return this.dispatchEvent(C),this._josmListener&&(this.removeEventListener("picture-loading",this._josmListener),this.removeEventListener("picture-loaded",this._josmListener),delete this._josmListener),Promise.resolve()}}setFocus(C){var Rn,or,So;let To=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("map"===C&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(C))throw new Error("Invalid focus value (should be pic or map)");if(("map"!==C||!this.map||!this.isMapWide())&&("pic"!==C||this.map&&this.isMapWide())){var Ro;if(null===(Rn=this.mapContainer.parentElement)||void 0===Rn||Rn.removeChild(this.mapContainer),null===(or=this.psvContainer.parentElement)||void 0===or||or.removeChild(this.psvContainer),"map"===C)this.psv.stopKeyboardControl(),this.map.keyboard.enable(),this.container.classList.add("gvs-focus-map"),this.mainContainer.appendChild(this.mapContainer),this.miniContainer.appendChild(this.psvContainer),this.map.getCanvas().focus();else null===this||void 0===this||null===(Ro=this.map)||void 0===Ro||Ro.keyboard.disable(),this.psv.startKeyboardControl(),this.container.classList.remove("gvs-focus-map"),this.mainContainer.appendChild(this.psvContainer),this.miniContainer.appendChild(this.mapContainer),this.psvContainer.focus();if(null===this||void 0===this||null===(So=this.map)||void 0===So||So.resize(),this.psv.autoSize(),this.refreshPSV(),!To){const Rn=new CustomEvent("focus-changed",{detail:{focus:C}});this.dispatchEvent(Rn)}}}toggleFocus(){if(!this.map)throw new Error("Map is not enabled");this.setFocus(this.isMapWide()?"pic":"map")}setUnfocusedVisible(C){if(!this.map)throw new Error("Map is not enabled");C?this.container.classList.remove("gvs-mini-hidden"):this.container.classList.add("gvs-mini-hidden"),this.map.resize(),this.psv.autoSize()}toggleUnfocusedVisible(){if(!this.map)throw new Error("Map is not enabled");this.setUnfocusedVisible(this.container.classList.contains("gvs-mini-hidden"))}setFilters(C){let Rn=arguments.length>1&&void 0!==arguments[1]&&arguments[1],or=[],So=[];if(this._mapFilters={},C.minDate&&""!==C.minDate&&(this._mapFilters.minDate=C.minDate,or.push([">=",["get","date"],C.minDate]),So.push([">=",["get","ts"],C.minDate])),C.maxDate&&""!==C.maxDate){this._mapFilters.maxDate=C.maxDate,or.push(["<=",["get","date"],C.maxDate]);let Rn=new Date(C.maxDate);Rn.setDate(Rn.getDate()+1),Rn=Rn.toISOString().split("T")[0],So.push(["<=",["get","ts"],Rn])}if(C.type&&""!==C.type&&(this._mapFilters.type=C.type,or.push(["==",["get","type"],C.type]),So.push(["==",["get","type"],C.type])),C.camera&&""!==C.camera){this._mapFilters.camera=C.camera;const Rn=C.camera.toLowerCase().trim()+" ",To=C.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",Ro=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];or.push([">=",["get","model"],Rn,Ro]),or.push(["<=",["get","model"],To,Ro]),So.push([">=",["get","model"],Rn,Ro]),So.push(["<=",["get","model"],To,Ro])}if(C.theme&&Object.values(Dl).includes(C.theme)&&(this._mapFilters.theme=C.theme,this.map&&(this._mapTheme=this._mapFilters.theme,this.map.reloadLayersStyles())),0==or.length?or=null:or.unshift("all"),0==So.length?So=null:(So.unshift("all"),So=["step",["zoom"],!0,dl.Lh,So]),this.map){const C=this.map.getVisibleUsers().includes("geovisio");or&&C&&(or=["step",["zoom"],!0,7,or]),this.map.filterUserLayersContent("sequences",or),this.map.filterUserLayersContent("pictures",So),!Rn&&(null!==or||null!==So||null!==this._mapFilters.theme&&this._mapFilters.theme!==Dl.DEFAULT)&&C&&this.map.getZoom()<7&&this.map.easeTo({zoom:7})}const To=new CustomEvent("filters-changed",{detail:Object.assign({},this._mapFilters)});this.dispatchEvent(To)}}},6792:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>CoreView});or(9835);var So=or(937),To=or(7586),Ro=or(3406),Uo=or(7457),Oo=or(4147),Ho=or(8152);class CoreView extends EventTarget{constructor(C,Rn){var or;let qo=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(super(),this._options=qo,null==this._options&&(this._options={}),this._options.users||(this._options.users=["geovisio"]),"string"===typeof this._options.users&&(this._options.users=[this._options.users]),this._options.style||(this._options.style=Ro.wL),this._options.testing||console.info("\ud83d\udcf7 Panoramax ".concat(this.getClassName()," - Version ").concat(Oo.i8," (").concat("f1bb641",")\n\n\ud83c\udd98 Issues can be reported at ").concat(Oo.cj.H)),this._t=(0,To.F)(this._options.lang),this._isInternetFast=null,(0,Uo.EF)().then((C=>this._isInternetFast=C)),this._selectedSeqId=this._options.selectedSequence||null,this._selectedPicId=this._options.selectedPicture||null,this.container="string"===typeof C?document.getElementById(C):C,!(this.container instanceof Element))throw new Error("Container is not a valid HTML element, does it exist in your page ?");this.container.classList.add("gvs","gvs-".concat(this.getClassName().toLocaleLowerCase())),(0,Uo.zd)()&&this.container.classList.add("gvs-iframed"),this.loaderContainer=document.createElement("div"),this.container.appendChild(this.loaderContainer),this._loader=new Ho.Z(this,this.loaderContainer),Rn=Rn.replace("/api/search","/api"),this._api=new So.Z(Rn,{users:this._options.users,fetch:null===(or=this._options)||void 0===or?void 0:or.fetchOptions,style:this._options.style}),this._api.onceReady().then((()=>console.info('\ud83c\udf10 Connected to API "'.concat(this._api._metadata.name,'" (').concat(this._api._endpoint,")\n\u2139\ufe0f API runs STAC ").concat(this._api._metadata.stac_version," & GeoVisio ").concat(this._api._metadata.geovisio_version)))).catch((C=>this._loader.dismiss(C,this._t.gvs.error_api)))}getClassName(){return"CoreView"}destroy(){delete this._options,delete this._t,delete this._api,delete this._loader,this.loaderContainer.remove(),delete this.loaderContainer}isWidthSmall(){var C;return(null===(C=this.container)||void 0===C?void 0:C.offsetWidth)<576}isHeightSmall(){var C;return(null===(C=this.container)||void 0===C?void 0:C.offsetHeight)<400}select(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,or=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const So=this._selectedSeqId||null,To=this._selectedPicId||null;(or||To!=Rn)&&(this._selectedSeqId=C,this._selectedPicId=Rn,this.dispatchEvent(new CustomEvent("select",{detail:{seqId:C,picId:Rn,prevSeqId:So,prevPicId:To}})))}}},8152:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Loader});or(2007);var So=or(3505),To=or(9836);class Loader{constructor(C,Rn){this._parent=C,this.container=Rn,this.container.classList.add("gvs-loader","gvs-loader-visible");const or=document.createElement("img");or.src=To,or.title=this._parent._t.map.loading,or.classList.add("gvs-loader-img"),this.container.appendChild(or);const So=document.createElement("div"),Ro=document.createElement("span"),nextLabelFun=()=>this._parent._t.gvs.loading_labels_fun[Math.floor(Math.random()*this._parent._t.gvs.loading_labels_fun.length)];Ro.innerHTML=this._parent._t.gvs.loading_labels_serious[Math.floor(Math.random()*this._parent._t.gvs.loading_labels_serious.length)];const nextLabelFct=()=>setTimeout((()=>{Ro.innerHTML=nextLabelFun(),this._loaderLabelChanger=nextLabelFct()}),500+1e3*Math.random());this._loaderLabelChanger=nextLabelFct(),So.appendChild(Ro),this.container.appendChild(So)}isVisible(){return this.container.classList.contains("gvs-loader-visible")}dismiss(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(clearTimeout(this._loaderLabelChanger),C){!0!==C&&console.error(C),this.container.children[0].src=So,this.container.children[0].style.width="200px",this.container.children[0].style.animation="unset";let To="<small>".concat(or?this._parent._t.gvs.error_click:this._parent._t.gvs.error_retry,"</small>");Rn&&(To=Rn+"<br />"+To),this.container.children[1].innerHTML="".concat(this._parent._t.gvs.error,"<br />").concat(To),or&&this.container.addEventListener("click",or);const Ro=Rn||"Panoramax JS had a blocking exception",Uo=new CustomEvent("broken",{detail:{error:Ro}});throw this._parent.dispatchEvent(Uo),new Error(Ro)}{this.container.classList.remove("gvs-loader-visible"),setTimeout((()=>this.container.remove()),2e3);const C=new CustomEvent("ready");this._parent.dispatchEvent(C),or&&or()}}}},2093:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Map});or(1786);var So=or(3406),To=or(7457),Ro=or(9836),Uo=or(2506),Oo=or(6812),Ho=or(3732),qo=(or(262),or(4307)),dl=or.n(qo),ml=or(2609),fl=or.n(ml),vl=or(6351);dl().workerClass=fl(),dl().addProtocol("pmtiles",(new vl.b$).tile);const bl=["antialias","attributionControl","bearing","bearingSnap","bounds","boxZoom","center","clickTolerance","collectResourceTiming","cooperativeGestures","crossSourceCollisions","doubleClickZoom","dragPan","dragRotate","fadeDuration","failIfMajorPerformanceCaveat","fitBoundsOptions","hash","interactive","keyboard","localIdeographFontFamily","locale","logoPosition","maplibreLogo","maxBounds","maxCanvasSize","maxPitch","maxTileCacheSize","maxTileCacheZoomLevels","maxZoom","minPitch","minZoom","pitch","pitchWithRotate","pixelRatio","preserveDrawingBuffer","refreshExpiredTiles","renderWorldCopies","scrollZoom","touchPitch","touchZoomRotate","trackResize","transformCameraUpdate","transformRequest","validateStyle","zoom"];class Map extends dl().Map{constructor(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var To;super({container:Rn,style:(0,So.Ec)(C,or),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,preserveDrawingBuffer:!C.isWidthSmall(),transformRequest:C._api._getMapRequestTransform(),locale:C._t.maplibre,...(To=or,Object.fromEntries(Object.entries(To).filter((C=>{let[Rn]=C;return bl.includes(Rn)}))))}),this._loadMarkerImages(),this._parent=C,this._options=or,this.getContainer().classList.add("gvs-map"),this._options.raster&&(this._options.background=this._options.background||"streets"),this._attribution=new(dl().AttributionControl)({compact:!1}),this.addControl(this._attribution),this._initGeocoder(),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picThumbUrl={},this._seqPictures={},this._userLayers=new Set,this.on("mousemove","sequences",this._onSequenceHover.bind(this)),this._parent.addEventListener("select",this.reloadLayersStyles.bind(this)),this.on("load",(async()=>{await this.setVisibleUsers(this._parent._options.users),this.reloadLayersStyles(),this.resize()}))}destroy(){this.remove(),delete this._parent,delete this._options,delete this._attribution,delete this._picMarker,delete this._picMarkerPreview,delete this._picThumbUrl,delete this._seqPictures,delete this._userLayers}_initMapPosition(){this._options.center&&this._options.center!=[0,0]||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent._api.onceReady().then((()=>{var C,Rn;let or=null===(C=this._parent)||void 0===C||null===(Rn=C._api)||void 0===Rn?void 0:Rn.getDataBbox();if(or)try{or=new(dl().LngLatBounds)(or),this.loaded()?this.fitBounds(or,{animate:!1}):this.on("load",(()=>this.fitBounds(or,{animate:!1})))}catch(So){console.warn("Received invalid bbox: "+or)}}))}_initGeocoder(){var C,Rn;const or={ban:So.uD,nominatim:So.g8},To=(null===(C=this._options)||void 0===C||null===(Rn=C.geocoder)||void 0===Rn?void 0:Rn.engine)||"nominatim";this.geocoder=or[To],this._geolocate=new(dl().GeolocateControl)({positionOptions:{enableHighAccuracy:!0,timeout:6e4,maximumAge:3e5},showAccuracyCircle:!0,showUserLocation:!0,trackUserLocation:!0}).onAdd(this)}_loadMarkerImages(){[{id:"gvs-marker",img:Ro},{id:"gvs-arrow-flat",img:Oo},{id:"gvs-arrow-360",img:Ho}].forEach((C=>{const Rn=new Image(64,64);Rn.onload=()=>this.addImage(C.id,Rn),Rn.src=C.img}))}reloadVectorTiles(){[...this._userLayers].forEach((C=>{const Rn=this.getSource((0,So.eY)(C));Rn.setTiles(Rn.tiles)}))}hasTwoBackgrounds(){return void 0!==this.getLayer(So.Ws)}getBackground(){if(!this.getLayer(So.Ws))return"streets";return"visible"==this.getLayoutProperty(So.Ws,"visibility")?"aerial":"streets"}setBackground(C){if(!this.getLayer(So.Ws)&&"aerial"===C)throw new Error("No aerial imagery available");if(this.getLayer(So.Ws)){this.setLayoutProperty(So.Ws,"visibility","aerial"===C?"visible":"none");const Rn=new CustomEvent("map:background-changed",{detail:{background:C||"streets"}});this._parent.dispatchEvent(Rn)}}getVisibleUsers(){return[...this._userLayers].filter((C=>"visible"===this.getLayoutProperty((0,So.lh)(C,"pictures"),"visibility")))}async setVisibleUsers(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"===typeof C&&(C=[C]),await Promise.all(C.filter((C=>""!=C&&!this._userLayers.has(C))).map((C=>this._createPicturesTilesLayer(C))));const Rn=["pictures","sequences","sequences_plus","grid","pictures_symbols"];[...this._userLayers].forEach((or=>{Rn.forEach((Rn=>{const To=(0,So.lh)(or,Rn);this.getLayer(To)&&this.setLayoutProperty(To,"visibility",C.includes(or)?"visible":"none")}))}));const or=new CustomEvent("map:users-changed",{detail:{usersIds:C}});this._parent.dispatchEvent(or)}filterUserLayersContent(C,Rn){[...this._userLayers].forEach((or=>{this.setFilter((0,So.lh)(or,C),Rn),"sequences"===C&&this.setFilter((0,So.lh)(or,"sequences_plus"),Rn),"pictures"===C&&this.setFilter((0,So.lh)(or,"pictures_symbols"),Rn)}))}displayPictureMarker(C,Rn,or){this._picMarkerPreview.remove(),this._picMarker.setLngLat([C,Rn]).setRotation(or).addTo(this),this.reloadLayersStyles(),this.flyTo({center:[C,Rn],zoom:this.getZoom()<So.Lh+2?So.Lh+2:this.getZoom(),maxDuration:2e3})}reloadLayersStyles(){const updateStyle=(C,Rn)=>{[...this._userLayers].forEach((or=>{for(let To in Rn.layout)this.setLayoutProperty((0,So.lh)(or,C),To,Rn.layout[To]);for(let To in Rn.paint)this.setPaintProperty((0,So.lh)(or,C),To,Rn.paint[To])}))};["pictures","pictures_symbols","sequences"].forEach((C=>{updateStyle(C,this._getLayerStyleProperties(C))}))}async _createPicturesTilesLayer(C){this._userLayers.add(C);const Rn=this.getStyle().layers.find(So.RF);if("geovisio"!==C&&!this.getSource("geovisio_".concat(C))){const or=await this._parent._api.getUserMapStyle(C);Object.entries(or.sources).forEach((C=>{let[Rn,or]=C;return this.addSource(Rn,or)})),or.layers=or.layers||[];or.layers.concat((0,So.FS)(or.sources,or.layers)).forEach((C=>this.addLayer(C,null===Rn||void 0===Rn?void 0:Rn.id)))}this._picPreviewTimer=null,this._picPopup=new(dl().Popup)({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:3}),this._picPopup.on("close",(()=>{delete this._picPopup._picId}));const or=(0,So.lh)(C,"pictures");this.on("mousemove",or,(C=>{this.getCanvas().style.cursor="pointer";const Rn=Object.assign({},C);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(Rn,or)),100)})),this.on("mouseleave",or,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",or,this._onPictureClick.bind(this));const To=(0,So.lh)(C,"sequences_plus");this.on("mousemove",To,(C=>{if(this.getZoom()<=So.Lh+1&&(this.getCanvas().style.cursor="pointer",C.features[0].properties.id)){const Rn=Object.assign({},C);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(Rn,To)),100)}})),this.on("mouseleave",To,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",To,(C=>{C.preventDefault(),this.getZoom()<=So.Lh+1&&this._onSequenceClick(C)})),"geovisio"===C&&this.getLayer("geovisio_grid")&&(this.on("mousemove","geovisio_grid",(C=>{if(this.getZoom()<=So.Lh+1){this.getCanvas().style.cursor="pointer";const Rn=Object.assign({},C);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(Rn,"geovisio_grid")),100)}})),this.on("mouseleave","geovisio_grid",(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click","geovisio_grid",(C=>{C.preventDefault(),this.flyTo({center:C.lngLat,zoom:So.Lh-6})}))),this.on("click",(C=>{!1===C.defaultPrevented&&(clearTimeout(this._picPreviewTimer),this._picPopup.remove())}))}_getLayerStyleProperties(C){if("pictures_symbols"===C)return{paint:{},layout:{"icon-image":["case",["==",["get","id"],this._parent._selectedPicId],"",["==",["get","type"],"equirectangular"],"gvs-arrow-360","gvs-arrow-flat"],"symbol-sort-key":this._getLayerSortStyle(C)}};{const Rn={pictures:"circle",sequences:"line"};return{paint:Object.assign({["".concat(Rn[C],"-color")]:this._getLayerColorStyle(C)},So.lg[C.toUpperCase()].paint),layout:Object.assign({["".concat(Rn[C],"-sort-key")]:this._getLayerSortStyle(C)},So.lg[C.toUpperCase()].layout)}}}_getLayerColorStyle(C){const Rn=["case",["==",["get","hidden"],!0],To.DM.HIDDEN,["==",["get","geovisio:status"],"hidden"],To.DM.HIDDEN],or=this._parent._selectedSeqId;return"sequences"==C&&or?Rn.push(["==",["get","id"],or],To.DM.SELECTED):C.startsWith("pictures")&&or&&Rn.push(["in",or,["get","sequences"]],To.DM.SELECTED),Rn.push(To.DM.BASE),Rn}_getLayerSortStyle(C){const Rn=["case",["==",["get","hidden"],!0],90],or=this._parent._selectedSeqId;return"sequences"==C&&or?Rn.push(["==",["get","id"],or],100):C.startsWith("pictures")&&or&&Rn.push(["in",or,["get","sequences"]],100),Rn.push(10),Rn}_attachPreviewToPictures(C,Rn){let or=C.features.pop();if(!or||or.properties.id==this._picPopup._picId)return;let To=null;if(Rn.endsWith("pictures")?To=or.geometry.coordinates.slice():C.lngLat&&(To=[C.lngLat.lng,C.lngLat.lat]),!To){const C="LineString"===or.geometry.type?[or.geometry.coordinates]:or.geometry.coordinates;let Rn=null;const So=this.getBounds(),Ro=So.getCenter();for(let or=0;or<C.length;or++)for(let Uo=0;Uo<C[or].length;Uo++)if(So.contains(C[or][Uo])){let So=Ro.distanceTo(new(dl().LngLat)(...C[or][Uo]));(null===Rn||So<Rn)&&(To=C[or][Uo],Rn=So)}if(!To)return}this._picPopup.setLngLat(To).addTo(this),this._picThumbUrl[or.properties.id]||this._picPopup.setDOMContent((0,So.sl)(this._parent._t)),this._picPopup._loading=or.properties.id,this._picPopup._picId=or.properties.id;const displayThumb=C=>{if(this._picPopup._loading===or.properties.id)if(delete this._picPopup._loading,C){let Rn=document.createElement("img");Rn.classList.add("gvs-map-thumb"),Rn.alt=this._parent._t.thumbnail;let So=new Image;if(So.src=C,So.addEventListener("load",(()=>{or.properties.hidden?Rn.children[0].src=So.src:Rn.src=So.src,this._picPopup.setDOMContent(Rn)})),or.properties.hidden){const C=document.createElement("div");C.classList.add("gvs-map-thumb-legend"),C.appendChild(document.createTextNode(this._parent._t.map.not_public));const or=document.createElement("div");or.appendChild(Rn),or.appendChild(C),Rn=or}}else this._picPopup.setHTML("<i>".concat(this._parent._t.no_thumbnail,"</i>"))};Rn.endsWith("pictures")?this._getPictureThumbURL(or.properties.id).then(displayThumb):Rn.endsWith("grid")?this._getThumbURL(To).then(displayThumb):this._getSequenceThumbURL(or.properties.id,new(dl().LngLat)(...To)).then(displayThumb)}_getThumbURL(C){return this._parent._api.getPicturesAroundCoordinates(C[1],C[0],.1,1).then((C=>{var Rn;const or=null===C||void 0===C||null===(Rn=C.features)||void 0===Rn?void 0:Rn.pop();return or?this._parent._api.findThumbnailInPictureFeature(or):null}))}_getSequenceThumbURL(C,Rn){return Rn?this._parent._api.getPicturesAroundCoordinates(Rn.lat,Rn.lng,1,1,C).then((Rn=>{var or;return(null===Rn||void 0===Rn||null===(or=Rn.features)||void 0===or?void 0:or.length)>0?this._parent._api.findThumbnailInPictureFeature(Rn.features[0]):this._parent._api.getPictureThumbnailURLForSequence(C)})):this._parent._api.getPictureThumbnailURLForSequence(C)}_getPictureThumbURL(C,Rn){let or=null;return C&&(void 0!==this._picThumbUrl[C]?or="string"===typeof this._picThumbUrl[C]?Promise.resolve(this._picThumbUrl[C]):this._picThumbUrl[C]:(this._picThumbUrl[C]=this._parent._api.getPictureThumbnailURL(C,Rn).then((Rn=>Rn?(this._picThumbUrl[C]=Rn,Rn):(this._picThumbUrl[C]=null,null))).catch((()=>{this._picThumbUrl[C]=null})),or=this._picThumbUrl[C])),or}_getPictureMarker(){let C=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const Rn=document.createElement("img");return Rn.src=C?Uo:Ro,new(dl().Marker)({element:Rn})}_onSequenceHover(C){var Rn;C.preventDefault(),C.features.length>0&&null!==(Rn=C.features[0].properties)&&void 0!==Rn&&Rn.id&&this._parent.dispatchEvent(new CustomEvent("map:sequence-hover",{detail:{seqId:C.features[0].properties.id}}))}_onSequenceClick(C){var Rn;C.preventDefault(),C.features.length>0&&null!==(Rn=C.features[0].properties)&&void 0!==Rn&&Rn.id&&this._parent.dispatchEvent(new CustomEvent("map:sequence-click",{detail:{seqId:C.features[0].properties.id,coordinates:C.lngLat}}))}_onPictureClick(C){var Rn,or;C.preventDefault();const So=(null===C||void 0===C||null===(Rn=C.features)||void 0===Rn?void 0:Rn.length)>0?C.features[0]:null;if(null!==So&&void 0!==So&&null!==(or=So.properties)&&void 0!==or&&or.id){let Rn=null;try{So.properties.sequences&&(Array.isArray(So.properties.sequences)||(So.properties.sequences=JSON.parse(So.properties.sequences)),Rn=So.properties.sequences.pop())}catch(C){console.log("Sequence ID is not available in vector tiles for picture "+So.properties.id)}this._parent.dispatchEvent(new CustomEvent("map:picture-click",{detail:{picId:So.properties.id,seqId:Rn,feature:So}}))}}}},2354:(C,Rn,or)=>{"use strict";or.d(Rn,{O_:()=>ml,Se:()=>dl,ZP:()=>Photo,q7:()=>fl});or(9154);var So=or(9364),To=or(3505),Ro=or(7457),Uo=(or(1066),or(8386),or(9254),or(2825),or(3114)),Oo=or(2188),Ho=or(5856);const qo={baseUrl:So,width:1280,cols:2,rows:1,tileUrl:()=>null},dl=30,ml=250,fl=3e3;Uo.AE.useNewAnglesOrder=!0;class Photo extends Uo.AE{constructor(C,Rn){var or,So,To,Ro;let Uo=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:Rn,adapter:[Ho.Z,{showErrorTile:!1,baseBlur:!1,resolution:C.isWidthSmall()?32:64,shouldGoFast:Uo.shouldGoFast}],withCredentials:"include"==(null===(or=C._options)||void 0===or||null===(So=or.fetchOptions)||void 0===So?void 0:So.credentials),requestHeaders:null===(To=C._options)||void 0===To||null===(Ro=To.fetchOptions)||void 0===Ro?void 0:Ro.headers,panorama:qo,lang:C._t.psv,minFov:5,loadingTxt:" ",navbar:null,rendererParameters:{preserveDrawingBuffer:!C.isWidthSmall()},plugins:[[Oo.P,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}]],...Uo}),this._parent=C,Rn.classList.add("gvs-psv"),this._shouldGoFast=(null===Uo||void 0===Uo?void 0:Uo.shouldGoFast)||(()=>!1),this._transitionDuration=(null===Uo||void 0===Uo?void 0:Uo.transitionDuration)||ml,this._myVTour=this.getPlugin(Oo.P),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent()}async _getNodeFromAPI(C){var Rn,or,So;if(!C)return;const To=await fetch(this._parent._api.getPictureMetadataUrl(C,this._picturesSequences[C]),this._parent._api._getFetchOptions());let Uo=await To.json();if(Uo.features&&(Uo=Uo.features.pop()),!Uo||0===Object.keys(Uo).length||!To.ok)throw this._parent._loader&&this._parent._loader.dismiss(!0,this._parent._t.gvs.error_pic),new Error("Picture with ID "+C+" was not found");this._picturesSequences[C]=Uo.collection;const Oo=(0,Ro.FF)(Uo,this._parent._t,this._parent._isInternetFast,null===(Rn=this._parent._picturesNavFilter)||void 0===Rn?void 0:Rn.bind(this._parent));var Ho,qo;null!==Oo&&void 0!==Oo&&null!==(or=Oo.sequence)&&void 0!==or&&or.prevPic&&(this._picturesSequences[null===Oo||void 0===Oo||null===(Ho=Oo.sequence)||void 0===Ho?void 0:Ho.prevPic]=Uo.collection);null!==Oo&&void 0!==Oo&&null!==(So=Oo.sequence)&&void 0!==So&&So.nextPic&&(this._picturesSequences[null===Oo||void 0===Oo||null===(qo=Oo.sequence)||void 0===qo?void 0:qo.nextPic]=Uo.collection);return Oo}_psvNodeTransition(C,Rn,or){var So,To;let Uo={};const Oo=this._shouldGoFast()?0:Math.min(ml,this._transitionDuration),Ho=Oo>100,qo=null!=(or||(null===Rn||void 0===Rn?void 0:Rn.links.find((Rn=>Rn.nodeId==C.id)))),fl=Rn&&C.sequence.id===Rn.sequence.id,vl=((null===Rn||void 0===Rn||null===(So=Rn.properties)||void 0===So?void 0:So["view:azimuth"])||0)*(Math.PI/180),bl=((null===C||void 0===C||null===(To=C.properties)||void 0===To?void 0:To["view:azimuth"])||0)*(Math.PI/180);this.setOption("maxFov",Math.min(3*C.horizontalFov/4,90));const kl={speed:0,fadeIn:!1,rotation:!1,rotateTo:{pitch:0,yaw:0},zoomTo:dl};if(360==C.horizontalFov)Rn?(0,Ro.Sp)(Rn.gps,C.gps)>=.001?Uo=kl:(Uo={speed:Oo,fadeIn:qo&&Ho,rotation:qo&&fl&&Ho,rotateTo:this.getPosition()},Uo.rotateTo.yaw+=vl-bl):Uo=kl;else if(fl){const C=this.getPosition().yaw,or=Rn.horizontalFov*(Math.PI/180)/2,So=C<=or||C>=2*Math.PI-or,To=Math.abs(vl-bl)<=Math.PI/4;Uo={speed:Oo,fadeIn:qo&&To&&Ho,rotation:qo&&To&&Ho,rotateTo:So?this.getPosition():{pitch:0,yaw:0},zoomTo:So?this.getZoomLevel():dl}}else Uo=kl;Uo.fadeIn&&Uo.speed>=150?setTimeout(this._clearArrows,Uo.speed-100):this._clearArrows();const Ll=new CustomEvent("psv:picture-loading",{detail:{...Object.assign({},this.getXYZ(),Uo.rotateTo?{x:180*(bl+Uo.rotateTo.yaw)/Math.PI}:null,Uo.zoomTo?{z:Uo.zoomTo}:null),picId:C.id,lon:C.gps[0],lat:C.gps[1]}});return this._parent.dispatchEvent(Ll),Uo}_onEnterArrow(C){const Rn=C.link,or=C.node;let So;or&&(So=360===or.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const To=new CustomEvent("psv:picture-preview-started",{detail:{picId:Rn.nodeId,coordinates:Rn.gps,direction:So}});this._parent.dispatchEvent(To)}_onLeaveArrow(C){const Rn=C.link,or=new CustomEvent("psv:picture-preview-stopped",{detail:{picId:Rn.nodeId}});this._parent.dispatchEvent(or)}_onPositionUpdated(C){let{position:Rn}=C;const or=(0,Ro.wW)(Rn,this.getZoomLevel());or.x+=this.getPictureOriginalHeading(),or.x=or.x%360;const So=new CustomEvent("psv:view-rotated",{detail:or});this._parent.dispatchEvent(So),this._onTilesStartLoading()}_onZoomUpdated(C){let{zoomLevel:Rn}=C;const or=new CustomEvent("psv:view-rotated",{detail:{...this.getXY(),z:Rn}});this._parent.dispatchEvent(or),this._onTilesStartLoading()}_onNodeChanged(C){for(let So of document.getElementsByClassName("gvs-psv-tour-arrows"))So.classList.remove("gvs-clicked");if(C.node.id){var Rn,or;this._parent.select(null===(Rn=C.node)||void 0===Rn||null===(or=Rn.sequence)||void 0===or?void 0:or.id,C.node.id);const So=this.getPictureMetadata();if(!So)return;this._prevSequence=So.sequence.id;const To=new CustomEvent("psv:picture-loaded",{detail:{...this.getXYZ(),picId:C.node.id,lon:So.gps[0],lat:So.gps[1]}});this._parent.dispatchEvent(To),So.panorama.hdUrl?(this.setOption("downloadUrl",So.panorama.hdUrl),this.setOption("downloadName",C.node.id+".jpg")):this.setOption("downloadUrl",null)}this._onTilesStartLoading()}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const C=new Event("psv:picture-tiles-loaded",{picId:this._myVTour.state.currentNode.id});this._parent.dispatchEvent(C)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){return this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}_onSelect(C){var Rn;C.detail.seqId&&(this._picturesSequences[C.detail.picId]=C.detail.seqId),(null===(Rn=this._myVTour.getCurrentNode())||void 0===Rn?void 0:Rn.id)!==C.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(C.detail.picId).catch((C=>{this.showErrorOverlay(C,this._parent._t.gvs.error_pic,!0)})))}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const C=this.getPictureMetadata().sequence.nextPic;if(!C)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,C)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const C=this.getPictureMetadata().sequence.prevPic;if(!C)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,C)}async goToPosition(C,Rn){return this._parent._api.getPicturesAroundCoordinates(C,Rn).then((C=>{if(C.features.length>0){const Rn=C.features.pop();return this._parent.select(null===Rn||void 0===Rn?void 0:Rn.collection,Rn.id),Rn.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const C=(0,Ro.wW)(this.getPosition());return C.x=(C.x+this.getPictureOriginalHeading())%360,C}getXYZ(){const C=this.getXY();return C.z=this.getZoomLevel(),C}getPictureOriginalHeading(){var C,Rn;return(null===(C=this.getPictureMetadata())||void 0===C||null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"])||0}getPictureRelativeHeading(){return(0,Ro.r)(this.getPictureMetadata())}clearPictureMetadataCache(){var C,Rn,or,So;const To=null===(C=this.getPictureMetadata())||void 0===C?void 0:C.id,Ro=null===(Rn=this.getPictureMetadata())||void 0===Rn||null===(or=Rn.sequence)||void 0===or?void 0:or.id;null===(So=this._myVTour.state.currentTooltip)||void 0===So||So.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},To&&this._parent.select(Ro,To)}setXYZ(C,Rn,or){const So=(0,Ro.J9)(C-this.getPictureOriginalHeading(),Rn,or);this.rotate({yaw:So.yaw,pitch:So.pitch}),this.zoom(So.zoom)}setHigherContrast(C){this.renderer.renderer.toneMapping=C?3:0,this.renderer.renderer.toneMappingExposure=C?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(C){if((C=parseFloat(C))<100||C>fl)throw new Error("Invalid transition duration (should be between 100 and "+fl+")");this._transitionDuration=C;const Rn=new CustomEvent("psv:transition-duration-changed",{detail:{value:C}});this._parent.dispatchEvent(Rn)}setPanorama(C,Rn){const onFailure=C=>this.showErrorOverlay(C,this._parent._t.gvs.error_pic,!0);try{return super.setPanorama(C,Rn).catch(onFailure)}catch(or){onFailure(or)}}showErrorOverlay(C,Rn,or){this._parent._loader.isVisible()||!this.overlay.isVisible()?this._parent._loader.dismiss(C,Rn,or?()=>{this._parent._loader.dismiss(),this.overlay.hide()}:void 0):(console.error(C),this.overlay.show({image:'<img style="width: 200px" src="'.concat(To,'" />'),title:this._parent._t.gvs.error,text:Rn+"<br />"+this._parent._t.gvs.error_click,dissmisable:or}))}}},937:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>API});var So=or(3406);class API{constructor(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null===C||void 0===C||"string"!==typeof C)throw new Error("endpoint parameter is empty or not a valid string");if(C.startsWith("/")&&(C=window.location.href.split("/").slice(0,3).join("/")+C),!API.isValidHttpUrl(C))throw new Error("endpoint parameter is not a valid URL: ".concat(C));this._endpoint=C,this._isReady=0,this._dataBbox=null,this._fetchOpts=(null===Rn||void 0===Rn?void 0:Rn.fetch)||{},this._metadata={},Rn.skipReadLanding||(this._readLanding=fetch(C,this._getFetchOptions()).then((C=>C.json())).then((C=>this._parseLanding(C,Rn))).catch((C=>(this._isReady=-1,console.error(C),Promise.reject("Viewer failed to communicate with API")))).then((()=>this._loadMapStyles(Rn.style,Rn.users))).then((()=>(this._isReady=1,"API is ready"))))}onceReady(){return-1==this._isReady?Promise.reject("Viewer failed to communicate with API"):1==this._isReady?Promise.resolve("API is ready"):this._readLanding}isReady(){return 1==this._isReady}_parseLanding(C,Rn){var or,So;if(this._endpoints={collections:null,search:null,style:null,user_style:null,tiles:(null===Rn||void 0===Rn?void 0:Rn.tiles)||null,user_tiles:null,user_search:null,collection_preview:null,item_preview:null,rss:null,report:null},!C||!C.links||!Array.isArray(C.links))throw new Error("API Landing page doesn't contain 'links' list");if(!C.stac_version.startsWith("1.0"))throw new Error("API is not in a supported STAC version (Panoramax viewer supports only 1.0, API is ".concat(C.stac_version,")"));this._metadata.name=C.title||"Unnamed",this._metadata.stac_version=C.stac_version,this._metadata.geovisio_version=C.geovisio_version||"Unknown";const To=[],Ro=[];if([{rel:"search",type:"application/geo+json",endpointId:"search",mandatory:!0,missingIssue:"No direct access to pictures metadata."},{rel:"data",type:"application/json",endpointId:"collections",mandatory:!0,missingIssue:"No way for viewer to access sequences."},{rel:"data",type:"application/rss+xml",endpointId:"rss"},{rel:"xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"tiles"},{rel:"xyz-style",type:"application/json",endpointId:"style"},{rel:"user-xyz-style",type:"application/json",endpointId:"user_style"},{rel:"user-xyz",type:"application/vnd.mapbox-vector-tile",endpointId:"user_tiles"},{rel:"user-search",type:"application/json",endpointId:"user_search",missingIssue:"Filter map data by user name will not be available."},{rel:"collection-preview",type:"image/jpeg",endpointId:"collection_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"item-preview",type:"image/jpeg",endpointId:"item_preview",missingIssue:"Display of thumbnail could be slower."},{rel:"report",type:"application/json",endpointId:"report"}].forEach((Rn=>{const or=C.links.find((C=>C.rel==Rn.rel&&C.type==Rn.type));if(or){if(!API.isValidHttpUrl(or.href))throw new Error("API endpoint '".concat(or.rel,"' (").concat(or.type,") is not a valid URL: ").concat(or.href));this._endpoints[Rn.endpointId]||(this._endpoints[Rn.endpointId]=or.href)}else if(!this._endpoints[Rn.endpointId]){let C="API doesn't offer a '".concat(Rn.rel,"' (").concat(Rn.type,") endpoint in its links");Rn.missingIssue&&(C+="\n".concat(Rn.missingIssue)),Rn.mandatory?To.push(C):Rn.missingIssue&&Ro.push(C)}})),this._endpoints.style||this._endpoints.tiles||Ro.push("API doesn't offer 'xyz' or 'xyz-style' endpoints in its links.\nMap widget will not be available."),this._endpoints.user_style||this._endpoints.user_tiles||Ro.push("API doesn't offer 'user-xyz' or 'user-xyz-style' endpoints in its links.\nFilter map data by user ID will not be available."),Ro.forEach((C=>console.warn(C))),To.length>0)throw new Error(To.join("\n"));const Uo=null===C||void 0===C||null===(or=C.extent)||void 0===or||null===(So=or.spatial)||void 0===So?void 0:So.bbox;this._dataBbox=Uo&&Array.isArray(Uo)&&Uo.length>0&&Array.isArray(Uo[0])&&4===Uo[0].length?[[Uo[0][0],Uo[0][1]],[Uo[0][2],Uo[0][3]]]:null}_loadMapStyles(C,Rn){const or=new Set(Rn||[]);this.mapStyle={version:8,sources:{},layers:[]};const So=[this.getMapStyle()];if("string"===typeof C){const Rn=C.startsWith(this._endpoint)?this._getFetchOptions():void 0;So.push(fetch(C,Rn).then((C=>C.json())))}else"object"===typeof C&&So.push(Promise.resolve(C));return[...or].filter((C=>"geovisio"!==C)).forEach((C=>{So.push(this.getUserMapStyle(C,!0))})),Promise.all(So).then((C=>{const Rn=["bearing","center","glyphs","light","metadata","name","pitch","sky","sprite","terrain","transition","zoom"];C.forEach((C=>{Rn.forEach((Rn=>{C[Rn]&&(this.mapStyle[Rn]=C[Rn]||this.mapStyle[Rn])})),Object.assign(this.mapStyle.sources,(null===C||void 0===C?void 0:C.sources)||{}),this.mapStyle.layers=this.mapStyle.layers.concat((null===C||void 0===C?void 0:C.layers)||[])}))})).catch((C=>console.error(C)))}_getFetchOptions(){return Object.assign({},this._fetchOpts)}_getMapRequestTransform(){if(Object.keys(this._getFetchOptions()).length>0)return C=>{if(C.startsWith(this._endpoint))return{url:C,...this._getFetchOptions()}}}async getSequenceItems(C){if(!this.isReady())throw new Error("API is not ready to use");try{return API.isIdValid(C),fetch("".concat(this._endpoints.collections,"/").concat(C,"/items"),this._getFetchOptions()).then((C=>C.json()))}catch(Rn){return Promise.reject(Rn)}}getPicturesAroundCoordinatesUrl(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e-4,So=arguments.length>3?arguments[3]:void 0,To=arguments.length>4?arguments[4]:void 0;if(!this.isReady())throw new Error("API is not ready to use");if(isNaN(parseFloat(C))||isNaN(parseFloat(Rn)))throw new Error("lat and lon parameters should be valid numbers");const Ro=[Rn-or,C-or,Rn+or,C+or].map((C=>C.toFixed(4))).join(","),Uo=So?"&limit=".concat(So):"",Oo=To?"&collections=".concat(To):"";return"".concat(this._endpoints.search,"?bbox=").concat(Ro).concat(Uo).concat(Oo)}getPicturesAroundCoordinates(C,Rn,or,So,To){return fetch(this.getPicturesAroundCoordinatesUrl(C,Rn,or,So,To),this._getFetchOptions()).then((C=>C.json()))}getPictureMetadataUrl(C,Rn){if(!this.isReady())throw new Error("API is not ready to use");if(API.isIdValid(C))return Rn?"".concat(this._endpoints.collections,"/").concat(Rn,"/items/").concat(C):"".concat(this._endpoints.search,"?ids=").concat(C)}getMapStyle(){if(this.isReady())return this.mapStyle;let C;return C=this._endpoints.style?this._endpoints.style:this._endpoints.tiles?{version:8,sources:{geovisio:{type:"vector",tiles:[this._endpoints.tiles],minzoom:0,maxzoom:So.Lh}}}:fetch("".concat(this._endpoint,"/map/14/0/0.mvt"),this._getFetchOptions()).then((()=>(this._endpoints.tiles="".concat(this._endpoint,"/map/{z}/{x}/{y}.mvt"),console.log("Using fallback endpoint for vector tiles"),this.getMapStyle()))).catch((C=>(console.error(C),Promise.reject(new Error("API doesn't offer a vector tiles endpoint"))))),"string"===typeof C?fetch(C,this._getFetchOptions()).then((C=>C.json())):Promise.resolve(C)}getUserMapStyle(C){let Rn;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]||this.isReady()?C?(this._endpoints.user_style?Rn=this._endpoints.user_style.replace(/\{userId\}/g,C):this._endpoints.user_tiles&&(Rn={version:8,sources:{["geovisio_".concat(C)]:{type:"vector",tiles:[this._endpoints.user_tiles.replace(/\{userId\}/g,C)],minzoom:0,maxzoom:So.Lh}}}),Rn?"string"===typeof Rn?fetch(Rn,this._getFetchOptions()).then((C=>C.json())):Promise.resolve(Rn):Promise.reject(new Error("API doesn't offer map style for specific user"))):Promise.reject(new Error("Parameter userId is empty")):Promise.reject(new Error("API is not ready to use"))}findThumbnailInPictureFeature(C){if(!this.isReady())throw new Error("API is not ready to use");if(!C||!C.assets)return null;let Rn=null;for(let or of Object.values(C.assets)){if(or.roles.includes("thumbnail")&&"image/jpeg"==or.type&&API.isValidHttpUrl(or.href))return or.href;or.roles.includes("visual")&&"image/jpeg"==or.type&&API.isValidHttpUrl(or.href)&&(Rn=or.href)}return Rn}getPictureThumbnailURLForSequence(C,Rn){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.collection_preview)return Promise.resolve(this._endpoints.collection_preview.replace("{id}",C));if(Rn&&Array.isArray(Rn.links)&&Rn.links.length>0){let C=Rn.links.find((C=>"preview"===C.rel&&"image/jpeg"===C.type));if(C&&API.isValidHttpUrl(C.href))return Promise.resolve(C.href)}const or="".concat(this._endpoints.search,"?limit=1&collections=").concat(C);return fetch(or,this._getFetchOptions()).then((C=>C.json())).then((C=>Array.isArray(C.features)&&0!=C.features.length?this.findThumbnailInPictureFeature(C.features.pop()):null))}getPictureThumbnailURL(C,Rn){if(!this.isReady())throw new Error("API is not ready to use");return C?this._endpoints.item_preview?Promise.resolve(this._endpoints.item_preview.replace("{id}",C)):C&&Rn?fetch("".concat(this._endpoints.collections,"/").concat(Rn,"/items/").concat(C),this._getFetchOptions()).then((C=>C.json())).then((C=>C?this.findThumbnailInPictureFeature(C):null)):fetch("".concat(this._endpoints.search,"?ids=").concat(C),this._getFetchOptions()).then((C=>C.json())).then((C=>C&&Array.isArray(C.features)&&0!=C.features.length?this.findThumbnailInPictureFeature(C.features.pop()):null)):Promise.resolve(null)}getRSSURL(C){if(!this.isReady())throw new Error("API is not ready to use");if(this._endpoints.rss){let Rn=this._endpoints.rss;return C&&(Rn+=Rn.includes("?")?"&":"?",Rn+="bbox="+[C.getWest(),C.getSouth(),C.getEast(),C.getNorth()].join(",")),Rn}return null}getSequenceMetadataUrl(C){if(!this.isReady())throw new Error("API is not ready to use");return"".concat(this._endpoints.collections,"/").concat(C)}getDataBbox(){if(!this.isReady())throw new Error("API is not ready to use");return this._dataBbox}searchUsers(C){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch("".concat(this._endpoints.user_search,"?q=").concat(C),this._getFetchOptions()).then((C=>C.json())).then((C=>(null===C||void 0===C?void 0:C.features)||null))}getUserName(C){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.user_search)throw new Error("User search is not available");return fetch(this._endpoints.user_search.replace(/\/search$/,"/".concat(C)),this._getFetchOptions()).then((C=>C.json())).then((C=>(null===C||void 0===C?void 0:C.name)||null))}sendReport(C){if(!this.isReady())throw new Error("API is not ready to use");if(!this._endpoints.report)throw new Error("Report sending is not available");const Rn={...this._getFetchOptions(),method:"POST",body:JSON.stringify(C),headers:{"Content-Type":"application/json"}};return fetch(this._endpoints.report,Rn).then((async C=>{if(C.status>=400){let or=await C.text();try{or=JSON.parse(or).message}catch(Rn){}return Promise.reject(or)}return C.json()}))}static isValidHttpUrl(C){let Rn;try{Rn=new URL(C)}catch(or){return!1}return"http:"===Rn.protocol||"https:"===Rn.protocol}static isIdValid(C){if(!C||"string"!==typeof C||0===C.length)throw new Error("id should be a valid picture unique identifier");return!0}}},8139:(C,Rn,or)=>{"use strict";function getExifFloat(C){if(!([null,void 0,""].includes(C)||"string"===typeof C&&""===C.trim())){if("number"===typeof C)return C;if("string"!==typeof C);else{if(/^-?\d+(\.\d+)?\/-?\d+(\.\d+)?$/.test(C)){const Rn=C.split("/").map((C=>parseFloat(C)));return Rn[0]/Rn[1]}try{return parseFloat(C)}catch(Rn){}}}}function getGPSPrecision(C){var Rn,or,So,To;let Ro="unknown";const Uo=getExifFloat(null===C||void 0===C||null===(Rn=C.properties)||void 0===Rn||null===(or=Rn.exif)||void 0===or?void 0:or["Exif.GPSInfo.GPSHPositioningError"]),Oo=getExifFloat(null===C||void 0===C||null===(So=C.properties)||void 0===So||null===(To=So.exif)||void 0===To?void 0:To["Exif.GPSInfo.GPSDOP"]);return void 0!==Uo?Ro=Uo<.5?"ideal":Uo<1?"excellent":Uo<3?"good":Uo<7?"moderate":Uo<10?"fair":"poor":void 0!==Oo&&(Ro=Oo<1?"ideal":Oo<2?"excellent":Oo<5?"good":Oo<10?"moderate":Oo<20?"fair":"poor"),Ro}function getSphereCorrection(C){var Rn,or,So,To;let Ro=null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"];if(void 0===Ro){var Uo,Oo;const Rn=getExifFloat(null===(Uo=C.properties)||void 0===Uo||null===(Oo=Uo.exif)||void 0===Oo?void 0:Oo["Exif.GPSInfo.GPSImgDirection"]);void 0!==Rn&&(Ro=Rn)}Ro=Ro||0;let Ho=null===(or=C.properties)||void 0===or?void 0:or["pers:yaw"],qo=["Xmp.GPano.PoseHeadingDegrees","Xmp.Camera.Yaw","Exif.MpfInfo.MPFYawAngle"];if(void 0===Ho)for(let Nc of qo){var dl,ml;const Rn=getExifFloat(null===(dl=C.properties)||void 0===dl||null===(ml=dl.exif)||void 0===ml?void 0:ml[Nc]);if(void 0!==Rn){Ho=Rn;break}}Ho=Ho||0,Math.round(Ro)===Math.round(Ho)&&Ho>0&&console.warn("Picture with UUID",C.id,"has same GPS Image direction and Yaw, could cause rendering issues");let fl=null===(So=C.properties)||void 0===So?void 0:So["pers:pitch"];if(qo=["Xmp.GPano.PosePitchDegrees","Xmp.Camera.Pitch","Exif.MpfInfo.MPFPitchAngle"],void 0===fl)for(let Nc of qo){var vl,bl;const Rn=getExifFloat(null===(vl=C.properties)||void 0===vl||null===(bl=vl.exif)||void 0===bl?void 0:bl[Nc]);if(void 0!==Rn){fl=Rn;break}}fl=fl||0;let kl=null===(To=C.properties)||void 0===To?void 0:To["pers:roll"];if(qo=["Xmp.GPano.PoseRollDegrees","Xmp.Camera.Roll","Exif.MpfInfo.MPFRollAngle"],void 0===kl)for(let Nc of qo){var Ll,Dl;const Rn=getExifFloat(null===(Ll=C.properties)||void 0===Ll||null===(Dl=Ll.exif)||void 0===Dl?void 0:Dl[Nc]);if(void 0!==Rn){kl=Rn;break}}return kl=kl||0,{pan:Ho*Math.PI/180,tilt:fl*Math.PI/180,roll:kl*Math.PI/180}}function getCroppedPanoData(C){var Rn,or;let So;var To,Ro;if(null!==(Rn=C.properties)&&void 0!==Rn&&Rn["pers:interior_orientation"]&&(null!==(To=C.properties["pers:interior_orientation"])&&void 0!==To&&To.visible_area&&null!==(Ro=C.properties["pers:interior_orientation"])&&void 0!==Ro&&Ro.sensor_array_dimensions)){const Rn=C.properties["pers:interior_orientation"].visible_area,or=C.properties["pers:interior_orientation"].sensor_array_dimensions;try{So={fullWidth:parseInt(or[0]),fullHeight:parseInt(or[1]),croppedX:parseInt(Rn[0]),croppedY:parseInt(Rn[1]),croppedWidth:parseInt(or[0])-parseInt(Rn[2])-parseInt(Rn[0]),croppedHeight:parseInt(or[1])-parseInt(Rn[3])-parseInt(Rn[1])}}catch(fl){console.warn("Invalid pers:interior_orientation values for cropped panorama "+C.id)}}if(!So&&null!==(or=C.properties)&&void 0!==or&&or.exif)try{var Uo,Oo,Ho,qo,dl,ml;So={fullWidth:parseInt(null===(Uo=C.properties.exif)||void 0===Uo?void 0:Uo["Xmp.GPano.FullPanoWidthPixels"]),fullHeight:parseInt(null===(Oo=C.properties.exif)||void 0===Oo?void 0:Oo["Xmp.GPano.FullPanoHeightPixels"]),croppedX:parseInt(null===(Ho=C.properties.exif)||void 0===Ho?void 0:Ho["Xmp.GPano.CroppedAreaLeftPixels"]),croppedY:parseInt(null===(qo=C.properties.exif)||void 0===qo?void 0:qo["Xmp.GPano.CroppedAreaTopPixels"]),croppedWidth:parseInt(null===(dl=C.properties.exif)||void 0===dl?void 0:dl["Xmp.GPano.CroppedAreaImageWidthPixels"]),croppedHeight:parseInt(null===(ml=C.properties.exif)||void 0===ml?void 0:ml["Xmp.GPano.CroppedAreaImageHeightPixels"])}}catch(fl){console.warn("Invalid XMP.GPano values for cropped panorama "+C.id)}return So&&(So=Object.fromEntries(Object.entries(So||{}).filter((C=>!isNaN(C[1])))),So.fullWidth==So.croppedWidth&&So.fullHeight==So.croppedHeight&&(So={})),So||{}}or.d(Rn,{Cf:()=>getSphereCorrection,Z1:()=>getCroppedPanoData,j$:()=>getGPSPrecision})},7586:(C,Rn,or)=>{"use strict";or.d(Rn,{F:()=>getTranslations});var So=or(3517),To=or(1700),Ro=or(6980),Uo=or(6493),Oo=or(6254),Ho=or(1392);const qo={de:So,en:To,es:Ro,fr:Uo,hu:Oo,zh_Hant:Ho},autoDetectLocale=()=>{for(const C of window.navigator.languages){let Rn=C;switch(Rn){case"zh-TW":case"zh-HK":case"zh-MO":Rn="zh_Hant";break;case"zh-CN":case"zh-SG":Rn="zh_Hans";break;default:Rn.length>2&&(Rn=C.substring(0,2))}const or=Object.entries(qo).find((C=>C[0]===Rn));if(or)return or[0]}return"en"};function getTranslations(){let C=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const Rn=JSON.parse(JSON.stringify(To));let or;if(C||(C=autoDetectLocale()),qo[C]&&"en"!==C&&(or=qo[C]),C.length>2){const Rn=C.substring(0,2);qo[Rn]&&(or=qo[Rn])}return or&&Object.entries(or).forEach((C=>{let[or,So]=C;Object.assign(Rn[or],So)})),Rn}},3406:(C,Rn,or)=>{"use strict";or.d(Rn,{Ec:()=>combineStyles,FS:()=>getMissingLayerStyles,Lh:()=>qo,RF:()=>isLabelLayer,Ws:()=>Ho,eY:()=>getUserSourceId,g8:()=>forwardGeocodingNominatim,lg:()=>dl,lh:()=>getUserLayerId,sl:()=>getThumbGif,uD:()=>forwardGeocodingBAN,wL:()=>Oo});var So=or(4307),To=or.n(So),Ro=or(9836),Uo=or(7457);const Oo="https://panoramax.openstreetmap.fr/pmtiles/basic.json",Ho="gvs-aerial",qo=15,dl={PICTURES:{paint:{"circle-radius":["interpolate",["linear"],["zoom"],qo,4.5,18,6,24,12],"circle-opacity":["interpolate",["linear"],["zoom"],qo,0,qo+1,1],"circle-stroke-color":"#ffffff","circle-stroke-width":["interpolate",["linear"],["zoom"],qo+1,0,qo+2,1,18,1.5,24,3]},layout:{}},PICTURES_SYMBOLS:{paint:{"icon-opacity":["interpolate",["linear"],["zoom"],18,0,19,1]},layout:{"icon-image":["case",["==",["get","type"],"equirectangular"],"gvs-arrow-360","gvs-arrow-flat"],"icon-size":["interpolate",["linear"],["zoom"],18,.5,24,1],"icon-rotate":["to-number",["get","heading"]],"icon-allow-overlap":!0}},SEQUENCES:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,.5,10,2,14,4,16,5,22,3]},layout:{"line-cap":"square"}},SEQUENCES_PLUS:{paint:{"line-width":["interpolate",["linear"],["zoom"],0,15,qo+1,30,qo+2,0],"line-opacity":0,"line-color":"#ff0000"},layout:{"line-cap":"square"}}};function getThumbGif(C){const Rn=document.createElement("img");return Rn.src=Ro,Rn.alt=C.loading,Rn.title=C.loading,Rn.classList.add("gvs-map-thumb","gvs-map-thumb-loader"),Rn}function isLabelLayer(C){var Rn;return"symbol"===C.type&&(null===C||void 0===C||null===(Rn=C.layout)||void 0===Rn?void 0:Rn["text-field"])&&(void 0===C.minzoom||C.minzoom<15)}function combineStyles(C,Rn){var or,So;const To=C._api.getMapStyle();return To.layers=To.layers.concat(getMissingLayerStyles(To.sources,To.layers)),Rn.supplementaryStyle&&(Object.assign(To.sources,Rn.supplementaryStyle.sources||{}),To.layers=To.layers.concat(Rn.supplementaryStyle.layers||[])),Rn.raster&&(To.sources["gvs-aerial"]=Rn.raster,To.layers.push({id:Ho,type:"raster",source:"gvs-aerial",layout:{visibility:"aerial"===Rn.background?"visible":"none"}})),null!==(or=C._options)&&void 0!==or&&null!==(So=or.users)&&void 0!==So&&So.includes("geovisio")||To.layers.forEach((C=>{"geovisio"===C.source&&(C.layout||(C.layout={}),C.layout.visibility="none")})),To.layers.sort(((C,Rn)=>isLabelLayer(C)&&!isLabelLayer(Rn)?1:!isLabelLayer(C)&&isLabelLayer(Rn)?-1:C.id.startsWith("geovisio")&&!Rn.id.startsWith("geovisio")?1:!C.id.startsWith("geovisio")&&Rn.id.startsWith("geovisio")?-1:C.id.endsWith("_pictures")&&!Rn.id.endsWith("_pictures")?1:!C.id.endsWith("_pictures")&&Rn.id.endsWith("_pictures")?-1:0)),To}function getMissingLayerStyles(C,Rn){const or=[];return Object.keys(C).filter((C=>void 0===Rn.find((Rn=>(null===Rn||void 0===Rn?void 0:Rn.source)===C)))).forEach((C=>{C.startsWith("geovisio")&&(or.push({id:"".concat(C,"_sequences"),type:"line",source:C,"source-layer":"sequences",layout:{...dl.SEQUENCES.layout},paint:{...dl.SEQUENCES.paint,"line-color":Uo.DM.BASE}}),or.push({id:"".concat(C,"_sequences_plus"),type:"line",source:C,"source-layer":"sequences",layout:{...dl.SEQUENCES_PLUS.layout},paint:{...dl.SEQUENCES_PLUS.paint}}),or.push({id:"".concat(C,"_pictures_symbols"),type:"symbol",source:C,"source-layer":"pictures",...dl.PICTURES_SYMBOLS}),or.push({id:"".concat(C,"_pictures_symbols"),type:"symbol",source:C,"source-layer":"pictures",...dl.PICTURES_SYMBOLS}),or.push({id:"".concat(C,"_pictures"),type:"circle",source:C,"source-layer":"pictures",layout:{...dl.PICTURES.layout},paint:{...dl.PICTURES.paint,"circle-color":Uo.DM.BASE}}))})),Rn.filter((C=>{var or;return(null===C||void 0===C||null===(or=C.id)||void 0===or?void 0:or.endsWith("_sequences"))&&void 0===Rn.find((Rn=>(null===Rn||void 0===Rn?void 0:Rn.id)===C.id+"_plus"))})).forEach((C=>{or.push({id:"".concat(C.id,"_plus"),type:"line",source:C.source,"source-layer":C["source-layer"],layout:{...dl.SEQUENCES_PLUS.layout},paint:{...dl.SEQUENCES_PLUS.paint}})})),Rn.filter((C=>{var or;return(null===C||void 0===C||null===(or=C.id)||void 0===or?void 0:or.endsWith("_pictures"))&&void 0===Rn.find((Rn=>(null===Rn||void 0===Rn?void 0:Rn.id)===C.id+"_symbols"))})).forEach((C=>{or.unshift({id:"".concat(C.id,"_symbols"),type:"symbol",source:C.source,"source-layer":"pictures",...dl.PICTURES_SYMBOLS}),C.paint=Object.assign(C.paint||{},dl.PICTURES.paint),C.layout=Object.assign(C.layout||{},dl.PICTURES.layout)})),or}function getUserLayerId(C,Rn){return"".concat(getUserSourceId(C),"_").concat(Rn)}function getUserSourceId(C){return"geovisio"===C?"geovisio":"geovisio_"+C}function geocoderParamsToURLString(C){let Rn={};return Object.entries(C).filter((C=>void 0!==C[1]&&null!==C[1])).forEach((C=>Rn[C[0]]=C[1])),new URLSearchParams(Rn).toString()}function forwardGeocodingNominatim(C){const Rn={q:C.query,countrycodes:C.countries,limit:C.limit,viewbox:C.bbox};return fetch("https://nominatim.openstreetmap.org/search?".concat(geocoderParamsToURLString(Rn),"&format=geojson&polygon_geojson=1&addressdetails=1")).then((C=>C.json())).then((C=>{const Rn={features:[]},or=[];return C.features.forEach((C=>{or.includes(C.properties.display_name)||(Rn.features.push({place_type:["place"],place_name:C.properties.display_name,bounds:new(To().LngLatBounds)(C.bbox)}),or.push(C.properties.display_name))})),Rn}))}function forwardGeocodingBAN(C){const Rn={q:C.query,limit:C.limit};if("string"===typeof C.proximity){const[or,So]=C.proximity.split(",").map((C=>parseFloat(C.trim())));Rn.lat=or,Rn.lon=So}const or={housenumber:20,street:18,locality:15,municipality:12};return fetch("https://api-adresse.data.gouv.fr/search/?".concat(geocoderParamsToURLString(Rn))).then((C=>C.json())).then((C=>(C.features=C.features.map((C=>{return{place_type:["place"],place_name:(Rn=C.properties,[Rn.name,Rn.district,Rn.city].filter((C=>C)).join(", ")),center:new(To().LngLat)(...C.geometry.coordinates),zoom:or[C.properties.type]};var Rn})),C)))}},5856:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>PhotoAdapter});var So=or(9771);class PhotoAdapter extends So.k{constructor(C,Rn){super(C,Rn),this._shouldGoFast=Rn.shouldGoFast||(()=>!0)}loadTexture(C,Rn){return C.origBaseUrl?C.baseUrl=C.origBaseUrl:C.origBaseUrl=C.baseUrl,this._shouldGoFast()&&C.thumbUrl&&!C.hdLoaded&&1==C.rows&&(C.baseUrl=C.thumbUrl),super.loadTexture(C,Rn).then((Rn=>(C.baseUrl===C.origBaseUrl&&(C.hdLoaded=!0),Rn)))}__loadTiles(C){this._shouldGoFast()||super.__loadTiles(C)}}},7457:(C,Rn,or)=>{"use strict";or.d(Rn,{DM:()=>Uo,EF:()=>isInternetFast,FF:()=>apiFeatureToPSVNode,Iu:()=>josmBboxParameters,J9:()=>xyzToPosition,Sp:()=>getDistance,bk:()=>linkMapAndPhoto,iE:()=>getUserAccount,r:()=>getRelativeHeading,wW:()=>positionToXYZ,zd:()=>isInIframe});var So=or(8139),To=or(9341),Ro=or(2893);const Uo={BASE:"#FF6F00",SELECTED:"#1E88E5",HIDDEN:"#34495E",NEXT:"#ffab40",QUALI_1:"#00695C",QUALI_2:"#fd8d3c",PALETTE_1:"#fecc5c",PALETTE_2:"#fd8d3c",PALETTE_3:"#f03b20",PALETTE_4:"#bd0026"},Oo=(Object.fromEntries(Object.entries(Uo).map((C=>(C[1]=parseInt(C[1].slice(1),16),C)))),svgToPSVLink(To,"white")),Ho=svgToPSVLink(Ro,Uo.NEXT);function getDistance(C,Rn){const or=C[0]-Rn[0],So=C[1]-Rn[1];return Math.sqrt(or*or+So*So)}function sortPicturesInDirection(C){return(Rn,or)=>"related"!=Rn.rel&&"related"!=or.rel?0:"related"!=Rn.rel?-1:"related"!=or.rel?1:Rn.date==or.date?getDistance(C,Rn.geometry.coordinates)-getDistance(C,or.geometry.coordinates):or.date.localeCompare(Rn.date)}function svgToPSVLink(C,Rn){try{const or=atob(C.replace(/^data:image\/svg\+xml;base64,/,"")),So=(new DOMParser).parseFromString(or,"image/svg+xml").childNodes[0],To=document.createElement("button");return To.appendChild(So),To.classList.add("gvs-psv-tour-arrows"),To.style.color=Rn,To}catch(or){const Rn=document.createElement("img");return Rn.src=C,Rn}}function getArrow(C){const Rn=C.cloneNode(!0);return Rn.addEventListener("pointerup",(()=>Rn.classList.add("gvs-clicked"))),Rn}function getAzimuth(C,Rn){return(Math.atan2(Rn[0]-C[0],Rn[1]-C[1])*(180/Math.PI)+360)%360}function getRelativeHeading(C){var Rn,or;if(!C)throw new Error("No picture selected");let So,To;const Ro=C.properties["view:azimuth"];if(null!==C&&void 0!==C&&null!==(Rn=C.sequence)&&void 0!==Rn&&Rn.prevPic){var Uo;const Rn=null===C||void 0===C||null===(Uo=C.links)||void 0===Uo?void 0:Uo.find((Rn=>Rn.nodeId===C.sequence.prevPic));Rn&&(So=(Ro-getAzimuth(Rn.gps,C.gps)+180)%360-180)}if(null!==C&&void 0!==C&&null!==(or=C.sequence)&&void 0!==or&&or.nextPic){var Oo;const Rn=null===C||void 0===C||null===(Oo=C.links)||void 0===Oo?void 0:Oo.find((Rn=>Rn.nodeId===C.sequence.nextPic));Rn&&(To=(Ro-getAzimuth(C.gps,Rn.gps)+180)%360-180)}return void 0!==So?So:void 0!==To?To:0}function getSimplifiedAngle(C,Rn){const or=Math.atan2(Rn[0]-C[0],Rn[1]-C[1])*(180/Math.PI);return Math.abs(or)<30?"N":or>=30&&or<90?"ENE":or>=90&&or<150?"ESE":Math.abs(or)>=150?"S":or<=-30&&or>-90?"WNW":or<=-90&&or>-150?"WSW":void 0}function positionToXYZ(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const or={x:C.yaw*(180/Math.PI),y:C.pitch*(180/Math.PI)};return void 0!==Rn&&(or.z=Rn),or}function xyzToPosition(C,Rn,or){return{yaw:C/(180/Math.PI),pitch:Rn/(180/Math.PI),zoom:or}}function getNodeCaption(C,Rn){var or,So,To;const Ro={};if(null!==C&&void 0!==C&&null!==(or=C.properties)&&void 0!==or&&or.datetimetz?Ro.date=new Date(C.properties.datetimetz):null!==C&&void 0!==C&&null!==(So=C.properties)&&void 0!==So&&So.datetime&&(Ro.date=new Date(C.properties.datetime)),null!==C&&void 0!==C&&C.providers){var Uo;const Rn=null===C||void 0===C||null===(Uo=C.providers)||void 0===Uo?void 0:Uo.filter((C=>{var Rn;return null===C||void 0===C||null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("producer")}));if((null===Rn||void 0===Rn?void 0:Rn.length)>=0){const C={};Rn.map((C=>C.name)).forEach((Rn=>{const or=Rn.toLowerCase().replace(/\s/g,"");C[or]?C[or].push(Rn):C[or]=[Rn]})),Ro.producer=[],Object.values(C).forEach((C=>{const Rn=C[0],or=C.find((C=>C.toLowerCase()!=C));Ro.producer.push(or||Rn)})),Ro.producer=Ro.producer.join(", ")}}if(null!==C&&void 0!==C&&null!==(To=C.properties)&&void 0!==To&&To.license&&(Ro.license=C.properties.license,null!==C&&void 0!==C&&C.links)){const or=C.links.find((C=>"license"===(null===C||void 0===C?void 0:C.rel)));or&&(Ro.license='<a href="'.concat(or.href,'" title="').concat(Rn.gvs.metadata_general_license_link,'" target="_blank">').concat(Ro.license,"</a>"))}return Ro}function linkMapAndPhoto(C){const onPicLoad=Rn=>C.map.displayPictureMarker(Rn.detail.lon,Rn.detail.lat,C.psv.getXY().x);C.addEventListener("psv:picture-loading",onPicLoad),C.addEventListener("psv:picture-loaded",onPicLoad),C.addEventListener("psv:view-rotated",(()=>{let Rn=C.psv.getPosition().yaw*(180/Math.PI);Rn+=C.psv.getPictureOriginalHeading(),C.map._picMarker.setRotation(Rn)})),C.addEventListener("psv:picture-preview-started",(Rn=>{C.map._picMarkerPreview.setLngLat(Rn.detail.coordinates).setRotation(Rn.detail.direction||0).addTo(C.map)})),C.addEventListener("psv:picture-preview-stopped",(()=>{C.map._picMarkerPreview.remove()})),C.addEventListener("psv:picture-loaded",(Rn=>{C.isWidthSmall()&&C._picPopup&&Rn.detail.picId==C._picPopup._picId&&C._picPopup.remove()})),C.addEventListener("map:picture-click",(Rn=>{C.select(Rn.detail.seqId,Rn.detail.picId),!C.psv._myVTour.state.currentNode&&null!==C&&void 0!==C&&C.setFocus&&C.setFocus("pic")})),C.addEventListener("map:sequence-click",(Rn=>{C._api.getPicturesAroundCoordinates(Rn.detail.coordinates.lat,Rn.detail.coordinates.lng,1,1,Rn.detail.seqId).then((Rn=>{var or,So;(null===Rn||void 0===Rn||null===(or=Rn.features)||void 0===or?void 0:or.length)>0&&(C.select(null===(So=Rn.features[0])||void 0===So?void 0:So.collection,Rn.features[0].id),!C.psv.getPictureMetadata()&&null!==C&&void 0!==C&&C.setFocus&&C.setFocus("pic"))}))}))}function apiFeatureToPSVNode(C,Rn){var or,To,Ro,Uo,Oo,Ho,qo;let dl=arguments.length>2&&void 0!==arguments[2]&&arguments[2],ml=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const fl=null!=(null===(or=C.properties)||void 0===or||null===(To=or["pers:interior_orientation"])||void 0===To?void 0:To.field_of_view);let vl=fl?parseInt(C.properties["pers:interior_orientation"].field_of_view):70;const bl=360===vl,kl=(Object.values(C.assets).find((C=>{var Rn;return null===C||void 0===C||null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("data")}))||{}).href,Ll=null===C||void 0===C||null===(Ro=C.properties)||void 0===Ro||null===(Uo=Ro["tiles:tile_matrix_sets"])||void 0===Uo?void 0:Uo.geovisio,Dl=C.links.find((C=>"prev"===(null===C||void 0===C?void 0:C.rel)&&"application/geo+json"===(null===C||void 0===C?void 0:C.type))),Nc=C.links.find((C=>"next"===(null===C||void 0===C?void 0:C.rel)&&"application/geo+json"===(null===C||void 0===C?void 0:C.type))),jc=Object.values(C.assets).find((C=>{var Rn;return(null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("visual"))&&"image/webp"===C.type})),Zc=Object.values(C.assets).find((C=>{var Rn;return(null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("visual"))&&"image/jpeg"===C.type})),eu=(jc||Zc).href,Ku=null===(Oo=Object.values(C.assets).find((C=>{var Rn;return(null===(Rn=C.roles)||void 0===Rn?void 0:Rn.includes("thumbnail"))&&"image/jpeg"===C.type})))||void 0===Oo?void 0:Oo.href,Yu=(null===C||void 0===C||null===(Ho=C.asset_templates)||void 0===Ho?void 0:Ho.tiles_webp)||(null===C||void 0===C||null===(qo=C.asset_templates)||void 0===qo?void 0:qo.tiles),Eh=(0,So.Z1)(C);let Th;return Th=Object.keys(Eh).length>0?{baseUrl:dl?kl:eu,origBaseUrl:dl?kl:eu,hdUrl:kl,thumbUrl:Ku,basePanoData:Eh,cols:2,rows:1,width:2,tileUrl:()=>null}:bl?{baseUrl:eu,origBaseUrl:eu,basePanoData:C=>({fullWidth:C.width,fullHeight:C.height}),hdUrl:kl,thumbUrl:Ku,cols:Ll&&Ll.tileMatrix[0].matrixWidth,rows:Ll&&Ll.tileMatrix[0].matrixHeight,width:Ll&&Ll.tileMatrix[0].matrixWidth*Ll.tileMatrix[0].tileWidth,tileUrl:Ll&&((C,Rn)=>Yu.href.replace(/\{TileCol\}/g,C).replace(/\{TileRow\}/g,Rn))}:{baseUrl:dl?kl:eu,origBaseUrl:dl?kl:eu,hdUrl:kl,thumbUrl:Ku,basePanoData:C=>{C.width<C.height&&!fl&&(vl=35);const Rn=vl*C.height/C.width,or=360*C.width/vl,So=180*C.height/Rn;return{fullWidth:or,fullHeight:So,croppedWidth:C.width,croppedHeight:C.height,croppedX:(or-C.width)/2,croppedY:(So-C.height)/2}},cols:2,rows:1,width:2,tileUrl:()=>null},{id:C.id,caption:getNodeCaption(C,Rn),panorama:Th,links:filterRelatedPicsLinks(C,ml),gps:C.geometry.coordinates,sequence:{id:C.collection,nextPic:Nc?Nc.id:void 0,prevPic:Dl?Dl.id:void 0},sphereCorrection:(0,So.Cf)(C),horizontalFov:vl,properties:C.properties}}function filterRelatedPicsLinks(C){var Rn;let or=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const So=C.links.filter((C=>["next","prev","related"].includes(null===C||void 0===C?void 0:C.rel)&&"application/geo+json"===(null===C||void 0===C?void 0:C.type))).filter((C=>!or||or(C))).map((C=>(C.datetime&&(C.date=C.datetime.split("T")[0]),C))),To=C.geometry.coordinates,Ro=[],Uo={N:[],ENE:[],ESE:[],S:[],WSW:[],WNW:[]};for(let Oo of So){Uo[getSimplifiedAngle(To,Oo.geometry.coordinates)].push(Oo)}for(let Oo in Uo){const C=Uo[Oo];0!=C.length&&(C.sort(sortPicturesInDirection(To)),Ro.push(C.shift()))}let arrowStyle=C=>"related"===C.rel?{element:getArrow(Ho),size:{width:128/3,height:128}}:{element:getArrow(Oo),size:{width:75,height:75}};const qo=-((null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"])||0)*(Math.PI/180);return Ro.map((C=>({nodeId:C.id,gps:C.geometry.coordinates,arrowStyle:arrowStyle(C),linkOffset:{yaw:qo}})))}function josmBboxParameters(C){if(C){var Rn;const or=C.gps,So=null===C||void 0===C||null===(Rn=C.properties)||void 0===Rn?void 0:Rn["view:azimuth"],To=2e-4,Ro={left:or[0]-(null===So||So>=180?To:0),right:or[0]+(null===So||So<=180?To:0),top:or[1]+(null===So||So<=90||So>=270?To:0),bottom:or[1]-(null===So||So>=90&&So<=270?To:0),changeset_source:"Panoramax"};return Object.entries(Ro).map((C=>C.join("="))).join("&")}return null}function isInIframe(){try{return window.self!==window.top}catch(C){return!0}}const qo=10,dl="gvs-internet-fast",ml="https://panoramax.openstreetmap.fr/images/05/ca/2c/98/0111-4baf-b6f3-587bb8847d2e.jpg";function isInternetFast(){try{const C=navigator.connection.downlink;return Promise.resolve(C>=qo)}catch(C){const Rn=sessionStorage.getItem(dl);if(["true","false"].includes(Rn))return Promise.resolve("true"===Rn);const or=(new Date).getTime();return fetch(ml+"?nocache="+or).then((async C=>[C,await C.blob()])).then((C=>{let[Rn,So]=C;const To=8*parseInt(Rn.headers.get("Content-Length")||So.size)/1024/1024/(((new Date).getTime()-or)/1e3)>=qo;return sessionStorage.setItem(dl,To?"true":"false"),To})).catch((C=>(console.warn("Failed to run speedtest",C),!1)))}}function getCookie(C){var Rn,or,So;const To=null===(Rn=document.cookie)||void 0===Rn||null===(or=Rn.split(";"))||void 0===or||null===(So=or.find((Rn=>Rn.trimStart().startsWith("".concat(C,"=")))))||void 0===So?void 0:So.split("=");if(To)return To.shift(),To.join("=")}function getUserAccount(){const C=getCookie("session"),Rn=getCookie("user_id"),or=getCookie("user_name");return C&&Rn&&or?{id:Rn,name:or}:null}},4824:(C,Rn,or)=>{"use strict";or.d(Rn,{C:()=>createButtonSpan,Fl:()=>createSearchBar,Mr:()=>enableButton,Nk:()=>fat,QO:()=>enableCopyButton,Qr:()=>disableButton,VQ:()=>closeOtherPanels,WD:()=>createExpandableButton,W_:()=>createTable,_:()=>createLabel,ax:()=>createButton,dc:()=>createHeader,fa:()=>fa,gJ:()=>createLinkCell,sS:()=>createGroup,wf:()=>createPanel});var So=or(942),To=or(6899),Ro=or(4671),Uo=or(7361),Oo=or(4666),Ho=or(8455),qo=or(6565),dl=or(6087);function createButton(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,So=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];const To=document.createElement("button");return Rn&&(Rn instanceof HTMLElement||Rn instanceof Node?To.appendChild(Rn):To.innerHTML=Rn),To.id=C,Array.isArray(So)&&(So=So.filter((C=>null!=C&&C.length>0))),To.classList.add("gvs-btn","gvs-widget-bg",...So),or&&(To.title=or),To}function createExpandableButton(C,Rn,or,So){let To=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const Ro=document.createElement("button");return Ro.id=C,Ro.appendChild(fa(Rn)),So._viewer.isWidthSmall()?Ro.title=or:(Ro.appendChild(document.createTextNode(or)),Ro.appendChild(fa(Uo.pt))),Ro.classList.add("gvs-btn","gvs-widget-bg","gvs-btn-expandable",...To),Ro}function createSearchBar(C,Rn,or,So,Uo){let qo=arguments.length>5&&void 0!==arguments[5]&&arguments[5],dl=arguments.length>6&&void 0!==arguments[6]&&arguments[6],ml=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;const fl=document.createElement("div");fl.classList.add("gvs-widget-bg","gvs-search-bar"),fl.id=C,dl&&fl.classList.add("gvs-search-bar-reducable"),ml&&fl.appendChild(ml);const vl=document.createElement("input");vl.type="text",vl.placeholder=Rn,fl.appendChild(vl);const extendInput=()=>{fl.classList.remove("gvs-search-bar-reduced")},reduceInput=()=>{fl.classList.add("gvs-search-bar-reduced")};dl&&reduceInput();const bl=document.createElement("span");bl.classList.add("gvs-search-bar-icon");const kl=fa(Oo.Y$),Ll=fa(Ho.IJ,{classes:["fa-spin"]}),Dl=fa(To.g8),Nc=fa(Ro.xH);bl.appendChild(kl),fl.appendChild(bl);const jc=createPanel(Uo,fl,[],["gvs-search-bar-results"],qo);fl.appendChild(jc);const switchIcon=C=>{bl.innerHTML="",bl.appendChild(C)},resetSearch=()=>{fl._throttler&&clearTimeout(fl._throttler),vl.value="",jc.innerHTML="",jc._toggle(!1),delete fl._lastSearch,switchIcon(kl),So(null),dl&&reduceInput()};fl.resetSearch=resetSearch;vl.setItem=C=>{fl._throttler&&clearTimeout(fl._throttler),vl.value=C,jc.innerHTML="",jc._toggle(!1),switchIcon(Dl),dl&&extendInput()};const goSearch=()=>{if(fl._throttler&&clearTimeout(fl._throttler),0===vl.value.length)return jc.innerHTML="",void jc._toggle(!1);fl._throttler=setTimeout((()=>{jc.innerHTML="",jc._toggle(!1),switchIcon(Ll),or(vl.value).then((C=>{switchIcon(Dl),jc._toggle(!0),C&&0!=C.length?!0!==C?C.forEach((C=>{const Rn=document.createElement("div");Rn.classList.add("gvs-search-bar-result"),Rn.innerHTML="".concat(C.title,"<br /><small>").concat((null===C||void 0===C?void 0:C.subtitle)||"","</small>"),jc.appendChild(Rn),Rn.addEventListener("click",(()=>(C=>{dl?(So(C),resetSearch()):(fl._throttler&&clearTimeout(fl._throttler),vl.value=C.title,jc.innerHTML="",jc._toggle(!1),So(C))})(C)))})):jc._toggle(!1):jc.innerHTML='<div class="gvs-search-empty">'.concat(Uo._t.gvs.search_empty,"</li>")})).catch((C=>{console.error(C),switchIcon(Nc)}))}),250)};return vl.addEventListener("change",goSearch),vl.addEventListener("keypress",goSearch),vl.addEventListener("paste",goSearch),vl.addEventListener("input",goSearch),bl.addEventListener("click",(()=>{bl.firstChild!=Dl&&bl.firstChild!=Nc||resetSearch(),dl&&bl.firstChild==kl&&(fl.classList.contains("gvs-search-bar-reduced")?extendInput():reduceInput())})),fl}function createPanel(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],So=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],To=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const Ro=document.createElement("div");Ro.id=Rn.id+"-panel",Array.isArray(So)&&(So=So.filter((C=>null!=C&&C.length>0))),Ro.classList.add("gvs-panel","gvs-widget-bg","gvs-hidden",...So);for(let Uo of or)Ro.appendChild(Uo);const togglePanel=(Rn,or)=>{Rn&&Rn.stopPropagation(),!0===or?Ro.classList.remove("gvs-hidden"):!1===or?Ro.classList.add("gvs-hidden"):(Ro.classList.toggle("gvs-hidden"),or=!Ro.classList.contains("gvs-hidden")),or&&!To&&closeOtherPanels(Ro,C._viewer.container)};return Ro._toggle=C=>togglePanel(null,C),"BUTTON"==Rn.tagName&&(Rn.addEventListener("click",togglePanel),Rn.addEventListener("hover",togglePanel)),Ro}function closeOtherPanels(C,Rn){var or;const isPanel=C=>C.classList.contains("gvs-panel")||C.classList.contains("gvs-search-bar-result")||C.classList.contains("gvs-search-empty")||C.classList.contains("gvs-search-bar-reducable");if(!isPanel(C)&&null!==(or=C)&&void 0!==or&&or.parentNode)for(C=C.parentNode;C instanceof Element&&!isPanel(C);)C=C.parentNode;for(const So of Rn.getElementsByClassName("gvs-panel"))So==C||So.contains(C)||So.classList.contains("gvs-hidden")||So.classList.add("gvs-hidden");for(const So of Rn.getElementsByClassName("gvs-search-bar-reducable"))So==C||So.contains(C)||So.classList.contains("gvs-search-bar-reduced")||So.resetSearch()}function createGroup(C,Rn,or){let So=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],To=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const Ro=document.createElement("div");Ro.id=C,Array.isArray(To)&&(To=To.filter((C=>null!=C&&C.length>0))),Ro.classList.add("gvs-group",...To);for(let Uo of So)Ro.appendChild(Uo);return or._corners[Rn].appendChild(Ro),Ro}function enableCopyButton(C,Rn){for(let or of C.getElementsByTagName("button")){const C=or.getAttribute("data-input"),So=or.getAttribute("data-copy");(C||So)&&or.addEventListener("click",(()=>{let To;if(C){const Rn=document.getElementById(C);To=Rn.innerText||Rn.value}else So&&(To=or.getAttribute("data-copy"));navigator.clipboard.writeText(To);const Ro=or.innerHTML;or.innerHTML="".concat(Rn.gvs.copied," ").concat(fat(qo.LE)),or.classList.add("gvs-btn-active"),setTimeout((()=>{or.innerHTML=Ro,or.classList.remove("gvs-btn-active")}),2e3)}))}}function enableButton(C){C.removeAttribute("disabled")}function disableButton(C){C.setAttribute("disabled","")}function fa(C,Rn){return(0,So.qv)(C,Rn).node[0]}function fat(C,Rn){return(0,So.qv)(C,Rn).html[0]}function createLinkCell(C,Rn,or,So){const To=document.createElement("a");To.href=Rn,To.target="_blank",To.title=or,To.textContent=C;return[To,createButtonSpan("".concat(fat(dl.kZ)," ").concat(So),C)]}function createTable(C,Rn){const or=document.createElement("table");return or.className=C,Rn.forEach((C=>{let{section:Rn,value:So,values:To,classes:Ro}=C;const Uo=document.createElement("tr"),Oo=document.createElement("th");Oo.scope="row",Oo.textContent=Rn,Uo.appendChild(Oo);const Ho=document.createElement("td");Ro&&Ho.classList.add(...Ro),To?To.forEach((C=>Ho.appendChild(C))):So instanceof HTMLElement?Ho.appendChild(So):Ho.innerHTML=So,Uo.appendChild(Ho),or.appendChild(Uo)})),or}function createHeader(C,Rn){const or=document.createElement(C);return or.innerHTML=Rn,or}function createButtonSpan(C){let Rn=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const or=document.createElement("button");or.innerHTML=C,Rn&&or.setAttribute("data-copy",Rn);const So=document.createElement("span");return So.className="gvs-input-btn",So.appendChild(or),So}function createLabel(C,Rn){let or=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const So=document.createElement("label");return So.htmlFor=C,or&&So.appendChild(fa(or)),So.appendChild(document.createTextNode(Rn)),So}},9204:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>URLHash});const So={minDate:"date_from",maxDate:"date_to",type:"pic_type",camera:"camera",theme:"theme"},To=Object.fromEntries(Object.entries(So).map((C=>[C[1],C[0]]))),Ro=["psv:view-rotated","psv:picture-loaded","focus-changed","filters-changed","psv:transition-duration-changed","map:background-changed","map:users-changed","pictures-navigation-changed"];class URLHash extends EventTarget{constructor(C){super(),this._viewer=C,this._delay=null,this._hashChangeHandler=this._onHashChange.bind(this),C.addEventListener("ready",(()=>{window.addEventListener("hashchange",this._hashChangeHandler,!1),Ro.forEach((C=>this._viewer.addEventListener(C,this._updateHash.bind(this))))}),{once:!0})}destroy(){var C,Rn;window.removeEventListener("hashchange",this._hashChangeHandler),delete this._hashChangeHandler,null===(C=this._viewer)||void 0===C||null===(Rn=C.map)||void 0===Rn||Rn.off("moveend",this._updateHash),Ro.forEach((C=>this._viewer.removeEventListener(C,this._updateHash))),delete this._viewer,this._updateHash()}bindMapEvents(){this._viewer.map.on("moveend",this._updateHash.bind(this))}getHashString(){let C="",Rn={};"number"==typeof this._viewer.psv.getTransitionDuration()&&(Rn.speed=this._viewer.psv.getTransitionDuration()),[null,"any"].includes(this._viewer.getPicturesNavigation())||(Rn.nav=this._viewer.getPicturesNavigation());const or=this._viewer.psv.getPictureMetadata();if(or&&(Rn.pic=or.id,Rn.xyz=this._getXyzHashString()),this._viewer.map){Rn.map=this._getMapHashString(),Rn.focus="pic",this._viewer.isMapWide()&&(Rn.focus="map"),this._viewer.popupContainer.classList.contains("gvs-hidden")||(Rn.focus="meta"),this._viewer.map.hasTwoBackgrounds()&&this._viewer.map.getBackground()&&(Rn.background=this._viewer.map.getBackground());const C=this._viewer.map.getVisibleUsers();if((C.length>1||!C.includes("geovisio"))&&(Rn.users=C.join(",")),this._viewer._mapFilters)for(let or in So)this._viewer._mapFilters[or]&&(Rn[So[or]]=this._viewer._mapFilters[or])}else Rn.map="none";return Object.entries(Rn).sort(((C,Rn)=>C[0].localeCompare(Rn[0]))).forEach((Rn=>{let[or,So]=Rn,To=!1;const Ro=C.split("&").map((C=>{const Rn=C.split("=")[0];return Rn===or?(To=!0,"".concat(Rn,"=").concat(So)):C})).filter((C=>C));To||Ro.push("".concat(or,"=").concat(So)),C="".concat(Ro.join("&"))})),"#".concat(C).replace(/^#+/,"#")}_getCurrentHash(){const C=window.location.hash.replace("#","");let Rn={};return C.split("&").map((C=>C.split("="))).filter((C=>void 0!==C[0]&&C[0].length>0)).forEach((C=>{Rn[C[0]]=C[1]})),Rn}_getMapHashString(){const C=this._viewer.map.getCenter(),Rn=Math.round(100*this._viewer.map.getZoom())/100,or=Math.ceil((Rn*Math.LN2+Math.log(512/360/.5))/Math.LN10),So=Math.pow(10,or),To=Math.round(C.lng*So)/So,Ro=Math.round(C.lat*So)/So,Uo=this._viewer.map.getBearing(),Oo=this._viewer.map.getPitch();let Ho="".concat(Rn,"/").concat(Ro,"/").concat(To);return(Uo||Oo)&&(Ho+="/".concat(Math.round(10*Uo)/10)),Oo&&(Ho+="/".concat(Math.round(Oo))),Ho}_getXyzHashString(){const C=this._viewer.psv.getXYZ(),Rn=C.x.toFixed(2),or=C.y.toFixed(2),So=Math.round(C.z||0);return"".concat(Rn,"/").concat(or,"/").concat(So)}_onHashChange(){const C=this._getCurrentHash();if(C.pic){const Rn=C.pic.split(";");Rn.length>1&&console.warn("Multiple picture IDs passed in URL, only first one kept"),this._viewer.select(null,Rn[0])}if(C.focus&&["map","pic"].includes(C.focus)&&this._viewer.setFocus(C.focus),C.focus&&"meta"==C.focus&&this._viewer._widgets._showPictureMetadataPopup(),void 0!==C.speed&&this._viewer.psv.setTransitionDuration(C.speed),C.map&&this._viewer.map){const Rn=this.getMapOptionsFromHashString(C.map);Rn&&this._viewer.map.jumpTo(Rn);let or=(C.users||"").split(",");(0===or.length||1===or.length&&""===or[0].trim())&&(or=["geovisio"]),this._viewer.map.setVisibleUsers(or)}if(C.xyz){const Rn=this.getXyzOptionsFromHashString(C.xyz);this._viewer.psv.setXYZ(Rn.x,Rn.y,Rn.z)}this._viewer.setFilters(this.getMapFiltersFromHashVals(C)),["aerial","streets"].includes(C.background)&&this._viewer.map.setBackground(C.background),["pic","any","seq"].includes(C.nav)&&this._viewer.setPicturesNavigation(C.nav)}getMapFiltersFromHashVals(C){const Rn={};for(let or in To)C[or]&&(Rn[To[or]]=C[or]);return Rn}getMapOptionsFromHashString(C){const Rn=C.split("/");if(Rn.length>=3&&!Rn.some((C=>isNaN(C)))){const C={center:[+Rn[2],+Rn[1]],zoom:+Rn[0],pitch:+(Rn[4]||0)};return this._viewer.map&&(C.bearing=this._viewer.map.dragRotate.isEnabled()&&this._viewer.map.touchZoomRotate.isEnabled()?+(Rn[3]||0):this._viewer.map.getBearing()),C}return null}getXyzOptionsFromHashString(C){const Rn=C.split("/");if(3!==Rn.length||Rn.some((C=>isNaN(C))))return null;return{x:+Rn[0],y:+Rn[1],z:+Rn[2]}}_updateHash(){this._delay&&(clearTimeout(this._delay),this._delay=null),this._delay=setTimeout((()=>{var C,Rn,or;const So=new URL(window.location.href),To=new URL(window.location.href);if(To.hash=this._viewer?this.getHashString():"",So.hash==To.hash)return;const Ro=this._getCurrentHash().pic||"",Uo=(null===(C=this._viewer)||void 0===C||null===(Rn=C.psv)||void 0===Rn||null===(or=Rn.getPictureMetadata())||void 0===or?void 0:or.id)||"";try{if(Ro!=Uo?window.history.pushState(window.history.state,null,To.href):window.history.replaceState(window.history.state,null,To.href),this._viewer){const C=new CustomEvent("url-changed",{detail:{url:To.href}});this.dispatchEvent(C)}}catch(Oo){}}),500)}}},9705:(C,Rn,or)=>{"use strict";or.d(Rn,{Z:()=>Widgets});or(8193);var So=or(1707),To=or(4824),Ro=or(7457),Uo=or(1679),Oo=or(5608),Ho=or(4133),qo=or(7832),dl=or(8139),ml=or(4229),fl=or(5974),vl=or(8818),bl=or(3911),kl=or(8402),Ll=or(4422),Dl=or(4038),Nc=or(1788),jc=or(4056),Zc=or(5218),eu=or(2482),Ku=or(5163),Yu=or(4873),Eh=or(779),Th=or(625),Ch=or(6666),Lh=or(953),Dh=or(1445),Rh=or(8117),Nh=or(5088),Uh=or(4480),Bh=or(1658),Fh=or(4470),Oh=or(3650),Vh=or(2155),jh=or(3299),Gh=or(939),Hh=or(3701),Zh=or(5476),Wh=or(6580),qh=or(847),Kh=or(6087),Qh=or(8381),Xh=or(7711),Yh=or(3630),Jh=or(4411),$h=or(421);class Widgets{constructor(C){var Rn;let or=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null==or&&(or={}),null==or.editIdUrl&&(or.editIdUrl="https://www.openstreetmap.org/edit"),this._viewer=C,this._t=this._viewer._t,this._options=or;const So=void 0!==this._viewer.map;this._corners={};const Uo=So?["main","mini"]:["main"],Oo=["top","bottom"],Ho=["left","middle","right"];for(let To of Uo)for(let C of Oo){const Rn=document.createElement("div");Rn.id="gvs-corner-".concat(To,"-").concat(C),Rn.classList.add("gvs-corner-space");for(let or of Ho){const So=document.createElement("div");So.id="".concat(Rn.id,"-").concat(or),So.classList.add("gvs-corner"),this._corners["".concat(To,"-").concat(C,"-").concat(or)]=So,Rn.appendChild(So)}"main"==To?this._viewer.mainContainer.appendChild(Rn):"mini"==To&&this._viewer.miniContainer.appendChild(Rn)}if((0,Ro.zd)()||this._initWidgetPlayer(So),this._initWidgetLegend(So,null===(Rn=or)||void 0===Rn?void 0:Rn.mapAttribution),So&&(this._initWidgetMiniActions(),(0,Ro.zd)()||(this._initWidgetSearch(),this._initWidgetFilters(null!==this._viewer._api._endpoints.user_search&&null!==this._viewer._api._endpoints.user_tiles),this._initWidgetMapLayers(),this._listenMapFiltersChanges())),this._viewer.isWidthSmall()||this._initWidgetShare(),or.customWidget){const C=this._corners["main-bottom-right"];switch(typeof or.customWidget){case"string":for(let Rn of(new DOMParser).parseFromString(or.customWidget,"text/html").body.children)C.appendChild(Rn);break;case"object":Array.isArray(or.customWidget)?or.customWidget.forEach((Rn=>C.appendChild(Rn))):C.appendChild(or.customWidget)}}this._initWidgetZoom(So),this._viewer.container.addEventListener("click",(C=>(0,To.VQ)(C.target,this._viewer.container)))}destroy(){Object.values(this._corners).forEach((C=>C.remove())),delete this._corners,delete this._t,delete this._viewer}_initWidgetZoom(C){this._lastWantedZoom=this._viewer.psv.getZoomLevel();const Rn=(0,To.ax)("gvs-zoom-in",(0,To.fa)(ml.r8),this._t.gvs.zoomIn),or=(0,To.ax)("gvs-zoom-out",(0,To.fa)(fl.Kl),this._t.gvs.zoomOut);(0,To.sS)("gvs-widget-zoom","main-bottom-right",this,[Rn,or],["gvs-group-vertical","gvs-mobile-hidden","gvs-print-hidden"]);const zoomFct=(Rn,or)=>{if(C&&this._viewer.isMapWide())or?this._viewer.map.zoomIn({},{originalEvent:Rn}):this._viewer.map.zoomOut({},{originalEvent:Rn});else{this._viewer.lastPsvAnim&&this._viewer.lastPsvAnim.cancel();const C=or?Math.min(100,this._lastWantedZoom+So.ns):Math.max(0,this._lastWantedZoom-So.ns);this._viewer.lastPsvAnim=this._viewer.psv.animate({speed:So.O_,zoom:C}),this._lastWantedZoom=C}};Rn.addEventListener("click",(C=>zoomFct(C,!0))),or.addEventListener("click",(C=>zoomFct(C,!1)))}_initWidgetPlayer(C){const Rn=(0,To.ax)("gvs-player-prev",(0,To.fa)(jc.DY),this._t.gvs.sequence_prev),or=(0,To.ax)("gvs-player-play"),Ro=(0,To.ax)("gvs-player-next",(0,To.fa)(Zc.ir),this._t.gvs.sequence_next),Uo=(0,To.ax)("gvs-player-more",(0,To.fa)(Dh.Uw),this._t.gvs.sequence_more,["gvs-xs-hidden"]),Oo=(0,To.wf)(this,Uo,[],["gvs-player-options"]);Oo.innerHTML='\n\t\t\t<div class="gvs-input-range" title="'.concat(this._t.gvs.sequence_speed,'">\n\t\t\t\t').concat((0,To.Nk)(Bh.uY),'\n\t\t\t\t<input\n\t\t\t\t\tid="gvs-player-speed"\n\t\t\t\t\ttype="range" name="speed"\n\t\t\t\t\tmin="0" max="').concat(So.q7-100,'"\n\t\t\t\t\tvalue="').concat(So.q7-this._viewer.psv.getTransitionDuration(),'"\n\t\t\t\t\ttitle="').concat(this._t.gvs.sequence_speed,'"\n\t\t\t\t\tstyle="width: 100%;" />\n\t\t\t\t').concat((0,To.Nk)(Rh.tM),'\n\t\t\t</div>\n\t\t\t<button title="').concat(this._t.gvs.contrast,'" id="gvs-player-contrast">\n\t\t\t\t').concat((0,To.Nk)(Uh.X8),"\n\t\t\t</button>\n\t\t");const Ho=(0,To.sS)("gvs-widget-player",C?"main-top-middle":"main-top-left",this,[Rn,or,Ro].concat(this._viewer.isWidthSmall()?[]:[Oo,Uo]),["gvs-group-horizontal","gvs-only-psv","gvs-print-hidden",this._viewer.psv.getPictureMetadata()?"":"gvs-hidden"]),toggleBtnPlay=C=>{or.innerHTML=C?(0,To.Nk)(eu.XQ):(0,To.Nk)(Nc.zc),or.title=C?this._t.gvs.sequence_pause:this._t.gvs.sequence_play};toggleBtnPlay(!1);const updatePlayBtn=()=>{var C,So,Uo,Oo;"pic"===this._viewer.getPicturesNavigation()?((0,To.Qr)(Ro),(0,To.Qr)(or),(0,To.Qr)(Rn)):(null!=(null===(C=this._viewer.psv.getPictureMetadata())||void 0===C||null===(So=C.sequence)||void 0===So?void 0:So.prevPic)?(0,To.Mr)(Rn):(0,To.Qr)(Rn),null!=(null===(Uo=this._viewer.psv.getPictureMetadata())||void 0===Uo||null===(Oo=Uo.sequence)||void 0===Oo?void 0:Oo.nextPic)?((0,To.Mr)(Ro),(0,To.Mr)(or)):((0,To.Qr)(Ro),(0,To.Qr)(or)))};if(updatePlayBtn(),this._viewer.addEventListener("sequence-playing",(()=>toggleBtnPlay(!0))),this._viewer.addEventListener("sequence-stopped",(()=>toggleBtnPlay(!1))),this._viewer.addEventListener("psv:picture-loaded",(()=>Ho.classList.remove("gvs-hidden")),{once:!0}),this._viewer.addEventListener("psv:picture-loaded",updatePlayBtn),this._viewer.addEventListener("pictures-navigation-changed",updatePlayBtn),!this._viewer.isWidthSmall()){const C=Oo.children[0].children[1];this._viewer.addEventListener("psv:transition-duration-changed",(Rn=>{C.value=So.q7-Rn.detail.value})),C.addEventListener("change",(C=>{const Rn=So.q7-C.target.value;this._viewer.psv.setTransitionDuration(Rn)}))}Rn.addEventListener("click",(()=>this._viewer.psv.goToPrevPicture())),Ro.addEventListener("click",(()=>this._viewer.psv.goToNextPicture())),or.addEventListener("click",(()=>{this._viewer.isSequencePlaying()?(toggleBtnPlay(!1),this._viewer.stopSequence()):(toggleBtnPlay(!0),this._viewer.playSequence())}));const qo=document.getElementById("gvs-player-contrast");qo&&qo.addEventListener("click",(()=>{qo.classList.contains("gvs-btn-active")?(qo.classList.remove("gvs-btn-active"),this._viewer.psv.setHigherContrast(!1)):(qo.classList.add("gvs-btn-active"),this._viewer.psv.setHigherContrast(!0))}))}_initWidgetLegend(C,Rn){const or=(0,To.sS)("gvs-widget-legend",C?"main-bottom-right":"main-bottom-left",this,[],["gvs-widget-bg"]);let So,Uo,Oo;C&&(So=(0,To.sS)("gvs-widget-mini-legend","mini-bottom-right",this,[],["gvs-widget-bg","gvs-only-mini","gvs-mobile-hidden"])),this._viewer.isWidthSmall()&&(Uo=document.createElement("button"),Uo.id="gvs-legend-toggle",Uo.classList.add("gvs-btn","gvs-widget-bg","gvs-print-hidden"),Uo.appendChild((0,To.fa)(Gh.DB)),Oo=()=>{"hidden"===or.style.visibility?(or.style.visibility="visible",toggleLegend(!!C&&this._viewer.isMapWide())):(or.innerHTML="",or.style.visibility="hidden",or.appendChild(Uo))},Uo.addEventListener("click",(C=>{C.stopPropagation(),Oo()})));const toggleLegend=Oo=>{var Ho,qo,dl;let ml=Rn||(null===(Ho=this._viewer.map)||void 0===Ho||null===(qo=Ho._attribution)||void 0===qo?void 0:qo._attribHTML)||"",fl="<a href='https://panoramax.fr/' target='_blank'>Panoramax</a>";const vl=null===(dl=this._viewer.psv.getPictureMetadata())||void 0===dl?void 0:dl.caption;let bl;!(0,Ro.zd)()&&vl&&(fl="",vl.producer&&(fl+='<span style="font-weight: bold">© '.concat(vl.producer,"</span>")),vl.date&&(vl.producer&&(fl+=" - "),fl+=vl.date.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})),bl=(0,To.fa)(Xh.FD),bl.style.marginLeft="5px"),or.title="",Oo?(or.innerHTML=ml,(0,Ro.zd)()&&(or.innerHTML="<a href='https://panoramax.fr/' target='_blank'>Panoramax</a><br />"+or.innerHTML),or.style.cursor=null,or.onclick=null,So.innerHTML=fl):(or.innerHTML=fl,bl?(or.appendChild(bl),or.style.cursor="pointer",or.title=this._t.gvs.legend_title,or.onclick=(0,Ro.zd)()?()=>window.open(window.location.href,"_blank"):this._showPictureMetadataPopup.bind(this)):(or.style.cursor=null,or.onclick=null),C&&(So.innerHTML=ml)),Uo&&or.appendChild(Uo)};Uo?(or.appendChild(Uo),or.style.visibility="hidden"):toggleLegend(!!C&&this._viewer.isMapWide()),this._viewer.addEventListener("focus-changed",(C=>toggleLegend("map"==C.detail.focus))),this._viewer.addEventListener("psv:picture-loaded",(()=>toggleLegend(C&&this._viewer.isMapWide())))}_showPictureMetadataPopup(){var C,Rn,or,So,Ro,Uo,Oo,Ho,qo,ml,fl,vl,bl,kl,Ll,Dl,Nc;const jc=this._viewer.psv.getPictureMetadata();if(!jc)throw new Error("No picture currently selected");const Zc=[];if(Zc.push((0,To.dc)("h4","".concat((0,To.Nk)(Gh.DB)," ").concat(this._t.gvs.metadata))),this._viewer._api._endpoints.report){const C=(0,To.C)("".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report));C.firstChild.addEventListener("click",this._showReportForm.bind(this)),Zc.push(C)}const eu=[{section:this._t.gvs.metadata_general_picid,classes:["gvs-td-with-id"],values:(0,To.gJ)(jc.id,this._viewer._api.getPictureMetadataUrl(jc.id,null===jc||void 0===jc||null===(C=jc.sequence)||void 0===C?void 0:C.id),this._t.gvs.metadata_general_picid_link,this._t.gvs.copy)},{section:this._t.gvs.metadata_general_seqid,classes:["gvs-td-with-id"],values:(0,To.gJ)(null===jc||void 0===jc||null===(Rn=jc.sequence)||void 0===Rn?void 0:Rn.id,this._viewer._api.getSequenceMetadataUrl(null===jc||void 0===jc||null===(or=jc.sequence)||void 0===or?void 0:or.id),this._t.gvs.metadata_general_seqid_link,this._t.gvs.copy)},{section:this._t.gvs.metadata_general_author,value:null===jc||void 0===jc||null===(So=jc.caption)||void 0===So?void 0:So.producer},{section:this._t.gvs.metadata_general_license,value:null===jc||void 0===jc||null===(Ro=jc.caption)||void 0===Ro?void 0:Ro.license},{section:this._t.gvs.metadata_general_date,value:null===jc||void 0===jc||null===(Uo=jc.caption)||void 0===Uo||null===(Oo=Uo.date)||void 0===Oo?void 0:Oo.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZoneName:"short"})}];Zc.push((0,To.W_)("gvs-table-light",eu)),Zc.push((0,To.dc)("h4","".concat((0,To.Nk)(Eh._j)," ").concat(this._t.gvs.metadata_camera)));const Ku=null!==jc&&void 0!==jc&&null!==(Ho=jc.properties)&&void 0!==Ho&&null!==(qo=Ho["pers:interior_orientation"])&&void 0!==qo&&qo.focal_length?"".concat(null===jc||void 0===jc||null===(ml=jc.properties)||void 0===ml||null===(fl=ml["pers:interior_orientation"])||void 0===fl?void 0:fl.focal_length," mm"):"unknown",Yu=[{section:this._t.gvs.metadata_camera_make,value:null===jc||void 0===jc||null===(vl=jc.properties)||void 0===vl||null===(bl=vl["pers:interior_orientation"])||void 0===bl?void 0:bl.camera_manufacturer},{section:this._t.gvs.metadata_camera_model,value:null===jc||void 0===jc||null===(kl=jc.properties)||void 0===kl||null===(Ll=kl["pers:interior_orientation"])||void 0===Ll?void 0:Ll.camera_model},{section:this._t.gvs.metadata_camera_type,value:360===(null===jc||void 0===jc?void 0:jc.horizontalFov)?this._t.gvs.picture_360:this._t.gvs.picture_flat},{section:this._t.gvs.metadata_camera_focal_length,value:Ku}];Zc.push((0,To.W_)("gvs-table-light",Yu)),Zc.push((0,To.dc)("h4","".concat((0,To.Nk)(Zh.op)," ").concat(this._t.gvs.metadata_location)));const Th=void 0!==(null===jc||void 0===jc||null===(Dl=jc.properties)||void 0===Dl?void 0:Dl["view:azimuth"])?"".concat(jc.properties["view:azimuth"],"\xb0"):"unknown",Ch=(0,dl.j$)(jc),Lh=[{section:this._t.gvs.metadata_location_longitude,value:jc.gps[0]},{section:this._t.gvs.metadata_location_latitude,value:jc.gps[1]},{section:this._t.gvs.metadata_location_orientation,value:Th},{section:this._t.gvs.metadata_location_precision,value:Ch}];if(Zc.push((0,To.W_)("gvs-table-light",Lh)),null!==(Nc=jc.properties)&&void 0!==Nc&&Nc.exif){const C=document.createElement("details");C.appendChild((0,To.dc)("summary","".concat((0,To.Nk)(Hh.gr)," ").concat(this._t.gvs.metadata_exif)));const Rn=Object.entries(jc.properties.exif).sort().map((C=>{let[Rn,or]=C;return{section:Rn,value:or}}));C.appendChild((0,To.W_)("",Rn)),Zc.push(C)}this._viewer.setPopup(!0,Zc),this._viewer.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}_showReportForm(){const C=this._viewer.psv.getPictureMetadata();if(!C)throw new Error("No picture currently selected");const Rn=[];Rn.push((0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)));const or=(0,Ro.iE)();if(or){const C=document.createElement("p");C.appendChild(document.createTextNode(this._t.gvs.report_auth.replace("{a}",or.name))),Rn.push(C)}const So=document.createElement("form");Rn.push(So);const Uo=document.createElement("div");Uo.classList.add("gvs-input-group");const Oo=(0,To._)("gvs-report-issue",this._t.gvs.report_nature_label,Gh.DB),Ho=document.createElement("select");Ho.name="gvs-report-issue",Ho.required=!0;["","blur_missing","blur_excess","inappropriate","privacy","picture_low_quality","mislocated","copyright","other"].forEach((C=>{const Rn=document.createElement("option");Rn.value=C,Rn.textContent=this._t.gvs.report_nature[C],""===C&&(Rn.setAttribute("disabled",""),Rn.setAttribute("selected",""),Rn.setAttribute("hidden","")),Ho.appendChild(Rn)})),Uo.appendChild(Oo),Uo.appendChild(Ho),So.appendChild(Uo);const qo=document.createElement("div");qo.classList.add("gvs-input-group","gvs-input-group-inline");const dl=document.createElement("input");dl.id="gvs-report-whole-sequence",dl.name="gvs-report-whole-sequence",dl.type="checkbox";const ml=(0,To._)("gvs-report-whole-sequence",this._t.gvs.report_whole_sequence);qo.appendChild(dl),qo.appendChild(ml),So.appendChild(qo);const fl=document.createElement("div");fl.classList.add("gvs-input-group");const vl=(0,To._)("gvs-report-details",this._t.gvs.report_details,Yh.Z6),bl=document.createElement("textarea");let kl;if(bl.name="gvs-report-details",bl.placeholder=this._t.gvs.report_details_placeholder,fl.appendChild(vl),fl.appendChild(bl),So.appendChild(fl),!or){const C=document.createElement("div");C.classList.add("gvs-input-group");const Rn=(0,To._)("email",this._t.gvs.report_email,Jh.IB);kl=document.createElement("input"),kl.type="email",kl.name="email",kl.placeholder=this._t.gvs.report_email_placeholder,C.appendChild(Rn),C.appendChild(kl),So.appendChild(C)}const Ll=document.createElement("div");Ll.classList.add("gvs-input-btn");const Dl=document.createElement("button");Dl.type="submit",Dl.appendChild((0,To.fa)($h.XC)),Dl.appendChild(document.createTextNode(this._t.gvs.report_submit)),Ll.appendChild(Dl),So.appendChild(Ll),So.addEventListener("submit",(Rn=>{var or;Rn.preventDefault();const So={issue:Ho.value,picture_id:dl.checked?null:C.id,reporter_comments:bl.value,reporter_email:null===(or=kl)||void 0===or?void 0:or.value,sequence_id:C.sequence.id};this._viewer.setPopup(!0,[(0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)),document.createTextNode(this._t.gvs.report_wait)]),this._viewer._api.sendReport(So).then((()=>{this._viewer.setPopup(!0,[(0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)),document.createTextNode(this._t.gvs.report_success)])})).catch((C=>{console.error(C),this._viewer.setPopup(!0,[(0,To.dc)("h4","".concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.report)),document.createTextNode(this._t.gvs.report_failure.replace("{e}",C))])}))})),this._viewer.setPopup(!0,Rn),this._viewer.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:"meta"}}))}_initWidgetMiniActions(){const C=document.createElement("img");C.src=Uo;const Rn=document.createElement("span");Rn.classList.add("gvs-mobile-hidden"),Rn.appendChild(document.createTextNode(this._t.gvs.expand));const or=(0,To.ax)("gvs-mini-expand",Rn,this._t.gvs.expand_info,["gvs-only-mini","gvs-print-hidden"]);or.appendChild(C),this._corners["mini-top-right"].appendChild(or),or.addEventListener("click",(()=>{this._viewer.setFocus(this._viewer.isMapWide()?"pic":"map")}));const So=document.createElement("img");So.src=Oo;const Ho=(0,To.ax)("gvs-mini-hide",So,this._t.gvs.minimize,["gvs-only-mini","gvs-print-hidden"]);this._corners["mini-bottom-left"].appendChild(Ho),Ho.addEventListener("click",(()=>{this._viewer.setUnfocusedVisible(!1)}));const qo=(0,To.ax)("gvs-mini-show",null,null,["gvs-btn-large","gvs-only-mini-hidden","gvs-print-hidden"]);this._corners["main-bottom-left"].appendChild(qo),qo.addEventListener("click",(()=>{(0,Ro.zd)()?this._viewer.setFocus(this._viewer.isMapWide()?"pic":"map"):this._viewer.setUnfocusedVisible(!0)}));const miniBtnRendering=()=>{this._viewer.map&&this._viewer.isMapWide()?(qo.title=this._t.gvs.show_psv,qo.innerHTML=(0,To.Nk)(Dl.UH)):(qo.title=this._t.gvs.show_map,qo.innerHTML=(0,To.Nk)(kl.Wx))};miniBtnRendering(),this._viewer.addEventListener("focus-changed",miniBtnRendering)}_initWidgetSearch(){const C=(0,To.Fl)("gvs-widget-search-bar",this._t.gvs.search_address,(C=>{const Rn=C.match(/([-+]?\d{1,2}\.\d+),\s*([-+]?\d{1,3}\.\d+)/);if(Rn){const C=parseFloat(Rn[1]),or=parseFloat(Rn[2]);return this._viewer.map.flyTo({center:[or,C],zoom:16}),Promise.resolve(!0)}return this._viewer.map.geocoder({query:C,limit:3,bbox:this._viewer.map.getBounds().toArray().map((C=>C.join(","))).join(","),proximity:this._viewer.map.getCenter().lat+","+this._viewer.map.getCenter().lng}).then((C=>C=C.features.map((C=>({title:C.place_name.split(",")[0],subtitle:C.place_name.split(",").slice(1).join(", "),data:C})))))}),(C=>{C&&(C.data.bounds?this._viewer.map.fitBounds(C.data.bounds):this._viewer.map.flyTo({center:C.data.center,zoom:C.data.zoom||13}))}),this,void 0,this._viewer.isWidthSmall(),this._viewer.map._geolocate);(0,To.sS)("gvs-widget-search",this._viewer.isWidthSmall()?"main-top-right":"main-top-left",this,[C],["gvs-only-map","gvs-print-hidden"])}_initWidgetMapLayers(){const C=(0,To.WD)("gvs-map-layers",Oh.Kr,this._t.gvs.layers,this),Rn=(0,To.wf)(this,C,[]);(0,To.sS)("gvs-widget-map-layers","main-top-right",this,[C,Rn],["gvs-group-large","gvs-group-btnpanel","gvs-only-map","gvs-print-hidden"]),this._viewer.map.hasTwoBackgrounds()&&(Rn.innerHTML="\n\t\t\t\t<h4>".concat((0,To.Nk)(Vh.ye)," ").concat(this._t.gvs.map_background,'</h4>\n\t\t\t\t<div id="gvs-map-bg" class="gvs-input-group">\n\t\t\t\t\t<input type="radio" id="gvs-map-bg-streets" name="gvs-map-bg" value="streets" />\n\t\t\t\t\t<label for="gvs-map-bg-streets">\n\t\t\t\t\t\t<img id="gvs-map-bg-streets-img" />\n\t\t\t\t\t\t').concat(this._t.gvs.map_background_streets,'\n\t\t\t\t\t</label>\n\t\t\t\t\t<input type="radio" id="gvs-map-bg-aerial" name="gvs-map-bg" value="aerial" />\n\t\t\t\t\t<label for="gvs-map-bg-aerial">\n\t\t\t\t\t\t<img id="gvs-map-bg-aerial-img" />\n\t\t\t\t\t\t').concat(this._t.gvs.map_background_aerial,"\n\t\t\t\t\t</label>\n\t\t\t\t</div>")),Rn.innerHTML+="\n\t\t\t<h4>".concat((0,To.Nk)(Nh.q2)," ").concat(this._t.gvs.map_theme,'</h4>\n\t\t\t<div class="gvs-input-group">\n\t\t\t\t<select id="gvs-map-theme" style="width: 100%;">\n\t\t\t\t\t<option value="default">').concat(this._t.gvs.map_theme_default,'</option>\n\t\t\t\t\t<option value="age">').concat(this._t.gvs.map_theme_age,'</option>\n\t\t\t\t\t<option value="type">').concat(this._t.gvs.map_theme_type,'</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<div id="gvs-map-theme-legend-age" class="gvs-map-theme-legend gvs-hidden">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_4,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_4,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_3,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_3,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_2,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_2,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.PALETTE_1,'"></span>\n\t\t\t\t\t\t\t').concat(this._t.gvs.map_theme_age_1,'\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div id="gvs-map-theme-legend-type" class="gvs-map-theme-legend gvs-hidden">\n\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.QUALI_1,'"></span>\n\t\t\t\t\t\t').concat(this._t.gvs.picture_360,'\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="gvs-map-theme-legend-entry">\n\t\t\t\t\t\t<span class="gvs-map-theme-color" style="background-color: ').concat(Ro.DM.QUALI_2,'"></span>\n\t\t\t\t\t\t').concat(this._t.gvs.picture_flat,"\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>");const or=Rn.querySelector("#gvs-map-theme"),onChange=()=>{this._onMapThemeChange(),this._onMapFiltersChange()};if(or.addEventListener("change",onChange),or.addEventListener("keypress",onChange),or.addEventListener("paste",onChange),or.addEventListener("input",onChange),this._viewer.map.hasTwoBackgrounds()){Rn.querySelector("#gvs-map-bg-aerial-img").src=Ho;Rn.querySelector("#gvs-map-bg-streets-img").src=qo;const C=Rn.querySelector("#gvs-map-bg-aerial"),or=Rn.querySelector("#gvs-map-bg-streets"),onBgChange=C=>{this._viewer.map.setBackground(C.target.value)};C.addEventListener("change",onBgChange),or.addEventListener("change",onBgChange),this._viewer.addEventListener("map:background-changed",(C=>this._onMapBackgroundChange(C.detail.background))),this._onMapBackgroundChange(this._viewer.map.getBackground())}}_onMapBackgroundChange(C){const Rn=document.getElementById("gvs-map-bg-aerial"),or=document.getElementById("gvs-map-bg-streets");"aerial"===C?Rn.checked=!0:or.checked=!0}_onMapThemeChange(){const C=document.getElementById("gvs-map-theme").value;for(let Rn of document.getElementsByClassName("gvs-map-theme-legend"))Rn.id=="gvs-map-theme-legend-"+C?Rn.classList.remove("gvs-hidden"):Rn.classList.add("gvs-hidden")}_initWidgetFilters(C){const Rn=(0,To.WD)("gvs-filter",Fh.cR,this._t.gvs.filters,this),or=(0,To.wf)(this,Rn,[]);if(or.innerHTML='\n\t\t\t<form id="gvs-filter-form">\n\t\t\t\t<div id="gvs-filter-zoomin">'.concat((0,To.Nk)(Qh.ik)," ").concat(this._t.gvs.filter_zoom_in,"</div>\n\t\t\t\t<h4>").concat((0,To.Nk)(Ku.fT)," ").concat(this._t.gvs.filter_date,'</h4>\n\t\t\t\t<div class="gvs-input-group">\n\t\t\t\t\t<input type="date" id="gvs-filter-date-from" />\n\t\t\t\t\t').concat((0,To.Nk)(Yu.eF),'\n\t\t\t\t\t<input type="date" id="gvs-filter-date-end" />\n\t\t\t\t</div>\n\t\t\t\t<h4>').concat((0,To.Nk)(Ll.Vm)," ").concat(this._t.gvs.filter_picture,'</h4>\n\t\t\t\t<div class="gvs-input-group" style="justify-content: center;">\n\t\t\t\t\t<input type="checkbox" id="gvs-filter-type-flat" name="flat" checked />\n\t\t\t\t\t<label for="gvs-filter-type-flat" style="margin-right: 20px">').concat(this._t.gvs.picture_flat,'</label>\n\t\t\t\t\t<input type="checkbox" id="gvs-filter-type-360" name="360" checked />\n\t\t\t\t\t<label for="gvs-filter-type-360">').concat(this._t.gvs.picture_360,"</label>\n\t\t\t\t</div>\n\t\t\t\t\x3c!--h4>").concat((0,To.Nk)(Eh._j)," ").concat(this._t.gvs.filter_camera_model,'</h4>\n\t\t\t\t<div class="gvs-input-group" id="gvs-filter-model"></div--\x3e\n\t\t\t</form>\n\t\t'),(0,To.sS)("gvs-widget-filter",this._viewer.isWidthSmall()?"main-top-right":"main-top-left",this,[Rn,or],["gvs-group-large","gvs-group-btnpanel","gvs-only-map","gvs-print-hidden"]),this._viewer.isWidthSmall()&&(or.style.width="".concat(this._viewer.container.offsetWidth-70,"px")),C){const C=or.querySelector("#gvs-filter-form"),Rn=document.createElement("h4");Rn.innerHTML="".concat((0,To.Nk)(jh.IL)," ").concat(this._t.gvs.filter_user),C.appendChild(Rn);const So=document.createElement("div");So.id="gvs-filter-user",So.classList.add("gvs-input-group");const Ro=(0,To.Fl)("gvs-filter-search-user",this._t.gvs.search_user,(C=>this._viewer._api.searchUsers(C).then((C=>(C||[]).map((C=>({title:C.label,data:C})))))),(C=>this._viewer.map.setVisibleUsers(C?[C.data.id]:["geovisio"])),this,!0);So.appendChild(Ro),C.appendChild(So)}const So=or.children[0];this._formDelay=null;const onFormChange=()=>{this._formDelay&&clearTimeout(this._formDelay),this._formDelay=setTimeout((()=>{this._onMapFiltersChange()}),250)};So.addEventListener("change",onFormChange),So.addEventListener("reset",onFormChange),So.addEventListener("submit",(C=>(onFormChange(),C.preventDefault(),!1)),!0);for(let To of So.getElementsByTagName("input"))To.addEventListener("change",onFormChange),To.addEventListener("keypress",onFormChange),To.addEventListener("paste",onFormChange),To.addEventListener("input",onFormChange)}_onMapFiltersChange(){const C=document.getElementById("gvs-filter-date-from"),Rn=document.getElementById("gvs-filter-date-end"),or=document.getElementById("gvs-filter-type-flat"),So=document.getElementById("gvs-filter-type-360"),To=document.getElementById("gvs-map-theme");let Ro="";So.checked&&!or.checked&&(Ro="equirectangular"),!So.checked&&or.checked&&(Ro="flat");const Uo={minDate:C.value,maxDate:Rn.value,type:Ro,theme:To.value};this._viewer.setFilters(Uo)}_listenMapFiltersChanges(){const C=document.getElementById("gvs-filter-date-from"),Rn=document.getElementById("gvs-filter-date-end"),or=document.getElementById("gvs-filter-type-flat"),So=document.getElementById("gvs-filter-type-360"),To=document.getElementById("gvs-map-theme");this._viewer.addEventListener("filters-changed",(Ro=>{Ro.detail.minDate&&(C.value=Ro.detail.minDate),Ro.detail.maxDate&&(Rn.value=Ro.detail.maxDate),Ro.detail.theme&&(To.value=Ro.detail.theme),Ro.detail.type&&(So.checked=["","equirectangular"].includes(Ro.detail.type),or.checked=["","flat"].includes(Ro.detail.type)),this._onMapThemeChange()}));const Ro=document.getElementById("gvs-filter-zoomin"),changeLblZoomInDisplay=()=>{this._viewer.map.getZoom()<7?Ro.style.display=null:Ro.style.display="none"};changeLblZoomInDisplay(),this._viewer.map.on("zoomend",changeLblZoomInDisplay)}_initWidgetShare(){var C,Rn;const or=(0,To.ax)("gvs-share",(0,To.fa)(vl.M6),this._t.gvs.share,["gvs-btn-large"]),So=(0,To.wf)(this,or,[]);So.innerHTML='\n\t\t\t<div class="gvs-hidden">\n\t\t\t\t<p id="gvs-share-license" style="margin: 0 0 10px 0;"></p>\n\t\t\t</div>\n\t\t\t<h4 style="margin-top: 0">'.concat((0,To.Nk)(bl.nN)," ").concat(this._t.gvs.share_links,'</h4>\n\t\t\t<div id="gvs-share-links" class="gvs-input-btn">\n\t\t\t\t<a id="gvs-share-image" class="gvs-link-btn gvs-hidden" download target="_blank">').concat((0,To.Nk)(qh.zo)," ").concat(this._t.gvs.share_image,'</a>\n\t\t\t\t<button id="gvs-share-url" data-copy="true" style="flex-basis: 100%; flex-grow: 2; flex-shrink: 2;">').concat((0,To.Nk)(Kh.kZ)," ").concat(this._t.gvs.share_page,'</button>\n\t\t\t\t<button id="gvs-share-print" style="flex-basis: 100%; flex-grow: 2; flex-shrink: 2;">').concat((0,To.Nk)(Ch.wf)," ").concat(this._t.gvs.share_print,"</button>\n\t\t\t</div>\n\t\t\t<h4>\n\t\t\t\t").concat((0,To.Nk)(kl.Wx)," ").concat(this._t.gvs.share_embed,'\n\t\t\t\t<a href="https://docs.panoramax.fr/web-viewer/03_URL_settings/"\n\t\t\t\t\ttitle="').concat(this._t.gvs.share_embed_docs,'"\n\t\t\t\t\ttarget="_blank"\n\t\t\t\t\tstyle="vertical-align: middle">\n\t\t\t\t\t').concat((0,To.Nk)(Gh.DB),'\n\t\t\t\t</a>\n\t\t\t</h4>\n\t\t\t<div class="gvs-input-btn">\n\t\t\t\t<textarea id="gvs-share-iframe" readonly></textarea>\n\t\t\t\t<button data-input="gvs-share-iframe">').concat((0,To.Nk)(Kh.kZ)," ").concat(this._t.gvs.copy,'</button>\n\t\t\t</div>\n\t\t\t<h4 class="gvs-hidden">').concat((0,To.Nk)(Th.Iw)," ").concat(this._t.gvs.edit_osm,'</h4>\n\t\t\t<div class="gvs-input-btn gvs-hidden" style="justify-content: center">\n\t\t\t\t<a id="gvs-edit-id" class="gvs-link-btn" target="_blank">').concat((0,To.Nk)(Zh.op)," ").concat(this._t.gvs.id,'</a>\n\t\t\t\t<button id="gvs-edit-josm" title="').concat(this._t.gvs.josm_live,'">').concat((0,To.Nk)(Lh.QN)," ").concat(this._t.gvs.josm,"</button>\n\t\t\t</div>\n\t\t"),(0,To.sS)("gvs-widget-share","main-bottom-right",this,[or,So],["gvs-group-large","gvs-group-btnpanel","gvs-mobile-hidden","gvs-print-hidden"]);const Ro=document.getElementById("gvs-share-links"),Uo=document.getElementById("gvs-share-image"),Oo=document.getElementById("gvs-share-url");if(this._viewer._api.getRSSURL()){const C=document.createElement("a");C.id="gvs-share-rss",C.classList.add("gvs-link-btn"),C.setAttribute("target","_blank"),C.setAttribute("title",this._t.gvs.share_rss_title),C.appendChild((0,To.fa)(Wh.mW)),C.appendChild(document.createTextNode(this._t.gvs.share_rss)),Ro.insertBefore(C,Oo)}this._viewer.addEventListener("psv:picture-loaded",(()=>{var C;const Rn=this._viewer.psv.getPictureMetadata();Uo.href=Rn.panorama.hdUrl;for(document.getElementById("gvs-share-license").innerHTML=null!==Rn&&void 0!==Rn&&null!==(C=Rn.caption)&&void 0!==C&&C.license?this._t.gvs.legend_license.replace("{l}",Rn.caption.license):"";So.getElementsByClassName("gvs-hidden").length>0;){So.getElementsByClassName("gvs-hidden")[0].classList.remove("gvs-hidden")}}));const updateLinks=C=>{var Rn;const or=(null===C||void 0===C||null===(Rn=C.detail)||void 0===Rn?void 0:Rn.url)||window.location.href.replace(/\/$/,""),To=this._options.iframeBaseURL?this._options.iframeBaseURL+window.location.hash:or,Ro=So.querySelector("#gvs-share-url"),Uo=So.querySelector("#gvs-share-iframe"),Oo=So.querySelector("#gvs-edit-id"),Ho=So.querySelector("#gvs-share-rss");Ro.setAttribute("data-copy",or),Uo.innerText='<iframe src="'.concat(To,'" style="border: none; width: 500px; height: 300px"></iframe>');const qo=this._viewer.psv.getPictureMetadata();if(qo){const C={map:"19/".concat(qo.gps[1],"/").concat(qo.gps[0]),source:"Panoramax",photo_overlay:"panoramax",photo:"panoramax/".concat(qo.id)};Oo.setAttribute("href","".concat(this._options.editIdUrl,"#").concat(new URLSearchParams(C).toString()))}var dl,ml;Ho&&Ho.setAttribute("href",this._viewer._api.getRSSURL(null===(dl=this._viewer)||void 0===dl||null===(ml=dl.map)||void 0===ml?void 0:ml.getBounds()))};updateLinks(),null===(C=this._viewer)||void 0===C||null===(Rn=C._hash)||void 0===Rn||Rn.addEventListener("url-changed",updateLinks),(0,To.QO)(So,this._viewer._t);const Ho=So.querySelector("#gvs-edit-josm");Ho.addEventListener("click",(()=>{Ho.classList.contains("gvs-btn-active")?this._viewer.toggleJOSMLive(!1):this._viewer.toggleJOSMLive(!0).catch((C=>{console.warn(C),alert(this._t.gvs.error_josm)}))})),this._viewer.addEventListener("josm-live-enabled",(()=>Ho.classList.add("gvs-btn-active"))),this._viewer.addEventListener("josm-live-disabled",(()=>Ho.classList.remove("gvs-btn-active")));So.querySelector("#gvs-share-print").addEventListener("click",window.print.bind(window))}}},4873:(C,Rn)=>{"use strict";var or="arrow-right",So=[8594],To="f061",Ro="M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.eF=Rn.DF},4411:(C,Rn)=>{"use strict";var or=[61946],So="M256 64C150 64 64 150 64 256s86 192 192 192c17.7 0 32 14.3 32 32s-14.3 32-32 32C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256v32c0 53-43 96-96 96c-29.3 0-55.6-13.2-73.2-33.9C320 371.1 289.5 384 256 384c-70.7 0-128-57.3-128-128s57.3-128 128-128c27.9 0 53.7 8.9 74.7 24.1c5.7-5 13.1-8.1 21.3-8.1c17.7 0 32 14.3 32 32v80 32c0 17.7 14.3 32 32 32s32-14.3 32-32V256c0-106-86-192-192-192zm64 192a64 64 0 1 0 -128 0 64 64 0 1 0 128 0z";Rn.DF={prefix:"fas",iconName:"at",icon:[512,512,or,"40",So]},Rn.IB=Rn.DF},4056:(C,Rn)=>{"use strict";var or="backward",So=[9194],To="f04a",Ro="M459.5 440.6c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4L288 214.3V256v41.7L459.5 440.6zM256 352V256 128 96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4l-192 160C4.2 237.5 0 246.5 0 256s4.2 18.5 11.5 24.6l192 160c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V352z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.DY=Rn.DF},5163:(C,Rn)=>{"use strict";var or="calendar",So=[128197,128198],To="f133",Ro="M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.fT=Rn.DF},779:(C,Rn)=>{"use strict";var or="camera",So=[62258,"camera-alt"],To="f030",Ro="M149.1 64.8L138.7 96H64C28.7 96 0 124.7 0 160V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64H373.3L362.9 64.8C356.4 45.2 338.1 32 317.4 32H194.6c-20.7 0-39 13.2-45.5 32.8zM256 192a96 96 0 1 1 0 192 96 96 0 1 1 0-192z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn._j=Rn.DF},6565:(C,Rn)=>{"use strict";var or="check",So=[10003,10004],To="f00c",Ro="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.LE=Rn.DF},7361:(C,Rn)=>{"use strict";var or="chevron-down",So=[],To="f078",Ro="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.pt=Rn.DF},4671:(C,Rn)=>{"use strict";var or="circle-exclamation",So=["exclamation-circle"],To="f06a",Ro="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.xH=Rn.DF},939:(C,Rn)=>{"use strict";var or="circle-info",So=["info-circle"],To="f05a",Ro="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.DB=Rn.DF},8455:(C,Rn)=>{"use strict";var or="circle-notch",So=[],To="f1ce",Ro="M222.7 32.1c5 16.9-4.6 34.8-21.5 39.8C121.8 95.6 64 169.1 64 256c0 106 86 192 192 192s192-86 192-192c0-86.9-57.8-160.4-137.1-184.1c-16.9-5-26.6-22.9-21.5-39.8s22.9-26.6 39.8-21.5C434.9 42.1 512 140 512 256c0 141.4-114.6 256-256 256S0 397.4 0 256C0 140 77.1 42.1 182.9 10.6c16.9-5 34.8 4.6 39.8 21.5z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.IJ=Rn.DF},7711:(C,Rn)=>{"use strict";var or="circle-question",So=[62108,"question-circle"],To="f059",Ro="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.FD=Rn.DF},847:(C,Rn)=>{"use strict";var or="cloud-arrow-down",So=[62337,"cloud-download","cloud-download-alt"],To="f0ed",Ro="M144 480C64.5 480 0 415.5 0 336c0-62.8 40.2-116.2 96.2-135.9c-.1-2.7-.2-5.4-.2-8.1c0-88.4 71.6-160 160-160c59.3 0 111 32.2 138.7 80.2C409.9 102 428.3 96 448 96c53 0 96 43 96 96c0 12.2-2.3 23.8-6.4 34.6C596 238.4 640 290.1 640 352c0 70.7-57.3 128-128 128H144zm79-167l80 80c9.4 9.4 24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-39 39V184c0-13.3-10.7-24-24-24s-24 10.7-24 24V318.1l-39-39c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.zo=Rn.DF},3630:(C,Rn)=>{"use strict";var or="comment-dots",So=[128172,62075,"commenting"],To="f4ad",Ro="M256 448c141.4 0 256-93.1 256-208S397.4 32 256 32S0 125.1 0 240c0 45.1 17.7 86.8 47.7 120.9c-1.9 24.5-11.4 46.3-21.4 62.9c-5.5 9.2-11.1 16.6-15.2 21.6c-2.1 2.5-3.7 4.4-4.9 5.7c-.6 .6-1 1.1-1.3 1.4l-.3 .3 0 0 0 0 0 0 0 0c-4.6 4.6-5.9 11.4-3.4 17.4c2.5 6 8.3 9.9 14.8 9.9c28.7 0 57.6-8.9 81.6-19.3c22.9-10 42.4-21.9 54.3-30.6c31.8 11.5 67 17.9 104.1 17.9zM128 208a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm128 0a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm96 32a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.Z6=Rn.DF},6087:(C,Rn)=>{"use strict";var or="copy",So=[],To="f0c5",Ro="M272 0H396.1c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9V336c0 26.5-21.5 48-48 48H272c-26.5 0-48-21.5-48-48V48c0-26.5 21.5-48 48-48zM48 128H192v64H64V448H256V416h64v48c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V176c0-26.5 21.5-48 48-48z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.kZ=Rn.DF},2155:(C,Rn)=>{"use strict";var or="earth-europe",So=["globe-europe"],To="f7a2",Ro="M266.3 48.3L232.5 73.6c-5.4 4-8.5 10.4-8.5 17.1v9.1c0 6.8 5.5 12.3 12.3 12.3c2.4 0 4.8-.7 6.8-2.1l41.8-27.9c2-1.3 4.4-2.1 6.8-2.1h1c6.2 0 11.3 5.1 11.3 11.3c0 3-1.2 5.9-3.3 8l-19.9 19.9c-5.8 5.8-12.9 10.2-20.7 12.8l-26.5 8.8c-5.8 1.9-9.6 7.3-9.6 13.4c0 3.7-1.5 7.3-4.1 10l-17.9 17.9c-6.4 6.4-9.9 15-9.9 24v4.3c0 16.4 13.6 29.7 29.9 29.7c11 0 21.2-6.2 26.1-16l4-8.1c2.4-4.8 7.4-7.9 12.8-7.9c4.5 0 8.7 2.1 11.4 5.7l16.3 21.7c2.1 2.9 5.5 4.5 9.1 4.5c8.4 0 13.9-8.9 10.1-16.4l-1.1-2.3c-3.5-7 0-15.5 7.5-18l21.2-7.1c7.6-2.5 12.7-9.6 12.7-17.6c0-10.3 8.3-18.6 18.6-18.6H400c8.8 0 16 7.2 16 16s-7.2 16-16 16H379.3c-7.2 0-14.2 2.9-19.3 8l-4.7 4.7c-2.1 2.1-3.3 5-3.3 8c0 6.2 5.1 11.3 11.3 11.3h11.3c6 0 11.8 2.4 16 6.6l6.5 6.5c1.8 1.8 2.8 4.3 2.8 6.8s-1 5-2.8 6.8l-7.5 7.5C386 262 384 266.9 384 272s2 10 5.7 13.7L408 304c10.2 10.2 24.1 16 38.6 16H454c6.5-20.2 10-41.7 10-64c0-111.4-87.6-202.4-197.7-207.7zm172 307.9c-3.7-2.6-8.2-4.1-13-4.1c-6 0-11.8-2.4-16-6.6L396 332c-7.7-7.7-18-12-28.9-12c-9.7 0-19.2-3.5-26.6-9.8L314 287.4c-11.6-9.9-26.4-15.4-41.7-15.4H251.4c-12.6 0-25 3.7-35.5 10.7L188.5 301c-17.8 11.9-28.5 31.9-28.5 53.3v3.2c0 17 6.7 33.3 18.7 45.3l16 16c8.5 8.5 20 13.3 32 13.3H248c13.3 0 24 10.7 24 24c0 2.5 .4 5 1.1 7.3c71.3-5.8 132.5-47.6 165.2-107.2zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM187.3 100.7c-6.2-6.2-16.4-6.2-22.6 0l-32 32c-6.2 6.2-6.2 16.4 0 22.6s16.4 6.2 22.6 0l32-32c6.2-6.2 6.2-16.4 0-22.6z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.ye=Rn.DF},1445:(C,Rn)=>{"use strict";var or="ellipsis-vertical",So=["ellipsis-v"],To="f142",Ro="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z";Rn.DF={prefix:"fas",iconName:or,icon:[128,512,So,To,Ro]},Rn.Uw=Rn.DF},5218:(C,Rn)=>{"use strict";var or="forward",So=[9193],To="f04e",Ro="M52.5 440.6c-9.5 7.9-22.8 9.7-34.1 4.4S0 428.4 0 416V96C0 83.6 7.2 72.3 18.4 67s24.5-3.6 34.1 4.4L224 214.3V256v41.7L52.5 440.6zM256 352V256 128 96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4l192 160c7.3 6.1 11.5 15.1 11.5 24.6s-4.2 18.5-11.5 24.6l-192 160c-9.5 7.9-22.8 9.7-34.1 4.4s-18.4-16.6-18.4-29V352z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.ir=Rn.DF},3701:(C,Rn)=>{"use strict";var or="gear",So=[9881,"cog"],To="f013",Ro="M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.gr=Rn.DF},4422:(C,Rn)=>{"use strict";var or="image",So=[],To="f03e",Ro="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.Vm=Rn.DF},3650:(C,Rn)=>{"use strict";var or="layer-group",So=[],To="f5fd",Ro="M264.5 5.2c14.9-6.9 32.1-6.9 47 0l218.6 101c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 149.8C37.4 145.8 32 137.3 32 128s5.4-17.9 13.9-21.8L264.5 5.2zM476.9 209.6l53.2 24.6c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 277.8C37.4 273.8 32 265.3 32 256s5.4-17.9 13.9-21.8l53.2-24.6 152 70.2c23.4 10.8 50.4 10.8 73.8 0l152-70.2zm-152 198.2l152-70.2 53.2 24.6c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L45.9 405.8C37.4 401.8 32 393.3 32 384s5.4-17.9 13.9-21.8l53.2-24.6 152 70.2c23.4 10.8 50.4 10.8 73.8 0z";Rn.DF={prefix:"fas",iconName:or,icon:[576,512,So,To,Ro]},Rn.Kr=Rn.DF},4480:(C,Rn)=>{"use strict";var or="lightbulb",So=[128161],To="f0eb",Ro="M272 384c9.6-31.9 29.5-59.1 49.2-86.2l0 0c5.2-7.1 10.4-14.2 15.4-21.4c19.8-28.5 31.4-63 31.4-100.3C368 78.8 289.2 0 192 0S16 78.8 16 176c0 37.3 11.6 71.9 31.4 100.3c5 7.2 10.2 14.3 15.4 21.4l0 0c19.8 27.1 39.7 54.4 49.2 86.2H272zM192 512c44.2 0 80-35.8 80-80V416H112v16c0 44.2 35.8 80 80 80zM112 176c0 8.8-7.2 16-16 16s-16-7.2-16-16c0-61.9 50.1-112 112-112c8.8 0 16 7.2 16 16s-7.2 16-16 16c-44.2 0-80 35.8-80 80z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.X8=Rn.DF},3911:(C,Rn)=>{"use strict";var or="link",So=[128279,"chain"],To="f0c1",Ro="M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.nN=Rn.DF},5476:(C,Rn)=>{"use strict";var or="location-dot",So=["map-marker-alt"],To="f3c5",Ro="M215.7 499.2C267 435 384 279.4 384 192C384 86 298 0 192 0S0 86 0 192c0 87.4 117 243 168.3 307.2c12.3 15.3 35.1 15.3 47.4 0zM192 128a64 64 0 1 1 0 128 64 64 0 1 1 0-128z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.op=Rn.DF},4666:(C,Rn)=>{"use strict";var or="magnifying-glass",So=[128269,"search"],To="f002",Ro="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.Y$=Rn.DF},8402:(C,Rn)=>{"use strict";var or=[128506,62072],So="f279",To="M384 476.1L192 421.2V35.9L384 90.8V476.1zm32-1.2V88.4L543.1 37.5c15.8-6.3 32.9 5.3 32.9 22.3V394.6c0 9.8-6 18.6-15.1 22.3L416 474.8zM15.1 95.1L160 37.2V423.6L32.9 474.5C17.1 480.8 0 469.2 0 452.2V117.4c0-9.8 6-18.6 15.1-22.3z";Rn.DF={prefix:"fas",iconName:"map",icon:[576,512,or,So,To]},Rn.Wx=Rn.DF},5974:(C,Rn)=>{"use strict";var or="minus",So=[8211,8722,10134,"subtract"],To="f068",Ro="M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.Kl=Rn.DF},5088:(C,Rn)=>{"use strict";var or="palette",So=[127912],To="f53f",Ro="M512 256c0 .9 0 1.8 0 2.7c-.4 36.5-33.6 61.3-70.1 61.3H344c-26.5 0-48 21.5-48 48c0 3.4 .4 6.7 1 9.9c2.1 10.2 6.5 20 10.8 29.9c6.1 13.8 12.1 27.5 12.1 42c0 31.8-21.6 60.7-53.4 62c-3.5 .1-7 .2-10.6 .2C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm0-96a32 32 0 1 0 0-64 32 32 0 1 0 0 64zM288 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm96 96a32 32 0 1 0 0-64 32 32 0 1 0 0 64z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.q2=Rn.DF},4038:(C,Rn)=>{"use strict";var or="panorama",So=[],To="e209",Ro="M45.6 32C20.4 32 0 52.4 0 77.6V434.4C0 459.6 20.4 480 45.6 480c5.1 0 10-.8 14.7-2.4C74.6 472.8 177.6 440 320 440s245.4 32.8 259.6 37.6c4.7 1.6 9.7 2.4 14.7 2.4c25.2 0 45.6-20.4 45.6-45.6V77.6C640 52.4 619.6 32 594.4 32c-5 0-10 .8-14.7 2.4C565.4 39.2 462.4 72 320 72S74.6 39.2 60.4 34.4C55.6 32.8 50.7 32 45.6 32zM96 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm272 0c7.9 0 15.4 3.9 19.8 10.5L512.3 353c5.4 8 5.6 18.4 .4 26.5s-14.7 12.3-24.2 10.7C442.7 382.4 385.2 376 320 376c-65.6 0-123.4 6.5-169.3 14.4c-9.8 1.7-19.7-2.9-24.7-11.5s-4.3-19.4 1.9-27.2L197.3 265c4.6-5.7 11.4-9 18.7-9s14.2 3.3 18.7 9l26.4 33.1 87-127.6c4.5-6.6 11.9-10.5 19.8-10.5z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.UH=Rn.DF},421:(C,Rn)=>{"use strict";var or="paper-plane",So=[61913],To="f1d8",Ro="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L284 427.7l-68.5 74.1c-8.9 9.7-22.9 12.9-35.2 8.1S160 493.2 160 480V396.4c0-4 1.5-7.8 4.2-10.7L331.8 202.8c5.8-6.3 5.6-16-.4-22s-15.7-6.4-22-.7L106 360.8 17.7 316.6C7.1 311.3 .3 300.7 0 288.9s5.9-22.8 16.1-28.7l448-256c10.7-6.1 23.9-5.5 34 1.4z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.XC=Rn.DF},2482:(C,Rn)=>{"use strict";var or="pause",So=[9208],To="f04c",Ro="M48 64C21.5 64 0 85.5 0 112V400c0 26.5 21.5 48 48 48H80c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H48zm192 0c-26.5 0-48 21.5-48 48V400c0 26.5 21.5 48 48 48h32c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H240z";Rn.DF={prefix:"fas",iconName:or,icon:[320,512,So,To,Ro]},Rn.XQ=Rn.DF},625:(C,Rn)=>{"use strict";var or=[128394],So="f304",To="M362.7 19.3L314.3 67.7 444.3 197.7l48.4-48.4c25-25 25-65.5 0-90.5L453.3 19.3c-25-25-65.5-25-90.5 0zm-71 71L58.6 323.5c-10.4 10.4-18 23.3-22.2 37.4L1 481.2C-1.5 489.7 .8 498.8 7 505s15.3 8.5 23.7 6.1l120.3-35.4c14.1-4.2 27-11.8 37.4-22.2L421.7 220.3 291.7 90.3z";Rn.DF={prefix:"fas",iconName:"pen",icon:[512,512,or,So,To]},Rn.Iw=Rn.DF},1658:(C,Rn)=>{"use strict";var or="person-biking",So=[128692,"biking"],To="f84a",Ro="M400 96a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm27.2 64l-61.8-48.8c-17.3-13.6-41.7-13.8-59.1-.3l-83.1 64.2c-30.7 23.8-28.5 70.8 4.3 91.6L288 305.1V416c0 17.7 14.3 32 32 32s32-14.3 32-32V288c0-10.7-5.3-20.7-14.2-26.6L295 232.9l60.3-48.5L396 217c5.7 4.5 12.7 7 20 7h64c17.7 0 32-14.3 32-32s-14.3-32-32-32H427.2zM56 384a72 72 0 1 1 144 0A72 72 0 1 1 56 384zm200 0A128 128 0 1 0 0 384a128 128 0 1 0 256 0zm184 0a72 72 0 1 1 144 0 72 72 0 1 1 -144 0zm200 0a128 128 0 1 0 -256 0 128 128 0 1 0 256 0z";Rn.DF={prefix:"fas",iconName:or,icon:[640,512,So,To,Ro]},Rn.uY=Rn.DF},1788:(C,Rn)=>{"use strict";var or="play",So=[9654],To="f04b",Ro="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.zc=Rn.DF},4229:(C,Rn)=>{"use strict";var or="plus",So=[10133,61543,"add"],To="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,"2b",To]},Rn.r8=Rn.DF},6666:(C,Rn)=>{"use strict";var or="print",So=[128424,128438,9113],To="f02f",Ro="M128 0C92.7 0 64 28.7 64 64v96h64V64H354.7L384 93.3V160h64V93.3c0-17-6.7-33.3-18.7-45.3L400 18.7C388 6.7 371.7 0 354.7 0H128zM384 352v32 64H128V384 368 352H384zm64 32h32c17.7 0 32-14.3 32-32V256c0-35.3-28.7-64-64-64H64c-35.3 0-64 28.7-64 64v96c0 17.7 14.3 32 32 32H64v64c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V384zM432 248a24 24 0 1 1 0 48 24 24 0 1 1 0-48z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.wf=Rn.DF},8117:(C,Rn)=>{"use strict";var or="rocket",So=[],To="f135",Ro="M156.6 384.9L125.7 354c-8.5-8.5-11.5-20.8-7.7-32.2c3-8.9 7-20.5 11.8-33.8L24 288c-8.6 0-16.6-4.6-20.9-12.1s-4.2-16.7 .2-24.1l52.5-88.5c13-21.9 36.5-35.3 61.9-35.3l82.3 0c2.4-4 4.8-7.7 7.2-11.3C289.1-4.1 411.1-8.1 483.9 5.3c11.6 2.1 20.6 11.2 22.8 22.8c13.4 72.9 9.3 194.8-111.4 276.7c-3.5 2.4-7.3 4.8-11.3 7.2v82.3c0 25.4-13.4 49-35.3 61.9l-88.5 52.5c-7.4 4.4-16.6 4.5-24.1 .2s-12.1-12.2-12.1-20.9V380.8c-14.1 4.9-26.4 8.9-35.7 11.9c-11.2 3.6-23.4 .5-31.8-7.8zM384 168a40 40 0 1 0 0-80 40 40 0 1 0 0 80z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.tM=Rn.DF},953:(C,Rn)=>{"use strict";var or="satellite-dish",So=[128225],To="f7c0",Ro="M192 32c0-17.7 14.3-32 32-32C383.1 0 512 128.9 512 288c0 17.7-14.3 32-32 32s-32-14.3-32-32C448 164.3 347.7 64 224 64c-17.7 0-32-14.3-32-32zM60.6 220.6L164.7 324.7l28.4-28.4c-.7-2.6-1.1-5.4-1.1-8.3c0-17.7 14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32c-2.9 0-5.6-.4-8.3-1.1l-28.4 28.4L291.4 451.4c14.5 14.5 11.8 38.8-7.3 46.3C260.5 506.9 234.9 512 208 512C93.1 512 0 418.9 0 304c0-26.9 5.1-52.5 14.4-76.1c7.5-19 31.8-21.8 46.3-7.3zM224 96c106 0 192 86 192 192c0 17.7-14.3 32-32 32s-32-14.3-32-32c0-70.7-57.3-128-128-128c-17.7 0-32-14.3-32-32s14.3-32 32-32z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.QN=Rn.DF},8818:(C,Rn)=>{"use strict";var or="share-nodes",So=["share-alt"],To="f1e0",Ro="M352 224c53 0 96-43 96-96s-43-96-96-96s-96 43-96 96c0 4 .2 8 .7 11.9l-94.1 47C145.4 170.2 121.9 160 96 160c-53 0-96 43-96 96s43 96 96 96c25.9 0 49.4-10.2 66.6-26.9l94.1 47c-.5 3.9-.7 7.8-.7 11.9c0 53 43 96 96 96s96-43 96-96s-43-96-96-96c-25.9 0-49.4 10.2-66.6 26.9l-94.1-47c.5-3.9 .7-7.8 .7-11.9s-.2-8-.7-11.9l94.1-47C302.6 213.8 326.1 224 352 224z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.M6=Rn.DF},4470:(C,Rn)=>{"use strict";var or="sliders",So=["sliders-h"],To="f1de",Ro="M0 416c0 17.7 14.3 32 32 32l54.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 448c17.7 0 32-14.3 32-32s-14.3-32-32-32l-246.7 0c-12.3-28.3-40.5-48-73.3-48s-61 19.7-73.3 48L32 384c-17.7 0-32 14.3-32 32zm128 0a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zM320 256a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm32-80c-32.8 0-61 19.7-73.3 48L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l246.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48l54.7 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-54.7 0c-12.3-28.3-40.5-48-73.3-48zM192 128a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm73.3-64C253 35.7 224.8 16 192 16s-61 19.7-73.3 48L32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l86.7 0c12.3 28.3 40.5 48 73.3 48s61-19.7 73.3-48L480 128c17.7 0 32-14.3 32-32s-14.3-32-32-32L265.3 64z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.cR=Rn.DF},6580:(C,Rn)=>{"use strict";var or="square-rss",So=["rss-square"],To="f143",Ro="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM96 136c0-13.3 10.7-24 24-24c137 0 248 111 248 248c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-110.5-89.5-200-200-200c-13.3 0-24-10.7-24-24zm0 96c0-13.3 10.7-24 24-24c83.9 0 152 68.1 152 152c0 13.3-10.7 24-24 24s-24-10.7-24-24c0-57.4-46.6-104-104-104c-13.3 0-24-10.7-24-24zm0 120a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.mW=Rn.DF},8381:(C,Rn)=>{"use strict";var or="triangle-exclamation",So=[9888,"exclamation-triangle","warning"],To="f071",Ro="M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z";Rn.DF={prefix:"fas",iconName:or,icon:[512,512,So,To,Ro]},Rn.ik=Rn.DF},3299:(C,Rn)=>{"use strict";var or="user",So=[128100,62144],To="f007",Ro="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z";Rn.DF={prefix:"fas",iconName:or,icon:[448,512,So,To,Ro]},Rn.IL=Rn.DF},6899:(C,Rn)=>{"use strict";var or="xmark",So=[128473,10005,10006,10060,215,"close","multiply","remove","times"],To="f00d",Ro="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z";Rn.DF={prefix:"fas",iconName:or,icon:[384,512,So,To,Ro]},Rn.g8=Rn.DF},3114:(C,Rn,or)=>{"use strict";or.d(Rn,{$N:()=>Hh,AE:()=>im,F6:()=>ep,Il:()=>Eh,Of:()=>Sp,P6:()=>Yu,U3:()=>Gh,Yc:()=>Mp,k8:()=>op,rq:()=>ap,tl:()=>Ro,we:()=>ip});var So=or(7760),To=Object.defineProperty,__export=(C,Rn)=>{for(var or in Rn)To(C,or,{get:Rn[or],enumerable:!0})},Ro={};
|
|
13
13
|
/*!
|
|
14
14
|
* Photo Sphere Viewer 5.10.1
|
|
15
15
|
* @copyright 2014-2015 Jérémy Heleine
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
* Copyright 2010-2024 Three.js Authors
|
|
22
22
|
* SPDX-License-Identifier: MIT
|
|
23
23
|
*/
|
|
24
|
-
const So="168",To=0,Ro=1,Uo=2,Oo=1,Ho=2,qo=3,dl=0,ml=1,fl=2,vl=0,bl=1,kl=2,Ll=3,Dl=4,Nc=5,jc=100,Zc=101,eu=102,Ku=103,Yu=104,Eh=200,Th=201,Ch=202,Lh=203,Dh=204,Rh=205,Nh=206,Uh=207,Bh=208,Fh=209,Oh=210,Vh=211,jh=212,Gh=213,Hh=214,Zh=0,Wh=1,qh=2,Kh=3,Qh=4,Xh=5,Yh=6,Jh=7,$h=0,ed=1,td=2,id=0,nd=1,rd=2,ad=3,sd=4,od=5,ld=6,cd=7,ud=301,hd=302,dd=303,pd=304,md=306,fd=1e3,gd=1001,Ad=1002,yd=1003,vd=1004,xd=1005,_d=1006,bd=1007,wd=1008,Ed=1009,Md=1010,Sd=1011,kd=1012,Td=1013,Id=1014,Cd=1015,Ld=1016,Pd=1017,zd=1018,Dd=1020,Rd=35902,Nd=1021,Ud=1022,Bd=1023,Fd=1024,Od=1025,Vd=1026,jd=1027,Gd=1028,Hd=1029,Zd=1030,Wd=1031,qd=1033,Kd=33776,Qd=33777,Xd=33778,Yd=33779,Jd=35840,$d=35841,ep=35842,tp=35843,ip=36196,np=37492,rp=37496,ap=37808,sp=37809,op=37810,lp=37811,cp=37812,up=37813,hp=37814,dp=37815,pp=37816,mp=37817,fp=37818,gp=37819,Ap=37820,yp=37821,vp=36492,xp=36494,_p=36495,bp=36283,wp=36284,Ep=36285,Mp=36286,Sp=2300,kp=2301,Tp=2302,Ip=2400,Cp=2401,Lp=2402,Pp=3201,zp=0,Dp=1,Rp="",Np="srgb",Up="srgb-linear",Bp="display-p3",Fp="display-p3-linear",Op="linear",Vp="srgb",jp="rec709",Gp="p3",Hp=7680,Zp=512,Wp=513,qp=514,Kp=515,Qp=516,Xp=517,Yp=518,Jp=519,$p=35044,em="300 es",tm=2e3,im=2001;class EventDispatcher{addEventListener(C,Rn){void 0===this._listeners&&(this._listeners={});const or=this._listeners;void 0===or[C]&&(or[C]=[]),-1===or[C].indexOf(Rn)&&or[C].push(Rn)}hasEventListener(C,Rn){if(void 0===this._listeners)return!1;const or=this._listeners;return void 0!==or[C]&&-1!==or[C].indexOf(Rn)}removeEventListener(C,Rn){if(void 0===this._listeners)return;const or=this._listeners[C];if(void 0!==or){const C=or.indexOf(Rn);-1!==C&&or.splice(C,1)}}dispatchEvent(C){if(void 0===this._listeners)return;const Rn=this._listeners[C.type];if(void 0!==Rn){C.target=this;const or=Rn.slice(0);for(let Rn=0,So=or.length;Rn<So;Rn++)or[Rn].call(this,C);C.target=null}}}const nm=["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 rm=1234567;const am=Math.PI/180,sm=180/Math.PI;function generateUUID(){const C=4294967295*Math.random()|0,Rn=4294967295*Math.random()|0,or=4294967295*Math.random()|0,So=4294967295*Math.random()|0;return(nm[255&C]+nm[C>>8&255]+nm[C>>16&255]+nm[C>>24&255]+"-"+nm[255&Rn]+nm[Rn>>8&255]+"-"+nm[Rn>>16&15|64]+nm[Rn>>24&255]+"-"+nm[63&or|128]+nm[or>>8&255]+"-"+nm[or>>16&255]+nm[or>>24&255]+nm[255&So]+nm[So>>8&255]+nm[So>>16&255]+nm[So>>24&255]).toLowerCase()}function clamp(C,Rn,or){return Math.max(Rn,Math.min(or,C))}function euclideanModulo(C,Rn){return(C%Rn+Rn)%Rn}function lerp(C,Rn,or){return(1-or)*C+or*Rn}function denormalize(C,Rn){switch(Rn.constructor){case Float32Array:return C;case Uint32Array:return C/4294967295;case Uint16Array:return C/65535;case Uint8Array:return C/255;case Int32Array:return Math.max(C/2147483647,-1);case Int16Array:return Math.max(C/32767,-1);case Int8Array:return Math.max(C/127,-1);default:throw new Error("Invalid component type.")}}function normalize(C,Rn){switch(Rn.constructor){case Float32Array:return C;case Uint32Array:return Math.round(4294967295*C);case Uint16Array:return Math.round(65535*C);case Uint8Array:return Math.round(255*C);case Int32Array:return Math.round(2147483647*C);case Int16Array:return Math.round(32767*C);case Int8Array:return Math.round(127*C);default:throw new Error("Invalid component type.")}}const om={DEG2RAD:am,RAD2DEG:sm,generateUUID:generateUUID,clamp:clamp,euclideanModulo:euclideanModulo,mapLinear:function(C,Rn,or,So,To){return So+(C-Rn)*(To-So)/(or-Rn)},inverseLerp:function(C,Rn,or){return C!==Rn?(or-C)/(Rn-C):0},lerp:lerp,damp:function(C,Rn,or,So){return lerp(C,Rn,1-Math.exp(-or*So))},pingpong:function(C,Rn){return void 0===Rn&&(Rn=1),Rn-Math.abs(euclideanModulo(C,2*Rn)-Rn)},smoothstep:function(C,Rn,or){return C<=Rn?0:C>=or?1:(C=(C-Rn)/(or-Rn))*C*(3-2*C)},smootherstep:function(C,Rn,or){return C<=Rn?0:C>=or?1:(C=(C-Rn)/(or-Rn))*C*C*(C*(6*C-15)+10)},randInt:function(C,Rn){return C+Math.floor(Math.random()*(Rn-C+1))},randFloat:function(C,Rn){return C+Math.random()*(Rn-C)},randFloatSpread:function(C){return C*(.5-Math.random())},seededRandom:function(C){void 0!==C&&(rm=C);let Rn=rm+=1831565813;return Rn=Math.imul(Rn^Rn>>>15,1|Rn),Rn^=Rn+Math.imul(Rn^Rn>>>7,61|Rn),((Rn^Rn>>>14)>>>0)/4294967296},degToRad:function(C){return C*am},radToDeg:function(C){return C*sm},isPowerOfTwo:function(C){return 0===(C&C-1)&&0!==C},ceilPowerOfTwo:function(C){return Math.pow(2,Math.ceil(Math.log(C)/Math.LN2))},floorPowerOfTwo:function(C){return Math.pow(2,Math.floor(Math.log(C)/Math.LN2))},setQuaternionFromProperEuler:function(C,Rn,or,So,To){const Ro=Math.cos,Uo=Math.sin,Oo=Ro(or/2),Ho=Uo(or/2),qo=Ro((Rn+So)/2),dl=Uo((Rn+So)/2),ml=Ro((Rn-So)/2),fl=Uo((Rn-So)/2),vl=Ro((So-Rn)/2),bl=Uo((So-Rn)/2);switch(To){case"XYX":C.set(Oo*dl,Ho*ml,Ho*fl,Oo*qo);break;case"YZY":C.set(Ho*fl,Oo*dl,Ho*ml,Oo*qo);break;case"ZXZ":C.set(Ho*ml,Ho*fl,Oo*dl,Oo*qo);break;case"XZX":C.set(Oo*dl,Ho*bl,Ho*vl,Oo*qo);break;case"YXY":C.set(Ho*vl,Oo*dl,Ho*bl,Oo*qo);break;case"ZYZ":C.set(Ho*bl,Ho*vl,Oo*dl,Oo*qo);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+To)}},normalize:normalize,denormalize:denormalize};class Vector2{constructor(C,Rn){void 0===C&&(C=0),void 0===Rn&&(Rn=0),Vector2.prototype.isVector2=!0,this.x=C,this.y=Rn}get width(){return this.x}set width(C){this.x=C}get height(){return this.y}set height(C){this.y=C}set(C,Rn){return this.x=C,this.y=Rn,this}setScalar(C){return this.x=C,this.y=C,this}setX(C){return this.x=C,this}setY(C){return this.y=C,this}setComponent(C,Rn){switch(C){case 0:this.x=Rn;break;case 1:this.y=Rn;break;default:throw new Error("index is out of range: "+C)}return this}getComponent(C){switch(C){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+C)}}clone(){return new this.constructor(this.x,this.y)}copy(C){return this.x=C.x,this.y=C.y,this}add(C){return this.x+=C.x,this.y+=C.y,this}addScalar(C){return this.x+=C,this.y+=C,this}addVectors(C,Rn){return this.x=C.x+Rn.x,this.y=C.y+Rn.y,this}addScaledVector(C,Rn){return this.x+=C.x*Rn,this.y+=C.y*Rn,this}sub(C){return this.x-=C.x,this.y-=C.y,this}subScalar(C){return this.x-=C,this.y-=C,this}subVectors(C,Rn){return this.x=C.x-Rn.x,this.y=C.y-Rn.y,this}multiply(C){return this.x*=C.x,this.y*=C.y,this}multiplyScalar(C){return this.x*=C,this.y*=C,this}divide(C){return this.x/=C.x,this.y/=C.y,this}divideScalar(C){return this.multiplyScalar(1/C)}applyMatrix3(C){const Rn=this.x,or=this.y,So=C.elements;return this.x=So[0]*Rn+So[3]*or+So[6],this.y=So[1]*Rn+So[4]*or+So[7],this}min(C){return this.x=Math.min(this.x,C.x),this.y=Math.min(this.y,C.y),this}max(C){return this.x=Math.max(this.x,C.x),this.y=Math.max(this.y,C.y),this}clamp(C,Rn){return this.x=Math.max(C.x,Math.min(Rn.x,this.x)),this.y=Math.max(C.y,Math.min(Rn.y,this.y)),this}clampScalar(C,Rn){return this.x=Math.max(C,Math.min(Rn,this.x)),this.y=Math.max(C,Math.min(Rn,this.y)),this}clampLength(C,Rn){const or=this.length();return this.divideScalar(or||1).multiplyScalar(Math.max(C,Math.min(Rn,or)))}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(C){return this.x*C.x+this.y*C.y}cross(C){return this.x*C.y-this.y*C.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(C){const Rn=Math.sqrt(this.lengthSq()*C.lengthSq());if(0===Rn)return Math.PI/2;const or=this.dot(C)/Rn;return Math.acos(clamp(or,-1,1))}distanceTo(C){return Math.sqrt(this.distanceToSquared(C))}distanceToSquared(C){const Rn=this.x-C.x,or=this.y-C.y;return Rn*Rn+or*or}manhattanDistanceTo(C){return Math.abs(this.x-C.x)+Math.abs(this.y-C.y)}setLength(C){return this.normalize().multiplyScalar(C)}lerp(C,Rn){return this.x+=(C.x-this.x)*Rn,this.y+=(C.y-this.y)*Rn,this}lerpVectors(C,Rn,or){return this.x=C.x+(Rn.x-C.x)*or,this.y=C.y+(Rn.y-C.y)*or,this}equals(C){return C.x===this.x&&C.y===this.y}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.x=C[Rn],this.y=C[Rn+1],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.x,C[Rn+1]=this.y,C}fromBufferAttribute(C,Rn){return this.x=C.getX(Rn),this.y=C.getY(Rn),this}rotateAround(C,Rn){const or=Math.cos(Rn),So=Math.sin(Rn),To=this.x-C.x,Ro=this.y-C.y;return this.x=To*or-Ro*So+C.x,this.y=To*So+Ro*or+C.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Matrix3{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==C&&this.set(C,Rn,or,So,To,Ro,Uo,Oo,Ho)}set(C,Rn,or,So,To,Ro,Uo,Oo,Ho){const qo=this.elements;return qo[0]=C,qo[1]=So,qo[2]=Uo,qo[3]=Rn,qo[4]=To,qo[5]=Oo,qo[6]=or,qo[7]=Ro,qo[8]=Ho,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(C){const Rn=this.elements,or=C.elements;return Rn[0]=or[0],Rn[1]=or[1],Rn[2]=or[2],Rn[3]=or[3],Rn[4]=or[4],Rn[5]=or[5],Rn[6]=or[6],Rn[7]=or[7],Rn[8]=or[8],this}extractBasis(C,Rn,or){return C.setFromMatrix3Column(this,0),Rn.setFromMatrix3Column(this,1),or.setFromMatrix3Column(this,2),this}setFromMatrix4(C){const Rn=C.elements;return this.set(Rn[0],Rn[4],Rn[8],Rn[1],Rn[5],Rn[9],Rn[2],Rn[6],Rn[10]),this}multiply(C){return this.multiplyMatrices(this,C)}premultiply(C){return this.multiplyMatrices(C,this)}multiplyMatrices(C,Rn){const or=C.elements,So=Rn.elements,To=this.elements,Ro=or[0],Uo=or[3],Oo=or[6],Ho=or[1],qo=or[4],dl=or[7],ml=or[2],fl=or[5],vl=or[8],bl=So[0],kl=So[3],Ll=So[6],Dl=So[1],Nc=So[4],jc=So[7],Zc=So[2],eu=So[5],Ku=So[8];return To[0]=Ro*bl+Uo*Dl+Oo*Zc,To[3]=Ro*kl+Uo*Nc+Oo*eu,To[6]=Ro*Ll+Uo*jc+Oo*Ku,To[1]=Ho*bl+qo*Dl+dl*Zc,To[4]=Ho*kl+qo*Nc+dl*eu,To[7]=Ho*Ll+qo*jc+dl*Ku,To[2]=ml*bl+fl*Dl+vl*Zc,To[5]=ml*kl+fl*Nc+vl*eu,To[8]=ml*Ll+fl*jc+vl*Ku,this}multiplyScalar(C){const Rn=this.elements;return Rn[0]*=C,Rn[3]*=C,Rn[6]*=C,Rn[1]*=C,Rn[4]*=C,Rn[7]*=C,Rn[2]*=C,Rn[5]*=C,Rn[8]*=C,this}determinant(){const C=this.elements,Rn=C[0],or=C[1],So=C[2],To=C[3],Ro=C[4],Uo=C[5],Oo=C[6],Ho=C[7],qo=C[8];return Rn*Ro*qo-Rn*Uo*Ho-or*To*qo+or*Uo*Oo+So*To*Ho-So*Ro*Oo}invert(){const C=this.elements,Rn=C[0],or=C[1],So=C[2],To=C[3],Ro=C[4],Uo=C[5],Oo=C[6],Ho=C[7],qo=C[8],dl=qo*Ro-Uo*Ho,ml=Uo*Oo-qo*To,fl=Ho*To-Ro*Oo,vl=Rn*dl+or*ml+So*fl;if(0===vl)return this.set(0,0,0,0,0,0,0,0,0);const bl=1/vl;return C[0]=dl*bl,C[1]=(So*Ho-qo*or)*bl,C[2]=(Uo*or-So*Ro)*bl,C[3]=ml*bl,C[4]=(qo*Rn-So*Oo)*bl,C[5]=(So*To-Uo*Rn)*bl,C[6]=fl*bl,C[7]=(or*Oo-Ho*Rn)*bl,C[8]=(Ro*Rn-or*To)*bl,this}transpose(){let C;const Rn=this.elements;return C=Rn[1],Rn[1]=Rn[3],Rn[3]=C,C=Rn[2],Rn[2]=Rn[6],Rn[6]=C,C=Rn[5],Rn[5]=Rn[7],Rn[7]=C,this}getNormalMatrix(C){return this.setFromMatrix4(C).invert().transpose()}transposeIntoArray(C){const Rn=this.elements;return C[0]=Rn[0],C[1]=Rn[3],C[2]=Rn[6],C[3]=Rn[1],C[4]=Rn[4],C[5]=Rn[7],C[6]=Rn[2],C[7]=Rn[5],C[8]=Rn[8],this}setUvTransform(C,Rn,or,So,To,Ro,Uo){const Oo=Math.cos(To),Ho=Math.sin(To);return this.set(or*Oo,or*Ho,-or*(Oo*Ro+Ho*Uo)+Ro+C,-So*Ho,So*Oo,-So*(-Ho*Ro+Oo*Uo)+Uo+Rn,0,0,1),this}scale(C,Rn){return this.premultiply(lm.makeScale(C,Rn)),this}rotate(C){return this.premultiply(lm.makeRotation(-C)),this}translate(C,Rn){return this.premultiply(lm.makeTranslation(C,Rn)),this}makeTranslation(C,Rn){return C.isVector2?this.set(1,0,C.x,0,1,C.y,0,0,1):this.set(1,0,C,0,1,Rn,0,0,1),this}makeRotation(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(Rn,-or,0,or,Rn,0,0,0,1),this}makeScale(C,Rn){return this.set(C,0,0,0,Rn,0,0,0,1),this}equals(C){const Rn=this.elements,or=C.elements;for(let So=0;So<9;So++)if(Rn[So]!==or[So])return!1;return!0}fromArray(C,Rn){void 0===Rn&&(Rn=0);for(let or=0;or<9;or++)this.elements[or]=C[or+Rn];return this}toArray(C,Rn){void 0===C&&(C=[]),void 0===Rn&&(Rn=0);const or=this.elements;return C[Rn]=or[0],C[Rn+1]=or[1],C[Rn+2]=or[2],C[Rn+3]=or[3],C[Rn+4]=or[4],C[Rn+5]=or[5],C[Rn+6]=or[6],C[Rn+7]=or[7],C[Rn+8]=or[8],C}clone(){return(new this.constructor).fromArray(this.elements)}}const lm=new Matrix3;function arrayNeedsUint32(C){for(let Rn=C.length-1;Rn>=0;--Rn)if(C[Rn]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function createElementNS(C){return document.createElementNS("http://www.w3.org/1999/xhtml",C)}function createCanvasElement(){const C=createElementNS("canvas");return C.style.display="block",C}const cm={};function warnOnce(C){C in cm||(cm[C]=!0,console.warn(C))}const um=(new Matrix3).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),hm=(new Matrix3).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),dm={[Up]:{transfer:Op,primaries:jp,luminanceCoefficients:[.2126,.7152,.0722],toReference:C=>C,fromReference:C=>C},[Np]:{transfer:Vp,primaries:jp,luminanceCoefficients:[.2126,.7152,.0722],toReference:C=>C.convertSRGBToLinear(),fromReference:C=>C.convertLinearToSRGB()},[Fp]:{transfer:Op,primaries:Gp,luminanceCoefficients:[.2289,.6917,.0793],toReference:C=>C.applyMatrix3(hm),fromReference:C=>C.applyMatrix3(um)},[Bp]:{transfer:Vp,primaries:Gp,luminanceCoefficients:[.2289,.6917,.0793],toReference:C=>C.convertSRGBToLinear().applyMatrix3(hm),fromReference:C=>C.applyMatrix3(um).convertLinearToSRGB()}},pm=new Set([Up,Fp]),mm={enabled:!0,_workingColorSpace:Up,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(C){if(!pm.has(C))throw new Error('Unsupported working color space, "'+C+'".');this._workingColorSpace=C},convert:function(C,Rn,or){if(!1===this.enabled||Rn===or||!Rn||!or)return C;const So=dm[Rn].toReference;return(0,dm[or].fromReference)(So(C))},fromWorkingColorSpace:function(C,Rn){return this.convert(C,this._workingColorSpace,Rn)},toWorkingColorSpace:function(C,Rn){return this.convert(C,Rn,this._workingColorSpace)},getPrimaries:function(C){return dm[C].primaries},getTransfer:function(C){return C===Rp?Op:dm[C].transfer},getLuminanceCoefficients:function(C,Rn){return void 0===Rn&&(Rn=this._workingColorSpace),C.fromArray(dm[Rn].luminanceCoefficients)}};function SRGBToLinear(C){return C<.04045?.0773993808*C:Math.pow(.9478672986*C+.0521327014,2.4)}function LinearToSRGB(C){return C<.0031308?12.92*C:1.055*Math.pow(C,.41666)-.055}let fm;class ImageUtils{static getDataURL(C){if(/^data:/i.test(C.src))return C.src;if("undefined"===typeof HTMLCanvasElement)return C.src;let Rn;if(C instanceof HTMLCanvasElement)Rn=C;else{void 0===fm&&(fm=createElementNS("canvas")),fm.width=C.width,fm.height=C.height;const or=fm.getContext("2d");C instanceof ImageData?or.putImageData(C,0,0):or.drawImage(C,0,0,C.width,C.height),Rn=fm}return Rn.width>2048||Rn.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",C),Rn.toDataURL("image/jpeg",.6)):Rn.toDataURL("image/png")}static sRGBToLinear(C){if("undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&C instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&C instanceof ImageBitmap){const Rn=createElementNS("canvas");Rn.width=C.width,Rn.height=C.height;const or=Rn.getContext("2d");or.drawImage(C,0,0,C.width,C.height);const So=or.getImageData(0,0,C.width,C.height),To=So.data;for(let C=0;C<To.length;C++)To[C]=255*SRGBToLinear(To[C]/255);return or.putImageData(So,0,0),Rn}if(C.data){const Rn=C.data.slice(0);for(let C=0;C<Rn.length;C++)Rn instanceof Uint8Array||Rn instanceof Uint8ClampedArray?Rn[C]=Math.floor(255*SRGBToLinear(Rn[C]/255)):Rn[C]=SRGBToLinear(Rn[C]);return{data:Rn,width:C.width,height:C.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),C}}let gm=0;class Source{constructor(C){void 0===C&&(C=null),this.isSource=!0,Object.defineProperty(this,"id",{value:gm++}),this.uuid=generateUUID(),this.data=C,this.dataReady=!0,this.version=0}set needsUpdate(C){!0===C&&this.version++}toJSON(C){const Rn=void 0===C||"string"===typeof C;if(!Rn&&void 0!==C.images[this.uuid])return C.images[this.uuid];const or={uuid:this.uuid,url:""},So=this.data;if(null!==So){let C;if(Array.isArray(So)){C=[];for(let Rn=0,or=So.length;Rn<or;Rn++)So[Rn].isDataTexture?C.push(serializeImage(So[Rn].image)):C.push(serializeImage(So[Rn]))}else C=serializeImage(So);or.url=C}return Rn||(C.images[this.uuid]=or),or}}function serializeImage(C){return"undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&C instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&C instanceof ImageBitmap?ImageUtils.getDataURL(C):C.data?{data:Array.from(C.data),width:C.width,height:C.height,type:C.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Am=0;class Texture extends EventDispatcher{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){void 0===C&&(C=Texture.DEFAULT_IMAGE),void 0===Rn&&(Rn=Texture.DEFAULT_MAPPING),void 0===or&&(or=gd),void 0===So&&(So=gd),void 0===To&&(To=_d),void 0===Ro&&(Ro=wd),void 0===Uo&&(Uo=Bd),void 0===Oo&&(Oo=Ed),void 0===Ho&&(Ho=Texture.DEFAULT_ANISOTROPY),void 0===qo&&(qo=Rp),super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Am++}),this.uuid=generateUUID(),this.name="",this.source=new Source(C),this.mipmaps=[],this.mapping=Rn,this.channel=0,this.wrapS=or,this.wrapT=So,this.magFilter=To,this.minFilter=Ro,this.anisotropy=Ho,this.format=Uo,this.internalFormat=null,this.type=Oo,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=qo,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(C){void 0===C&&(C=null),this.source.data=C}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(C){return this.name=C.name,this.source=C.source,this.mipmaps=C.mipmaps.slice(0),this.mapping=C.mapping,this.channel=C.channel,this.wrapS=C.wrapS,this.wrapT=C.wrapT,this.magFilter=C.magFilter,this.minFilter=C.minFilter,this.anisotropy=C.anisotropy,this.format=C.format,this.internalFormat=C.internalFormat,this.type=C.type,this.offset.copy(C.offset),this.repeat.copy(C.repeat),this.center.copy(C.center),this.rotation=C.rotation,this.matrixAutoUpdate=C.matrixAutoUpdate,this.matrix.copy(C.matrix),this.generateMipmaps=C.generateMipmaps,this.premultiplyAlpha=C.premultiplyAlpha,this.flipY=C.flipY,this.unpackAlignment=C.unpackAlignment,this.colorSpace=C.colorSpace,this.userData=JSON.parse(JSON.stringify(C.userData)),this.needsUpdate=!0,this}toJSON(C){const Rn=void 0===C||"string"===typeof C;if(!Rn&&void 0!==C.textures[this.uuid])return C.textures[this.uuid];const or={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(C).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&&(or.userData=this.userData),Rn||(C.textures[this.uuid]=or),or}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(C){if(300!==this.mapping)return C;if(C.applyMatrix3(this.matrix),C.x<0||C.x>1)switch(this.wrapS){case fd:C.x=C.x-Math.floor(C.x);break;case gd:C.x=C.x<0?0:1;break;case Ad:1===Math.abs(Math.floor(C.x)%2)?C.x=Math.ceil(C.x)-C.x:C.x=C.x-Math.floor(C.x)}if(C.y<0||C.y>1)switch(this.wrapT){case fd:C.y=C.y-Math.floor(C.y);break;case gd:C.y=C.y<0?0:1;break;case Ad:1===Math.abs(Math.floor(C.y)%2)?C.y=Math.ceil(C.y)-C.y:C.y=C.y-Math.floor(C.y)}return this.flipY&&(C.y=1-C.y),C}set needsUpdate(C){!0===C&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(C){!0===C&&this.pmremVersion++}}Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=300,Texture.DEFAULT_ANISOTROPY=1;class Vector4{constructor(C,Rn,or,So){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),void 0===So&&(So=1),Vector4.prototype.isVector4=!0,this.x=C,this.y=Rn,this.z=or,this.w=So}get width(){return this.z}set width(C){this.z=C}get height(){return this.w}set height(C){this.w=C}set(C,Rn,or,So){return this.x=C,this.y=Rn,this.z=or,this.w=So,this}setScalar(C){return this.x=C,this.y=C,this.z=C,this.w=C,this}setX(C){return this.x=C,this}setY(C){return this.y=C,this}setZ(C){return this.z=C,this}setW(C){return this.w=C,this}setComponent(C,Rn){switch(C){case 0:this.x=Rn;break;case 1:this.y=Rn;break;case 2:this.z=Rn;break;case 3:this.w=Rn;break;default:throw new Error("index is out of range: "+C)}return this}getComponent(C){switch(C){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: "+C)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(C){return this.x=C.x,this.y=C.y,this.z=C.z,this.w=void 0!==C.w?C.w:1,this}add(C){return this.x+=C.x,this.y+=C.y,this.z+=C.z,this.w+=C.w,this}addScalar(C){return this.x+=C,this.y+=C,this.z+=C,this.w+=C,this}addVectors(C,Rn){return this.x=C.x+Rn.x,this.y=C.y+Rn.y,this.z=C.z+Rn.z,this.w=C.w+Rn.w,this}addScaledVector(C,Rn){return this.x+=C.x*Rn,this.y+=C.y*Rn,this.z+=C.z*Rn,this.w+=C.w*Rn,this}sub(C){return this.x-=C.x,this.y-=C.y,this.z-=C.z,this.w-=C.w,this}subScalar(C){return this.x-=C,this.y-=C,this.z-=C,this.w-=C,this}subVectors(C,Rn){return this.x=C.x-Rn.x,this.y=C.y-Rn.y,this.z=C.z-Rn.z,this.w=C.w-Rn.w,this}multiply(C){return this.x*=C.x,this.y*=C.y,this.z*=C.z,this.w*=C.w,this}multiplyScalar(C){return this.x*=C,this.y*=C,this.z*=C,this.w*=C,this}applyMatrix4(C){const Rn=this.x,or=this.y,So=this.z,To=this.w,Ro=C.elements;return this.x=Ro[0]*Rn+Ro[4]*or+Ro[8]*So+Ro[12]*To,this.y=Ro[1]*Rn+Ro[5]*or+Ro[9]*So+Ro[13]*To,this.z=Ro[2]*Rn+Ro[6]*or+Ro[10]*So+Ro[14]*To,this.w=Ro[3]*Rn+Ro[7]*or+Ro[11]*So+Ro[15]*To,this}divideScalar(C){return this.multiplyScalar(1/C)}setAxisAngleFromQuaternion(C){this.w=2*Math.acos(C.w);const Rn=Math.sqrt(1-C.w*C.w);return Rn<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=C.x/Rn,this.y=C.y/Rn,this.z=C.z/Rn),this}setAxisAngleFromRotationMatrix(C){let Rn,or,So,To;const Ro=.01,Uo=.1,Oo=C.elements,Ho=Oo[0],qo=Oo[4],dl=Oo[8],ml=Oo[1],fl=Oo[5],vl=Oo[9],bl=Oo[2],kl=Oo[6],Ll=Oo[10];if(Math.abs(qo-ml)<Ro&&Math.abs(dl-bl)<Ro&&Math.abs(vl-kl)<Ro){if(Math.abs(qo+ml)<Uo&&Math.abs(dl+bl)<Uo&&Math.abs(vl+kl)<Uo&&Math.abs(Ho+fl+Ll-3)<Uo)return this.set(1,0,0,0),this;Rn=Math.PI;const C=(Ho+1)/2,Oo=(fl+1)/2,Dl=(Ll+1)/2,Nc=(qo+ml)/4,jc=(dl+bl)/4,Zc=(vl+kl)/4;return C>Oo&&C>Dl?C<Ro?(or=0,So=.707106781,To=.707106781):(or=Math.sqrt(C),So=Nc/or,To=jc/or):Oo>Dl?Oo<Ro?(or=.707106781,So=0,To=.707106781):(So=Math.sqrt(Oo),or=Nc/So,To=Zc/So):Dl<Ro?(or=.707106781,So=.707106781,To=0):(To=Math.sqrt(Dl),or=jc/To,So=Zc/To),this.set(or,So,To,Rn),this}let Dl=Math.sqrt((kl-vl)*(kl-vl)+(dl-bl)*(dl-bl)+(ml-qo)*(ml-qo));return Math.abs(Dl)<.001&&(Dl=1),this.x=(kl-vl)/Dl,this.y=(dl-bl)/Dl,this.z=(ml-qo)/Dl,this.w=Math.acos((Ho+fl+Ll-1)/2),this}setFromMatrixPosition(C){const Rn=C.elements;return this.x=Rn[12],this.y=Rn[13],this.z=Rn[14],this.w=Rn[15],this}min(C){return this.x=Math.min(this.x,C.x),this.y=Math.min(this.y,C.y),this.z=Math.min(this.z,C.z),this.w=Math.min(this.w,C.w),this}max(C){return this.x=Math.max(this.x,C.x),this.y=Math.max(this.y,C.y),this.z=Math.max(this.z,C.z),this.w=Math.max(this.w,C.w),this}clamp(C,Rn){return this.x=Math.max(C.x,Math.min(Rn.x,this.x)),this.y=Math.max(C.y,Math.min(Rn.y,this.y)),this.z=Math.max(C.z,Math.min(Rn.z,this.z)),this.w=Math.max(C.w,Math.min(Rn.w,this.w)),this}clampScalar(C,Rn){return this.x=Math.max(C,Math.min(Rn,this.x)),this.y=Math.max(C,Math.min(Rn,this.y)),this.z=Math.max(C,Math.min(Rn,this.z)),this.w=Math.max(C,Math.min(Rn,this.w)),this}clampLength(C,Rn){const or=this.length();return this.divideScalar(or||1).multiplyScalar(Math.max(C,Math.min(Rn,or)))}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(C){return this.x*C.x+this.y*C.y+this.z*C.z+this.w*C.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(C){return this.normalize().multiplyScalar(C)}lerp(C,Rn){return this.x+=(C.x-this.x)*Rn,this.y+=(C.y-this.y)*Rn,this.z+=(C.z-this.z)*Rn,this.w+=(C.w-this.w)*Rn,this}lerpVectors(C,Rn,or){return this.x=C.x+(Rn.x-C.x)*or,this.y=C.y+(Rn.y-C.y)*or,this.z=C.z+(Rn.z-C.z)*or,this.w=C.w+(Rn.w-C.w)*or,this}equals(C){return C.x===this.x&&C.y===this.y&&C.z===this.z&&C.w===this.w}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.x=C[Rn],this.y=C[Rn+1],this.z=C[Rn+2],this.w=C[Rn+3],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.x,C[Rn+1]=this.y,C[Rn+2]=this.z,C[Rn+3]=this.w,C}fromBufferAttribute(C,Rn){return this.x=C.getX(Rn),this.y=C.getY(Rn),this.z=C.getZ(Rn),this.w=C.getW(Rn),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 RenderTarget extends EventDispatcher{constructor(C,Rn,or){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or={}),super(),this.isRenderTarget=!0,this.width=C,this.height=Rn,this.depth=1,this.scissor=new Vector4(0,0,C,Rn),this.scissorTest=!1,this.viewport=new Vector4(0,0,C,Rn);const So={width:C,height:Rn,depth:1};or=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:_d,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},or);const To=new Texture(So,or.mapping,or.wrapS,or.wrapT,or.magFilter,or.minFilter,or.format,or.type,or.anisotropy,or.colorSpace);To.flipY=!1,To.generateMipmaps=or.generateMipmaps,To.internalFormat=or.internalFormat,this.textures=[];const Ro=or.count;for(let Uo=0;Uo<Ro;Uo++)this.textures[Uo]=To.clone(),this.textures[Uo].isRenderTargetTexture=!0;this.depthBuffer=or.depthBuffer,this.stencilBuffer=or.stencilBuffer,this.resolveDepthBuffer=or.resolveDepthBuffer,this.resolveStencilBuffer=or.resolveStencilBuffer,this.depthTexture=or.depthTexture,this.samples=or.samples}get texture(){return this.textures[0]}set texture(C){this.textures[0]=C}setSize(C,Rn,or){if(void 0===or&&(or=1),this.width!==C||this.height!==Rn||this.depth!==or){this.width=C,this.height=Rn,this.depth=or;for(let So=0,To=this.textures.length;So<To;So++)this.textures[So].image.width=C,this.textures[So].image.height=Rn,this.textures[So].image.depth=or;this.dispose()}this.viewport.set(0,0,C,Rn),this.scissor.set(0,0,C,Rn)}clone(){return(new this.constructor).copy(this)}copy(C){this.width=C.width,this.height=C.height,this.depth=C.depth,this.scissor.copy(C.scissor),this.scissorTest=C.scissorTest,this.viewport.copy(C.viewport),this.textures.length=0;for(let or=0,So=C.textures.length;or<So;or++)this.textures[or]=C.textures[or].clone(),this.textures[or].isRenderTargetTexture=!0;const Rn=Object.assign({},C.texture.image);return this.texture.source=new Source(Rn),this.depthBuffer=C.depthBuffer,this.stencilBuffer=C.stencilBuffer,this.resolveDepthBuffer=C.resolveDepthBuffer,this.resolveStencilBuffer=C.resolveStencilBuffer,null!==C.depthTexture&&(this.depthTexture=C.depthTexture.clone()),this.samples=C.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class WebGLRenderTarget extends RenderTarget{constructor(C,Rn,or){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or={}),super(C,Rn,or),this.isWebGLRenderTarget=!0}}class DataArrayTexture extends Texture{constructor(C,Rn,or,So){void 0===C&&(C=null),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),super(null),this.isDataArrayTexture=!0,this.image={data:C,width:Rn,height:or,depth:So},this.magFilter=yd,this.minFilter=yd,this.wrapR=gd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(C){this.layerUpdates.add(C)}clearLayerUpdates(){this.layerUpdates.clear()}}class Data3DTexture extends Texture{constructor(C,Rn,or,So){void 0===C&&(C=null),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),super(null),this.isData3DTexture=!0,this.image={data:C,width:Rn,height:or,depth:So},this.magFilter=yd,this.minFilter=yd,this.wrapR=gd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Quaternion{constructor(C,Rn,or,So){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),void 0===So&&(So=1),this.isQuaternion=!0,this._x=C,this._y=Rn,this._z=or,this._w=So}static slerpFlat(C,Rn,or,So,To,Ro,Uo){let Oo=or[So+0],Ho=or[So+1],qo=or[So+2],dl=or[So+3];const ml=To[Ro+0],fl=To[Ro+1],vl=To[Ro+2],bl=To[Ro+3];if(0===Uo)return C[Rn+0]=Oo,C[Rn+1]=Ho,C[Rn+2]=qo,void(C[Rn+3]=dl);if(1===Uo)return C[Rn+0]=ml,C[Rn+1]=fl,C[Rn+2]=vl,void(C[Rn+3]=bl);if(dl!==bl||Oo!==ml||Ho!==fl||qo!==vl){let C=1-Uo;const Rn=Oo*ml+Ho*fl+qo*vl+dl*bl,or=Rn>=0?1:-1,So=1-Rn*Rn;if(So>Number.EPSILON){const To=Math.sqrt(So),Ro=Math.atan2(To,Rn*or);C=Math.sin(C*Ro)/To,Uo=Math.sin(Uo*Ro)/To}const To=Uo*or;if(Oo=Oo*C+ml*To,Ho=Ho*C+fl*To,qo=qo*C+vl*To,dl=dl*C+bl*To,C===1-Uo){const C=1/Math.sqrt(Oo*Oo+Ho*Ho+qo*qo+dl*dl);Oo*=C,Ho*=C,qo*=C,dl*=C}}C[Rn]=Oo,C[Rn+1]=Ho,C[Rn+2]=qo,C[Rn+3]=dl}static multiplyQuaternionsFlat(C,Rn,or,So,To,Ro){const Uo=or[So],Oo=or[So+1],Ho=or[So+2],qo=or[So+3],dl=To[Ro],ml=To[Ro+1],fl=To[Ro+2],vl=To[Ro+3];return C[Rn]=Uo*vl+qo*dl+Oo*fl-Ho*ml,C[Rn+1]=Oo*vl+qo*ml+Ho*dl-Uo*fl,C[Rn+2]=Ho*vl+qo*fl+Uo*ml-Oo*dl,C[Rn+3]=qo*vl-Uo*dl-Oo*ml-Ho*fl,C}get x(){return this._x}set x(C){this._x=C,this._onChangeCallback()}get y(){return this._y}set y(C){this._y=C,this._onChangeCallback()}get z(){return this._z}set z(C){this._z=C,this._onChangeCallback()}get w(){return this._w}set w(C){this._w=C,this._onChangeCallback()}set(C,Rn,or,So){return this._x=C,this._y=Rn,this._z=or,this._w=So,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(C){return this._x=C.x,this._y=C.y,this._z=C.z,this._w=C.w,this._onChangeCallback(),this}setFromEuler(C,Rn){void 0===Rn&&(Rn=!0);const or=C._x,So=C._y,To=C._z,Ro=C._order,Uo=Math.cos,Oo=Math.sin,Ho=Uo(or/2),qo=Uo(So/2),dl=Uo(To/2),ml=Oo(or/2),fl=Oo(So/2),vl=Oo(To/2);switch(Ro){case"XYZ":this._x=ml*qo*dl+Ho*fl*vl,this._y=Ho*fl*dl-ml*qo*vl,this._z=Ho*qo*vl+ml*fl*dl,this._w=Ho*qo*dl-ml*fl*vl;break;case"YXZ":this._x=ml*qo*dl+Ho*fl*vl,this._y=Ho*fl*dl-ml*qo*vl,this._z=Ho*qo*vl-ml*fl*dl,this._w=Ho*qo*dl+ml*fl*vl;break;case"ZXY":this._x=ml*qo*dl-Ho*fl*vl,this._y=Ho*fl*dl+ml*qo*vl,this._z=Ho*qo*vl+ml*fl*dl,this._w=Ho*qo*dl-ml*fl*vl;break;case"ZYX":this._x=ml*qo*dl-Ho*fl*vl,this._y=Ho*fl*dl+ml*qo*vl,this._z=Ho*qo*vl-ml*fl*dl,this._w=Ho*qo*dl+ml*fl*vl;break;case"YZX":this._x=ml*qo*dl+Ho*fl*vl,this._y=Ho*fl*dl+ml*qo*vl,this._z=Ho*qo*vl-ml*fl*dl,this._w=Ho*qo*dl-ml*fl*vl;break;case"XZY":this._x=ml*qo*dl-Ho*fl*vl,this._y=Ho*fl*dl-ml*qo*vl,this._z=Ho*qo*vl+ml*fl*dl,this._w=Ho*qo*dl+ml*fl*vl;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+Ro)}return!0===Rn&&this._onChangeCallback(),this}setFromAxisAngle(C,Rn){const or=Rn/2,So=Math.sin(or);return this._x=C.x*So,this._y=C.y*So,this._z=C.z*So,this._w=Math.cos(or),this._onChangeCallback(),this}setFromRotationMatrix(C){const Rn=C.elements,or=Rn[0],So=Rn[4],To=Rn[8],Ro=Rn[1],Uo=Rn[5],Oo=Rn[9],Ho=Rn[2],qo=Rn[6],dl=Rn[10],ml=or+Uo+dl;if(ml>0){const C=.5/Math.sqrt(ml+1);this._w=.25/C,this._x=(qo-Oo)*C,this._y=(To-Ho)*C,this._z=(Ro-So)*C}else if(or>Uo&&or>dl){const C=2*Math.sqrt(1+or-Uo-dl);this._w=(qo-Oo)/C,this._x=.25*C,this._y=(So+Ro)/C,this._z=(To+Ho)/C}else if(Uo>dl){const C=2*Math.sqrt(1+Uo-or-dl);this._w=(To-Ho)/C,this._x=(So+Ro)/C,this._y=.25*C,this._z=(Oo+qo)/C}else{const C=2*Math.sqrt(1+dl-or-Uo);this._w=(Ro-So)/C,this._x=(To+Ho)/C,this._y=(Oo+qo)/C,this._z=.25*C}return this._onChangeCallback(),this}setFromUnitVectors(C,Rn){let or=C.dot(Rn)+1;return or<Number.EPSILON?(or=0,Math.abs(C.x)>Math.abs(C.z)?(this._x=-C.y,this._y=C.x,this._z=0,this._w=or):(this._x=0,this._y=-C.z,this._z=C.y,this._w=or)):(this._x=C.y*Rn.z-C.z*Rn.y,this._y=C.z*Rn.x-C.x*Rn.z,this._z=C.x*Rn.y-C.y*Rn.x,this._w=or),this.normalize()}angleTo(C){return 2*Math.acos(Math.abs(clamp(this.dot(C),-1,1)))}rotateTowards(C,Rn){const or=this.angleTo(C);if(0===or)return this;const So=Math.min(1,Rn/or);return this.slerp(C,So),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(C){return this._x*C._x+this._y*C._y+this._z*C._z+this._w*C._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 C=this.length();return 0===C?(this._x=0,this._y=0,this._z=0,this._w=1):(C=1/C,this._x=this._x*C,this._y=this._y*C,this._z=this._z*C,this._w=this._w*C),this._onChangeCallback(),this}multiply(C){return this.multiplyQuaternions(this,C)}premultiply(C){return this.multiplyQuaternions(C,this)}multiplyQuaternions(C,Rn){const or=C._x,So=C._y,To=C._z,Ro=C._w,Uo=Rn._x,Oo=Rn._y,Ho=Rn._z,qo=Rn._w;return this._x=or*qo+Ro*Uo+So*Ho-To*Oo,this._y=So*qo+Ro*Oo+To*Uo-or*Ho,this._z=To*qo+Ro*Ho+or*Oo-So*Uo,this._w=Ro*qo-or*Uo-So*Oo-To*Ho,this._onChangeCallback(),this}slerp(C,Rn){if(0===Rn)return this;if(1===Rn)return this.copy(C);const or=this._x,So=this._y,To=this._z,Ro=this._w;let Uo=Ro*C._w+or*C._x+So*C._y+To*C._z;if(Uo<0?(this._w=-C._w,this._x=-C._x,this._y=-C._y,this._z=-C._z,Uo=-Uo):this.copy(C),Uo>=1)return this._w=Ro,this._x=or,this._y=So,this._z=To,this;const Oo=1-Uo*Uo;if(Oo<=Number.EPSILON){const C=1-Rn;return this._w=C*Ro+Rn*this._w,this._x=C*or+Rn*this._x,this._y=C*So+Rn*this._y,this._z=C*To+Rn*this._z,this.normalize(),this}const Ho=Math.sqrt(Oo),qo=Math.atan2(Ho,Uo),dl=Math.sin((1-Rn)*qo)/Ho,ml=Math.sin(Rn*qo)/Ho;return this._w=Ro*dl+this._w*ml,this._x=or*dl+this._x*ml,this._y=So*dl+this._y*ml,this._z=To*dl+this._z*ml,this._onChangeCallback(),this}slerpQuaternions(C,Rn,or){return this.copy(C).slerp(Rn,or)}random(){const C=2*Math.PI*Math.random(),Rn=2*Math.PI*Math.random(),or=Math.random(),So=Math.sqrt(1-or),To=Math.sqrt(or);return this.set(So*Math.sin(C),So*Math.cos(C),To*Math.sin(Rn),To*Math.cos(Rn))}equals(C){return C._x===this._x&&C._y===this._y&&C._z===this._z&&C._w===this._w}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this._x=C[Rn],this._y=C[Rn+1],this._z=C[Rn+2],this._w=C[Rn+3],this._onChangeCallback(),this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this._x,C[Rn+1]=this._y,C[Rn+2]=this._z,C[Rn+3]=this._w,C}fromBufferAttribute(C,Rn){return this._x=C.getX(Rn),this._y=C.getY(Rn),this._z=C.getZ(Rn),this._w=C.getW(Rn),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(C){return this._onChangeCallback=C,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Vector3{constructor(C,Rn,or){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),Vector3.prototype.isVector3=!0,this.x=C,this.y=Rn,this.z=or}set(C,Rn,or){return void 0===or&&(or=this.z),this.x=C,this.y=Rn,this.z=or,this}setScalar(C){return this.x=C,this.y=C,this.z=C,this}setX(C){return this.x=C,this}setY(C){return this.y=C,this}setZ(C){return this.z=C,this}setComponent(C,Rn){switch(C){case 0:this.x=Rn;break;case 1:this.y=Rn;break;case 2:this.z=Rn;break;default:throw new Error("index is out of range: "+C)}return this}getComponent(C){switch(C){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+C)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(C){return this.x=C.x,this.y=C.y,this.z=C.z,this}add(C){return this.x+=C.x,this.y+=C.y,this.z+=C.z,this}addScalar(C){return this.x+=C,this.y+=C,this.z+=C,this}addVectors(C,Rn){return this.x=C.x+Rn.x,this.y=C.y+Rn.y,this.z=C.z+Rn.z,this}addScaledVector(C,Rn){return this.x+=C.x*Rn,this.y+=C.y*Rn,this.z+=C.z*Rn,this}sub(C){return this.x-=C.x,this.y-=C.y,this.z-=C.z,this}subScalar(C){return this.x-=C,this.y-=C,this.z-=C,this}subVectors(C,Rn){return this.x=C.x-Rn.x,this.y=C.y-Rn.y,this.z=C.z-Rn.z,this}multiply(C){return this.x*=C.x,this.y*=C.y,this.z*=C.z,this}multiplyScalar(C){return this.x*=C,this.y*=C,this.z*=C,this}multiplyVectors(C,Rn){return this.x=C.x*Rn.x,this.y=C.y*Rn.y,this.z=C.z*Rn.z,this}applyEuler(C){return this.applyQuaternion(vm.setFromEuler(C))}applyAxisAngle(C,Rn){return this.applyQuaternion(vm.setFromAxisAngle(C,Rn))}applyMatrix3(C){const Rn=this.x,or=this.y,So=this.z,To=C.elements;return this.x=To[0]*Rn+To[3]*or+To[6]*So,this.y=To[1]*Rn+To[4]*or+To[7]*So,this.z=To[2]*Rn+To[5]*or+To[8]*So,this}applyNormalMatrix(C){return this.applyMatrix3(C).normalize()}applyMatrix4(C){const Rn=this.x,or=this.y,So=this.z,To=C.elements,Ro=1/(To[3]*Rn+To[7]*or+To[11]*So+To[15]);return this.x=(To[0]*Rn+To[4]*or+To[8]*So+To[12])*Ro,this.y=(To[1]*Rn+To[5]*or+To[9]*So+To[13])*Ro,this.z=(To[2]*Rn+To[6]*or+To[10]*So+To[14])*Ro,this}applyQuaternion(C){const Rn=this.x,or=this.y,So=this.z,To=C.x,Ro=C.y,Uo=C.z,Oo=C.w,Ho=2*(Ro*So-Uo*or),qo=2*(Uo*Rn-To*So),dl=2*(To*or-Ro*Rn);return this.x=Rn+Oo*Ho+Ro*dl-Uo*qo,this.y=or+Oo*qo+Uo*Ho-To*dl,this.z=So+Oo*dl+To*qo-Ro*Ho,this}project(C){return this.applyMatrix4(C.matrixWorldInverse).applyMatrix4(C.projectionMatrix)}unproject(C){return this.applyMatrix4(C.projectionMatrixInverse).applyMatrix4(C.matrixWorld)}transformDirection(C){const Rn=this.x,or=this.y,So=this.z,To=C.elements;return this.x=To[0]*Rn+To[4]*or+To[8]*So,this.y=To[1]*Rn+To[5]*or+To[9]*So,this.z=To[2]*Rn+To[6]*or+To[10]*So,this.normalize()}divide(C){return this.x/=C.x,this.y/=C.y,this.z/=C.z,this}divideScalar(C){return this.multiplyScalar(1/C)}min(C){return this.x=Math.min(this.x,C.x),this.y=Math.min(this.y,C.y),this.z=Math.min(this.z,C.z),this}max(C){return this.x=Math.max(this.x,C.x),this.y=Math.max(this.y,C.y),this.z=Math.max(this.z,C.z),this}clamp(C,Rn){return this.x=Math.max(C.x,Math.min(Rn.x,this.x)),this.y=Math.max(C.y,Math.min(Rn.y,this.y)),this.z=Math.max(C.z,Math.min(Rn.z,this.z)),this}clampScalar(C,Rn){return this.x=Math.max(C,Math.min(Rn,this.x)),this.y=Math.max(C,Math.min(Rn,this.y)),this.z=Math.max(C,Math.min(Rn,this.z)),this}clampLength(C,Rn){const or=this.length();return this.divideScalar(or||1).multiplyScalar(Math.max(C,Math.min(Rn,or)))}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(C){return this.x*C.x+this.y*C.y+this.z*C.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(C){return this.normalize().multiplyScalar(C)}lerp(C,Rn){return this.x+=(C.x-this.x)*Rn,this.y+=(C.y-this.y)*Rn,this.z+=(C.z-this.z)*Rn,this}lerpVectors(C,Rn,or){return this.x=C.x+(Rn.x-C.x)*or,this.y=C.y+(Rn.y-C.y)*or,this.z=C.z+(Rn.z-C.z)*or,this}cross(C){return this.crossVectors(this,C)}crossVectors(C,Rn){const or=C.x,So=C.y,To=C.z,Ro=Rn.x,Uo=Rn.y,Oo=Rn.z;return this.x=So*Oo-To*Uo,this.y=To*Ro-or*Oo,this.z=or*Uo-So*Ro,this}projectOnVector(C){const Rn=C.lengthSq();if(0===Rn)return this.set(0,0,0);const or=C.dot(this)/Rn;return this.copy(C).multiplyScalar(or)}projectOnPlane(C){return ym.copy(this).projectOnVector(C),this.sub(ym)}reflect(C){return this.sub(ym.copy(C).multiplyScalar(2*this.dot(C)))}angleTo(C){const Rn=Math.sqrt(this.lengthSq()*C.lengthSq());if(0===Rn)return Math.PI/2;const or=this.dot(C)/Rn;return Math.acos(clamp(or,-1,1))}distanceTo(C){return Math.sqrt(this.distanceToSquared(C))}distanceToSquared(C){const Rn=this.x-C.x,or=this.y-C.y,So=this.z-C.z;return Rn*Rn+or*or+So*So}manhattanDistanceTo(C){return Math.abs(this.x-C.x)+Math.abs(this.y-C.y)+Math.abs(this.z-C.z)}setFromSpherical(C){return this.setFromSphericalCoords(C.radius,C.phi,C.theta)}setFromSphericalCoords(C,Rn,or){const So=Math.sin(Rn)*C;return this.x=So*Math.sin(or),this.y=Math.cos(Rn)*C,this.z=So*Math.cos(or),this}setFromCylindrical(C){return this.setFromCylindricalCoords(C.radius,C.theta,C.y)}setFromCylindricalCoords(C,Rn,or){return this.x=C*Math.sin(Rn),this.y=or,this.z=C*Math.cos(Rn),this}setFromMatrixPosition(C){const Rn=C.elements;return this.x=Rn[12],this.y=Rn[13],this.z=Rn[14],this}setFromMatrixScale(C){const Rn=this.setFromMatrixColumn(C,0).length(),or=this.setFromMatrixColumn(C,1).length(),So=this.setFromMatrixColumn(C,2).length();return this.x=Rn,this.y=or,this.z=So,this}setFromMatrixColumn(C,Rn){return this.fromArray(C.elements,4*Rn)}setFromMatrix3Column(C,Rn){return this.fromArray(C.elements,3*Rn)}setFromEuler(C){return this.x=C._x,this.y=C._y,this.z=C._z,this}setFromColor(C){return this.x=C.r,this.y=C.g,this.z=C.b,this}equals(C){return C.x===this.x&&C.y===this.y&&C.z===this.z}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.x=C[Rn],this.y=C[Rn+1],this.z=C[Rn+2],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.x,C[Rn+1]=this.y,C[Rn+2]=this.z,C}fromBufferAttribute(C,Rn){return this.x=C.getX(Rn),this.y=C.getY(Rn),this.z=C.getZ(Rn),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const C=Math.random()*Math.PI*2,Rn=2*Math.random()-1,or=Math.sqrt(1-Rn*Rn);return this.x=or*Math.cos(C),this.y=Rn,this.z=or*Math.sin(C),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ym=new Vector3,vm=new Quaternion;class Box3{constructor(C,Rn){void 0===C&&(C=new Vector3(1/0,1/0,1/0)),void 0===Rn&&(Rn=new Vector3(-1/0,-1/0,-1/0)),this.isBox3=!0,this.min=C,this.max=Rn}set(C,Rn){return this.min.copy(C),this.max.copy(Rn),this}setFromArray(C){this.makeEmpty();for(let Rn=0,or=C.length;Rn<or;Rn+=3)this.expandByPoint(_m.fromArray(C,Rn));return this}setFromBufferAttribute(C){this.makeEmpty();for(let Rn=0,or=C.count;Rn<or;Rn++)this.expandByPoint(_m.fromBufferAttribute(C,Rn));return this}setFromPoints(C){this.makeEmpty();for(let Rn=0,or=C.length;Rn<or;Rn++)this.expandByPoint(C[Rn]);return this}setFromCenterAndSize(C,Rn){const or=_m.copy(Rn).multiplyScalar(.5);return this.min.copy(C).sub(or),this.max.copy(C).add(or),this}setFromObject(C,Rn){return void 0===Rn&&(Rn=!1),this.makeEmpty(),this.expandByObject(C,Rn)}clone(){return(new this.constructor).copy(this)}copy(C){return this.min.copy(C.min),this.max.copy(C.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(C){return this.isEmpty()?C.set(0,0,0):C.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(C){return this.isEmpty()?C.set(0,0,0):C.subVectors(this.max,this.min)}expandByPoint(C){return this.min.min(C),this.max.max(C),this}expandByVector(C){return this.min.sub(C),this.max.add(C),this}expandByScalar(C){return this.min.addScalar(-C),this.max.addScalar(C),this}expandByObject(C,Rn){void 0===Rn&&(Rn=!1),C.updateWorldMatrix(!1,!1);const or=C.geometry;if(void 0!==or){const So=or.getAttribute("position");if(!0===Rn&&void 0!==So&&!0!==C.isInstancedMesh)for(let Rn=0,or=So.count;Rn<or;Rn++)!0===C.isMesh?C.getVertexPosition(Rn,_m):_m.fromBufferAttribute(So,Rn),_m.applyMatrix4(C.matrixWorld),this.expandByPoint(_m);else void 0!==C.boundingBox?(null===C.boundingBox&&C.computeBoundingBox(),bm.copy(C.boundingBox)):(null===or.boundingBox&&or.computeBoundingBox(),bm.copy(or.boundingBox)),bm.applyMatrix4(C.matrixWorld),this.union(bm)}const So=C.children;for(let To=0,Ro=So.length;To<Ro;To++)this.expandByObject(So[To],Rn);return this}containsPoint(C){return C.x>=this.min.x&&C.x<=this.max.x&&C.y>=this.min.y&&C.y<=this.max.y&&C.z>=this.min.z&&C.z<=this.max.z}containsBox(C){return this.min.x<=C.min.x&&C.max.x<=this.max.x&&this.min.y<=C.min.y&&C.max.y<=this.max.y&&this.min.z<=C.min.z&&C.max.z<=this.max.z}getParameter(C,Rn){return Rn.set((C.x-this.min.x)/(this.max.x-this.min.x),(C.y-this.min.y)/(this.max.y-this.min.y),(C.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(C){return C.max.x>=this.min.x&&C.min.x<=this.max.x&&C.max.y>=this.min.y&&C.min.y<=this.max.y&&C.max.z>=this.min.z&&C.min.z<=this.max.z}intersectsSphere(C){return this.clampPoint(C.center,_m),_m.distanceToSquared(C.center)<=C.radius*C.radius}intersectsPlane(C){let Rn,or;return C.normal.x>0?(Rn=C.normal.x*this.min.x,or=C.normal.x*this.max.x):(Rn=C.normal.x*this.max.x,or=C.normal.x*this.min.x),C.normal.y>0?(Rn+=C.normal.y*this.min.y,or+=C.normal.y*this.max.y):(Rn+=C.normal.y*this.max.y,or+=C.normal.y*this.min.y),C.normal.z>0?(Rn+=C.normal.z*this.min.z,or+=C.normal.z*this.max.z):(Rn+=C.normal.z*this.max.z,or+=C.normal.z*this.min.z),Rn<=-C.constant&&or>=-C.constant}intersectsTriangle(C){if(this.isEmpty())return!1;this.getCenter(Im),Cm.subVectors(this.max,Im),wm.subVectors(C.a,Im),Em.subVectors(C.b,Im),Mm.subVectors(C.c,Im),Sm.subVectors(Em,wm),km.subVectors(Mm,Em),Tm.subVectors(wm,Mm);let Rn=[0,-Sm.z,Sm.y,0,-km.z,km.y,0,-Tm.z,Tm.y,Sm.z,0,-Sm.x,km.z,0,-km.x,Tm.z,0,-Tm.x,-Sm.y,Sm.x,0,-km.y,km.x,0,-Tm.y,Tm.x,0];return!!satForAxes(Rn,wm,Em,Mm,Cm)&&(Rn=[1,0,0,0,1,0,0,0,1],!!satForAxes(Rn,wm,Em,Mm,Cm)&&(Lm.crossVectors(Sm,km),Rn=[Lm.x,Lm.y,Lm.z],satForAxes(Rn,wm,Em,Mm,Cm)))}clampPoint(C,Rn){return Rn.copy(C).clamp(this.min,this.max)}distanceToPoint(C){return this.clampPoint(C,_m).distanceTo(C)}getBoundingSphere(C){return this.isEmpty()?C.makeEmpty():(this.getCenter(C.center),C.radius=.5*this.getSize(_m).length()),C}intersect(C){return this.min.max(C.min),this.max.min(C.max),this.isEmpty()&&this.makeEmpty(),this}union(C){return this.min.min(C.min),this.max.max(C.max),this}applyMatrix4(C){return this.isEmpty()||(xm[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(C),xm[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(C),xm[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(C),xm[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(C),xm[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(C),xm[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(C),xm[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(C),xm[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(C),this.setFromPoints(xm)),this}translate(C){return this.min.add(C),this.max.add(C),this}equals(C){return C.min.equals(this.min)&&C.max.equals(this.max)}}const xm=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],_m=new Vector3,bm=new Box3,wm=new Vector3,Em=new Vector3,Mm=new Vector3,Sm=new Vector3,km=new Vector3,Tm=new Vector3,Im=new Vector3,Cm=new Vector3,Lm=new Vector3,Pm=new Vector3;function satForAxes(C,Rn,or,So,To){for(let Ro=0,Uo=C.length-3;Ro<=Uo;Ro+=3){Pm.fromArray(C,Ro);const Uo=To.x*Math.abs(Pm.x)+To.y*Math.abs(Pm.y)+To.z*Math.abs(Pm.z),Oo=Rn.dot(Pm),Ho=or.dot(Pm),qo=So.dot(Pm);if(Math.max(-Math.max(Oo,Ho,qo),Math.min(Oo,Ho,qo))>Uo)return!1}return!0}const zm=new Box3,Dm=new Vector3,Rm=new Vector3;class Sphere{constructor(C,Rn){void 0===C&&(C=new Vector3),void 0===Rn&&(Rn=-1),this.isSphere=!0,this.center=C,this.radius=Rn}set(C,Rn){return this.center.copy(C),this.radius=Rn,this}setFromPoints(C,Rn){const or=this.center;void 0!==Rn?or.copy(Rn):zm.setFromPoints(C).getCenter(or);let So=0;for(let To=0,Ro=C.length;To<Ro;To++)So=Math.max(So,or.distanceToSquared(C[To]));return this.radius=Math.sqrt(So),this}copy(C){return this.center.copy(C.center),this.radius=C.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(C){return C.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(C){return C.distanceTo(this.center)-this.radius}intersectsSphere(C){const Rn=this.radius+C.radius;return C.center.distanceToSquared(this.center)<=Rn*Rn}intersectsBox(C){return C.intersectsSphere(this)}intersectsPlane(C){return Math.abs(C.distanceToPoint(this.center))<=this.radius}clampPoint(C,Rn){const or=this.center.distanceToSquared(C);return Rn.copy(C),or>this.radius*this.radius&&(Rn.sub(this.center).normalize(),Rn.multiplyScalar(this.radius).add(this.center)),Rn}getBoundingBox(C){return this.isEmpty()?(C.makeEmpty(),C):(C.set(this.center,this.center),C.expandByScalar(this.radius),C)}applyMatrix4(C){return this.center.applyMatrix4(C),this.radius=this.radius*C.getMaxScaleOnAxis(),this}translate(C){return this.center.add(C),this}expandByPoint(C){if(this.isEmpty())return this.center.copy(C),this.radius=0,this;Dm.subVectors(C,this.center);const Rn=Dm.lengthSq();if(Rn>this.radius*this.radius){const C=Math.sqrt(Rn),or=.5*(C-this.radius);this.center.addScaledVector(Dm,or/C),this.radius+=or}return this}union(C){return C.isEmpty()?this:this.isEmpty()?(this.copy(C),this):(!0===this.center.equals(C.center)?this.radius=Math.max(this.radius,C.radius):(Rm.subVectors(C.center,this.center).setLength(C.radius),this.expandByPoint(Dm.copy(C.center).add(Rm)),this.expandByPoint(Dm.copy(C.center).sub(Rm))),this)}equals(C){return C.center.equals(this.center)&&C.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Nm=new Vector3,Um=new Vector3,Bm=new Vector3,Fm=new Vector3,Om=new Vector3,Vm=new Vector3,jm=new Vector3;class Ray{constructor(C,Rn){void 0===C&&(C=new Vector3),void 0===Rn&&(Rn=new Vector3(0,0,-1)),this.origin=C,this.direction=Rn}set(C,Rn){return this.origin.copy(C),this.direction.copy(Rn),this}copy(C){return this.origin.copy(C.origin),this.direction.copy(C.direction),this}at(C,Rn){return Rn.copy(this.origin).addScaledVector(this.direction,C)}lookAt(C){return this.direction.copy(C).sub(this.origin).normalize(),this}recast(C){return this.origin.copy(this.at(C,Nm)),this}closestPointToPoint(C,Rn){Rn.subVectors(C,this.origin);const or=Rn.dot(this.direction);return or<0?Rn.copy(this.origin):Rn.copy(this.origin).addScaledVector(this.direction,or)}distanceToPoint(C){return Math.sqrt(this.distanceSqToPoint(C))}distanceSqToPoint(C){const Rn=Nm.subVectors(C,this.origin).dot(this.direction);return Rn<0?this.origin.distanceToSquared(C):(Nm.copy(this.origin).addScaledVector(this.direction,Rn),Nm.distanceToSquared(C))}distanceSqToSegment(C,Rn,or,So){Um.copy(C).add(Rn).multiplyScalar(.5),Bm.copy(Rn).sub(C).normalize(),Fm.copy(this.origin).sub(Um);const To=.5*C.distanceTo(Rn),Ro=-this.direction.dot(Bm),Uo=Fm.dot(this.direction),Oo=-Fm.dot(Bm),Ho=Fm.lengthSq(),qo=Math.abs(1-Ro*Ro);let dl,ml,fl,vl;if(qo>0)if(dl=Ro*Oo-Uo,ml=Ro*Uo-Oo,vl=To*qo,dl>=0)if(ml>=-vl)if(ml<=vl){const C=1/qo;dl*=C,ml*=C,fl=dl*(dl+Ro*ml+2*Uo)+ml*(Ro*dl+ml+2*Oo)+Ho}else ml=To,dl=Math.max(0,-(Ro*ml+Uo)),fl=-dl*dl+ml*(ml+2*Oo)+Ho;else ml=-To,dl=Math.max(0,-(Ro*ml+Uo)),fl=-dl*dl+ml*(ml+2*Oo)+Ho;else ml<=-vl?(dl=Math.max(0,-(-Ro*To+Uo)),ml=dl>0?-To:Math.min(Math.max(-To,-Oo),To),fl=-dl*dl+ml*(ml+2*Oo)+Ho):ml<=vl?(dl=0,ml=Math.min(Math.max(-To,-Oo),To),fl=ml*(ml+2*Oo)+Ho):(dl=Math.max(0,-(Ro*To+Uo)),ml=dl>0?To:Math.min(Math.max(-To,-Oo),To),fl=-dl*dl+ml*(ml+2*Oo)+Ho);else ml=Ro>0?-To:To,dl=Math.max(0,-(Ro*ml+Uo)),fl=-dl*dl+ml*(ml+2*Oo)+Ho;return or&&or.copy(this.origin).addScaledVector(this.direction,dl),So&&So.copy(Um).addScaledVector(Bm,ml),fl}intersectSphere(C,Rn){Nm.subVectors(C.center,this.origin);const or=Nm.dot(this.direction),So=Nm.dot(Nm)-or*or,To=C.radius*C.radius;if(So>To)return null;const Ro=Math.sqrt(To-So),Uo=or-Ro,Oo=or+Ro;return Oo<0?null:Uo<0?this.at(Oo,Rn):this.at(Uo,Rn)}intersectsSphere(C){return this.distanceSqToPoint(C.center)<=C.radius*C.radius}distanceToPlane(C){const Rn=C.normal.dot(this.direction);if(0===Rn)return 0===C.distanceToPoint(this.origin)?0:null;const or=-(this.origin.dot(C.normal)+C.constant)/Rn;return or>=0?or:null}intersectPlane(C,Rn){const or=this.distanceToPlane(C);return null===or?null:this.at(or,Rn)}intersectsPlane(C){const Rn=C.distanceToPoint(this.origin);if(0===Rn)return!0;return C.normal.dot(this.direction)*Rn<0}intersectBox(C,Rn){let or,So,To,Ro,Uo,Oo;const Ho=1/this.direction.x,qo=1/this.direction.y,dl=1/this.direction.z,ml=this.origin;return Ho>=0?(or=(C.min.x-ml.x)*Ho,So=(C.max.x-ml.x)*Ho):(or=(C.max.x-ml.x)*Ho,So=(C.min.x-ml.x)*Ho),qo>=0?(To=(C.min.y-ml.y)*qo,Ro=(C.max.y-ml.y)*qo):(To=(C.max.y-ml.y)*qo,Ro=(C.min.y-ml.y)*qo),or>Ro||To>So?null:((To>or||isNaN(or))&&(or=To),(Ro<So||isNaN(So))&&(So=Ro),dl>=0?(Uo=(C.min.z-ml.z)*dl,Oo=(C.max.z-ml.z)*dl):(Uo=(C.max.z-ml.z)*dl,Oo=(C.min.z-ml.z)*dl),or>Oo||Uo>So?null:((Uo>or||or!==or)&&(or=Uo),(Oo<So||So!==So)&&(So=Oo),So<0?null:this.at(or>=0?or:So,Rn)))}intersectsBox(C){return null!==this.intersectBox(C,Nm)}intersectTriangle(C,Rn,or,So,To){Om.subVectors(Rn,C),Vm.subVectors(or,C),jm.crossVectors(Om,Vm);let Ro,Uo=this.direction.dot(jm);if(Uo>0){if(So)return null;Ro=1}else{if(!(Uo<0))return null;Ro=-1,Uo=-Uo}Fm.subVectors(this.origin,C);const Oo=Ro*this.direction.dot(Vm.crossVectors(Fm,Vm));if(Oo<0)return null;const Ho=Ro*this.direction.dot(Om.cross(Fm));if(Ho<0)return null;if(Oo+Ho>Uo)return null;const qo=-Ro*Fm.dot(jm);return qo<0?null:this.at(qo/Uo,To)}applyMatrix4(C){return this.origin.applyMatrix4(C),this.direction.transformDirection(C),this}equals(C){return C.origin.equals(this.origin)&&C.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Matrix4{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl,bl,kl){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==C&&this.set(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl,bl,kl)}set(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl,bl,kl){const Ll=this.elements;return Ll[0]=C,Ll[4]=Rn,Ll[8]=or,Ll[12]=So,Ll[1]=To,Ll[5]=Ro,Ll[9]=Uo,Ll[13]=Oo,Ll[2]=Ho,Ll[6]=qo,Ll[10]=dl,Ll[14]=ml,Ll[3]=fl,Ll[7]=vl,Ll[11]=bl,Ll[15]=kl,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 Matrix4).fromArray(this.elements)}copy(C){const Rn=this.elements,or=C.elements;return Rn[0]=or[0],Rn[1]=or[1],Rn[2]=or[2],Rn[3]=or[3],Rn[4]=or[4],Rn[5]=or[5],Rn[6]=or[6],Rn[7]=or[7],Rn[8]=or[8],Rn[9]=or[9],Rn[10]=or[10],Rn[11]=or[11],Rn[12]=or[12],Rn[13]=or[13],Rn[14]=or[14],Rn[15]=or[15],this}copyPosition(C){const Rn=this.elements,or=C.elements;return Rn[12]=or[12],Rn[13]=or[13],Rn[14]=or[14],this}setFromMatrix3(C){const Rn=C.elements;return this.set(Rn[0],Rn[3],Rn[6],0,Rn[1],Rn[4],Rn[7],0,Rn[2],Rn[5],Rn[8],0,0,0,0,1),this}extractBasis(C,Rn,or){return C.setFromMatrixColumn(this,0),Rn.setFromMatrixColumn(this,1),or.setFromMatrixColumn(this,2),this}makeBasis(C,Rn,or){return this.set(C.x,Rn.x,or.x,0,C.y,Rn.y,or.y,0,C.z,Rn.z,or.z,0,0,0,0,1),this}extractRotation(C){const Rn=this.elements,or=C.elements,So=1/Gm.setFromMatrixColumn(C,0).length(),To=1/Gm.setFromMatrixColumn(C,1).length(),Ro=1/Gm.setFromMatrixColumn(C,2).length();return Rn[0]=or[0]*So,Rn[1]=or[1]*So,Rn[2]=or[2]*So,Rn[3]=0,Rn[4]=or[4]*To,Rn[5]=or[5]*To,Rn[6]=or[6]*To,Rn[7]=0,Rn[8]=or[8]*Ro,Rn[9]=or[9]*Ro,Rn[10]=or[10]*Ro,Rn[11]=0,Rn[12]=0,Rn[13]=0,Rn[14]=0,Rn[15]=1,this}makeRotationFromEuler(C){const Rn=this.elements,or=C.x,So=C.y,To=C.z,Ro=Math.cos(or),Uo=Math.sin(or),Oo=Math.cos(So),Ho=Math.sin(So),qo=Math.cos(To),dl=Math.sin(To);if("XYZ"===C.order){const C=Ro*qo,or=Ro*dl,So=Uo*qo,To=Uo*dl;Rn[0]=Oo*qo,Rn[4]=-Oo*dl,Rn[8]=Ho,Rn[1]=or+So*Ho,Rn[5]=C-To*Ho,Rn[9]=-Uo*Oo,Rn[2]=To-C*Ho,Rn[6]=So+or*Ho,Rn[10]=Ro*Oo}else if("YXZ"===C.order){const C=Oo*qo,or=Oo*dl,So=Ho*qo,To=Ho*dl;Rn[0]=C+To*Uo,Rn[4]=So*Uo-or,Rn[8]=Ro*Ho,Rn[1]=Ro*dl,Rn[5]=Ro*qo,Rn[9]=-Uo,Rn[2]=or*Uo-So,Rn[6]=To+C*Uo,Rn[10]=Ro*Oo}else if("ZXY"===C.order){const C=Oo*qo,or=Oo*dl,So=Ho*qo,To=Ho*dl;Rn[0]=C-To*Uo,Rn[4]=-Ro*dl,Rn[8]=So+or*Uo,Rn[1]=or+So*Uo,Rn[5]=Ro*qo,Rn[9]=To-C*Uo,Rn[2]=-Ro*Ho,Rn[6]=Uo,Rn[10]=Ro*Oo}else if("ZYX"===C.order){const C=Ro*qo,or=Ro*dl,So=Uo*qo,To=Uo*dl;Rn[0]=Oo*qo,Rn[4]=So*Ho-or,Rn[8]=C*Ho+To,Rn[1]=Oo*dl,Rn[5]=To*Ho+C,Rn[9]=or*Ho-So,Rn[2]=-Ho,Rn[6]=Uo*Oo,Rn[10]=Ro*Oo}else if("YZX"===C.order){const C=Ro*Oo,or=Ro*Ho,So=Uo*Oo,To=Uo*Ho;Rn[0]=Oo*qo,Rn[4]=To-C*dl,Rn[8]=So*dl+or,Rn[1]=dl,Rn[5]=Ro*qo,Rn[9]=-Uo*qo,Rn[2]=-Ho*qo,Rn[6]=or*dl+So,Rn[10]=C-To*dl}else if("XZY"===C.order){const C=Ro*Oo,or=Ro*Ho,So=Uo*Oo,To=Uo*Ho;Rn[0]=Oo*qo,Rn[4]=-dl,Rn[8]=Ho*qo,Rn[1]=C*dl+To,Rn[5]=Ro*qo,Rn[9]=or*dl-So,Rn[2]=So*dl-or,Rn[6]=Uo*qo,Rn[10]=To*dl+C}return Rn[3]=0,Rn[7]=0,Rn[11]=0,Rn[12]=0,Rn[13]=0,Rn[14]=0,Rn[15]=1,this}makeRotationFromQuaternion(C){return this.compose(Zm,C,Wm)}lookAt(C,Rn,or){const So=this.elements;return Qm.subVectors(C,Rn),0===Qm.lengthSq()&&(Qm.z=1),Qm.normalize(),qm.crossVectors(or,Qm),0===qm.lengthSq()&&(1===Math.abs(or.z)?Qm.x+=1e-4:Qm.z+=1e-4,Qm.normalize(),qm.crossVectors(or,Qm)),qm.normalize(),Km.crossVectors(Qm,qm),So[0]=qm.x,So[4]=Km.x,So[8]=Qm.x,So[1]=qm.y,So[5]=Km.y,So[9]=Qm.y,So[2]=qm.z,So[6]=Km.z,So[10]=Qm.z,this}multiply(C){return this.multiplyMatrices(this,C)}premultiply(C){return this.multiplyMatrices(C,this)}multiplyMatrices(C,Rn){const or=C.elements,So=Rn.elements,To=this.elements,Ro=or[0],Uo=or[4],Oo=or[8],Ho=or[12],qo=or[1],dl=or[5],ml=or[9],fl=or[13],vl=or[2],bl=or[6],kl=or[10],Ll=or[14],Dl=or[3],Nc=or[7],jc=or[11],Zc=or[15],eu=So[0],Ku=So[4],Yu=So[8],Eh=So[12],Th=So[1],Ch=So[5],Lh=So[9],Dh=So[13],Rh=So[2],Nh=So[6],Uh=So[10],Bh=So[14],Fh=So[3],Oh=So[7],Vh=So[11],jh=So[15];return To[0]=Ro*eu+Uo*Th+Oo*Rh+Ho*Fh,To[4]=Ro*Ku+Uo*Ch+Oo*Nh+Ho*Oh,To[8]=Ro*Yu+Uo*Lh+Oo*Uh+Ho*Vh,To[12]=Ro*Eh+Uo*Dh+Oo*Bh+Ho*jh,To[1]=qo*eu+dl*Th+ml*Rh+fl*Fh,To[5]=qo*Ku+dl*Ch+ml*Nh+fl*Oh,To[9]=qo*Yu+dl*Lh+ml*Uh+fl*Vh,To[13]=qo*Eh+dl*Dh+ml*Bh+fl*jh,To[2]=vl*eu+bl*Th+kl*Rh+Ll*Fh,To[6]=vl*Ku+bl*Ch+kl*Nh+Ll*Oh,To[10]=vl*Yu+bl*Lh+kl*Uh+Ll*Vh,To[14]=vl*Eh+bl*Dh+kl*Bh+Ll*jh,To[3]=Dl*eu+Nc*Th+jc*Rh+Zc*Fh,To[7]=Dl*Ku+Nc*Ch+jc*Nh+Zc*Oh,To[11]=Dl*Yu+Nc*Lh+jc*Uh+Zc*Vh,To[15]=Dl*Eh+Nc*Dh+jc*Bh+Zc*jh,this}multiplyScalar(C){const Rn=this.elements;return Rn[0]*=C,Rn[4]*=C,Rn[8]*=C,Rn[12]*=C,Rn[1]*=C,Rn[5]*=C,Rn[9]*=C,Rn[13]*=C,Rn[2]*=C,Rn[6]*=C,Rn[10]*=C,Rn[14]*=C,Rn[3]*=C,Rn[7]*=C,Rn[11]*=C,Rn[15]*=C,this}determinant(){const C=this.elements,Rn=C[0],or=C[4],So=C[8],To=C[12],Ro=C[1],Uo=C[5],Oo=C[9],Ho=C[13],qo=C[2],dl=C[6],ml=C[10],fl=C[14];return C[3]*(+To*Oo*dl-So*Ho*dl-To*Uo*ml+or*Ho*ml+So*Uo*fl-or*Oo*fl)+C[7]*(+Rn*Oo*fl-Rn*Ho*ml+To*Ro*ml-So*Ro*fl+So*Ho*qo-To*Oo*qo)+C[11]*(+Rn*Ho*dl-Rn*Uo*fl-To*Ro*dl+or*Ro*fl+To*Uo*qo-or*Ho*qo)+C[15]*(-So*Uo*qo-Rn*Oo*dl+Rn*Uo*ml+So*Ro*dl-or*Ro*ml+or*Oo*qo)}transpose(){const C=this.elements;let Rn;return Rn=C[1],C[1]=C[4],C[4]=Rn,Rn=C[2],C[2]=C[8],C[8]=Rn,Rn=C[6],C[6]=C[9],C[9]=Rn,Rn=C[3],C[3]=C[12],C[12]=Rn,Rn=C[7],C[7]=C[13],C[13]=Rn,Rn=C[11],C[11]=C[14],C[14]=Rn,this}setPosition(C,Rn,or){const So=this.elements;return C.isVector3?(So[12]=C.x,So[13]=C.y,So[14]=C.z):(So[12]=C,So[13]=Rn,So[14]=or),this}invert(){const C=this.elements,Rn=C[0],or=C[1],So=C[2],To=C[3],Ro=C[4],Uo=C[5],Oo=C[6],Ho=C[7],qo=C[8],dl=C[9],ml=C[10],fl=C[11],vl=C[12],bl=C[13],kl=C[14],Ll=C[15],Dl=dl*kl*Ho-bl*ml*Ho+bl*Oo*fl-Uo*kl*fl-dl*Oo*Ll+Uo*ml*Ll,Nc=vl*ml*Ho-qo*kl*Ho-vl*Oo*fl+Ro*kl*fl+qo*Oo*Ll-Ro*ml*Ll,jc=qo*bl*Ho-vl*dl*Ho+vl*Uo*fl-Ro*bl*fl-qo*Uo*Ll+Ro*dl*Ll,Zc=vl*dl*Oo-qo*bl*Oo-vl*Uo*ml+Ro*bl*ml+qo*Uo*kl-Ro*dl*kl,eu=Rn*Dl+or*Nc+So*jc+To*Zc;if(0===eu)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Ku=1/eu;return C[0]=Dl*Ku,C[1]=(bl*ml*To-dl*kl*To-bl*So*fl+or*kl*fl+dl*So*Ll-or*ml*Ll)*Ku,C[2]=(Uo*kl*To-bl*Oo*To+bl*So*Ho-or*kl*Ho-Uo*So*Ll+or*Oo*Ll)*Ku,C[3]=(dl*Oo*To-Uo*ml*To-dl*So*Ho+or*ml*Ho+Uo*So*fl-or*Oo*fl)*Ku,C[4]=Nc*Ku,C[5]=(qo*kl*To-vl*ml*To+vl*So*fl-Rn*kl*fl-qo*So*Ll+Rn*ml*Ll)*Ku,C[6]=(vl*Oo*To-Ro*kl*To-vl*So*Ho+Rn*kl*Ho+Ro*So*Ll-Rn*Oo*Ll)*Ku,C[7]=(Ro*ml*To-qo*Oo*To+qo*So*Ho-Rn*ml*Ho-Ro*So*fl+Rn*Oo*fl)*Ku,C[8]=jc*Ku,C[9]=(vl*dl*To-qo*bl*To-vl*or*fl+Rn*bl*fl+qo*or*Ll-Rn*dl*Ll)*Ku,C[10]=(Ro*bl*To-vl*Uo*To+vl*or*Ho-Rn*bl*Ho-Ro*or*Ll+Rn*Uo*Ll)*Ku,C[11]=(qo*Uo*To-Ro*dl*To-qo*or*Ho+Rn*dl*Ho+Ro*or*fl-Rn*Uo*fl)*Ku,C[12]=Zc*Ku,C[13]=(qo*bl*So-vl*dl*So+vl*or*ml-Rn*bl*ml-qo*or*kl+Rn*dl*kl)*Ku,C[14]=(vl*Uo*So-Ro*bl*So-vl*or*Oo+Rn*bl*Oo+Ro*or*kl-Rn*Uo*kl)*Ku,C[15]=(Ro*dl*So-qo*Uo*So+qo*or*Oo-Rn*dl*Oo-Ro*or*ml+Rn*Uo*ml)*Ku,this}scale(C){const Rn=this.elements,or=C.x,So=C.y,To=C.z;return Rn[0]*=or,Rn[4]*=So,Rn[8]*=To,Rn[1]*=or,Rn[5]*=So,Rn[9]*=To,Rn[2]*=or,Rn[6]*=So,Rn[10]*=To,Rn[3]*=or,Rn[7]*=So,Rn[11]*=To,this}getMaxScaleOnAxis(){const C=this.elements,Rn=C[0]*C[0]+C[1]*C[1]+C[2]*C[2],or=C[4]*C[4]+C[5]*C[5]+C[6]*C[6],So=C[8]*C[8]+C[9]*C[9]+C[10]*C[10];return Math.sqrt(Math.max(Rn,or,So))}makeTranslation(C,Rn,or){return C.isVector3?this.set(1,0,0,C.x,0,1,0,C.y,0,0,1,C.z,0,0,0,1):this.set(1,0,0,C,0,1,0,Rn,0,0,1,or,0,0,0,1),this}makeRotationX(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(1,0,0,0,0,Rn,-or,0,0,or,Rn,0,0,0,0,1),this}makeRotationY(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(Rn,0,or,0,0,1,0,0,-or,0,Rn,0,0,0,0,1),this}makeRotationZ(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(Rn,-or,0,0,or,Rn,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(C,Rn){const or=Math.cos(Rn),So=Math.sin(Rn),To=1-or,Ro=C.x,Uo=C.y,Oo=C.z,Ho=To*Ro,qo=To*Uo;return this.set(Ho*Ro+or,Ho*Uo-So*Oo,Ho*Oo+So*Uo,0,Ho*Uo+So*Oo,qo*Uo+or,qo*Oo-So*Ro,0,Ho*Oo-So*Uo,qo*Oo+So*Ro,To*Oo*Oo+or,0,0,0,0,1),this}makeScale(C,Rn,or){return this.set(C,0,0,0,0,Rn,0,0,0,0,or,0,0,0,0,1),this}makeShear(C,Rn,or,So,To,Ro){return this.set(1,or,To,0,C,1,Ro,0,Rn,So,1,0,0,0,0,1),this}compose(C,Rn,or){const So=this.elements,To=Rn._x,Ro=Rn._y,Uo=Rn._z,Oo=Rn._w,Ho=To+To,qo=Ro+Ro,dl=Uo+Uo,ml=To*Ho,fl=To*qo,vl=To*dl,bl=Ro*qo,kl=Ro*dl,Ll=Uo*dl,Dl=Oo*Ho,Nc=Oo*qo,jc=Oo*dl,Zc=or.x,eu=or.y,Ku=or.z;return So[0]=(1-(bl+Ll))*Zc,So[1]=(fl+jc)*Zc,So[2]=(vl-Nc)*Zc,So[3]=0,So[4]=(fl-jc)*eu,So[5]=(1-(ml+Ll))*eu,So[6]=(kl+Dl)*eu,So[7]=0,So[8]=(vl+Nc)*Ku,So[9]=(kl-Dl)*Ku,So[10]=(1-(ml+bl))*Ku,So[11]=0,So[12]=C.x,So[13]=C.y,So[14]=C.z,So[15]=1,this}decompose(C,Rn,or){const So=this.elements;let To=Gm.set(So[0],So[1],So[2]).length();const Ro=Gm.set(So[4],So[5],So[6]).length(),Uo=Gm.set(So[8],So[9],So[10]).length();this.determinant()<0&&(To=-To),C.x=So[12],C.y=So[13],C.z=So[14],Hm.copy(this);const Oo=1/To,Ho=1/Ro,qo=1/Uo;return Hm.elements[0]*=Oo,Hm.elements[1]*=Oo,Hm.elements[2]*=Oo,Hm.elements[4]*=Ho,Hm.elements[5]*=Ho,Hm.elements[6]*=Ho,Hm.elements[8]*=qo,Hm.elements[9]*=qo,Hm.elements[10]*=qo,Rn.setFromRotationMatrix(Hm),or.x=To,or.y=Ro,or.z=Uo,this}makePerspective(C,Rn,or,So,To,Ro,Uo){void 0===Uo&&(Uo=tm);const Oo=this.elements,Ho=2*To/(Rn-C),qo=2*To/(or-So),dl=(Rn+C)/(Rn-C),ml=(or+So)/(or-So);let fl,vl;if(Uo===tm)fl=-(Ro+To)/(Ro-To),vl=-2*Ro*To/(Ro-To);else{if(Uo!==im)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Uo);fl=-Ro/(Ro-To),vl=-Ro*To/(Ro-To)}return Oo[0]=Ho,Oo[4]=0,Oo[8]=dl,Oo[12]=0,Oo[1]=0,Oo[5]=qo,Oo[9]=ml,Oo[13]=0,Oo[2]=0,Oo[6]=0,Oo[10]=fl,Oo[14]=vl,Oo[3]=0,Oo[7]=0,Oo[11]=-1,Oo[15]=0,this}makeOrthographic(C,Rn,or,So,To,Ro,Uo){void 0===Uo&&(Uo=tm);const Oo=this.elements,Ho=1/(Rn-C),qo=1/(or-So),dl=1/(Ro-To),ml=(Rn+C)*Ho,fl=(or+So)*qo;let vl,bl;if(Uo===tm)vl=(Ro+To)*dl,bl=-2*dl;else{if(Uo!==im)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Uo);vl=To*dl,bl=-1*dl}return Oo[0]=2*Ho,Oo[4]=0,Oo[8]=0,Oo[12]=-ml,Oo[1]=0,Oo[5]=2*qo,Oo[9]=0,Oo[13]=-fl,Oo[2]=0,Oo[6]=0,Oo[10]=bl,Oo[14]=-vl,Oo[3]=0,Oo[7]=0,Oo[11]=0,Oo[15]=1,this}equals(C){const Rn=this.elements,or=C.elements;for(let So=0;So<16;So++)if(Rn[So]!==or[So])return!1;return!0}fromArray(C,Rn){void 0===Rn&&(Rn=0);for(let or=0;or<16;or++)this.elements[or]=C[or+Rn];return this}toArray(C,Rn){void 0===C&&(C=[]),void 0===Rn&&(Rn=0);const or=this.elements;return C[Rn]=or[0],C[Rn+1]=or[1],C[Rn+2]=or[2],C[Rn+3]=or[3],C[Rn+4]=or[4],C[Rn+5]=or[5],C[Rn+6]=or[6],C[Rn+7]=or[7],C[Rn+8]=or[8],C[Rn+9]=or[9],C[Rn+10]=or[10],C[Rn+11]=or[11],C[Rn+12]=or[12],C[Rn+13]=or[13],C[Rn+14]=or[14],C[Rn+15]=or[15],C}}const Gm=new Vector3,Hm=new Matrix4,Zm=new Vector3(0,0,0),Wm=new Vector3(1,1,1),qm=new Vector3,Km=new Vector3,Qm=new Vector3,Xm=new Matrix4,Ym=new Quaternion;class Euler{constructor(C,Rn,or,So){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),void 0===So&&(So=Euler.DEFAULT_ORDER),this.isEuler=!0,this._x=C,this._y=Rn,this._z=or,this._order=So}get x(){return this._x}set x(C){this._x=C,this._onChangeCallback()}get y(){return this._y}set y(C){this._y=C,this._onChangeCallback()}get z(){return this._z}set z(C){this._z=C,this._onChangeCallback()}get order(){return this._order}set order(C){this._order=C,this._onChangeCallback()}set(C,Rn,or,So){return void 0===So&&(So=this._order),this._x=C,this._y=Rn,this._z=or,this._order=So,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(C){return this._x=C._x,this._y=C._y,this._z=C._z,this._order=C._order,this._onChangeCallback(),this}setFromRotationMatrix(C,Rn,or){void 0===Rn&&(Rn=this._order),void 0===or&&(or=!0);const So=C.elements,To=So[0],Ro=So[4],Uo=So[8],Oo=So[1],Ho=So[5],qo=So[9],dl=So[2],ml=So[6],fl=So[10];switch(Rn){case"XYZ":this._y=Math.asin(clamp(Uo,-1,1)),Math.abs(Uo)<.9999999?(this._x=Math.atan2(-qo,fl),this._z=Math.atan2(-Ro,To)):(this._x=Math.atan2(ml,Ho),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(qo,-1,1)),Math.abs(qo)<.9999999?(this._y=Math.atan2(Uo,fl),this._z=Math.atan2(Oo,Ho)):(this._y=Math.atan2(-dl,To),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(ml,-1,1)),Math.abs(ml)<.9999999?(this._y=Math.atan2(-dl,fl),this._z=Math.atan2(-Ro,Ho)):(this._y=0,this._z=Math.atan2(Oo,To));break;case"ZYX":this._y=Math.asin(-clamp(dl,-1,1)),Math.abs(dl)<.9999999?(this._x=Math.atan2(ml,fl),this._z=Math.atan2(Oo,To)):(this._x=0,this._z=Math.atan2(-Ro,Ho));break;case"YZX":this._z=Math.asin(clamp(Oo,-1,1)),Math.abs(Oo)<.9999999?(this._x=Math.atan2(-qo,Ho),this._y=Math.atan2(-dl,To)):(this._x=0,this._y=Math.atan2(Uo,fl));break;case"XZY":this._z=Math.asin(-clamp(Ro,-1,1)),Math.abs(Ro)<.9999999?(this._x=Math.atan2(ml,Ho),this._y=Math.atan2(Uo,To)):(this._x=Math.atan2(-qo,fl),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+Rn)}return this._order=Rn,!0===or&&this._onChangeCallback(),this}setFromQuaternion(C,Rn,or){return Xm.makeRotationFromQuaternion(C),this.setFromRotationMatrix(Xm,Rn,or)}setFromVector3(C,Rn){return void 0===Rn&&(Rn=this._order),this.set(C.x,C.y,C.z,Rn)}reorder(C){return Ym.setFromEuler(this),this.setFromQuaternion(Ym,C)}equals(C){return C._x===this._x&&C._y===this._y&&C._z===this._z&&C._order===this._order}fromArray(C){return this._x=C[0],this._y=C[1],this._z=C[2],void 0!==C[3]&&(this._order=C[3]),this._onChangeCallback(),this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this._x,C[Rn+1]=this._y,C[Rn+2]=this._z,C[Rn+3]=this._order,C}_onChange(C){return this._onChangeCallback=C,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Euler.DEFAULT_ORDER="XYZ";class Layers{constructor(){this.mask=1}set(C){this.mask=(1<<C|0)>>>0}enable(C){this.mask|=1<<C|0}enableAll(){this.mask=-1}toggle(C){this.mask^=1<<C|0}disable(C){this.mask&=~(1<<C|0)}disableAll(){this.mask=0}test(C){return 0!==(this.mask&C.mask)}isEnabled(C){return 0!==(this.mask&(1<<C|0))}}let Jm=0;const $m=new Vector3,ef=new Quaternion,tf=new Matrix4,nf=new Vector3,rf=new Vector3,af=new Vector3,sf=new Quaternion,of=new Vector3(1,0,0),lf=new Vector3(0,1,0),cf=new Vector3(0,0,1),uf={type:"added"},hf={type:"removed"},df={type:"childadded",child:null},pf={type:"childremoved",child:null};class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Jm++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();const C=new Vector3,Rn=new Euler,or=new Quaternion,So=new Vector3(1,1,1);Rn._onChange((function(){or.setFromEuler(Rn,!1)})),or._onChange((function(){Rn.setFromQuaternion(or,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:C},rotation:{configurable:!0,enumerable:!0,value:Rn},quaternion:{configurable:!0,enumerable:!0,value:or},scale:{configurable:!0,enumerable:!0,value:So},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(C){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(C),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(C){return this.quaternion.premultiply(C),this}setRotationFromAxisAngle(C,Rn){this.quaternion.setFromAxisAngle(C,Rn)}setRotationFromEuler(C){this.quaternion.setFromEuler(C,!0)}setRotationFromMatrix(C){this.quaternion.setFromRotationMatrix(C)}setRotationFromQuaternion(C){this.quaternion.copy(C)}rotateOnAxis(C,Rn){return ef.setFromAxisAngle(C,Rn),this.quaternion.multiply(ef),this}rotateOnWorldAxis(C,Rn){return ef.setFromAxisAngle(C,Rn),this.quaternion.premultiply(ef),this}rotateX(C){return this.rotateOnAxis(of,C)}rotateY(C){return this.rotateOnAxis(lf,C)}rotateZ(C){return this.rotateOnAxis(cf,C)}translateOnAxis(C,Rn){return $m.copy(C).applyQuaternion(this.quaternion),this.position.add($m.multiplyScalar(Rn)),this}translateX(C){return this.translateOnAxis(of,C)}translateY(C){return this.translateOnAxis(lf,C)}translateZ(C){return this.translateOnAxis(cf,C)}localToWorld(C){return this.updateWorldMatrix(!0,!1),C.applyMatrix4(this.matrixWorld)}worldToLocal(C){return this.updateWorldMatrix(!0,!1),C.applyMatrix4(tf.copy(this.matrixWorld).invert())}lookAt(C,Rn,or){C.isVector3?nf.copy(C):nf.set(C,Rn,or);const So=this.parent;this.updateWorldMatrix(!0,!1),rf.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tf.lookAt(rf,nf,this.up):tf.lookAt(nf,rf,this.up),this.quaternion.setFromRotationMatrix(tf),So&&(tf.extractRotation(So.matrixWorld),ef.setFromRotationMatrix(tf),this.quaternion.premultiply(ef.invert()))}add(C){if(arguments.length>1){for(let C=0;C<arguments.length;C++)this.add(arguments[C]);return this}return C===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",C),this):(C&&C.isObject3D?(C.removeFromParent(),C.parent=this,this.children.push(C),C.dispatchEvent(uf),df.child=C,this.dispatchEvent(df),df.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",C),this)}remove(C){if(arguments.length>1){for(let C=0;C<arguments.length;C++)this.remove(arguments[C]);return this}const Rn=this.children.indexOf(C);return-1!==Rn&&(C.parent=null,this.children.splice(Rn,1),C.dispatchEvent(hf),pf.child=C,this.dispatchEvent(pf),pf.child=null),this}removeFromParent(){const C=this.parent;return null!==C&&C.remove(this),this}clear(){return this.remove(...this.children)}attach(C){return this.updateWorldMatrix(!0,!1),tf.copy(this.matrixWorld).invert(),null!==C.parent&&(C.parent.updateWorldMatrix(!0,!1),tf.multiply(C.parent.matrixWorld)),C.applyMatrix4(tf),C.removeFromParent(),C.parent=this,this.children.push(C),C.updateWorldMatrix(!1,!0),C.dispatchEvent(uf),df.child=C,this.dispatchEvent(df),df.child=null,this}getObjectById(C){return this.getObjectByProperty("id",C)}getObjectByName(C){return this.getObjectByProperty("name",C)}getObjectByProperty(C,Rn){if(this[C]===Rn)return this;for(let or=0,So=this.children.length;or<So;or++){const So=this.children[or].getObjectByProperty(C,Rn);if(void 0!==So)return So}}getObjectsByProperty(C,Rn,or){void 0===or&&(or=[]),this[C]===Rn&&or.push(this);const So=this.children;for(let To=0,Ro=So.length;To<Ro;To++)So[To].getObjectsByProperty(C,Rn,or);return or}getWorldPosition(C){return this.updateWorldMatrix(!0,!1),C.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(C){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rf,C,af),C}getWorldScale(C){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rf,sf,C),C}getWorldDirection(C){this.updateWorldMatrix(!0,!1);const Rn=this.matrixWorld.elements;return C.set(Rn[8],Rn[9],Rn[10]).normalize()}raycast(){}traverse(C){C(this);const Rn=this.children;for(let or=0,So=Rn.length;or<So;or++)Rn[or].traverse(C)}traverseVisible(C){if(!1===this.visible)return;C(this);const Rn=this.children;for(let or=0,So=Rn.length;or<So;or++)Rn[or].traverseVisible(C)}traverseAncestors(C){const Rn=this.parent;null!==Rn&&(C(Rn),Rn.traverseAncestors(C))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(C){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||C)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,C=!0);const Rn=this.children;for(let or=0,So=Rn.length;or<So;or++){Rn[or].updateMatrixWorld(C)}}updateWorldMatrix(C,Rn){const or=this.parent;if(!0===C&&null!==or&&or.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===Rn){const C=this.children;for(let Rn=0,or=C.length;Rn<or;Rn++){C[Rn].updateWorldMatrix(!1,!0)}}}toJSON(C){const Rn=void 0===C||"string"===typeof C,or={};Rn&&(C={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},or.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const So={};function serialize(Rn,or){return void 0===Rn[or.uuid]&&(Rn[or.uuid]=or.toJSON(C)),or.uuid}if(So.uuid=this.uuid,So.type=this.type,""!==this.name&&(So.name=this.name),!0===this.castShadow&&(So.castShadow=!0),!0===this.receiveShadow&&(So.receiveShadow=!0),!1===this.visible&&(So.visible=!1),!1===this.frustumCulled&&(So.frustumCulled=!1),0!==this.renderOrder&&(So.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(So.userData=this.userData),So.layers=this.layers.mask,So.matrix=this.matrix.toArray(),So.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(So.matrixAutoUpdate=!1),this.isInstancedMesh&&(So.type="InstancedMesh",So.count=this.count,So.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(So.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(So.type="BatchedMesh",So.perObjectFrustumCulled=this.perObjectFrustumCulled,So.sortObjects=this.sortObjects,So.drawRanges=this._drawRanges,So.reservedRanges=this._reservedRanges,So.visibility=this._visibility,So.active=this._active,So.bounds=this._bounds.map((C=>({boxInitialized:C.boxInitialized,boxMin:C.box.min.toArray(),boxMax:C.box.max.toArray(),sphereInitialized:C.sphereInitialized,sphereRadius:C.sphere.radius,sphereCenter:C.sphere.center.toArray()}))),So.maxInstanceCount=this._maxInstanceCount,So.maxVertexCount=this._maxVertexCount,So.maxIndexCount=this._maxIndexCount,So.geometryInitialized=this._geometryInitialized,So.geometryCount=this._geometryCount,So.matricesTexture=this._matricesTexture.toJSON(C),null!==this._colorsTexture&&(So.colorsTexture=this._colorsTexture.toJSON(C)),null!==this.boundingSphere&&(So.boundingSphere={center:So.boundingSphere.center.toArray(),radius:So.boundingSphere.radius}),null!==this.boundingBox&&(So.boundingBox={min:So.boundingBox.min.toArray(),max:So.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?So.background=this.background.toJSON():this.background.isTexture&&(So.background=this.background.toJSON(C).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(So.environment=this.environment.toJSON(C).uuid);else if(this.isMesh||this.isLine||this.isPoints){So.geometry=serialize(C.geometries,this.geometry);const Rn=this.geometry.parameters;if(void 0!==Rn&&void 0!==Rn.shapes){const or=Rn.shapes;if(Array.isArray(or))for(let Rn=0,So=or.length;Rn<So;Rn++){const So=or[Rn];serialize(C.shapes,So)}else serialize(C.shapes,or)}}if(this.isSkinnedMesh&&(So.bindMode=this.bindMode,So.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(serialize(C.skeletons,this.skeleton),So.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const Rn=[];for(let or=0,So=this.material.length;or<So;or++)Rn.push(serialize(C.materials,this.material[or]));So.material=Rn}else So.material=serialize(C.materials,this.material);if(this.children.length>0){So.children=[];for(let Rn=0;Rn<this.children.length;Rn++)So.children.push(this.children[Rn].toJSON(C).object)}if(this.animations.length>0){So.animations=[];for(let Rn=0;Rn<this.animations.length;Rn++){const or=this.animations[Rn];So.animations.push(serialize(C.animations,or))}}if(Rn){const Rn=extractFromCache(C.geometries),So=extractFromCache(C.materials),To=extractFromCache(C.textures),Ro=extractFromCache(C.images),Uo=extractFromCache(C.shapes),Oo=extractFromCache(C.skeletons),Ho=extractFromCache(C.animations),qo=extractFromCache(C.nodes);Rn.length>0&&(or.geometries=Rn),So.length>0&&(or.materials=So),To.length>0&&(or.textures=To),Ro.length>0&&(or.images=Ro),Uo.length>0&&(or.shapes=Uo),Oo.length>0&&(or.skeletons=Oo),Ho.length>0&&(or.animations=Ho),qo.length>0&&(or.nodes=qo)}return or.object=So,or;function extractFromCache(C){const Rn=[];for(const or in C){const So=C[or];delete So.metadata,Rn.push(So)}return Rn}}clone(C){return(new this.constructor).copy(this,C)}copy(C,Rn){if(void 0===Rn&&(Rn=!0),this.name=C.name,this.up.copy(C.up),this.position.copy(C.position),this.rotation.order=C.rotation.order,this.quaternion.copy(C.quaternion),this.scale.copy(C.scale),this.matrix.copy(C.matrix),this.matrixWorld.copy(C.matrixWorld),this.matrixAutoUpdate=C.matrixAutoUpdate,this.matrixWorldAutoUpdate=C.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=C.matrixWorldNeedsUpdate,this.layers.mask=C.layers.mask,this.visible=C.visible,this.castShadow=C.castShadow,this.receiveShadow=C.receiveShadow,this.frustumCulled=C.frustumCulled,this.renderOrder=C.renderOrder,this.animations=C.animations.slice(),this.userData=JSON.parse(JSON.stringify(C.userData)),!0===Rn)for(let or=0;or<C.children.length;or++){const Rn=C.children[or];this.add(Rn.clone())}return this}}Object3D.DEFAULT_UP=new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const mf=new Vector3,ff=new Vector3,gf=new Vector3,Af=new Vector3,yf=new Vector3,vf=new Vector3,xf=new Vector3,_f=new Vector3,bf=new Vector3,wf=new Vector3;class Triangle{constructor(C,Rn,or){void 0===C&&(C=new Vector3),void 0===Rn&&(Rn=new Vector3),void 0===or&&(or=new Vector3),this.a=C,this.b=Rn,this.c=or}static getNormal(C,Rn,or,So){So.subVectors(or,Rn),mf.subVectors(C,Rn),So.cross(mf);const To=So.lengthSq();return To>0?So.multiplyScalar(1/Math.sqrt(To)):So.set(0,0,0)}static getBarycoord(C,Rn,or,So,To){mf.subVectors(So,Rn),ff.subVectors(or,Rn),gf.subVectors(C,Rn);const Ro=mf.dot(mf),Uo=mf.dot(ff),Oo=mf.dot(gf),Ho=ff.dot(ff),qo=ff.dot(gf),dl=Ro*Ho-Uo*Uo;if(0===dl)return To.set(0,0,0),null;const ml=1/dl,fl=(Ho*Oo-Uo*qo)*ml,vl=(Ro*qo-Uo*Oo)*ml;return To.set(1-fl-vl,vl,fl)}static containsPoint(C,Rn,or,So){return null!==this.getBarycoord(C,Rn,or,So,Af)&&(Af.x>=0&&Af.y>=0&&Af.x+Af.y<=1)}static getInterpolation(C,Rn,or,So,To,Ro,Uo,Oo){return null===this.getBarycoord(C,Rn,or,So,Af)?(Oo.x=0,Oo.y=0,"z"in Oo&&(Oo.z=0),"w"in Oo&&(Oo.w=0),null):(Oo.setScalar(0),Oo.addScaledVector(To,Af.x),Oo.addScaledVector(Ro,Af.y),Oo.addScaledVector(Uo,Af.z),Oo)}static isFrontFacing(C,Rn,or,So){return mf.subVectors(or,Rn),ff.subVectors(C,Rn),mf.cross(ff).dot(So)<0}set(C,Rn,or){return this.a.copy(C),this.b.copy(Rn),this.c.copy(or),this}setFromPointsAndIndices(C,Rn,or,So){return this.a.copy(C[Rn]),this.b.copy(C[or]),this.c.copy(C[So]),this}setFromAttributeAndIndices(C,Rn,or,So){return this.a.fromBufferAttribute(C,Rn),this.b.fromBufferAttribute(C,or),this.c.fromBufferAttribute(C,So),this}clone(){return(new this.constructor).copy(this)}copy(C){return this.a.copy(C.a),this.b.copy(C.b),this.c.copy(C.c),this}getArea(){return mf.subVectors(this.c,this.b),ff.subVectors(this.a,this.b),.5*mf.cross(ff).length()}getMidpoint(C){return C.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(C){return Triangle.getNormal(this.a,this.b,this.c,C)}getPlane(C){return C.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(C,Rn){return Triangle.getBarycoord(C,this.a,this.b,this.c,Rn)}getInterpolation(C,Rn,or,So,To){return Triangle.getInterpolation(C,this.a,this.b,this.c,Rn,or,So,To)}containsPoint(C){return Triangle.containsPoint(C,this.a,this.b,this.c)}isFrontFacing(C){return Triangle.isFrontFacing(this.a,this.b,this.c,C)}intersectsBox(C){return C.intersectsTriangle(this)}closestPointToPoint(C,Rn){const or=this.a,So=this.b,To=this.c;let Ro,Uo;yf.subVectors(So,or),vf.subVectors(To,or),_f.subVectors(C,or);const Oo=yf.dot(_f),Ho=vf.dot(_f);if(Oo<=0&&Ho<=0)return Rn.copy(or);bf.subVectors(C,So);const qo=yf.dot(bf),dl=vf.dot(bf);if(qo>=0&&dl<=qo)return Rn.copy(So);const ml=Oo*dl-qo*Ho;if(ml<=0&&Oo>=0&&qo<=0)return Ro=Oo/(Oo-qo),Rn.copy(or).addScaledVector(yf,Ro);wf.subVectors(C,To);const fl=yf.dot(wf),vl=vf.dot(wf);if(vl>=0&&fl<=vl)return Rn.copy(To);const bl=fl*Ho-Oo*vl;if(bl<=0&&Ho>=0&&vl<=0)return Uo=Ho/(Ho-vl),Rn.copy(or).addScaledVector(vf,Uo);const kl=qo*vl-fl*dl;if(kl<=0&&dl-qo>=0&&fl-vl>=0)return xf.subVectors(To,So),Uo=(dl-qo)/(dl-qo+(fl-vl)),Rn.copy(So).addScaledVector(xf,Uo);const Ll=1/(kl+bl+ml);return Ro=bl*Ll,Uo=ml*Ll,Rn.copy(or).addScaledVector(yf,Ro).addScaledVector(vf,Uo)}equals(C){return C.a.equals(this.a)&&C.b.equals(this.b)&&C.c.equals(this.c)}}const Ef={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},Mf={h:0,s:0,l:0},Sf={h:0,s:0,l:0};function hue2rgb(C,Rn,or){return or<0&&(or+=1),or>1&&(or-=1),or<1/6?C+6*(Rn-C)*or:or<.5?Rn:or<2/3?C+6*(Rn-C)*(2/3-or):C}class Color{constructor(C,Rn,or){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(C,Rn,or)}set(C,Rn,or){if(void 0===Rn&&void 0===or){const Rn=C;Rn&&Rn.isColor?this.copy(Rn):"number"===typeof Rn?this.setHex(Rn):"string"===typeof Rn&&this.setStyle(Rn)}else this.setRGB(C,Rn,or);return this}setScalar(C){return this.r=C,this.g=C,this.b=C,this}setHex(C,Rn){return void 0===Rn&&(Rn=Np),C=Math.floor(C),this.r=(C>>16&255)/255,this.g=(C>>8&255)/255,this.b=(255&C)/255,mm.toWorkingColorSpace(this,Rn),this}setRGB(C,Rn,or,So){return void 0===So&&(So=mm.workingColorSpace),this.r=C,this.g=Rn,this.b=or,mm.toWorkingColorSpace(this,So),this}setHSL(C,Rn,or,So){if(void 0===So&&(So=mm.workingColorSpace),C=euclideanModulo(C,1),Rn=clamp(Rn,0,1),or=clamp(or,0,1),0===Rn)this.r=this.g=this.b=or;else{const So=or<=.5?or*(1+Rn):or+Rn-or*Rn,To=2*or-So;this.r=hue2rgb(To,So,C+1/3),this.g=hue2rgb(To,So,C),this.b=hue2rgb(To,So,C-1/3)}return mm.toWorkingColorSpace(this,So),this}setStyle(C,Rn){function handleAlpha(Rn){void 0!==Rn&&parseFloat(Rn)<1&&console.warn("THREE.Color: Alpha component of "+C+" will be ignored.")}let or;if(void 0===Rn&&(Rn=Np),or=/^(\w+)\(([^\)]*)\)/.exec(C)){let So;const To=or[1],Ro=or[2];switch(To){case"rgb":case"rgba":if(So=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Ro))return handleAlpha(So[4]),this.setRGB(Math.min(255,parseInt(So[1],10))/255,Math.min(255,parseInt(So[2],10))/255,Math.min(255,parseInt(So[3],10))/255,Rn);if(So=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Ro))return handleAlpha(So[4]),this.setRGB(Math.min(100,parseInt(So[1],10))/100,Math.min(100,parseInt(So[2],10))/100,Math.min(100,parseInt(So[3],10))/100,Rn);break;case"hsl":case"hsla":if(So=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Ro))return handleAlpha(So[4]),this.setHSL(parseFloat(So[1])/360,parseFloat(So[2])/100,parseFloat(So[3])/100,Rn);break;default:console.warn("THREE.Color: Unknown color model "+C)}}else if(or=/^\#([A-Fa-f\d]+)$/.exec(C)){const So=or[1],To=So.length;if(3===To)return this.setRGB(parseInt(So.charAt(0),16)/15,parseInt(So.charAt(1),16)/15,parseInt(So.charAt(2),16)/15,Rn);if(6===To)return this.setHex(parseInt(So,16),Rn);console.warn("THREE.Color: Invalid hex color "+C)}else if(C&&C.length>0)return this.setColorName(C,Rn);return this}setColorName(C,Rn){void 0===Rn&&(Rn=Np);const or=Ef[C.toLowerCase()];return void 0!==or?this.setHex(or,Rn):console.warn("THREE.Color: Unknown color "+C),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(C){return this.r=C.r,this.g=C.g,this.b=C.b,this}copySRGBToLinear(C){return this.r=SRGBToLinear(C.r),this.g=SRGBToLinear(C.g),this.b=SRGBToLinear(C.b),this}copyLinearToSRGB(C){return this.r=LinearToSRGB(C.r),this.g=LinearToSRGB(C.g),this.b=LinearToSRGB(C.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(C){return void 0===C&&(C=Np),mm.fromWorkingColorSpace(kf.copy(this),C),65536*Math.round(clamp(255*kf.r,0,255))+256*Math.round(clamp(255*kf.g,0,255))+Math.round(clamp(255*kf.b,0,255))}getHexString(C){return void 0===C&&(C=Np),("000000"+this.getHex(C).toString(16)).slice(-6)}getHSL(C,Rn){void 0===Rn&&(Rn=mm.workingColorSpace),mm.fromWorkingColorSpace(kf.copy(this),Rn);const or=kf.r,So=kf.g,To=kf.b,Ro=Math.max(or,So,To),Uo=Math.min(or,So,To);let Oo,Ho;const qo=(Uo+Ro)/2;if(Uo===Ro)Oo=0,Ho=0;else{const C=Ro-Uo;switch(Ho=qo<=.5?C/(Ro+Uo):C/(2-Ro-Uo),Ro){case or:Oo=(So-To)/C+(So<To?6:0);break;case So:Oo=(To-or)/C+2;break;case To:Oo=(or-So)/C+4}Oo/=6}return C.h=Oo,C.s=Ho,C.l=qo,C}getRGB(C,Rn){return void 0===Rn&&(Rn=mm.workingColorSpace),mm.fromWorkingColorSpace(kf.copy(this),Rn),C.r=kf.r,C.g=kf.g,C.b=kf.b,C}getStyle(C){void 0===C&&(C=Np),mm.fromWorkingColorSpace(kf.copy(this),C);const Rn=kf.r,or=kf.g,So=kf.b;return C!==Np?"color("+C+" "+Rn.toFixed(3)+" "+or.toFixed(3)+" "+So.toFixed(3)+")":"rgb("+Math.round(255*Rn)+","+Math.round(255*or)+","+Math.round(255*So)+")"}offsetHSL(C,Rn,or){return this.getHSL(Mf),this.setHSL(Mf.h+C,Mf.s+Rn,Mf.l+or)}add(C){return this.r+=C.r,this.g+=C.g,this.b+=C.b,this}addColors(C,Rn){return this.r=C.r+Rn.r,this.g=C.g+Rn.g,this.b=C.b+Rn.b,this}addScalar(C){return this.r+=C,this.g+=C,this.b+=C,this}sub(C){return this.r=Math.max(0,this.r-C.r),this.g=Math.max(0,this.g-C.g),this.b=Math.max(0,this.b-C.b),this}multiply(C){return this.r*=C.r,this.g*=C.g,this.b*=C.b,this}multiplyScalar(C){return this.r*=C,this.g*=C,this.b*=C,this}lerp(C,Rn){return this.r+=(C.r-this.r)*Rn,this.g+=(C.g-this.g)*Rn,this.b+=(C.b-this.b)*Rn,this}lerpColors(C,Rn,or){return this.r=C.r+(Rn.r-C.r)*or,this.g=C.g+(Rn.g-C.g)*or,this.b=C.b+(Rn.b-C.b)*or,this}lerpHSL(C,Rn){this.getHSL(Mf),C.getHSL(Sf);const or=lerp(Mf.h,Sf.h,Rn),So=lerp(Mf.s,Sf.s,Rn),To=lerp(Mf.l,Sf.l,Rn);return this.setHSL(or,So,To),this}setFromVector3(C){return this.r=C.x,this.g=C.y,this.b=C.z,this}applyMatrix3(C){const Rn=this.r,or=this.g,So=this.b,To=C.elements;return this.r=To[0]*Rn+To[3]*or+To[6]*So,this.g=To[1]*Rn+To[4]*or+To[7]*So,this.b=To[2]*Rn+To[5]*or+To[8]*So,this}equals(C){return C.r===this.r&&C.g===this.g&&C.b===this.b}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.r=C[Rn],this.g=C[Rn+1],this.b=C[Rn+2],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.r,C[Rn+1]=this.g,C[Rn+2]=this.b,C}fromBufferAttribute(C,Rn){return this.r=C.getX(Rn),this.g=C.getY(Rn),this.b=C.getZ(Rn),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const kf=new Color;Color.NAMES=Ef;let Tf=0;class Material extends EventDispatcher{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Tf++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=bl,this.side=dl,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Dh,this.blendDst=Rh,this.blendEquation=jc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Color(0,0,0),this.blendAlpha=0,this.depthFunc=Kh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Hp,this.stencilZFail=Hp,this.stencilZPass=Hp,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(C){this._alphaTest>0!==C>0&&this.version++,this._alphaTest=C}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(C){if(void 0!==C)for(const Rn in C){const or=C[Rn];if(void 0===or){console.warn("THREE.Material: parameter '"+Rn+"' has value of undefined.");continue}const So=this[Rn];void 0!==So?So&&So.isColor?So.set(or):So&&So.isVector3&&or&&or.isVector3?So.copy(or):this[Rn]=or:console.warn("THREE.Material: '"+Rn+"' is not a property of THREE."+this.type+".")}}toJSON(C){const Rn=void 0===C||"string"===typeof C;Rn&&(C={textures:{},images:{}});const or={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function extractFromCache(C){const Rn=[];for(const or in C){const So=C[or];delete So.metadata,Rn.push(So)}return Rn}if(or.uuid=this.uuid,or.type=this.type,""!==this.name&&(or.name=this.name),this.color&&this.color.isColor&&(or.color=this.color.getHex()),void 0!==this.roughness&&(or.roughness=this.roughness),void 0!==this.metalness&&(or.metalness=this.metalness),void 0!==this.sheen&&(or.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(or.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(or.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(or.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(or.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(or.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(or.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(or.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(or.shininess=this.shininess),void 0!==this.clearcoat&&(or.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(or.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(or.clearcoatMap=this.clearcoatMap.toJSON(C).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(or.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(C).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(or.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(C).uuid,or.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(or.dispersion=this.dispersion),void 0!==this.iridescence&&(or.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(or.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(or.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(or.iridescenceMap=this.iridescenceMap.toJSON(C).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(or.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(C).uuid),void 0!==this.anisotropy&&(or.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(or.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(or.anisotropyMap=this.anisotropyMap.toJSON(C).uuid),this.map&&this.map.isTexture&&(or.map=this.map.toJSON(C).uuid),this.matcap&&this.matcap.isTexture&&(or.matcap=this.matcap.toJSON(C).uuid),this.alphaMap&&this.alphaMap.isTexture&&(or.alphaMap=this.alphaMap.toJSON(C).uuid),this.lightMap&&this.lightMap.isTexture&&(or.lightMap=this.lightMap.toJSON(C).uuid,or.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(or.aoMap=this.aoMap.toJSON(C).uuid,or.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(or.bumpMap=this.bumpMap.toJSON(C).uuid,or.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(or.normalMap=this.normalMap.toJSON(C).uuid,or.normalMapType=this.normalMapType,or.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(or.displacementMap=this.displacementMap.toJSON(C).uuid,or.displacementScale=this.displacementScale,or.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(or.roughnessMap=this.roughnessMap.toJSON(C).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(or.metalnessMap=this.metalnessMap.toJSON(C).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(or.emissiveMap=this.emissiveMap.toJSON(C).uuid),this.specularMap&&this.specularMap.isTexture&&(or.specularMap=this.specularMap.toJSON(C).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(or.specularIntensityMap=this.specularIntensityMap.toJSON(C).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(or.specularColorMap=this.specularColorMap.toJSON(C).uuid),this.envMap&&this.envMap.isTexture&&(or.envMap=this.envMap.toJSON(C).uuid,void 0!==this.combine&&(or.combine=this.combine)),void 0!==this.envMapRotation&&(or.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(or.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(or.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(or.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(or.gradientMap=this.gradientMap.toJSON(C).uuid),void 0!==this.transmission&&(or.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(or.transmissionMap=this.transmissionMap.toJSON(C).uuid),void 0!==this.thickness&&(or.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(or.thicknessMap=this.thicknessMap.toJSON(C).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(or.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(or.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(or.size=this.size),null!==this.shadowSide&&(or.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(or.sizeAttenuation=this.sizeAttenuation),this.blending!==bl&&(or.blending=this.blending),this.side!==dl&&(or.side=this.side),!0===this.vertexColors&&(or.vertexColors=!0),this.opacity<1&&(or.opacity=this.opacity),!0===this.transparent&&(or.transparent=!0),this.blendSrc!==Dh&&(or.blendSrc=this.blendSrc),this.blendDst!==Rh&&(or.blendDst=this.blendDst),this.blendEquation!==jc&&(or.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(or.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(or.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(or.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(or.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(or.blendAlpha=this.blendAlpha),this.depthFunc!==Kh&&(or.depthFunc=this.depthFunc),!1===this.depthTest&&(or.depthTest=this.depthTest),!1===this.depthWrite&&(or.depthWrite=this.depthWrite),!1===this.colorWrite&&(or.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(or.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(or.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(or.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(or.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Hp&&(or.stencilFail=this.stencilFail),this.stencilZFail!==Hp&&(or.stencilZFail=this.stencilZFail),this.stencilZPass!==Hp&&(or.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(or.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(or.rotation=this.rotation),!0===this.polygonOffset&&(or.polygonOffset=!0),0!==this.polygonOffsetFactor&&(or.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(or.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(or.linewidth=this.linewidth),void 0!==this.dashSize&&(or.dashSize=this.dashSize),void 0!==this.gapSize&&(or.gapSize=this.gapSize),void 0!==this.scale&&(or.scale=this.scale),!0===this.dithering&&(or.dithering=!0),this.alphaTest>0&&(or.alphaTest=this.alphaTest),!0===this.alphaHash&&(or.alphaHash=!0),!0===this.alphaToCoverage&&(or.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(or.premultipliedAlpha=!0),!0===this.forceSinglePass&&(or.forceSinglePass=!0),!0===this.wireframe&&(or.wireframe=!0),this.wireframeLinewidth>1&&(or.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(or.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(or.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(or.flatShading=!0),!1===this.visible&&(or.visible=!1),!1===this.toneMapped&&(or.toneMapped=!1),!1===this.fog&&(or.fog=!1),Object.keys(this.userData).length>0&&(or.userData=this.userData),Rn){const Rn=extractFromCache(C.textures),So=extractFromCache(C.images);Rn.length>0&&(or.textures=Rn),So.length>0&&(or.images=So)}return or}clone(){return(new this.constructor).copy(this)}copy(C){this.name=C.name,this.blending=C.blending,this.side=C.side,this.vertexColors=C.vertexColors,this.opacity=C.opacity,this.transparent=C.transparent,this.blendSrc=C.blendSrc,this.blendDst=C.blendDst,this.blendEquation=C.blendEquation,this.blendSrcAlpha=C.blendSrcAlpha,this.blendDstAlpha=C.blendDstAlpha,this.blendEquationAlpha=C.blendEquationAlpha,this.blendColor.copy(C.blendColor),this.blendAlpha=C.blendAlpha,this.depthFunc=C.depthFunc,this.depthTest=C.depthTest,this.depthWrite=C.depthWrite,this.stencilWriteMask=C.stencilWriteMask,this.stencilFunc=C.stencilFunc,this.stencilRef=C.stencilRef,this.stencilFuncMask=C.stencilFuncMask,this.stencilFail=C.stencilFail,this.stencilZFail=C.stencilZFail,this.stencilZPass=C.stencilZPass,this.stencilWrite=C.stencilWrite;const Rn=C.clippingPlanes;let or=null;if(null!==Rn){const C=Rn.length;or=new Array(C);for(let So=0;So!==C;++So)or[So]=Rn[So].clone()}return this.clippingPlanes=or,this.clipIntersection=C.clipIntersection,this.clipShadows=C.clipShadows,this.shadowSide=C.shadowSide,this.colorWrite=C.colorWrite,this.precision=C.precision,this.polygonOffset=C.polygonOffset,this.polygonOffsetFactor=C.polygonOffsetFactor,this.polygonOffsetUnits=C.polygonOffsetUnits,this.dithering=C.dithering,this.alphaTest=C.alphaTest,this.alphaHash=C.alphaHash,this.alphaToCoverage=C.alphaToCoverage,this.premultipliedAlpha=C.premultipliedAlpha,this.forceSinglePass=C.forceSinglePass,this.visible=C.visible,this.toneMapped=C.toneMapped,this.userData=JSON.parse(JSON.stringify(C.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(C){!0===C&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class MeshBasicMaterial extends Material{constructor(C){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=$h,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(C)}copy(C){return super.copy(C),this.color.copy(C.color),this.map=C.map,this.lightMap=C.lightMap,this.lightMapIntensity=C.lightMapIntensity,this.aoMap=C.aoMap,this.aoMapIntensity=C.aoMapIntensity,this.specularMap=C.specularMap,this.alphaMap=C.alphaMap,this.envMap=C.envMap,this.envMapRotation.copy(C.envMapRotation),this.combine=C.combine,this.reflectivity=C.reflectivity,this.refractionRatio=C.refractionRatio,this.wireframe=C.wireframe,this.wireframeLinewidth=C.wireframeLinewidth,this.wireframeLinecap=C.wireframeLinecap,this.wireframeLinejoin=C.wireframeLinejoin,this.fog=C.fog,this}}const If=new Vector3,Cf=new Vector2;class BufferAttribute{constructor(C,Rn,or){if(void 0===or&&(or=!1),Array.isArray(C))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=C,this.itemSize=Rn,this.count=void 0!==C?C.length/Rn:0,this.normalized=or,this.usage=$p,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Cd,this.version=0}onUploadCallback(){}set needsUpdate(C){!0===C&&this.version++}get updateRange(){return warnOnce("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(C){return this.usage=C,this}addUpdateRange(C,Rn){this.updateRanges.push({start:C,count:Rn})}clearUpdateRanges(){this.updateRanges.length=0}copy(C){return this.name=C.name,this.array=new C.array.constructor(C.array),this.itemSize=C.itemSize,this.count=C.count,this.normalized=C.normalized,this.usage=C.usage,this.gpuType=C.gpuType,this}copyAt(C,Rn,or){C*=this.itemSize,or*=Rn.itemSize;for(let So=0,To=this.itemSize;So<To;So++)this.array[C+So]=Rn.array[or+So];return this}copyArray(C){return this.array.set(C),this}applyMatrix3(C){if(2===this.itemSize)for(let Rn=0,or=this.count;Rn<or;Rn++)Cf.fromBufferAttribute(this,Rn),Cf.applyMatrix3(C),this.setXY(Rn,Cf.x,Cf.y);else if(3===this.itemSize)for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.applyMatrix3(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}applyMatrix4(C){for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.applyMatrix4(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}applyNormalMatrix(C){for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.applyNormalMatrix(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}transformDirection(C){for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.transformDirection(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}set(C,Rn){return void 0===Rn&&(Rn=0),this.array.set(C,Rn),this}getComponent(C,Rn){let or=this.array[C*this.itemSize+Rn];return this.normalized&&(or=denormalize(or,this.array)),or}setComponent(C,Rn,or){return this.normalized&&(or=normalize(or,this.array)),this.array[C*this.itemSize+Rn]=or,this}getX(C){let Rn=this.array[C*this.itemSize];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setX(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize]=Rn,this}getY(C){let Rn=this.array[C*this.itemSize+1];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setY(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize+1]=Rn,this}getZ(C){let Rn=this.array[C*this.itemSize+2];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setZ(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize+2]=Rn,this}getW(C){let Rn=this.array[C*this.itemSize+3];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setW(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize+3]=Rn,this}setXY(C,Rn,or){return C*=this.itemSize,this.normalized&&(Rn=normalize(Rn,this.array),or=normalize(or,this.array)),this.array[C+0]=Rn,this.array[C+1]=or,this}setXYZ(C,Rn,or,So){return C*=this.itemSize,this.normalized&&(Rn=normalize(Rn,this.array),or=normalize(or,this.array),So=normalize(So,this.array)),this.array[C+0]=Rn,this.array[C+1]=or,this.array[C+2]=So,this}setXYZW(C,Rn,or,So,To){return C*=this.itemSize,this.normalized&&(Rn=normalize(Rn,this.array),or=normalize(or,this.array),So=normalize(So,this.array),To=normalize(To,this.array)),this.array[C+0]=Rn,this.array[C+1]=or,this.array[C+2]=So,this.array[C+3]=To,this}onUpload(C){return this.onUploadCallback=C,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const C={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(C.name=this.name),this.usage!==$p&&(C.usage=this.usage),C}}class Uint16BufferAttribute extends BufferAttribute{constructor(C,Rn,or){super(new Uint16Array(C),Rn,or)}}class Uint32BufferAttribute extends BufferAttribute{constructor(C,Rn,or){super(new Uint32Array(C),Rn,or)}}class Float32BufferAttribute extends BufferAttribute{constructor(C,Rn,or){super(new Float32Array(C),Rn,or)}}let Lf=0;const Pf=new Matrix4,zf=new Object3D,Df=new Vector3,Rf=new Box3,Nf=new Box3,Uf=new Vector3;class BufferGeometry extends EventDispatcher{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Lf++}),this.uuid=generateUUID(),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(C){return Array.isArray(C)?this.index=new(arrayNeedsUint32(C)?Uint32BufferAttribute:Uint16BufferAttribute)(C,1):this.index=C,this}getAttribute(C){return this.attributes[C]}setAttribute(C,Rn){return this.attributes[C]=Rn,this}deleteAttribute(C){return delete this.attributes[C],this}hasAttribute(C){return void 0!==this.attributes[C]}addGroup(C,Rn,or){void 0===or&&(or=0),this.groups.push({start:C,count:Rn,materialIndex:or})}clearGroups(){this.groups=[]}setDrawRange(C,Rn){this.drawRange.start=C,this.drawRange.count=Rn}applyMatrix4(C){const Rn=this.attributes.position;void 0!==Rn&&(Rn.applyMatrix4(C),Rn.needsUpdate=!0);const or=this.attributes.normal;if(void 0!==or){const Rn=(new Matrix3).getNormalMatrix(C);or.applyNormalMatrix(Rn),or.needsUpdate=!0}const So=this.attributes.tangent;return void 0!==So&&(So.transformDirection(C),So.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(C){return Pf.makeRotationFromQuaternion(C),this.applyMatrix4(Pf),this}rotateX(C){return Pf.makeRotationX(C),this.applyMatrix4(Pf),this}rotateY(C){return Pf.makeRotationY(C),this.applyMatrix4(Pf),this}rotateZ(C){return Pf.makeRotationZ(C),this.applyMatrix4(Pf),this}translate(C,Rn,or){return Pf.makeTranslation(C,Rn,or),this.applyMatrix4(Pf),this}scale(C,Rn,or){return Pf.makeScale(C,Rn,or),this.applyMatrix4(Pf),this}lookAt(C){return zf.lookAt(C),zf.updateMatrix(),this.applyMatrix4(zf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Df).negate(),this.translate(Df.x,Df.y,Df.z),this}setFromPoints(C){const Rn=[];for(let or=0,So=C.length;or<So;or++){const So=C[or];Rn.push(So.x,So.y,So.z||0)}return this.setAttribute("position",new Float32BufferAttribute(Rn,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);const C=this.attributes.position,Rn=this.morphAttributes.position;if(C&&C.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3(1/0,1/0,1/0));if(void 0!==C){if(this.boundingBox.setFromBufferAttribute(C),Rn)for(let or=0,So=Rn.length;or<So;or++){const C=Rn[or];Rf.setFromBufferAttribute(C),this.morphTargetsRelative?(Uf.addVectors(this.boundingBox.min,Rf.min),this.boundingBox.expandByPoint(Uf),Uf.addVectors(this.boundingBox.max,Rf.max),this.boundingBox.expandByPoint(Uf)):(this.boundingBox.expandByPoint(Rf.min),this.boundingBox.expandByPoint(Rf.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 Sphere);const C=this.attributes.position,Rn=this.morphAttributes.position;if(C&&C.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Vector3,1/0);if(C){const or=this.boundingSphere.center;if(Rf.setFromBufferAttribute(C),Rn)for(let C=0,To=Rn.length;C<To;C++){const or=Rn[C];Nf.setFromBufferAttribute(or),this.morphTargetsRelative?(Uf.addVectors(Rf.min,Nf.min),Rf.expandByPoint(Uf),Uf.addVectors(Rf.max,Nf.max),Rf.expandByPoint(Uf)):(Rf.expandByPoint(Nf.min),Rf.expandByPoint(Nf.max))}Rf.getCenter(or);let So=0;for(let Rn=0,To=C.count;Rn<To;Rn++)Uf.fromBufferAttribute(C,Rn),So=Math.max(So,or.distanceToSquared(Uf));if(Rn)for(let To=0,Ro=Rn.length;To<Ro;To++){const Ro=Rn[To],Uo=this.morphTargetsRelative;for(let Rn=0,To=Ro.count;Rn<To;Rn++)Uf.fromBufferAttribute(Ro,Rn),Uo&&(Df.fromBufferAttribute(C,Rn),Uf.add(Df)),So=Math.max(So,or.distanceToSquared(Uf))}this.boundingSphere.radius=Math.sqrt(So),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 C=this.index,Rn=this.attributes;if(null===C||void 0===Rn.position||void 0===Rn.normal||void 0===Rn.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const or=Rn.position,So=Rn.normal,To=Rn.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new BufferAttribute(new Float32Array(4*or.count),4));const Ro=this.getAttribute("tangent"),Uo=[],Oo=[];for(let eu=0;eu<or.count;eu++)Uo[eu]=new Vector3,Oo[eu]=new Vector3;const Ho=new Vector3,qo=new Vector3,dl=new Vector3,ml=new Vector2,fl=new Vector2,vl=new Vector2,bl=new Vector3,kl=new Vector3;function handleTriangle(C,Rn,So){Ho.fromBufferAttribute(or,C),qo.fromBufferAttribute(or,Rn),dl.fromBufferAttribute(or,So),ml.fromBufferAttribute(To,C),fl.fromBufferAttribute(To,Rn),vl.fromBufferAttribute(To,So),qo.sub(Ho),dl.sub(Ho),fl.sub(ml),vl.sub(ml);const Ro=1/(fl.x*vl.y-vl.x*fl.y);isFinite(Ro)&&(bl.copy(qo).multiplyScalar(vl.y).addScaledVector(dl,-fl.y).multiplyScalar(Ro),kl.copy(dl).multiplyScalar(fl.x).addScaledVector(qo,-vl.x).multiplyScalar(Ro),Uo[C].add(bl),Uo[Rn].add(bl),Uo[So].add(bl),Oo[C].add(kl),Oo[Rn].add(kl),Oo[So].add(kl))}let Ll=this.groups;0===Ll.length&&(Ll=[{start:0,count:C.count}]);for(let eu=0,Ku=Ll.length;eu<Ku;++eu){const Rn=Ll[eu],or=Rn.start;for(let So=or,To=or+Rn.count;So<To;So+=3)handleTriangle(C.getX(So+0),C.getX(So+1),C.getX(So+2))}const Dl=new Vector3,Nc=new Vector3,jc=new Vector3,Zc=new Vector3;function handleVertex(C){jc.fromBufferAttribute(So,C),Zc.copy(jc);const Rn=Uo[C];Dl.copy(Rn),Dl.sub(jc.multiplyScalar(jc.dot(Rn))).normalize(),Nc.crossVectors(Zc,Rn);const or=Nc.dot(Oo[C])<0?-1:1;Ro.setXYZW(C,Dl.x,Dl.y,Dl.z,or)}for(let eu=0,Ku=Ll.length;eu<Ku;++eu){const Rn=Ll[eu],or=Rn.start;for(let So=or,To=or+Rn.count;So<To;So+=3)handleVertex(C.getX(So+0)),handleVertex(C.getX(So+1)),handleVertex(C.getX(So+2))}}computeVertexNormals(){const C=this.index,Rn=this.getAttribute("position");if(void 0!==Rn){let or=this.getAttribute("normal");if(void 0===or)or=new BufferAttribute(new Float32Array(3*Rn.count),3),this.setAttribute("normal",or);else for(let C=0,Rn=or.count;C<Rn;C++)or.setXYZ(C,0,0,0);const So=new Vector3,To=new Vector3,Ro=new Vector3,Uo=new Vector3,Oo=new Vector3,Ho=new Vector3,qo=new Vector3,dl=new Vector3;if(C)for(let ml=0,fl=C.count;ml<fl;ml+=3){const fl=C.getX(ml+0),vl=C.getX(ml+1),bl=C.getX(ml+2);So.fromBufferAttribute(Rn,fl),To.fromBufferAttribute(Rn,vl),Ro.fromBufferAttribute(Rn,bl),qo.subVectors(Ro,To),dl.subVectors(So,To),qo.cross(dl),Uo.fromBufferAttribute(or,fl),Oo.fromBufferAttribute(or,vl),Ho.fromBufferAttribute(or,bl),Uo.add(qo),Oo.add(qo),Ho.add(qo),or.setXYZ(fl,Uo.x,Uo.y,Uo.z),or.setXYZ(vl,Oo.x,Oo.y,Oo.z),or.setXYZ(bl,Ho.x,Ho.y,Ho.z)}else for(let C=0,ml=Rn.count;C<ml;C+=3)So.fromBufferAttribute(Rn,C+0),To.fromBufferAttribute(Rn,C+1),Ro.fromBufferAttribute(Rn,C+2),qo.subVectors(Ro,To),dl.subVectors(So,To),qo.cross(dl),or.setXYZ(C+0,qo.x,qo.y,qo.z),or.setXYZ(C+1,qo.x,qo.y,qo.z),or.setXYZ(C+2,qo.x,qo.y,qo.z);this.normalizeNormals(),or.needsUpdate=!0}}normalizeNormals(){const C=this.attributes.normal;for(let Rn=0,or=C.count;Rn<or;Rn++)Uf.fromBufferAttribute(C,Rn),Uf.normalize(),C.setXYZ(Rn,Uf.x,Uf.y,Uf.z)}toNonIndexed(){function convertBufferAttribute(C,Rn){const or=C.array,So=C.itemSize,To=C.normalized,Ro=new or.constructor(Rn.length*So);let Uo=0,Oo=0;for(let Ho=0,qo=Rn.length;Ho<qo;Ho++){Uo=C.isInterleavedBufferAttribute?Rn[Ho]*C.data.stride+C.offset:Rn[Ho]*So;for(let C=0;C<So;C++)Ro[Oo++]=or[Uo++]}return new BufferAttribute(Ro,So,To)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const C=new BufferGeometry,Rn=this.index.array,or=this.attributes;for(const Ro in or){const So=convertBufferAttribute(or[Ro],Rn);C.setAttribute(Ro,So)}const So=this.morphAttributes;for(const Ro in So){const or=[],To=So[Ro];for(let C=0,So=To.length;C<So;C++){const So=convertBufferAttribute(To[C],Rn);or.push(So)}C.morphAttributes[Ro]=or}C.morphTargetsRelative=this.morphTargetsRelative;const To=this.groups;for(let Ro=0,Uo=To.length;Ro<Uo;Ro++){const Rn=To[Ro];C.addGroup(Rn.start,Rn.count,Rn.materialIndex)}return C}toJSON(){const C={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(C.uuid=this.uuid,C.type=this.type,""!==this.name&&(C.name=this.name),Object.keys(this.userData).length>0&&(C.userData=this.userData),void 0!==this.parameters){const Rn=this.parameters;for(const or in Rn)void 0!==Rn[or]&&(C[or]=Rn[or]);return C}C.data={attributes:{}};const Rn=this.index;null!==Rn&&(C.data.index={type:Rn.array.constructor.name,array:Array.prototype.slice.call(Rn.array)});const or=this.attributes;for(const Oo in or){const Rn=or[Oo];C.data.attributes[Oo]=Rn.toJSON(C.data)}const So={};let To=!1;for(const Oo in this.morphAttributes){const Rn=this.morphAttributes[Oo],or=[];for(let So=0,To=Rn.length;So<To;So++){const To=Rn[So];or.push(To.toJSON(C.data))}or.length>0&&(So[Oo]=or,To=!0)}To&&(C.data.morphAttributes=So,C.data.morphTargetsRelative=this.morphTargetsRelative);const Ro=this.groups;Ro.length>0&&(C.data.groups=JSON.parse(JSON.stringify(Ro)));const Uo=this.boundingSphere;return null!==Uo&&(C.data.boundingSphere={center:Uo.center.toArray(),radius:Uo.radius}),C}clone(){return(new this.constructor).copy(this)}copy(C){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const Rn={};this.name=C.name;const or=C.index;null!==or&&this.setIndex(or.clone(Rn));const So=C.attributes;for(const Ho in So){const C=So[Ho];this.setAttribute(Ho,C.clone(Rn))}const To=C.morphAttributes;for(const Ho in To){const C=[],or=To[Ho];for(let So=0,To=or.length;So<To;So++)C.push(or[So].clone(Rn));this.morphAttributes[Ho]=C}this.morphTargetsRelative=C.morphTargetsRelative;const Ro=C.groups;for(let Ho=0,qo=Ro.length;Ho<qo;Ho++){const C=Ro[Ho];this.addGroup(C.start,C.count,C.materialIndex)}const Uo=C.boundingBox;null!==Uo&&(this.boundingBox=Uo.clone());const Oo=C.boundingSphere;return null!==Oo&&(this.boundingSphere=Oo.clone()),this.drawRange.start=C.drawRange.start,this.drawRange.count=C.drawRange.count,this.userData=C.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Bf=new Matrix4,Ff=new Ray,Of=new Sphere,Vf=new Vector3,jf=new Vector3,Gf=new Vector3,Hf=new Vector3,Zf=new Vector3,Wf=new Vector3,qf=new Vector2,Kf=new Vector2,Qf=new Vector2,Xf=new Vector3,Yf=new Vector3,Jf=new Vector3,$f=new Vector3,eg=new Vector3;class Mesh extends Object3D{constructor(C,Rn){void 0===C&&(C=new BufferGeometry),void 0===Rn&&(Rn=new MeshBasicMaterial),super(),this.isMesh=!0,this.type="Mesh",this.geometry=C,this.material=Rn,this.updateMorphTargets()}copy(C,Rn){return super.copy(C,Rn),void 0!==C.morphTargetInfluences&&(this.morphTargetInfluences=C.morphTargetInfluences.slice()),void 0!==C.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},C.morphTargetDictionary)),this.material=Array.isArray(C.material)?C.material.slice():C.material,this.geometry=C.geometry,this}updateMorphTargets(){const C=this.geometry.morphAttributes,Rn=Object.keys(C);if(Rn.length>0){const or=C[Rn[0]];if(void 0!==or){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let C=0,Rn=or.length;C<Rn;C++){const Rn=or[C].name||String(C);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Rn]=C}}}}getVertexPosition(C,Rn){const or=this.geometry,So=or.attributes.position,To=or.morphAttributes.position,Ro=or.morphTargetsRelative;Rn.fromBufferAttribute(So,C);const Uo=this.morphTargetInfluences;if(To&&Uo){Wf.set(0,0,0);for(let or=0,So=To.length;or<So;or++){const So=Uo[or],Oo=To[or];0!==So&&(Zf.fromBufferAttribute(Oo,C),Ro?Wf.addScaledVector(Zf,So):Wf.addScaledVector(Zf.sub(Rn),So))}Rn.add(Wf)}return Rn}raycast(C,Rn){const or=this.geometry,So=this.material,To=this.matrixWorld;if(void 0!==So){if(null===or.boundingSphere&&or.computeBoundingSphere(),Of.copy(or.boundingSphere),Of.applyMatrix4(To),Ff.copy(C.ray).recast(C.near),!1===Of.containsPoint(Ff.origin)){if(null===Ff.intersectSphere(Of,Vf))return;if(Ff.origin.distanceToSquared(Vf)>(C.far-C.near)**2)return}Bf.copy(To).invert(),Ff.copy(C.ray).applyMatrix4(Bf),null!==or.boundingBox&&!1===Ff.intersectsBox(or.boundingBox)||this._computeIntersections(C,Rn,Ff)}}_computeIntersections(C,Rn,or){let So;const To=this.geometry,Ro=this.material,Uo=To.index,Oo=To.attributes.position,Ho=To.attributes.uv,qo=To.attributes.uv1,dl=To.attributes.normal,ml=To.groups,fl=To.drawRange;if(null!==Uo)if(Array.isArray(Ro))for(let vl=0,bl=ml.length;vl<bl;vl++){const To=ml[vl],Oo=Ro[To.materialIndex];for(let Ro=Math.max(To.start,fl.start),ml=Math.min(Uo.count,Math.min(To.start+To.count,fl.start+fl.count));Ro<ml;Ro+=3){So=checkGeometryIntersection(this,Oo,C,or,Ho,qo,dl,Uo.getX(Ro),Uo.getX(Ro+1),Uo.getX(Ro+2)),So&&(So.faceIndex=Math.floor(Ro/3),So.face.materialIndex=To.materialIndex,Rn.push(So))}}else{for(let To=Math.max(0,fl.start),Oo=Math.min(Uo.count,fl.start+fl.count);To<Oo;To+=3){So=checkGeometryIntersection(this,Ro,C,or,Ho,qo,dl,Uo.getX(To),Uo.getX(To+1),Uo.getX(To+2)),So&&(So.faceIndex=Math.floor(To/3),Rn.push(So))}}else if(void 0!==Oo)if(Array.isArray(Ro))for(let vl=0,bl=ml.length;vl<bl;vl++){const To=ml[vl],Uo=Ro[To.materialIndex];for(let Ro=Math.max(To.start,fl.start),ml=Math.min(Oo.count,Math.min(To.start+To.count,fl.start+fl.count));Ro<ml;Ro+=3){So=checkGeometryIntersection(this,Uo,C,or,Ho,qo,dl,Ro,Ro+1,Ro+2),So&&(So.faceIndex=Math.floor(Ro/3),So.face.materialIndex=To.materialIndex,Rn.push(So))}}else{for(let To=Math.max(0,fl.start),Uo=Math.min(Oo.count,fl.start+fl.count);To<Uo;To+=3){So=checkGeometryIntersection(this,Ro,C,or,Ho,qo,dl,To,To+1,To+2),So&&(So.faceIndex=Math.floor(To/3),Rn.push(So))}}}}function checkGeometryIntersection(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){C.getVertexPosition(Oo,jf),C.getVertexPosition(Ho,Gf),C.getVertexPosition(qo,Hf);const fl=function(C,Rn,or,So,To,Ro,Uo,Oo){let Ho;if(Ho=Rn.side===ml?So.intersectTriangle(Uo,Ro,To,!0,Oo):So.intersectTriangle(To,Ro,Uo,Rn.side===dl,Oo),null===Ho)return null;eg.copy(Oo),eg.applyMatrix4(C.matrixWorld);const qo=or.ray.origin.distanceTo(eg);return qo<or.near||qo>or.far?null:{distance:qo,point:eg.clone(),object:C}}(C,Rn,or,So,jf,Gf,Hf,$f);if(fl){To&&(qf.fromBufferAttribute(To,Oo),Kf.fromBufferAttribute(To,Ho),Qf.fromBufferAttribute(To,qo),fl.uv=Triangle.getInterpolation($f,jf,Gf,Hf,qf,Kf,Qf,new Vector2)),Ro&&(qf.fromBufferAttribute(Ro,Oo),Kf.fromBufferAttribute(Ro,Ho),Qf.fromBufferAttribute(Ro,qo),fl.uv1=Triangle.getInterpolation($f,jf,Gf,Hf,qf,Kf,Qf,new Vector2)),Uo&&(Xf.fromBufferAttribute(Uo,Oo),Yf.fromBufferAttribute(Uo,Ho),Jf.fromBufferAttribute(Uo,qo),fl.normal=Triangle.getInterpolation($f,jf,Gf,Hf,Xf,Yf,Jf,new Vector3),fl.normal.dot(So.direction)>0&&fl.normal.multiplyScalar(-1));const C={a:Oo,b:Ho,c:qo,normal:new Vector3,materialIndex:0};Triangle.getNormal(jf,Gf,Hf,C.normal),fl.face=C}return fl}class BoxGeometry extends BufferGeometry{constructor(C,Rn,or,So,To,Ro){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),void 0===To&&(To=1),void 0===Ro&&(Ro=1),super(),this.type="BoxGeometry",this.parameters={width:C,height:Rn,depth:or,widthSegments:So,heightSegments:To,depthSegments:Ro};const Uo=this;So=Math.floor(So),To=Math.floor(To),Ro=Math.floor(Ro);const Oo=[],Ho=[],qo=[],dl=[];let ml=0,fl=0;function buildPlane(C,Rn,or,So,To,Ro,vl,bl,kl,Ll,Dl){const Nc=Ro/kl,jc=vl/Ll,Zc=Ro/2,eu=vl/2,Ku=bl/2,Yu=kl+1,Eh=Ll+1;let Th=0,Ch=0;const Lh=new Vector3;for(let Uo=0;Uo<Eh;Uo++){const Ro=Uo*jc-eu;for(let Oo=0;Oo<Yu;Oo++){const ml=Oo*Nc-Zc;Lh[C]=ml*So,Lh[Rn]=Ro*To,Lh[or]=Ku,Ho.push(Lh.x,Lh.y,Lh.z),Lh[C]=0,Lh[Rn]=0,Lh[or]=bl>0?1:-1,qo.push(Lh.x,Lh.y,Lh.z),dl.push(Oo/kl),dl.push(1-Uo/Ll),Th+=1}}for(let Uo=0;Uo<Ll;Uo++)for(let C=0;C<kl;C++){const Rn=ml+C+Yu*Uo,or=ml+C+Yu*(Uo+1),So=ml+(C+1)+Yu*(Uo+1),To=ml+(C+1)+Yu*Uo;Oo.push(Rn,or,To),Oo.push(or,So,To),Ch+=6}Uo.addGroup(fl,Ch,Dl),fl+=Ch,ml+=Th}buildPlane("z","y","x",-1,-1,or,Rn,C,Ro,To,0),buildPlane("z","y","x",1,-1,or,Rn,-C,Ro,To,1),buildPlane("x","z","y",1,1,C,or,Rn,So,Ro,2),buildPlane("x","z","y",1,-1,C,or,-Rn,So,Ro,3),buildPlane("x","y","z",1,-1,C,Rn,or,So,To,4),buildPlane("x","y","z",-1,-1,C,Rn,-or,So,To,5),this.setIndex(Oo),this.setAttribute("position",new Float32BufferAttribute(Ho,3)),this.setAttribute("normal",new Float32BufferAttribute(qo,3)),this.setAttribute("uv",new Float32BufferAttribute(dl,2))}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}static fromJSON(C){return new BoxGeometry(C.width,C.height,C.depth,C.widthSegments,C.heightSegments,C.depthSegments)}}function cloneUniforms(C){const Rn={};for(const or in C){Rn[or]={};for(const So in C[or]){const To=C[or][So];To&&(To.isColor||To.isMatrix3||To.isMatrix4||To.isVector2||To.isVector3||To.isVector4||To.isTexture||To.isQuaternion)?To.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Rn[or][So]=null):Rn[or][So]=To.clone():Array.isArray(To)?Rn[or][So]=To.slice():Rn[or][So]=To}}return Rn}function mergeUniforms(C){const Rn={};for(let or=0;or<C.length;or++){const So=cloneUniforms(C[or]);for(const C in So)Rn[C]=So[C]}return Rn}function getUnlitUniformColorSpace(C){const Rn=C.getRenderTarget();return null===Rn?C.outputColorSpace:!0===Rn.isXRRenderTarget?Rn.texture.colorSpace:mm.workingColorSpace}const tg={clone:cloneUniforms,merge:mergeUniforms};class ShaderMaterial extends Material{constructor(C){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={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==C&&this.setValues(C)}copy(C){return super.copy(C),this.fragmentShader=C.fragmentShader,this.vertexShader=C.vertexShader,this.uniforms=cloneUniforms(C.uniforms),this.uniformsGroups=function(C){const Rn=[];for(let or=0;or<C.length;or++)Rn.push(C[or].clone());return Rn}(C.uniformsGroups),this.defines=Object.assign({},C.defines),this.wireframe=C.wireframe,this.wireframeLinewidth=C.wireframeLinewidth,this.fog=C.fog,this.lights=C.lights,this.clipping=C.clipping,this.extensions=Object.assign({},C.extensions),this.glslVersion=C.glslVersion,this}toJSON(C){const Rn=super.toJSON(C);Rn.glslVersion=this.glslVersion,Rn.uniforms={};for(const So in this.uniforms){const or=this.uniforms[So].value;or&&or.isTexture?Rn.uniforms[So]={type:"t",value:or.toJSON(C).uuid}:or&&or.isColor?Rn.uniforms[So]={type:"c",value:or.getHex()}:or&&or.isVector2?Rn.uniforms[So]={type:"v2",value:or.toArray()}:or&&or.isVector3?Rn.uniforms[So]={type:"v3",value:or.toArray()}:or&&or.isVector4?Rn.uniforms[So]={type:"v4",value:or.toArray()}:or&&or.isMatrix3?Rn.uniforms[So]={type:"m3",value:or.toArray()}:or&&or.isMatrix4?Rn.uniforms[So]={type:"m4",value:or.toArray()}:Rn.uniforms[So]={value:or}}Object.keys(this.defines).length>0&&(Rn.defines=this.defines),Rn.vertexShader=this.vertexShader,Rn.fragmentShader=this.fragmentShader,Rn.lights=this.lights,Rn.clipping=this.clipping;const or={};for(const So in this.extensions)!0===this.extensions[So]&&(or[So]=!0);return Object.keys(or).length>0&&(Rn.extensions=or),Rn}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4,this.coordinateSystem=tm}copy(C,Rn){return super.copy(C,Rn),this.matrixWorldInverse.copy(C.matrixWorldInverse),this.projectionMatrix.copy(C.projectionMatrix),this.projectionMatrixInverse.copy(C.projectionMatrixInverse),this.coordinateSystem=C.coordinateSystem,this}getWorldDirection(C){return super.getWorldDirection(C).negate()}updateMatrixWorld(C){super.updateMatrixWorld(C),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(C,Rn){super.updateWorldMatrix(C,Rn),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const ig=new Vector3,ng=new Vector2,rg=new Vector2;class PerspectiveCamera extends Camera{constructor(C,Rn,or,So){void 0===C&&(C=50),void 0===Rn&&(Rn=1),void 0===or&&(or=.1),void 0===So&&(So=2e3),super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=C,this.zoom=1,this.near=or,this.far=So,this.focus=10,this.aspect=Rn,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(C,Rn){return super.copy(C,Rn),this.fov=C.fov,this.zoom=C.zoom,this.near=C.near,this.far=C.far,this.focus=C.focus,this.aspect=C.aspect,this.view=null===C.view?null:Object.assign({},C.view),this.filmGauge=C.filmGauge,this.filmOffset=C.filmOffset,this}setFocalLength(C){const Rn=.5*this.getFilmHeight()/C;this.fov=2*sm*Math.atan(Rn),this.updateProjectionMatrix()}getFocalLength(){const C=Math.tan(.5*am*this.fov);return.5*this.getFilmHeight()/C}getEffectiveFOV(){return 2*sm*Math.atan(Math.tan(.5*am*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(C,Rn,or){ig.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),Rn.set(ig.x,ig.y).multiplyScalar(-C/ig.z),ig.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),or.set(ig.x,ig.y).multiplyScalar(-C/ig.z)}getViewSize(C,Rn){return this.getViewBounds(C,ng,rg),Rn.subVectors(rg,ng)}setViewOffset(C,Rn,or,So,To,Ro){this.aspect=C/Rn,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=C,this.view.fullHeight=Rn,this.view.offsetX=or,this.view.offsetY=So,this.view.width=To,this.view.height=Ro,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const C=this.near;let Rn=C*Math.tan(.5*am*this.fov)/this.zoom,or=2*Rn,So=this.aspect*or,To=-.5*So;const Ro=this.view;if(null!==this.view&&this.view.enabled){const C=Ro.fullWidth,Uo=Ro.fullHeight;To+=Ro.offsetX*So/C,Rn-=Ro.offsetY*or/Uo,So*=Ro.width/C,or*=Ro.height/Uo}const Uo=this.filmOffset;0!==Uo&&(To+=C*Uo/this.getFilmWidth()),this.projectionMatrix.makePerspective(To,To+So,Rn,Rn-or,C,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(C){const Rn=super.toJSON(C);return Rn.object.fov=this.fov,Rn.object.zoom=this.zoom,Rn.object.near=this.near,Rn.object.far=this.far,Rn.object.focus=this.focus,Rn.object.aspect=this.aspect,null!==this.view&&(Rn.object.view=Object.assign({},this.view)),Rn.object.filmGauge=this.filmGauge,Rn.object.filmOffset=this.filmOffset,Rn}}const ag=-90;class CubeCamera extends Object3D{constructor(C,Rn,or){super(),this.type="CubeCamera",this.renderTarget=or,this.coordinateSystem=null,this.activeMipmapLevel=0;const So=new PerspectiveCamera(ag,1,C,Rn);So.layers=this.layers,this.add(So);const To=new PerspectiveCamera(ag,1,C,Rn);To.layers=this.layers,this.add(To);const Ro=new PerspectiveCamera(ag,1,C,Rn);Ro.layers=this.layers,this.add(Ro);const Uo=new PerspectiveCamera(ag,1,C,Rn);Uo.layers=this.layers,this.add(Uo);const Oo=new PerspectiveCamera(ag,1,C,Rn);Oo.layers=this.layers,this.add(Oo);const Ho=new PerspectiveCamera(ag,1,C,Rn);Ho.layers=this.layers,this.add(Ho)}updateCoordinateSystem(){const C=this.coordinateSystem,Rn=this.children.concat(),[or,So,To,Ro,Uo,Oo]=Rn;for(const Ho of Rn)this.remove(Ho);if(C===tm)or.up.set(0,1,0),or.lookAt(1,0,0),So.up.set(0,1,0),So.lookAt(-1,0,0),To.up.set(0,0,-1),To.lookAt(0,1,0),Ro.up.set(0,0,1),Ro.lookAt(0,-1,0),Uo.up.set(0,1,0),Uo.lookAt(0,0,1),Oo.up.set(0,1,0),Oo.lookAt(0,0,-1);else{if(C!==im)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+C);or.up.set(0,-1,0),or.lookAt(-1,0,0),So.up.set(0,-1,0),So.lookAt(1,0,0),To.up.set(0,0,1),To.lookAt(0,1,0),Ro.up.set(0,0,-1),Ro.lookAt(0,-1,0),Uo.up.set(0,-1,0),Uo.lookAt(0,0,1),Oo.up.set(0,-1,0),Oo.lookAt(0,0,-1)}for(const Ho of Rn)this.add(Ho),Ho.updateMatrixWorld()}update(C,Rn){null===this.parent&&this.updateMatrixWorld();const{renderTarget:or,activeMipmapLevel:So}=this;this.coordinateSystem!==C.coordinateSystem&&(this.coordinateSystem=C.coordinateSystem,this.updateCoordinateSystem());const[To,Ro,Uo,Oo,Ho,qo]=this.children,dl=C.getRenderTarget(),ml=C.getActiveCubeFace(),fl=C.getActiveMipmapLevel(),vl=C.xr.enabled;C.xr.enabled=!1;const bl=or.texture.generateMipmaps;or.texture.generateMipmaps=!1,C.setRenderTarget(or,0,So),C.render(Rn,To),C.setRenderTarget(or,1,So),C.render(Rn,Ro),C.setRenderTarget(or,2,So),C.render(Rn,Uo),C.setRenderTarget(or,3,So),C.render(Rn,Oo),C.setRenderTarget(or,4,So),C.render(Rn,Ho),or.texture.generateMipmaps=bl,C.setRenderTarget(or,5,So),C.render(Rn,qo),C.setRenderTarget(dl,ml,fl),C.xr.enabled=vl,or.texture.needsPMREMUpdate=!0}}class CubeTexture extends Texture{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){super(C=void 0!==C?C:[],Rn=void 0!==Rn?Rn:ud,or,So,To,Ro,Uo,Oo,Ho,qo),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(C){this.image=C}}class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(C,Rn){void 0===C&&(C=1),void 0===Rn&&(Rn={}),super(C,C,Rn),this.isWebGLCubeRenderTarget=!0;const or={width:C,height:C,depth:1},So=[or,or,or,or,or,or];this.texture=new CubeTexture(So,Rn.mapping,Rn.wrapS,Rn.wrapT,Rn.magFilter,Rn.minFilter,Rn.format,Rn.type,Rn.anisotropy,Rn.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==Rn.generateMipmaps&&Rn.generateMipmaps,this.texture.minFilter=void 0!==Rn.minFilter?Rn.minFilter:_d}fromEquirectangularTexture(C,Rn){this.texture.type=Rn.type,this.texture.colorSpace=Rn.colorSpace,this.texture.generateMipmaps=Rn.generateMipmaps,this.texture.minFilter=Rn.minFilter,this.texture.magFilter=Rn.magFilter;const or={tEquirect:{value:null}},So="\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",To="\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",Ro=new BoxGeometry(5,5,5),Uo=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(or),vertexShader:So,fragmentShader:To,side:ml,blending:vl});Uo.uniforms.tEquirect.value=Rn;const Oo=new Mesh(Ro,Uo),Ho=Rn.minFilter;Rn.minFilter===wd&&(Rn.minFilter=_d);return new CubeCamera(1,10,this).update(C,Oo),Rn.minFilter=Ho,Oo.geometry.dispose(),Oo.material.dispose(),this}clear(C,Rn,or,So){const To=C.getRenderTarget();for(let Ro=0;Ro<6;Ro++)C.setRenderTarget(this,Ro),C.clear(Rn,or,So);C.setRenderTarget(To)}}const sg=new Vector3,og=new Vector3,lg=new Matrix3;class Plane{constructor(C,Rn){void 0===C&&(C=new Vector3(1,0,0)),void 0===Rn&&(Rn=0),this.isPlane=!0,this.normal=C,this.constant=Rn}set(C,Rn){return this.normal.copy(C),this.constant=Rn,this}setComponents(C,Rn,or,So){return this.normal.set(C,Rn,or),this.constant=So,this}setFromNormalAndCoplanarPoint(C,Rn){return this.normal.copy(C),this.constant=-Rn.dot(this.normal),this}setFromCoplanarPoints(C,Rn,or){const So=sg.subVectors(or,Rn).cross(og.subVectors(C,Rn)).normalize();return this.setFromNormalAndCoplanarPoint(So,C),this}copy(C){return this.normal.copy(C.normal),this.constant=C.constant,this}normalize(){const C=1/this.normal.length();return this.normal.multiplyScalar(C),this.constant*=C,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(C){return this.normal.dot(C)+this.constant}distanceToSphere(C){return this.distanceToPoint(C.center)-C.radius}projectPoint(C,Rn){return Rn.copy(C).addScaledVector(this.normal,-this.distanceToPoint(C))}intersectLine(C,Rn){const or=C.delta(sg),So=this.normal.dot(or);if(0===So)return 0===this.distanceToPoint(C.start)?Rn.copy(C.start):null;const To=-(C.start.dot(this.normal)+this.constant)/So;return To<0||To>1?null:Rn.copy(C.start).addScaledVector(or,To)}intersectsLine(C){const Rn=this.distanceToPoint(C.start),or=this.distanceToPoint(C.end);return Rn<0&&or>0||or<0&&Rn>0}intersectsBox(C){return C.intersectsPlane(this)}intersectsSphere(C){return C.intersectsPlane(this)}coplanarPoint(C){return C.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(C,Rn){const or=Rn||lg.getNormalMatrix(C),So=this.coplanarPoint(sg).applyMatrix4(C),To=this.normal.applyMatrix3(or).normalize();return this.constant=-So.dot(To),this}translate(C){return this.constant-=C.dot(this.normal),this}equals(C){return C.normal.equals(this.normal)&&C.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const cg=new Sphere,ug=new Vector3;class Frustum{constructor(C,Rn,or,So,To,Ro){void 0===C&&(C=new Plane),void 0===Rn&&(Rn=new Plane),void 0===or&&(or=new Plane),void 0===So&&(So=new Plane),void 0===To&&(To=new Plane),void 0===Ro&&(Ro=new Plane),this.planes=[C,Rn,or,So,To,Ro]}set(C,Rn,or,So,To,Ro){const Uo=this.planes;return Uo[0].copy(C),Uo[1].copy(Rn),Uo[2].copy(or),Uo[3].copy(So),Uo[4].copy(To),Uo[5].copy(Ro),this}copy(C){const Rn=this.planes;for(let or=0;or<6;or++)Rn[or].copy(C.planes[or]);return this}setFromProjectionMatrix(C,Rn){void 0===Rn&&(Rn=tm);const or=this.planes,So=C.elements,To=So[0],Ro=So[1],Uo=So[2],Oo=So[3],Ho=So[4],qo=So[5],dl=So[6],ml=So[7],fl=So[8],vl=So[9],bl=So[10],kl=So[11],Ll=So[12],Dl=So[13],Nc=So[14],jc=So[15];if(or[0].setComponents(Oo-To,ml-Ho,kl-fl,jc-Ll).normalize(),or[1].setComponents(Oo+To,ml+Ho,kl+fl,jc+Ll).normalize(),or[2].setComponents(Oo+Ro,ml+qo,kl+vl,jc+Dl).normalize(),or[3].setComponents(Oo-Ro,ml-qo,kl-vl,jc-Dl).normalize(),or[4].setComponents(Oo-Uo,ml-dl,kl-bl,jc-Nc).normalize(),Rn===tm)or[5].setComponents(Oo+Uo,ml+dl,kl+bl,jc+Nc).normalize();else{if(Rn!==im)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+Rn);or[5].setComponents(Uo,dl,bl,Nc).normalize()}return this}intersectsObject(C){if(void 0!==C.boundingSphere)null===C.boundingSphere&&C.computeBoundingSphere(),cg.copy(C.boundingSphere).applyMatrix4(C.matrixWorld);else{const Rn=C.geometry;null===Rn.boundingSphere&&Rn.computeBoundingSphere(),cg.copy(Rn.boundingSphere).applyMatrix4(C.matrixWorld)}return this.intersectsSphere(cg)}intersectsSprite(C){return cg.center.set(0,0,0),cg.radius=.7071067811865476,cg.applyMatrix4(C.matrixWorld),this.intersectsSphere(cg)}intersectsSphere(C){const Rn=this.planes,or=C.center,So=-C.radius;for(let To=0;To<6;To++){if(Rn[To].distanceToPoint(or)<So)return!1}return!0}intersectsBox(C){const Rn=this.planes;for(let or=0;or<6;or++){const So=Rn[or];if(ug.x=So.normal.x>0?C.max.x:C.min.x,ug.y=So.normal.y>0?C.max.y:C.min.y,ug.z=So.normal.z>0?C.max.z:C.min.z,So.distanceToPoint(ug)<0)return!1}return!0}containsPoint(C){const Rn=this.planes;for(let or=0;or<6;or++)if(Rn[or].distanceToPoint(C)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function WebGLAnimation(){let C=null,Rn=!1,or=null,So=null;function onAnimationFrame(Rn,To){or(Rn,To),So=C.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==Rn&&null!==or&&(So=C.requestAnimationFrame(onAnimationFrame),Rn=!0)},stop:function(){C.cancelAnimationFrame(So),Rn=!1},setAnimationLoop:function(C){or=C},setContext:function(Rn){C=Rn}}}function WebGLAttributes(C){const Rn=new WeakMap;return{get:function(C){return C.isInterleavedBufferAttribute&&(C=C.data),Rn.get(C)},remove:function(or){or.isInterleavedBufferAttribute&&(or=or.data);const So=Rn.get(or);So&&(C.deleteBuffer(So.buffer),Rn.delete(or))},update:function(or,So){if(or.isInterleavedBufferAttribute&&(or=or.data),or.isGLBufferAttribute){const C=Rn.get(or);return void((!C||C.version<or.version)&&Rn.set(or,{buffer:or.buffer,type:or.type,bytesPerElement:or.elementSize,version:or.version}))}const To=Rn.get(or);if(void 0===To)Rn.set(or,function(Rn,or){const So=Rn.array,To=Rn.usage,Ro=So.byteLength,Uo=C.createBuffer();let Oo;if(C.bindBuffer(or,Uo),C.bufferData(or,So,To),Rn.onUploadCallback(),So instanceof Float32Array)Oo=C.FLOAT;else if(So instanceof Uint16Array)Oo=Rn.isFloat16BufferAttribute?C.HALF_FLOAT:C.UNSIGNED_SHORT;else if(So instanceof Int16Array)Oo=C.SHORT;else if(So instanceof Uint32Array)Oo=C.UNSIGNED_INT;else if(So instanceof Int32Array)Oo=C.INT;else if(So instanceof Int8Array)Oo=C.BYTE;else if(So instanceof Uint8Array)Oo=C.UNSIGNED_BYTE;else{if(!(So instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+So);Oo=C.UNSIGNED_BYTE}return{buffer:Uo,type:Oo,bytesPerElement:So.BYTES_PER_ELEMENT,version:Rn.version,size:Ro}}(or,So));else if(To.version<or.version){if(To.size!==or.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(Rn,or,So){const To=or.array,Ro=or._updateRange,Uo=or.updateRanges;if(C.bindBuffer(So,Rn),-1===Ro.count&&0===Uo.length&&C.bufferSubData(So,0,To),0!==Uo.length){for(let Rn=0,or=Uo.length;Rn<or;Rn++){const or=Uo[Rn];C.bufferSubData(So,or.start*To.BYTES_PER_ELEMENT,To,or.start,or.count)}or.clearUpdateRanges()}-1!==Ro.count&&(C.bufferSubData(So,Ro.offset*To.BYTES_PER_ELEMENT,To,Ro.offset,Ro.count),Ro.count=-1),or.onUploadCallback()}(To.buffer,or,So),To.version=or.version}}}}class PlaneGeometry extends BufferGeometry{constructor(C,Rn,or,So){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),super(),this.type="PlaneGeometry",this.parameters={width:C,height:Rn,widthSegments:or,heightSegments:So};const To=C/2,Ro=Rn/2,Uo=Math.floor(or),Oo=Math.floor(So),Ho=Uo+1,qo=Oo+1,dl=C/Uo,ml=Rn/Oo,fl=[],vl=[],bl=[],kl=[];for(let Ll=0;Ll<qo;Ll++){const C=Ll*ml-Ro;for(let Rn=0;Rn<Ho;Rn++){const or=Rn*dl-To;vl.push(or,-C,0),bl.push(0,0,1),kl.push(Rn/Uo),kl.push(1-Ll/Oo)}}for(let Ll=0;Ll<Oo;Ll++)for(let C=0;C<Uo;C++){const Rn=C+Ho*Ll,or=C+Ho*(Ll+1),So=C+1+Ho*(Ll+1),To=C+1+Ho*Ll;fl.push(Rn,or,To),fl.push(or,So,To)}this.setIndex(fl),this.setAttribute("position",new Float32BufferAttribute(vl,3)),this.setAttribute("normal",new Float32BufferAttribute(bl,3)),this.setAttribute("uv",new Float32BufferAttribute(kl,2))}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}static fromJSON(C){return new PlaneGeometry(C.width,C.height,C.widthSegments,C.heightSegments)}}const hg={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\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\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\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\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\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\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#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\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 ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.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}\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_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\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}",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, envMapRotation * 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\tuniform mat3 envMapRotation;\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, envMapRotation * 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, envMapRotation * 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_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\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\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_DISPERSION\n\tmaterial.dispersion = dispersion;\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\tfloat dispersion;\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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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 )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\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",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\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\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\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.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in 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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, 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 mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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 CineonToneMapping( 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}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\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.dispersion, 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 dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\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;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * 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#include <morphinstance_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\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\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#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\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#include <morphinstance_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\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\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 ), diffuseColor.a );\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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_DISPERSION\n\tuniform float dispersion;\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\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}"},dg={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Matrix3},normalScale:{value:new Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}}},pg={basic:{uniforms:mergeUniforms([dg.common,dg.specularmap,dg.envmap,dg.aomap,dg.lightmap,dg.fog]),vertexShader:hg.meshbasic_vert,fragmentShader:hg.meshbasic_frag},lambert:{uniforms:mergeUniforms([dg.common,dg.specularmap,dg.envmap,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.fog,dg.lights,{emissive:{value:new Color(0)}}]),vertexShader:hg.meshlambert_vert,fragmentShader:hg.meshlambert_frag},phong:{uniforms:mergeUniforms([dg.common,dg.specularmap,dg.envmap,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.fog,dg.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:hg.meshphong_vert,fragmentShader:hg.meshphong_frag},standard:{uniforms:mergeUniforms([dg.common,dg.envmap,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.roughnessmap,dg.metalnessmap,dg.fog,dg.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hg.meshphysical_vert,fragmentShader:hg.meshphysical_frag},toon:{uniforms:mergeUniforms([dg.common,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.gradientmap,dg.fog,dg.lights,{emissive:{value:new Color(0)}}]),vertexShader:hg.meshtoon_vert,fragmentShader:hg.meshtoon_frag},matcap:{uniforms:mergeUniforms([dg.common,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.fog,{matcap:{value:null}}]),vertexShader:hg.meshmatcap_vert,fragmentShader:hg.meshmatcap_frag},points:{uniforms:mergeUniforms([dg.points,dg.fog]),vertexShader:hg.points_vert,fragmentShader:hg.points_frag},dashed:{uniforms:mergeUniforms([dg.common,dg.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hg.linedashed_vert,fragmentShader:hg.linedashed_frag},depth:{uniforms:mergeUniforms([dg.common,dg.displacementmap]),vertexShader:hg.depth_vert,fragmentShader:hg.depth_frag},normal:{uniforms:mergeUniforms([dg.common,dg.bumpmap,dg.normalmap,dg.displacementmap,{opacity:{value:1}}]),vertexShader:hg.meshnormal_vert,fragmentShader:hg.meshnormal_frag},sprite:{uniforms:mergeUniforms([dg.sprite,dg.fog]),vertexShader:hg.sprite_vert,fragmentShader:hg.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hg.background_vert,fragmentShader:hg.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Matrix3}},vertexShader:hg.backgroundCube_vert,fragmentShader:hg.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hg.cube_vert,fragmentShader:hg.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hg.equirect_vert,fragmentShader:hg.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([dg.common,dg.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hg.distanceRGBA_vert,fragmentShader:hg.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([dg.lights,dg.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:hg.shadow_vert,fragmentShader:hg.shadow_frag}};pg.physical={uniforms:mergeUniforms([pg.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Matrix3},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Matrix3},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Matrix3},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Matrix3},anisotropyVector:{value:new Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Matrix3}}]),vertexShader:hg.meshphysical_vert,fragmentShader:hg.meshphysical_frag};const mg={r:0,b:0,g:0},fg=new Euler,gg=new Matrix4;function WebGLBackground(C,Rn,or,So,To,Ro,Uo){const Oo=new Color(0);let Ho,qo,fl=!0===Ro?0:1,vl=null,bl=0,kl=null;function getBackground(C){let So=!0===C.isScene?C.background:null;if(So&&So.isTexture){So=(C.backgroundBlurriness>0?or:Rn).get(So)}return So}function setClear(Rn,or){Rn.getRGB(mg,getUnlitUniformColorSpace(C)),So.buffers.color.setClear(mg.r,mg.g,mg.b,or,Uo)}return{getClearColor:function(){return Oo},setClearColor:function(C,Rn){void 0===Rn&&(Rn=1),Oo.set(C),fl=Rn,setClear(Oo,fl)},getClearAlpha:function(){return fl},setClearAlpha:function(C){fl=C,setClear(Oo,fl)},render:function(Rn){let or=!1;const To=getBackground(Rn);null===To?setClear(Oo,fl):To&&To.isColor&&(setClear(To,1),or=!0);const Ro=C.xr.getEnvironmentBlendMode();"additive"===Ro?So.buffers.color.setClear(0,0,0,1,Uo):"alpha-blend"===Ro&&So.buffers.color.setClear(0,0,0,0,Uo),(C.autoClear||or)&&(So.buffers.depth.setTest(!0),So.buffers.depth.setMask(!0),So.buffers.color.setMask(!0),C.clear(C.autoClearColor,C.autoClearDepth,C.autoClearStencil))},addToRenderList:function(Rn,or){const So=getBackground(or);So&&(So.isCubeTexture||So.mapping===md)?(void 0===qo&&(qo=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(pg.backgroundCube.uniforms),vertexShader:pg.backgroundCube.vertexShader,fragmentShader:pg.backgroundCube.fragmentShader,side:ml,depthTest:!1,depthWrite:!1,fog:!1})),qo.geometry.deleteAttribute("normal"),qo.geometry.deleteAttribute("uv"),qo.onBeforeRender=function(C,Rn,or){this.matrixWorld.copyPosition(or.matrixWorld)},Object.defineProperty(qo.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),To.update(qo)),fg.copy(or.backgroundRotation),fg.x*=-1,fg.y*=-1,fg.z*=-1,So.isCubeTexture&&!1===So.isRenderTargetTexture&&(fg.y*=-1,fg.z*=-1),qo.material.uniforms.envMap.value=So,qo.material.uniforms.flipEnvMap.value=So.isCubeTexture&&!1===So.isRenderTargetTexture?-1:1,qo.material.uniforms.backgroundBlurriness.value=or.backgroundBlurriness,qo.material.uniforms.backgroundIntensity.value=or.backgroundIntensity,qo.material.uniforms.backgroundRotation.value.setFromMatrix4(gg.makeRotationFromEuler(fg)),qo.material.toneMapped=mm.getTransfer(So.colorSpace)!==Vp,vl===So&&bl===So.version&&kl===C.toneMapping||(qo.material.needsUpdate=!0,vl=So,bl=So.version,kl=C.toneMapping),qo.layers.enableAll(),Rn.unshift(qo,qo.geometry,qo.material,0,0,null)):So&&So.isTexture&&(void 0===Ho&&(Ho=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(pg.background.uniforms),vertexShader:pg.background.vertexShader,fragmentShader:pg.background.fragmentShader,side:dl,depthTest:!1,depthWrite:!1,fog:!1})),Ho.geometry.deleteAttribute("normal"),Object.defineProperty(Ho.material,"map",{get:function(){return this.uniforms.t2D.value}}),To.update(Ho)),Ho.material.uniforms.t2D.value=So,Ho.material.uniforms.backgroundIntensity.value=or.backgroundIntensity,Ho.material.toneMapped=mm.getTransfer(So.colorSpace)!==Vp,!0===So.matrixAutoUpdate&&So.updateMatrix(),Ho.material.uniforms.uvTransform.value.copy(So.matrix),vl===So&&bl===So.version&&kl===C.toneMapping||(Ho.material.needsUpdate=!0,vl=So,bl=So.version,kl=C.toneMapping),Ho.layers.enableAll(),Rn.unshift(Ho,Ho.geometry,Ho.material,0,0,null))}}}function WebGLBindingStates(C,Rn){const or=C.getParameter(C.MAX_VERTEX_ATTRIBS),So={},To=createBindingState(null);let Ro=To,Uo=!1;function bindVertexArrayObject(Rn){return C.bindVertexArray(Rn)}function deleteVertexArrayObject(Rn){return C.deleteVertexArray(Rn)}function createBindingState(C){const Rn=[],So=[],To=[];for(let Ro=0;Ro<or;Ro++)Rn[Ro]=0,So[Ro]=0,To[Ro]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Rn,enabledAttributes:So,attributeDivisors:To,object:C,attributes:{},index:null}}function initAttributes(){const C=Ro.newAttributes;for(let Rn=0,or=C.length;Rn<or;Rn++)C[Rn]=0}function enableAttribute(C){enableAttributeAndDivisor(C,0)}function enableAttributeAndDivisor(Rn,or){const So=Ro.newAttributes,To=Ro.enabledAttributes,Uo=Ro.attributeDivisors;So[Rn]=1,0===To[Rn]&&(C.enableVertexAttribArray(Rn),To[Rn]=1),Uo[Rn]!==or&&(C.vertexAttribDivisor(Rn,or),Uo[Rn]=or)}function disableUnusedAttributes(){const Rn=Ro.newAttributes,or=Ro.enabledAttributes;for(let So=0,To=or.length;So<To;So++)or[So]!==Rn[So]&&(C.disableVertexAttribArray(So),or[So]=0)}function vertexAttribPointer(Rn,or,So,To,Ro,Uo,Oo){!0===Oo?C.vertexAttribIPointer(Rn,or,So,Ro,Uo):C.vertexAttribPointer(Rn,or,So,To,Ro,Uo)}function reset(){resetDefaultState(),Uo=!0,Ro!==To&&(Ro=To,bindVertexArrayObject(Ro.object))}function resetDefaultState(){To.geometry=null,To.program=null,To.wireframe=!1}return{setup:function(or,To,Oo,Ho,qo){let dl=!1;const ml=function(Rn,or,To){const Ro=!0===To.wireframe;let Uo=So[Rn.id];void 0===Uo&&(Uo={},So[Rn.id]=Uo);let Oo=Uo[or.id];void 0===Oo&&(Oo={},Uo[or.id]=Oo);let Ho=Oo[Ro];void 0===Ho&&(Ho=createBindingState(C.createVertexArray()),Oo[Ro]=Ho);return Ho}(Ho,Oo,To);Ro!==ml&&(Ro=ml,bindVertexArrayObject(Ro.object)),dl=function(C,Rn,or,So){const To=Ro.attributes,Uo=Rn.attributes;let Oo=0;const Ho=or.getAttributes();for(const Ro in Ho){if(Ho[Ro].location>=0){const Rn=To[Ro];let or=Uo[Ro];if(void 0===or&&("instanceMatrix"===Ro&&C.instanceMatrix&&(or=C.instanceMatrix),"instanceColor"===Ro&&C.instanceColor&&(or=C.instanceColor)),void 0===Rn)return!0;if(Rn.attribute!==or)return!0;if(or&&Rn.data!==or.data)return!0;Oo++}}return Ro.attributesNum!==Oo||Ro.index!==So}(or,Ho,Oo,qo),dl&&function(C,Rn,or,So){const To={},Uo=Rn.attributes;let Oo=0;const Ho=or.getAttributes();for(const Ro in Ho){if(Ho[Ro].location>=0){let Rn=Uo[Ro];void 0===Rn&&("instanceMatrix"===Ro&&C.instanceMatrix&&(Rn=C.instanceMatrix),"instanceColor"===Ro&&C.instanceColor&&(Rn=C.instanceColor));const or={};or.attribute=Rn,Rn&&Rn.data&&(or.data=Rn.data),To[Ro]=or,Oo++}}Ro.attributes=To,Ro.attributesNum=Oo,Ro.index=So}(or,Ho,Oo,qo),null!==qo&&Rn.update(qo,C.ELEMENT_ARRAY_BUFFER),(dl||Uo)&&(Uo=!1,function(or,So,To,Ro){initAttributes();const Uo=Ro.attributes,Oo=To.getAttributes(),Ho=So.defaultAttributeValues;for(const qo in Oo){const So=Oo[qo];if(So.location>=0){let To=Uo[qo];if(void 0===To&&("instanceMatrix"===qo&&or.instanceMatrix&&(To=or.instanceMatrix),"instanceColor"===qo&&or.instanceColor&&(To=or.instanceColor)),void 0!==To){const Uo=To.normalized,Oo=To.itemSize,Ho=Rn.get(To);if(void 0===Ho)continue;const qo=Ho.buffer,dl=Ho.type,ml=Ho.bytesPerElement,fl=dl===C.INT||dl===C.UNSIGNED_INT||To.gpuType===Td;if(To.isInterleavedBufferAttribute){const Rn=To.data,Ho=Rn.stride,vl=To.offset;if(Rn.isInstancedInterleavedBuffer){for(let C=0;C<So.locationSize;C++)enableAttributeAndDivisor(So.location+C,Rn.meshPerAttribute);!0!==or.isInstancedMesh&&void 0===Ro._maxInstanceCount&&(Ro._maxInstanceCount=Rn.meshPerAttribute*Rn.count)}else for(let C=0;C<So.locationSize;C++)enableAttribute(So.location+C);C.bindBuffer(C.ARRAY_BUFFER,qo);for(let C=0;C<So.locationSize;C++)vertexAttribPointer(So.location+C,Oo/So.locationSize,dl,Uo,Ho*ml,(vl+Oo/So.locationSize*C)*ml,fl)}else{if(To.isInstancedBufferAttribute){for(let C=0;C<So.locationSize;C++)enableAttributeAndDivisor(So.location+C,To.meshPerAttribute);!0!==or.isInstancedMesh&&void 0===Ro._maxInstanceCount&&(Ro._maxInstanceCount=To.meshPerAttribute*To.count)}else for(let C=0;C<So.locationSize;C++)enableAttribute(So.location+C);C.bindBuffer(C.ARRAY_BUFFER,qo);for(let C=0;C<So.locationSize;C++)vertexAttribPointer(So.location+C,Oo/So.locationSize,dl,Uo,Oo*ml,Oo/So.locationSize*C*ml,fl)}}else if(void 0!==Ho){const Rn=Ho[qo];if(void 0!==Rn)switch(Rn.length){case 2:C.vertexAttrib2fv(So.location,Rn);break;case 3:C.vertexAttrib3fv(So.location,Rn);break;case 4:C.vertexAttrib4fv(So.location,Rn);break;default:C.vertexAttrib1fv(So.location,Rn)}}}}disableUnusedAttributes()}(or,To,Oo,Ho),null!==qo&&C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,Rn.get(qo).buffer))},reset:reset,resetDefaultState:resetDefaultState,dispose:function(){reset();for(const C in So){const Rn=So[C];for(const C in Rn){const or=Rn[C];for(const C in or)deleteVertexArrayObject(or[C].object),delete or[C];delete Rn[C]}delete So[C]}},releaseStatesOfGeometry:function(C){if(void 0===So[C.id])return;const Rn=So[C.id];for(const or in Rn){const C=Rn[or];for(const Rn in C)deleteVertexArrayObject(C[Rn].object),delete C[Rn];delete Rn[or]}delete So[C.id]},releaseStatesOfProgram:function(C){for(const Rn in So){const or=So[Rn];if(void 0===or[C.id])continue;const To=or[C.id];for(const C in To)deleteVertexArrayObject(To[C].object),delete To[C];delete or[C.id]}},initAttributes:initAttributes,enableAttribute:enableAttribute,disableUnusedAttributes:disableUnusedAttributes}}function WebGLBufferRenderer(C,Rn,or){let So;function renderInstances(Rn,To,Ro){0!==Ro&&(C.drawArraysInstanced(So,Rn,To,Ro),or.update(To,So,Ro))}this.setMode=function(C){So=C},this.render=function(Rn,To){C.drawArrays(So,Rn,To),or.update(To,So,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function(C,To,Ro){if(0===Ro)return;Rn.get("WEBGL_multi_draw").multiDrawArraysWEBGL(So,C,0,To,0,Ro);let Uo=0;for(let Rn=0;Rn<Ro;Rn++)Uo+=To[Rn];or.update(Uo,So,1)},this.renderMultiDrawInstances=function(C,To,Ro,Uo){if(0===Ro)return;const Oo=Rn.get("WEBGL_multi_draw");if(null===Oo)for(let Rn=0;Rn<C.length;Rn++)renderInstances(C[Rn],To[Rn],Uo[Rn]);else{Oo.multiDrawArraysInstancedWEBGL(So,C,0,To,0,Uo,0,Ro);let Rn=0;for(let C=0;C<Ro;C++)Rn+=To[C];for(let C=0;C<Uo.length;C++)or.update(Rn,So,Uo[C])}}}function WebGLCapabilities(C,Rn,or,So){let To;function getMaxPrecision(Rn){if("highp"===Rn){if(C.getShaderPrecisionFormat(C.VERTEX_SHADER,C.HIGH_FLOAT).precision>0&&C.getShaderPrecisionFormat(C.FRAGMENT_SHADER,C.HIGH_FLOAT).precision>0)return"highp";Rn="mediump"}return"mediump"===Rn&&C.getShaderPrecisionFormat(C.VERTEX_SHADER,C.MEDIUM_FLOAT).precision>0&&C.getShaderPrecisionFormat(C.FRAGMENT_SHADER,C.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let Ro=void 0!==or.precision?or.precision:"highp";const Uo=getMaxPrecision(Ro);Uo!==Ro&&(console.warn("THREE.WebGLRenderer:",Ro,"not supported, using",Uo,"instead."),Ro=Uo);const Oo=!0===or.logarithmicDepthBuffer,Ho=C.getParameter(C.MAX_TEXTURE_IMAGE_UNITS),qo=C.getParameter(C.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==To)return To;if(!0===Rn.has("EXT_texture_filter_anisotropic")){const or=Rn.get("EXT_texture_filter_anisotropic");To=C.getParameter(or.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else To=0;return To},getMaxPrecision:getMaxPrecision,textureFormatReadable:function(Rn){return Rn===Bd||So.convert(Rn)===C.getParameter(C.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(or){const To=or===Ld&&(Rn.has("EXT_color_buffer_half_float")||Rn.has("EXT_color_buffer_float"));return!(or!==Ed&&So.convert(or)!==C.getParameter(C.IMPLEMENTATION_COLOR_READ_TYPE)&&or!==Cd&&!To)},precision:Ro,logarithmicDepthBuffer:Oo,maxTextures:Ho,maxVertexTextures:qo,maxTextureSize:C.getParameter(C.MAX_TEXTURE_SIZE),maxCubemapSize:C.getParameter(C.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:C.getParameter(C.MAX_VERTEX_ATTRIBS),maxVertexUniforms:C.getParameter(C.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:C.getParameter(C.MAX_VARYING_VECTORS),maxFragmentUniforms:C.getParameter(C.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:qo>0,maxSamples:C.getParameter(C.MAX_SAMPLES)}}function WebGLClipping(C){const Rn=this;let or=null,So=0,To=!1,Ro=!1;const Uo=new Plane,Oo=new Matrix3,Ho={value:null,needsUpdate:!1};function projectPlanes(C,or,So,To){const Ro=null!==C?C.length:0;let qo=null;if(0!==Ro){if(qo=Ho.value,!0!==To||null===qo){const Rn=So+4*Ro,To=or.matrixWorldInverse;Oo.getNormalMatrix(To),(null===qo||qo.length<Rn)&&(qo=new Float32Array(Rn));for(let or=0,Ho=So;or!==Ro;++or,Ho+=4)Uo.copy(C[or]).applyMatrix4(To,Oo),Uo.normal.toArray(qo,Ho),qo[Ho+3]=Uo.constant}Ho.value=qo,Ho.needsUpdate=!0}return Rn.numPlanes=Ro,Rn.numIntersection=0,qo}this.uniform=Ho,this.numPlanes=0,this.numIntersection=0,this.init=function(C,Rn){const or=0!==C.length||Rn||0!==So||To;return To=Rn,So=C.length,or},this.beginShadows=function(){Ro=!0,projectPlanes(null)},this.endShadows=function(){Ro=!1},this.setGlobalState=function(C,Rn){or=projectPlanes(C,Rn,0)},this.setState=function(Uo,Oo,qo){const dl=Uo.clippingPlanes,ml=Uo.clipIntersection,fl=Uo.clipShadows,vl=C.get(Uo);if(!To||null===dl||0===dl.length||Ro&&!fl)Ro?projectPlanes(null):function(){Ho.value!==or&&(Ho.value=or,Ho.needsUpdate=So>0);Rn.numPlanes=So,Rn.numIntersection=0}();else{const C=Ro?0:So,Rn=4*C;let To=vl.clippingState||null;Ho.value=To,To=projectPlanes(dl,Oo,Rn,qo);for(let So=0;So!==Rn;++So)To[So]=or[So];vl.clippingState=To,this.numIntersection=ml?this.numPlanes:0,this.numPlanes+=C}}}function WebGLCubeMaps(C){let Rn=new WeakMap;function mapTextureMapping(C,Rn){return Rn===dd?C.mapping=ud:Rn===pd&&(C.mapping=hd),C}function onTextureDispose(C){const or=C.target;or.removeEventListener("dispose",onTextureDispose);const So=Rn.get(or);void 0!==So&&(Rn.delete(or),So.dispose())}return{get:function(or){if(or&&or.isTexture){const So=or.mapping;if(So===dd||So===pd){if(Rn.has(or)){return mapTextureMapping(Rn.get(or).texture,or.mapping)}{const So=or.image;if(So&&So.height>0){const To=new WebGLCubeRenderTarget(So.height);return To.fromEquirectangularTexture(C,or),Rn.set(or,To),or.addEventListener("dispose",onTextureDispose),mapTextureMapping(To.texture,or.mapping)}return null}}}return or},dispose:function(){Rn=new WeakMap}}}class OrthographicCamera extends Camera{constructor(C,Rn,or,So,To,Ro){void 0===C&&(C=-1),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=-1),void 0===To&&(To=.1),void 0===Ro&&(Ro=2e3),super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=C,this.right=Rn,this.top=or,this.bottom=So,this.near=To,this.far=Ro,this.updateProjectionMatrix()}copy(C,Rn){return super.copy(C,Rn),this.left=C.left,this.right=C.right,this.top=C.top,this.bottom=C.bottom,this.near=C.near,this.far=C.far,this.zoom=C.zoom,this.view=null===C.view?null:Object.assign({},C.view),this}setViewOffset(C,Rn,or,So,To,Ro){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=C,this.view.fullHeight=Rn,this.view.offsetX=or,this.view.offsetY=So,this.view.width=To,this.view.height=Ro,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const C=(this.right-this.left)/(2*this.zoom),Rn=(this.top-this.bottom)/(2*this.zoom),or=(this.right+this.left)/2,So=(this.top+this.bottom)/2;let To=or-C,Ro=or+C,Uo=So+Rn,Oo=So-Rn;if(null!==this.view&&this.view.enabled){const C=(this.right-this.left)/this.view.fullWidth/this.zoom,Rn=(this.top-this.bottom)/this.view.fullHeight/this.zoom;To+=C*this.view.offsetX,Ro=To+C*this.view.width,Uo-=Rn*this.view.offsetY,Oo=Uo-Rn*this.view.height}this.projectionMatrix.makeOrthographic(To,Ro,Uo,Oo,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(C){const Rn=super.toJSON(C);return Rn.object.zoom=this.zoom,Rn.object.left=this.left,Rn.object.right=this.right,Rn.object.top=this.top,Rn.object.bottom=this.bottom,Rn.object.near=this.near,Rn.object.far=this.far,null!==this.view&&(Rn.object.view=Object.assign({},this.view)),Rn}}const Ag=4,yg=[.125,.215,.35,.446,.526,.582],vg=20,xg=new OrthographicCamera,_g=new Color;let bg=null,wg=0,Eg=0,Mg=!1;const Sg=(1+Math.sqrt(5))/2,kg=1/Sg,Tg=[new Vector3(-Sg,kg,0),new Vector3(Sg,kg,0),new Vector3(-kg,0,Sg),new Vector3(kg,0,Sg),new Vector3(0,Sg,-kg),new Vector3(0,Sg,kg),new Vector3(-1,1,-1),new Vector3(1,1,-1),new Vector3(-1,1,1),new Vector3(1,1,1)];class PMREMGenerator{constructor(C){this._renderer=C,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(C,Rn,or,So){void 0===Rn&&(Rn=0),void 0===or&&(or=.1),void 0===So&&(So=100),bg=this._renderer.getRenderTarget(),wg=this._renderer.getActiveCubeFace(),Eg=this._renderer.getActiveMipmapLevel(),Mg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const To=this._allocateTargets();return To.depthBuffer=!0,this._sceneToCubeUV(C,or,So,To),Rn>0&&this._blur(To,0,0,Rn),this._applyPMREM(To),this._cleanup(To),To}fromEquirectangular(C,Rn){return void 0===Rn&&(Rn=null),this._fromTexture(C,Rn)}fromCubemap(C,Rn){return void 0===Rn&&(Rn=null),this._fromTexture(C,Rn)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(C){this._lodMax=Math.floor(Math.log2(C)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let C=0;C<this._lodPlanes.length;C++)this._lodPlanes[C].dispose()}_cleanup(C){this._renderer.setRenderTarget(bg,wg,Eg),this._renderer.xr.enabled=Mg,C.scissorTest=!1,_setViewport(C,0,0,C.width,C.height)}_fromTexture(C,Rn){C.mapping===ud||C.mapping===hd?this._setSize(0===C.image.length?16:C.image[0].width||C.image[0].image.width):this._setSize(C.image.width/4),bg=this._renderer.getRenderTarget(),wg=this._renderer.getActiveCubeFace(),Eg=this._renderer.getActiveMipmapLevel(),Mg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const or=Rn||this._allocateTargets();return this._textureToCubeUV(C,or),this._applyPMREM(or),this._cleanup(or),or}_allocateTargets(){const C=3*Math.max(this._cubeSize,112),Rn=4*this._cubeSize,or={magFilter:_d,minFilter:_d,generateMipmaps:!1,type:Ld,format:Bd,colorSpace:Up,depthBuffer:!1},So=_createRenderTarget(C,Rn,or);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==C||this._pingPongRenderTarget.height!==Rn){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(C,Rn,or);const{_lodMax:So}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(C){const Rn=[],or=[],So=[];let To=C;const Ro=C-Ag+1+yg.length;for(let Uo=0;Uo<Ro;Uo++){const Ro=Math.pow(2,To);or.push(Ro);let Oo=1/Ro;Uo>C-Ag?Oo=yg[Uo-C+Ag-1]:0===Uo&&(Oo=0),So.push(Oo);const Ho=1/(Ro-2),qo=-Ho,dl=1+Ho,ml=[qo,qo,dl,qo,dl,dl,qo,qo,dl,dl,qo,dl],fl=6,vl=6,bl=3,kl=2,Ll=1,Dl=new Float32Array(bl*vl*fl),Nc=new Float32Array(kl*vl*fl),jc=new Float32Array(Ll*vl*fl);for(let C=0;C<fl;C++){const Rn=C%3*2/3-1,or=C>2?0:-1,So=[Rn,or,0,Rn+2/3,or,0,Rn+2/3,or+1,0,Rn,or,0,Rn+2/3,or+1,0,Rn,or+1,0];Dl.set(So,bl*vl*C),Nc.set(ml,kl*vl*C);const To=[C,C,C,C,C,C];jc.set(To,Ll*vl*C)}const Zc=new BufferGeometry;Zc.setAttribute("position",new BufferAttribute(Dl,bl)),Zc.setAttribute("uv",new BufferAttribute(Nc,kl)),Zc.setAttribute("faceIndex",new BufferAttribute(jc,Ll)),Rn.push(Zc),To>Ag&&To--}return{lodPlanes:Rn,sizeLods:or,sigmas:So}}(So)),this._blurMaterial=function(C,Rn,or){const So=new Float32Array(vg),To=new Vector3(0,1,0),Ro=new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:vg,CUBEUV_TEXEL_WIDTH:1/Rn,CUBEUV_TEXEL_HEIGHT:1/or,CUBEUV_MAX_MIP:C+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:So},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:To}},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:vl,depthTest:!1,depthWrite:!1});return Ro}(So,C,Rn)}return So}_compileMaterial(C){const Rn=new Mesh(this._lodPlanes[0],C);this._renderer.compile(Rn,xg)}_sceneToCubeUV(C,Rn,or,So){const To=new PerspectiveCamera(90,1,Rn,or),Ro=[1,-1,1,1,1,1],Uo=[1,1,1,-1,-1,-1],Oo=this._renderer,Ho=Oo.autoClear,qo=Oo.toneMapping;Oo.getClearColor(_g),Oo.toneMapping=id,Oo.autoClear=!1;const dl=new MeshBasicMaterial({name:"PMREM.Background",side:ml,depthWrite:!1,depthTest:!1}),fl=new Mesh(new BoxGeometry,dl);let vl=!1;const bl=C.background;bl?bl.isColor&&(dl.color.copy(bl),C.background=null,vl=!0):(dl.color.copy(_g),vl=!0);for(let ml=0;ml<6;ml++){const Rn=ml%3;0===Rn?(To.up.set(0,Ro[ml],0),To.lookAt(Uo[ml],0,0)):1===Rn?(To.up.set(0,0,Ro[ml]),To.lookAt(0,Uo[ml],0)):(To.up.set(0,Ro[ml],0),To.lookAt(0,0,Uo[ml]));const or=this._cubeSize;_setViewport(So,Rn*or,ml>2?or:0,or,or),Oo.setRenderTarget(So),vl&&Oo.render(fl,To),Oo.render(C,To)}fl.geometry.dispose(),fl.material.dispose(),Oo.toneMapping=qo,Oo.autoClear=Ho,C.background=bl}_textureToCubeUV(C,Rn){const or=this._renderer,So=C.mapping===ud||C.mapping===hd;So?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===C.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());const To=So?this._cubemapMaterial:this._equirectMaterial,Ro=new Mesh(this._lodPlanes[0],To);To.uniforms.envMap.value=C;const Uo=this._cubeSize;_setViewport(Rn,0,0,3*Uo,2*Uo),or.setRenderTarget(Rn),or.render(Ro,xg)}_applyPMREM(C){const Rn=this._renderer,or=Rn.autoClear;Rn.autoClear=!1;const So=this._lodPlanes.length;for(let To=1;To<So;To++){const Rn=Math.sqrt(this._sigmas[To]*this._sigmas[To]-this._sigmas[To-1]*this._sigmas[To-1]),or=Tg[(So-To-1)%Tg.length];this._blur(C,To-1,To,Rn,or)}Rn.autoClear=or}_blur(C,Rn,or,So,To){const Ro=this._pingPongRenderTarget;this._halfBlur(C,Ro,Rn,or,So,"latitudinal",To),this._halfBlur(Ro,C,or,or,So,"longitudinal",To)}_halfBlur(C,Rn,or,So,To,Ro,Uo){const Oo=this._renderer,Ho=this._blurMaterial;"latitudinal"!==Ro&&"longitudinal"!==Ro&&console.error("blur direction must be either latitudinal or longitudinal!");const qo=new Mesh(this._lodPlanes[So],Ho),dl=Ho.uniforms,ml=this._sizeLods[or]-1,fl=isFinite(To)?Math.PI/(2*ml):2*Math.PI/(2*vg-1),vl=To/fl,bl=isFinite(To)?1+Math.floor(3*vl):vg;bl>vg&&console.warn("sigmaRadians, "+To+", is too large and will clip, as it requested "+bl+" samples when the maximum is set to "+vg);const kl=[];let Ll=0;for(let jc=0;jc<vg;++jc){const C=jc/vl,Rn=Math.exp(-C*C/2);kl.push(Rn),0===jc?Ll+=Rn:jc<bl&&(Ll+=2*Rn)}for(let jc=0;jc<kl.length;jc++)kl[jc]=kl[jc]/Ll;dl.envMap.value=C.texture,dl.samples.value=bl,dl.weights.value=kl,dl.latitudinal.value="latitudinal"===Ro,Uo&&(dl.poleAxis.value=Uo);const{_lodMax:Dl}=this;dl.dTheta.value=fl,dl.mipInt.value=Dl-or;const Nc=this._sizeLods[So];_setViewport(Rn,3*Nc*(So>Dl-Ag?So-Dl+Ag:0),4*(this._cubeSize-Nc),3*Nc,2*Nc),Oo.setRenderTarget(Rn),Oo.render(qo,xg)}}function _createRenderTarget(C,Rn,or){const So=new WebGLRenderTarget(C,Rn,or);return So.texture.mapping=md,So.texture.name="PMREM.cubeUv",So.scissorTest=!0,So}function _setViewport(C,Rn,or,So,To){C.viewport.set(Rn,or,So,To),C.scissor.set(Rn,or,So,To)}function _getEquirectMaterial(){return new ShaderMaterial({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:vl,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({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:vl,depthTest:!1,depthWrite:!1})}function WebGLCubeUVMaps(C){let Rn=new WeakMap,or=null;function onTextureDispose(C){const or=C.target;or.removeEventListener("dispose",onTextureDispose);const So=Rn.get(or);void 0!==So&&(Rn.delete(or),So.dispose())}return{get:function(So){if(So&&So.isTexture){const To=So.mapping,Ro=To===dd||To===pd,Uo=To===ud||To===hd;if(Ro||Uo){let To=Rn.get(So);const Oo=void 0!==To?To.texture.pmremVersion:0;if(So.isRenderTargetTexture&&So.pmremVersion!==Oo)return null===or&&(or=new PMREMGenerator(C)),To=Ro?or.fromEquirectangular(So,To):or.fromCubemap(So,To),To.texture.pmremVersion=So.pmremVersion,Rn.set(So,To),To.texture;if(void 0!==To)return To.texture;{const Oo=So.image;return Ro&&Oo&&Oo.height>0||Uo&&Oo&&function(C){let Rn=0;const or=6;for(let So=0;So<or;So++)void 0!==C[So]&&Rn++;return Rn===or}(Oo)?(null===or&&(or=new PMREMGenerator(C)),To=Ro?or.fromEquirectangular(So):or.fromCubemap(So),To.texture.pmremVersion=So.pmremVersion,Rn.set(So,To),So.addEventListener("dispose",onTextureDispose),To.texture):null}}}return So},dispose:function(){Rn=new WeakMap,null!==or&&(or.dispose(),or=null)}}}function WebGLExtensions(C){const Rn={};function getExtension(or){if(void 0!==Rn[or])return Rn[or];let So;switch(or){case"WEBGL_depth_texture":So=C.getExtension("WEBGL_depth_texture")||C.getExtension("MOZ_WEBGL_depth_texture")||C.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":So=C.getExtension("EXT_texture_filter_anisotropic")||C.getExtension("MOZ_EXT_texture_filter_anisotropic")||C.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":So=C.getExtension("WEBGL_compressed_texture_s3tc")||C.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||C.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":So=C.getExtension("WEBGL_compressed_texture_pvrtc")||C.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:So=C.getExtension(or)}return Rn[or]=So,So}return{has:function(C){return null!==getExtension(C)},init:function(){getExtension("EXT_color_buffer_float"),getExtension("WEBGL_clip_cull_distance"),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture"),getExtension("WEBGL_render_shared_exponent")},get:function(C){const Rn=getExtension(C);return null===Rn&&warnOnce("THREE.WebGLRenderer: "+C+" extension not supported."),Rn}}}function WebGLGeometries(C,Rn,or,So){const To={},Ro=new WeakMap;function onGeometryDispose(C){const Uo=C.target;null!==Uo.index&&Rn.remove(Uo.index);for(const or in Uo.attributes)Rn.remove(Uo.attributes[or]);for(const or in Uo.morphAttributes){const C=Uo.morphAttributes[or];for(let or=0,So=C.length;or<So;or++)Rn.remove(C[or])}Uo.removeEventListener("dispose",onGeometryDispose),delete To[Uo.id];const Oo=Ro.get(Uo);Oo&&(Rn.remove(Oo),Ro.delete(Uo)),So.releaseStatesOfGeometry(Uo),!0===Uo.isInstancedBufferGeometry&&delete Uo._maxInstanceCount,or.memory.geometries--}function updateWireframeAttribute(C){const or=[],So=C.index,To=C.attributes.position;let Uo=0;if(null!==So){const C=So.array;Uo=So.version;for(let Rn=0,So=C.length;Rn<So;Rn+=3){const So=C[Rn+0],To=C[Rn+1],Ro=C[Rn+2];or.push(So,To,To,Ro,Ro,So)}}else{if(void 0===To)return;{const C=To.array;Uo=To.version;for(let Rn=0,So=C.length/3-1;Rn<So;Rn+=3){const C=Rn+0,So=Rn+1,To=Rn+2;or.push(C,So,So,To,To,C)}}}const Oo=new(arrayNeedsUint32(or)?Uint32BufferAttribute:Uint16BufferAttribute)(or,1);Oo.version=Uo;const Ho=Ro.get(C);Ho&&Rn.remove(Ho),Ro.set(C,Oo)}return{get:function(C,Rn){return!0===To[Rn.id]||(Rn.addEventListener("dispose",onGeometryDispose),To[Rn.id]=!0,or.memory.geometries++),Rn},update:function(or){const So=or.attributes;for(const Ro in So)Rn.update(So[Ro],C.ARRAY_BUFFER);const To=or.morphAttributes;for(const Ro in To){const or=To[Ro];for(let So=0,To=or.length;So<To;So++)Rn.update(or[So],C.ARRAY_BUFFER)}},getWireframeAttribute:function(C){const Rn=Ro.get(C);if(Rn){const or=C.index;null!==or&&Rn.version<or.version&&updateWireframeAttribute(C)}else updateWireframeAttribute(C);return Ro.get(C)}}}function WebGLIndexedBufferRenderer(C,Rn,or){let So,To,Ro;function renderInstances(Rn,Uo,Oo){0!==Oo&&(C.drawElementsInstanced(So,Uo,To,Rn*Ro,Oo),or.update(Uo,So,Oo))}this.setMode=function(C){So=C},this.setIndex=function(C){To=C.type,Ro=C.bytesPerElement},this.render=function(Rn,Uo){C.drawElements(So,Uo,To,Rn*Ro),or.update(Uo,So,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function(C,Ro,Uo){if(0===Uo)return;Rn.get("WEBGL_multi_draw").multiDrawElementsWEBGL(So,Ro,0,To,C,0,Uo);let Oo=0;for(let Rn=0;Rn<Uo;Rn++)Oo+=Ro[Rn];or.update(Oo,So,1)},this.renderMultiDrawInstances=function(C,Uo,Oo,Ho){if(0===Oo)return;const qo=Rn.get("WEBGL_multi_draw");if(null===qo)for(let Rn=0;Rn<C.length;Rn++)renderInstances(C[Rn]/Ro,Uo[Rn],Ho[Rn]);else{qo.multiDrawElementsInstancedWEBGL(So,Uo,0,To,C,0,Ho,0,Oo);let Rn=0;for(let C=0;C<Oo;C++)Rn+=Uo[C];for(let C=0;C<Ho.length;C++)or.update(Rn,So,Ho[C])}}}function WebGLInfo(C){const Rn={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:Rn,programs:null,autoReset:!0,reset:function(){Rn.calls=0,Rn.triangles=0,Rn.points=0,Rn.lines=0},update:function(or,So,To){switch(Rn.calls++,So){case C.TRIANGLES:Rn.triangles+=To*(or/3);break;case C.LINES:Rn.lines+=To*(or/2);break;case C.LINE_STRIP:Rn.lines+=To*(or-1);break;case C.LINE_LOOP:Rn.lines+=To*or;break;case C.POINTS:Rn.points+=To*or;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",So)}}}}function WebGLMorphtargets(C,Rn,or){const So=new WeakMap,To=new Vector4;return{update:function(Ro,Uo,Oo){const Ho=Ro.morphTargetInfluences,qo=Uo.morphAttributes.position||Uo.morphAttributes.normal||Uo.morphAttributes.color,dl=void 0!==qo?qo.length:0;let ml=So.get(Uo);if(void 0===ml||ml.count!==dl){void 0!==ml&&ml.texture.dispose();const fl=void 0!==Uo.morphAttributes.position,vl=void 0!==Uo.morphAttributes.normal,bl=void 0!==Uo.morphAttributes.color,kl=Uo.morphAttributes.position||[],Ll=Uo.morphAttributes.normal||[],Dl=Uo.morphAttributes.color||[];let Nc=0;!0===fl&&(Nc=1),!0===vl&&(Nc=2),!0===bl&&(Nc=3);let jc=Uo.attributes.position.count*Nc,Zc=1;jc>Rn.maxTextureSize&&(Zc=Math.ceil(jc/Rn.maxTextureSize),jc=Rn.maxTextureSize);const eu=new Float32Array(jc*Zc*4*dl),Ku=new DataArrayTexture(eu,jc,Zc,dl);Ku.type=Cd,Ku.needsUpdate=!0;const Yu=4*Nc;for(let Eh=0;Eh<dl;Eh++){const Th=kl[Eh],Ch=Ll[Eh],Lh=Dl[Eh],Dh=jc*Zc*4*Eh;for(let Rh=0;Rh<Th.count;Rh++){const Nh=Rh*Yu;!0===fl&&(To.fromBufferAttribute(Th,Rh),eu[Dh+Nh+0]=To.x,eu[Dh+Nh+1]=To.y,eu[Dh+Nh+2]=To.z,eu[Dh+Nh+3]=0),!0===vl&&(To.fromBufferAttribute(Ch,Rh),eu[Dh+Nh+4]=To.x,eu[Dh+Nh+5]=To.y,eu[Dh+Nh+6]=To.z,eu[Dh+Nh+7]=0),!0===bl&&(To.fromBufferAttribute(Lh,Rh),eu[Dh+Nh+8]=To.x,eu[Dh+Nh+9]=To.y,eu[Dh+Nh+10]=To.z,eu[Dh+Nh+11]=4===Lh.itemSize?To.w:1)}}function disposeTexture(){Ku.dispose(),So.delete(Uo),Uo.removeEventListener("dispose",disposeTexture)}ml={count:dl,texture:Ku,size:new Vector2(jc,Zc)},So.set(Uo,ml),Uo.addEventListener("dispose",disposeTexture)}if(!0===Ro.isInstancedMesh&&null!==Ro.morphTexture)Oo.getUniforms().setValue(C,"morphTexture",Ro.morphTexture,or);else{let Uh=0;for(let Fh=0;Fh<Ho.length;Fh++)Uh+=Ho[Fh];const Bh=Uo.morphTargetsRelative?1:1-Uh;Oo.getUniforms().setValue(C,"morphTargetBaseInfluence",Bh),Oo.getUniforms().setValue(C,"morphTargetInfluences",Ho)}Oo.getUniforms().setValue(C,"morphTargetsTexture",ml.texture,or),Oo.getUniforms().setValue(C,"morphTargetsTextureSize",ml.size)}}}function WebGLObjects(C,Rn,or,So){let To=new WeakMap;function onInstancedMeshDispose(C){const Rn=C.target;Rn.removeEventListener("dispose",onInstancedMeshDispose),or.remove(Rn.instanceMatrix),null!==Rn.instanceColor&&or.remove(Rn.instanceColor)}return{update:function(Ro){const Uo=So.render.frame,Oo=Ro.geometry,Ho=Rn.get(Ro,Oo);if(To.get(Ho)!==Uo&&(Rn.update(Ho),To.set(Ho,Uo)),Ro.isInstancedMesh&&(!1===Ro.hasEventListener("dispose",onInstancedMeshDispose)&&Ro.addEventListener("dispose",onInstancedMeshDispose),To.get(Ro)!==Uo&&(or.update(Ro.instanceMatrix,C.ARRAY_BUFFER),null!==Ro.instanceColor&&or.update(Ro.instanceColor,C.ARRAY_BUFFER),To.set(Ro,Uo))),Ro.isSkinnedMesh){const C=Ro.skeleton;To.get(C)!==Uo&&(C.update(),To.set(C,Uo))}return Ho},dispose:function(){To=new WeakMap}}}class DepthTexture extends Texture{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){if(void 0===qo&&(qo=Vd),qo!==Vd&&qo!==jd)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===or&&qo===Vd&&(or=Id),void 0===or&&qo===jd&&(or=Dd),super(null,So,To,Ro,Uo,Oo,qo,or,Ho),this.isDepthTexture=!0,this.image={width:C,height:Rn},this.magFilter=void 0!==Uo?Uo:yd,this.minFilter=void 0!==Oo?Oo:yd,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(C){return super.copy(C),this.compareFunction=C.compareFunction,this}toJSON(C){const Rn=super.toJSON(C);return null!==this.compareFunction&&(Rn.compareFunction=this.compareFunction),Rn}}const Ig=new Texture,Cg=new DepthTexture(1,1),Lg=new DataArrayTexture,Pg=new Data3DTexture,zg=new CubeTexture,Dg=[],Rg=[],Ng=new Float32Array(16),Ug=new Float32Array(9),Bg=new Float32Array(4);function flatten(C,Rn,or){const So=C[0];if(So<=0||So>0)return C;const To=Rn*or;let Ro=Dg[To];if(void 0===Ro&&(Ro=new Float32Array(To),Dg[To]=Ro),0!==Rn){So.toArray(Ro,0);for(let So=1,To=0;So!==Rn;++So)To+=or,C[So].toArray(Ro,To)}return Ro}function arraysEqual(C,Rn){if(C.length!==Rn.length)return!1;for(let or=0,So=C.length;or<So;or++)if(C[or]!==Rn[or])return!1;return!0}function copyArray(C,Rn){for(let or=0,So=Rn.length;or<So;or++)C[or]=Rn[or]}function allocTexUnits(C,Rn){let or=Rg[Rn];void 0===or&&(or=new Int32Array(Rn),Rg[Rn]=or);for(let So=0;So!==Rn;++So)or[So]=C.allocateTextureUnit();return or}function setValueV1f(C,Rn){const or=this.cache;or[0]!==Rn&&(C.uniform1f(this.addr,Rn),or[0]=Rn)}function setValueV2f(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y||(C.uniform2f(this.addr,Rn.x,Rn.y),or[0]=Rn.x,or[1]=Rn.y);else{if(arraysEqual(or,Rn))return;C.uniform2fv(this.addr,Rn),copyArray(or,Rn)}}function setValueV3f(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z||(C.uniform3f(this.addr,Rn.x,Rn.y,Rn.z),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z);else if(void 0!==Rn.r)or[0]===Rn.r&&or[1]===Rn.g&&or[2]===Rn.b||(C.uniform3f(this.addr,Rn.r,Rn.g,Rn.b),or[0]=Rn.r,or[1]=Rn.g,or[2]=Rn.b);else{if(arraysEqual(or,Rn))return;C.uniform3fv(this.addr,Rn),copyArray(or,Rn)}}function setValueV4f(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z&&or[3]===Rn.w||(C.uniform4f(this.addr,Rn.x,Rn.y,Rn.z,Rn.w),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z,or[3]=Rn.w);else{if(arraysEqual(or,Rn))return;C.uniform4fv(this.addr,Rn),copyArray(or,Rn)}}function setValueM2(C,Rn){const or=this.cache,So=Rn.elements;if(void 0===So){if(arraysEqual(or,Rn))return;C.uniformMatrix2fv(this.addr,!1,Rn),copyArray(or,Rn)}else{if(arraysEqual(or,So))return;Bg.set(So),C.uniformMatrix2fv(this.addr,!1,Bg),copyArray(or,So)}}function setValueM3(C,Rn){const or=this.cache,So=Rn.elements;if(void 0===So){if(arraysEqual(or,Rn))return;C.uniformMatrix3fv(this.addr,!1,Rn),copyArray(or,Rn)}else{if(arraysEqual(or,So))return;Ug.set(So),C.uniformMatrix3fv(this.addr,!1,Ug),copyArray(or,So)}}function setValueM4(C,Rn){const or=this.cache,So=Rn.elements;if(void 0===So){if(arraysEqual(or,Rn))return;C.uniformMatrix4fv(this.addr,!1,Rn),copyArray(or,Rn)}else{if(arraysEqual(or,So))return;Ng.set(So),C.uniformMatrix4fv(this.addr,!1,Ng),copyArray(or,So)}}function setValueV1i(C,Rn){const or=this.cache;or[0]!==Rn&&(C.uniform1i(this.addr,Rn),or[0]=Rn)}function setValueV2i(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y||(C.uniform2i(this.addr,Rn.x,Rn.y),or[0]=Rn.x,or[1]=Rn.y);else{if(arraysEqual(or,Rn))return;C.uniform2iv(this.addr,Rn),copyArray(or,Rn)}}function setValueV3i(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z||(C.uniform3i(this.addr,Rn.x,Rn.y,Rn.z),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z);else{if(arraysEqual(or,Rn))return;C.uniform3iv(this.addr,Rn),copyArray(or,Rn)}}function setValueV4i(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z&&or[3]===Rn.w||(C.uniform4i(this.addr,Rn.x,Rn.y,Rn.z,Rn.w),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z,or[3]=Rn.w);else{if(arraysEqual(or,Rn))return;C.uniform4iv(this.addr,Rn),copyArray(or,Rn)}}function setValueV1ui(C,Rn){const or=this.cache;or[0]!==Rn&&(C.uniform1ui(this.addr,Rn),or[0]=Rn)}function setValueV2ui(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y||(C.uniform2ui(this.addr,Rn.x,Rn.y),or[0]=Rn.x,or[1]=Rn.y);else{if(arraysEqual(or,Rn))return;C.uniform2uiv(this.addr,Rn),copyArray(or,Rn)}}function setValueV3ui(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z||(C.uniform3ui(this.addr,Rn.x,Rn.y,Rn.z),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z);else{if(arraysEqual(or,Rn))return;C.uniform3uiv(this.addr,Rn),copyArray(or,Rn)}}function setValueV4ui(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z&&or[3]===Rn.w||(C.uniform4ui(this.addr,Rn.x,Rn.y,Rn.z,Rn.w),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z,or[3]=Rn.w);else{if(arraysEqual(or,Rn))return;C.uniform4uiv(this.addr,Rn),copyArray(or,Rn)}}function setValueT1(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();let Ro;So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),this.type===C.SAMPLER_2D_SHADOW?(Cg.compareFunction=Kp,Ro=Cg):Ro=Ig,or.setTexture2D(Rn||Ro,To)}function setValueT3D1(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),or.setTexture3D(Rn||Pg,To)}function setValueT6(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),or.setTextureCube(Rn||zg,To)}function setValueT2DArray1(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),or.setTexture2DArray(Rn||Lg,To)}function setValueV1fArray(C,Rn){C.uniform1fv(this.addr,Rn)}function setValueV2fArray(C,Rn){const or=flatten(Rn,this.size,2);C.uniform2fv(this.addr,or)}function setValueV3fArray(C,Rn){const or=flatten(Rn,this.size,3);C.uniform3fv(this.addr,or)}function setValueV4fArray(C,Rn){const or=flatten(Rn,this.size,4);C.uniform4fv(this.addr,or)}function setValueM2Array(C,Rn){const or=flatten(Rn,this.size,4);C.uniformMatrix2fv(this.addr,!1,or)}function setValueM3Array(C,Rn){const or=flatten(Rn,this.size,9);C.uniformMatrix3fv(this.addr,!1,or)}function setValueM4Array(C,Rn){const or=flatten(Rn,this.size,16);C.uniformMatrix4fv(this.addr,!1,or)}function setValueV1iArray(C,Rn){C.uniform1iv(this.addr,Rn)}function setValueV2iArray(C,Rn){C.uniform2iv(this.addr,Rn)}function setValueV3iArray(C,Rn){C.uniform3iv(this.addr,Rn)}function setValueV4iArray(C,Rn){C.uniform4iv(this.addr,Rn)}function setValueV1uiArray(C,Rn){C.uniform1uiv(this.addr,Rn)}function setValueV2uiArray(C,Rn){C.uniform2uiv(this.addr,Rn)}function setValueV3uiArray(C,Rn){C.uniform3uiv(this.addr,Rn)}function setValueV4uiArray(C,Rn){C.uniform4uiv(this.addr,Rn)}function setValueT1Array(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTexture2D(Rn[Uo]||Ig,Ro[Uo])}function setValueT3DArray(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTexture3D(Rn[Uo]||Pg,Ro[Uo])}function setValueT6Array(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTextureCube(Rn[Uo]||zg,Ro[Uo])}function setValueT2DArrayArray(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTexture2DArray(Rn[Uo]||Lg,Ro[Uo])}class SingleUniform{constructor(C,Rn,or){this.id=C,this.addr=or,this.cache=[],this.type=Rn.type,this.setValue=function(C){switch(C){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(Rn.type)}}class PureArrayUniform{constructor(C,Rn,or){this.id=C,this.addr=or,this.cache=[],this.type=Rn.type,this.size=Rn.size,this.setValue=function(C){switch(C){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(Rn.type)}}class StructuredUniform{constructor(C){this.id=C,this.seq=[],this.map={}}setValue(C,Rn,or){const So=this.seq;for(let To=0,Ro=So.length;To!==Ro;++To){const Ro=So[To];Ro.setValue(C,Rn[Ro.id],or)}}}const Fg=/(\w+)(\])?(\[|\.)?/g;function addUniform(C,Rn){C.seq.push(Rn),C.map[Rn.id]=Rn}function parseUniform(C,Rn,or){const So=C.name,To=So.length;for(Fg.lastIndex=0;;){const Ro=Fg.exec(So),Uo=Fg.lastIndex;let Oo=Ro[1];const Ho="]"===Ro[2],qo=Ro[3];if(Ho&&(Oo|=0),void 0===qo||"["===qo&&Uo+2===To){addUniform(or,void 0===qo?new SingleUniform(Oo,C,Rn):new PureArrayUniform(Oo,C,Rn));break}{let C=or.map[Oo];void 0===C&&(C=new StructuredUniform(Oo),addUniform(or,C)),or=C}}}class WebGLUniforms{constructor(C,Rn){this.seq=[],this.map={};const or=C.getProgramParameter(Rn,C.ACTIVE_UNIFORMS);for(let So=0;So<or;++So){const or=C.getActiveUniform(Rn,So);parseUniform(or,C.getUniformLocation(Rn,or.name),this)}}setValue(C,Rn,or,So){const To=this.map[Rn];void 0!==To&&To.setValue(C,or,So)}setOptional(C,Rn,or){const So=Rn[or];void 0!==So&&this.setValue(C,or,So)}static upload(C,Rn,or,So){for(let To=0,Ro=Rn.length;To!==Ro;++To){const Ro=Rn[To],Uo=or[Ro.id];!1!==Uo.needsUpdate&&Ro.setValue(C,Uo.value,So)}}static seqWithValue(C,Rn){const or=[];for(let So=0,To=C.length;So!==To;++So){const To=C[So];To.id in Rn&&or.push(To)}return or}}function WebGLShader(C,Rn,or){const So=C.createShader(Rn);return C.shaderSource(So,or),C.compileShader(So),So}const Og=37297;let Vg=0;function getShaderErrors(C,Rn,or){const So=C.getShaderParameter(Rn,C.COMPILE_STATUS),To=C.getShaderInfoLog(Rn).trim();if(So&&""===To)return"";const Ro=/ERROR: 0:(\d+)/.exec(To);if(Ro){const So=parseInt(Ro[1]);return or.toUpperCase()+"\n\n"+To+"\n\n"+function(C,Rn){const or=C.split("\n"),So=[],To=Math.max(Rn-6,0),Ro=Math.min(Rn+6,or.length);for(let Uo=To;Uo<Ro;Uo++){const C=Uo+1;So.push((C===Rn?">":" ")+" "+C+": "+or[Uo])}return So.join("\n")}(C.getShaderSource(Rn),So)}return To}function getTexelEncodingFunction(C,Rn){const or=function(C){const Rn=mm.getPrimaries(mm.workingColorSpace),or=mm.getPrimaries(C);let So;switch(Rn===or?So="":Rn===Gp&&or===jp?So="LinearDisplayP3ToLinearSRGB":Rn===jp&&or===Gp&&(So="LinearSRGBToLinearDisplayP3"),C){case Up:case Fp:return[So,"LinearTransferOETF"];case Np:case Bp:return[So,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",C),[So,"LinearTransferOETF"]}}(Rn);return"vec4 "+C+"( vec4 value ) { return "+or[0]+"( "+or[1]+"( value ) ); }"}function getToneMappingFunction(C,Rn){let or;switch(Rn){case nd:or="Linear";break;case rd:or="Reinhard";break;case ad:or="Cineon";break;case sd:or="ACESFilmic";break;case ld:or="AgX";break;case cd:or="Neutral";break;case od:or="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",Rn),or="Linear"}return"vec3 "+C+"( vec3 color ) { return "+or+"ToneMapping( color ); }"}const jg=new Vector3;function getLuminanceFunction(){mm.getLuminanceCoefficients(jg);return["float luminance( const in vec3 rgb ) {","\tconst vec3 weights = vec3( "+jg.x.toFixed(4)+", "+jg.y.toFixed(4)+", "+jg.z.toFixed(4)+" );","\treturn dot( weights, rgb );","}"].join("\n")}function filterEmptyLine(C){return""!==C}function replaceLightNums(C,Rn){const or=Rn.numSpotLightShadows+Rn.numSpotLightMaps-Rn.numSpotLightShadowsWithMaps;return C.replace(/NUM_DIR_LIGHTS/g,Rn.numDirLights).replace(/NUM_SPOT_LIGHTS/g,Rn.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,Rn.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,or).replace(/NUM_RECT_AREA_LIGHTS/g,Rn.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,Rn.numPointLights).replace(/NUM_HEMI_LIGHTS/g,Rn.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,Rn.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,Rn.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,Rn.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,Rn.numPointLightShadows)}function replaceClippingPlaneNums(C,Rn){return C.replace(/NUM_CLIPPING_PLANES/g,Rn.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Rn.numClippingPlanes-Rn.numClipIntersection)}const Gg=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(C){return C.replace(Gg,includeReplacer)}const Hg=new Map;function includeReplacer(C,Rn){let or=hg[Rn];if(void 0===or){const C=Hg.get(Rn);if(void 0===C)throw new Error("Can not resolve #include <"+Rn+">");or=hg[C],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Rn,C)}return resolveIncludes(or)}const Zg=/#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 unrollLoops(C){return C.replace(Zg,loopReplacer)}function loopReplacer(C,Rn,or,So){let To="";for(let Ro=parseInt(Rn);Ro<parseInt(or);Ro++)To+=So.replace(/\[\s*i\s*\]/g,"[ "+Ro+" ]").replace(/UNROLLED_LOOP_INDEX/g,Ro);return To}function generatePrecision(C){let Rn="precision "+C.precision+" float;\n\tprecision "+C.precision+" int;\n\tprecision "+C.precision+" sampler2D;\n\tprecision "+C.precision+" samplerCube;\n\tprecision "+C.precision+" sampler3D;\n\tprecision "+C.precision+" sampler2DArray;\n\tprecision "+C.precision+" sampler2DShadow;\n\tprecision "+C.precision+" samplerCubeShadow;\n\tprecision "+C.precision+" sampler2DArrayShadow;\n\tprecision "+C.precision+" isampler2D;\n\tprecision "+C.precision+" isampler3D;\n\tprecision "+C.precision+" isamplerCube;\n\tprecision "+C.precision+" isampler2DArray;\n\tprecision "+C.precision+" usampler2D;\n\tprecision "+C.precision+" usampler3D;\n\tprecision "+C.precision+" usamplerCube;\n\tprecision "+C.precision+" usampler2DArray;\n\t";return"highp"===C.precision?Rn+="\n#define HIGH_PRECISION":"mediump"===C.precision?Rn+="\n#define MEDIUM_PRECISION":"lowp"===C.precision&&(Rn+="\n#define LOW_PRECISION"),Rn}function WebGLProgram(C,Rn,or,So){const To=C.getContext(),Ro=or.defines;let Uo=or.vertexShader,dl=or.fragmentShader;const ml=function(C){let Rn="SHADOWMAP_TYPE_BASIC";return C.shadowMapType===Oo?Rn="SHADOWMAP_TYPE_PCF":C.shadowMapType===Ho?Rn="SHADOWMAP_TYPE_PCF_SOFT":C.shadowMapType===qo&&(Rn="SHADOWMAP_TYPE_VSM"),Rn}(or),fl=function(C){let Rn="ENVMAP_TYPE_CUBE";if(C.envMap)switch(C.envMapMode){case ud:case hd:Rn="ENVMAP_TYPE_CUBE";break;case md:Rn="ENVMAP_TYPE_CUBE_UV"}return Rn}(or),vl=function(C){let Rn="ENVMAP_MODE_REFLECTION";C.envMap&&C.envMapMode===hd&&(Rn="ENVMAP_MODE_REFRACTION");return Rn}(or),bl=function(C){let Rn="ENVMAP_BLENDING_NONE";if(C.envMap)switch(C.combine){case $h:Rn="ENVMAP_BLENDING_MULTIPLY";break;case ed:Rn="ENVMAP_BLENDING_MIX";break;case td:Rn="ENVMAP_BLENDING_ADD"}return Rn}(or),kl=function(C){const Rn=C.envMapCubeUVHeight;if(null===Rn)return null;const or=Math.log2(Rn)-2,So=1/Rn;return{texelWidth:1/(3*Math.max(Math.pow(2,or),112)),texelHeight:So,maxMip:or}}(or),Ll=function(C){return[C.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",C.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(filterEmptyLine).join("\n")}(or),Dl=function(C){const Rn=[];for(const or in C){const So=C[or];!1!==So&&Rn.push("#define "+or+" "+So)}return Rn.join("\n")}(Ro),Nc=To.createProgram();let jc,Zc,eu=or.glslVersion?"#version "+or.glslVersion+"\n":"";or.isRawShaderMaterial?(jc=["#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl].filter(filterEmptyLine).join("\n"),jc.length>0&&(jc+="\n"),Zc=["#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl].filter(filterEmptyLine).join("\n"),Zc.length>0&&(Zc+="\n")):(jc=[generatePrecision(or),"#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl,or.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",or.batching?"#define USE_BATCHING":"",or.batchingColor?"#define USE_BATCHING_COLOR":"",or.instancing?"#define USE_INSTANCING":"",or.instancingColor?"#define USE_INSTANCING_COLOR":"",or.instancingMorph?"#define USE_INSTANCING_MORPH":"",or.useFog&&or.fog?"#define USE_FOG":"",or.useFog&&or.fogExp2?"#define FOG_EXP2":"",or.map?"#define USE_MAP":"",or.envMap?"#define USE_ENVMAP":"",or.envMap?"#define "+vl:"",or.lightMap?"#define USE_LIGHTMAP":"",or.aoMap?"#define USE_AOMAP":"",or.bumpMap?"#define USE_BUMPMAP":"",or.normalMap?"#define USE_NORMALMAP":"",or.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",or.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",or.displacementMap?"#define USE_DISPLACEMENTMAP":"",or.emissiveMap?"#define USE_EMISSIVEMAP":"",or.anisotropy?"#define USE_ANISOTROPY":"",or.anisotropyMap?"#define USE_ANISOTROPYMAP":"",or.clearcoatMap?"#define USE_CLEARCOATMAP":"",or.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",or.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",or.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",or.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",or.specularMap?"#define USE_SPECULARMAP":"",or.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",or.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",or.roughnessMap?"#define USE_ROUGHNESSMAP":"",or.metalnessMap?"#define USE_METALNESSMAP":"",or.alphaMap?"#define USE_ALPHAMAP":"",or.alphaHash?"#define USE_ALPHAHASH":"",or.transmission?"#define USE_TRANSMISSION":"",or.transmissionMap?"#define USE_TRANSMISSIONMAP":"",or.thicknessMap?"#define USE_THICKNESSMAP":"",or.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",or.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",or.mapUv?"#define MAP_UV "+or.mapUv:"",or.alphaMapUv?"#define ALPHAMAP_UV "+or.alphaMapUv:"",or.lightMapUv?"#define LIGHTMAP_UV "+or.lightMapUv:"",or.aoMapUv?"#define AOMAP_UV "+or.aoMapUv:"",or.emissiveMapUv?"#define EMISSIVEMAP_UV "+or.emissiveMapUv:"",or.bumpMapUv?"#define BUMPMAP_UV "+or.bumpMapUv:"",or.normalMapUv?"#define NORMALMAP_UV "+or.normalMapUv:"",or.displacementMapUv?"#define DISPLACEMENTMAP_UV "+or.displacementMapUv:"",or.metalnessMapUv?"#define METALNESSMAP_UV "+or.metalnessMapUv:"",or.roughnessMapUv?"#define ROUGHNESSMAP_UV "+or.roughnessMapUv:"",or.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+or.anisotropyMapUv:"",or.clearcoatMapUv?"#define CLEARCOATMAP_UV "+or.clearcoatMapUv:"",or.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+or.clearcoatNormalMapUv:"",or.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+or.clearcoatRoughnessMapUv:"",or.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+or.iridescenceMapUv:"",or.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+or.iridescenceThicknessMapUv:"",or.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+or.sheenColorMapUv:"",or.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+or.sheenRoughnessMapUv:"",or.specularMapUv?"#define SPECULARMAP_UV "+or.specularMapUv:"",or.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+or.specularColorMapUv:"",or.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+or.specularIntensityMapUv:"",or.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+or.transmissionMapUv:"",or.thicknessMapUv?"#define THICKNESSMAP_UV "+or.thicknessMapUv:"",or.vertexTangents&&!1===or.flatShading?"#define USE_TANGENT":"",or.vertexColors?"#define USE_COLOR":"",or.vertexAlphas?"#define USE_COLOR_ALPHA":"",or.vertexUv1s?"#define USE_UV1":"",or.vertexUv2s?"#define USE_UV2":"",or.vertexUv3s?"#define USE_UV3":"",or.pointsUvs?"#define USE_POINTS_UV":"",or.flatShading?"#define FLAT_SHADED":"",or.skinning?"#define USE_SKINNING":"",or.morphTargets?"#define USE_MORPHTARGETS":"",or.morphNormals&&!1===or.flatShading?"#define USE_MORPHNORMALS":"",or.morphColors?"#define USE_MORPHCOLORS":"",or.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+or.morphTextureStride:"",or.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+or.morphTargetsCount:"",or.doubleSided?"#define DOUBLE_SIDED":"",or.flipSided?"#define FLIP_SIDED":"",or.shadowMapEnabled?"#define USE_SHADOWMAP":"",or.shadowMapEnabled?"#define "+ml:"",or.sizeAttenuation?"#define USE_SIZEATTENUATION":"",or.numLightProbes>0?"#define USE_LIGHT_PROBES":"",or.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#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","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),Zc=[generatePrecision(or),"#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl,or.useFog&&or.fog?"#define USE_FOG":"",or.useFog&&or.fogExp2?"#define FOG_EXP2":"",or.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",or.map?"#define USE_MAP":"",or.matcap?"#define USE_MATCAP":"",or.envMap?"#define USE_ENVMAP":"",or.envMap?"#define "+fl:"",or.envMap?"#define "+vl:"",or.envMap?"#define "+bl:"",kl?"#define CUBEUV_TEXEL_WIDTH "+kl.texelWidth:"",kl?"#define CUBEUV_TEXEL_HEIGHT "+kl.texelHeight:"",kl?"#define CUBEUV_MAX_MIP "+kl.maxMip+".0":"",or.lightMap?"#define USE_LIGHTMAP":"",or.aoMap?"#define USE_AOMAP":"",or.bumpMap?"#define USE_BUMPMAP":"",or.normalMap?"#define USE_NORMALMAP":"",or.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",or.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",or.emissiveMap?"#define USE_EMISSIVEMAP":"",or.anisotropy?"#define USE_ANISOTROPY":"",or.anisotropyMap?"#define USE_ANISOTROPYMAP":"",or.clearcoat?"#define USE_CLEARCOAT":"",or.clearcoatMap?"#define USE_CLEARCOATMAP":"",or.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",or.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",or.dispersion?"#define USE_DISPERSION":"",or.iridescence?"#define USE_IRIDESCENCE":"",or.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",or.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",or.specularMap?"#define USE_SPECULARMAP":"",or.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",or.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",or.roughnessMap?"#define USE_ROUGHNESSMAP":"",or.metalnessMap?"#define USE_METALNESSMAP":"",or.alphaMap?"#define USE_ALPHAMAP":"",or.alphaTest?"#define USE_ALPHATEST":"",or.alphaHash?"#define USE_ALPHAHASH":"",or.sheen?"#define USE_SHEEN":"",or.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",or.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",or.transmission?"#define USE_TRANSMISSION":"",or.transmissionMap?"#define USE_TRANSMISSIONMAP":"",or.thicknessMap?"#define USE_THICKNESSMAP":"",or.vertexTangents&&!1===or.flatShading?"#define USE_TANGENT":"",or.vertexColors||or.instancingColor||or.batchingColor?"#define USE_COLOR":"",or.vertexAlphas?"#define USE_COLOR_ALPHA":"",or.vertexUv1s?"#define USE_UV1":"",or.vertexUv2s?"#define USE_UV2":"",or.vertexUv3s?"#define USE_UV3":"",or.pointsUvs?"#define USE_POINTS_UV":"",or.gradientMap?"#define USE_GRADIENTMAP":"",or.flatShading?"#define FLAT_SHADED":"",or.doubleSided?"#define DOUBLE_SIDED":"",or.flipSided?"#define FLIP_SIDED":"",or.shadowMapEnabled?"#define USE_SHADOWMAP":"",or.shadowMapEnabled?"#define "+ml:"",or.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",or.numLightProbes>0?"#define USE_LIGHT_PROBES":"",or.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",or.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",or.toneMapping!==id?"#define TONE_MAPPING":"",or.toneMapping!==id?hg.tonemapping_pars_fragment:"",or.toneMapping!==id?getToneMappingFunction("toneMapping",or.toneMapping):"",or.dithering?"#define DITHERING":"",or.opaque?"#define OPAQUE":"",hg.colorspace_pars_fragment,getTexelEncodingFunction("linearToOutputTexel",or.outputColorSpace),getLuminanceFunction(),or.useDepthPacking?"#define DEPTH_PACKING "+or.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),Uo=resolveIncludes(Uo),Uo=replaceLightNums(Uo,or),Uo=replaceClippingPlaneNums(Uo,or),dl=resolveIncludes(dl),dl=replaceLightNums(dl,or),dl=replaceClippingPlaneNums(dl,or),Uo=unrollLoops(Uo),dl=unrollLoops(dl),!0!==or.isRawShaderMaterial&&(eu="#version 300 es\n",jc=[Ll,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+jc,Zc=["#define varying in",or.glslVersion===em?"":"layout(location = 0) out highp vec4 pc_fragColor;",or.glslVersion===em?"":"#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"+Zc);const Ku=eu+jc+Uo,Yu=eu+Zc+dl,Eh=WebGLShader(To,To.VERTEX_SHADER,Ku),Th=WebGLShader(To,To.FRAGMENT_SHADER,Yu);function onFirstUse(Rn){if(C.debug.checkShaderErrors){const or=To.getProgramInfoLog(Nc).trim(),So=To.getShaderInfoLog(Eh).trim(),Ro=To.getShaderInfoLog(Th).trim();let Uo=!0,Oo=!0;if(!1===To.getProgramParameter(Nc,To.LINK_STATUS))if(Uo=!1,"function"===typeof C.debug.onShaderError)C.debug.onShaderError(To,Nc,Eh,Th);else{const C=getShaderErrors(To,Eh,"vertex"),So=getShaderErrors(To,Th,"fragment");console.error("THREE.WebGLProgram: Shader Error "+To.getError()+" - VALIDATE_STATUS "+To.getProgramParameter(Nc,To.VALIDATE_STATUS)+"\n\nMaterial Name: "+Rn.name+"\nMaterial Type: "+Rn.type+"\n\nProgram Info Log: "+or+"\n"+C+"\n"+So)}else""!==or?console.warn("THREE.WebGLProgram: Program Info Log:",or):""!==So&&""!==Ro||(Oo=!1);Oo&&(Rn.diagnostics={runnable:Uo,programLog:or,vertexShader:{log:So,prefix:jc},fragmentShader:{log:Ro,prefix:Zc}})}To.deleteShader(Eh),To.deleteShader(Th),Ch=new WebGLUniforms(To,Nc),Lh=function(C,Rn){const or={},So=C.getProgramParameter(Rn,C.ACTIVE_ATTRIBUTES);for(let To=0;To<So;To++){const So=C.getActiveAttrib(Rn,To),Ro=So.name;let Uo=1;So.type===C.FLOAT_MAT2&&(Uo=2),So.type===C.FLOAT_MAT3&&(Uo=3),So.type===C.FLOAT_MAT4&&(Uo=4),or[Ro]={type:So.type,location:C.getAttribLocation(Rn,Ro),locationSize:Uo}}return or}(To,Nc)}let Ch,Lh;To.attachShader(Nc,Eh),To.attachShader(Nc,Th),void 0!==or.index0AttributeName?To.bindAttribLocation(Nc,0,or.index0AttributeName):!0===or.morphTargets&&To.bindAttribLocation(Nc,0,"position"),To.linkProgram(Nc),this.getUniforms=function(){return void 0===Ch&&onFirstUse(this),Ch},this.getAttributes=function(){return void 0===Lh&&onFirstUse(this),Lh};let Dh=!1===or.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===Dh&&(Dh=To.getProgramParameter(Nc,Og)),Dh},this.destroy=function(){So.releaseStatesOfProgram(this),To.deleteProgram(Nc),this.program=void 0},this.type=or.shaderType,this.name=or.shaderName,this.id=Vg++,this.cacheKey=Rn,this.usedTimes=1,this.program=Nc,this.vertexShader=Eh,this.fragmentShader=Th,this}let Wg=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(C){const Rn=C.vertexShader,or=C.fragmentShader,So=this._getShaderStage(Rn),To=this._getShaderStage(or),Ro=this._getShaderCacheForMaterial(C);return!1===Ro.has(So)&&(Ro.add(So),So.usedTimes++),!1===Ro.has(To)&&(Ro.add(To),To.usedTimes++),this}remove(C){const Rn=this.materialCache.get(C);for(const or of Rn)or.usedTimes--,0===or.usedTimes&&this.shaderCache.delete(or.code);return this.materialCache.delete(C),this}getVertexShaderID(C){return this._getShaderStage(C.vertexShader).id}getFragmentShaderID(C){return this._getShaderStage(C.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(C){const Rn=this.materialCache;let or=Rn.get(C);return void 0===or&&(or=new Set,Rn.set(C,or)),or}_getShaderStage(C){const Rn=this.shaderCache;let or=Rn.get(C);return void 0===or&&(or=new WebGLShaderStage(C),Rn.set(C,or)),or}}class WebGLShaderStage{constructor(C){this.id=Wg++,this.code=C,this.usedTimes=0}}function WebGLPrograms(C,Rn,or,So,To,Ro,Uo){const Oo=new Layers,Ho=new WebGLShaderCache,qo=new Set,dl=[],vl=To.logarithmicDepthBuffer,kl=To.vertexTextures;let Ll=To.precision;const Dl={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 getChannel(C){return qo.add(C),0===C?"uv":"uv"+C}return{getParameters:function(Ro,Oo,dl,Nc,jc){const Zc=Nc.fog,eu=jc.geometry,Ku=Ro.isMeshStandardMaterial?Nc.environment:null,Yu=(Ro.isMeshStandardMaterial?or:Rn).get(Ro.envMap||Ku),Eh=Yu&&Yu.mapping===md?Yu.image.height:null,Th=Dl[Ro.type];null!==Ro.precision&&(Ll=To.getMaxPrecision(Ro.precision),Ll!==Ro.precision&&console.warn("THREE.WebGLProgram.getParameters:",Ro.precision,"not supported, using",Ll,"instead."));const Ch=eu.morphAttributes.position||eu.morphAttributes.normal||eu.morphAttributes.color,Lh=void 0!==Ch?Ch.length:0;let Dh,Rh,Nh,Uh,Bh=0;if(void 0!==eu.morphAttributes.position&&(Bh=1),void 0!==eu.morphAttributes.normal&&(Bh=2),void 0!==eu.morphAttributes.color&&(Bh=3),Th){const C=pg[Th];Dh=C.vertexShader,Rh=C.fragmentShader}else Dh=Ro.vertexShader,Rh=Ro.fragmentShader,Ho.update(Ro),Nh=Ho.getVertexShaderID(Ro),Uh=Ho.getFragmentShaderID(Ro);const Fh=C.getRenderTarget(),Oh=!0===jc.isInstancedMesh,Vh=!0===jc.isBatchedMesh,jh=!!Ro.map,Gh=!!Ro.matcap,Hh=!!Yu,Zh=!!Ro.aoMap,Wh=!!Ro.lightMap,qh=!!Ro.bumpMap,Kh=!!Ro.normalMap,Qh=!!Ro.displacementMap,Xh=!!Ro.emissiveMap,Yh=!!Ro.metalnessMap,Jh=!!Ro.roughnessMap,$h=Ro.anisotropy>0,ed=Ro.clearcoat>0,td=Ro.dispersion>0,nd=Ro.iridescence>0,rd=Ro.sheen>0,ad=Ro.transmission>0,sd=$h&&!!Ro.anisotropyMap,od=ed&&!!Ro.clearcoatMap,ld=ed&&!!Ro.clearcoatNormalMap,cd=ed&&!!Ro.clearcoatRoughnessMap,ud=nd&&!!Ro.iridescenceMap,hd=nd&&!!Ro.iridescenceThicknessMap,dd=rd&&!!Ro.sheenColorMap,pd=rd&&!!Ro.sheenRoughnessMap,fd=!!Ro.specularMap,gd=!!Ro.specularColorMap,Ad=!!Ro.specularIntensityMap,yd=ad&&!!Ro.transmissionMap,vd=ad&&!!Ro.thicknessMap,xd=!!Ro.gradientMap,_d=!!Ro.alphaMap,bd=Ro.alphaTest>0,wd=!!Ro.alphaHash,Ed=!!Ro.extensions;let Md=id;Ro.toneMapped&&(null!==Fh&&!0!==Fh.isXRRenderTarget||(Md=C.toneMapping));const Sd={shaderID:Th,shaderType:Ro.type,shaderName:Ro.name,vertexShader:Dh,fragmentShader:Rh,defines:Ro.defines,customVertexShaderID:Nh,customFragmentShaderID:Uh,isRawShaderMaterial:!0===Ro.isRawShaderMaterial,glslVersion:Ro.glslVersion,precision:Ll,batching:Vh,batchingColor:Vh&&null!==jc._colorsTexture,instancing:Oh,instancingColor:Oh&&null!==jc.instanceColor,instancingMorph:Oh&&null!==jc.morphTexture,supportsVertexTextures:kl,outputColorSpace:null===Fh?C.outputColorSpace:!0===Fh.isXRRenderTarget?Fh.texture.colorSpace:Up,alphaToCoverage:!!Ro.alphaToCoverage,map:jh,matcap:Gh,envMap:Hh,envMapMode:Hh&&Yu.mapping,envMapCubeUVHeight:Eh,aoMap:Zh,lightMap:Wh,bumpMap:qh,normalMap:Kh,displacementMap:kl&&Qh,emissiveMap:Xh,normalMapObjectSpace:Kh&&Ro.normalMapType===Dp,normalMapTangentSpace:Kh&&Ro.normalMapType===zp,metalnessMap:Yh,roughnessMap:Jh,anisotropy:$h,anisotropyMap:sd,clearcoat:ed,clearcoatMap:od,clearcoatNormalMap:ld,clearcoatRoughnessMap:cd,dispersion:td,iridescence:nd,iridescenceMap:ud,iridescenceThicknessMap:hd,sheen:rd,sheenColorMap:dd,sheenRoughnessMap:pd,specularMap:fd,specularColorMap:gd,specularIntensityMap:Ad,transmission:ad,transmissionMap:yd,thicknessMap:vd,gradientMap:xd,opaque:!1===Ro.transparent&&Ro.blending===bl&&!1===Ro.alphaToCoverage,alphaMap:_d,alphaTest:bd,alphaHash:wd,combine:Ro.combine,mapUv:jh&&getChannel(Ro.map.channel),aoMapUv:Zh&&getChannel(Ro.aoMap.channel),lightMapUv:Wh&&getChannel(Ro.lightMap.channel),bumpMapUv:qh&&getChannel(Ro.bumpMap.channel),normalMapUv:Kh&&getChannel(Ro.normalMap.channel),displacementMapUv:Qh&&getChannel(Ro.displacementMap.channel),emissiveMapUv:Xh&&getChannel(Ro.emissiveMap.channel),metalnessMapUv:Yh&&getChannel(Ro.metalnessMap.channel),roughnessMapUv:Jh&&getChannel(Ro.roughnessMap.channel),anisotropyMapUv:sd&&getChannel(Ro.anisotropyMap.channel),clearcoatMapUv:od&&getChannel(Ro.clearcoatMap.channel),clearcoatNormalMapUv:ld&&getChannel(Ro.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:cd&&getChannel(Ro.clearcoatRoughnessMap.channel),iridescenceMapUv:ud&&getChannel(Ro.iridescenceMap.channel),iridescenceThicknessMapUv:hd&&getChannel(Ro.iridescenceThicknessMap.channel),sheenColorMapUv:dd&&getChannel(Ro.sheenColorMap.channel),sheenRoughnessMapUv:pd&&getChannel(Ro.sheenRoughnessMap.channel),specularMapUv:fd&&getChannel(Ro.specularMap.channel),specularColorMapUv:gd&&getChannel(Ro.specularColorMap.channel),specularIntensityMapUv:Ad&&getChannel(Ro.specularIntensityMap.channel),transmissionMapUv:yd&&getChannel(Ro.transmissionMap.channel),thicknessMapUv:vd&&getChannel(Ro.thicknessMap.channel),alphaMapUv:_d&&getChannel(Ro.alphaMap.channel),vertexTangents:!!eu.attributes.tangent&&(Kh||$h),vertexColors:Ro.vertexColors,vertexAlphas:!0===Ro.vertexColors&&!!eu.attributes.color&&4===eu.attributes.color.itemSize,pointsUvs:!0===jc.isPoints&&!!eu.attributes.uv&&(jh||_d),fog:!!Zc,useFog:!0===Ro.fog,fogExp2:!!Zc&&Zc.isFogExp2,flatShading:!0===Ro.flatShading,sizeAttenuation:!0===Ro.sizeAttenuation,logarithmicDepthBuffer:vl,skinning:!0===jc.isSkinnedMesh,morphTargets:void 0!==eu.morphAttributes.position,morphNormals:void 0!==eu.morphAttributes.normal,morphColors:void 0!==eu.morphAttributes.color,morphTargetsCount:Lh,morphTextureStride:Bh,numDirLights:Oo.directional.length,numPointLights:Oo.point.length,numSpotLights:Oo.spot.length,numSpotLightMaps:Oo.spotLightMap.length,numRectAreaLights:Oo.rectArea.length,numHemiLights:Oo.hemi.length,numDirLightShadows:Oo.directionalShadowMap.length,numPointLightShadows:Oo.pointShadowMap.length,numSpotLightShadows:Oo.spotShadowMap.length,numSpotLightShadowsWithMaps:Oo.numSpotLightShadowsWithMaps,numLightProbes:Oo.numLightProbes,numClippingPlanes:Uo.numPlanes,numClipIntersection:Uo.numIntersection,dithering:Ro.dithering,shadowMapEnabled:C.shadowMap.enabled&&dl.length>0,shadowMapType:C.shadowMap.type,toneMapping:Md,decodeVideoTexture:jh&&!0===Ro.map.isVideoTexture&&mm.getTransfer(Ro.map.colorSpace)===Vp,premultipliedAlpha:Ro.premultipliedAlpha,doubleSided:Ro.side===fl,flipSided:Ro.side===ml,useDepthPacking:Ro.depthPacking>=0,depthPacking:Ro.depthPacking||0,index0AttributeName:Ro.index0AttributeName,extensionClipCullDistance:Ed&&!0===Ro.extensions.clipCullDistance&&So.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ed&&!0===Ro.extensions.multiDraw||Vh)&&So.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:So.has("KHR_parallel_shader_compile"),customProgramCacheKey:Ro.customProgramCacheKey()};return Sd.vertexUv1s=qo.has(1),Sd.vertexUv2s=qo.has(2),Sd.vertexUv3s=qo.has(3),qo.clear(),Sd},getProgramCacheKey:function(Rn){const or=[];if(Rn.shaderID?or.push(Rn.shaderID):(or.push(Rn.customVertexShaderID),or.push(Rn.customFragmentShaderID)),void 0!==Rn.defines)for(const C in Rn.defines)or.push(C),or.push(Rn.defines[C]);return!1===Rn.isRawShaderMaterial&&(!function(C,Rn){C.push(Rn.precision),C.push(Rn.outputColorSpace),C.push(Rn.envMapMode),C.push(Rn.envMapCubeUVHeight),C.push(Rn.mapUv),C.push(Rn.alphaMapUv),C.push(Rn.lightMapUv),C.push(Rn.aoMapUv),C.push(Rn.bumpMapUv),C.push(Rn.normalMapUv),C.push(Rn.displacementMapUv),C.push(Rn.emissiveMapUv),C.push(Rn.metalnessMapUv),C.push(Rn.roughnessMapUv),C.push(Rn.anisotropyMapUv),C.push(Rn.clearcoatMapUv),C.push(Rn.clearcoatNormalMapUv),C.push(Rn.clearcoatRoughnessMapUv),C.push(Rn.iridescenceMapUv),C.push(Rn.iridescenceThicknessMapUv),C.push(Rn.sheenColorMapUv),C.push(Rn.sheenRoughnessMapUv),C.push(Rn.specularMapUv),C.push(Rn.specularColorMapUv),C.push(Rn.specularIntensityMapUv),C.push(Rn.transmissionMapUv),C.push(Rn.thicknessMapUv),C.push(Rn.combine),C.push(Rn.fogExp2),C.push(Rn.sizeAttenuation),C.push(Rn.morphTargetsCount),C.push(Rn.morphAttributeCount),C.push(Rn.numDirLights),C.push(Rn.numPointLights),C.push(Rn.numSpotLights),C.push(Rn.numSpotLightMaps),C.push(Rn.numHemiLights),C.push(Rn.numRectAreaLights),C.push(Rn.numDirLightShadows),C.push(Rn.numPointLightShadows),C.push(Rn.numSpotLightShadows),C.push(Rn.numSpotLightShadowsWithMaps),C.push(Rn.numLightProbes),C.push(Rn.shadowMapType),C.push(Rn.toneMapping),C.push(Rn.numClippingPlanes),C.push(Rn.numClipIntersection),C.push(Rn.depthPacking)}(or,Rn),function(C,Rn){Oo.disableAll(),Rn.supportsVertexTextures&&Oo.enable(0);Rn.instancing&&Oo.enable(1);Rn.instancingColor&&Oo.enable(2);Rn.instancingMorph&&Oo.enable(3);Rn.matcap&&Oo.enable(4);Rn.envMap&&Oo.enable(5);Rn.normalMapObjectSpace&&Oo.enable(6);Rn.normalMapTangentSpace&&Oo.enable(7);Rn.clearcoat&&Oo.enable(8);Rn.iridescence&&Oo.enable(9);Rn.alphaTest&&Oo.enable(10);Rn.vertexColors&&Oo.enable(11);Rn.vertexAlphas&&Oo.enable(12);Rn.vertexUv1s&&Oo.enable(13);Rn.vertexUv2s&&Oo.enable(14);Rn.vertexUv3s&&Oo.enable(15);Rn.vertexTangents&&Oo.enable(16);Rn.anisotropy&&Oo.enable(17);Rn.alphaHash&&Oo.enable(18);Rn.batching&&Oo.enable(19);Rn.dispersion&&Oo.enable(20);Rn.batchingColor&&Oo.enable(21);C.push(Oo.mask),Oo.disableAll(),Rn.fog&&Oo.enable(0);Rn.useFog&&Oo.enable(1);Rn.flatShading&&Oo.enable(2);Rn.logarithmicDepthBuffer&&Oo.enable(3);Rn.skinning&&Oo.enable(4);Rn.morphTargets&&Oo.enable(5);Rn.morphNormals&&Oo.enable(6);Rn.morphColors&&Oo.enable(7);Rn.premultipliedAlpha&&Oo.enable(8);Rn.shadowMapEnabled&&Oo.enable(9);Rn.doubleSided&&Oo.enable(10);Rn.flipSided&&Oo.enable(11);Rn.useDepthPacking&&Oo.enable(12);Rn.dithering&&Oo.enable(13);Rn.transmission&&Oo.enable(14);Rn.sheen&&Oo.enable(15);Rn.opaque&&Oo.enable(16);Rn.pointsUvs&&Oo.enable(17);Rn.decodeVideoTexture&&Oo.enable(18);Rn.alphaToCoverage&&Oo.enable(19);C.push(Oo.mask)}(or,Rn),or.push(C.outputColorSpace)),or.push(Rn.customProgramCacheKey),or.join()},getUniforms:function(C){const Rn=Dl[C.type];let or;if(Rn){const C=pg[Rn];or=tg.clone(C.uniforms)}else or=C.uniforms;return or},acquireProgram:function(Rn,or){let So;for(let C=0,To=dl.length;C<To;C++){const Rn=dl[C];if(Rn.cacheKey===or){So=Rn,++So.usedTimes;break}}return void 0===So&&(So=new WebGLProgram(C,or,Rn,Ro),dl.push(So)),So},releaseProgram:function(C){if(0===--C.usedTimes){const Rn=dl.indexOf(C);dl[Rn]=dl[dl.length-1],dl.pop(),C.destroy()}},releaseShaderCache:function(C){Ho.remove(C)},programs:dl,dispose:function(){Ho.dispose()}}}function WebGLProperties(){let C=new WeakMap;return{has:function(Rn){return C.has(Rn)},get:function(Rn){let or=C.get(Rn);return void 0===or&&(or={},C.set(Rn,or)),or},remove:function(Rn){C.delete(Rn)},update:function(Rn,or,So){C.get(Rn)[or]=So},dispose:function(){C=new WeakMap}}}function painterSortStable(C,Rn){return C.groupOrder!==Rn.groupOrder?C.groupOrder-Rn.groupOrder:C.renderOrder!==Rn.renderOrder?C.renderOrder-Rn.renderOrder:C.material.id!==Rn.material.id?C.material.id-Rn.material.id:C.z!==Rn.z?C.z-Rn.z:C.id-Rn.id}function reversePainterSortStable(C,Rn){return C.groupOrder!==Rn.groupOrder?C.groupOrder-Rn.groupOrder:C.renderOrder!==Rn.renderOrder?C.renderOrder-Rn.renderOrder:C.z!==Rn.z?Rn.z-C.z:C.id-Rn.id}function WebGLRenderList(){const C=[];let Rn=0;const or=[],So=[],To=[];function getNextRenderItem(or,So,To,Ro,Uo,Oo){let Ho=C[Rn];return void 0===Ho?(Ho={id:or.id,object:or,geometry:So,material:To,groupOrder:Ro,renderOrder:or.renderOrder,z:Uo,group:Oo},C[Rn]=Ho):(Ho.id=or.id,Ho.object=or,Ho.geometry=So,Ho.material=To,Ho.groupOrder=Ro,Ho.renderOrder=or.renderOrder,Ho.z=Uo,Ho.group=Oo),Rn++,Ho}return{opaque:or,transmissive:So,transparent:To,init:function(){Rn=0,or.length=0,So.length=0,To.length=0},push:function(C,Rn,Ro,Uo,Oo,Ho){const qo=getNextRenderItem(C,Rn,Ro,Uo,Oo,Ho);Ro.transmission>0?So.push(qo):!0===Ro.transparent?To.push(qo):or.push(qo)},unshift:function(C,Rn,Ro,Uo,Oo,Ho){const qo=getNextRenderItem(C,Rn,Ro,Uo,Oo,Ho);Ro.transmission>0?So.unshift(qo):!0===Ro.transparent?To.unshift(qo):or.unshift(qo)},finish:function(){for(let or=Rn,So=C.length;or<So;or++){const Rn=C[or];if(null===Rn.id)break;Rn.id=null,Rn.object=null,Rn.geometry=null,Rn.material=null,Rn.group=null}},sort:function(C,Rn){or.length>1&&or.sort(C||painterSortStable),So.length>1&&So.sort(Rn||reversePainterSortStable),To.length>1&&To.sort(Rn||reversePainterSortStable)}}}function WebGLRenderLists(){let C=new WeakMap;return{get:function(Rn,or){const So=C.get(Rn);let To;return void 0===So?(To=new WebGLRenderList,C.set(Rn,[To])):or>=So.length?(To=new WebGLRenderList,So.push(To)):To=So[or],To},dispose:function(){C=new WeakMap}}}function UniformsCache(){const C={};return{get:function(Rn){if(void 0!==C[Rn.id])return C[Rn.id];let or;switch(Rn.type){case"DirectionalLight":or={direction:new Vector3,color:new Color};break;case"SpotLight":or={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":or={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":or={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":or={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3}}return C[Rn.id]=or,or}}}let qg=0;function shadowCastingAndTexturingLightsFirst(C,Rn){return(Rn.castShadow?2:0)-(C.castShadow?2:0)+(Rn.map?1:0)-(C.map?1:0)}function WebGLLights(C){const Rn=new UniformsCache,or=function(){const C={};return{get:function(Rn){if(void 0!==C[Rn.id])return C[Rn.id];let or;switch(Rn.type){case"DirectionalLight":case"SpotLight":or={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":or={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return C[Rn.id]=or,or}}}(),So={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 Oo=0;Oo<9;Oo++)So.probe.push(new Vector3);const To=new Vector3,Ro=new Matrix4,Uo=new Matrix4;return{setup:function(To){let Ro=0,Uo=0,Oo=0;for(let C=0;C<9;C++)So.probe[C].set(0,0,0);let Ho=0,qo=0,dl=0,ml=0,fl=0,vl=0,bl=0,kl=0,Ll=0,Dl=0,Nc=0;To.sort(shadowCastingAndTexturingLightsFirst);for(let C=0,Zc=To.length;C<Zc;C++){const jc=To[C],Zc=jc.color,eu=jc.intensity,Ku=jc.distance,Yu=jc.shadow&&jc.shadow.map?jc.shadow.map.texture:null;if(jc.isAmbientLight)Ro+=Zc.r*eu,Uo+=Zc.g*eu,Oo+=Zc.b*eu;else if(jc.isLightProbe){for(let C=0;C<9;C++)So.probe[C].addScaledVector(jc.sh.coefficients[C],eu);Nc++}else if(jc.isDirectionalLight){const C=Rn.get(jc);if(C.color.copy(jc.color).multiplyScalar(jc.intensity),jc.castShadow){const C=jc.shadow,Rn=or.get(jc);Rn.shadowIntensity=C.intensity,Rn.shadowBias=C.bias,Rn.shadowNormalBias=C.normalBias,Rn.shadowRadius=C.radius,Rn.shadowMapSize=C.mapSize,So.directionalShadow[Ho]=Rn,So.directionalShadowMap[Ho]=Yu,So.directionalShadowMatrix[Ho]=jc.shadow.matrix,vl++}So.directional[Ho]=C,Ho++}else if(jc.isSpotLight){const C=Rn.get(jc);C.position.setFromMatrixPosition(jc.matrixWorld),C.color.copy(Zc).multiplyScalar(eu),C.distance=Ku,C.coneCos=Math.cos(jc.angle),C.penumbraCos=Math.cos(jc.angle*(1-jc.penumbra)),C.decay=jc.decay,So.spot[dl]=C;const To=jc.shadow;if(jc.map&&(So.spotLightMap[Ll]=jc.map,Ll++,To.updateMatrices(jc),jc.castShadow&&Dl++),So.spotLightMatrix[dl]=To.matrix,jc.castShadow){const C=or.get(jc);C.shadowIntensity=To.intensity,C.shadowBias=To.bias,C.shadowNormalBias=To.normalBias,C.shadowRadius=To.radius,C.shadowMapSize=To.mapSize,So.spotShadow[dl]=C,So.spotShadowMap[dl]=Yu,kl++}dl++}else if(jc.isRectAreaLight){const C=Rn.get(jc);C.color.copy(Zc).multiplyScalar(eu),C.halfWidth.set(.5*jc.width,0,0),C.halfHeight.set(0,.5*jc.height,0),So.rectArea[ml]=C,ml++}else if(jc.isPointLight){const C=Rn.get(jc);if(C.color.copy(jc.color).multiplyScalar(jc.intensity),C.distance=jc.distance,C.decay=jc.decay,jc.castShadow){const C=jc.shadow,Rn=or.get(jc);Rn.shadowIntensity=C.intensity,Rn.shadowBias=C.bias,Rn.shadowNormalBias=C.normalBias,Rn.shadowRadius=C.radius,Rn.shadowMapSize=C.mapSize,Rn.shadowCameraNear=C.camera.near,Rn.shadowCameraFar=C.camera.far,So.pointShadow[qo]=Rn,So.pointShadowMap[qo]=Yu,So.pointShadowMatrix[qo]=jc.shadow.matrix,bl++}So.point[qo]=C,qo++}else if(jc.isHemisphereLight){const C=Rn.get(jc);C.skyColor.copy(jc.color).multiplyScalar(eu),C.groundColor.copy(jc.groundColor).multiplyScalar(eu),So.hemi[fl]=C,fl++}}ml>0&&(!0===C.has("OES_texture_float_linear")?(So.rectAreaLTC1=dg.LTC_FLOAT_1,So.rectAreaLTC2=dg.LTC_FLOAT_2):(So.rectAreaLTC1=dg.LTC_HALF_1,So.rectAreaLTC2=dg.LTC_HALF_2)),So.ambient[0]=Ro,So.ambient[1]=Uo,So.ambient[2]=Oo;const jc=So.hash;jc.directionalLength===Ho&&jc.pointLength===qo&&jc.spotLength===dl&&jc.rectAreaLength===ml&&jc.hemiLength===fl&&jc.numDirectionalShadows===vl&&jc.numPointShadows===bl&&jc.numSpotShadows===kl&&jc.numSpotMaps===Ll&&jc.numLightProbes===Nc||(So.directional.length=Ho,So.spot.length=dl,So.rectArea.length=ml,So.point.length=qo,So.hemi.length=fl,So.directionalShadow.length=vl,So.directionalShadowMap.length=vl,So.pointShadow.length=bl,So.pointShadowMap.length=bl,So.spotShadow.length=kl,So.spotShadowMap.length=kl,So.directionalShadowMatrix.length=vl,So.pointShadowMatrix.length=bl,So.spotLightMatrix.length=kl+Ll-Dl,So.spotLightMap.length=Ll,So.numSpotLightShadowsWithMaps=Dl,So.numLightProbes=Nc,jc.directionalLength=Ho,jc.pointLength=qo,jc.spotLength=dl,jc.rectAreaLength=ml,jc.hemiLength=fl,jc.numDirectionalShadows=vl,jc.numPointShadows=bl,jc.numSpotShadows=kl,jc.numSpotMaps=Ll,jc.numLightProbes=Nc,So.version=qg++)},setupView:function(C,Rn){let or=0,Oo=0,Ho=0,qo=0,dl=0;const ml=Rn.matrixWorldInverse;for(let fl=0,vl=C.length;fl<vl;fl++){const Rn=C[fl];if(Rn.isDirectionalLight){const C=So.directional[or];C.direction.setFromMatrixPosition(Rn.matrixWorld),To.setFromMatrixPosition(Rn.target.matrixWorld),C.direction.sub(To),C.direction.transformDirection(ml),or++}else if(Rn.isSpotLight){const C=So.spot[Ho];C.position.setFromMatrixPosition(Rn.matrixWorld),C.position.applyMatrix4(ml),C.direction.setFromMatrixPosition(Rn.matrixWorld),To.setFromMatrixPosition(Rn.target.matrixWorld),C.direction.sub(To),C.direction.transformDirection(ml),Ho++}else if(Rn.isRectAreaLight){const C=So.rectArea[qo];C.position.setFromMatrixPosition(Rn.matrixWorld),C.position.applyMatrix4(ml),Uo.identity(),Ro.copy(Rn.matrixWorld),Ro.premultiply(ml),Uo.extractRotation(Ro),C.halfWidth.set(.5*Rn.width,0,0),C.halfHeight.set(0,.5*Rn.height,0),C.halfWidth.applyMatrix4(Uo),C.halfHeight.applyMatrix4(Uo),qo++}else if(Rn.isPointLight){const C=So.point[Oo];C.position.setFromMatrixPosition(Rn.matrixWorld),C.position.applyMatrix4(ml),Oo++}else if(Rn.isHemisphereLight){const C=So.hemi[dl];C.direction.setFromMatrixPosition(Rn.matrixWorld),C.direction.transformDirection(ml),dl++}}},state:So}}function WebGLRenderState(C){const Rn=new WebGLLights(C),or=[],So=[];const To={lightsArray:or,shadowsArray:So,camera:null,lights:Rn,transmissionRenderTarget:{}};return{init:function(C){To.camera=C,or.length=0,So.length=0},state:To,setupLights:function(){Rn.setup(or)},setupLightsView:function(C){Rn.setupView(or,C)},pushLight:function(C){or.push(C)},pushShadow:function(C){So.push(C)}}}function WebGLRenderStates(C){let Rn=new WeakMap;return{get:function(or,So){void 0===So&&(So=0);const To=Rn.get(or);let Ro;return void 0===To?(Ro=new WebGLRenderState(C),Rn.set(or,[Ro])):So>=To.length?(Ro=new WebGLRenderState(C),To.push(Ro)):Ro=To[So],Ro},dispose:function(){Rn=new WeakMap}}}class MeshDepthMaterial extends Material{constructor(C){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(C)}copy(C){return super.copy(C),this.depthPacking=C.depthPacking,this.map=C.map,this.alphaMap=C.alphaMap,this.displacementMap=C.displacementMap,this.displacementScale=C.displacementScale,this.displacementBias=C.displacementBias,this.wireframe=C.wireframe,this.wireframeLinewidth=C.wireframeLinewidth,this}}class MeshDistanceMaterial extends Material{constructor(C){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(C)}copy(C){return super.copy(C),this.map=C.map,this.alphaMap=C.alphaMap,this.displacementMap=C.displacementMap,this.displacementScale=C.displacementScale,this.displacementBias=C.displacementBias,this}}const Kg="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Qg="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}";function WebGLShadowMap(C,Rn,or){let So=new Frustum;const To=new Vector2,Ro=new Vector2,Uo=new Vector4,Ho=new MeshDepthMaterial({depthPacking:Pp}),bl=new MeshDistanceMaterial,kl={},Ll=or.maxTextureSize,Dl={[dl]:ml,[ml]:dl,[fl]:fl},Nc=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:Kg,fragmentShader:Qg}),jc=Nc.clone();jc.defines.HORIZONTAL_PASS=1;const Zc=new BufferGeometry;Zc.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const eu=new Mesh(Zc,Nc),Ku=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Oo;let Yu=this.type;function VSMPass(or,So){const Ro=Rn.update(eu);Nc.defines.VSM_SAMPLES!==or.blurSamples&&(Nc.defines.VSM_SAMPLES=or.blurSamples,jc.defines.VSM_SAMPLES=or.blurSamples,Nc.needsUpdate=!0,jc.needsUpdate=!0),null===or.mapPass&&(or.mapPass=new WebGLRenderTarget(To.x,To.y)),Nc.uniforms.shadow_pass.value=or.map.texture,Nc.uniforms.resolution.value=or.mapSize,Nc.uniforms.radius.value=or.radius,C.setRenderTarget(or.mapPass),C.clear(),C.renderBufferDirect(So,null,Ro,Nc,eu,null),jc.uniforms.shadow_pass.value=or.mapPass.texture,jc.uniforms.resolution.value=or.mapSize,jc.uniforms.radius.value=or.radius,C.setRenderTarget(or.map),C.clear(),C.renderBufferDirect(So,null,Ro,jc,eu,null)}function getDepthMaterial(Rn,or,So,To){let Ro=null;const Uo=!0===So.isPointLight?Rn.customDistanceMaterial:Rn.customDepthMaterial;if(void 0!==Uo)Ro=Uo;else if(Ro=!0===So.isPointLight?bl:Ho,C.localClippingEnabled&&!0===or.clipShadows&&Array.isArray(or.clippingPlanes)&&0!==or.clippingPlanes.length||or.displacementMap&&0!==or.displacementScale||or.alphaMap&&or.alphaTest>0||or.map&&or.alphaTest>0){const C=Ro.uuid,Rn=or.uuid;let So=kl[C];void 0===So&&(So={},kl[C]=So);let To=So[Rn];void 0===To&&(To=Ro.clone(),So[Rn]=To,or.addEventListener("dispose",onMaterialDispose)),Ro=To}if(Ro.visible=or.visible,Ro.wireframe=or.wireframe,Ro.side=To===qo?null!==or.shadowSide?or.shadowSide:or.side:null!==or.shadowSide?or.shadowSide:Dl[or.side],Ro.alphaMap=or.alphaMap,Ro.alphaTest=or.alphaTest,Ro.map=or.map,Ro.clipShadows=or.clipShadows,Ro.clippingPlanes=or.clippingPlanes,Ro.clipIntersection=or.clipIntersection,Ro.displacementMap=or.displacementMap,Ro.displacementScale=or.displacementScale,Ro.displacementBias=or.displacementBias,Ro.wireframeLinewidth=or.wireframeLinewidth,Ro.linewidth=or.linewidth,!0===So.isPointLight&&!0===Ro.isMeshDistanceMaterial){C.properties.get(Ro).light=So}return Ro}function renderObject(or,To,Ro,Uo,Oo){if(!1===or.visible)return;if(or.layers.test(To.layers)&&(or.isMesh||or.isLine||or.isPoints)&&(or.castShadow||or.receiveShadow&&Oo===qo)&&(!or.frustumCulled||So.intersectsObject(or))){or.modelViewMatrix.multiplyMatrices(Ro.matrixWorldInverse,or.matrixWorld);const So=Rn.update(or),Ho=or.material;if(Array.isArray(Ho)){const Rn=So.groups;for(let qo=0,dl=Rn.length;qo<dl;qo++){const dl=Rn[qo],ml=Ho[dl.materialIndex];if(ml&&ml.visible){const Rn=getDepthMaterial(or,ml,Uo,Oo);or.onBeforeShadow(C,or,To,Ro,So,Rn,dl),C.renderBufferDirect(Ro,null,So,Rn,or,dl),or.onAfterShadow(C,or,To,Ro,So,Rn,dl)}}}else if(Ho.visible){const Rn=getDepthMaterial(or,Ho,Uo,Oo);or.onBeforeShadow(C,or,To,Ro,So,Rn,null),C.renderBufferDirect(Ro,null,So,Rn,or,null),or.onAfterShadow(C,or,To,Ro,So,Rn,null)}}const Ho=or.children;for(let C=0,Rn=Ho.length;C<Rn;C++)renderObject(Ho[C],To,Ro,Uo,Oo)}function onMaterialDispose(C){C.target.removeEventListener("dispose",onMaterialDispose);for(const Rn in kl){const or=kl[Rn],So=C.target.uuid;if(So in or){or[So].dispose(),delete or[So]}}}this.render=function(Rn,or,Oo){if(!1===Ku.enabled)return;if(!1===Ku.autoUpdate&&!1===Ku.needsUpdate)return;if(0===Rn.length)return;const Ho=C.getRenderTarget(),dl=C.getActiveCubeFace(),ml=C.getActiveMipmapLevel(),fl=C.state;fl.setBlending(vl),fl.buffers.color.setClear(1,1,1,1),fl.buffers.depth.setTest(!0),fl.setScissorTest(!1);const bl=Yu!==qo&&this.type===qo,kl=Yu===qo&&this.type!==qo;for(let vl=0,Dl=Rn.length;vl<Dl;vl++){const Ho=Rn[vl],dl=Ho.shadow;if(void 0===dl){console.warn("THREE.WebGLShadowMap:",Ho,"has no shadow.");continue}if(!1===dl.autoUpdate&&!1===dl.needsUpdate)continue;To.copy(dl.mapSize);const ml=dl.getFrameExtents();if(To.multiply(ml),Ro.copy(dl.mapSize),(To.x>Ll||To.y>Ll)&&(To.x>Ll&&(Ro.x=Math.floor(Ll/ml.x),To.x=Ro.x*ml.x,dl.mapSize.x=Ro.x),To.y>Ll&&(Ro.y=Math.floor(Ll/ml.y),To.y=Ro.y*ml.y,dl.mapSize.y=Ro.y)),null===dl.map||!0===bl||!0===kl){const C=this.type!==qo?{minFilter:yd,magFilter:yd}:{};null!==dl.map&&dl.map.dispose(),dl.map=new WebGLRenderTarget(To.x,To.y,C),dl.map.texture.name=Ho.name+".shadowMap",dl.camera.updateProjectionMatrix()}C.setRenderTarget(dl.map),C.clear();const Dl=dl.getViewportCount();for(let C=0;C<Dl;C++){const Rn=dl.getViewport(C);Uo.set(Ro.x*Rn.x,Ro.y*Rn.y,Ro.x*Rn.z,Ro.y*Rn.w),fl.viewport(Uo),dl.updateMatrices(Ho,C),So=dl.getFrustum(),renderObject(or,Oo,dl.camera,Ho,this.type)}!0!==dl.isPointLightShadow&&this.type===qo&&VSMPass(dl,Oo),dl.needsUpdate=!1}Yu=this.type,Ku.needsUpdate=!1,C.setRenderTarget(Ho,dl,ml)}}function WebGLState(C){const Rn=new function(){let Rn=!1;const or=new Vector4;let So=null;const To=new Vector4(0,0,0,0);return{setMask:function(or){So===or||Rn||(C.colorMask(or,or,or,or),So=or)},setLocked:function(C){Rn=C},setClear:function(Rn,So,Ro,Uo,Oo){!0===Oo&&(Rn*=Uo,So*=Uo,Ro*=Uo),or.set(Rn,So,Ro,Uo),!1===To.equals(or)&&(C.clearColor(Rn,So,Ro,Uo),To.copy(or))},reset:function(){Rn=!1,So=null,To.set(-1,0,0,0)}}},or=new function(){let Rn=!1,or=null,So=null,To=null;return{setTest:function(Rn){Rn?enable(C.DEPTH_TEST):disable(C.DEPTH_TEST)},setMask:function(So){or===So||Rn||(C.depthMask(So),or=So)},setFunc:function(Rn){if(So!==Rn){switch(Rn){case Zh:C.depthFunc(C.NEVER);break;case Wh:C.depthFunc(C.ALWAYS);break;case qh:C.depthFunc(C.LESS);break;case Kh:C.depthFunc(C.LEQUAL);break;case Qh:C.depthFunc(C.EQUAL);break;case Xh:C.depthFunc(C.GEQUAL);break;case Yh:C.depthFunc(C.GREATER);break;case Jh:C.depthFunc(C.NOTEQUAL);break;default:C.depthFunc(C.LEQUAL)}So=Rn}},setLocked:function(C){Rn=C},setClear:function(Rn){To!==Rn&&(C.clearDepth(Rn),To=Rn)},reset:function(){Rn=!1,or=null,So=null,To=null}}},So=new function(){let Rn=!1,or=null,So=null,To=null,Ro=null,Uo=null,Oo=null,Ho=null,qo=null;return{setTest:function(or){Rn||(or?enable(C.STENCIL_TEST):disable(C.STENCIL_TEST))},setMask:function(So){or===So||Rn||(C.stencilMask(So),or=So)},setFunc:function(Rn,or,Uo){So===Rn&&To===or&&Ro===Uo||(C.stencilFunc(Rn,or,Uo),So=Rn,To=or,Ro=Uo)},setOp:function(Rn,or,So){Uo===Rn&&Oo===or&&Ho===So||(C.stencilOp(Rn,or,So),Uo=Rn,Oo=or,Ho=So)},setLocked:function(C){Rn=C},setClear:function(Rn){qo!==Rn&&(C.clearStencil(Rn),qo=Rn)},reset:function(){Rn=!1,or=null,So=null,To=null,Ro=null,Uo=null,Oo=null,Ho=null,qo=null}}},Oo=new WeakMap,Ho=new WeakMap;let qo={},dl={},$h=new WeakMap,ed=[],td=null,id=!1,nd=null,rd=null,ad=null,sd=null,od=null,ld=null,cd=null,ud=new Color(0,0,0),hd=0,dd=!1,pd=null,md=null,fd=null,gd=null,Ad=null;const yd=C.getParameter(C.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let vd=!1,xd=0;const _d=C.getParameter(C.VERSION);-1!==_d.indexOf("WebGL")?(xd=parseFloat(/^WebGL (\d)/.exec(_d)[1]),vd=xd>=1):-1!==_d.indexOf("OpenGL ES")&&(xd=parseFloat(/^OpenGL ES (\d)/.exec(_d)[1]),vd=xd>=2);let bd=null,wd={};const Ed=C.getParameter(C.SCISSOR_BOX),Md=C.getParameter(C.VIEWPORT),Sd=(new Vector4).fromArray(Ed),kd=(new Vector4).fromArray(Md);function createTexture(Rn,or,So,To){const Ro=new Uint8Array(4),Uo=C.createTexture();C.bindTexture(Rn,Uo),C.texParameteri(Rn,C.TEXTURE_MIN_FILTER,C.NEAREST),C.texParameteri(Rn,C.TEXTURE_MAG_FILTER,C.NEAREST);for(let Oo=0;Oo<So;Oo++)Rn===C.TEXTURE_3D||Rn===C.TEXTURE_2D_ARRAY?C.texImage3D(or,0,C.RGBA,1,1,To,0,C.RGBA,C.UNSIGNED_BYTE,Ro):C.texImage2D(or+Oo,0,C.RGBA,1,1,0,C.RGBA,C.UNSIGNED_BYTE,Ro);return Uo}const Td={};function enable(Rn){!0!==qo[Rn]&&(C.enable(Rn),qo[Rn]=!0)}function disable(Rn){!1!==qo[Rn]&&(C.disable(Rn),qo[Rn]=!1)}Td[C.TEXTURE_2D]=createTexture(C.TEXTURE_2D,C.TEXTURE_2D,1),Td[C.TEXTURE_CUBE_MAP]=createTexture(C.TEXTURE_CUBE_MAP,C.TEXTURE_CUBE_MAP_POSITIVE_X,6),Td[C.TEXTURE_2D_ARRAY]=createTexture(C.TEXTURE_2D_ARRAY,C.TEXTURE_2D_ARRAY,1,1),Td[C.TEXTURE_3D]=createTexture(C.TEXTURE_3D,C.TEXTURE_3D,1,1),Rn.setClear(0,0,0,1),or.setClear(1),So.setClear(0),enable(C.DEPTH_TEST),or.setFunc(Kh),setFlipSided(!1),setCullFace(Ro),enable(C.CULL_FACE),setBlending(vl);const Id={[jc]:C.FUNC_ADD,[Zc]:C.FUNC_SUBTRACT,[eu]:C.FUNC_REVERSE_SUBTRACT};Id[Ku]=C.MIN,Id[Yu]=C.MAX;const Cd={[Eh]:C.ZERO,[Th]:C.ONE,[Ch]:C.SRC_COLOR,[Dh]:C.SRC_ALPHA,[Oh]:C.SRC_ALPHA_SATURATE,[Bh]:C.DST_COLOR,[Nh]:C.DST_ALPHA,[Lh]:C.ONE_MINUS_SRC_COLOR,[Rh]:C.ONE_MINUS_SRC_ALPHA,[Fh]:C.ONE_MINUS_DST_COLOR,[Uh]:C.ONE_MINUS_DST_ALPHA,[Vh]:C.CONSTANT_COLOR,[jh]:C.ONE_MINUS_CONSTANT_COLOR,[Gh]:C.CONSTANT_ALPHA,[Hh]:C.ONE_MINUS_CONSTANT_ALPHA};function setBlending(Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl){if(Rn!==vl){if(!1===id&&(enable(C.BLEND),id=!0),Rn===Nc)Ro=Ro||or,Uo=Uo||So,Oo=Oo||To,or===rd&&Ro===od||(C.blendEquationSeparate(Id[or],Id[Ro]),rd=or,od=Ro),So===ad&&To===sd&&Uo===ld&&Oo===cd||(C.blendFuncSeparate(Cd[So],Cd[To],Cd[Uo],Cd[Oo]),ad=So,sd=To,ld=Uo,cd=Oo),!1!==Ho.equals(ud)&&qo===hd||(C.blendColor(Ho.r,Ho.g,Ho.b,qo),ud.copy(Ho),hd=qo),nd=Rn,dd=!1;else if(Rn!==nd||dl!==dd){if(rd===jc&&od===jc||(C.blendEquation(C.FUNC_ADD),rd=jc,od=jc),dl)switch(Rn){case bl:C.blendFuncSeparate(C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA);break;case kl:C.blendFunc(C.ONE,C.ONE);break;case Ll:C.blendFuncSeparate(C.ZERO,C.ONE_MINUS_SRC_COLOR,C.ZERO,C.ONE);break;case Dl:C.blendFuncSeparate(C.ZERO,C.SRC_COLOR,C.ZERO,C.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",Rn)}else switch(Rn){case bl:C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA);break;case kl:C.blendFunc(C.SRC_ALPHA,C.ONE);break;case Ll:C.blendFuncSeparate(C.ZERO,C.ONE_MINUS_SRC_COLOR,C.ZERO,C.ONE);break;case Dl:C.blendFunc(C.ZERO,C.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",Rn)}ad=null,sd=null,ld=null,cd=null,ud.set(0,0,0),hd=0,nd=Rn,dd=dl}}else!0===id&&(disable(C.BLEND),id=!1)}function setFlipSided(Rn){pd!==Rn&&(Rn?C.frontFace(C.CW):C.frontFace(C.CCW),pd=Rn)}function setCullFace(Rn){Rn!==To?(enable(C.CULL_FACE),Rn!==md&&(Rn===Ro?C.cullFace(C.BACK):Rn===Uo?C.cullFace(C.FRONT):C.cullFace(C.FRONT_AND_BACK))):disable(C.CULL_FACE),md=Rn}function setPolygonOffset(Rn,or,So){Rn?(enable(C.POLYGON_OFFSET_FILL),gd===or&&Ad===So||(C.polygonOffset(or,So),gd=or,Ad=So)):disable(C.POLYGON_OFFSET_FILL)}return{buffers:{color:Rn,depth:or,stencil:So},enable:enable,disable:disable,bindFramebuffer:function(Rn,or){return dl[Rn]!==or&&(C.bindFramebuffer(Rn,or),dl[Rn]=or,Rn===C.DRAW_FRAMEBUFFER&&(dl[C.FRAMEBUFFER]=or),Rn===C.FRAMEBUFFER&&(dl[C.DRAW_FRAMEBUFFER]=or),!0)},drawBuffers:function(Rn,or){let So=ed,To=!1;if(Rn){So=$h.get(or),void 0===So&&(So=[],$h.set(or,So));const Ro=Rn.textures;if(So.length!==Ro.length||So[0]!==C.COLOR_ATTACHMENT0){for(let Rn=0,or=Ro.length;Rn<or;Rn++)So[Rn]=C.COLOR_ATTACHMENT0+Rn;So.length=Ro.length,To=!0}}else So[0]!==C.BACK&&(So[0]=C.BACK,To=!0);To&&C.drawBuffers(So)},useProgram:function(Rn){return td!==Rn&&(C.useProgram(Rn),td=Rn,!0)},setBlending:setBlending,setMaterial:function(To,Ro){To.side===fl?disable(C.CULL_FACE):enable(C.CULL_FACE);let Uo=To.side===ml;Ro&&(Uo=!Uo),setFlipSided(Uo),To.blending===bl&&!1===To.transparent?setBlending(vl):setBlending(To.blending,To.blendEquation,To.blendSrc,To.blendDst,To.blendEquationAlpha,To.blendSrcAlpha,To.blendDstAlpha,To.blendColor,To.blendAlpha,To.premultipliedAlpha),or.setFunc(To.depthFunc),or.setTest(To.depthTest),or.setMask(To.depthWrite),Rn.setMask(To.colorWrite);const Oo=To.stencilWrite;So.setTest(Oo),Oo&&(So.setMask(To.stencilWriteMask),So.setFunc(To.stencilFunc,To.stencilRef,To.stencilFuncMask),So.setOp(To.stencilFail,To.stencilZFail,To.stencilZPass)),setPolygonOffset(To.polygonOffset,To.polygonOffsetFactor,To.polygonOffsetUnits),!0===To.alphaToCoverage?enable(C.SAMPLE_ALPHA_TO_COVERAGE):disable(C.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:setFlipSided,setCullFace:setCullFace,setLineWidth:function(Rn){Rn!==fd&&(vd&&C.lineWidth(Rn),fd=Rn)},setPolygonOffset:setPolygonOffset,setScissorTest:function(Rn){Rn?enable(C.SCISSOR_TEST):disable(C.SCISSOR_TEST)},activeTexture:function(Rn){void 0===Rn&&(Rn=C.TEXTURE0+yd-1),bd!==Rn&&(C.activeTexture(Rn),bd=Rn)},bindTexture:function(Rn,or,So){void 0===So&&(So=null===bd?C.TEXTURE0+yd-1:bd);let To=wd[So];void 0===To&&(To={type:void 0,texture:void 0},wd[So]=To),To.type===Rn&&To.texture===or||(bd!==So&&(C.activeTexture(So),bd=So),C.bindTexture(Rn,or||Td[Rn]),To.type=Rn,To.texture=or)},unbindTexture:function(){const Rn=wd[bd];void 0!==Rn&&void 0!==Rn.type&&(C.bindTexture(Rn.type,null),Rn.type=void 0,Rn.texture=void 0)},compressedTexImage2D:function(){try{C.compressedTexImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},compressedTexImage3D:function(){try{C.compressedTexImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texImage2D:function(){try{C.texImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texImage3D:function(){try{C.texImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},updateUBOMapping:function(Rn,or){let So=Ho.get(or);void 0===So&&(So=new WeakMap,Ho.set(or,So));let To=So.get(Rn);void 0===To&&(To=C.getUniformBlockIndex(or,Rn.name),So.set(Rn,To))},uniformBlockBinding:function(Rn,or){const So=Ho.get(or).get(Rn);Oo.get(or)!==So&&(C.uniformBlockBinding(or,So,Rn.__bindingPointIndex),Oo.set(or,So))},texStorage2D:function(){try{C.texStorage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texStorage3D:function(){try{C.texStorage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texSubImage2D:function(){try{C.texSubImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texSubImage3D:function(){try{C.texSubImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},compressedTexSubImage2D:function(){try{C.compressedTexSubImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},compressedTexSubImage3D:function(){try{C.compressedTexSubImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},scissor:function(Rn){!1===Sd.equals(Rn)&&(C.scissor(Rn.x,Rn.y,Rn.z,Rn.w),Sd.copy(Rn))},viewport:function(Rn){!1===kd.equals(Rn)&&(C.viewport(Rn.x,Rn.y,Rn.z,Rn.w),kd.copy(Rn))},reset:function(){C.disable(C.BLEND),C.disable(C.CULL_FACE),C.disable(C.DEPTH_TEST),C.disable(C.POLYGON_OFFSET_FILL),C.disable(C.SCISSOR_TEST),C.disable(C.STENCIL_TEST),C.disable(C.SAMPLE_ALPHA_TO_COVERAGE),C.blendEquation(C.FUNC_ADD),C.blendFunc(C.ONE,C.ZERO),C.blendFuncSeparate(C.ONE,C.ZERO,C.ONE,C.ZERO),C.blendColor(0,0,0,0),C.colorMask(!0,!0,!0,!0),C.clearColor(0,0,0,0),C.depthMask(!0),C.depthFunc(C.LESS),C.clearDepth(1),C.stencilMask(4294967295),C.stencilFunc(C.ALWAYS,0,4294967295),C.stencilOp(C.KEEP,C.KEEP,C.KEEP),C.clearStencil(0),C.cullFace(C.BACK),C.frontFace(C.CCW),C.polygonOffset(0,0),C.activeTexture(C.TEXTURE0),C.bindFramebuffer(C.FRAMEBUFFER,null),C.bindFramebuffer(C.DRAW_FRAMEBUFFER,null),C.bindFramebuffer(C.READ_FRAMEBUFFER,null),C.useProgram(null),C.lineWidth(1),C.scissor(0,0,C.canvas.width,C.canvas.height),C.viewport(0,0,C.canvas.width,C.canvas.height),qo={},bd=null,wd={},dl={},$h=new WeakMap,ed=[],td=null,id=!1,nd=null,rd=null,ad=null,sd=null,od=null,ld=null,cd=null,ud=new Color(0,0,0),hd=0,dd=!1,pd=null,md=null,fd=null,gd=null,Ad=null,Sd.set(0,0,C.canvas.width,C.canvas.height),kd.set(0,0,C.canvas.width,C.canvas.height),Rn.reset(),or.reset(),So.reset()}}}function getByteLength(C,Rn,or,So){const To=function(C){switch(C){case Ed:case Md:return{byteLength:1,components:1};case kd:case Sd:case Ld:return{byteLength:2,components:1};case Pd:case zd:return{byteLength:2,components:4};case Id:case Td:case Cd:return{byteLength:4,components:1};case Rd:return{byteLength:4,components:3}}throw new Error("Unknown texture type "+C+".")}(So);switch(or){case Nd:case Fd:return C*Rn;case Od:return C*Rn*2;case Gd:case Hd:return C*Rn/To.components*To.byteLength;case Zd:case Wd:return C*Rn*2/To.components*To.byteLength;case Ud:return C*Rn*3/To.components*To.byteLength;case Bd:case qd:return C*Rn*4/To.components*To.byteLength;case Kd:case Qd:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*8;case Xd:case Yd:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*16;case $d:case tp:return Math.max(C,16)*Math.max(Rn,8)/4;case Jd:case ep:return Math.max(C,8)*Math.max(Rn,8)/2;case ip:case np:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*8;case rp:case ap:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*16;case sp:return Math.floor((C+4)/5)*Math.floor((Rn+3)/4)*16;case op:return Math.floor((C+4)/5)*Math.floor((Rn+4)/5)*16;case lp:return Math.floor((C+5)/6)*Math.floor((Rn+4)/5)*16;case cp:return Math.floor((C+5)/6)*Math.floor((Rn+5)/6)*16;case up:return Math.floor((C+7)/8)*Math.floor((Rn+4)/5)*16;case hp:return Math.floor((C+7)/8)*Math.floor((Rn+5)/6)*16;case dp:return Math.floor((C+7)/8)*Math.floor((Rn+7)/8)*16;case pp:return Math.floor((C+9)/10)*Math.floor((Rn+4)/5)*16;case mp:return Math.floor((C+9)/10)*Math.floor((Rn+5)/6)*16;case fp:return Math.floor((C+9)/10)*Math.floor((Rn+7)/8)*16;case gp:return Math.floor((C+9)/10)*Math.floor((Rn+9)/10)*16;case Ap:return Math.floor((C+11)/12)*Math.floor((Rn+9)/10)*16;case yp:return Math.floor((C+11)/12)*Math.floor((Rn+11)/12)*16;case vp:case xp:case _p:return Math.ceil(C/4)*Math.ceil(Rn/4)*16;case bp:case wp:return Math.ceil(C/4)*Math.ceil(Rn/4)*8;case Ep:case Mp:return Math.ceil(C/4)*Math.ceil(Rn/4)*16}throw new Error("Unable to determine texture byte length for "+or+" format.")}function WebGLTextures(C,Rn,or,So,To,Ro,Uo){const Oo=Rn.has("WEBGL_multisampled_render_to_texture")?Rn.get("WEBGL_multisampled_render_to_texture"):null,Ho="undefined"!==typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),qo=new Vector2,dl=new WeakMap;let ml;const fl=new WeakMap;let vl=!1;try{vl="undefined"!==typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(Zc){}function createCanvas(C,Rn){return vl?new OffscreenCanvas(C,Rn):createElementNS("canvas")}function resizeImage(C,Rn,or){let So=1;const To=getDimensions(C);if((To.width>or||To.height>or)&&(So=or/Math.max(To.width,To.height)),So<1){if("undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&C instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&C instanceof ImageBitmap||"undefined"!==typeof VideoFrame&&C instanceof VideoFrame){const or=Math.floor(So*To.width),Ro=Math.floor(So*To.height);void 0===ml&&(ml=createCanvas(or,Ro));const Uo=Rn?createCanvas(or,Ro):ml;Uo.width=or,Uo.height=Ro;return Uo.getContext("2d").drawImage(C,0,0,or,Ro),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+To.width+"x"+To.height+") to ("+or+"x"+Ro+")."),Uo}return"data"in C&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+To.width+"x"+To.height+")."),C}return C}function textureNeedsGenerateMipmaps(C){return C.generateMipmaps&&C.minFilter!==yd&&C.minFilter!==_d}function generateMipmap(Rn){C.generateMipmap(Rn)}function getInternalFormat(or,So,To,Ro,Uo){if(void 0===Uo&&(Uo=!1),null!==or){if(void 0!==C[or])return C[or];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+or+"'")}let Oo=So;if(So===C.RED&&(To===C.FLOAT&&(Oo=C.R32F),To===C.HALF_FLOAT&&(Oo=C.R16F),To===C.UNSIGNED_BYTE&&(Oo=C.R8)),So===C.RED_INTEGER&&(To===C.UNSIGNED_BYTE&&(Oo=C.R8UI),To===C.UNSIGNED_SHORT&&(Oo=C.R16UI),To===C.UNSIGNED_INT&&(Oo=C.R32UI),To===C.BYTE&&(Oo=C.R8I),To===C.SHORT&&(Oo=C.R16I),To===C.INT&&(Oo=C.R32I)),So===C.RG&&(To===C.FLOAT&&(Oo=C.RG32F),To===C.HALF_FLOAT&&(Oo=C.RG16F),To===C.UNSIGNED_BYTE&&(Oo=C.RG8)),So===C.RG_INTEGER&&(To===C.UNSIGNED_BYTE&&(Oo=C.RG8UI),To===C.UNSIGNED_SHORT&&(Oo=C.RG16UI),To===C.UNSIGNED_INT&&(Oo=C.RG32UI),To===C.BYTE&&(Oo=C.RG8I),To===C.SHORT&&(Oo=C.RG16I),To===C.INT&&(Oo=C.RG32I)),So===C.RGB&&To===C.UNSIGNED_INT_5_9_9_9_REV&&(Oo=C.RGB9_E5),So===C.RGBA){const Rn=Uo?Op:mm.getTransfer(Ro);To===C.FLOAT&&(Oo=C.RGBA32F),To===C.HALF_FLOAT&&(Oo=C.RGBA16F),To===C.UNSIGNED_BYTE&&(Oo=Rn===Vp?C.SRGB8_ALPHA8:C.RGBA8),To===C.UNSIGNED_SHORT_4_4_4_4&&(Oo=C.RGBA4),To===C.UNSIGNED_SHORT_5_5_5_1&&(Oo=C.RGB5_A1)}return Oo!==C.R16F&&Oo!==C.R32F&&Oo!==C.RG16F&&Oo!==C.RG32F&&Oo!==C.RGBA16F&&Oo!==C.RGBA32F||Rn.get("EXT_color_buffer_float"),Oo}function getInternalDepthFormat(Rn,or){let So;return Rn?null===or||or===Id||or===Dd?So=C.DEPTH24_STENCIL8:or===Cd?So=C.DEPTH32F_STENCIL8:or===kd&&(So=C.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===or||or===Id||or===Dd?So=C.DEPTH_COMPONENT24:or===Cd?So=C.DEPTH_COMPONENT32F:or===kd&&(So=C.DEPTH_COMPONENT16),So}function getMipLevels(C,Rn){return!0===textureNeedsGenerateMipmaps(C)||C.isFramebufferTexture&&C.minFilter!==yd&&C.minFilter!==_d?Math.log2(Math.max(Rn.width,Rn.height))+1:void 0!==C.mipmaps&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?Rn.mipmaps.length:1}function onTextureDispose(C){const Rn=C.target;Rn.removeEventListener("dispose",onTextureDispose),function(C){const Rn=So.get(C);if(void 0===Rn.__webglInit)return;const or=C.source,To=fl.get(or);if(To){const So=To[Rn.__cacheKey];So.usedTimes--,0===So.usedTimes&&deleteTexture(C),0===Object.keys(To).length&&fl.delete(or)}So.remove(C)}(Rn),Rn.isVideoTexture&&dl.delete(Rn)}function onRenderTargetDispose(Rn){const or=Rn.target;or.removeEventListener("dispose",onRenderTargetDispose),function(Rn){const or=So.get(Rn);Rn.depthTexture&&Rn.depthTexture.dispose();if(Rn.isWebGLCubeRenderTarget)for(let So=0;So<6;So++){if(Array.isArray(or.__webglFramebuffer[So]))for(let Rn=0;Rn<or.__webglFramebuffer[So].length;Rn++)C.deleteFramebuffer(or.__webglFramebuffer[So][Rn]);else C.deleteFramebuffer(or.__webglFramebuffer[So]);or.__webglDepthbuffer&&C.deleteRenderbuffer(or.__webglDepthbuffer[So])}else{if(Array.isArray(or.__webglFramebuffer))for(let Rn=0;Rn<or.__webglFramebuffer.length;Rn++)C.deleteFramebuffer(or.__webglFramebuffer[Rn]);else C.deleteFramebuffer(or.__webglFramebuffer);if(or.__webglDepthbuffer&&C.deleteRenderbuffer(or.__webglDepthbuffer),or.__webglMultisampledFramebuffer&&C.deleteFramebuffer(or.__webglMultisampledFramebuffer),or.__webglColorRenderbuffer)for(let Rn=0;Rn<or.__webglColorRenderbuffer.length;Rn++)or.__webglColorRenderbuffer[Rn]&&C.deleteRenderbuffer(or.__webglColorRenderbuffer[Rn]);or.__webglDepthRenderbuffer&&C.deleteRenderbuffer(or.__webglDepthRenderbuffer)}const To=Rn.textures;for(let Ro=0,Oo=To.length;Ro<Oo;Ro++){const Rn=So.get(To[Ro]);Rn.__webglTexture&&(C.deleteTexture(Rn.__webglTexture),Uo.memory.textures--),So.remove(To[Ro])}So.remove(Rn)}(or)}function deleteTexture(Rn){const or=So.get(Rn);C.deleteTexture(or.__webglTexture);const To=Rn.source;delete fl.get(To)[or.__cacheKey],Uo.memory.textures--}let bl=0;function setTexture2D(Rn,To){const Ro=So.get(Rn);if(Rn.isVideoTexture&&function(C){const Rn=Uo.render.frame;dl.get(C)!==Rn&&(dl.set(C,Rn),C.update())}(Rn),!1===Rn.isRenderTargetTexture&&Rn.version>0&&Ro.__version!==Rn.version){const C=Rn.image;if(null===C)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==C.complete)return void uploadTexture(Ro,Rn,To);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}or.bindTexture(C.TEXTURE_2D,Ro.__webglTexture,C.TEXTURE0+To)}const kl={[fd]:C.REPEAT,[gd]:C.CLAMP_TO_EDGE,[Ad]:C.MIRRORED_REPEAT},Ll={[yd]:C.NEAREST,[vd]:C.NEAREST_MIPMAP_NEAREST,[xd]:C.NEAREST_MIPMAP_LINEAR,[_d]:C.LINEAR,[bd]:C.LINEAR_MIPMAP_NEAREST,[wd]:C.LINEAR_MIPMAP_LINEAR},Dl={[Zp]:C.NEVER,[Jp]:C.ALWAYS,[Wp]:C.LESS,[Kp]:C.LEQUAL,[qp]:C.EQUAL,[Yp]:C.GEQUAL,[Qp]:C.GREATER,[Xp]:C.NOTEQUAL};function setTextureParameters(or,Ro){if(Ro.type!==Cd||!1!==Rn.has("OES_texture_float_linear")||Ro.magFilter!==_d&&Ro.magFilter!==bd&&Ro.magFilter!==xd&&Ro.magFilter!==wd&&Ro.minFilter!==_d&&Ro.minFilter!==bd&&Ro.minFilter!==xd&&Ro.minFilter!==wd||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),C.texParameteri(or,C.TEXTURE_WRAP_S,kl[Ro.wrapS]),C.texParameteri(or,C.TEXTURE_WRAP_T,kl[Ro.wrapT]),or!==C.TEXTURE_3D&&or!==C.TEXTURE_2D_ARRAY||C.texParameteri(or,C.TEXTURE_WRAP_R,kl[Ro.wrapR]),C.texParameteri(or,C.TEXTURE_MAG_FILTER,Ll[Ro.magFilter]),C.texParameteri(or,C.TEXTURE_MIN_FILTER,Ll[Ro.minFilter]),Ro.compareFunction&&(C.texParameteri(or,C.TEXTURE_COMPARE_MODE,C.COMPARE_REF_TO_TEXTURE),C.texParameteri(or,C.TEXTURE_COMPARE_FUNC,Dl[Ro.compareFunction])),!0===Rn.has("EXT_texture_filter_anisotropic")){if(Ro.magFilter===yd)return;if(Ro.minFilter!==xd&&Ro.minFilter!==wd)return;if(Ro.type===Cd&&!1===Rn.has("OES_texture_float_linear"))return;if(Ro.anisotropy>1||So.get(Ro).__currentAnisotropy){const Uo=Rn.get("EXT_texture_filter_anisotropic");C.texParameterf(or,Uo.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Ro.anisotropy,To.getMaxAnisotropy())),So.get(Ro).__currentAnisotropy=Ro.anisotropy}}}function initTexture(Rn,or){let So=!1;void 0===Rn.__webglInit&&(Rn.__webglInit=!0,or.addEventListener("dispose",onTextureDispose));const To=or.source;let Ro=fl.get(To);void 0===Ro&&(Ro={},fl.set(To,Ro));const Oo=function(C){const Rn=[];return Rn.push(C.wrapS),Rn.push(C.wrapT),Rn.push(C.wrapR||0),Rn.push(C.magFilter),Rn.push(C.minFilter),Rn.push(C.anisotropy),Rn.push(C.internalFormat),Rn.push(C.format),Rn.push(C.type),Rn.push(C.generateMipmaps),Rn.push(C.premultiplyAlpha),Rn.push(C.flipY),Rn.push(C.unpackAlignment),Rn.push(C.colorSpace),Rn.join()}(or);if(Oo!==Rn.__cacheKey){void 0===Ro[Oo]&&(Ro[Oo]={texture:C.createTexture(),usedTimes:0},Uo.memory.textures++,So=!0),Ro[Oo].usedTimes++;const To=Ro[Rn.__cacheKey];void 0!==To&&(Ro[Rn.__cacheKey].usedTimes--,0===To.usedTimes&&deleteTexture(or)),Rn.__cacheKey=Oo,Rn.__webglTexture=Ro[Oo].texture}return So}function uploadTexture(Rn,Uo,Oo){let Ho=C.TEXTURE_2D;(Uo.isDataArrayTexture||Uo.isCompressedArrayTexture)&&(Ho=C.TEXTURE_2D_ARRAY),Uo.isData3DTexture&&(Ho=C.TEXTURE_3D);const qo=initTexture(Rn,Uo),dl=Uo.source;or.bindTexture(Ho,Rn.__webglTexture,C.TEXTURE0+Oo);const ml=So.get(dl);if(dl.version!==ml.__version||!0===qo){or.activeTexture(C.TEXTURE0+Oo);const Rn=mm.getPrimaries(mm.workingColorSpace),So=Uo.colorSpace===Rp?null:mm.getPrimaries(Uo.colorSpace),fl=Uo.colorSpace===Rp||Rn===So?C.NONE:C.BROWSER_DEFAULT_WEBGL;C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,Uo.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Uo.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,Uo.unpackAlignment),C.pixelStorei(C.UNPACK_COLORSPACE_CONVERSION_WEBGL,fl);let vl=resizeImage(Uo.image,!1,To.maxTextureSize);vl=verifyColorSpace(Uo,vl);const bl=Ro.convert(Uo.format,Uo.colorSpace),kl=Ro.convert(Uo.type);let Ll,Dl=getInternalFormat(Uo.internalFormat,bl,kl,Uo.colorSpace,Uo.isVideoTexture);setTextureParameters(Ho,Uo);const Nc=Uo.mipmaps,jc=!0!==Uo.isVideoTexture,Zc=void 0===ml.__version||!0===qo,eu=dl.dataReady,Ku=getMipLevels(Uo,vl);if(Uo.isDepthTexture)Dl=getInternalDepthFormat(Uo.format===jd,Uo.type),Zc&&(jc?or.texStorage2D(C.TEXTURE_2D,1,Dl,vl.width,vl.height):or.texImage2D(C.TEXTURE_2D,0,Dl,vl.width,vl.height,0,bl,kl,null));else if(Uo.isDataTexture)if(Nc.length>0){jc&&Zc&&or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Nc[0].width,Nc[0].height);for(let Rn=0,So=Nc.length;Rn<So;Rn++)Ll=Nc[Rn],jc?eu&&or.texSubImage2D(C.TEXTURE_2D,Rn,0,0,Ll.width,Ll.height,bl,kl,Ll.data):or.texImage2D(C.TEXTURE_2D,Rn,Dl,Ll.width,Ll.height,0,bl,kl,Ll.data);Uo.generateMipmaps=!1}else jc?(Zc&&or.texStorage2D(C.TEXTURE_2D,Ku,Dl,vl.width,vl.height),eu&&or.texSubImage2D(C.TEXTURE_2D,0,0,0,vl.width,vl.height,bl,kl,vl.data)):or.texImage2D(C.TEXTURE_2D,0,Dl,vl.width,vl.height,0,bl,kl,vl.data);else if(Uo.isCompressedTexture)if(Uo.isCompressedArrayTexture){jc&&Zc&&or.texStorage3D(C.TEXTURE_2D_ARRAY,Ku,Dl,Nc[0].width,Nc[0].height,vl.depth);for(let Rn=0,So=Nc.length;Rn<So;Rn++)if(Ll=Nc[Rn],Uo.format!==Bd)if(null!==bl)if(jc){if(eu)if(Uo.layerUpdates.size>0){const So=getByteLength(Ll.width,Ll.height,Uo.format,Uo.type);for(const To of Uo.layerUpdates){const Ro=Ll.data.subarray(To*So/Ll.data.BYTES_PER_ELEMENT,(To+1)*So/Ll.data.BYTES_PER_ELEMENT);or.compressedTexSubImage3D(C.TEXTURE_2D_ARRAY,Rn,0,0,To,Ll.width,Ll.height,1,bl,Ro,0,0)}Uo.clearLayerUpdates()}else or.compressedTexSubImage3D(C.TEXTURE_2D_ARRAY,Rn,0,0,0,Ll.width,Ll.height,vl.depth,bl,Ll.data,0,0)}else or.compressedTexImage3D(C.TEXTURE_2D_ARRAY,Rn,Dl,Ll.width,Ll.height,vl.depth,0,Ll.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else jc?eu&&or.texSubImage3D(C.TEXTURE_2D_ARRAY,Rn,0,0,0,Ll.width,Ll.height,vl.depth,bl,kl,Ll.data):or.texImage3D(C.TEXTURE_2D_ARRAY,Rn,Dl,Ll.width,Ll.height,vl.depth,0,bl,kl,Ll.data)}else{jc&&Zc&&or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Nc[0].width,Nc[0].height);for(let Rn=0,So=Nc.length;Rn<So;Rn++)Ll=Nc[Rn],Uo.format!==Bd?null!==bl?jc?eu&&or.compressedTexSubImage2D(C.TEXTURE_2D,Rn,0,0,Ll.width,Ll.height,bl,Ll.data):or.compressedTexImage2D(C.TEXTURE_2D,Rn,Dl,Ll.width,Ll.height,0,Ll.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):jc?eu&&or.texSubImage2D(C.TEXTURE_2D,Rn,0,0,Ll.width,Ll.height,bl,kl,Ll.data):or.texImage2D(C.TEXTURE_2D,Rn,Dl,Ll.width,Ll.height,0,bl,kl,Ll.data)}else if(Uo.isDataArrayTexture)if(jc){if(Zc&&or.texStorage3D(C.TEXTURE_2D_ARRAY,Ku,Dl,vl.width,vl.height,vl.depth),eu)if(Uo.layerUpdates.size>0){const Rn=getByteLength(vl.width,vl.height,Uo.format,Uo.type);for(const So of Uo.layerUpdates){const To=vl.data.subarray(So*Rn/vl.data.BYTES_PER_ELEMENT,(So+1)*Rn/vl.data.BYTES_PER_ELEMENT);or.texSubImage3D(C.TEXTURE_2D_ARRAY,0,0,0,So,vl.width,vl.height,1,bl,kl,To)}Uo.clearLayerUpdates()}else or.texSubImage3D(C.TEXTURE_2D_ARRAY,0,0,0,0,vl.width,vl.height,vl.depth,bl,kl,vl.data)}else or.texImage3D(C.TEXTURE_2D_ARRAY,0,Dl,vl.width,vl.height,vl.depth,0,bl,kl,vl.data);else if(Uo.isData3DTexture)jc?(Zc&&or.texStorage3D(C.TEXTURE_3D,Ku,Dl,vl.width,vl.height,vl.depth),eu&&or.texSubImage3D(C.TEXTURE_3D,0,0,0,0,vl.width,vl.height,vl.depth,bl,kl,vl.data)):or.texImage3D(C.TEXTURE_3D,0,Dl,vl.width,vl.height,vl.depth,0,bl,kl,vl.data);else if(Uo.isFramebufferTexture){if(Zc)if(jc)or.texStorage2D(C.TEXTURE_2D,Ku,Dl,vl.width,vl.height);else{let Rn=vl.width,So=vl.height;for(let To=0;To<Ku;To++)or.texImage2D(C.TEXTURE_2D,To,Dl,Rn,So,0,bl,kl,null),Rn>>=1,So>>=1}}else if(Nc.length>0){if(jc&&Zc){const Rn=getDimensions(Nc[0]);or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Rn.width,Rn.height)}for(let Rn=0,So=Nc.length;Rn<So;Rn++)Ll=Nc[Rn],jc?eu&&or.texSubImage2D(C.TEXTURE_2D,Rn,0,0,bl,kl,Ll):or.texImage2D(C.TEXTURE_2D,Rn,Dl,bl,kl,Ll);Uo.generateMipmaps=!1}else if(jc){if(Zc){const Rn=getDimensions(vl);or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Rn.width,Rn.height)}eu&&or.texSubImage2D(C.TEXTURE_2D,0,0,0,bl,kl,vl)}else or.texImage2D(C.TEXTURE_2D,0,Dl,bl,kl,vl);textureNeedsGenerateMipmaps(Uo)&&generateMipmap(Ho),ml.__version=dl.version,Uo.onUpdate&&Uo.onUpdate(Uo)}Rn.__version=Uo.version}function setupFrameBufferTexture(Rn,To,Uo,Ho,qo,dl){const ml=Ro.convert(Uo.format,Uo.colorSpace),fl=Ro.convert(Uo.type),vl=getInternalFormat(Uo.internalFormat,ml,fl,Uo.colorSpace);if(!So.get(To).__hasExternalTextures){const Rn=Math.max(1,To.width>>dl),So=Math.max(1,To.height>>dl);qo===C.TEXTURE_3D||qo===C.TEXTURE_2D_ARRAY?or.texImage3D(qo,dl,vl,Rn,So,To.depth,0,ml,fl,null):or.texImage2D(qo,dl,vl,Rn,So,0,ml,fl,null)}or.bindFramebuffer(C.FRAMEBUFFER,Rn),useMultisampledRTT(To)?Oo.framebufferTexture2DMultisampleEXT(C.FRAMEBUFFER,Ho,qo,So.get(Uo).__webglTexture,0,getRenderTargetSamples(To)):(qo===C.TEXTURE_2D||qo>=C.TEXTURE_CUBE_MAP_POSITIVE_X&&qo<=C.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&C.framebufferTexture2D(C.FRAMEBUFFER,Ho,qo,So.get(Uo).__webglTexture,dl),or.bindFramebuffer(C.FRAMEBUFFER,null)}function setupRenderBufferStorage(Rn,or,So){if(C.bindRenderbuffer(C.RENDERBUFFER,Rn),or.depthBuffer){const To=or.depthTexture,Ro=To&&To.isDepthTexture?To.type:null,Uo=getInternalDepthFormat(or.stencilBuffer,Ro),Ho=or.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,qo=getRenderTargetSamples(or);useMultisampledRTT(or)?Oo.renderbufferStorageMultisampleEXT(C.RENDERBUFFER,qo,Uo,or.width,or.height):So?C.renderbufferStorageMultisample(C.RENDERBUFFER,qo,Uo,or.width,or.height):C.renderbufferStorage(C.RENDERBUFFER,Uo,or.width,or.height),C.framebufferRenderbuffer(C.FRAMEBUFFER,Ho,C.RENDERBUFFER,Rn)}else{const Rn=or.textures;for(let To=0;To<Rn.length;To++){const Uo=Rn[To],Ho=Ro.convert(Uo.format,Uo.colorSpace),qo=Ro.convert(Uo.type),dl=getInternalFormat(Uo.internalFormat,Ho,qo,Uo.colorSpace),ml=getRenderTargetSamples(or);So&&!1===useMultisampledRTT(or)?C.renderbufferStorageMultisample(C.RENDERBUFFER,ml,dl,or.width,or.height):useMultisampledRTT(or)?Oo.renderbufferStorageMultisampleEXT(C.RENDERBUFFER,ml,dl,or.width,or.height):C.renderbufferStorage(C.RENDERBUFFER,dl,or.width,or.height)}}C.bindRenderbuffer(C.RENDERBUFFER,null)}function setupDepthRenderbuffer(Rn){const To=So.get(Rn),Ro=!0===Rn.isWebGLCubeRenderTarget;if(To.__boundDepthTexture!==Rn.depthTexture){const C=Rn.depthTexture;if(To.__depthDisposeCallback&&To.__depthDisposeCallback(),C){const disposeEvent=()=>{delete To.__boundDepthTexture,delete To.__depthDisposeCallback,C.removeEventListener("dispose",disposeEvent)};C.addEventListener("dispose",disposeEvent),To.__depthDisposeCallback=disposeEvent}To.__boundDepthTexture=C}if(Rn.depthTexture&&!To.__autoAllocateDepthBuffer){if(Ro)throw new Error("target.depthTexture not supported in Cube render targets");!function(Rn,To){if(To&&To.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(or.bindFramebuffer(C.FRAMEBUFFER,Rn),!To.depthTexture||!To.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");So.get(To.depthTexture).__webglTexture&&To.depthTexture.image.width===To.width&&To.depthTexture.image.height===To.height||(To.depthTexture.image.width=To.width,To.depthTexture.image.height=To.height,To.depthTexture.needsUpdate=!0),setTexture2D(To.depthTexture,0);const Ro=So.get(To.depthTexture).__webglTexture,Uo=getRenderTargetSamples(To);if(To.depthTexture.format===Vd)useMultisampledRTT(To)?Oo.framebufferTexture2DMultisampleEXT(C.FRAMEBUFFER,C.DEPTH_ATTACHMENT,C.TEXTURE_2D,Ro,0,Uo):C.framebufferTexture2D(C.FRAMEBUFFER,C.DEPTH_ATTACHMENT,C.TEXTURE_2D,Ro,0);else{if(To.depthTexture.format!==jd)throw new Error("Unknown depthTexture format");useMultisampledRTT(To)?Oo.framebufferTexture2DMultisampleEXT(C.FRAMEBUFFER,C.DEPTH_STENCIL_ATTACHMENT,C.TEXTURE_2D,Ro,0,Uo):C.framebufferTexture2D(C.FRAMEBUFFER,C.DEPTH_STENCIL_ATTACHMENT,C.TEXTURE_2D,Ro,0)}}(To.__webglFramebuffer,Rn)}else if(Ro){To.__webglDepthbuffer=[];for(let So=0;So<6;So++)if(or.bindFramebuffer(C.FRAMEBUFFER,To.__webglFramebuffer[So]),void 0===To.__webglDepthbuffer[So])To.__webglDepthbuffer[So]=C.createRenderbuffer(),setupRenderBufferStorage(To.__webglDepthbuffer[So],Rn,!1);else{const or=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,Ro=To.__webglDepthbuffer[So];C.bindRenderbuffer(C.RENDERBUFFER,Ro),C.framebufferRenderbuffer(C.FRAMEBUFFER,or,C.RENDERBUFFER,Ro)}}else if(or.bindFramebuffer(C.FRAMEBUFFER,To.__webglFramebuffer),void 0===To.__webglDepthbuffer)To.__webglDepthbuffer=C.createRenderbuffer(),setupRenderBufferStorage(To.__webglDepthbuffer,Rn,!1);else{const or=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,So=To.__webglDepthbuffer;C.bindRenderbuffer(C.RENDERBUFFER,So),C.framebufferRenderbuffer(C.FRAMEBUFFER,or,C.RENDERBUFFER,So)}or.bindFramebuffer(C.FRAMEBUFFER,null)}const Nc=[],jc=[];function getRenderTargetSamples(C){return Math.min(To.maxSamples,C.samples)}function useMultisampledRTT(C){const or=So.get(C);return C.samples>0&&!0===Rn.has("WEBGL_multisampled_render_to_texture")&&!1!==or.__useRenderToTexture}function verifyColorSpace(C,Rn){const or=C.colorSpace,So=C.format,To=C.type;return!0===C.isCompressedTexture||!0===C.isVideoTexture||or!==Up&&or!==Rp&&(mm.getTransfer(or)===Vp?So===Bd&&To===Ed||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",or)),Rn}function getDimensions(C){return"undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement?(qo.width=C.naturalWidth||C.width,qo.height=C.naturalHeight||C.height):"undefined"!==typeof VideoFrame&&C instanceof VideoFrame?(qo.width=C.displayWidth,qo.height=C.displayHeight):(qo.width=C.width,qo.height=C.height),qo}this.allocateTextureUnit=function(){const C=bl;return C>=To.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+To.maxTextures),bl+=1,C},this.resetTextureUnits=function(){bl=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function(Rn,To){const Ro=So.get(Rn);Rn.version>0&&Ro.__version!==Rn.version?uploadTexture(Ro,Rn,To):or.bindTexture(C.TEXTURE_2D_ARRAY,Ro.__webglTexture,C.TEXTURE0+To)},this.setTexture3D=function(Rn,To){const Ro=So.get(Rn);Rn.version>0&&Ro.__version!==Rn.version?uploadTexture(Ro,Rn,To):or.bindTexture(C.TEXTURE_3D,Ro.__webglTexture,C.TEXTURE0+To)},this.setTextureCube=function(Rn,Uo){const Oo=So.get(Rn);Rn.version>0&&Oo.__version!==Rn.version?function(Rn,Uo,Oo){if(6!==Uo.image.length)return;const Ho=initTexture(Rn,Uo),qo=Uo.source;or.bindTexture(C.TEXTURE_CUBE_MAP,Rn.__webglTexture,C.TEXTURE0+Oo);const dl=So.get(qo);if(qo.version!==dl.__version||!0===Ho){or.activeTexture(C.TEXTURE0+Oo);const Rn=mm.getPrimaries(mm.workingColorSpace),So=Uo.colorSpace===Rp?null:mm.getPrimaries(Uo.colorSpace),ml=Uo.colorSpace===Rp||Rn===So?C.NONE:C.BROWSER_DEFAULT_WEBGL;C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,Uo.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Uo.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,Uo.unpackAlignment),C.pixelStorei(C.UNPACK_COLORSPACE_CONVERSION_WEBGL,ml);const fl=Uo.isCompressedTexture||Uo.image[0].isCompressedTexture,vl=Uo.image[0]&&Uo.image[0].isDataTexture,bl=[];for(let C=0;C<6;C++)bl[C]=fl||vl?vl?Uo.image[C].image:Uo.image[C]:resizeImage(Uo.image[C],!0,To.maxCubemapSize),bl[C]=verifyColorSpace(Uo,bl[C]);const kl=bl[0],Ll=Ro.convert(Uo.format,Uo.colorSpace),Dl=Ro.convert(Uo.type),Nc=getInternalFormat(Uo.internalFormat,Ll,Dl,Uo.colorSpace),jc=!0!==Uo.isVideoTexture,Zc=void 0===dl.__version||!0===Ho,eu=qo.dataReady;let Ku,Yu=getMipLevels(Uo,kl);if(setTextureParameters(C.TEXTURE_CUBE_MAP,Uo),fl){jc&&Zc&&or.texStorage2D(C.TEXTURE_CUBE_MAP,Yu,Nc,kl.width,kl.height);for(let Rn=0;Rn<6;Rn++){Ku=bl[Rn].mipmaps;for(let So=0;So<Ku.length;So++){const To=Ku[So];Uo.format!==Bd?null!==Ll?jc?eu&&or.compressedTexSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,0,0,To.width,To.height,Ll,To.data):or.compressedTexImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,Nc,To.width,To.height,0,To.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,0,0,To.width,To.height,Ll,Dl,To.data):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,Nc,To.width,To.height,0,Ll,Dl,To.data)}}}else{if(Ku=Uo.mipmaps,jc&&Zc){Ku.length>0&&Yu++;const Rn=getDimensions(bl[0]);or.texStorage2D(C.TEXTURE_CUBE_MAP,Yu,Nc,Rn.width,Rn.height)}for(let Rn=0;Rn<6;Rn++)if(vl){jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,0,0,bl[Rn].width,bl[Rn].height,Ll,Dl,bl[Rn].data):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,Nc,bl[Rn].width,bl[Rn].height,0,Ll,Dl,bl[Rn].data);for(let So=0;So<Ku.length;So++){const To=Ku[So].image[Rn].image;jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,0,0,To.width,To.height,Ll,Dl,To.data):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,Nc,To.width,To.height,0,Ll,Dl,To.data)}}else{jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,0,0,Ll,Dl,bl[Rn]):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,Nc,Ll,Dl,bl[Rn]);for(let So=0;So<Ku.length;So++){const To=Ku[So];jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,0,0,Ll,Dl,To.image[Rn]):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,Nc,Ll,Dl,To.image[Rn])}}}textureNeedsGenerateMipmaps(Uo)&&generateMipmap(C.TEXTURE_CUBE_MAP),dl.__version=qo.version,Uo.onUpdate&&Uo.onUpdate(Uo)}Rn.__version=Uo.version}(Oo,Rn,Uo):or.bindTexture(C.TEXTURE_CUBE_MAP,Oo.__webglTexture,C.TEXTURE0+Uo)},this.rebindTextures=function(Rn,or,To){const Ro=So.get(Rn);void 0!==or&&setupFrameBufferTexture(Ro.__webglFramebuffer,Rn,Rn.texture,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,0),void 0!==To&&setupDepthRenderbuffer(Rn)},this.setupRenderTarget=function(Rn){const To=Rn.texture,Oo=So.get(Rn),Ho=So.get(To);Rn.addEventListener("dispose",onRenderTargetDispose);const qo=Rn.textures,dl=!0===Rn.isWebGLCubeRenderTarget,ml=qo.length>1;if(ml||(void 0===Ho.__webglTexture&&(Ho.__webglTexture=C.createTexture()),Ho.__version=To.version,Uo.memory.textures++),dl){Oo.__webglFramebuffer=[];for(let Rn=0;Rn<6;Rn++)if(To.mipmaps&&To.mipmaps.length>0){Oo.__webglFramebuffer[Rn]=[];for(let or=0;or<To.mipmaps.length;or++)Oo.__webglFramebuffer[Rn][or]=C.createFramebuffer()}else Oo.__webglFramebuffer[Rn]=C.createFramebuffer()}else{if(To.mipmaps&&To.mipmaps.length>0){Oo.__webglFramebuffer=[];for(let Rn=0;Rn<To.mipmaps.length;Rn++)Oo.__webglFramebuffer[Rn]=C.createFramebuffer()}else Oo.__webglFramebuffer=C.createFramebuffer();if(ml)for(let Rn=0,or=qo.length;Rn<or;Rn++){const or=So.get(qo[Rn]);void 0===or.__webglTexture&&(or.__webglTexture=C.createTexture(),Uo.memory.textures++)}if(Rn.samples>0&&!1===useMultisampledRTT(Rn)){Oo.__webglMultisampledFramebuffer=C.createFramebuffer(),Oo.__webglColorRenderbuffer=[],or.bindFramebuffer(C.FRAMEBUFFER,Oo.__webglMultisampledFramebuffer);for(let or=0;or<qo.length;or++){const So=qo[or];Oo.__webglColorRenderbuffer[or]=C.createRenderbuffer(),C.bindRenderbuffer(C.RENDERBUFFER,Oo.__webglColorRenderbuffer[or]);const To=Ro.convert(So.format,So.colorSpace),Uo=Ro.convert(So.type),Ho=getInternalFormat(So.internalFormat,To,Uo,So.colorSpace,!0===Rn.isXRRenderTarget),dl=getRenderTargetSamples(Rn);C.renderbufferStorageMultisample(C.RENDERBUFFER,dl,Ho,Rn.width,Rn.height),C.framebufferRenderbuffer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0+or,C.RENDERBUFFER,Oo.__webglColorRenderbuffer[or])}C.bindRenderbuffer(C.RENDERBUFFER,null),Rn.depthBuffer&&(Oo.__webglDepthRenderbuffer=C.createRenderbuffer(),setupRenderBufferStorage(Oo.__webglDepthRenderbuffer,Rn,!0)),or.bindFramebuffer(C.FRAMEBUFFER,null)}}if(dl){or.bindTexture(C.TEXTURE_CUBE_MAP,Ho.__webglTexture),setTextureParameters(C.TEXTURE_CUBE_MAP,To);for(let or=0;or<6;or++)if(To.mipmaps&&To.mipmaps.length>0)for(let So=0;So<To.mipmaps.length;So++)setupFrameBufferTexture(Oo.__webglFramebuffer[or][So],Rn,To,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+or,So);else setupFrameBufferTexture(Oo.__webglFramebuffer[or],Rn,To,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+or,0);textureNeedsGenerateMipmaps(To)&&generateMipmap(C.TEXTURE_CUBE_MAP),or.unbindTexture()}else if(ml){for(let To=0,Ro=qo.length;To<Ro;To++){const Ro=qo[To],Uo=So.get(Ro);or.bindTexture(C.TEXTURE_2D,Uo.__webglTexture),setTextureParameters(C.TEXTURE_2D,Ro),setupFrameBufferTexture(Oo.__webglFramebuffer,Rn,Ro,C.COLOR_ATTACHMENT0+To,C.TEXTURE_2D,0),textureNeedsGenerateMipmaps(Ro)&&generateMipmap(C.TEXTURE_2D)}or.unbindTexture()}else{let So=C.TEXTURE_2D;if((Rn.isWebGL3DRenderTarget||Rn.isWebGLArrayRenderTarget)&&(So=Rn.isWebGL3DRenderTarget?C.TEXTURE_3D:C.TEXTURE_2D_ARRAY),or.bindTexture(So,Ho.__webglTexture),setTextureParameters(So,To),To.mipmaps&&To.mipmaps.length>0)for(let or=0;or<To.mipmaps.length;or++)setupFrameBufferTexture(Oo.__webglFramebuffer[or],Rn,To,C.COLOR_ATTACHMENT0,So,or);else setupFrameBufferTexture(Oo.__webglFramebuffer,Rn,To,C.COLOR_ATTACHMENT0,So,0);textureNeedsGenerateMipmaps(To)&&generateMipmap(So),or.unbindTexture()}Rn.depthBuffer&&setupDepthRenderbuffer(Rn)},this.updateRenderTargetMipmap=function(Rn){const To=Rn.textures;for(let Ro=0,Uo=To.length;Ro<Uo;Ro++){const Uo=To[Ro];if(textureNeedsGenerateMipmaps(Uo)){const To=Rn.isWebGLCubeRenderTarget?C.TEXTURE_CUBE_MAP:C.TEXTURE_2D,Ro=So.get(Uo).__webglTexture;or.bindTexture(To,Ro),generateMipmap(To),or.unbindTexture()}}},this.updateMultisampleRenderTarget=function(Rn){if(Rn.samples>0)if(!1===useMultisampledRTT(Rn)){const To=Rn.textures,Ro=Rn.width,Uo=Rn.height;let Oo=C.COLOR_BUFFER_BIT;const qo=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,dl=So.get(Rn),ml=To.length>1;if(ml)for(let Rn=0;Rn<To.length;Rn++)or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglMultisampledFramebuffer),C.framebufferRenderbuffer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.RENDERBUFFER,null),or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglFramebuffer),C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.TEXTURE_2D,null,0);or.bindFramebuffer(C.READ_FRAMEBUFFER,dl.__webglMultisampledFramebuffer),or.bindFramebuffer(C.DRAW_FRAMEBUFFER,dl.__webglFramebuffer);for(let or=0;or<To.length;or++){if(Rn.resolveDepthBuffer&&(Rn.depthBuffer&&(Oo|=C.DEPTH_BUFFER_BIT),Rn.stencilBuffer&&Rn.resolveStencilBuffer&&(Oo|=C.STENCIL_BUFFER_BIT)),ml){C.framebufferRenderbuffer(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.RENDERBUFFER,dl.__webglColorRenderbuffer[or]);const Rn=So.get(To[or]).__webglTexture;C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,Rn,0)}C.blitFramebuffer(0,0,Ro,Uo,0,0,Ro,Uo,Oo,C.NEAREST),!0===Ho&&(Nc.length=0,jc.length=0,Nc.push(C.COLOR_ATTACHMENT0+or),Rn.depthBuffer&&!1===Rn.resolveDepthBuffer&&(Nc.push(qo),jc.push(qo),C.invalidateFramebuffer(C.DRAW_FRAMEBUFFER,jc)),C.invalidateFramebuffer(C.READ_FRAMEBUFFER,Nc))}if(or.bindFramebuffer(C.READ_FRAMEBUFFER,null),or.bindFramebuffer(C.DRAW_FRAMEBUFFER,null),ml)for(let Rn=0;Rn<To.length;Rn++){or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglMultisampledFramebuffer),C.framebufferRenderbuffer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.RENDERBUFFER,dl.__webglColorRenderbuffer[Rn]);const Ro=So.get(To[Rn]).__webglTexture;or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglFramebuffer),C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.TEXTURE_2D,Ro,0)}or.bindFramebuffer(C.DRAW_FRAMEBUFFER,dl.__webglMultisampledFramebuffer)}else if(Rn.depthBuffer&&!1===Rn.resolveDepthBuffer&&Ho){const or=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT;C.invalidateFramebuffer(C.DRAW_FRAMEBUFFER,[or])}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(C,Rn){return{convert:function(or,So){let To;void 0===So&&(So=Rp);const Ro=mm.getTransfer(So);if(or===Ed)return C.UNSIGNED_BYTE;if(or===Pd)return C.UNSIGNED_SHORT_4_4_4_4;if(or===zd)return C.UNSIGNED_SHORT_5_5_5_1;if(or===Rd)return C.UNSIGNED_INT_5_9_9_9_REV;if(or===Md)return C.BYTE;if(or===Sd)return C.SHORT;if(or===kd)return C.UNSIGNED_SHORT;if(or===Td)return C.INT;if(or===Id)return C.UNSIGNED_INT;if(or===Cd)return C.FLOAT;if(or===Ld)return C.HALF_FLOAT;if(or===Nd)return C.ALPHA;if(or===Ud)return C.RGB;if(or===Bd)return C.RGBA;if(or===Fd)return C.LUMINANCE;if(or===Od)return C.LUMINANCE_ALPHA;if(or===Vd)return C.DEPTH_COMPONENT;if(or===jd)return C.DEPTH_STENCIL;if(or===Gd)return C.RED;if(or===Hd)return C.RED_INTEGER;if(or===Zd)return C.RG;if(or===Wd)return C.RG_INTEGER;if(or===qd)return C.RGBA_INTEGER;if(or===Kd||or===Qd||or===Xd||or===Yd)if(Ro===Vp){if(To=Rn.get("WEBGL_compressed_texture_s3tc_srgb"),null===To)return null;if(or===Kd)return To.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(or===Qd)return To.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(or===Xd)return To.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(or===Yd)return To.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(To=Rn.get("WEBGL_compressed_texture_s3tc"),null===To)return null;if(or===Kd)return To.COMPRESSED_RGB_S3TC_DXT1_EXT;if(or===Qd)return To.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(or===Xd)return To.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(or===Yd)return To.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(or===Jd||or===$d||or===ep||or===tp){if(To=Rn.get("WEBGL_compressed_texture_pvrtc"),null===To)return null;if(or===Jd)return To.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(or===$d)return To.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(or===ep)return To.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(or===tp)return To.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(or===ip||or===np||or===rp){if(To=Rn.get("WEBGL_compressed_texture_etc"),null===To)return null;if(or===ip||or===np)return Ro===Vp?To.COMPRESSED_SRGB8_ETC2:To.COMPRESSED_RGB8_ETC2;if(or===rp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:To.COMPRESSED_RGBA8_ETC2_EAC}if(or===ap||or===sp||or===op||or===lp||or===cp||or===up||or===hp||or===dp||or===pp||or===mp||or===fp||or===gp||or===Ap||or===yp){if(To=Rn.get("WEBGL_compressed_texture_astc"),null===To)return null;if(or===ap)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:To.COMPRESSED_RGBA_ASTC_4x4_KHR;if(or===sp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:To.COMPRESSED_RGBA_ASTC_5x4_KHR;if(or===op)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:To.COMPRESSED_RGBA_ASTC_5x5_KHR;if(or===lp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:To.COMPRESSED_RGBA_ASTC_6x5_KHR;if(or===cp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:To.COMPRESSED_RGBA_ASTC_6x6_KHR;if(or===up)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:To.COMPRESSED_RGBA_ASTC_8x5_KHR;if(or===hp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:To.COMPRESSED_RGBA_ASTC_8x6_KHR;if(or===dp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:To.COMPRESSED_RGBA_ASTC_8x8_KHR;if(or===pp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:To.COMPRESSED_RGBA_ASTC_10x5_KHR;if(or===mp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:To.COMPRESSED_RGBA_ASTC_10x6_KHR;if(or===fp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:To.COMPRESSED_RGBA_ASTC_10x8_KHR;if(or===gp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:To.COMPRESSED_RGBA_ASTC_10x10_KHR;if(or===Ap)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:To.COMPRESSED_RGBA_ASTC_12x10_KHR;if(or===yp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:To.COMPRESSED_RGBA_ASTC_12x12_KHR}if(or===vp||or===xp||or===_p){if(To=Rn.get("EXT_texture_compression_bptc"),null===To)return null;if(or===vp)return Ro===Vp?To.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:To.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(or===xp)return To.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(or===_p)return To.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(or===bp||or===wp||or===Ep||or===Mp){if(To=Rn.get("EXT_texture_compression_rgtc"),null===To)return null;if(or===vp)return To.COMPRESSED_RED_RGTC1_EXT;if(or===wp)return To.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(or===Ep)return To.COMPRESSED_RED_GREEN_RGTC2_EXT;if(or===Mp)return To.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return or===Dd?C.UNSIGNED_INT_24_8:void 0!==C[or]?C[or]:null}}}class ArrayCamera extends PerspectiveCamera{constructor(C){void 0===C&&(C=[]),super(),this.isArrayCamera=!0,this.cameras=C}}class Group extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Xg={type:"move"};class WebXRController{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Group,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 Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(C){return null!==this._targetRay&&this._targetRay.dispatchEvent(C),null!==this._grip&&this._grip.dispatchEvent(C),null!==this._hand&&this._hand.dispatchEvent(C),this}connect(C){if(C&&C.hand){const Rn=this._hand;if(Rn)for(const or of C.hand.values())this._getHandJoint(Rn,or)}return this.dispatchEvent({type:"connected",data:C}),this}disconnect(C){return this.dispatchEvent({type:"disconnected",data:C}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(C,Rn,or){let So=null,To=null,Ro=null;const Uo=this._targetRay,Oo=this._grip,Ho=this._hand;if(C&&"visible-blurred"!==Rn.session.visibilityState){if(Ho&&C.hand){Ro=!0;for(const Ro of C.hand.values()){const C=Rn.getJointPose(Ro,or),So=this._getHandJoint(Ho,Ro);null!==C&&(So.matrix.fromArray(C.transform.matrix),So.matrix.decompose(So.position,So.rotation,So.scale),So.matrixWorldNeedsUpdate=!0,So.jointRadius=C.radius),So.visible=null!==C}const So=Ho.joints["index-finger-tip"],To=Ho.joints["thumb-tip"],Uo=So.position.distanceTo(To.position),Oo=.02,qo=.005;Ho.inputState.pinching&&Uo>Oo+qo?(Ho.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:C.handedness,target:this})):!Ho.inputState.pinching&&Uo<=Oo-qo&&(Ho.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:C.handedness,target:this}))}else null!==Oo&&C.gripSpace&&(To=Rn.getPose(C.gripSpace,or),null!==To&&(Oo.matrix.fromArray(To.transform.matrix),Oo.matrix.decompose(Oo.position,Oo.rotation,Oo.scale),Oo.matrixWorldNeedsUpdate=!0,To.linearVelocity?(Oo.hasLinearVelocity=!0,Oo.linearVelocity.copy(To.linearVelocity)):Oo.hasLinearVelocity=!1,To.angularVelocity?(Oo.hasAngularVelocity=!0,Oo.angularVelocity.copy(To.angularVelocity)):Oo.hasAngularVelocity=!1));null!==Uo&&(So=Rn.getPose(C.targetRaySpace,or),null===So&&null!==To&&(So=To),null!==So&&(Uo.matrix.fromArray(So.transform.matrix),Uo.matrix.decompose(Uo.position,Uo.rotation,Uo.scale),Uo.matrixWorldNeedsUpdate=!0,So.linearVelocity?(Uo.hasLinearVelocity=!0,Uo.linearVelocity.copy(So.linearVelocity)):Uo.hasLinearVelocity=!1,So.angularVelocity?(Uo.hasAngularVelocity=!0,Uo.angularVelocity.copy(So.angularVelocity)):Uo.hasAngularVelocity=!1,this.dispatchEvent(Xg)))}return null!==Uo&&(Uo.visible=null!==So),null!==Oo&&(Oo.visible=null!==To),null!==Ho&&(Ho.visible=null!==Ro),this}_getHandJoint(C,Rn){if(void 0===C.joints[Rn.jointName]){const or=new Group;or.matrixAutoUpdate=!1,or.visible=!1,C.joints[Rn.jointName]=or,C.add(or)}return C.joints[Rn.jointName]}}class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(C,Rn,or){if(null===this.texture){const So=new Texture;C.properties.get(So).__webglTexture=Rn.texture,Rn.depthNear==or.depthNear&&Rn.depthFar==or.depthFar||(this.depthNear=Rn.depthNear,this.depthFar=Rn.depthFar),this.texture=So}}getMesh(C){if(null!==this.texture&&null===this.mesh){const Rn=C.cameras[0].viewport,or=new ShaderMaterial({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:Rn.z},depthHeight:{value:Rn.w}}});this.mesh=new Mesh(new PlaneGeometry(20,20),or)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class WebXRManager extends EventDispatcher{constructor(C,Rn){super();const or=this;let So=null,To=1,Ro=null,Uo="local-floor",Oo=1,Ho=null,qo=null,dl=null,ml=null,fl=null,vl=null;const bl=new WebXRDepthSensing,kl=Rn.getContextAttributes();let Ll=null,Dl=null;const Nc=[],jc=[],Zc=new Vector2;let eu=null;const Ku=new PerspectiveCamera;Ku.layers.enable(1),Ku.viewport=new Vector4;const Yu=new PerspectiveCamera;Yu.layers.enable(2),Yu.viewport=new Vector4;const Eh=[Ku,Yu],Th=new ArrayCamera;Th.layers.enable(1),Th.layers.enable(2);let Ch=null,Lh=null;function onSessionEvent(C){const Rn=jc.indexOf(C.inputSource);if(-1===Rn)return;const or=Nc[Rn];void 0!==or&&(or.update(C.inputSource,C.frame,Ho||Ro),or.dispatchEvent({type:C.type,data:C.inputSource}))}function onSessionEnd(){So.removeEventListener("select",onSessionEvent),So.removeEventListener("selectstart",onSessionEvent),So.removeEventListener("selectend",onSessionEvent),So.removeEventListener("squeeze",onSessionEvent),So.removeEventListener("squeezestart",onSessionEvent),So.removeEventListener("squeezeend",onSessionEvent),So.removeEventListener("end",onSessionEnd),So.removeEventListener("inputsourceschange",onInputSourcesChange);for(let C=0;C<Nc.length;C++){const Rn=jc[C];null!==Rn&&(jc[C]=null,Nc[C].disconnect(Rn))}Ch=null,Lh=null,bl.reset(),C.setRenderTarget(Ll),fl=null,ml=null,dl=null,So=null,Dl=null,Uh.stop(),or.isPresenting=!1,C.setPixelRatio(eu),C.setSize(Zc.width,Zc.height,!1),or.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(C){for(let Rn=0;Rn<C.removed.length;Rn++){const or=C.removed[Rn],So=jc.indexOf(or);So>=0&&(jc[So]=null,Nc[So].disconnect(or))}for(let Rn=0;Rn<C.added.length;Rn++){const or=C.added[Rn];let So=jc.indexOf(or);if(-1===So){for(let C=0;C<Nc.length;C++){if(C>=jc.length){jc.push(or),So=C;break}if(null===jc[C]){jc[C]=or,So=C;break}}if(-1===So)break}const To=Nc[So];To&&To.connect(or)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(C){let Rn=Nc[C];return void 0===Rn&&(Rn=new WebXRController,Nc[C]=Rn),Rn.getTargetRaySpace()},this.getControllerGrip=function(C){let Rn=Nc[C];return void 0===Rn&&(Rn=new WebXRController,Nc[C]=Rn),Rn.getGripSpace()},this.getHand=function(C){let Rn=Nc[C];return void 0===Rn&&(Rn=new WebXRController,Nc[C]=Rn),Rn.getHandSpace()},this.setFramebufferScaleFactor=function(C){To=C,!0===or.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(C){Uo=C,!0===or.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return Ho||Ro},this.setReferenceSpace=function(C){Ho=C},this.getBaseLayer=function(){return null!==ml?ml:fl},this.getBinding=function(){return dl},this.getFrame=function(){return vl},this.getSession=function(){return So},this.setSession=async function(qo){if(So=qo,null!==So){if(Ll=C.getRenderTarget(),So.addEventListener("select",onSessionEvent),So.addEventListener("selectstart",onSessionEvent),So.addEventListener("selectend",onSessionEvent),So.addEventListener("squeeze",onSessionEvent),So.addEventListener("squeezestart",onSessionEvent),So.addEventListener("squeezeend",onSessionEvent),So.addEventListener("end",onSessionEnd),So.addEventListener("inputsourceschange",onInputSourcesChange),!0!==kl.xrCompatible&&await Rn.makeXRCompatible(),eu=C.getPixelRatio(),C.getSize(Zc),void 0===So.renderState.layers){const or={antialias:kl.antialias,alpha:!0,depth:kl.depth,stencil:kl.stencil,framebufferScaleFactor:To};fl=new XRWebGLLayer(So,Rn,or),So.updateRenderState({baseLayer:fl}),C.setPixelRatio(1),C.setSize(fl.framebufferWidth,fl.framebufferHeight,!1),Dl=new WebGLRenderTarget(fl.framebufferWidth,fl.framebufferHeight,{format:Bd,type:Ed,colorSpace:C.outputColorSpace,stencilBuffer:kl.stencil})}else{let or=null,Ro=null,Uo=null;kl.depth&&(Uo=kl.stencil?Rn.DEPTH24_STENCIL8:Rn.DEPTH_COMPONENT24,or=kl.stencil?jd:Vd,Ro=kl.stencil?Dd:Id);const Oo={colorFormat:Rn.RGBA8,depthFormat:Uo,scaleFactor:To};dl=new XRWebGLBinding(So,Rn),ml=dl.createProjectionLayer(Oo),So.updateRenderState({layers:[ml]}),C.setPixelRatio(1),C.setSize(ml.textureWidth,ml.textureHeight,!1),Dl=new WebGLRenderTarget(ml.textureWidth,ml.textureHeight,{format:Bd,type:Ed,depthTexture:new DepthTexture(ml.textureWidth,ml.textureHeight,Ro,void 0,void 0,void 0,void 0,void 0,void 0,or),stencilBuffer:kl.stencil,colorSpace:C.outputColorSpace,samples:kl.antialias?4:0,resolveDepthBuffer:!1===ml.ignoreDepthValues})}Dl.isXRRenderTarget=!0,this.setFoveation(Oo),Ho=null,Ro=await So.requestReferenceSpace(Uo),Uh.setContext(So),Uh.start(),or.isPresenting=!0,or.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==So)return So.environmentBlendMode},this.getDepthTexture=function(){return bl.getDepthTexture()};const Dh=new Vector3,Rh=new Vector3;function updateCamera(C,Rn){null===Rn?C.matrixWorld.copy(C.matrix):C.matrixWorld.multiplyMatrices(Rn.matrixWorld,C.matrix),C.matrixWorldInverse.copy(C.matrixWorld).invert()}this.updateCamera=function(C){if(null===So)return;let Rn=C.near,or=C.far;null!==bl.texture&&(bl.depthNear>0&&(Rn=bl.depthNear),bl.depthFar>0&&(or=bl.depthFar)),Th.near=Yu.near=Ku.near=Rn,Th.far=Yu.far=Ku.far=or,Ch===Th.near&&Lh===Th.far||(So.updateRenderState({depthNear:Th.near,depthFar:Th.far}),Ch=Th.near,Lh=Th.far);const To=C.parent,Ro=Th.cameras;updateCamera(Th,To);for(let So=0;So<Ro.length;So++)updateCamera(Ro[So],To);2===Ro.length?function(C,Rn,or){Dh.setFromMatrixPosition(Rn.matrixWorld),Rh.setFromMatrixPosition(or.matrixWorld);const So=Dh.distanceTo(Rh),To=Rn.projectionMatrix.elements,Ro=or.projectionMatrix.elements,Uo=To[14]/(To[10]-1),Oo=To[14]/(To[10]+1),Ho=(To[9]+1)/To[5],qo=(To[9]-1)/To[5],dl=(To[8]-1)/To[0],ml=(Ro[8]+1)/Ro[0],fl=Uo*dl,vl=Uo*ml,bl=So/(-dl+ml),kl=bl*-dl;if(Rn.matrixWorld.decompose(C.position,C.quaternion,C.scale),C.translateX(kl),C.translateZ(bl),C.matrixWorld.compose(C.position,C.quaternion,C.scale),C.matrixWorldInverse.copy(C.matrixWorld).invert(),-1===To[10])C.projectionMatrix.copy(Rn.projectionMatrix),C.projectionMatrixInverse.copy(Rn.projectionMatrixInverse);else{const Rn=Uo+bl,or=Oo+bl,To=fl-kl,Ro=vl+(So-kl),dl=Ho*Oo/or*Rn,ml=qo*Oo/or*Rn;C.projectionMatrix.makePerspective(To,Ro,dl,ml,Rn,or),C.projectionMatrixInverse.copy(C.projectionMatrix).invert()}}(Th,Ku,Yu):Th.projectionMatrix.copy(Ku.projectionMatrix),function(C,Rn,or){null===or?C.matrix.copy(Rn.matrixWorld):(C.matrix.copy(or.matrixWorld),C.matrix.invert(),C.matrix.multiply(Rn.matrixWorld));C.matrix.decompose(C.position,C.quaternion,C.scale),C.updateMatrixWorld(!0),C.projectionMatrix.copy(Rn.projectionMatrix),C.projectionMatrixInverse.copy(Rn.projectionMatrixInverse),C.isPerspectiveCamera&&(C.fov=2*sm*Math.atan(1/C.projectionMatrix.elements[5]),C.zoom=1)}(C,Th,To)},this.getCamera=function(){return Th},this.getFoveation=function(){if(null!==ml||null!==fl)return Oo},this.setFoveation=function(C){Oo=C,null!==ml&&(ml.fixedFoveation=C),null!==fl&&void 0!==fl.fixedFoveation&&(fl.fixedFoveation=C)},this.hasDepthSensing=function(){return null!==bl.texture},this.getDepthSensingMesh=function(){return bl.getMesh(Th)};let Nh=null;const Uh=new WebGLAnimation;Uh.setAnimationLoop((function(Rn,To){if(qo=To.getViewerPose(Ho||Ro),vl=To,null!==qo){const Rn=qo.views;null!==fl&&(C.setRenderTargetFramebuffer(Dl,fl.framebuffer),C.setRenderTarget(Dl));let or=!1;Rn.length!==Th.cameras.length&&(Th.cameras.length=0,or=!0);for(let So=0;So<Rn.length;So++){const To=Rn[So];let Ro=null;if(null!==fl)Ro=fl.getViewport(To);else{const Rn=dl.getViewSubImage(ml,To);Ro=Rn.viewport,0===So&&(C.setRenderTargetTextures(Dl,Rn.colorTexture,ml.ignoreDepthValues?void 0:Rn.depthStencilTexture),C.setRenderTarget(Dl))}let Uo=Eh[So];void 0===Uo&&(Uo=new PerspectiveCamera,Uo.layers.enable(So),Uo.viewport=new Vector4,Eh[So]=Uo),Uo.matrix.fromArray(To.transform.matrix),Uo.matrix.decompose(Uo.position,Uo.quaternion,Uo.scale),Uo.projectionMatrix.fromArray(To.projectionMatrix),Uo.projectionMatrixInverse.copy(Uo.projectionMatrix).invert(),Uo.viewport.set(Ro.x,Ro.y,Ro.width,Ro.height),0===So&&(Th.matrix.copy(Uo.matrix),Th.matrix.decompose(Th.position,Th.quaternion,Th.scale)),!0===or&&Th.cameras.push(Uo)}const To=So.enabledFeatures;if(To&&To.includes("depth-sensing")){const or=dl.getDepthInformation(Rn[0]);or&&or.isValid&&or.texture&&bl.init(C,or,So.renderState)}}for(let C=0;C<Nc.length;C++){const Rn=jc[C],or=Nc[C];null!==Rn&&void 0!==or&&or.update(Rn,To,Ho||Ro)}Nh&&Nh(Rn,To),To.detectedPlanes&&or.dispatchEvent({type:"planesdetected",data:To}),vl=null})),this.setAnimationLoop=function(C){Nh=C},this.dispose=function(){}}}const Yg=new Euler,Jg=new Matrix4;function WebGLMaterials(C,Rn){function refreshTransformUniform(C,Rn){!0===C.matrixAutoUpdate&&C.updateMatrix(),Rn.value.copy(C.matrix)}function refreshUniformsCommon(C,or){C.opacity.value=or.opacity,or.color&&C.diffuse.value.copy(or.color),or.emissive&&C.emissive.value.copy(or.emissive).multiplyScalar(or.emissiveIntensity),or.map&&(C.map.value=or.map,refreshTransformUniform(or.map,C.mapTransform)),or.alphaMap&&(C.alphaMap.value=or.alphaMap,refreshTransformUniform(or.alphaMap,C.alphaMapTransform)),or.bumpMap&&(C.bumpMap.value=or.bumpMap,refreshTransformUniform(or.bumpMap,C.bumpMapTransform),C.bumpScale.value=or.bumpScale,or.side===ml&&(C.bumpScale.value*=-1)),or.normalMap&&(C.normalMap.value=or.normalMap,refreshTransformUniform(or.normalMap,C.normalMapTransform),C.normalScale.value.copy(or.normalScale),or.side===ml&&C.normalScale.value.negate()),or.displacementMap&&(C.displacementMap.value=or.displacementMap,refreshTransformUniform(or.displacementMap,C.displacementMapTransform),C.displacementScale.value=or.displacementScale,C.displacementBias.value=or.displacementBias),or.emissiveMap&&(C.emissiveMap.value=or.emissiveMap,refreshTransformUniform(or.emissiveMap,C.emissiveMapTransform)),or.specularMap&&(C.specularMap.value=or.specularMap,refreshTransformUniform(or.specularMap,C.specularMapTransform)),or.alphaTest>0&&(C.alphaTest.value=or.alphaTest);const So=Rn.get(or),To=So.envMap,Ro=So.envMapRotation;To&&(C.envMap.value=To,Yg.copy(Ro),Yg.x*=-1,Yg.y*=-1,Yg.z*=-1,To.isCubeTexture&&!1===To.isRenderTargetTexture&&(Yg.y*=-1,Yg.z*=-1),C.envMapRotation.value.setFromMatrix4(Jg.makeRotationFromEuler(Yg)),C.flipEnvMap.value=To.isCubeTexture&&!1===To.isRenderTargetTexture?-1:1,C.reflectivity.value=or.reflectivity,C.ior.value=or.ior,C.refractionRatio.value=or.refractionRatio),or.lightMap&&(C.lightMap.value=or.lightMap,C.lightMapIntensity.value=or.lightMapIntensity,refreshTransformUniform(or.lightMap,C.lightMapTransform)),or.aoMap&&(C.aoMap.value=or.aoMap,C.aoMapIntensity.value=or.aoMapIntensity,refreshTransformUniform(or.aoMap,C.aoMapTransform))}return{refreshFogUniforms:function(Rn,or){or.color.getRGB(Rn.fogColor.value,getUnlitUniformColorSpace(C)),or.isFog?(Rn.fogNear.value=or.near,Rn.fogFar.value=or.far):or.isFogExp2&&(Rn.fogDensity.value=or.density)},refreshMaterialUniforms:function(C,or,So,To,Ro){or.isMeshBasicMaterial||or.isMeshLambertMaterial?refreshUniformsCommon(C,or):or.isMeshToonMaterial?(refreshUniformsCommon(C,or),function(C,Rn){Rn.gradientMap&&(C.gradientMap.value=Rn.gradientMap)}(C,or)):or.isMeshPhongMaterial?(refreshUniformsCommon(C,or),function(C,Rn){C.specular.value.copy(Rn.specular),C.shininess.value=Math.max(Rn.shininess,1e-4)}(C,or)):or.isMeshStandardMaterial?(refreshUniformsCommon(C,or),function(C,Rn){C.metalness.value=Rn.metalness,Rn.metalnessMap&&(C.metalnessMap.value=Rn.metalnessMap,refreshTransformUniform(Rn.metalnessMap,C.metalnessMapTransform));C.roughness.value=Rn.roughness,Rn.roughnessMap&&(C.roughnessMap.value=Rn.roughnessMap,refreshTransformUniform(Rn.roughnessMap,C.roughnessMapTransform));Rn.envMap&&(C.envMapIntensity.value=Rn.envMapIntensity)}(C,or),or.isMeshPhysicalMaterial&&function(C,Rn,or){C.ior.value=Rn.ior,Rn.sheen>0&&(C.sheenColor.value.copy(Rn.sheenColor).multiplyScalar(Rn.sheen),C.sheenRoughness.value=Rn.sheenRoughness,Rn.sheenColorMap&&(C.sheenColorMap.value=Rn.sheenColorMap,refreshTransformUniform(Rn.sheenColorMap,C.sheenColorMapTransform)),Rn.sheenRoughnessMap&&(C.sheenRoughnessMap.value=Rn.sheenRoughnessMap,refreshTransformUniform(Rn.sheenRoughnessMap,C.sheenRoughnessMapTransform)));Rn.clearcoat>0&&(C.clearcoat.value=Rn.clearcoat,C.clearcoatRoughness.value=Rn.clearcoatRoughness,Rn.clearcoatMap&&(C.clearcoatMap.value=Rn.clearcoatMap,refreshTransformUniform(Rn.clearcoatMap,C.clearcoatMapTransform)),Rn.clearcoatRoughnessMap&&(C.clearcoatRoughnessMap.value=Rn.clearcoatRoughnessMap,refreshTransformUniform(Rn.clearcoatRoughnessMap,C.clearcoatRoughnessMapTransform)),Rn.clearcoatNormalMap&&(C.clearcoatNormalMap.value=Rn.clearcoatNormalMap,refreshTransformUniform(Rn.clearcoatNormalMap,C.clearcoatNormalMapTransform),C.clearcoatNormalScale.value.copy(Rn.clearcoatNormalScale),Rn.side===ml&&C.clearcoatNormalScale.value.negate()));Rn.dispersion>0&&(C.dispersion.value=Rn.dispersion);Rn.iridescence>0&&(C.iridescence.value=Rn.iridescence,C.iridescenceIOR.value=Rn.iridescenceIOR,C.iridescenceThicknessMinimum.value=Rn.iridescenceThicknessRange[0],C.iridescenceThicknessMaximum.value=Rn.iridescenceThicknessRange[1],Rn.iridescenceMap&&(C.iridescenceMap.value=Rn.iridescenceMap,refreshTransformUniform(Rn.iridescenceMap,C.iridescenceMapTransform)),Rn.iridescenceThicknessMap&&(C.iridescenceThicknessMap.value=Rn.iridescenceThicknessMap,refreshTransformUniform(Rn.iridescenceThicknessMap,C.iridescenceThicknessMapTransform)));Rn.transmission>0&&(C.transmission.value=Rn.transmission,C.transmissionSamplerMap.value=or.texture,C.transmissionSamplerSize.value.set(or.width,or.height),Rn.transmissionMap&&(C.transmissionMap.value=Rn.transmissionMap,refreshTransformUniform(Rn.transmissionMap,C.transmissionMapTransform)),C.thickness.value=Rn.thickness,Rn.thicknessMap&&(C.thicknessMap.value=Rn.thicknessMap,refreshTransformUniform(Rn.thicknessMap,C.thicknessMapTransform)),C.attenuationDistance.value=Rn.attenuationDistance,C.attenuationColor.value.copy(Rn.attenuationColor));Rn.anisotropy>0&&(C.anisotropyVector.value.set(Rn.anisotropy*Math.cos(Rn.anisotropyRotation),Rn.anisotropy*Math.sin(Rn.anisotropyRotation)),Rn.anisotropyMap&&(C.anisotropyMap.value=Rn.anisotropyMap,refreshTransformUniform(Rn.anisotropyMap,C.anisotropyMapTransform)));C.specularIntensity.value=Rn.specularIntensity,C.specularColor.value.copy(Rn.specularColor),Rn.specularColorMap&&(C.specularColorMap.value=Rn.specularColorMap,refreshTransformUniform(Rn.specularColorMap,C.specularColorMapTransform));Rn.specularIntensityMap&&(C.specularIntensityMap.value=Rn.specularIntensityMap,refreshTransformUniform(Rn.specularIntensityMap,C.specularIntensityMapTransform))}(C,or,Ro)):or.isMeshMatcapMaterial?(refreshUniformsCommon(C,or),function(C,Rn){Rn.matcap&&(C.matcap.value=Rn.matcap)}(C,or)):or.isMeshDepthMaterial?refreshUniformsCommon(C,or):or.isMeshDistanceMaterial?(refreshUniformsCommon(C,or),function(C,or){const So=Rn.get(or).light;C.referencePosition.value.setFromMatrixPosition(So.matrixWorld),C.nearDistance.value=So.shadow.camera.near,C.farDistance.value=So.shadow.camera.far}(C,or)):or.isMeshNormalMaterial?refreshUniformsCommon(C,or):or.isLineBasicMaterial?(function(C,Rn){C.diffuse.value.copy(Rn.color),C.opacity.value=Rn.opacity,Rn.map&&(C.map.value=Rn.map,refreshTransformUniform(Rn.map,C.mapTransform))}(C,or),or.isLineDashedMaterial&&function(C,Rn){C.dashSize.value=Rn.dashSize,C.totalSize.value=Rn.dashSize+Rn.gapSize,C.scale.value=Rn.scale}(C,or)):or.isPointsMaterial?function(C,Rn,or,So){C.diffuse.value.copy(Rn.color),C.opacity.value=Rn.opacity,C.size.value=Rn.size*or,C.scale.value=.5*So,Rn.map&&(C.map.value=Rn.map,refreshTransformUniform(Rn.map,C.uvTransform));Rn.alphaMap&&(C.alphaMap.value=Rn.alphaMap,refreshTransformUniform(Rn.alphaMap,C.alphaMapTransform));Rn.alphaTest>0&&(C.alphaTest.value=Rn.alphaTest)}(C,or,So,To):or.isSpriteMaterial?function(C,Rn){C.diffuse.value.copy(Rn.color),C.opacity.value=Rn.opacity,C.rotation.value=Rn.rotation,Rn.map&&(C.map.value=Rn.map,refreshTransformUniform(Rn.map,C.mapTransform));Rn.alphaMap&&(C.alphaMap.value=Rn.alphaMap,refreshTransformUniform(Rn.alphaMap,C.alphaMapTransform));Rn.alphaTest>0&&(C.alphaTest.value=Rn.alphaTest)}(C,or):or.isShadowMaterial?(C.color.value.copy(or.color),C.opacity.value=or.opacity):or.isShaderMaterial&&(or.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(C,Rn,or,So){let To={},Ro={},Uo=[];const Oo=C.getParameter(C.MAX_UNIFORM_BUFFER_BINDINGS);function hasUniformChanged(C,Rn,or,So){const To=C.value,Ro=Rn+"_"+or;if(void 0===So[Ro])return So[Ro]="number"===typeof To||"boolean"===typeof To?To:To.clone(),!0;{const C=So[Ro];if("number"===typeof To||"boolean"===typeof To){if(C!==To)return So[Ro]=To,!0}else if(!1===C.equals(To))return C.copy(To),!0}return!1}function getUniformSize(C){const Rn={boundary:0,storage:0};return"number"===typeof C||"boolean"===typeof C?(Rn.boundary=4,Rn.storage=4):C.isVector2?(Rn.boundary=8,Rn.storage=8):C.isVector3||C.isColor?(Rn.boundary=16,Rn.storage=12):C.isVector4?(Rn.boundary=16,Rn.storage=16):C.isMatrix3?(Rn.boundary=48,Rn.storage=48):C.isMatrix4?(Rn.boundary=64,Rn.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),Rn}function onUniformsGroupsDispose(Rn){const or=Rn.target;or.removeEventListener("dispose",onUniformsGroupsDispose);const So=Uo.indexOf(or.__bindingPointIndex);Uo.splice(So,1),C.deleteBuffer(To[or.id]),delete To[or.id],delete Ro[or.id]}return{bind:function(C,Rn){const or=Rn.program;So.uniformBlockBinding(C,or)},update:function(or,Ho){let qo=To[or.id];void 0===qo&&(!function(C){const Rn=C.uniforms;let or=0;const So=16;for(let Ro=0,Uo=Rn.length;Ro<Uo;Ro++){const C=Array.isArray(Rn[Ro])?Rn[Ro]:[Rn[Ro]];for(let Rn=0,To=C.length;Rn<To;Rn++){const To=C[Rn],Ro=Array.isArray(To.value)?To.value:[To.value];for(let C=0,Rn=Ro.length;C<Rn;C++){const Rn=getUniformSize(Ro[C]),Uo=or%So,Oo=Uo%Rn.boundary,Ho=Uo+Oo;or+=Oo,0!==Ho&&So-Ho<Rn.storage&&(or+=So-Ho),To.__data=new Float32Array(Rn.storage/Float32Array.BYTES_PER_ELEMENT),To.__offset=or,or+=Rn.storage}}}const To=or%So;To>0&&(or+=So-To);C.__size=or,C.__cache={}}(or),qo=function(Rn){const or=function(){for(let C=0;C<Oo;C++)if(-1===Uo.indexOf(C))return Uo.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();Rn.__bindingPointIndex=or;const So=C.createBuffer(),To=Rn.__size,Ro=Rn.usage;return C.bindBuffer(C.UNIFORM_BUFFER,So),C.bufferData(C.UNIFORM_BUFFER,To,Ro),C.bindBuffer(C.UNIFORM_BUFFER,null),C.bindBufferBase(C.UNIFORM_BUFFER,or,So),So}(or),To[or.id]=qo,or.addEventListener("dispose",onUniformsGroupsDispose));const dl=Ho.program;So.updateUBOMapping(or,dl);const ml=Rn.render.frame;Ro[or.id]!==ml&&(!function(Rn){const or=To[Rn.id],So=Rn.uniforms,Ro=Rn.__cache;C.bindBuffer(C.UNIFORM_BUFFER,or);for(let To=0,Uo=So.length;To<Uo;To++){const Rn=Array.isArray(So[To])?So[To]:[So[To]];for(let or=0,So=Rn.length;or<So;or++){const So=Rn[or];if(!0===hasUniformChanged(So,To,or,Ro)){const Rn=So.__offset,or=Array.isArray(So.value)?So.value:[So.value];let To=0;for(let Ro=0;Ro<or.length;Ro++){const Uo=or[Ro],Oo=getUniformSize(Uo);"number"===typeof Uo||"boolean"===typeof Uo?(So.__data[0]=Uo,C.bufferSubData(C.UNIFORM_BUFFER,Rn+To,So.__data)):Uo.isMatrix3?(So.__data[0]=Uo.elements[0],So.__data[1]=Uo.elements[1],So.__data[2]=Uo.elements[2],So.__data[3]=0,So.__data[4]=Uo.elements[3],So.__data[5]=Uo.elements[4],So.__data[6]=Uo.elements[5],So.__data[7]=0,So.__data[8]=Uo.elements[6],So.__data[9]=Uo.elements[7],So.__data[10]=Uo.elements[8],So.__data[11]=0):(Uo.toArray(So.__data,To),To+=Oo.storage/Float32Array.BYTES_PER_ELEMENT)}C.bufferSubData(C.UNIFORM_BUFFER,Rn,So.__data)}}}C.bindBuffer(C.UNIFORM_BUFFER,null)}(or),Ro[or.id]=ml)},dispose:function(){for(const Rn in To)C.deleteBuffer(To[Rn]);Uo=[],To={},Ro={}}}}class WebGLRenderer{constructor(C){void 0===C&&(C={});const{canvas:Rn=createCanvasElement(),context:or=null,depth:To=!0,stencil:Ro=!1,alpha:Uo=!1,antialias:Oo=!1,premultipliedAlpha:Ho=!0,preserveDrawingBuffer:qo=!1,powerPreference:vl="default",failIfMajorPerformanceCaveat:bl=!1}=C;let kl;if(this.isWebGLRenderer=!0,null!==or){if("undefined"!==typeof WebGLRenderingContext&&or instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");kl=or.getContextAttributes().alpha}else kl=Uo;const Ll=new Uint32Array(4),Dl=new Int32Array(4);let Nc=null,jc=null;const Zc=[],eu=[];this.domElement=Rn,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=Np,this.toneMapping=id,this.toneMappingExposure=1;const Ku=this;let Yu=!1,Eh=0,Th=0,Ch=null,Lh=-1,Dh=null;const Rh=new Vector4,Nh=new Vector4;let Uh=null;const Bh=new Color(0);let Fh=0,Oh=Rn.width,Vh=Rn.height,jh=1,Gh=null,Hh=null;const Zh=new Vector4(0,0,Oh,Vh),Wh=new Vector4(0,0,Oh,Vh);let qh=!1;const Kh=new Frustum;let Qh=!1,Xh=!1;const Yh=new Matrix4,Jh=new Vector3,$h=new Vector4,ed={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let td=!1;function getTargetPixelRatio(){return null===Ch?jh:1}let nd,rd,ad,sd,od,ld,cd,ud,hd,dd,pd,md,fd,gd,Ad,yd,vd,xd,_d,bd,Md,Sd,Td,Cd,Rd=or;function getContext(C,or){return Rn.getContext(C,or)}try{const C={alpha:!0,depth:To,stencil:Ro,antialias:Oo,premultipliedAlpha:Ho,preserveDrawingBuffer:qo,powerPreference:vl,failIfMajorPerformanceCaveat:bl};if("setAttribute"in Rn&&Rn.setAttribute("data-engine","three.js r"+So),Rn.addEventListener("webglcontextlost",onContextLost,!1),Rn.addEventListener("webglcontextrestored",onContextRestore,!1),Rn.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===Rd){const Rn="webgl2";if(Rd=getContext(Rn,C),null===Rd)throw getContext(Rn)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Fd){throw console.error("THREE.WebGLRenderer: "+Fd.message),Fd}function initGLContext(){nd=new WebGLExtensions(Rd),nd.init(),Sd=new WebGLUtils(Rd,nd),rd=new WebGLCapabilities(Rd,nd,C,Sd),ad=new WebGLState(Rd),sd=new WebGLInfo(Rd),od=new WebGLProperties,ld=new WebGLTextures(Rd,nd,ad,od,rd,Sd,sd),cd=new WebGLCubeMaps(Ku),ud=new WebGLCubeUVMaps(Ku),hd=new WebGLAttributes(Rd),Td=new WebGLBindingStates(Rd,hd),dd=new WebGLGeometries(Rd,hd,sd,Td),pd=new WebGLObjects(Rd,dd,hd,sd),_d=new WebGLMorphtargets(Rd,rd,ld),yd=new WebGLClipping(od),md=new WebGLPrograms(Ku,cd,ud,nd,rd,Td,yd),fd=new WebGLMaterials(Ku,od),gd=new WebGLRenderLists,Ad=new WebGLRenderStates(nd),xd=new WebGLBackground(Ku,cd,ud,ad,pd,kl,Ho),vd=new WebGLShadowMap(Ku,pd,rd),Cd=new WebGLUniformsGroups(Rd,sd,rd,ad),bd=new WebGLBufferRenderer(Rd,nd,sd),Md=new WebGLIndexedBufferRenderer(Rd,nd,sd),sd.programs=md.programs,Ku.capabilities=rd,Ku.extensions=nd,Ku.properties=od,Ku.renderLists=gd,Ku.shadowMap=vd,Ku.state=ad,Ku.info=sd}initGLContext();const Nd=new WebXRManager(Ku,Rd);function onContextLost(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),Yu=!0}function onContextRestore(){console.log("THREE.WebGLRenderer: Context Restored."),Yu=!1;const C=sd.autoReset,Rn=vd.enabled,or=vd.autoUpdate,So=vd.needsUpdate,To=vd.type;initGLContext(),sd.autoReset=C,vd.enabled=Rn,vd.autoUpdate=or,vd.needsUpdate=So,vd.type=To}function onContextCreationError(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function onMaterialDispose(C){const Rn=C.target;Rn.removeEventListener("dispose",onMaterialDispose),function(C){(function(C){const Rn=od.get(C).programs;void 0!==Rn&&(Rn.forEach((function(C){md.releaseProgram(C)})),C.isShaderMaterial&&md.releaseShaderCache(C))})(C),od.remove(C)}(Rn)}function prepareMaterial(C,Rn,or){!0===C.transparent&&C.side===fl&&!1===C.forceSinglePass?(C.side=ml,C.needsUpdate=!0,getProgram(C,Rn,or),C.side=dl,C.needsUpdate=!0,getProgram(C,Rn,or),C.side=fl):getProgram(C,Rn,or)}this.xr=Nd,this.getContext=function(){return Rd},this.getContextAttributes=function(){return Rd.getContextAttributes()},this.forceContextLoss=function(){const C=nd.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=nd.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return jh},this.setPixelRatio=function(C){void 0!==C&&(jh=C,this.setSize(Oh,Vh,!1))},this.getSize=function(C){return C.set(Oh,Vh)},this.setSize=function(C,or,So){void 0===So&&(So=!0),Nd.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Oh=C,Vh=or,Rn.width=Math.floor(C*jh),Rn.height=Math.floor(or*jh),!0===So&&(Rn.style.width=C+"px",Rn.style.height=or+"px"),this.setViewport(0,0,C,or))},this.getDrawingBufferSize=function(C){return C.set(Oh*jh,Vh*jh).floor()},this.setDrawingBufferSize=function(C,or,So){Oh=C,Vh=or,jh=So,Rn.width=Math.floor(C*So),Rn.height=Math.floor(or*So),this.setViewport(0,0,C,or)},this.getCurrentViewport=function(C){return C.copy(Rh)},this.getViewport=function(C){return C.copy(Zh)},this.setViewport=function(C,Rn,or,So){C.isVector4?Zh.set(C.x,C.y,C.z,C.w):Zh.set(C,Rn,or,So),ad.viewport(Rh.copy(Zh).multiplyScalar(jh).round())},this.getScissor=function(C){return C.copy(Wh)},this.setScissor=function(C,Rn,or,So){C.isVector4?Wh.set(C.x,C.y,C.z,C.w):Wh.set(C,Rn,or,So),ad.scissor(Nh.copy(Wh).multiplyScalar(jh).round())},this.getScissorTest=function(){return qh},this.setScissorTest=function(C){ad.setScissorTest(qh=C)},this.setOpaqueSort=function(C){Gh=C},this.setTransparentSort=function(C){Hh=C},this.getClearColor=function(C){return C.copy(xd.getClearColor())},this.setClearColor=function(){xd.setClearColor.apply(xd,arguments)},this.getClearAlpha=function(){return xd.getClearAlpha()},this.setClearAlpha=function(){xd.setClearAlpha.apply(xd,arguments)},this.clear=function(C,Rn,or){void 0===C&&(C=!0),void 0===Rn&&(Rn=!0),void 0===or&&(or=!0);let So=0;if(C){let C=!1;if(null!==Ch){const Rn=Ch.texture.format;C=Rn===qd||Rn===Wd||Rn===Hd}if(C){const C=Ch.texture.type,Rn=C===Ed||C===Id||C===kd||C===Dd||C===Pd||C===zd,or=xd.getClearColor(),So=xd.getClearAlpha(),To=or.r,Ro=or.g,Uo=or.b;Rn?(Ll[0]=To,Ll[1]=Ro,Ll[2]=Uo,Ll[3]=So,Rd.clearBufferuiv(Rd.COLOR,0,Ll)):(Dl[0]=To,Dl[1]=Ro,Dl[2]=Uo,Dl[3]=So,Rd.clearBufferiv(Rd.COLOR,0,Dl))}else So|=Rd.COLOR_BUFFER_BIT}Rn&&(So|=Rd.DEPTH_BUFFER_BIT),or&&(So|=Rd.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Rd.clear(So)},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(){Rn.removeEventListener("webglcontextlost",onContextLost,!1),Rn.removeEventListener("webglcontextrestored",onContextRestore,!1),Rn.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),gd.dispose(),Ad.dispose(),od.dispose(),cd.dispose(),ud.dispose(),pd.dispose(),Td.dispose(),Cd.dispose(),md.dispose(),Nd.dispose(),Nd.removeEventListener("sessionstart",onXRSessionStart),Nd.removeEventListener("sessionend",onXRSessionEnd),Bd.stop()},this.renderBufferDirect=function(C,Rn,or,So,To,Ro){null===Rn&&(Rn=ed);const Uo=To.isMesh&&To.matrixWorld.determinant()<0,Oo=function(C,Rn,or,So,To){!0!==Rn.isScene&&(Rn=ed);ld.resetTextureUnits();const Ro=Rn.fog,Uo=So.isMeshStandardMaterial?Rn.environment:null,Oo=null===Ch?Ku.outputColorSpace:!0===Ch.isXRRenderTarget?Ch.texture.colorSpace:Up,Ho=(So.isMeshStandardMaterial?ud:cd).get(So.envMap||Uo),qo=!0===So.vertexColors&&!!or.attributes.color&&4===or.attributes.color.itemSize,dl=!!or.attributes.tangent&&(!!So.normalMap||So.anisotropy>0),ml=!!or.morphAttributes.position,fl=!!or.morphAttributes.normal,vl=!!or.morphAttributes.color;let bl=id;So.toneMapped&&(null!==Ch&&!0!==Ch.isXRRenderTarget||(bl=Ku.toneMapping));const kl=or.morphAttributes.position||or.morphAttributes.normal||or.morphAttributes.color,Ll=void 0!==kl?kl.length:0,Dl=od.get(So),Nc=jc.state.lights;if(!0===Qh&&(!0===Xh||C!==Dh)){const Rn=C===Dh&&So.id===Lh;yd.setState(So,C,Rn)}let Zc=!1;So.version===Dl.__version?Dl.needsLights&&Dl.lightsStateVersion!==Nc.state.version||Dl.outputColorSpace!==Oo||To.isBatchedMesh&&!1===Dl.batching?Zc=!0:To.isBatchedMesh||!0!==Dl.batching?To.isBatchedMesh&&!0===Dl.batchingColor&&null===To.colorTexture||To.isBatchedMesh&&!1===Dl.batchingColor&&null!==To.colorTexture||To.isInstancedMesh&&!1===Dl.instancing?Zc=!0:To.isInstancedMesh||!0!==Dl.instancing?To.isSkinnedMesh&&!1===Dl.skinning?Zc=!0:To.isSkinnedMesh||!0!==Dl.skinning?To.isInstancedMesh&&!0===Dl.instancingColor&&null===To.instanceColor||To.isInstancedMesh&&!1===Dl.instancingColor&&null!==To.instanceColor||To.isInstancedMesh&&!0===Dl.instancingMorph&&null===To.morphTexture||To.isInstancedMesh&&!1===Dl.instancingMorph&&null!==To.morphTexture||Dl.envMap!==Ho||!0===So.fog&&Dl.fog!==Ro?Zc=!0:void 0===Dl.numClippingPlanes||Dl.numClippingPlanes===yd.numPlanes&&Dl.numIntersection===yd.numIntersection?(Dl.vertexAlphas!==qo||Dl.vertexTangents!==dl||Dl.morphTargets!==ml||Dl.morphNormals!==fl||Dl.morphColors!==vl||Dl.toneMapping!==bl||Dl.morphTargetsCount!==Ll)&&(Zc=!0):Zc=!0:Zc=!0:Zc=!0:Zc=!0:(Zc=!0,Dl.__version=So.version);let eu=Dl.currentProgram;!0===Zc&&(eu=getProgram(So,Rn,To));let Yu=!1,Eh=!1,Th=!1;const Rh=eu.getUniforms(),Nh=Dl.uniforms;ad.useProgram(eu.program)&&(Yu=!0,Eh=!0,Th=!0);So.id!==Lh&&(Lh=So.id,Eh=!0);if(Yu||Dh!==C){Rh.setValue(Rd,"projectionMatrix",C.projectionMatrix),Rh.setValue(Rd,"viewMatrix",C.matrixWorldInverse);const Rn=Rh.map.cameraPosition;void 0!==Rn&&Rn.setValue(Rd,Jh.setFromMatrixPosition(C.matrixWorld)),rd.logarithmicDepthBuffer&&Rh.setValue(Rd,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(So.isMeshPhongMaterial||So.isMeshToonMaterial||So.isMeshLambertMaterial||So.isMeshBasicMaterial||So.isMeshStandardMaterial||So.isShaderMaterial)&&Rh.setValue(Rd,"isOrthographic",!0===C.isOrthographicCamera),Dh!==C&&(Dh=C,Eh=!0,Th=!0)}if(To.isSkinnedMesh){Rh.setOptional(Rd,To,"bindMatrix"),Rh.setOptional(Rd,To,"bindMatrixInverse");const C=To.skeleton;C&&(null===C.boneTexture&&C.computeBoneTexture(),Rh.setValue(Rd,"boneTexture",C.boneTexture,ld))}To.isBatchedMesh&&(Rh.setOptional(Rd,To,"batchingTexture"),Rh.setValue(Rd,"batchingTexture",To._matricesTexture,ld),Rh.setOptional(Rd,To,"batchingIdTexture"),Rh.setValue(Rd,"batchingIdTexture",To._indirectTexture,ld),Rh.setOptional(Rd,To,"batchingColorTexture"),null!==To._colorsTexture&&Rh.setValue(Rd,"batchingColorTexture",To._colorsTexture,ld));const Uh=or.morphAttributes;void 0===Uh.position&&void 0===Uh.normal&&void 0===Uh.color||_d.update(To,or,eu);(Eh||Dl.receiveShadow!==To.receiveShadow)&&(Dl.receiveShadow=To.receiveShadow,Rh.setValue(Rd,"receiveShadow",To.receiveShadow));So.isMeshGouraudMaterial&&null!==So.envMap&&(Nh.envMap.value=Ho,Nh.flipEnvMap.value=Ho.isCubeTexture&&!1===Ho.isRenderTargetTexture?-1:1);So.isMeshStandardMaterial&&null===So.envMap&&null!==Rn.environment&&(Nh.envMapIntensity.value=Rn.environmentIntensity);Eh&&(Rh.setValue(Rd,"toneMappingExposure",Ku.toneMappingExposure),Dl.needsLights&&(Fh=Th,(Bh=Nh).ambientLightColor.needsUpdate=Fh,Bh.lightProbe.needsUpdate=Fh,Bh.directionalLights.needsUpdate=Fh,Bh.directionalLightShadows.needsUpdate=Fh,Bh.pointLights.needsUpdate=Fh,Bh.pointLightShadows.needsUpdate=Fh,Bh.spotLights.needsUpdate=Fh,Bh.spotLightShadows.needsUpdate=Fh,Bh.rectAreaLights.needsUpdate=Fh,Bh.hemisphereLights.needsUpdate=Fh),Ro&&!0===So.fog&&fd.refreshFogUniforms(Nh,Ro),fd.refreshMaterialUniforms(Nh,So,jh,Vh,jc.state.transmissionRenderTarget[C.id]),WebGLUniforms.upload(Rd,getUniformList(Dl),Nh,ld));var Bh,Fh;So.isShaderMaterial&&!0===So.uniformsNeedUpdate&&(WebGLUniforms.upload(Rd,getUniformList(Dl),Nh,ld),So.uniformsNeedUpdate=!1);So.isSpriteMaterial&&Rh.setValue(Rd,"center",To.center);if(Rh.setValue(Rd,"modelViewMatrix",To.modelViewMatrix),Rh.setValue(Rd,"normalMatrix",To.normalMatrix),Rh.setValue(Rd,"modelMatrix",To.matrixWorld),So.isShaderMaterial||So.isRawShaderMaterial){const C=So.uniformsGroups;for(let Rn=0,or=C.length;Rn<or;Rn++){const or=C[Rn];Cd.update(or,eu),Cd.bind(or,eu)}}return eu}(C,Rn,or,So,To);ad.setMaterial(So,Uo);let Ho=or.index,qo=1;if(!0===So.wireframe){if(Ho=dd.getWireframeAttribute(or),void 0===Ho)return;qo=2}const dl=or.drawRange,ml=or.attributes.position;let fl=dl.start*qo,vl=(dl.start+dl.count)*qo;null!==Ro&&(fl=Math.max(fl,Ro.start*qo),vl=Math.min(vl,(Ro.start+Ro.count)*qo)),null!==Ho?(fl=Math.max(fl,0),vl=Math.min(vl,Ho.count)):void 0!==ml&&null!==ml&&(fl=Math.max(fl,0),vl=Math.min(vl,ml.count));const bl=vl-fl;if(bl<0||bl===1/0)return;let kl;Td.setup(To,So,Oo,or,Ho);let Ll=bd;if(null!==Ho&&(kl=hd.get(Ho),Ll=Md,Ll.setIndex(kl)),To.isMesh)!0===So.wireframe?(ad.setLineWidth(So.wireframeLinewidth*getTargetPixelRatio()),Ll.setMode(Rd.LINES)):Ll.setMode(Rd.TRIANGLES);else if(To.isLine){let C=So.linewidth;void 0===C&&(C=1),ad.setLineWidth(C*getTargetPixelRatio()),To.isLineSegments?Ll.setMode(Rd.LINES):To.isLineLoop?Ll.setMode(Rd.LINE_LOOP):Ll.setMode(Rd.LINE_STRIP)}else To.isPoints?Ll.setMode(Rd.POINTS):To.isSprite&&Ll.setMode(Rd.TRIANGLES);if(To.isBatchedMesh)if(null!==To._multiDrawInstances)Ll.renderMultiDrawInstances(To._multiDrawStarts,To._multiDrawCounts,To._multiDrawCount,To._multiDrawInstances);else if(nd.get("WEBGL_multi_draw"))Ll.renderMultiDraw(To._multiDrawStarts,To._multiDrawCounts,To._multiDrawCount);else{const C=To._multiDrawStarts,Rn=To._multiDrawCounts,or=To._multiDrawCount,Ro=Ho?hd.get(Ho).bytesPerElement:1,Uo=od.get(So).currentProgram.getUniforms();for(let So=0;So<or;So++)Uo.setValue(Rd,"_gl_DrawID",So),Ll.render(C[So]/Ro,Rn[So])}else if(To.isInstancedMesh)Ll.renderInstances(fl,bl,To.count);else if(or.isInstancedBufferGeometry){const C=void 0!==or._maxInstanceCount?or._maxInstanceCount:1/0,Rn=Math.min(or.instanceCount,C);Ll.renderInstances(fl,bl,Rn)}else Ll.render(fl,bl)},this.compile=function(C,Rn,or){void 0===or&&(or=null),null===or&&(or=C),jc=Ad.get(or),jc.init(Rn),eu.push(jc),or.traverseVisible((function(C){C.isLight&&C.layers.test(Rn.layers)&&(jc.pushLight(C),C.castShadow&&jc.pushShadow(C))})),C!==or&&C.traverseVisible((function(C){C.isLight&&C.layers.test(Rn.layers)&&(jc.pushLight(C),C.castShadow&&jc.pushShadow(C))})),jc.setupLights();const So=new Set;return C.traverse((function(C){const Rn=C.material;if(Rn)if(Array.isArray(Rn))for(let To=0;To<Rn.length;To++){const Ro=Rn[To];prepareMaterial(Ro,or,C),So.add(Ro)}else prepareMaterial(Rn,or,C),So.add(Rn)})),eu.pop(),jc=null,So},this.compileAsync=function(C,Rn,or){void 0===or&&(or=null);const So=this.compile(C,Rn,or);return new Promise((Rn=>{function checkMaterialsReady(){So.forEach((function(C){od.get(C).currentProgram.isReady()&&So.delete(C)})),0!==So.size?setTimeout(checkMaterialsReady,10):Rn(C)}null!==nd.get("KHR_parallel_shader_compile")?checkMaterialsReady():setTimeout(checkMaterialsReady,10)}))};let Ud=null;function onXRSessionStart(){Bd.stop()}function onXRSessionEnd(){Bd.start()}const Bd=new WebGLAnimation;function projectObject(C,Rn,or,So){if(!1===C.visible)return;if(C.layers.test(Rn.layers))if(C.isGroup)or=C.renderOrder;else if(C.isLOD)!0===C.autoUpdate&&C.update(Rn);else if(C.isLight)jc.pushLight(C),C.castShadow&&jc.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||Kh.intersectsSprite(C)){So&&$h.setFromMatrixPosition(C.matrixWorld).applyMatrix4(Yh);const Rn=pd.update(C),To=C.material;To.visible&&Nc.push(C,Rn,To,or,$h.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||Kh.intersectsObject(C))){const Rn=pd.update(C),To=C.material;if(So&&(void 0!==C.boundingSphere?(null===C.boundingSphere&&C.computeBoundingSphere(),$h.copy(C.boundingSphere.center)):(null===Rn.boundingSphere&&Rn.computeBoundingSphere(),$h.copy(Rn.boundingSphere.center)),$h.applyMatrix4(C.matrixWorld).applyMatrix4(Yh)),Array.isArray(To)){const So=Rn.groups;for(let Ro=0,Uo=So.length;Ro<Uo;Ro++){const Uo=So[Ro],Oo=To[Uo.materialIndex];Oo&&Oo.visible&&Nc.push(C,Rn,Oo,or,$h.z,Uo)}}else To.visible&&Nc.push(C,Rn,To,or,$h.z,null)}const To=C.children;for(let Ro=0,Uo=To.length;Ro<Uo;Ro++)projectObject(To[Ro],Rn,or,So)}function renderScene(C,Rn,or,So){const To=C.opaque,Ro=C.transmissive,Uo=C.transparent;jc.setupLightsView(or),!0===Qh&&yd.setGlobalState(Ku.clippingPlanes,or),So&&ad.viewport(Rh.copy(So)),To.length>0&&renderObjects(To,Rn,or),Ro.length>0&&renderObjects(Ro,Rn,or),Uo.length>0&&renderObjects(Uo,Rn,or),ad.buffers.depth.setTest(!0),ad.buffers.depth.setMask(!0),ad.buffers.color.setMask(!0),ad.setPolygonOffset(!1)}function renderTransmissionPass(C,Rn,or,So){if(null!==(!0===or.isScene?or.overrideMaterial:null))return;void 0===jc.state.transmissionRenderTarget[So.id]&&(jc.state.transmissionRenderTarget[So.id]=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:nd.has("EXT_color_buffer_half_float")||nd.has("EXT_color_buffer_float")?Ld:Ed,minFilter:wd,samples:4,stencilBuffer:Ro,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:mm.workingColorSpace}));const To=jc.state.transmissionRenderTarget[So.id],Uo=So.viewport||Rh;To.setSize(Uo.z,Uo.w);const Oo=Ku.getRenderTarget();Ku.setRenderTarget(To),Ku.getClearColor(Bh),Fh=Ku.getClearAlpha(),Fh<1&&Ku.setClearColor(16777215,.5),Ku.clear(),td&&xd.render(or);const Ho=Ku.toneMapping;Ku.toneMapping=id;const qo=So.viewport;if(void 0!==So.viewport&&(So.viewport=void 0),jc.setupLightsView(So),!0===Qh&&yd.setGlobalState(Ku.clippingPlanes,So),renderObjects(C,or,So),ld.updateMultisampleRenderTarget(To),ld.updateRenderTargetMipmap(To),!1===nd.has("WEBGL_multisampled_render_to_texture")){let C=!1;for(let To=0,Ro=Rn.length;To<Ro;To++){const Ro=Rn[To],Uo=Ro.object,Oo=Ro.geometry,Ho=Ro.material,qo=Ro.group;if(Ho.side===fl&&Uo.layers.test(So.layers)){const Rn=Ho.side;Ho.side=ml,Ho.needsUpdate=!0,renderObject(Uo,or,So,Oo,Ho,qo),Ho.side=Rn,Ho.needsUpdate=!0,C=!0}}!0===C&&(ld.updateMultisampleRenderTarget(To),ld.updateRenderTargetMipmap(To))}Ku.setRenderTarget(Oo),Ku.setClearColor(Bh,Fh),void 0!==qo&&(So.viewport=qo),Ku.toneMapping=Ho}function renderObjects(C,Rn,or){const So=!0===Rn.isScene?Rn.overrideMaterial:null;for(let To=0,Ro=C.length;To<Ro;To++){const Ro=C[To],Uo=Ro.object,Oo=Ro.geometry,Ho=null===So?Ro.material:So,qo=Ro.group;Uo.layers.test(or.layers)&&renderObject(Uo,Rn,or,Oo,Ho,qo)}}function renderObject(C,Rn,or,So,To,Ro){C.onBeforeRender(Ku,Rn,or,So,To,Ro),C.modelViewMatrix.multiplyMatrices(or.matrixWorldInverse,C.matrixWorld),C.normalMatrix.getNormalMatrix(C.modelViewMatrix),To.onBeforeRender(Ku,Rn,or,So,C,Ro),!0===To.transparent&&To.side===fl&&!1===To.forceSinglePass?(To.side=ml,To.needsUpdate=!0,Ku.renderBufferDirect(or,Rn,So,To,C,Ro),To.side=dl,To.needsUpdate=!0,Ku.renderBufferDirect(or,Rn,So,To,C,Ro),To.side=fl):Ku.renderBufferDirect(or,Rn,So,To,C,Ro),C.onAfterRender(Ku,Rn,or,So,To,Ro)}function getProgram(C,Rn,or){!0!==Rn.isScene&&(Rn=ed);const So=od.get(C),To=jc.state.lights,Ro=jc.state.shadowsArray,Uo=To.state.version,Oo=md.getParameters(C,To.state,Ro,Rn,or),Ho=md.getProgramCacheKey(Oo);let qo=So.programs;So.environment=C.isMeshStandardMaterial?Rn.environment:null,So.fog=Rn.fog,So.envMap=(C.isMeshStandardMaterial?ud:cd).get(C.envMap||So.environment),So.envMapRotation=null!==So.environment&&null===C.envMap?Rn.environmentRotation:C.envMapRotation,void 0===qo&&(C.addEventListener("dispose",onMaterialDispose),qo=new Map,So.programs=qo);let dl=qo.get(Ho);if(void 0!==dl){if(So.currentProgram===dl&&So.lightsStateVersion===Uo)return updateCommonMaterialProperties(C,Oo),dl}else Oo.uniforms=md.getUniforms(C),C.onBeforeCompile(Oo,Ku),dl=md.acquireProgram(Oo,Ho),qo.set(Ho,dl),So.uniforms=Oo.uniforms;const ml=So.uniforms;return(C.isShaderMaterial||C.isRawShaderMaterial)&&!0!==C.clipping||(ml.clippingPlanes=yd.uniform),updateCommonMaterialProperties(C,Oo),So.needsLights=function(C){return C.isMeshLambertMaterial||C.isMeshToonMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isShadowMaterial||C.isShaderMaterial&&!0===C.lights}(C),So.lightsStateVersion=Uo,So.needsLights&&(ml.ambientLightColor.value=To.state.ambient,ml.lightProbe.value=To.state.probe,ml.directionalLights.value=To.state.directional,ml.directionalLightShadows.value=To.state.directionalShadow,ml.spotLights.value=To.state.spot,ml.spotLightShadows.value=To.state.spotShadow,ml.rectAreaLights.value=To.state.rectArea,ml.ltc_1.value=To.state.rectAreaLTC1,ml.ltc_2.value=To.state.rectAreaLTC2,ml.pointLights.value=To.state.point,ml.pointLightShadows.value=To.state.pointShadow,ml.hemisphereLights.value=To.state.hemi,ml.directionalShadowMap.value=To.state.directionalShadowMap,ml.directionalShadowMatrix.value=To.state.directionalShadowMatrix,ml.spotShadowMap.value=To.state.spotShadowMap,ml.spotLightMatrix.value=To.state.spotLightMatrix,ml.spotLightMap.value=To.state.spotLightMap,ml.pointShadowMap.value=To.state.pointShadowMap,ml.pointShadowMatrix.value=To.state.pointShadowMatrix),So.currentProgram=dl,So.uniformsList=null,dl}function getUniformList(C){if(null===C.uniformsList){const Rn=C.currentProgram.getUniforms();C.uniformsList=WebGLUniforms.seqWithValue(Rn.seq,C.uniforms)}return C.uniformsList}function updateCommonMaterialProperties(C,Rn){const or=od.get(C);or.outputColorSpace=Rn.outputColorSpace,or.batching=Rn.batching,or.batchingColor=Rn.batchingColor,or.instancing=Rn.instancing,or.instancingColor=Rn.instancingColor,or.instancingMorph=Rn.instancingMorph,or.skinning=Rn.skinning,or.morphTargets=Rn.morphTargets,or.morphNormals=Rn.morphNormals,or.morphColors=Rn.morphColors,or.morphTargetsCount=Rn.morphTargetsCount,or.numClippingPlanes=Rn.numClippingPlanes,or.numIntersection=Rn.numClipIntersection,or.vertexAlphas=Rn.vertexAlphas,or.vertexTangents=Rn.vertexTangents,or.toneMapping=Rn.toneMapping}Bd.setAnimationLoop((function(C){Ud&&Ud(C)})),"undefined"!==typeof self&&Bd.setContext(self),this.setAnimationLoop=function(C){Ud=C,Nd.setAnimationLoop(C),null===C?Bd.stop():Bd.start()},Nd.addEventListener("sessionstart",onXRSessionStart),Nd.addEventListener("sessionend",onXRSessionEnd),this.render=function(C,Rn){if(void 0!==Rn&&!0!==Rn.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===Yu)return;if(!0===C.matrixWorldAutoUpdate&&C.updateMatrixWorld(),null===Rn.parent&&!0===Rn.matrixWorldAutoUpdate&&Rn.updateMatrixWorld(),!0===Nd.enabled&&!0===Nd.isPresenting&&(!0===Nd.cameraAutoUpdate&&Nd.updateCamera(Rn),Rn=Nd.getCamera()),!0===C.isScene&&C.onBeforeRender(Ku,C,Rn,Ch),jc=Ad.get(C,eu.length),jc.init(Rn),eu.push(jc),Yh.multiplyMatrices(Rn.projectionMatrix,Rn.matrixWorldInverse),Kh.setFromProjectionMatrix(Yh),Xh=this.localClippingEnabled,Qh=yd.init(this.clippingPlanes,Xh),Nc=gd.get(C,Zc.length),Nc.init(),Zc.push(Nc),!0===Nd.enabled&&!0===Nd.isPresenting){const C=Ku.xr.getDepthSensingMesh();null!==C&&projectObject(C,Rn,-1/0,Ku.sortObjects)}projectObject(C,Rn,0,Ku.sortObjects),Nc.finish(),!0===Ku.sortObjects&&Nc.sort(Gh,Hh),td=!1===Nd.enabled||!1===Nd.isPresenting||!1===Nd.hasDepthSensing(),td&&xd.addToRenderList(Nc,C),this.info.render.frame++,!0===Qh&&yd.beginShadows();const or=jc.state.shadowsArray;vd.render(or,C,Rn),!0===Qh&&yd.endShadows(),!0===this.info.autoReset&&this.info.reset();const So=Nc.opaque,To=Nc.transmissive;if(jc.setupLights(),Rn.isArrayCamera){const or=Rn.cameras;if(To.length>0)for(let Rn=0,Ro=or.length;Rn<Ro;Rn++){renderTransmissionPass(So,To,C,or[Rn])}td&&xd.render(C);for(let Rn=0,So=or.length;Rn<So;Rn++){const So=or[Rn];renderScene(Nc,C,So,So.viewport)}}else To.length>0&&renderTransmissionPass(So,To,C,Rn),td&&xd.render(C),renderScene(Nc,C,Rn);null!==Ch&&(ld.updateMultisampleRenderTarget(Ch),ld.updateRenderTargetMipmap(Ch)),!0===C.isScene&&C.onAfterRender(Ku,C,Rn),Td.resetDefaultState(),Lh=-1,Dh=null,eu.pop(),eu.length>0?(jc=eu[eu.length-1],!0===Qh&&yd.setGlobalState(Ku.clippingPlanes,jc.state.camera)):jc=null,Zc.pop(),Nc=Zc.length>0?Zc[Zc.length-1]:null},this.getActiveCubeFace=function(){return Eh},this.getActiveMipmapLevel=function(){return Th},this.getRenderTarget=function(){return Ch},this.setRenderTargetTextures=function(C,Rn,or){od.get(C.texture).__webglTexture=Rn,od.get(C.depthTexture).__webglTexture=or;const So=od.get(C);So.__hasExternalTextures=!0,So.__autoAllocateDepthBuffer=void 0===or,So.__autoAllocateDepthBuffer||!0===nd.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),So.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(C,Rn){const or=od.get(C);or.__webglFramebuffer=Rn,or.__useDefaultFramebuffer=void 0===Rn},this.setRenderTarget=function(C,Rn,or){void 0===Rn&&(Rn=0),void 0===or&&(or=0),Ch=C,Eh=Rn,Th=or;let So=!0,To=null,Ro=!1,Uo=!1;if(C){const Oo=od.get(C);if(void 0!==Oo.__useDefaultFramebuffer)ad.bindFramebuffer(Rd.FRAMEBUFFER,null),So=!1;else if(void 0===Oo.__webglFramebuffer)ld.setupRenderTarget(C);else if(Oo.__hasExternalTextures)ld.rebindTextures(C,od.get(C.texture).__webglTexture,od.get(C.depthTexture).__webglTexture);else if(C.depthBuffer){const Rn=C.depthTexture;if(Oo.__boundDepthTexture!==Rn){if(null!==Rn&&od.has(Rn)&&(C.width!==Rn.image.width||C.height!==Rn.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ld.setupDepthRenderbuffer(C)}}const Ho=C.texture;(Ho.isData3DTexture||Ho.isDataArrayTexture||Ho.isCompressedArrayTexture)&&(Uo=!0);const qo=od.get(C).__webglFramebuffer;C.isWebGLCubeRenderTarget?(To=Array.isArray(qo[Rn])?qo[Rn][or]:qo[Rn],Ro=!0):To=C.samples>0&&!1===ld.useMultisampledRTT(C)?od.get(C).__webglMultisampledFramebuffer:Array.isArray(qo)?qo[or]:qo,Rh.copy(C.viewport),Nh.copy(C.scissor),Uh=C.scissorTest}else Rh.copy(Zh).multiplyScalar(jh).floor(),Nh.copy(Wh).multiplyScalar(jh).floor(),Uh=qh;if(ad.bindFramebuffer(Rd.FRAMEBUFFER,To)&&So&&ad.drawBuffers(C,To),ad.viewport(Rh),ad.scissor(Nh),ad.setScissorTest(Uh),Ro){const So=od.get(C.texture);Rd.framebufferTexture2D(Rd.FRAMEBUFFER,Rd.COLOR_ATTACHMENT0,Rd.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So.__webglTexture,or)}else if(Uo){const So=od.get(C.texture),To=Rn||0;Rd.framebufferTextureLayer(Rd.FRAMEBUFFER,Rd.COLOR_ATTACHMENT0,So.__webglTexture,or||0,To)}Lh=-1},this.readRenderTargetPixels=function(C,Rn,or,So,To,Ro,Uo){if(!C||!C.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oo=od.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&void 0!==Uo&&(Oo=Oo[Uo]),Oo){ad.bindFramebuffer(Rd.FRAMEBUFFER,Oo);try{const Uo=C.texture,Oo=Uo.format,Ho=Uo.type;if(!rd.textureFormatReadable(Oo))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!rd.textureTypeReadable(Ho))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Rn>=0&&Rn<=C.width-So&&or>=0&&or<=C.height-To&&Rd.readPixels(Rn,or,So,To,Sd.convert(Oo),Sd.convert(Ho),Ro)}finally{const C=null!==Ch?od.get(Ch).__webglFramebuffer:null;ad.bindFramebuffer(Rd.FRAMEBUFFER,C)}}},this.readRenderTargetPixelsAsync=async function(C,Rn,or,So,To,Ro,Uo){if(!C||!C.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oo=od.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&void 0!==Uo&&(Oo=Oo[Uo]),Oo){ad.bindFramebuffer(Rd.FRAMEBUFFER,Oo);try{const Uo=C.texture,Oo=Uo.format,Ho=Uo.type;if(!rd.textureFormatReadable(Oo))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!rd.textureTypeReadable(Ho))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(Rn>=0&&Rn<=C.width-So&&or>=0&&or<=C.height-To){const C=Rd.createBuffer();Rd.bindBuffer(Rd.PIXEL_PACK_BUFFER,C),Rd.bufferData(Rd.PIXEL_PACK_BUFFER,Ro.byteLength,Rd.STREAM_READ),Rd.readPixels(Rn,or,So,To,Sd.convert(Oo),Sd.convert(Ho),0),Rd.flush();const Uo=Rd.fenceSync(Rd.SYNC_GPU_COMMANDS_COMPLETE,0);await function(C,Rn,or){return new Promise((function(So,To){setTimeout((function probe(){switch(C.clientWaitSync(Rn,C.SYNC_FLUSH_COMMANDS_BIT,0)){case C.WAIT_FAILED:To();break;case C.TIMEOUT_EXPIRED:setTimeout(probe,or);break;default:So()}}),or)}))}(Rd,Uo,4);try{Rd.bindBuffer(Rd.PIXEL_PACK_BUFFER,C),Rd.getBufferSubData(Rd.PIXEL_PACK_BUFFER,0,Ro)}finally{Rd.deleteBuffer(C),Rd.deleteSync(Uo)}return Ro}}finally{const C=null!==Ch?od.get(Ch).__webglFramebuffer:null;ad.bindFramebuffer(Rd.FRAMEBUFFER,C)}}},this.copyFramebufferToTexture=function(C,Rn,or){void 0===Rn&&(Rn=null),void 0===or&&(or=0),!0!==C.isTexture&&(warnOnce("WebGLRenderer: copyFramebufferToTexture function signature has changed."),Rn=arguments[0]||null,C=arguments[1]);const So=Math.pow(2,-or),To=Math.floor(C.image.width*So),Ro=Math.floor(C.image.height*So),Uo=null!==Rn?Rn.x:0,Oo=null!==Rn?Rn.y:0;ld.setTexture2D(C,0),Rd.copyTexSubImage2D(Rd.TEXTURE_2D,or,0,0,Uo,Oo,To,Ro),ad.unbindTexture()},this.copyTextureToTexture=function(C,Rn,or,So,To){let Ro,Uo,Oo,Ho,qo,dl;void 0===or&&(or=null),void 0===So&&(So=null),void 0===To&&(To=0),!0!==C.isTexture&&(warnOnce("WebGLRenderer: copyTextureToTexture function signature has changed."),So=arguments[0]||null,C=arguments[1],Rn=arguments[2],To=arguments[3]||0,or=null),null!==or?(Ro=or.max.x-or.min.x,Uo=or.max.y-or.min.y,Oo=or.min.x,Ho=or.min.y):(Ro=C.image.width,Uo=C.image.height,Oo=0,Ho=0),null!==So?(qo=So.x,dl=So.y):(qo=0,dl=0);const ml=Sd.convert(Rn.format),fl=Sd.convert(Rn.type);ld.setTexture2D(Rn,0),Rd.pixelStorei(Rd.UNPACK_FLIP_Y_WEBGL,Rn.flipY),Rd.pixelStorei(Rd.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Rn.premultiplyAlpha),Rd.pixelStorei(Rd.UNPACK_ALIGNMENT,Rn.unpackAlignment);const vl=Rd.getParameter(Rd.UNPACK_ROW_LENGTH),bl=Rd.getParameter(Rd.UNPACK_IMAGE_HEIGHT),kl=Rd.getParameter(Rd.UNPACK_SKIP_PIXELS),Ll=Rd.getParameter(Rd.UNPACK_SKIP_ROWS),Dl=Rd.getParameter(Rd.UNPACK_SKIP_IMAGES),Nc=C.isCompressedTexture?C.mipmaps[To]:C.image;Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,Nc.width),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,Nc.height),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,Oo),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,Ho),C.isDataTexture?Rd.texSubImage2D(Rd.TEXTURE_2D,To,qo,dl,Ro,Uo,ml,fl,Nc.data):C.isCompressedTexture?Rd.compressedTexSubImage2D(Rd.TEXTURE_2D,To,qo,dl,Nc.width,Nc.height,ml,Nc.data):Rd.texSubImage2D(Rd.TEXTURE_2D,To,qo,dl,Ro,Uo,ml,fl,Nc),Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,vl),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,bl),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,kl),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,Ll),Rd.pixelStorei(Rd.UNPACK_SKIP_IMAGES,Dl),0===To&&Rn.generateMipmaps&&Rd.generateMipmap(Rd.TEXTURE_2D),ad.unbindTexture()},this.copyTextureToTexture3D=function(C,Rn,or,So,To){let Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl;void 0===or&&(or=null),void 0===So&&(So=null),void 0===To&&(To=0),!0!==C.isTexture&&(warnOnce("WebGLRenderer: copyTextureToTexture3D function signature has changed."),or=arguments[0]||null,So=arguments[1]||null,C=arguments[2],Rn=arguments[3],To=arguments[4]||0);const bl=C.isCompressedTexture?C.mipmaps[To]:C.image;null!==or?(Ro=or.max.x-or.min.x,Uo=or.max.y-or.min.y,Oo=or.max.z-or.min.z,Ho=or.min.x,qo=or.min.y,dl=or.min.z):(Ro=bl.width,Uo=bl.height,Oo=bl.depth,Ho=0,qo=0,dl=0),null!==So?(ml=So.x,fl=So.y,vl=So.z):(ml=0,fl=0,vl=0);const kl=Sd.convert(Rn.format),Ll=Sd.convert(Rn.type);let Dl;if(Rn.isData3DTexture)ld.setTexture3D(Rn,0),Dl=Rd.TEXTURE_3D;else{if(!Rn.isDataArrayTexture&&!Rn.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ld.setTexture2DArray(Rn,0),Dl=Rd.TEXTURE_2D_ARRAY}Rd.pixelStorei(Rd.UNPACK_FLIP_Y_WEBGL,Rn.flipY),Rd.pixelStorei(Rd.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Rn.premultiplyAlpha),Rd.pixelStorei(Rd.UNPACK_ALIGNMENT,Rn.unpackAlignment);const Nc=Rd.getParameter(Rd.UNPACK_ROW_LENGTH),jc=Rd.getParameter(Rd.UNPACK_IMAGE_HEIGHT),Zc=Rd.getParameter(Rd.UNPACK_SKIP_PIXELS),eu=Rd.getParameter(Rd.UNPACK_SKIP_ROWS),Ku=Rd.getParameter(Rd.UNPACK_SKIP_IMAGES);Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,bl.width),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,bl.height),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,Ho),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,qo),Rd.pixelStorei(Rd.UNPACK_SKIP_IMAGES,dl),C.isDataTexture||C.isData3DTexture?Rd.texSubImage3D(Dl,To,ml,fl,vl,Ro,Uo,Oo,kl,Ll,bl.data):Rn.isCompressedArrayTexture?Rd.compressedTexSubImage3D(Dl,To,ml,fl,vl,Ro,Uo,Oo,kl,bl.data):Rd.texSubImage3D(Dl,To,ml,fl,vl,Ro,Uo,Oo,kl,Ll,bl),Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,Nc),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,jc),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,Zc),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,eu),Rd.pixelStorei(Rd.UNPACK_SKIP_IMAGES,Ku),0===To&&Rn.generateMipmaps&&Rd.generateMipmap(Dl),ad.unbindTexture()},this.initRenderTarget=function(C){void 0===od.get(C).__webglFramebuffer&&ld.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?ld.setTextureCube(C,0):C.isData3DTexture?ld.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?ld.setTexture2DArray(C,0):ld.setTexture2D(C,0),ad.unbindTexture()},this.resetState=function(){Eh=0,Th=0,Ch=null,ad.reset(),Td.reset()},"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tm}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(C){this._outputColorSpace=C;const Rn=this.getContext();Rn.drawingBufferColorSpace=C===Bp?"display-p3":"srgb",Rn.unpackColorSpace=mm.workingColorSpace===Fp?"display-p3":"srgb"}}class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(C,Rn){return super.copy(C,Rn),null!==C.background&&(this.background=C.background.clone()),null!==C.environment&&(this.environment=C.environment.clone()),null!==C.fog&&(this.fog=C.fog.clone()),this.backgroundBlurriness=C.backgroundBlurriness,this.backgroundIntensity=C.backgroundIntensity,this.backgroundRotation.copy(C.backgroundRotation),this.environmentIntensity=C.environmentIntensity,this.environmentRotation.copy(C.environmentRotation),null!==C.overrideMaterial&&(this.overrideMaterial=C.overrideMaterial.clone()),this.matrixAutoUpdate=C.matrixAutoUpdate,this}toJSON(C){const Rn=super.toJSON(C);return null!==this.fog&&(Rn.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(Rn.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(Rn.object.backgroundIntensity=this.backgroundIntensity),Rn.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(Rn.object.environmentIntensity=this.environmentIntensity),Rn.object.environmentRotation=this.environmentRotation.toArray(),Rn}}class LineBasicMaterial extends Material{constructor(C){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(C)}copy(C){return super.copy(C),this.color.copy(C.color),this.map=C.map,this.linewidth=C.linewidth,this.linecap=C.linecap,this.linejoin=C.linejoin,this.fog=C.fog,this}}const $g=new Vector3,eA=new Vector3,tA=new Matrix4,iA=new Ray,nA=new Sphere,rA=new Vector3,aA=new Vector3;class Line extends Object3D{constructor(C,Rn){void 0===C&&(C=new BufferGeometry),void 0===Rn&&(Rn=new LineBasicMaterial),super(),this.isLine=!0,this.type="Line",this.geometry=C,this.material=Rn,this.updateMorphTargets()}copy(C,Rn){return super.copy(C,Rn),this.material=Array.isArray(C.material)?C.material.slice():C.material,this.geometry=C.geometry,this}computeLineDistances(){const C=this.geometry;if(null===C.index){const Rn=C.attributes.position,or=[0];for(let C=1,So=Rn.count;C<So;C++)$g.fromBufferAttribute(Rn,C-1),eA.fromBufferAttribute(Rn,C),or[C]=or[C-1],or[C]+=$g.distanceTo(eA);C.setAttribute("lineDistance",new Float32BufferAttribute(or,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(C,Rn){const or=this.geometry,So=this.matrixWorld,To=C.params.Line.threshold,Ro=or.drawRange;if(null===or.boundingSphere&&or.computeBoundingSphere(),nA.copy(or.boundingSphere),nA.applyMatrix4(So),nA.radius+=To,!1===C.ray.intersectsSphere(nA))return;tA.copy(So).invert(),iA.copy(C.ray).applyMatrix4(tA);const Uo=To/((this.scale.x+this.scale.y+this.scale.z)/3),Oo=Uo*Uo,Ho=this.isLineSegments?2:1,qo=or.index,dl=or.attributes.position;if(null!==qo){const or=Math.max(0,Ro.start),So=Math.min(qo.count,Ro.start+Ro.count);for(let To=or,Ro=So-1;To<Ro;To+=Ho){const or=qo.getX(To),So=qo.getX(To+1),Ro=checkIntersection(this,C,iA,Oo,or,So);Ro&&Rn.push(Ro)}if(this.isLineLoop){const To=qo.getX(So-1),Ro=qo.getX(or),Uo=checkIntersection(this,C,iA,Oo,To,Ro);Uo&&Rn.push(Uo)}}else{const or=Math.max(0,Ro.start),So=Math.min(dl.count,Ro.start+Ro.count);for(let To=or,Ro=So-1;To<Ro;To+=Ho){const or=checkIntersection(this,C,iA,Oo,To,To+1);or&&Rn.push(or)}if(this.isLineLoop){const To=checkIntersection(this,C,iA,Oo,So-1,or);To&&Rn.push(To)}}}updateMorphTargets(){const C=this.geometry.morphAttributes,Rn=Object.keys(C);if(Rn.length>0){const or=C[Rn[0]];if(void 0!==or){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let C=0,Rn=or.length;C<Rn;C++){const Rn=or[C].name||String(C);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Rn]=C}}}}}function checkIntersection(C,Rn,or,So,To,Ro){const Uo=C.geometry.attributes.position;$g.fromBufferAttribute(Uo,To),eA.fromBufferAttribute(Uo,Ro);if(or.distanceSqToSegment($g,eA,rA,aA)>So)return;rA.applyMatrix4(C.matrixWorld);const Oo=Rn.ray.origin.distanceTo(rA);return Oo<Rn.near||Oo>Rn.far?void 0:{distance:Oo,point:aA.clone().applyMatrix4(C.matrixWorld),index:To,face:null,faceIndex:null,object:C}}const sA=new Vector3,oA=new Vector3;class LineSegments extends Line{constructor(C,Rn){super(C,Rn),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const C=this.geometry;if(null===C.index){const Rn=C.attributes.position,or=[];for(let C=0,So=Rn.count;C<So;C+=2)sA.fromBufferAttribute(Rn,C),oA.fromBufferAttribute(Rn,C+1),or[C]=0===C?0:or[C-1],or[C+1]=or[C]+sA.distanceTo(oA);C.setAttribute("lineDistance",new Float32BufferAttribute(or,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(C,Rn){const or=this.getUtoTmapping(C);return this.getPoint(or,Rn)}getPoints(C){void 0===C&&(C=5);const Rn=[];for(let or=0;or<=C;or++)Rn.push(this.getPoint(or/C));return Rn}getSpacedPoints(C){void 0===C&&(C=5);const Rn=[];for(let or=0;or<=C;or++)Rn.push(this.getPointAt(or/C));return Rn}getLength(){const C=this.getLengths();return C[C.length-1]}getLengths(C){if(void 0===C&&(C=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===C+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const Rn=[];let or,So=this.getPoint(0),To=0;Rn.push(0);for(let Ro=1;Ro<=C;Ro++)or=this.getPoint(Ro/C),To+=or.distanceTo(So),Rn.push(To),So=or;return this.cacheArcLengths=Rn,Rn}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(C,Rn){const or=this.getLengths();let So=0;const To=or.length;let Ro;Ro=Rn||C*or[To-1];let Uo,Oo=0,Ho=To-1;for(;Oo<=Ho;)if(So=Math.floor(Oo+(Ho-Oo)/2),Uo=or[So]-Ro,Uo<0)Oo=So+1;else{if(!(Uo>0)){Ho=So;break}Ho=So-1}if(So=Ho,or[So]===Ro)return So/(To-1);const qo=or[So];return(So+(Ro-qo)/(or[So+1]-qo))/(To-1)}getTangent(C,Rn){const or=1e-4;let So=C-or,To=C+or;So<0&&(So=0),To>1&&(To=1);const Ro=this.getPoint(So),Uo=this.getPoint(To),Oo=Rn||(Ro.isVector2?new Vector2:new Vector3);return Oo.copy(Uo).sub(Ro).normalize(),Oo}getTangentAt(C,Rn){const or=this.getUtoTmapping(C);return this.getTangent(or,Rn)}computeFrenetFrames(C,Rn){const or=new Vector3,So=[],To=[],Ro=[],Uo=new Vector3,Oo=new Matrix4;for(let fl=0;fl<=C;fl++){const Rn=fl/C;So[fl]=this.getTangentAt(Rn,new Vector3)}To[0]=new Vector3,Ro[0]=new Vector3;let Ho=Number.MAX_VALUE;const qo=Math.abs(So[0].x),dl=Math.abs(So[0].y),ml=Math.abs(So[0].z);qo<=Ho&&(Ho=qo,or.set(1,0,0)),dl<=Ho&&(Ho=dl,or.set(0,1,0)),ml<=Ho&&or.set(0,0,1),Uo.crossVectors(So[0],or).normalize(),To[0].crossVectors(So[0],Uo),Ro[0].crossVectors(So[0],To[0]);for(let fl=1;fl<=C;fl++){if(To[fl]=To[fl-1].clone(),Ro[fl]=Ro[fl-1].clone(),Uo.crossVectors(So[fl-1],So[fl]),Uo.length()>Number.EPSILON){Uo.normalize();const C=Math.acos(clamp(So[fl-1].dot(So[fl]),-1,1));To[fl].applyMatrix4(Oo.makeRotationAxis(Uo,C))}Ro[fl].crossVectors(So[fl],To[fl])}if(!0===Rn){let Rn=Math.acos(clamp(To[0].dot(To[C]),-1,1));Rn/=C,So[0].dot(Uo.crossVectors(To[0],To[C]))>0&&(Rn=-Rn);for(let or=1;or<=C;or++)To[or].applyMatrix4(Oo.makeRotationAxis(So[or],Rn*or)),Ro[or].crossVectors(So[or],To[or])}return{tangents:So,normals:To,binormals:Ro}}clone(){return(new this.constructor).copy(this)}copy(C){return this.arcLengthDivisions=C.arcLengthDivisions,this}toJSON(){const C={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return C.arcLengthDivisions=this.arcLengthDivisions,C.type=this.type,C}fromJSON(C){return this.arcLengthDivisions=C.arcLengthDivisions,this}}function CatmullRom(C,Rn,or,So,To){const Ro=.5*(So-Rn),Uo=.5*(To-or),Oo=C*C;return(2*or-2*So+Ro+Uo)*(C*Oo)+(-3*or+3*So-2*Ro-Uo)*Oo+Ro*C+or}class SplineCurve extends Curve{constructor(C){void 0===C&&(C=[]),super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=C}getPoint(C,Rn){void 0===Rn&&(Rn=new Vector2);const or=Rn,So=this.points,To=(So.length-1)*C,Ro=Math.floor(To),Uo=To-Ro,Oo=So[0===Ro?Ro:Ro-1],Ho=So[Ro],qo=So[Ro>So.length-2?So.length-1:Ro+1],dl=So[Ro>So.length-3?So.length-1:Ro+2];return or.set(CatmullRom(Uo,Oo.x,Ho.x,qo.x,dl.x),CatmullRom(Uo,Oo.y,Ho.y,qo.y,dl.y)),or}copy(C){super.copy(C),this.points=[];for(let Rn=0,or=C.points.length;Rn<or;Rn++){const or=C.points[Rn];this.points.push(or.clone())}return this}toJSON(){const C=super.toJSON();C.points=[];for(let Rn=0,or=this.points.length;Rn<or;Rn++){const or=this.points[Rn];C.points.push(or.toArray())}return C}fromJSON(C){super.fromJSON(C),this.points=[];for(let Rn=0,or=C.points.length;Rn<or;Rn++){const or=C.points[Rn];this.points.push((new Vector2).fromArray(or))}return this}}class SphereGeometry extends BufferGeometry{constructor(C,Rn,or,So,To,Ro,Uo){void 0===C&&(C=1),void 0===Rn&&(Rn=32),void 0===or&&(or=16),void 0===So&&(So=0),void 0===To&&(To=2*Math.PI),void 0===Ro&&(Ro=0),void 0===Uo&&(Uo=Math.PI),super(),this.type="SphereGeometry",this.parameters={radius:C,widthSegments:Rn,heightSegments:or,phiStart:So,phiLength:To,thetaStart:Ro,thetaLength:Uo},Rn=Math.max(3,Math.floor(Rn)),or=Math.max(2,Math.floor(or));const Oo=Math.min(Ro+Uo,Math.PI);let Ho=0;const qo=[],dl=new Vector3,ml=new Vector3,fl=[],vl=[],bl=[],kl=[];for(let Ll=0;Ll<=or;Ll++){const fl=[],Dl=Ll/or;let Nc=0;0===Ll&&0===Ro?Nc=.5/Rn:Ll===or&&Oo===Math.PI&&(Nc=-.5/Rn);for(let or=0;or<=Rn;or++){const Oo=or/Rn;dl.x=-C*Math.cos(So+Oo*To)*Math.sin(Ro+Dl*Uo),dl.y=C*Math.cos(Ro+Dl*Uo),dl.z=C*Math.sin(So+Oo*To)*Math.sin(Ro+Dl*Uo),vl.push(dl.x,dl.y,dl.z),ml.copy(dl).normalize(),bl.push(ml.x,ml.y,ml.z),kl.push(Oo+Nc,1-Dl),fl.push(Ho++)}qo.push(fl)}for(let Ll=0;Ll<or;Ll++)for(let C=0;C<Rn;C++){const Rn=qo[Ll][C+1],So=qo[Ll][C],To=qo[Ll+1][C],Uo=qo[Ll+1][C+1];(0!==Ll||Ro>0)&&fl.push(Rn,So,Uo),(Ll!==or-1||Oo<Math.PI)&&fl.push(So,To,Uo)}this.setIndex(fl),this.setAttribute("position",new Float32BufferAttribute(vl,3)),this.setAttribute("normal",new Float32BufferAttribute(bl,3)),this.setAttribute("uv",new Float32BufferAttribute(kl,2))}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}static fromJSON(C){return new SphereGeometry(C.radius,C.widthSegments,C.heightSegments,C.phiStart,C.phiLength,C.thetaStart,C.thetaLength)}}class WireframeGeometry extends BufferGeometry{constructor(C){if(void 0===C&&(C=null),super(),this.type="WireframeGeometry",this.parameters={geometry:C},null!==C){const Rn=[],or=new Set,So=new Vector3,To=new Vector3;if(null!==C.index){const Ro=C.attributes.position,Uo=C.index;let Oo=C.groups;0===Oo.length&&(Oo=[{start:0,count:Uo.count,materialIndex:0}]);for(let C=0,Ho=Oo.length;C<Ho;++C){const Ho=Oo[C],qo=Ho.start;for(let C=qo,Oo=qo+Ho.count;C<Oo;C+=3)for(let Ho=0;Ho<3;Ho++){const Oo=Uo.getX(C+Ho),qo=Uo.getX(C+(Ho+1)%3);So.fromBufferAttribute(Ro,Oo),To.fromBufferAttribute(Ro,qo),!0===isUniqueEdge(So,To,or)&&(Rn.push(So.x,So.y,So.z),Rn.push(To.x,To.y,To.z))}}}else{const Ro=C.attributes.position;for(let C=0,Uo=Ro.count/3;C<Uo;C++)for(let Oo=0;Oo<3;Oo++){const Uo=3*C+Oo,Ho=3*C+(Oo+1)%3;So.fromBufferAttribute(Ro,Uo),To.fromBufferAttribute(Ro,Ho),!0===isUniqueEdge(So,To,or)&&(Rn.push(So.x,So.y,So.z),Rn.push(To.x,To.y,To.z))}}this.setAttribute("position",new Float32BufferAttribute(Rn,3))}}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}}function isUniqueEdge(C,Rn,or){const So=C.x+","+C.y+","+C.z+"-"+Rn.x+","+Rn.y+","+Rn.z,To=Rn.x+","+Rn.y+","+Rn.z+"-"+C.x+","+C.y+","+C.z;return!0!==or.has(So)&&!0!==or.has(To)&&(or.add(So),or.add(To),!0)}function convertArray(C,Rn,or){return!C||!or&&C.constructor===Rn?C:"number"===typeof Rn.BYTES_PER_ELEMENT?new Rn(C):Array.prototype.slice.call(C)}function isTypedArray(C){return ArrayBuffer.isView(C)&&!(C instanceof DataView)}class Interpolant{constructor(C,Rn,or,So){this.parameterPositions=C,this._cachedIndex=0,this.resultBuffer=void 0!==So?So:new Rn.constructor(or),this.sampleValues=Rn,this.valueSize=or,this.settings=null,this.DefaultSettings_={}}evaluate(C){const Rn=this.parameterPositions;let or=this._cachedIndex,So=Rn[or],To=Rn[or-1];e:{t:{let Ro;i:{n:if(!(C<So)){for(let Ro=or+2;;){if(void 0===So){if(C<To)break n;return or=Rn.length,this._cachedIndex=or,this.copySampleValue_(or-1)}if(or===Ro)break;if(To=So,So=Rn[++or],C<So)break t}Ro=Rn.length;break i}if(C>=To)break e;{const Uo=Rn[1];C<Uo&&(or=2,To=Uo);for(let Ro=or-2;;){if(void 0===To)return this._cachedIndex=0,this.copySampleValue_(0);if(or===Ro)break;if(So=To,To=Rn[--or-1],C>=To)break t}Ro=or,or=0}}for(;or<Ro;){const So=or+Ro>>>1;C<Rn[So]?Ro=So:or=So+1}if(So=Rn[or],To=Rn[or-1],void 0===To)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===So)return or=Rn.length,this._cachedIndex=or,this.copySampleValue_(or-1)}this._cachedIndex=or,this.intervalChanged_(or,To,So)}return this.interpolate_(or,To,C,So)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(C){const Rn=this.resultBuffer,or=this.sampleValues,So=this.valueSize,To=C*So;for(let Ro=0;Ro!==So;++Ro)Rn[Ro]=or[To+Ro];return Rn}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ip,endingEnd:Ip}}intervalChanged_(C,Rn,or){const So=this.parameterPositions;let To=C-2,Ro=C+1,Uo=So[To],Oo=So[Ro];if(void 0===Uo)switch(this.getSettings_().endingStart){case Cp:To=C,Uo=2*Rn-or;break;case Lp:To=So.length-2,Uo=Rn+So[To]-So[To+1];break;default:To=C,Uo=or}if(void 0===Oo)switch(this.getSettings_().endingEnd){case Cp:Ro=C,Oo=2*or-Rn;break;case Lp:Ro=1,Oo=or+So[1]-So[0];break;default:Ro=C-1,Oo=Rn}const Ho=.5*(or-Rn),qo=this.valueSize;this._weightPrev=Ho/(Rn-Uo),this._weightNext=Ho/(Oo-or),this._offsetPrev=To*qo,this._offsetNext=Ro*qo}interpolate_(C,Rn,or,So){const To=this.resultBuffer,Ro=this.sampleValues,Uo=this.valueSize,Oo=C*Uo,Ho=Oo-Uo,qo=this._offsetPrev,dl=this._offsetNext,ml=this._weightPrev,fl=this._weightNext,vl=(or-Rn)/(So-Rn),bl=vl*vl,kl=bl*vl,Ll=-ml*kl+2*ml*bl-ml*vl,Dl=(1+ml)*kl+(-1.5-2*ml)*bl+(-.5+ml)*vl+1,Nc=(-1-fl)*kl+(1.5+fl)*bl+.5*vl,jc=fl*kl-fl*bl;for(let Zc=0;Zc!==Uo;++Zc)To[Zc]=Ll*Ro[qo+Zc]+Dl*Ro[Ho+Zc]+Nc*Ro[Oo+Zc]+jc*Ro[dl+Zc];return To}}class LinearInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So)}interpolate_(C,Rn,or,So){const To=this.resultBuffer,Ro=this.sampleValues,Uo=this.valueSize,Oo=C*Uo,Ho=Oo-Uo,qo=(or-Rn)/(So-Rn),dl=1-qo;for(let ml=0;ml!==Uo;++ml)To[ml]=Ro[Ho+ml]*dl+Ro[Oo+ml]*qo;return To}}class DiscreteInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So)}interpolate_(C){return this.copySampleValue_(C-1)}}class KeyframeTrack{constructor(C,Rn,or,So){if(void 0===C)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===Rn||0===Rn.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+C);this.name=C,this.times=convertArray(Rn,this.TimeBufferType),this.values=convertArray(or,this.ValueBufferType),this.setInterpolation(So||this.DefaultInterpolation)}static toJSON(C){const Rn=C.constructor;let or;if(Rn.toJSON!==this.toJSON)or=Rn.toJSON(C);else{or={name:C.name,times:convertArray(C.times,Array),values:convertArray(C.values,Array)};const Rn=C.getInterpolation();Rn!==C.DefaultInterpolation&&(or.interpolation=Rn)}return or.type=C.ValueTypeName,or}InterpolantFactoryMethodDiscrete(C){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),C)}InterpolantFactoryMethodLinear(C){return new LinearInterpolant(this.times,this.values,this.getValueSize(),C)}InterpolantFactoryMethodSmooth(C){return new CubicInterpolant(this.times,this.values,this.getValueSize(),C)}setInterpolation(C){let Rn;switch(C){case Sp:Rn=this.InterpolantFactoryMethodDiscrete;break;case kp:Rn=this.InterpolantFactoryMethodLinear;break;case Tp:Rn=this.InterpolantFactoryMethodSmooth}if(void 0===Rn){const Rn="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(C===this.DefaultInterpolation)throw new Error(Rn);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",Rn),this}return this.createInterpolant=Rn,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Sp;case this.InterpolantFactoryMethodLinear:return kp;case this.InterpolantFactoryMethodSmooth:return Tp}}getValueSize(){return this.values.length/this.times.length}shift(C){if(0!==C){const Rn=this.times;for(let or=0,So=Rn.length;or!==So;++or)Rn[or]+=C}return this}scale(C){if(1!==C){const Rn=this.times;for(let or=0,So=Rn.length;or!==So;++or)Rn[or]*=C}return this}trim(C,Rn){const or=this.times,So=or.length;let To=0,Ro=So-1;for(;To!==So&&or[To]<C;)++To;for(;-1!==Ro&&or[Ro]>Rn;)--Ro;if(++Ro,0!==To||Ro!==So){To>=Ro&&(Ro=Math.max(Ro,1),To=Ro-1);const C=this.getValueSize();this.times=or.slice(To,Ro),this.values=this.values.slice(To*C,Ro*C)}return this}validate(){let C=!0;const Rn=this.getValueSize();Rn-Math.floor(Rn)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),C=!1);const or=this.times,So=this.values,To=or.length;0===To&&(console.error("THREE.KeyframeTrack: Track is empty.",this),C=!1);let Ro=null;for(let Uo=0;Uo!==To;Uo++){const Rn=or[Uo];if("number"===typeof Rn&&isNaN(Rn)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,Uo,Rn),C=!1;break}if(null!==Ro&&Ro>Rn){console.error("THREE.KeyframeTrack: Out of order keys.",this,Uo,Rn,Ro),C=!1;break}Ro=Rn}if(void 0!==So&&isTypedArray(So))for(let Uo=0,Oo=So.length;Uo!==Oo;++Uo){const Rn=So[Uo];if(isNaN(Rn)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,Uo,Rn),C=!1;break}}return C}optimize(){const C=this.times.slice(),Rn=this.values.slice(),or=this.getValueSize(),So=this.getInterpolation()===Tp,To=C.length-1;let Ro=1;for(let Uo=1;Uo<To;++Uo){let To=!1;const Oo=C[Uo];if(Oo!==C[Uo+1]&&(1!==Uo||Oo!==C[0]))if(So)To=!0;else{const C=Uo*or,So=C-or,Ro=C+or;for(let Uo=0;Uo!==or;++Uo){const or=Rn[C+Uo];if(or!==Rn[So+Uo]||or!==Rn[Ro+Uo]){To=!0;break}}}if(To){if(Uo!==Ro){C[Ro]=C[Uo];const So=Uo*or,To=Ro*or;for(let C=0;C!==or;++C)Rn[To+C]=Rn[So+C]}++Ro}}if(To>0){C[Ro]=C[To];for(let C=To*or,So=Ro*or,Uo=0;Uo!==or;++Uo)Rn[So+Uo]=Rn[C+Uo];++Ro}return Ro!==C.length?(this.times=C.slice(0,Ro),this.values=Rn.slice(0,Ro*or)):(this.times=C,this.values=Rn),this}clone(){const C=this.times.slice(),Rn=this.values.slice(),or=new(0,this.constructor)(this.name,C,Rn);return or.createInterpolant=this.createInterpolant,or}}KeyframeTrack.prototype.TimeBufferType=Float32Array,KeyframeTrack.prototype.ValueBufferType=Float32Array,KeyframeTrack.prototype.DefaultInterpolation=kp;class BooleanKeyframeTrack extends KeyframeTrack{constructor(C,Rn,or){super(C,Rn,or)}}BooleanKeyframeTrack.prototype.ValueTypeName="bool",BooleanKeyframeTrack.prototype.ValueBufferType=Array,BooleanKeyframeTrack.prototype.DefaultInterpolation=Sp,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";class QuaternionLinearInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So)}interpolate_(C,Rn,or,So){const To=this.resultBuffer,Ro=this.sampleValues,Uo=this.valueSize,Oo=(or-Rn)/(So-Rn);let Ho=C*Uo;for(let qo=Ho+Uo;Ho!==qo;Ho+=4)Quaternion.slerpFlat(To,0,Ro,Ho-Uo,Ro,Ho,Oo);return To}}class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(C){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),C)}}QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion",QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{constructor(C,Rn,or){super(C,Rn,or)}}StringKeyframeTrack.prototype.ValueTypeName="string",StringKeyframeTrack.prototype.ValueBufferType=Array,StringKeyframeTrack.prototype.DefaultInterpolation=Sp,StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName="vector";const lA={enabled:!1,files:{},add:function(C,Rn){!1!==this.enabled&&(this.files[C]=Rn)},get:function(C){if(!1!==this.enabled)return this.files[C]},remove:function(C){delete this.files[C]},clear:function(){this.files={}}};class LoadingManager{constructor(C,Rn,or){const So=this;let To,Ro=!1,Uo=0,Oo=0;const Ho=[];this.onStart=void 0,this.onLoad=C,this.onProgress=Rn,this.onError=or,this.itemStart=function(C){Oo++,!1===Ro&&void 0!==So.onStart&&So.onStart(C,Uo,Oo),Ro=!0},this.itemEnd=function(C){Uo++,void 0!==So.onProgress&&So.onProgress(C,Uo,Oo),Uo===Oo&&(Ro=!1,void 0!==So.onLoad&&So.onLoad())},this.itemError=function(C){void 0!==So.onError&&So.onError(C)},this.resolveURL=function(C){return To?To(C):C},this.setURLModifier=function(C){return To=C,this},this.addHandler=function(C,Rn){return Ho.push(C,Rn),this},this.removeHandler=function(C){const Rn=Ho.indexOf(C);return-1!==Rn&&Ho.splice(Rn,2),this},this.getHandler=function(C){for(let Rn=0,or=Ho.length;Rn<or;Rn+=2){const or=Ho[Rn],So=Ho[Rn+1];if(or.global&&(or.lastIndex=0),or.test(C))return So}return null}}}const cA=new LoadingManager;class Loader{constructor(C){this.manager=void 0!==C?C:cA,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(C,Rn){const or=this;return new Promise((function(So,To){or.load(C,So,Rn,To)}))}parse(){}setCrossOrigin(C){return this.crossOrigin=C,this}setWithCredentials(C){return this.withCredentials=C,this}setPath(C){return this.path=C,this}setResourcePath(C){return this.resourcePath=C,this}setRequestHeader(C){return this.requestHeader=C,this}}Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";class HttpError extends Error{constructor(C,Rn){super(C),this.response=Rn}}const uA="\\[\\]\\.:\\/",hA=new RegExp("["+uA+"]","g"),dA="[^"+uA+"]",pA="[^"+uA.replace("\\.","")+"]",mA=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",dA)+/(WCOD+)?/.source.replace("WCOD",pA)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dA)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dA)+"$"),fA=["material","materials","bones","map"];class PropertyBinding{constructor(C,Rn,or){this.path=Rn,this.parsedPath=or||PropertyBinding.parseTrackName(Rn),this.node=PropertyBinding.findNode(C,this.parsedPath.nodeName),this.rootNode=C,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(C,Rn,or){return C&&C.isAnimationObjectGroup?new PropertyBinding.Composite(C,Rn,or):new PropertyBinding(C,Rn,or)}static sanitizeNodeName(C){return C.replace(/\s/g,"_").replace(hA,"")}static parseTrackName(C){const Rn=mA.exec(C);if(null===Rn)throw new Error("PropertyBinding: Cannot parse trackName: "+C);const or={nodeName:Rn[2],objectName:Rn[3],objectIndex:Rn[4],propertyName:Rn[5],propertyIndex:Rn[6]},So=or.nodeName&&or.nodeName.lastIndexOf(".");if(void 0!==So&&-1!==So){const C=or.nodeName.substring(So+1);-1!==fA.indexOf(C)&&(or.nodeName=or.nodeName.substring(0,So),or.objectName=C)}if(null===or.propertyName||0===or.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+C);return or}static findNode(C,Rn){if(void 0===Rn||""===Rn||"."===Rn||-1===Rn||Rn===C.name||Rn===C.uuid)return C;if(C.skeleton){const or=C.skeleton.getBoneByName(Rn);if(void 0!==or)return or}if(C.children){const searchNodeSubtree=function(C){for(let or=0;or<C.length;or++){const So=C[or];if(So.name===Rn||So.uuid===Rn)return So;const To=searchNodeSubtree(So.children);if(To)return To}return null},or=searchNodeSubtree(C.children);if(or)return or}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(C,Rn){C[Rn]=this.targetObject[this.propertyName]}_getValue_array(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)C[Rn++]=or[So]}_getValue_arrayElement(C,Rn){C[Rn]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(C,Rn){this.resolvedProperty.toArray(C,Rn)}_setValue_direct(C,Rn){this.targetObject[this.propertyName]=C[Rn]}_setValue_direct_setNeedsUpdate(C,Rn){this.targetObject[this.propertyName]=C[Rn],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(C,Rn){this.targetObject[this.propertyName]=C[Rn],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)or[So]=C[Rn++]}_setValue_array_setNeedsUpdate(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)or[So]=C[Rn++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)or[So]=C[Rn++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(C,Rn){this.resolvedProperty[this.propertyIndex]=C[Rn]}_setValue_arrayElement_setNeedsUpdate(C,Rn){this.resolvedProperty[this.propertyIndex]=C[Rn],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(C,Rn){this.resolvedProperty[this.propertyIndex]=C[Rn],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(C,Rn){this.resolvedProperty.fromArray(C,Rn)}_setValue_fromArray_setNeedsUpdate(C,Rn){this.resolvedProperty.fromArray(C,Rn),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(C,Rn){this.resolvedProperty.fromArray(C,Rn),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(C,Rn){this.bind(),this.getValue(C,Rn)}_setValue_unbound(C,Rn){this.bind(),this.setValue(C,Rn)}bind(){let C=this.node;const Rn=this.parsedPath,or=Rn.objectName,So=Rn.propertyName;let To=Rn.propertyIndex;if(C||(C=PropertyBinding.findNode(this.rootNode,Rn.nodeName),this.node=C),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!C)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(or){let So=Rn.objectIndex;switch(or){case"materials":if(!C.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!C.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);C=C.material.materials;break;case"bones":if(!C.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);C=C.skeleton.bones;for(let Rn=0;Rn<C.length;Rn++)if(C[Rn].name===So){So=Rn;break}break;case"map":if("map"in C){C=C.map;break}if(!C.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!C.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);C=C.material.map;break;default:if(void 0===C[or])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);C=C[or]}if(void 0!==So){if(void 0===C[So])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,C);C=C[So]}}const Ro=C[So];if(void 0===Ro){const or=Rn.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+or+"."+So+" but it wasn't found.",C)}let Uo=this.Versioning.None;this.targetObject=C,void 0!==C.needsUpdate?Uo=this.Versioning.NeedsUpdate:void 0!==C.matrixWorldNeedsUpdate&&(Uo=this.Versioning.MatrixWorldNeedsUpdate);let Oo=this.BindingType.Direct;if(void 0!==To){if("morphTargetInfluences"===So){if(!C.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!C.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==C.morphTargetDictionary[To]&&(To=C.morphTargetDictionary[To])}Oo=this.BindingType.ArrayElement,this.resolvedProperty=Ro,this.propertyIndex=To}else void 0!==Ro.fromArray&&void 0!==Ro.toArray?(Oo=this.BindingType.HasFromToArray,this.resolvedProperty=Ro):Array.isArray(Ro)?(Oo=this.BindingType.EntireArray,this.resolvedProperty=Ro):this.propertyName=So;this.getValue=this.GetterByBindingType[Oo],this.setValue=this.SetterByBindingTypeAndVersioning[Oo][Uo]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}PropertyBinding.Composite=class{constructor(C,Rn,or){const So=or||PropertyBinding.parseTrackName(Rn);this._targetGroup=C,this._bindings=C.subscribe_(Rn,So)}getValue(C,Rn){this.bind();const or=this._targetGroup.nCachedObjects_,So=this._bindings[or];void 0!==So&&So.getValue(C,Rn)}setValue(C,Rn){const or=this._bindings;for(let So=this._targetGroup.nCachedObjects_,To=or.length;So!==To;++So)or[So].setValue(C,Rn)}bind(){const C=this._bindings;for(let Rn=this._targetGroup.nCachedObjects_,or=C.length;Rn!==or;++Rn)C[Rn].bind()}unbind(){const C=this._bindings;for(let Rn=this._targetGroup.nCachedObjects_,or=C.length;Rn!==or;++Rn)C[Rn].unbind()}},PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray],PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];new Float32Array(1);const gA=new Matrix4;class Raycaster{constructor(C,Rn,or,So){void 0===or&&(or=0),void 0===So&&(So=1/0),this.ray=new Ray(C,Rn),this.near=or,this.far=So,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(C,Rn){this.ray.set(C,Rn)}setFromCamera(C,Rn){Rn.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(Rn.matrixWorld),this.ray.direction.set(C.x,C.y,.5).unproject(Rn).sub(this.ray.origin).normalize(),this.camera=Rn):Rn.isOrthographicCamera?(this.ray.origin.set(C.x,C.y,(Rn.near+Rn.far)/(Rn.near-Rn.far)).unproject(Rn),this.ray.direction.set(0,0,-1).transformDirection(Rn.matrixWorld),this.camera=Rn):console.error("THREE.Raycaster: Unsupported camera type: "+Rn.type)}setFromXRController(C){return gA.identity().extractRotation(C.matrixWorld),this.ray.origin.setFromMatrixPosition(C.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(gA),this}intersectObject(C,Rn,or){return void 0===Rn&&(Rn=!0),void 0===or&&(or=[]),intersect(C,this,or,Rn),or.sort(ascSort),or}intersectObjects(C,Rn,or){void 0===Rn&&(Rn=!0),void 0===or&&(or=[]);for(let So=0,To=C.length;So<To;So++)intersect(C[So],this,or,Rn);return or.sort(ascSort),or}}function ascSort(C,Rn){return C.distance-Rn.distance}function intersect(C,Rn,or,So){let To=!0;if(C.layers.test(Rn.layers)){!1===C.raycast(Rn,or)&&(To=!1)}if(!0===To&&!0===So){const So=C.children;for(let C=0,To=So.length;C<To;C++)intersect(So[C],Rn,or,!0)}}"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:So}})),"undefined"!==typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=So)},4147:C=>{"use strict";C.exports=JSON.parse('{"i8":"3.0.2","cj":{"H":"https://gitlab.com/panoramax/clients/web-viewer"}}')},3517:C=>{"use strict";C.exports=JSON.parse('{"gvs":{"options":"Optionen","filters":"Filter","search":"Suche","layers":"Ebenen","share_links":"Links","share_page":"Link zu dieser Seite","loading_labels_fun":["\ud83e\udd8c Erkennung der \\"Reh kreuzt\\"-Schilder","\ud83d\ude98 Suche Panoramax-Auto \xa9","\u2615 Koffeininjektion","\ud83d\ude00 L\xe4chle, du wirst kartografiert!","\ud83d\udc08 Katzenfotos teilen","\ud83d\ude34 Reduzieren der Prokrastination","\ud83c\udf7a\ufe0f Bier brauen","\ud83d\udc27 Quellcode \xf6ffnen","\ud83d\udee3\ufe0f Indizierung der Autobahnen","\ud83e\uddf9 Metadatenreinigung","\ud83d\ude92 Senden der Fotos der Feuerwehren","\ud83d\udeb2 Gr\xfcne Radwege identifiziert","\ud83d\ude89 Durchgang zum Bahnsteig","\ud83d\udef0\ufe0f Suche Satelliten","\ud83d\udc65 Personas anlegen","\ud83c\udf2d\ufe0f Lokalisierung der Currywurst","\ud83e\uddd1\u200d\ud83d\udcbb Debugging des Interfaces","\ud83d\udcc8 Hochz\xe4hlen der Statistiken"],"search_empty":"Keine Ergebnisse gefunden","share":"Teilen","metadata_general_picid":"Bild-Identifier","zoom":"Zoom","zoomOut":"Herauszoomen","zoomIn":"Hereinzoomen","moveUp":"Nach oben","moveDown":"Nach unten","moveRight":"Nach rechts","moveMiddle":"Sicht zentrieren","map_theme_age":"Nach Aufnahmedatum","expand":"Vergr\xf6\xdfern","expand_info":"Widget im Vollbild anzeigen","show_psv":"Bildbetrachter anzeigen","show_map":"Karte anzeigen","search_user":"Benutzernamen suchen\u2026","filter_zoom_in":"Hereinzoomen um Filter sichtbar zu machen","picture_flat":"Klassisch","picture_360":"360\xb0","filter_camera_model":"Nach Kameramodell","filter_reset":"Filter l\xf6schen","map_background":"Kartenhintergrund","map_background_aerial":"Satelliten","map_background_streets":"Stra\xdfen","map_theme":"Karten-Art","metadata_exif_name":"Schlagwort","metadata_exif_value":"Wert","map_theme_age_2":"<2 Jahre","map_theme_age_3":"<1 Jahr","map_theme_type":"Nach Kameratyp","contrast":"H\xf6heren Bildkontrast aktivieren","metadata":"Bildmetadaten","metadata_general_seqid":"Sequenzidentifier","metadata_general_picid_link":"Zur JOSN-Beschreibung des Bildes gehen","loading_labels_serious":["\ud83d\uddfa\ufe0f Laden der Kartendaten","\ud83d\udda5\ufe0f API anfragen","\ud83d\uddbc\ufe0f Vorschaubilder laden","\ud83d\udd0d EXIF Metadaten analysieren","\ud83c\udfd8\ufe0f 3D-Rendering","\ud83d\udcf7 360\xb0 Fotos initialisieren","\ud83d\udfe0 Farben balancieren"],"search_address":"Suchen sie eine Adresse, Stadt, \u2026","share_image":"HD Bild","share_rss":"RSS Feed","share_embed":"Auf Webseite einbetten","share_print":"Druck","copy":"Kopieren","copied":"Kopiert","error":"Panoramax ist abgest\xfcrzt\u2026","sequence_next":"N\xe4chstes Foto in der Sequenz","sequence_play":"Sequenz abspielen","sequence_pause":"Sequenz pausieren","sequence_prev":"Vorheriges Foto in der Sequenz","sequence_more":"Mehr Abspieloptionen","sequence_speed":"Abspielgeschwindigkeit","legend_license":"Lizenz: {l}","edit_osm":"OSM editieren","id":"iD","josm":"JOSM","josm_live":"Einschalten der automatischen JOSM-Synchronisierung beim Laden eines Bildes","error_psv":"Betrachter f\xfcr die Photospheres wurde nicht richtig geladen","error_pic":"Gesuchtes Foto wurde nicht gefunden","error_nopic":"Kein Foto verf\xfcgbar an dieser Position","error_api":"Foto-Server ist nicht verf\xfcgbar","error_josm":"JOSM reagiert nicht, ist es ge\xf6ffnet und die Remote eingeschaltet?","error_api_compatibility":"Der Foto-Server ist nicht mit dieser Version des Betrachters kompatibel","filter_date":"Nach Datum","filter_user":"Nach Benutzer","filter_picture":"Nach Foto-Art","map_theme_default":"Nach standard","map_theme_age_1":">2 Jahre","metadata_general_seqid_link":"Zur JSON-Beschreibung der Sequenz gehen","metadata_general_author":"Autor","metadata_general_license":"Lizenz","metadata_general_date":"Aufnahmedatum","metadata_camera":"Kamera","metadata_camera_make":"Hersteller","metadata_camera_model":"Modell","metadata_camera_type":"Typ","metadata_camera_focal_length":"Brennweite","metadata_location":"Ort","metadata_location_longitude":"L\xe4ngengrad","metadata_location_latitude":"Breitengrad","metadata_location_orientation":"Aufnahmerichtung","metadata_location_precision":"Pr\xe4zision der Positionierung","metadata_exif":"EXIF / XMP","minimize":"Widget verbergen, sie k\xf6nnen es \xfcber die Schaltfl\xe4che in der linken unteren Ecke wieder einblenden","map_theme_age_4":"< 1 Monat","error_subtitle":"Bitte versuchen sie es sp\xe4ter erneut, oder schauen sie in die Web-Browser-Konsole f\xfcr mehr Details.","moveLeft":"Nach links","share_rss_title":"RSS Feed neuer Sequenzen auf der aktuell sichtbaren Karte","error_webgl":"WebGL wird von diesem Browser nicht unterst\xfctzt","metadata_general_license_link":"Zur vollen Lizenzbeschreibung gehen","share_embed_docs":"Mehr \xfcber die Einbettungs-Konfiguration lesen","report_nature":{"":"Art des Problems ausw\xe4hlen\u2026","inappropriate":"Bild ist unangemessen (irrelevant, Nacktheit, ...)","picture_low_quality":"Bild hat eine sehr schlechte Qualit\xe4t","blur_missing":"Das Gesicht einer Person oder ein KFZ-Kennzeichen ist sichtbar","blur_excess":"Ein Objekt das nicht unkenntlich gemacht werden muss wurde unkenntlich gemacht","privacy":"Ein privater Pfad oder ein privates Grundst\xfcck ist sichtbar","mislocated":"Bild ist falsch auf der Karte verortet","copyright":"Bild verletzt das Urheberrecht","other":"Andere Art von Problem"},"report_details_placeholder":"Sie k\xf6nnen optionale Details \xfcber das Problem hinzuf\xfcgen","report_auth":"Dieser Report wird durch ihren Account \\"{a}\\" gesendet","report_nature_label":"Art des Problems","report_whole_sequence":"Dies betrifft die gesamte Sequenz","report_details":"Weitere Details","report_email":"Ihre Email","report_email_placeholder":"Optional","report_submit":"Absenden","report_success":"Ihr Report wurde erfolgreich gesendet. Er wird so schnell wie m\xf6glich \xfcberpr\xfcft.","report_failure":"Ein Fehler ist bei der Erstellung des Reports aufgetreten: {e}. Bitte versuchen sie es erneut.","report":"Foto melden"},"psv":{"twoFingers":"Nutzen sie zwei Finger zum navigieren","ctrlZoom":"Nutzen sie Strg+Scrollen um das Bild zu zoomen","loadError":"Das Panorama konnte nicht geladen werden"},"map":{"thumbnail":"Vorschau des marktierten Fotos","no_thumbnail":"Keine Vorschau","not_public":"Nicht \xf6ffentlich sichtbar","loading":"Laden\u2026"},"maplibre":{"GeolocateControl.FindMyLocation":"Meinen Standort finden","GeolocateControl.LocationNotAvailable":"Standort nicht verf\xfcgbar"}}')},1700:C=>{"use strict";C.exports=JSON.parse('{"psv":{"twoFingers":"Use two fingers to navigate","ctrlZoom":"Use ctrl + scroll to zoom the image","loadError":"The panorama can\'t be loaded"},"maplibre":{"GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available"},"gvs":{"zoom":"Zoom","zoomOut":"Zoom out","zoomIn":"Zoom in","moveUp":"Move up","moveDown":"Move down","moveLeft":"Move left","moveRight":"Move right","moveMiddle":"Center view","expand":"Expand","expand_info":"Make the widget appear in full page","show_psv":"Show the picture viewer","show_map":"Show the map","minimize":"Hide this widget, you can show it again using button in bottom left corner","options":"Options","filters":"Filters","layers":"Layers","search":"Search","search_empty":"No results found","search_address":"Search an address, city\u2026","search_user":"Search a username\u2026","share":"Share","share_links":"Links","share_page":"Link to this page","share_image":"HD Image","share_rss":"RSS feed","share_rss_title":"RSS feed of new sequences on the map visible area","share_embed":"Embed on your website","share_embed_docs":"Read more about embed configuration","share_print":"Print","copy":"Copy","copied":"Copied","error":"We have a problem\u2026","error_click":"Click to continue","error_retry":"Please retry later","sequence_next":"Next picture in sequence","sequence_play":"Play along this sequence","sequence_pause":"Pause sequence","sequence_prev":"Previous picture in sequence","sequence_more":"More play options","sequence_speed":"Player speed","legend_license":"License: {l}","legend_title":"Show details of picture","edit_osm":"Edit OSM","id":"iD","josm":"JOSM","josm_live":"Enable JOSM automatic sync on picture loading","loading_labels_serious":["\ud83d\uddfa\ufe0f Loading map data","\ud83d\udda5\ufe0f Querying API","\ud83d\uddbc\ufe0f Loading thumbnails","\ud83d\udd0d Analyzing EXIF metadata","\ud83c\udfd8\ufe0f 3D rendering","\ud83d\udcf7 Initializing 360\xb0 pictures","\ud83d\udfe0 Colour balancing"],"loading_labels_fun":["\ud83e\udd8c Deer crossing sign detection","\ud83d\ude98 Searching Panoramax Car \xa9","\u2615 Caffeine injection","\ud83d\ude00 Smile, you\'re mapped!","\ud83d\udc08 Sharing cat pictures","\ud83d\ude34 Reducing procrastination","\ud83e\uded6 Brewing tea","\ud83d\udc27 Opening source code","\ud83d\ude87 Indexing Underground stations","\ud83e\uddf9 Metadata cleanup","\ud83d\ude92 Sending fire station photos","\ud83d\udeb2 Greenways update","\ud83d\ude89 Station platform walkthrough","\ud83d\udef0\ufe0f Searching satellites","\ud83d\udc65 Writing personas","\ud83d\udc1f Locating chip shops","\ud83e\uddd1\u200d\ud83d\udcbb Debugging interface","\ud83d\udcc8 Incrementing statistics"],"error_psv":"Photo Sphere Viewer is not loading properly","error_pic":"Wanted picture wasn\'t found","error_nopic":"No picture available at given position","error_api":"The pictures server is not available","error_webgl":"WebGL is not supported on this browser","error_josm":"JOSM doesn\'t respond, is it running and is remote enabled?","error_api_compatibility":"The pictures server is not compatible with this viewer version","filter_date":"By date","filter_user":"By user","filter_picture":"By picture type","filter_zoom_in":"Zoom-in for filters to be visible","picture_flat":"Classic","picture_360":"360\xb0","filter_camera_model":"By camera model","filter_reset":"Clear filters","map_background":"Map background","map_background_aerial":"Aerial","map_background_streets":"Streets","map_theme":"Map theme","map_theme_default":"By default","map_theme_age":"By capture date","map_theme_age_1":"> 2 years","map_theme_age_2":"< 2 years","map_theme_age_3":"< 1 year","map_theme_age_4":"< 1 month","map_theme_type":"By camera type","contrast":"Enable higher image contrast","metadata":"Picture metadata","metadata_general_picid":"Picture identifier","metadata_general_seqid":"Sequence identifier","metadata_general_picid_link":"Go to JSON description of the picture","metadata_general_seqid_link":"Go to JSON description of the sequence","metadata_general_author":"Author","metadata_general_license":"License","metadata_general_license_link":"Go to license full description page","metadata_general_date":"Capture date","metadata_camera":"Camera","metadata_camera_make":"Make","metadata_camera_model":"Model","metadata_camera_type":"Type","metadata_camera_focal_length":"Focal length","metadata_location":"Location","metadata_location_longitude":"Longitude","metadata_location_latitude":"Latitude","metadata_location_orientation":"Capture direction","metadata_location_precision":"Positioning precision","metadata_exif":"EXIF / XMP","metadata_exif_name":"Tag","metadata_exif_value":"Value","report":"Report picture","report_auth":"This report will be sent using your account \\"{a}\\"","report_nature_label":"Nature of the issue","report_nature":{"":"Select the nature of issue\u2026","blur_missing":"A person face or car plate is visible","blur_excess":"An object not needing blur is blurred","inappropriate":"Picture is inappropriate (unrelated, nudity\u2026)","privacy":"A private path or property is visible","picture_low_quality":"Picture is of very bad quality","mislocated":"Picture is badly positioned on map","copyright":"Picture infringes copyright","other":"Any other kind of issue"},"report_whole_sequence":"This concerns the entire sequence","report_details":"Additional details","report_details_placeholder":"Optional, you can add details about the issue and how this is concerning","report_email":"Your email","report_email_placeholder":"Optional","report_submit":"Submit","report_wait":"Sending report...","report_success":"Report has been successfully sent. It will be reviewed as soon as possible.","report_failure":"An error occurred when creating report: {e}. Please try again later."},"map":{"loading":"Loading\u2026","thumbnail":"Thumbnail of hovered picture","no_thumbnail":"No thumbnail","not_public":"Not publicly visible"}}')},6980:C=>{"use strict";C.exports=JSON.parse('{"gvs":{"report_auth":"La denuncia se enviar\xe1 usando tu cuenta \xab{a}\xbb","report":"Denunciar imagen","report_nature_label":"Tipo de problema","report_nature":{"":"Selecciona el tipo de problema\u2026","blur_missing":"Se ve el rostro de una persona, o una matr\xedcula","blur_excess":"Est\xe1 borroso un objeto que no hac\xeda falta ocultar","inappropriate":"La imagen no es apropiada (irrelevante, desnudez, \u2026)","privacy":"Se ve un camino privado, o una propiedad privada","mislocated":"La localizaci\xf3n de la imagen en el mapa no es correcta","picture_low_quality":"La calidad de la imagen es pobre","copyright":"La imagen infringe derechos de autor","other":"Otro tipo de problema"},"sequence_more":"M\xe1s opciones de reproducci\xf3n","sequence_speed":"Velocidad de reproducci\xf3n","legend_license":"Licencia: {l}","edit_osm":"Editar OpenStreetMap","id":"iD","josm":"JOSM","josm_live":"Activar la sincronizaci\xf3n autom\xe1tica de JOSM cuando se carga una imagen","loading_labels_serious":["\ud83d\uddfa\ufe0f Cargando datos del mapa","\ud83d\udda5\ufe0f Consultando la API","\ud83d\uddbc\ufe0f Cargando vistas previas","\ud83d\udd0d Analizando metadatos EXIF","\ud83c\udfd8\ufe0f Renderizado 3D","\ud83d\udcf7 Preparando im\xe1genes 360\xb0","\ud83d\udfe0 Ajustando balance de color"],"metadata":"Metadatos de la imagen","map_theme_type":"Por tipo de c\xe1mara","contrast":"Dar m\xe1s contraste a la imagen","zoom":"Acercar/alejar","zoomOut":"Alejar","map_background_streets":"Calles","loading_labels_fun":["\ud83e\udd8c Detectando paneles de cruce de alces","\ud83d\ude98 Buscando el Coche Panoramax \xa9","\u2615 Inyectando cafe\xedna","\ud83d\ude00 \xa1Sonr\xede, est\xe1s siendo mapeado!","\ud83d\udc08 Compartiendo fotos de gatos","\ud83d\ude34 Reduciendo la procrastinaci\xf3n","\ud83e\uded6 Preparando el t\xe9","\ud83d\udc27 Abriendo el c\xf3digo fuente","\ud83d\ude87 Indexando estaciones del metro","\ud83e\uddf9 Limpieza de metadatos","\ud83d\ude92 Enviando fotos de estaciones de bomberos","\ud83d\udeb2 Actualizando v\xedas verdes","\ud83d\ude89 Paseo por el and\xe9n de la estaci\xf3n","\ud83d\udef0\ufe0f Buscando sat\xe9lites","\ud83d\udc65 Describiendo tipolog\xedas de persona","\ud83d\udc1f Localizando tiendas de fish & chips","\ud83e\uddd1\u200d\ud83d\udcbb Buscando gazapos de la interfaz","\ud83d\udcc8 Incrementando estad\xedsticas"],"metadata_general_license_link":"Ir a la descripci\xf3n completa de la licencia","metadata_general_picid":"Identificador de la imagen","metadata_general_license":"Licencia","report_details_placeholder":"Opcional; puedes a\xf1adir m\xe1s detalles sobre el problema y por qu\xe9 te preocupa","expand":"Expandir","expand_info":"Mostrar el elemento ocupando toda la p\xe1gina","show_psv":"Mostrar el visor de im\xe1genes","show_map":"Mostrar el mapa","zoomIn":"Acercar","moveUp":"Desplazar hacia arriba","moveDown":"Desplazar hacia abajo","moveLeft":"Desplazar hacia la izquierda","moveRight":"Desplazar hacia la derecha","moveMiddle":"Centrar la vista","minimize":"Esconder este elemento. Para mostrarlo de nuevo, pulsa el bot\xf3n en la esquina inferior izquierda","options":"Opciones","filters":"Filtros","layers":"Capas","search":"Buscar","search_empty":"No se encontraron resultados","search_address":"Buscar una direcci\xf3n, una ciudad, \u2026","search_user":"Buscar un usuario\u2026","share":"Compartir","share_links":"Enlaces","share_page":"Enlace a esta p\xe1gina","share_image":"Imagen de alta calidad","share_rss":"Flujo RSS","share_rss_title":"Flujo RSS de las nuevas secuencias en el \xe1rea visible del mapa","share_embed":"Incrustar en tu p\xe1gina web","share_embed_docs":"M\xe1s informaci\xf3n sobre c\xf3mo configurar el incrustado","share_print":"Imprimir","copy":"Copiar","copied":"Copiado","error":"Hay un problema\u2026","sequence_next":"Siguiente imagen de la secuencia","sequence_play":"Reproducir esta secuencia","sequence_pause":"Pausar la secuencia","sequence_prev":"Imagen anterior de la secuencia","error_click":"Haz click para continuar","error_retry":"Por favor, int\xe9ntalo m\xe1s tarde","error_psv":"El visor de fotos esf\xe9ricas no se carga correctamente","error_pic":"No se encuentra la imagen que quer\xedamos","error_nopic":"No hay im\xe1genes para la posici\xf3n dada","error_api":"El servidor de im\xe1genes no est\xe1 disponible","error_webgl":"Este navegador no admite WebGL","error_josm":"JOSM no responde. \xbfEst\xe1 abierto, y admite el modo de Control Remoto?","error_api_compatibility":"El servidor de im\xe1genes no es compatible con esta versi\xf3n del visor","filter_date":"Por fecha","filter_user":"Por usuario","filter_picture":"Por tipo de imagen","filter_zoom_in":"Ac\xe9rcate para poder ver filtros","picture_flat":"Cl\xe1sico","picture_360":"360\xb0","filter_camera_model":"Por modelo de c\xe1mara","filter_reset":"Quitar filtros","map_background":"Fondo de mapa","map_background_aerial":"Vista a\xe9rea","map_theme":"Tema de mapa","map_theme_default":"Por defecto","map_theme_age":"Por fecha de toma de imagen","map_theme_age_1":"M\xe1s de dos a\xf1os","map_theme_age_2":"Menos de dos a\xf1os","map_theme_age_3":"Menos de un a\xf1o","map_theme_age_4":"Menos de un mes","metadata_general_seqid":"Identificador de la secuencia","metadata_general_picid_link":"Ir a la descripci\xf3n de la imagen en formato JSON","metadata_general_seqid_link":"Ir a la descripci\xf3n de la secuencia en formato JSON","metadata_general_author":"Autor","metadata_general_date":"Fecha de toma de imagen","metadata_camera":"C\xe1mara","metadata_camera_make":"Marca","metadata_camera_model":"Modelo","metadata_camera_type":"Tipo","metadata_camera_focal_length":"Distancia focal","metadata_location":"Localizaci\xf3n","metadata_location_longitude":"Longitud","metadata_location_latitude":"Latitud","metadata_location_orientation":"Orientaci\xf3n","metadata_location_precision":"Precisi\xf3n de la localizaci\xf3n","metadata_exif":"EXIF / XMP","metadata_exif_name":"Etiqueta","metadata_exif_value":"Valor","report_whole_sequence":"El problema afecta a la secuencia entera","report_details":"M\xe1s detalles","report_email":"Tu direcci\xf3n de correo electr\xf3nico","report_email_placeholder":"Opcional","report_submit":"Enviar","report_success":"La denuncia se ha enviado correctamente. Ser\xe1 revisada lo antes posible.","report_failure":"Ocurri\xf3 un error al crear la denuncia: {e}. Por favor, int\xe9ntalo m\xe1s tarde."},"psv":{"ctrlZoom":"Utiliza Control+rueda de desplazamiento para acercar/alejar","loadError":"Este panorama no se puede cargar","twoFingers":"Desplaza el mapa con dos dedos"},"maplibre":{"GeolocateControl.FindMyLocation":"Local\xedzame","GeolocateControl.LocationNotAvailable":"Localizaci\xf3n no disponible"},"map":{"loading":"Cargando\u2026","thumbnail":"Vista previa de la imagen bajo el cursor","no_thumbnail":"No hay vista previa","not_public":"No es visible p\xfablicamente"}}')},6493:C=>{"use strict";C.exports=JSON.parse('{"psv":{"twoFingers":"Utilisez deux doigts pour vous d\xe9placer","ctrlZoom":"Utilisez ctrl + scroll pour zoomer dans l\'image","loadError":"L\'image ne peut pas \xeatre charg\xe9e"},"maplibre":{"GeolocateControl.FindMyLocation":"Afficher ma position","GeolocateControl.LocationNotAvailable":"GPS non-disponible"},"gvs":{"zoom":"Zoom","zoomOut":"D\xe9zoomer","zoomIn":"Zoomer","moveUp":"Vers le haut","moveDown":"Vers le bas","moveLeft":"Vers la gauche","moveRight":"Vers la droite","moveMiddle":"Centrer la vue","expand":"Agrandir","expand_info":"Faire appara\xeetre ce widget en pleine page","show_psv":"Afficher la visionneuse de photos","show_map":"Afficher la carte","minimize":"Masquer ce widget, vous pouvez l\'afficher de nouveau gr\xe2ce au bouton dans le coin en bas \xe0 gauche","options":"Options","filters":"Filtres","layers":"Calques","search":"Rechercher","search_empty":"Aucun r\xe9sultat","search_address":"Rechercher une adresse, ville\u2026","search_user":"Rechercher un nom d\'utilisateur\u2026","share":"Partager","share_links":"Liens utiles","share_page":"Lien de la page","share_image":"Image HD","share_rss":"Flux RSS","share_rss_title":"Flux RSS des nouvelles s\xe9quences dans la zone visible sur la carte","share_embed":"Int\xe9gration sur votre site","share_embed_docs":"D\xe9couvrir plus de possibilit\xe9s pour l\'int\xe9gration sur votre site","share_print":"Imprimer","copy":"Copier","copied":"Copi\xe9","error":"On a un probl\xe8me\u2026","error_click":"Cliquez pour continuer","error_retry":"Merci de r\xe9essayer plus tard","sequence_next":"Photo suivante dans la s\xe9quence","sequence_play":"Parcourir cette s\xe9quence","sequence_pause":"Mettre en pause la s\xe9quence","sequence_prev":"Photo pr\xe9c\xe9dente dans la s\xe9quence","sequence_more":"Plus d\'options de lecture","sequence_speed":"Vitesse de lecture","legend_license":"Licence : {l}","legend_title":"Afficher les d\xe9tails de l\'image","edit_osm":"Contribuer sur OSM","id":"iD","josm":"JOSM","josm_live":"Active la synchronisation automatique de JOSM lors du chargement d\'une photo","loading_labels_serious":["\ud83d\uddfa\ufe0f Chargement du fond de carte","\ud83d\udda5\ufe0f Interrogation de l\'API","\ud83d\uddbc\ufe0f Chargement des miniatures","\ud83d\udd0d Analyse des m\xe9tadonn\xe9es EXIF","\ud83c\udfd8\ufe0f Cr\xe9ation du rendu 3D","\ud83d\udcf7 Initialisation des vues 360\xb0","\ud83d\udfe0 \xc9quilibrage des couleurs"],"loading_labels_fun":["\ud83e\udd8c D\xe9tection des panneaux biche","\ud83d\ude98 Recherche de la Panoramax Car \xa9","\u2615 Injection de caf\xe9ine","\ud83d\ude00 Souriez, vous \xeates mapp\xe9s !","\ud83d\udc08 Partage de photos de chats","\ud83d\ude34 R\xe9duction de la procrastination","\ud83c\uddf7\ud83c\uddea Chargement : 974%","\ud83d\udc27 Ouverture du code source","\ud83e\udd81 Indexation des traboules","\ud83e\uddf9 Nettoyage des m\xe9tadonn\xe9es","\ud83d\ude92 Envoi des photos du SDIS","\ud83d\udeb2 Mise \xe0 jour des voies vertes","\ud83d\ude89 Remont\xe9e des quais de gare","\ud83d\udef0\ufe0f Recherche de satellites","\ud83d\udc65 \xc9criture des personas","\ud83e\udd5e Localisation des cr\xeaperies","\ud83e\uddd1\u200d\ud83d\udcbb D\xe9boguage de l\'interface","\ud83d\udcc8 Incr\xe9mentation des statistiques"],"error_psv":"Photo Sphere Viewer ne s\'est pas charg\xe9 correctement","error_pic":"La photo demand\xe9e est introuvable","error_nopic":"Aucune photo disponible autour de la localisation recherch\xe9e","error_api":"Le serveur de photos n\'est pas disponible","error_webgl":"WebGL n\'est pas support\xe9 par ce navigateur","error_josm":"JOSM n\'a pas r\xe9pondu, est-il bien lanc\xe9 et la t\xe9l\xe9commande activ\xe9e ?","error_api_compatibility":"Le serveur de photos n\'est pas compatible avec cette visionneuse","filter_date":"Par date","filter_user":"Par utilisateur","filter_picture":"Par type d\'image","picture_flat":"Classique","picture_360":"360\xb0","filter_camera_model":"Par mod\xe8le d\'appareil","filter_reset":"Retirer les filtres","filter_zoom_in":"Zoomez plus pour voir les filtres","map_background":"Fond de carte","map_background_aerial":"Satellite","map_background_streets":"Plan","map_theme":"Rendu de carte","map_theme_default":"Par d\xe9faut","map_theme_age":"Par date de prise de vue","map_theme_age_1":"> 2 ans","map_theme_age_2":"< 2 ans","map_theme_age_3":"< 1 an","map_theme_age_4":"< 1 mois","map_theme_type":"Par type de cam\xe9ra","contrast":"Augmenter le contraste de l\'image","metadata":"M\xe9tadonn\xe9es de la photo","metadata_general_picid":"Identifiant de photo","metadata_general_seqid":"Identifiant de s\xe9quence","metadata_general_picid_link":"Aller au descriptif JSON de la photo","metadata_general_seqid_link":"Aller au descriptif JSON de la s\xe9quence","metadata_general_author":"Auteur","metadata_general_license":"Licence","metadata_general_license_link":"Aller \xe0 la page de pr\xe9sentation de la licence","metadata_general_date":"Date de prise de vue","metadata_camera":"Appareil","metadata_camera_make":"Fabricant","metadata_camera_model":"Mod\xe8le","metadata_camera_type":"Type","metadata_camera_focal_length":"Longueur focale","metadata_location":"Localisation","metadata_location_longitude":"Longitude","metadata_location_latitude":"Latitude","metadata_location_orientation":"Direction de prise de vue","metadata_location_precision":"Pr\xe9cision du positionnement","metadata_exif":"EXIF / XMP","metadata_exif_name":"Balise","metadata_exif_value":"Valeur","report":"Signaler la photo","report_auth":"Ce signalement sera envoy\xe9 en utilisant votre compte \\"{a}\\"","report_nature_label":"Nature du probl\xe8me","report_nature":{"":"S\xe9lectionnez la nature du probl\xe8me\u2026","blur_missing":"Un visage ou une plaque d\'immatriculation est visible","blur_excess":"Un objet qui ne n\xe9cessite pas de floutage est flout\xe9","inappropriate":"L\'image est inappropri\xe9e (non pertinente, nudit\xe9\u2026)","privacy":"Un chemin priv\xe9 ou une propri\xe9t\xe9 priv\xe9e est visible","picture_low_quality":"L\'image est de mauvaise qualit\xe9","mislocated":"L\'image est mal g\xe9olocalis\xe9e","copyright":"L\'image enfreint les droits d\'auteur","other":"Tout autre type de probl\xe8me"},"report_whole_sequence":"Cela concerne toute la s\xe9quence","report_details":"D\xe9tails suppl\xe9mentaires","report_details_placeholder":"Optionnel, vous pouvez ajouter des d\xe9tails sur le probl\xe8me","report_email":"Votre email","report_email_placeholder":"Optionnel","report_submit":"Envoyer","report_wait":"Envoi du signalement en cours...","report_success":"Le signalement a \xe9t\xe9 envoy\xe9 avec succ\xe8s. Il sera examin\xe9 d\xe8s que possible.","report_failure":"Une erreur est survenue lors de la cr\xe9ation du signalement : {e}. Veuillez r\xe9essayer plus tard."},"map":{"loading":"Chargement\u2026","thumbnail":"Miniature de la photo survol\xe9e","no_thumbnail":"Pas de miniature","not_public":"Masqu\xe9 au public"}}')},6254:C=>{"use strict";C.exports=JSON.parse('{"psv":{"twoFingers":"Haszn\xe1ljon k\xe9t ujjat a navig\xe1ci\xf3hoz","ctrlZoom":"Haszn\xe1ljon Ctrl + g\xf6rget\xe9st a k\xe9p nagy\xedt\xe1s\xe1hoz","loadError":"A panor\xe1ma nem t\xf6lthet\u0151 be"},"gvs":{"zoom":"Nagy\xedt\xe1s","zoomOut":"Nagy\xedt\xe1s","zoomIn":"Kicsiny\xedt\xe1s","moveUp":"Mozg\xe1s fel","moveDown":"Mozg\xe1s le","moveLeft":"Mozg\xe1s balra","moveRight":"Mozg\xe1s jobbra","moveMiddle":"N\xe9zet k\xf6z\xe9pre hoz\xe1sa","expand":"B\u0151v\xedteni","expand_info":"A widget teljes oldalon t\xf6rt\xe9n\u0151 megjelen\xedt\xe9se","show_psv":"A k\xe9pn\xe9zeget\u0151 megjelen\xedt\xe9se","show_map":"A t\xe9rk\xe9p megjelen\xedt\xe9se","minimize":"Kis m\xe9ret","options":"Be\xe1ll\xedt\xe1sok","filters":"Sz\u0171r\u0151k","layers":"R\xe9tegek","share":"Megoszt\xe1s","search":"Keres\xe9s","search_empty":"Nincs eredm\xe9ny","share_links":"Hivatkoz\xe1sok","share_page":"Ez az oldal","share_image":"HD felbont\xe1s\xfa k\xe9p","share_rss":"RSS","share_rss_title":"A t\xe9rk\xe9p l\xe1that\xf3 ter\xfclet\xe9n l\xe9v\u0151 \xfaj sorozatok RSS-h\xedrcsatorn\xe1ja","share_embed":"Be\xe1gyaz\xe1s a weboldal\xe1n","share_print":"Nyomtat\xe1s","copy":"M\xe1sol\xe1s","copied":"M\xe1solva","error":"A Panoramax \xf6sszeomlott\u2026","error_subtitle":"Pr\xf3b\xe1lja \xfajra k\xe9s\u0151bb, vagy n\xe9zze meg a b\xf6ng\xe9sz\u0151konzolt a tov\xe1bbi r\xe9szletek\xe9rt.","sequence_next":"A sorozat k\xf6vetkez\u0151 k\xe9pe","sequence_play":"V\xe9gigl\xe9pked\xe9s a sorozaton","sequence_pause":"Sorozat sz\xfcnetelt\xe9se","sequence_prev":"A sorozat el\u0151z\u0151 k\xe9pe","sequence_more":"Tov\xe1bbi lej\xe1tsz\xe1si lehet\u0151s\xe9gek","sequence_speed":"Lej\xe1tsz\xf3 sebess\xe9ge","legend_license":"Licenc: {l}","edit_osm":"Az OSM szerkeszt\xe9se","id":"iD","josm":"JOSM","josm_live":"A JOSM automatikus szinkroniz\xe1l\xe1s\xe1nak enged\xe9lyez\xe9se k\xe9pbet\xf6lt\xe9skor","loading_labels_serious":["\ud83d\uddfa\ufe0f Loading map data","\ud83d\udda5\ufe0f Querying API","\ud83d\uddbc\ufe0f Loading thumbnails","\ud83d\udd0d Analyzing EXIF metadata","\ud83c\udfd8\ufe0f 3D rendering","\ud83d\udcf7 Initializing 360\xb0 pictures","\ud83d\udfe0 Colour balancing"],"loading_labels_fun":["\ud83e\udd8c Deer crossing sign detection","\ud83d\ude98 Searching Panoramax Car \xa9","\u2615 Caffeine injection","\ud83d\ude00 Smile, you\'re mapped!","\ud83d\udc08 Sharing cat pictures","\ud83d\ude34 Reducing procrastination","\ud83e\uded6 Brewing tea","\ud83d\udc27 Opening source code","\ud83d\ude87 Indexing Underground stations","\ud83e\uddf9 Metadata cleanup","\ud83d\ude92 Sending fire station photos","\ud83d\udeb2 Greenways update","\ud83d\ude89 Station platform walkthrough","\ud83d\udef0\ufe0f Searching satellites","\ud83d\udc65 Writing personas","\ud83d\udc1f Locating chip shops","\ud83e\uddd1\u200d\ud83d\udcbb Debugging interface","\ud83d\udcc8 Incrementing statistics"],"error_psv":"A f\xe9nyk\xe9pek g\xf6mbmegjelen\xedt\u0151je nem megfelel\u0151en t\xf6lt\u0151dik be","error_pic":"A k\xe9rt k\xe9p nem t\xf6lthet\u0151 be","error_nopic":"Nem \xe9rhet\u0151 el k\xe9p a megadott helyen","error_api":"A k\xe9pkiszolg\xe1l\xf3 nem \xe9rhet\u0151 el","error_webgl":"A WebGL nem t\xe1mogatott ebben a b\xf6ng\xe9sz\u0151ben","error_josm":"A JOSM nem v\xe1laszol, fut \xe9s el\xe9rhet\u0151 t\xe1volr\xf3l?","error_api_compatibility":"A fot\xf3kiszolg\xe1l\xf3 nem kompatibilis ezzel a megjelen\xedt\u0151vel","filter_date":"D\xe1tum szerint","filter_user":"Felhaszn\xe1l\xf3 szerint","filter_picture":"K\xe9p t\xedpusa szerint","picture_flat":"Klasszikus","picture_360":"360\xb0","filter_camera_model":"Kameramodell szerint","filter_reset":"Sz\u0171r\u0151k t\xf6rl\xe9se","map_background":"T\xe9rk\xe9pes h\xe1tt\xe9r","map_background_aerial":"L\xe9gi","map_background_streets":"Utc\xe1k","map_theme":"T\xe9rk\xe9p t\xe9m\xe1ja","map_theme_default":"Alap\xe9rtelmez\xe9s szerint","map_theme_age":"R\xf6gz\xedt\xe9s ideje szerint","map_theme_age_1":"> 2 \xe9ve","map_theme_age_2":"< 2 \xe9ve","map_theme_age_3":"< 1 \xe9ve","map_theme_age_4":"< 1 h\xf3napja","map_theme_type":"Kamerat\xedpus szerint","contrast":"Magas k\xe9pkontraszt bekapcsol\xe1sa","metadata":"Fot\xf3 metaadatok","metadata_general_picid":"F\xe9nyk\xe9p azonos\xedt\xf3ja","metadata_general_seqid":"Sorozat azonos\xedt\xf3","metadata_general_picid_link":"Tov\xe1bb a f\xe9nyk\xe9p JSON le\xedr\xe1s\xe1hoz","metadata_general_seqid_link":"Tov\xe1bb a sorozat JSON le\xedr\xe1s\xe1hoz","metadata_general_author":"Szerz\u0151","metadata_general_license":"Enged\xe9ly","metadata_general_license_link":"Tov\xe1bb a licenc bemutat\xf3 oldal\xe1ra","metadata_general_date":"K\xe9sz\xedt\xe9s d\xe1tuma","metadata_camera":"Kamera","metadata_camera_make":"Gy\xe1rt\xf3","metadata_camera_model":"Modell","metadata_camera_type":"T\xedpus","metadata_camera_focal_length":"Gy\xfajt\xf3t\xe1vols\xe1g","metadata_location":"Helysz\xedn","metadata_location_longitude":"Hossz\xfas\xe1g","metadata_location_latitude":"Sz\xe9less\xe9g","metadata_location_orientation":"Felv\xe9teli ir\xe1ny","metadata_location_precision":"Helymeghat\xe1roz\xe1si pontoss\xe1g","metadata_exif":"EXIF / XMP","metadata_exif_name":"C\xedmke","metadata_exif_value":"\xc9rt\xe9k"},"map":{"loading":"Bet\xf6lt\xe9s\u2026","thumbnail":"A kurzorral mutatott k\xe9p b\xe9lyegk\xe9pe","no_thumbnail":"Nincs b\xe9lyegk\xe9p","not_public":"Nem l\xe1that\xf3 nyilv\xe1nosan"}}')},1392:C=>{"use strict";C.exports=JSON.parse('{"gvs":{"contrast":"\u589e\u52a0\u76f8\u7247\u5c0d\u6bd4\u5ea6","copied":"\u5df2\u8907\u88fd","copy":"\u8907\u88fd","edit_osm":"\u7de8\u8f2f OSM","error":"Panoramax \u7576\u6a5f\u4e86\u2026","error_api":"\u76f8\u7247\u4f3a\u670d\u5668\u7121\u6cd5\u4f7f\u7528","error_api_compatibility":"\u76f8\u7247\u4f3a\u670d\u5668\u548c\u6b64\u6aa2\u8996\u5668\u7684\u7248\u672c\u4e0d\u76f8\u5bb9","error_josm":"JOSM \u6c92\u6709\u56de\u61c9\uff0c\u5b83\u5df2\u7d93\u555f\u52d5\u4e14\u555f\u7528\u9060\u7aef\u63a7\u5236\u4e86\u55ce?","error_nopic":"\u641c\u5c0b\u7684\u4f4d\u7f6e\u9644\u8fd1\u6c92\u6709\u76f8\u7247","error_pic":"\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u76f8\u7247","error_psv":"\u7121\u6cd5\u6b63\u78ba\u8f09\u5165 Photo Sphere Viewer","error_subtitle":"\u8acb\u7a0d\u5f8c\u91cd\u8a66\u6216\u6aa2\u67e5\u700f\u89bd\u5668\u7684\u4e3b\u63a7\u53f0\u4ee5\u4e86\u89e3\u8a73\u60c5\u3002","error_webgl":"\u6b64\u700f\u89bd\u5668\u4e0d\u652f\u63f4 WebGL","expand":"\u5c55\u958b","expand_info":"\u5728\u6574\u500b\u756b\u9762\u986f\u793a\u6b64\u5c0f\u5de5\u5177","filter_camera_model":"\u6309\u76f8\u6a5f\u578b\u865f","filter_date":"\u6309\u65e5\u671f","filter_picture":"\u6309\u76f8\u7247\u985e\u578b","filter_reset":"\u91cd\u8a2d","filter_user":"\u6309\u4f7f\u7528\u8005","filter_zoom_in":"\u62c9\u8fd1\u5730\u5716\u4ee5\u986f\u793a\u7be9\u9078\u7d50\u679c","filters":"\u7be9\u9078\u5668","id":"iD","josm":"JOSM","josm_live":"\u555f\u7528\u8f09\u5165\u76f8\u7247\u6642\u81ea\u52d5\u540c\u6b65 JOSM","layers":"\u5716\u5c64","legend_license":"\u6388\u6b0a: {l}","loading_labels_fun":["\ud83e\udd8c \u5075\u6e2c\u5230\u7576\u5fc3\u6885\u82b1\u9e7f\u6a19\u8a8c","\ud83d\ude98 \u6b63\u5728\u641c\u5c0b Panoramax \u6c7d\u8eca \xa9","\u2615 \u6ce8\u5165\u5496\u5561\u56e0","\ud83d\ude00 \u8acb\u5fae\u7b11\uff0c\u60a8\u5df2\u88ab\u6a19\u8a18\u5728\u5730\u5716\u4e0a\u4e86\uff01","\ud83d\udc08 \u6b63\u5728\u5206\u4eab\u8c93\u54aa\u7684\u76f8\u7247","\ud83d\ude34 \u6b63\u5728\u6e1b\u5c11\u5ef6\u9072","\ud83e\uded6 \u6b63\u5728\u6c8f\u58fa\u597d\u8336","\ud83d\udc27 \u6b63\u5728\u958b\u555f\u539f\u59cb\u78bc","\ud83d\ude87 \u6b63\u5728\u7d22\u5f15\u5730\u9435\u8eca\u7ad9","\ud83e\uddf9 \u6e05\u7406\u8a6e\u91cb\u8cc7\u6599","\ud83d\ude92 \u6b63\u5728\u50b3\u9001\u6d88\u9632\u968a\u7684\u76f8\u7247","\ud83d\udeb2 \u66f4\u65b0\u7da0\u9053","\ud83d\ude89 \u6b63\u5728\u901a\u904e\u8eca\u7ad9\u6708\u53f0","\ud83d\udef0\ufe0f \u6b63\u5728\u641c\u5c0b\u885b\u661f","\ud83d\udc65 \u6b63\u5728\u64b0\u5beb\u4eba\u7269\u8a8c","\ud83c\udf57 \u6b63\u5728\u5b9a\u4f4d\u9e79\u9165\u96de\u5e97","\ud83e\uddd1\u200d\ud83d\udcbb \u6b63\u5728\u5075\u932f\u4ecb\u9762","\ud83d\udcc8 \u7d71\u8a08\u6578\u64da\u6b63\u5728\u589e\u52a0"],"loading_labels_serious":["\ud83d\uddfa\ufe0f \u6b63\u5728\u8f09\u5165\u5730\u5716\u8cc7\u6599","\ud83d\udda5\ufe0f \u6b63\u5728\u67e5\u8a62 API","\ud83d\uddbc\ufe0f \u6b63\u5728\u8f09\u5165\u7e2e\u5716","\ud83d\udd0d \u6b63\u5728\u5206\u6790 EXIF \u8a6e\u91cb\u8cc7\u6599","\ud83c\udfd8\ufe0f \u6b63\u5728\u7b97\u7e6a 3D","\ud83d\udcf7 \u6b63\u5728\u521d\u59cb\u5316 360\xb0 \u76f8\u7247","\ud83d\udfe0 \u6b63\u5728\u5e73\u8861\u8272\u5f69"],"map_background":"\u5730\u5716\u80cc\u666f","map_background_aerial":"\u885b\u661f","map_background_streets":"\u9810\u8a2d","map_theme":"\u5730\u5716\u4e3b\u984c","map_theme_age":"\u62cd\u651d\u6642\u9593","map_theme_age_1":"> 2 \u5e74","map_theme_age_2":"< 2 \u5e74","map_theme_age_3":"< 1 \u5e74","map_theme_age_4":"< 1 \u500b\u6708","map_theme_default":"\u9810\u8a2d","map_theme_type":"\u76f8\u6a5f\u985e\u578b","metadata":"\u76f8\u7247\u8a6e\u91cb\u8cc7\u6599","metadata_camera":"\u76f8\u6a5f","metadata_camera_focal_length":"\u7126\u8ddd","metadata_camera_make":"\u88fd\u9020\u5546","metadata_camera_model":"\u578b\u865f","metadata_camera_type":"\u985e\u578b","metadata_exif":"EXIF / XMP","metadata_exif_name":"\u6a19\u7c64","metadata_exif_value":"\u503c","metadata_general_author":"\u4f5c\u8005","metadata_general_date":"\u62cd\u651d\u6642\u9593","metadata_general_license":"\u6388\u6b0a","metadata_general_license_link":"\u524d\u5f80\u6388\u6b0a\u689d\u6b3e\u8aaa\u660e\u9801","metadata_general_picid":"\u76f8\u7247\u8b58\u5225\u78bc","metadata_general_picid_link":"\u524d\u5f80\u672c\u76f8\u7247\u7684 JSON \u8aaa\u660e","metadata_general_seqid":"\u5e8f\u5217\u8b58\u5225\u78bc","metadata_general_seqid_link":"\u524d\u5f80\u672c\u5e8f\u5217\u7684 JSON \u8aaa\u660e","metadata_location":"\u5730\u9ede","metadata_location_latitude":"\u7def\u5ea6","metadata_location_longitude":"\u7d93\u5ea6","metadata_location_orientation":"\u62cd\u651d\u65b9\u5411","metadata_location_precision":"\u5b9a\u4f4d\u7cbe\u5ea6","minimize":"\u96b1\u85cf\u9019\u500b\u5c0f\u5de5\u5177\uff0c\u60a8\u53ef\u4ee5\u6309\u5de6\u4e0b\u89d2\u7684\u6309\u9215\u518d\u6b21\u986f\u793a\u5b83","moveDown":"\u4e0b\u79fb","moveLeft":"\u5de6\u79fb","moveMiddle":"\u756b\u9762\u7f6e\u4e2d","moveRight":"\u53f3\u79fb","moveUp":"\u4e0a\u79fb","options":"\u9078\u9805","picture_360":"360\xb0","picture_flat":"\u7d93\u5178","search":"\u641c\u5c0b","search_address":"\u641c\u5c0b\u5730\u5740\u3001\u57ce\u5e02\u2026","search_empty":"\u627e\u4e0d\u5230\u7d50\u679c","search_user":"\u641c\u5c0b\u5e33\u865f\u2026","sequence_more":"\u66f4\u591a\u64ad\u653e\u9078\u9805","sequence_next":"\u5e8f\u5217\u4e2d\u7684\u4e0b\u4e00\u5f35\u76f8\u7247","sequence_pause":"\u66ab\u505c\u5e8f\u5217","sequence_play":"\u64ad\u653e\u5e8f\u5217","sequence_prev":"\u5e8f\u5217\u4e2d\u7684\u4e0a\u4e00\u5f35\u76f8\u7247","sequence_speed":"\u64ad\u653e\u901f\u5ea6","share":"\u5206\u4eab","share_embed":"\u5d4c\u5165\u5230\u60a8\u7684\u7db2\u7ad9","share_image":"\u9ad8\u756b\u8cea\u76f8\u7247","share_links":"\u8d85\u9023\u7d50","share_page":"\u672c\u9801\u7684\u8d85\u9023\u7d50","share_print":"\u5217\u5370","share_rss":"RSS \u6458\u8981","share_rss_title":"\u5730\u5716\u53ef\u898b\u5340\u57df\u65b0\u76f8\u7247\u5e8f\u5217\u7684 RSS \u6458\u8981","show_map":"\u986f\u793a\u5730\u5716","show_psv":"\u986f\u793a\u76f8\u7247\u6aa2\u8996\u5668","zoom":"\u7e2e\u653e","zoomIn":"\u62c9\u8fd1","zoomOut":"\u62c9\u9060"},"map":{"loading":"\u6b63\u5728\u8f09\u5165\u2026","no_thumbnail":"\u6c92\u6709\u7e2e\u5716","not_public":"\u672a\u516c\u958b\u986f\u793a","thumbnail":"\u904a\u6a19\u61f8\u505c\u76f8\u7247\u7684\u7e2e\u5716"},"psv":{"ctrlZoom":"\u4f7f\u7528 CTRL + \u6ed1\u9f20\u6efe\u8f2a\u7e2e\u653e\u5716\u7247","loadError":"\u7121\u6cd5\u8f09\u5165\u5168\u666f\u5716","twoFingers":"\u4f7f\u7528\u96d9\u6307\u79fb\u52d5"}}')}},Rn={};function __webpack_require__(or){var So=Rn[or];if(void 0!==So)return So.exports;var To=Rn[or]={exports:{}};return C[or].call(To.exports,To,To.exports,__webpack_require__),To.exports}__webpack_require__.n=C=>{var Rn=C&&C.__esModule?()=>C.default:()=>C;return __webpack_require__.d(Rn,{a:Rn}),Rn},__webpack_require__.d=(C,Rn)=>{for(var or in Rn)__webpack_require__.o(Rn,or)&&!__webpack_require__.o(C,or)&&Object.defineProperty(C,or,{enumerable:!0,get:Rn[or]})},__webpack_require__.o=(C,Rn)=>Object.prototype.hasOwnProperty.call(C,Rn),__webpack_require__.r=C=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(C,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(C,"__esModule",{value:!0})};var or={};return(()=>{"use strict";__webpack_require__.r(or),__webpack_require__.d(or,{Editor:()=>So.Z,StandaloneMap:()=>Rn.Z,Viewer:()=>C.ZP,default:()=>C.ZP});var C=__webpack_require__(1707),Rn=__webpack_require__(9323),So=__webpack_require__(2244)})(),or})()));
|
|
24
|
+
const So="168",To=0,Ro=1,Uo=2,Oo=1,Ho=2,qo=3,dl=0,ml=1,fl=2,vl=0,bl=1,kl=2,Ll=3,Dl=4,Nc=5,jc=100,Zc=101,eu=102,Ku=103,Yu=104,Eh=200,Th=201,Ch=202,Lh=203,Dh=204,Rh=205,Nh=206,Uh=207,Bh=208,Fh=209,Oh=210,Vh=211,jh=212,Gh=213,Hh=214,Zh=0,Wh=1,qh=2,Kh=3,Qh=4,Xh=5,Yh=6,Jh=7,$h=0,ed=1,td=2,id=0,nd=1,rd=2,ad=3,sd=4,od=5,ld=6,cd=7,ud=301,hd=302,dd=303,pd=304,md=306,fd=1e3,gd=1001,Ad=1002,yd=1003,vd=1004,xd=1005,_d=1006,bd=1007,wd=1008,Ed=1009,Md=1010,Sd=1011,kd=1012,Td=1013,Id=1014,Cd=1015,Ld=1016,Pd=1017,zd=1018,Dd=1020,Rd=35902,Nd=1021,Ud=1022,Bd=1023,Fd=1024,Od=1025,Vd=1026,jd=1027,Gd=1028,Hd=1029,Zd=1030,Wd=1031,qd=1033,Kd=33776,Qd=33777,Xd=33778,Yd=33779,Jd=35840,$d=35841,ep=35842,tp=35843,ip=36196,np=37492,rp=37496,ap=37808,sp=37809,op=37810,lp=37811,cp=37812,up=37813,hp=37814,dp=37815,pp=37816,mp=37817,fp=37818,gp=37819,Ap=37820,yp=37821,vp=36492,xp=36494,_p=36495,bp=36283,wp=36284,Ep=36285,Mp=36286,Sp=2300,kp=2301,Tp=2302,Ip=2400,Cp=2401,Lp=2402,Pp=3201,zp=0,Dp=1,Rp="",Np="srgb",Up="srgb-linear",Bp="display-p3",Fp="display-p3-linear",Op="linear",Vp="srgb",jp="rec709",Gp="p3",Hp=7680,Zp=512,Wp=513,qp=514,Kp=515,Qp=516,Xp=517,Yp=518,Jp=519,$p=35044,em="300 es",tm=2e3,im=2001;class EventDispatcher{addEventListener(C,Rn){void 0===this._listeners&&(this._listeners={});const or=this._listeners;void 0===or[C]&&(or[C]=[]),-1===or[C].indexOf(Rn)&&or[C].push(Rn)}hasEventListener(C,Rn){if(void 0===this._listeners)return!1;const or=this._listeners;return void 0!==or[C]&&-1!==or[C].indexOf(Rn)}removeEventListener(C,Rn){if(void 0===this._listeners)return;const or=this._listeners[C];if(void 0!==or){const C=or.indexOf(Rn);-1!==C&&or.splice(C,1)}}dispatchEvent(C){if(void 0===this._listeners)return;const Rn=this._listeners[C.type];if(void 0!==Rn){C.target=this;const or=Rn.slice(0);for(let Rn=0,So=or.length;Rn<So;Rn++)or[Rn].call(this,C);C.target=null}}}const nm=["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 rm=1234567;const am=Math.PI/180,sm=180/Math.PI;function generateUUID(){const C=4294967295*Math.random()|0,Rn=4294967295*Math.random()|0,or=4294967295*Math.random()|0,So=4294967295*Math.random()|0;return(nm[255&C]+nm[C>>8&255]+nm[C>>16&255]+nm[C>>24&255]+"-"+nm[255&Rn]+nm[Rn>>8&255]+"-"+nm[Rn>>16&15|64]+nm[Rn>>24&255]+"-"+nm[63&or|128]+nm[or>>8&255]+"-"+nm[or>>16&255]+nm[or>>24&255]+nm[255&So]+nm[So>>8&255]+nm[So>>16&255]+nm[So>>24&255]).toLowerCase()}function clamp(C,Rn,or){return Math.max(Rn,Math.min(or,C))}function euclideanModulo(C,Rn){return(C%Rn+Rn)%Rn}function lerp(C,Rn,or){return(1-or)*C+or*Rn}function denormalize(C,Rn){switch(Rn.constructor){case Float32Array:return C;case Uint32Array:return C/4294967295;case Uint16Array:return C/65535;case Uint8Array:return C/255;case Int32Array:return Math.max(C/2147483647,-1);case Int16Array:return Math.max(C/32767,-1);case Int8Array:return Math.max(C/127,-1);default:throw new Error("Invalid component type.")}}function normalize(C,Rn){switch(Rn.constructor){case Float32Array:return C;case Uint32Array:return Math.round(4294967295*C);case Uint16Array:return Math.round(65535*C);case Uint8Array:return Math.round(255*C);case Int32Array:return Math.round(2147483647*C);case Int16Array:return Math.round(32767*C);case Int8Array:return Math.round(127*C);default:throw new Error("Invalid component type.")}}const om={DEG2RAD:am,RAD2DEG:sm,generateUUID:generateUUID,clamp:clamp,euclideanModulo:euclideanModulo,mapLinear:function(C,Rn,or,So,To){return So+(C-Rn)*(To-So)/(or-Rn)},inverseLerp:function(C,Rn,or){return C!==Rn?(or-C)/(Rn-C):0},lerp:lerp,damp:function(C,Rn,or,So){return lerp(C,Rn,1-Math.exp(-or*So))},pingpong:function(C,Rn){return void 0===Rn&&(Rn=1),Rn-Math.abs(euclideanModulo(C,2*Rn)-Rn)},smoothstep:function(C,Rn,or){return C<=Rn?0:C>=or?1:(C=(C-Rn)/(or-Rn))*C*(3-2*C)},smootherstep:function(C,Rn,or){return C<=Rn?0:C>=or?1:(C=(C-Rn)/(or-Rn))*C*C*(C*(6*C-15)+10)},randInt:function(C,Rn){return C+Math.floor(Math.random()*(Rn-C+1))},randFloat:function(C,Rn){return C+Math.random()*(Rn-C)},randFloatSpread:function(C){return C*(.5-Math.random())},seededRandom:function(C){void 0!==C&&(rm=C);let Rn=rm+=1831565813;return Rn=Math.imul(Rn^Rn>>>15,1|Rn),Rn^=Rn+Math.imul(Rn^Rn>>>7,61|Rn),((Rn^Rn>>>14)>>>0)/4294967296},degToRad:function(C){return C*am},radToDeg:function(C){return C*sm},isPowerOfTwo:function(C){return 0===(C&C-1)&&0!==C},ceilPowerOfTwo:function(C){return Math.pow(2,Math.ceil(Math.log(C)/Math.LN2))},floorPowerOfTwo:function(C){return Math.pow(2,Math.floor(Math.log(C)/Math.LN2))},setQuaternionFromProperEuler:function(C,Rn,or,So,To){const Ro=Math.cos,Uo=Math.sin,Oo=Ro(or/2),Ho=Uo(or/2),qo=Ro((Rn+So)/2),dl=Uo((Rn+So)/2),ml=Ro((Rn-So)/2),fl=Uo((Rn-So)/2),vl=Ro((So-Rn)/2),bl=Uo((So-Rn)/2);switch(To){case"XYX":C.set(Oo*dl,Ho*ml,Ho*fl,Oo*qo);break;case"YZY":C.set(Ho*fl,Oo*dl,Ho*ml,Oo*qo);break;case"ZXZ":C.set(Ho*ml,Ho*fl,Oo*dl,Oo*qo);break;case"XZX":C.set(Oo*dl,Ho*bl,Ho*vl,Oo*qo);break;case"YXY":C.set(Ho*vl,Oo*dl,Ho*bl,Oo*qo);break;case"ZYZ":C.set(Ho*bl,Ho*vl,Oo*dl,Oo*qo);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+To)}},normalize:normalize,denormalize:denormalize};class Vector2{constructor(C,Rn){void 0===C&&(C=0),void 0===Rn&&(Rn=0),Vector2.prototype.isVector2=!0,this.x=C,this.y=Rn}get width(){return this.x}set width(C){this.x=C}get height(){return this.y}set height(C){this.y=C}set(C,Rn){return this.x=C,this.y=Rn,this}setScalar(C){return this.x=C,this.y=C,this}setX(C){return this.x=C,this}setY(C){return this.y=C,this}setComponent(C,Rn){switch(C){case 0:this.x=Rn;break;case 1:this.y=Rn;break;default:throw new Error("index is out of range: "+C)}return this}getComponent(C){switch(C){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+C)}}clone(){return new this.constructor(this.x,this.y)}copy(C){return this.x=C.x,this.y=C.y,this}add(C){return this.x+=C.x,this.y+=C.y,this}addScalar(C){return this.x+=C,this.y+=C,this}addVectors(C,Rn){return this.x=C.x+Rn.x,this.y=C.y+Rn.y,this}addScaledVector(C,Rn){return this.x+=C.x*Rn,this.y+=C.y*Rn,this}sub(C){return this.x-=C.x,this.y-=C.y,this}subScalar(C){return this.x-=C,this.y-=C,this}subVectors(C,Rn){return this.x=C.x-Rn.x,this.y=C.y-Rn.y,this}multiply(C){return this.x*=C.x,this.y*=C.y,this}multiplyScalar(C){return this.x*=C,this.y*=C,this}divide(C){return this.x/=C.x,this.y/=C.y,this}divideScalar(C){return this.multiplyScalar(1/C)}applyMatrix3(C){const Rn=this.x,or=this.y,So=C.elements;return this.x=So[0]*Rn+So[3]*or+So[6],this.y=So[1]*Rn+So[4]*or+So[7],this}min(C){return this.x=Math.min(this.x,C.x),this.y=Math.min(this.y,C.y),this}max(C){return this.x=Math.max(this.x,C.x),this.y=Math.max(this.y,C.y),this}clamp(C,Rn){return this.x=Math.max(C.x,Math.min(Rn.x,this.x)),this.y=Math.max(C.y,Math.min(Rn.y,this.y)),this}clampScalar(C,Rn){return this.x=Math.max(C,Math.min(Rn,this.x)),this.y=Math.max(C,Math.min(Rn,this.y)),this}clampLength(C,Rn){const or=this.length();return this.divideScalar(or||1).multiplyScalar(Math.max(C,Math.min(Rn,or)))}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(C){return this.x*C.x+this.y*C.y}cross(C){return this.x*C.y-this.y*C.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(C){const Rn=Math.sqrt(this.lengthSq()*C.lengthSq());if(0===Rn)return Math.PI/2;const or=this.dot(C)/Rn;return Math.acos(clamp(or,-1,1))}distanceTo(C){return Math.sqrt(this.distanceToSquared(C))}distanceToSquared(C){const Rn=this.x-C.x,or=this.y-C.y;return Rn*Rn+or*or}manhattanDistanceTo(C){return Math.abs(this.x-C.x)+Math.abs(this.y-C.y)}setLength(C){return this.normalize().multiplyScalar(C)}lerp(C,Rn){return this.x+=(C.x-this.x)*Rn,this.y+=(C.y-this.y)*Rn,this}lerpVectors(C,Rn,or){return this.x=C.x+(Rn.x-C.x)*or,this.y=C.y+(Rn.y-C.y)*or,this}equals(C){return C.x===this.x&&C.y===this.y}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.x=C[Rn],this.y=C[Rn+1],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.x,C[Rn+1]=this.y,C}fromBufferAttribute(C,Rn){return this.x=C.getX(Rn),this.y=C.getY(Rn),this}rotateAround(C,Rn){const or=Math.cos(Rn),So=Math.sin(Rn),To=this.x-C.x,Ro=this.y-C.y;return this.x=To*or-Ro*So+C.x,this.y=To*So+Ro*or+C.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Matrix3{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==C&&this.set(C,Rn,or,So,To,Ro,Uo,Oo,Ho)}set(C,Rn,or,So,To,Ro,Uo,Oo,Ho){const qo=this.elements;return qo[0]=C,qo[1]=So,qo[2]=Uo,qo[3]=Rn,qo[4]=To,qo[5]=Oo,qo[6]=or,qo[7]=Ro,qo[8]=Ho,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(C){const Rn=this.elements,or=C.elements;return Rn[0]=or[0],Rn[1]=or[1],Rn[2]=or[2],Rn[3]=or[3],Rn[4]=or[4],Rn[5]=or[5],Rn[6]=or[6],Rn[7]=or[7],Rn[8]=or[8],this}extractBasis(C,Rn,or){return C.setFromMatrix3Column(this,0),Rn.setFromMatrix3Column(this,1),or.setFromMatrix3Column(this,2),this}setFromMatrix4(C){const Rn=C.elements;return this.set(Rn[0],Rn[4],Rn[8],Rn[1],Rn[5],Rn[9],Rn[2],Rn[6],Rn[10]),this}multiply(C){return this.multiplyMatrices(this,C)}premultiply(C){return this.multiplyMatrices(C,this)}multiplyMatrices(C,Rn){const or=C.elements,So=Rn.elements,To=this.elements,Ro=or[0],Uo=or[3],Oo=or[6],Ho=or[1],qo=or[4],dl=or[7],ml=or[2],fl=or[5],vl=or[8],bl=So[0],kl=So[3],Ll=So[6],Dl=So[1],Nc=So[4],jc=So[7],Zc=So[2],eu=So[5],Ku=So[8];return To[0]=Ro*bl+Uo*Dl+Oo*Zc,To[3]=Ro*kl+Uo*Nc+Oo*eu,To[6]=Ro*Ll+Uo*jc+Oo*Ku,To[1]=Ho*bl+qo*Dl+dl*Zc,To[4]=Ho*kl+qo*Nc+dl*eu,To[7]=Ho*Ll+qo*jc+dl*Ku,To[2]=ml*bl+fl*Dl+vl*Zc,To[5]=ml*kl+fl*Nc+vl*eu,To[8]=ml*Ll+fl*jc+vl*Ku,this}multiplyScalar(C){const Rn=this.elements;return Rn[0]*=C,Rn[3]*=C,Rn[6]*=C,Rn[1]*=C,Rn[4]*=C,Rn[7]*=C,Rn[2]*=C,Rn[5]*=C,Rn[8]*=C,this}determinant(){const C=this.elements,Rn=C[0],or=C[1],So=C[2],To=C[3],Ro=C[4],Uo=C[5],Oo=C[6],Ho=C[7],qo=C[8];return Rn*Ro*qo-Rn*Uo*Ho-or*To*qo+or*Uo*Oo+So*To*Ho-So*Ro*Oo}invert(){const C=this.elements,Rn=C[0],or=C[1],So=C[2],To=C[3],Ro=C[4],Uo=C[5],Oo=C[6],Ho=C[7],qo=C[8],dl=qo*Ro-Uo*Ho,ml=Uo*Oo-qo*To,fl=Ho*To-Ro*Oo,vl=Rn*dl+or*ml+So*fl;if(0===vl)return this.set(0,0,0,0,0,0,0,0,0);const bl=1/vl;return C[0]=dl*bl,C[1]=(So*Ho-qo*or)*bl,C[2]=(Uo*or-So*Ro)*bl,C[3]=ml*bl,C[4]=(qo*Rn-So*Oo)*bl,C[5]=(So*To-Uo*Rn)*bl,C[6]=fl*bl,C[7]=(or*Oo-Ho*Rn)*bl,C[8]=(Ro*Rn-or*To)*bl,this}transpose(){let C;const Rn=this.elements;return C=Rn[1],Rn[1]=Rn[3],Rn[3]=C,C=Rn[2],Rn[2]=Rn[6],Rn[6]=C,C=Rn[5],Rn[5]=Rn[7],Rn[7]=C,this}getNormalMatrix(C){return this.setFromMatrix4(C).invert().transpose()}transposeIntoArray(C){const Rn=this.elements;return C[0]=Rn[0],C[1]=Rn[3],C[2]=Rn[6],C[3]=Rn[1],C[4]=Rn[4],C[5]=Rn[7],C[6]=Rn[2],C[7]=Rn[5],C[8]=Rn[8],this}setUvTransform(C,Rn,or,So,To,Ro,Uo){const Oo=Math.cos(To),Ho=Math.sin(To);return this.set(or*Oo,or*Ho,-or*(Oo*Ro+Ho*Uo)+Ro+C,-So*Ho,So*Oo,-So*(-Ho*Ro+Oo*Uo)+Uo+Rn,0,0,1),this}scale(C,Rn){return this.premultiply(lm.makeScale(C,Rn)),this}rotate(C){return this.premultiply(lm.makeRotation(-C)),this}translate(C,Rn){return this.premultiply(lm.makeTranslation(C,Rn)),this}makeTranslation(C,Rn){return C.isVector2?this.set(1,0,C.x,0,1,C.y,0,0,1):this.set(1,0,C,0,1,Rn,0,0,1),this}makeRotation(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(Rn,-or,0,or,Rn,0,0,0,1),this}makeScale(C,Rn){return this.set(C,0,0,0,Rn,0,0,0,1),this}equals(C){const Rn=this.elements,or=C.elements;for(let So=0;So<9;So++)if(Rn[So]!==or[So])return!1;return!0}fromArray(C,Rn){void 0===Rn&&(Rn=0);for(let or=0;or<9;or++)this.elements[or]=C[or+Rn];return this}toArray(C,Rn){void 0===C&&(C=[]),void 0===Rn&&(Rn=0);const or=this.elements;return C[Rn]=or[0],C[Rn+1]=or[1],C[Rn+2]=or[2],C[Rn+3]=or[3],C[Rn+4]=or[4],C[Rn+5]=or[5],C[Rn+6]=or[6],C[Rn+7]=or[7],C[Rn+8]=or[8],C}clone(){return(new this.constructor).fromArray(this.elements)}}const lm=new Matrix3;function arrayNeedsUint32(C){for(let Rn=C.length-1;Rn>=0;--Rn)if(C[Rn]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function createElementNS(C){return document.createElementNS("http://www.w3.org/1999/xhtml",C)}function createCanvasElement(){const C=createElementNS("canvas");return C.style.display="block",C}const cm={};function warnOnce(C){C in cm||(cm[C]=!0,console.warn(C))}const um=(new Matrix3).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),hm=(new Matrix3).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),dm={[Up]:{transfer:Op,primaries:jp,luminanceCoefficients:[.2126,.7152,.0722],toReference:C=>C,fromReference:C=>C},[Np]:{transfer:Vp,primaries:jp,luminanceCoefficients:[.2126,.7152,.0722],toReference:C=>C.convertSRGBToLinear(),fromReference:C=>C.convertLinearToSRGB()},[Fp]:{transfer:Op,primaries:Gp,luminanceCoefficients:[.2289,.6917,.0793],toReference:C=>C.applyMatrix3(hm),fromReference:C=>C.applyMatrix3(um)},[Bp]:{transfer:Vp,primaries:Gp,luminanceCoefficients:[.2289,.6917,.0793],toReference:C=>C.convertSRGBToLinear().applyMatrix3(hm),fromReference:C=>C.applyMatrix3(um).convertLinearToSRGB()}},pm=new Set([Up,Fp]),mm={enabled:!0,_workingColorSpace:Up,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(C){if(!pm.has(C))throw new Error('Unsupported working color space, "'+C+'".');this._workingColorSpace=C},convert:function(C,Rn,or){if(!1===this.enabled||Rn===or||!Rn||!or)return C;const So=dm[Rn].toReference;return(0,dm[or].fromReference)(So(C))},fromWorkingColorSpace:function(C,Rn){return this.convert(C,this._workingColorSpace,Rn)},toWorkingColorSpace:function(C,Rn){return this.convert(C,Rn,this._workingColorSpace)},getPrimaries:function(C){return dm[C].primaries},getTransfer:function(C){return C===Rp?Op:dm[C].transfer},getLuminanceCoefficients:function(C,Rn){return void 0===Rn&&(Rn=this._workingColorSpace),C.fromArray(dm[Rn].luminanceCoefficients)}};function SRGBToLinear(C){return C<.04045?.0773993808*C:Math.pow(.9478672986*C+.0521327014,2.4)}function LinearToSRGB(C){return C<.0031308?12.92*C:1.055*Math.pow(C,.41666)-.055}let fm;class ImageUtils{static getDataURL(C){if(/^data:/i.test(C.src))return C.src;if("undefined"===typeof HTMLCanvasElement)return C.src;let Rn;if(C instanceof HTMLCanvasElement)Rn=C;else{void 0===fm&&(fm=createElementNS("canvas")),fm.width=C.width,fm.height=C.height;const or=fm.getContext("2d");C instanceof ImageData?or.putImageData(C,0,0):or.drawImage(C,0,0,C.width,C.height),Rn=fm}return Rn.width>2048||Rn.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",C),Rn.toDataURL("image/jpeg",.6)):Rn.toDataURL("image/png")}static sRGBToLinear(C){if("undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&C instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&C instanceof ImageBitmap){const Rn=createElementNS("canvas");Rn.width=C.width,Rn.height=C.height;const or=Rn.getContext("2d");or.drawImage(C,0,0,C.width,C.height);const So=or.getImageData(0,0,C.width,C.height),To=So.data;for(let C=0;C<To.length;C++)To[C]=255*SRGBToLinear(To[C]/255);return or.putImageData(So,0,0),Rn}if(C.data){const Rn=C.data.slice(0);for(let C=0;C<Rn.length;C++)Rn instanceof Uint8Array||Rn instanceof Uint8ClampedArray?Rn[C]=Math.floor(255*SRGBToLinear(Rn[C]/255)):Rn[C]=SRGBToLinear(Rn[C]);return{data:Rn,width:C.width,height:C.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),C}}let gm=0;class Source{constructor(C){void 0===C&&(C=null),this.isSource=!0,Object.defineProperty(this,"id",{value:gm++}),this.uuid=generateUUID(),this.data=C,this.dataReady=!0,this.version=0}set needsUpdate(C){!0===C&&this.version++}toJSON(C){const Rn=void 0===C||"string"===typeof C;if(!Rn&&void 0!==C.images[this.uuid])return C.images[this.uuid];const or={uuid:this.uuid,url:""},So=this.data;if(null!==So){let C;if(Array.isArray(So)){C=[];for(let Rn=0,or=So.length;Rn<or;Rn++)So[Rn].isDataTexture?C.push(serializeImage(So[Rn].image)):C.push(serializeImage(So[Rn]))}else C=serializeImage(So);or.url=C}return Rn||(C.images[this.uuid]=or),or}}function serializeImage(C){return"undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&C instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&C instanceof ImageBitmap?ImageUtils.getDataURL(C):C.data?{data:Array.from(C.data),width:C.width,height:C.height,type:C.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Am=0;class Texture extends EventDispatcher{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){void 0===C&&(C=Texture.DEFAULT_IMAGE),void 0===Rn&&(Rn=Texture.DEFAULT_MAPPING),void 0===or&&(or=gd),void 0===So&&(So=gd),void 0===To&&(To=_d),void 0===Ro&&(Ro=wd),void 0===Uo&&(Uo=Bd),void 0===Oo&&(Oo=Ed),void 0===Ho&&(Ho=Texture.DEFAULT_ANISOTROPY),void 0===qo&&(qo=Rp),super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Am++}),this.uuid=generateUUID(),this.name="",this.source=new Source(C),this.mipmaps=[],this.mapping=Rn,this.channel=0,this.wrapS=or,this.wrapT=So,this.magFilter=To,this.minFilter=Ro,this.anisotropy=Ho,this.format=Uo,this.internalFormat=null,this.type=Oo,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=qo,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(C){void 0===C&&(C=null),this.source.data=C}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(C){return this.name=C.name,this.source=C.source,this.mipmaps=C.mipmaps.slice(0),this.mapping=C.mapping,this.channel=C.channel,this.wrapS=C.wrapS,this.wrapT=C.wrapT,this.magFilter=C.magFilter,this.minFilter=C.minFilter,this.anisotropy=C.anisotropy,this.format=C.format,this.internalFormat=C.internalFormat,this.type=C.type,this.offset.copy(C.offset),this.repeat.copy(C.repeat),this.center.copy(C.center),this.rotation=C.rotation,this.matrixAutoUpdate=C.matrixAutoUpdate,this.matrix.copy(C.matrix),this.generateMipmaps=C.generateMipmaps,this.premultiplyAlpha=C.premultiplyAlpha,this.flipY=C.flipY,this.unpackAlignment=C.unpackAlignment,this.colorSpace=C.colorSpace,this.userData=JSON.parse(JSON.stringify(C.userData)),this.needsUpdate=!0,this}toJSON(C){const Rn=void 0===C||"string"===typeof C;if(!Rn&&void 0!==C.textures[this.uuid])return C.textures[this.uuid];const or={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(C).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&&(or.userData=this.userData),Rn||(C.textures[this.uuid]=or),or}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(C){if(300!==this.mapping)return C;if(C.applyMatrix3(this.matrix),C.x<0||C.x>1)switch(this.wrapS){case fd:C.x=C.x-Math.floor(C.x);break;case gd:C.x=C.x<0?0:1;break;case Ad:1===Math.abs(Math.floor(C.x)%2)?C.x=Math.ceil(C.x)-C.x:C.x=C.x-Math.floor(C.x)}if(C.y<0||C.y>1)switch(this.wrapT){case fd:C.y=C.y-Math.floor(C.y);break;case gd:C.y=C.y<0?0:1;break;case Ad:1===Math.abs(Math.floor(C.y)%2)?C.y=Math.ceil(C.y)-C.y:C.y=C.y-Math.floor(C.y)}return this.flipY&&(C.y=1-C.y),C}set needsUpdate(C){!0===C&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(C){!0===C&&this.pmremVersion++}}Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=300,Texture.DEFAULT_ANISOTROPY=1;class Vector4{constructor(C,Rn,or,So){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),void 0===So&&(So=1),Vector4.prototype.isVector4=!0,this.x=C,this.y=Rn,this.z=or,this.w=So}get width(){return this.z}set width(C){this.z=C}get height(){return this.w}set height(C){this.w=C}set(C,Rn,or,So){return this.x=C,this.y=Rn,this.z=or,this.w=So,this}setScalar(C){return this.x=C,this.y=C,this.z=C,this.w=C,this}setX(C){return this.x=C,this}setY(C){return this.y=C,this}setZ(C){return this.z=C,this}setW(C){return this.w=C,this}setComponent(C,Rn){switch(C){case 0:this.x=Rn;break;case 1:this.y=Rn;break;case 2:this.z=Rn;break;case 3:this.w=Rn;break;default:throw new Error("index is out of range: "+C)}return this}getComponent(C){switch(C){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: "+C)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(C){return this.x=C.x,this.y=C.y,this.z=C.z,this.w=void 0!==C.w?C.w:1,this}add(C){return this.x+=C.x,this.y+=C.y,this.z+=C.z,this.w+=C.w,this}addScalar(C){return this.x+=C,this.y+=C,this.z+=C,this.w+=C,this}addVectors(C,Rn){return this.x=C.x+Rn.x,this.y=C.y+Rn.y,this.z=C.z+Rn.z,this.w=C.w+Rn.w,this}addScaledVector(C,Rn){return this.x+=C.x*Rn,this.y+=C.y*Rn,this.z+=C.z*Rn,this.w+=C.w*Rn,this}sub(C){return this.x-=C.x,this.y-=C.y,this.z-=C.z,this.w-=C.w,this}subScalar(C){return this.x-=C,this.y-=C,this.z-=C,this.w-=C,this}subVectors(C,Rn){return this.x=C.x-Rn.x,this.y=C.y-Rn.y,this.z=C.z-Rn.z,this.w=C.w-Rn.w,this}multiply(C){return this.x*=C.x,this.y*=C.y,this.z*=C.z,this.w*=C.w,this}multiplyScalar(C){return this.x*=C,this.y*=C,this.z*=C,this.w*=C,this}applyMatrix4(C){const Rn=this.x,or=this.y,So=this.z,To=this.w,Ro=C.elements;return this.x=Ro[0]*Rn+Ro[4]*or+Ro[8]*So+Ro[12]*To,this.y=Ro[1]*Rn+Ro[5]*or+Ro[9]*So+Ro[13]*To,this.z=Ro[2]*Rn+Ro[6]*or+Ro[10]*So+Ro[14]*To,this.w=Ro[3]*Rn+Ro[7]*or+Ro[11]*So+Ro[15]*To,this}divideScalar(C){return this.multiplyScalar(1/C)}setAxisAngleFromQuaternion(C){this.w=2*Math.acos(C.w);const Rn=Math.sqrt(1-C.w*C.w);return Rn<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=C.x/Rn,this.y=C.y/Rn,this.z=C.z/Rn),this}setAxisAngleFromRotationMatrix(C){let Rn,or,So,To;const Ro=.01,Uo=.1,Oo=C.elements,Ho=Oo[0],qo=Oo[4],dl=Oo[8],ml=Oo[1],fl=Oo[5],vl=Oo[9],bl=Oo[2],kl=Oo[6],Ll=Oo[10];if(Math.abs(qo-ml)<Ro&&Math.abs(dl-bl)<Ro&&Math.abs(vl-kl)<Ro){if(Math.abs(qo+ml)<Uo&&Math.abs(dl+bl)<Uo&&Math.abs(vl+kl)<Uo&&Math.abs(Ho+fl+Ll-3)<Uo)return this.set(1,0,0,0),this;Rn=Math.PI;const C=(Ho+1)/2,Oo=(fl+1)/2,Dl=(Ll+1)/2,Nc=(qo+ml)/4,jc=(dl+bl)/4,Zc=(vl+kl)/4;return C>Oo&&C>Dl?C<Ro?(or=0,So=.707106781,To=.707106781):(or=Math.sqrt(C),So=Nc/or,To=jc/or):Oo>Dl?Oo<Ro?(or=.707106781,So=0,To=.707106781):(So=Math.sqrt(Oo),or=Nc/So,To=Zc/So):Dl<Ro?(or=.707106781,So=.707106781,To=0):(To=Math.sqrt(Dl),or=jc/To,So=Zc/To),this.set(or,So,To,Rn),this}let Dl=Math.sqrt((kl-vl)*(kl-vl)+(dl-bl)*(dl-bl)+(ml-qo)*(ml-qo));return Math.abs(Dl)<.001&&(Dl=1),this.x=(kl-vl)/Dl,this.y=(dl-bl)/Dl,this.z=(ml-qo)/Dl,this.w=Math.acos((Ho+fl+Ll-1)/2),this}setFromMatrixPosition(C){const Rn=C.elements;return this.x=Rn[12],this.y=Rn[13],this.z=Rn[14],this.w=Rn[15],this}min(C){return this.x=Math.min(this.x,C.x),this.y=Math.min(this.y,C.y),this.z=Math.min(this.z,C.z),this.w=Math.min(this.w,C.w),this}max(C){return this.x=Math.max(this.x,C.x),this.y=Math.max(this.y,C.y),this.z=Math.max(this.z,C.z),this.w=Math.max(this.w,C.w),this}clamp(C,Rn){return this.x=Math.max(C.x,Math.min(Rn.x,this.x)),this.y=Math.max(C.y,Math.min(Rn.y,this.y)),this.z=Math.max(C.z,Math.min(Rn.z,this.z)),this.w=Math.max(C.w,Math.min(Rn.w,this.w)),this}clampScalar(C,Rn){return this.x=Math.max(C,Math.min(Rn,this.x)),this.y=Math.max(C,Math.min(Rn,this.y)),this.z=Math.max(C,Math.min(Rn,this.z)),this.w=Math.max(C,Math.min(Rn,this.w)),this}clampLength(C,Rn){const or=this.length();return this.divideScalar(or||1).multiplyScalar(Math.max(C,Math.min(Rn,or)))}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(C){return this.x*C.x+this.y*C.y+this.z*C.z+this.w*C.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(C){return this.normalize().multiplyScalar(C)}lerp(C,Rn){return this.x+=(C.x-this.x)*Rn,this.y+=(C.y-this.y)*Rn,this.z+=(C.z-this.z)*Rn,this.w+=(C.w-this.w)*Rn,this}lerpVectors(C,Rn,or){return this.x=C.x+(Rn.x-C.x)*or,this.y=C.y+(Rn.y-C.y)*or,this.z=C.z+(Rn.z-C.z)*or,this.w=C.w+(Rn.w-C.w)*or,this}equals(C){return C.x===this.x&&C.y===this.y&&C.z===this.z&&C.w===this.w}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.x=C[Rn],this.y=C[Rn+1],this.z=C[Rn+2],this.w=C[Rn+3],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.x,C[Rn+1]=this.y,C[Rn+2]=this.z,C[Rn+3]=this.w,C}fromBufferAttribute(C,Rn){return this.x=C.getX(Rn),this.y=C.getY(Rn),this.z=C.getZ(Rn),this.w=C.getW(Rn),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 RenderTarget extends EventDispatcher{constructor(C,Rn,or){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or={}),super(),this.isRenderTarget=!0,this.width=C,this.height=Rn,this.depth=1,this.scissor=new Vector4(0,0,C,Rn),this.scissorTest=!1,this.viewport=new Vector4(0,0,C,Rn);const So={width:C,height:Rn,depth:1};or=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:_d,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},or);const To=new Texture(So,or.mapping,or.wrapS,or.wrapT,or.magFilter,or.minFilter,or.format,or.type,or.anisotropy,or.colorSpace);To.flipY=!1,To.generateMipmaps=or.generateMipmaps,To.internalFormat=or.internalFormat,this.textures=[];const Ro=or.count;for(let Uo=0;Uo<Ro;Uo++)this.textures[Uo]=To.clone(),this.textures[Uo].isRenderTargetTexture=!0;this.depthBuffer=or.depthBuffer,this.stencilBuffer=or.stencilBuffer,this.resolveDepthBuffer=or.resolveDepthBuffer,this.resolveStencilBuffer=or.resolveStencilBuffer,this.depthTexture=or.depthTexture,this.samples=or.samples}get texture(){return this.textures[0]}set texture(C){this.textures[0]=C}setSize(C,Rn,or){if(void 0===or&&(or=1),this.width!==C||this.height!==Rn||this.depth!==or){this.width=C,this.height=Rn,this.depth=or;for(let So=0,To=this.textures.length;So<To;So++)this.textures[So].image.width=C,this.textures[So].image.height=Rn,this.textures[So].image.depth=or;this.dispose()}this.viewport.set(0,0,C,Rn),this.scissor.set(0,0,C,Rn)}clone(){return(new this.constructor).copy(this)}copy(C){this.width=C.width,this.height=C.height,this.depth=C.depth,this.scissor.copy(C.scissor),this.scissorTest=C.scissorTest,this.viewport.copy(C.viewport),this.textures.length=0;for(let or=0,So=C.textures.length;or<So;or++)this.textures[or]=C.textures[or].clone(),this.textures[or].isRenderTargetTexture=!0;const Rn=Object.assign({},C.texture.image);return this.texture.source=new Source(Rn),this.depthBuffer=C.depthBuffer,this.stencilBuffer=C.stencilBuffer,this.resolveDepthBuffer=C.resolveDepthBuffer,this.resolveStencilBuffer=C.resolveStencilBuffer,null!==C.depthTexture&&(this.depthTexture=C.depthTexture.clone()),this.samples=C.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class WebGLRenderTarget extends RenderTarget{constructor(C,Rn,or){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or={}),super(C,Rn,or),this.isWebGLRenderTarget=!0}}class DataArrayTexture extends Texture{constructor(C,Rn,or,So){void 0===C&&(C=null),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),super(null),this.isDataArrayTexture=!0,this.image={data:C,width:Rn,height:or,depth:So},this.magFilter=yd,this.minFilter=yd,this.wrapR=gd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(C){this.layerUpdates.add(C)}clearLayerUpdates(){this.layerUpdates.clear()}}class Data3DTexture extends Texture{constructor(C,Rn,or,So){void 0===C&&(C=null),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),super(null),this.isData3DTexture=!0,this.image={data:C,width:Rn,height:or,depth:So},this.magFilter=yd,this.minFilter=yd,this.wrapR=gd,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Quaternion{constructor(C,Rn,or,So){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),void 0===So&&(So=1),this.isQuaternion=!0,this._x=C,this._y=Rn,this._z=or,this._w=So}static slerpFlat(C,Rn,or,So,To,Ro,Uo){let Oo=or[So+0],Ho=or[So+1],qo=or[So+2],dl=or[So+3];const ml=To[Ro+0],fl=To[Ro+1],vl=To[Ro+2],bl=To[Ro+3];if(0===Uo)return C[Rn+0]=Oo,C[Rn+1]=Ho,C[Rn+2]=qo,void(C[Rn+3]=dl);if(1===Uo)return C[Rn+0]=ml,C[Rn+1]=fl,C[Rn+2]=vl,void(C[Rn+3]=bl);if(dl!==bl||Oo!==ml||Ho!==fl||qo!==vl){let C=1-Uo;const Rn=Oo*ml+Ho*fl+qo*vl+dl*bl,or=Rn>=0?1:-1,So=1-Rn*Rn;if(So>Number.EPSILON){const To=Math.sqrt(So),Ro=Math.atan2(To,Rn*or);C=Math.sin(C*Ro)/To,Uo=Math.sin(Uo*Ro)/To}const To=Uo*or;if(Oo=Oo*C+ml*To,Ho=Ho*C+fl*To,qo=qo*C+vl*To,dl=dl*C+bl*To,C===1-Uo){const C=1/Math.sqrt(Oo*Oo+Ho*Ho+qo*qo+dl*dl);Oo*=C,Ho*=C,qo*=C,dl*=C}}C[Rn]=Oo,C[Rn+1]=Ho,C[Rn+2]=qo,C[Rn+3]=dl}static multiplyQuaternionsFlat(C,Rn,or,So,To,Ro){const Uo=or[So],Oo=or[So+1],Ho=or[So+2],qo=or[So+3],dl=To[Ro],ml=To[Ro+1],fl=To[Ro+2],vl=To[Ro+3];return C[Rn]=Uo*vl+qo*dl+Oo*fl-Ho*ml,C[Rn+1]=Oo*vl+qo*ml+Ho*dl-Uo*fl,C[Rn+2]=Ho*vl+qo*fl+Uo*ml-Oo*dl,C[Rn+3]=qo*vl-Uo*dl-Oo*ml-Ho*fl,C}get x(){return this._x}set x(C){this._x=C,this._onChangeCallback()}get y(){return this._y}set y(C){this._y=C,this._onChangeCallback()}get z(){return this._z}set z(C){this._z=C,this._onChangeCallback()}get w(){return this._w}set w(C){this._w=C,this._onChangeCallback()}set(C,Rn,or,So){return this._x=C,this._y=Rn,this._z=or,this._w=So,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(C){return this._x=C.x,this._y=C.y,this._z=C.z,this._w=C.w,this._onChangeCallback(),this}setFromEuler(C,Rn){void 0===Rn&&(Rn=!0);const or=C._x,So=C._y,To=C._z,Ro=C._order,Uo=Math.cos,Oo=Math.sin,Ho=Uo(or/2),qo=Uo(So/2),dl=Uo(To/2),ml=Oo(or/2),fl=Oo(So/2),vl=Oo(To/2);switch(Ro){case"XYZ":this._x=ml*qo*dl+Ho*fl*vl,this._y=Ho*fl*dl-ml*qo*vl,this._z=Ho*qo*vl+ml*fl*dl,this._w=Ho*qo*dl-ml*fl*vl;break;case"YXZ":this._x=ml*qo*dl+Ho*fl*vl,this._y=Ho*fl*dl-ml*qo*vl,this._z=Ho*qo*vl-ml*fl*dl,this._w=Ho*qo*dl+ml*fl*vl;break;case"ZXY":this._x=ml*qo*dl-Ho*fl*vl,this._y=Ho*fl*dl+ml*qo*vl,this._z=Ho*qo*vl+ml*fl*dl,this._w=Ho*qo*dl-ml*fl*vl;break;case"ZYX":this._x=ml*qo*dl-Ho*fl*vl,this._y=Ho*fl*dl+ml*qo*vl,this._z=Ho*qo*vl-ml*fl*dl,this._w=Ho*qo*dl+ml*fl*vl;break;case"YZX":this._x=ml*qo*dl+Ho*fl*vl,this._y=Ho*fl*dl+ml*qo*vl,this._z=Ho*qo*vl-ml*fl*dl,this._w=Ho*qo*dl-ml*fl*vl;break;case"XZY":this._x=ml*qo*dl-Ho*fl*vl,this._y=Ho*fl*dl-ml*qo*vl,this._z=Ho*qo*vl+ml*fl*dl,this._w=Ho*qo*dl+ml*fl*vl;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+Ro)}return!0===Rn&&this._onChangeCallback(),this}setFromAxisAngle(C,Rn){const or=Rn/2,So=Math.sin(or);return this._x=C.x*So,this._y=C.y*So,this._z=C.z*So,this._w=Math.cos(or),this._onChangeCallback(),this}setFromRotationMatrix(C){const Rn=C.elements,or=Rn[0],So=Rn[4],To=Rn[8],Ro=Rn[1],Uo=Rn[5],Oo=Rn[9],Ho=Rn[2],qo=Rn[6],dl=Rn[10],ml=or+Uo+dl;if(ml>0){const C=.5/Math.sqrt(ml+1);this._w=.25/C,this._x=(qo-Oo)*C,this._y=(To-Ho)*C,this._z=(Ro-So)*C}else if(or>Uo&&or>dl){const C=2*Math.sqrt(1+or-Uo-dl);this._w=(qo-Oo)/C,this._x=.25*C,this._y=(So+Ro)/C,this._z=(To+Ho)/C}else if(Uo>dl){const C=2*Math.sqrt(1+Uo-or-dl);this._w=(To-Ho)/C,this._x=(So+Ro)/C,this._y=.25*C,this._z=(Oo+qo)/C}else{const C=2*Math.sqrt(1+dl-or-Uo);this._w=(Ro-So)/C,this._x=(To+Ho)/C,this._y=(Oo+qo)/C,this._z=.25*C}return this._onChangeCallback(),this}setFromUnitVectors(C,Rn){let or=C.dot(Rn)+1;return or<Number.EPSILON?(or=0,Math.abs(C.x)>Math.abs(C.z)?(this._x=-C.y,this._y=C.x,this._z=0,this._w=or):(this._x=0,this._y=-C.z,this._z=C.y,this._w=or)):(this._x=C.y*Rn.z-C.z*Rn.y,this._y=C.z*Rn.x-C.x*Rn.z,this._z=C.x*Rn.y-C.y*Rn.x,this._w=or),this.normalize()}angleTo(C){return 2*Math.acos(Math.abs(clamp(this.dot(C),-1,1)))}rotateTowards(C,Rn){const or=this.angleTo(C);if(0===or)return this;const So=Math.min(1,Rn/or);return this.slerp(C,So),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(C){return this._x*C._x+this._y*C._y+this._z*C._z+this._w*C._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 C=this.length();return 0===C?(this._x=0,this._y=0,this._z=0,this._w=1):(C=1/C,this._x=this._x*C,this._y=this._y*C,this._z=this._z*C,this._w=this._w*C),this._onChangeCallback(),this}multiply(C){return this.multiplyQuaternions(this,C)}premultiply(C){return this.multiplyQuaternions(C,this)}multiplyQuaternions(C,Rn){const or=C._x,So=C._y,To=C._z,Ro=C._w,Uo=Rn._x,Oo=Rn._y,Ho=Rn._z,qo=Rn._w;return this._x=or*qo+Ro*Uo+So*Ho-To*Oo,this._y=So*qo+Ro*Oo+To*Uo-or*Ho,this._z=To*qo+Ro*Ho+or*Oo-So*Uo,this._w=Ro*qo-or*Uo-So*Oo-To*Ho,this._onChangeCallback(),this}slerp(C,Rn){if(0===Rn)return this;if(1===Rn)return this.copy(C);const or=this._x,So=this._y,To=this._z,Ro=this._w;let Uo=Ro*C._w+or*C._x+So*C._y+To*C._z;if(Uo<0?(this._w=-C._w,this._x=-C._x,this._y=-C._y,this._z=-C._z,Uo=-Uo):this.copy(C),Uo>=1)return this._w=Ro,this._x=or,this._y=So,this._z=To,this;const Oo=1-Uo*Uo;if(Oo<=Number.EPSILON){const C=1-Rn;return this._w=C*Ro+Rn*this._w,this._x=C*or+Rn*this._x,this._y=C*So+Rn*this._y,this._z=C*To+Rn*this._z,this.normalize(),this}const Ho=Math.sqrt(Oo),qo=Math.atan2(Ho,Uo),dl=Math.sin((1-Rn)*qo)/Ho,ml=Math.sin(Rn*qo)/Ho;return this._w=Ro*dl+this._w*ml,this._x=or*dl+this._x*ml,this._y=So*dl+this._y*ml,this._z=To*dl+this._z*ml,this._onChangeCallback(),this}slerpQuaternions(C,Rn,or){return this.copy(C).slerp(Rn,or)}random(){const C=2*Math.PI*Math.random(),Rn=2*Math.PI*Math.random(),or=Math.random(),So=Math.sqrt(1-or),To=Math.sqrt(or);return this.set(So*Math.sin(C),So*Math.cos(C),To*Math.sin(Rn),To*Math.cos(Rn))}equals(C){return C._x===this._x&&C._y===this._y&&C._z===this._z&&C._w===this._w}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this._x=C[Rn],this._y=C[Rn+1],this._z=C[Rn+2],this._w=C[Rn+3],this._onChangeCallback(),this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this._x,C[Rn+1]=this._y,C[Rn+2]=this._z,C[Rn+3]=this._w,C}fromBufferAttribute(C,Rn){return this._x=C.getX(Rn),this._y=C.getY(Rn),this._z=C.getZ(Rn),this._w=C.getW(Rn),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(C){return this._onChangeCallback=C,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Vector3{constructor(C,Rn,or){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),Vector3.prototype.isVector3=!0,this.x=C,this.y=Rn,this.z=or}set(C,Rn,or){return void 0===or&&(or=this.z),this.x=C,this.y=Rn,this.z=or,this}setScalar(C){return this.x=C,this.y=C,this.z=C,this}setX(C){return this.x=C,this}setY(C){return this.y=C,this}setZ(C){return this.z=C,this}setComponent(C,Rn){switch(C){case 0:this.x=Rn;break;case 1:this.y=Rn;break;case 2:this.z=Rn;break;default:throw new Error("index is out of range: "+C)}return this}getComponent(C){switch(C){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+C)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(C){return this.x=C.x,this.y=C.y,this.z=C.z,this}add(C){return this.x+=C.x,this.y+=C.y,this.z+=C.z,this}addScalar(C){return this.x+=C,this.y+=C,this.z+=C,this}addVectors(C,Rn){return this.x=C.x+Rn.x,this.y=C.y+Rn.y,this.z=C.z+Rn.z,this}addScaledVector(C,Rn){return this.x+=C.x*Rn,this.y+=C.y*Rn,this.z+=C.z*Rn,this}sub(C){return this.x-=C.x,this.y-=C.y,this.z-=C.z,this}subScalar(C){return this.x-=C,this.y-=C,this.z-=C,this}subVectors(C,Rn){return this.x=C.x-Rn.x,this.y=C.y-Rn.y,this.z=C.z-Rn.z,this}multiply(C){return this.x*=C.x,this.y*=C.y,this.z*=C.z,this}multiplyScalar(C){return this.x*=C,this.y*=C,this.z*=C,this}multiplyVectors(C,Rn){return this.x=C.x*Rn.x,this.y=C.y*Rn.y,this.z=C.z*Rn.z,this}applyEuler(C){return this.applyQuaternion(vm.setFromEuler(C))}applyAxisAngle(C,Rn){return this.applyQuaternion(vm.setFromAxisAngle(C,Rn))}applyMatrix3(C){const Rn=this.x,or=this.y,So=this.z,To=C.elements;return this.x=To[0]*Rn+To[3]*or+To[6]*So,this.y=To[1]*Rn+To[4]*or+To[7]*So,this.z=To[2]*Rn+To[5]*or+To[8]*So,this}applyNormalMatrix(C){return this.applyMatrix3(C).normalize()}applyMatrix4(C){const Rn=this.x,or=this.y,So=this.z,To=C.elements,Ro=1/(To[3]*Rn+To[7]*or+To[11]*So+To[15]);return this.x=(To[0]*Rn+To[4]*or+To[8]*So+To[12])*Ro,this.y=(To[1]*Rn+To[5]*or+To[9]*So+To[13])*Ro,this.z=(To[2]*Rn+To[6]*or+To[10]*So+To[14])*Ro,this}applyQuaternion(C){const Rn=this.x,or=this.y,So=this.z,To=C.x,Ro=C.y,Uo=C.z,Oo=C.w,Ho=2*(Ro*So-Uo*or),qo=2*(Uo*Rn-To*So),dl=2*(To*or-Ro*Rn);return this.x=Rn+Oo*Ho+Ro*dl-Uo*qo,this.y=or+Oo*qo+Uo*Ho-To*dl,this.z=So+Oo*dl+To*qo-Ro*Ho,this}project(C){return this.applyMatrix4(C.matrixWorldInverse).applyMatrix4(C.projectionMatrix)}unproject(C){return this.applyMatrix4(C.projectionMatrixInverse).applyMatrix4(C.matrixWorld)}transformDirection(C){const Rn=this.x,or=this.y,So=this.z,To=C.elements;return this.x=To[0]*Rn+To[4]*or+To[8]*So,this.y=To[1]*Rn+To[5]*or+To[9]*So,this.z=To[2]*Rn+To[6]*or+To[10]*So,this.normalize()}divide(C){return this.x/=C.x,this.y/=C.y,this.z/=C.z,this}divideScalar(C){return this.multiplyScalar(1/C)}min(C){return this.x=Math.min(this.x,C.x),this.y=Math.min(this.y,C.y),this.z=Math.min(this.z,C.z),this}max(C){return this.x=Math.max(this.x,C.x),this.y=Math.max(this.y,C.y),this.z=Math.max(this.z,C.z),this}clamp(C,Rn){return this.x=Math.max(C.x,Math.min(Rn.x,this.x)),this.y=Math.max(C.y,Math.min(Rn.y,this.y)),this.z=Math.max(C.z,Math.min(Rn.z,this.z)),this}clampScalar(C,Rn){return this.x=Math.max(C,Math.min(Rn,this.x)),this.y=Math.max(C,Math.min(Rn,this.y)),this.z=Math.max(C,Math.min(Rn,this.z)),this}clampLength(C,Rn){const or=this.length();return this.divideScalar(or||1).multiplyScalar(Math.max(C,Math.min(Rn,or)))}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(C){return this.x*C.x+this.y*C.y+this.z*C.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(C){return this.normalize().multiplyScalar(C)}lerp(C,Rn){return this.x+=(C.x-this.x)*Rn,this.y+=(C.y-this.y)*Rn,this.z+=(C.z-this.z)*Rn,this}lerpVectors(C,Rn,or){return this.x=C.x+(Rn.x-C.x)*or,this.y=C.y+(Rn.y-C.y)*or,this.z=C.z+(Rn.z-C.z)*or,this}cross(C){return this.crossVectors(this,C)}crossVectors(C,Rn){const or=C.x,So=C.y,To=C.z,Ro=Rn.x,Uo=Rn.y,Oo=Rn.z;return this.x=So*Oo-To*Uo,this.y=To*Ro-or*Oo,this.z=or*Uo-So*Ro,this}projectOnVector(C){const Rn=C.lengthSq();if(0===Rn)return this.set(0,0,0);const or=C.dot(this)/Rn;return this.copy(C).multiplyScalar(or)}projectOnPlane(C){return ym.copy(this).projectOnVector(C),this.sub(ym)}reflect(C){return this.sub(ym.copy(C).multiplyScalar(2*this.dot(C)))}angleTo(C){const Rn=Math.sqrt(this.lengthSq()*C.lengthSq());if(0===Rn)return Math.PI/2;const or=this.dot(C)/Rn;return Math.acos(clamp(or,-1,1))}distanceTo(C){return Math.sqrt(this.distanceToSquared(C))}distanceToSquared(C){const Rn=this.x-C.x,or=this.y-C.y,So=this.z-C.z;return Rn*Rn+or*or+So*So}manhattanDistanceTo(C){return Math.abs(this.x-C.x)+Math.abs(this.y-C.y)+Math.abs(this.z-C.z)}setFromSpherical(C){return this.setFromSphericalCoords(C.radius,C.phi,C.theta)}setFromSphericalCoords(C,Rn,or){const So=Math.sin(Rn)*C;return this.x=So*Math.sin(or),this.y=Math.cos(Rn)*C,this.z=So*Math.cos(or),this}setFromCylindrical(C){return this.setFromCylindricalCoords(C.radius,C.theta,C.y)}setFromCylindricalCoords(C,Rn,or){return this.x=C*Math.sin(Rn),this.y=or,this.z=C*Math.cos(Rn),this}setFromMatrixPosition(C){const Rn=C.elements;return this.x=Rn[12],this.y=Rn[13],this.z=Rn[14],this}setFromMatrixScale(C){const Rn=this.setFromMatrixColumn(C,0).length(),or=this.setFromMatrixColumn(C,1).length(),So=this.setFromMatrixColumn(C,2).length();return this.x=Rn,this.y=or,this.z=So,this}setFromMatrixColumn(C,Rn){return this.fromArray(C.elements,4*Rn)}setFromMatrix3Column(C,Rn){return this.fromArray(C.elements,3*Rn)}setFromEuler(C){return this.x=C._x,this.y=C._y,this.z=C._z,this}setFromColor(C){return this.x=C.r,this.y=C.g,this.z=C.b,this}equals(C){return C.x===this.x&&C.y===this.y&&C.z===this.z}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.x=C[Rn],this.y=C[Rn+1],this.z=C[Rn+2],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.x,C[Rn+1]=this.y,C[Rn+2]=this.z,C}fromBufferAttribute(C,Rn){return this.x=C.getX(Rn),this.y=C.getY(Rn),this.z=C.getZ(Rn),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const C=Math.random()*Math.PI*2,Rn=2*Math.random()-1,or=Math.sqrt(1-Rn*Rn);return this.x=or*Math.cos(C),this.y=Rn,this.z=or*Math.sin(C),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ym=new Vector3,vm=new Quaternion;class Box3{constructor(C,Rn){void 0===C&&(C=new Vector3(1/0,1/0,1/0)),void 0===Rn&&(Rn=new Vector3(-1/0,-1/0,-1/0)),this.isBox3=!0,this.min=C,this.max=Rn}set(C,Rn){return this.min.copy(C),this.max.copy(Rn),this}setFromArray(C){this.makeEmpty();for(let Rn=0,or=C.length;Rn<or;Rn+=3)this.expandByPoint(_m.fromArray(C,Rn));return this}setFromBufferAttribute(C){this.makeEmpty();for(let Rn=0,or=C.count;Rn<or;Rn++)this.expandByPoint(_m.fromBufferAttribute(C,Rn));return this}setFromPoints(C){this.makeEmpty();for(let Rn=0,or=C.length;Rn<or;Rn++)this.expandByPoint(C[Rn]);return this}setFromCenterAndSize(C,Rn){const or=_m.copy(Rn).multiplyScalar(.5);return this.min.copy(C).sub(or),this.max.copy(C).add(or),this}setFromObject(C,Rn){return void 0===Rn&&(Rn=!1),this.makeEmpty(),this.expandByObject(C,Rn)}clone(){return(new this.constructor).copy(this)}copy(C){return this.min.copy(C.min),this.max.copy(C.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(C){return this.isEmpty()?C.set(0,0,0):C.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(C){return this.isEmpty()?C.set(0,0,0):C.subVectors(this.max,this.min)}expandByPoint(C){return this.min.min(C),this.max.max(C),this}expandByVector(C){return this.min.sub(C),this.max.add(C),this}expandByScalar(C){return this.min.addScalar(-C),this.max.addScalar(C),this}expandByObject(C,Rn){void 0===Rn&&(Rn=!1),C.updateWorldMatrix(!1,!1);const or=C.geometry;if(void 0!==or){const So=or.getAttribute("position");if(!0===Rn&&void 0!==So&&!0!==C.isInstancedMesh)for(let Rn=0,or=So.count;Rn<or;Rn++)!0===C.isMesh?C.getVertexPosition(Rn,_m):_m.fromBufferAttribute(So,Rn),_m.applyMatrix4(C.matrixWorld),this.expandByPoint(_m);else void 0!==C.boundingBox?(null===C.boundingBox&&C.computeBoundingBox(),bm.copy(C.boundingBox)):(null===or.boundingBox&&or.computeBoundingBox(),bm.copy(or.boundingBox)),bm.applyMatrix4(C.matrixWorld),this.union(bm)}const So=C.children;for(let To=0,Ro=So.length;To<Ro;To++)this.expandByObject(So[To],Rn);return this}containsPoint(C){return C.x>=this.min.x&&C.x<=this.max.x&&C.y>=this.min.y&&C.y<=this.max.y&&C.z>=this.min.z&&C.z<=this.max.z}containsBox(C){return this.min.x<=C.min.x&&C.max.x<=this.max.x&&this.min.y<=C.min.y&&C.max.y<=this.max.y&&this.min.z<=C.min.z&&C.max.z<=this.max.z}getParameter(C,Rn){return Rn.set((C.x-this.min.x)/(this.max.x-this.min.x),(C.y-this.min.y)/(this.max.y-this.min.y),(C.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(C){return C.max.x>=this.min.x&&C.min.x<=this.max.x&&C.max.y>=this.min.y&&C.min.y<=this.max.y&&C.max.z>=this.min.z&&C.min.z<=this.max.z}intersectsSphere(C){return this.clampPoint(C.center,_m),_m.distanceToSquared(C.center)<=C.radius*C.radius}intersectsPlane(C){let Rn,or;return C.normal.x>0?(Rn=C.normal.x*this.min.x,or=C.normal.x*this.max.x):(Rn=C.normal.x*this.max.x,or=C.normal.x*this.min.x),C.normal.y>0?(Rn+=C.normal.y*this.min.y,or+=C.normal.y*this.max.y):(Rn+=C.normal.y*this.max.y,or+=C.normal.y*this.min.y),C.normal.z>0?(Rn+=C.normal.z*this.min.z,or+=C.normal.z*this.max.z):(Rn+=C.normal.z*this.max.z,or+=C.normal.z*this.min.z),Rn<=-C.constant&&or>=-C.constant}intersectsTriangle(C){if(this.isEmpty())return!1;this.getCenter(Im),Cm.subVectors(this.max,Im),wm.subVectors(C.a,Im),Em.subVectors(C.b,Im),Mm.subVectors(C.c,Im),Sm.subVectors(Em,wm),km.subVectors(Mm,Em),Tm.subVectors(wm,Mm);let Rn=[0,-Sm.z,Sm.y,0,-km.z,km.y,0,-Tm.z,Tm.y,Sm.z,0,-Sm.x,km.z,0,-km.x,Tm.z,0,-Tm.x,-Sm.y,Sm.x,0,-km.y,km.x,0,-Tm.y,Tm.x,0];return!!satForAxes(Rn,wm,Em,Mm,Cm)&&(Rn=[1,0,0,0,1,0,0,0,1],!!satForAxes(Rn,wm,Em,Mm,Cm)&&(Lm.crossVectors(Sm,km),Rn=[Lm.x,Lm.y,Lm.z],satForAxes(Rn,wm,Em,Mm,Cm)))}clampPoint(C,Rn){return Rn.copy(C).clamp(this.min,this.max)}distanceToPoint(C){return this.clampPoint(C,_m).distanceTo(C)}getBoundingSphere(C){return this.isEmpty()?C.makeEmpty():(this.getCenter(C.center),C.radius=.5*this.getSize(_m).length()),C}intersect(C){return this.min.max(C.min),this.max.min(C.max),this.isEmpty()&&this.makeEmpty(),this}union(C){return this.min.min(C.min),this.max.max(C.max),this}applyMatrix4(C){return this.isEmpty()||(xm[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(C),xm[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(C),xm[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(C),xm[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(C),xm[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(C),xm[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(C),xm[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(C),xm[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(C),this.setFromPoints(xm)),this}translate(C){return this.min.add(C),this.max.add(C),this}equals(C){return C.min.equals(this.min)&&C.max.equals(this.max)}}const xm=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],_m=new Vector3,bm=new Box3,wm=new Vector3,Em=new Vector3,Mm=new Vector3,Sm=new Vector3,km=new Vector3,Tm=new Vector3,Im=new Vector3,Cm=new Vector3,Lm=new Vector3,Pm=new Vector3;function satForAxes(C,Rn,or,So,To){for(let Ro=0,Uo=C.length-3;Ro<=Uo;Ro+=3){Pm.fromArray(C,Ro);const Uo=To.x*Math.abs(Pm.x)+To.y*Math.abs(Pm.y)+To.z*Math.abs(Pm.z),Oo=Rn.dot(Pm),Ho=or.dot(Pm),qo=So.dot(Pm);if(Math.max(-Math.max(Oo,Ho,qo),Math.min(Oo,Ho,qo))>Uo)return!1}return!0}const zm=new Box3,Dm=new Vector3,Rm=new Vector3;class Sphere{constructor(C,Rn){void 0===C&&(C=new Vector3),void 0===Rn&&(Rn=-1),this.isSphere=!0,this.center=C,this.radius=Rn}set(C,Rn){return this.center.copy(C),this.radius=Rn,this}setFromPoints(C,Rn){const or=this.center;void 0!==Rn?or.copy(Rn):zm.setFromPoints(C).getCenter(or);let So=0;for(let To=0,Ro=C.length;To<Ro;To++)So=Math.max(So,or.distanceToSquared(C[To]));return this.radius=Math.sqrt(So),this}copy(C){return this.center.copy(C.center),this.radius=C.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(C){return C.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(C){return C.distanceTo(this.center)-this.radius}intersectsSphere(C){const Rn=this.radius+C.radius;return C.center.distanceToSquared(this.center)<=Rn*Rn}intersectsBox(C){return C.intersectsSphere(this)}intersectsPlane(C){return Math.abs(C.distanceToPoint(this.center))<=this.radius}clampPoint(C,Rn){const or=this.center.distanceToSquared(C);return Rn.copy(C),or>this.radius*this.radius&&(Rn.sub(this.center).normalize(),Rn.multiplyScalar(this.radius).add(this.center)),Rn}getBoundingBox(C){return this.isEmpty()?(C.makeEmpty(),C):(C.set(this.center,this.center),C.expandByScalar(this.radius),C)}applyMatrix4(C){return this.center.applyMatrix4(C),this.radius=this.radius*C.getMaxScaleOnAxis(),this}translate(C){return this.center.add(C),this}expandByPoint(C){if(this.isEmpty())return this.center.copy(C),this.radius=0,this;Dm.subVectors(C,this.center);const Rn=Dm.lengthSq();if(Rn>this.radius*this.radius){const C=Math.sqrt(Rn),or=.5*(C-this.radius);this.center.addScaledVector(Dm,or/C),this.radius+=or}return this}union(C){return C.isEmpty()?this:this.isEmpty()?(this.copy(C),this):(!0===this.center.equals(C.center)?this.radius=Math.max(this.radius,C.radius):(Rm.subVectors(C.center,this.center).setLength(C.radius),this.expandByPoint(Dm.copy(C.center).add(Rm)),this.expandByPoint(Dm.copy(C.center).sub(Rm))),this)}equals(C){return C.center.equals(this.center)&&C.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Nm=new Vector3,Um=new Vector3,Bm=new Vector3,Fm=new Vector3,Om=new Vector3,Vm=new Vector3,jm=new Vector3;class Ray{constructor(C,Rn){void 0===C&&(C=new Vector3),void 0===Rn&&(Rn=new Vector3(0,0,-1)),this.origin=C,this.direction=Rn}set(C,Rn){return this.origin.copy(C),this.direction.copy(Rn),this}copy(C){return this.origin.copy(C.origin),this.direction.copy(C.direction),this}at(C,Rn){return Rn.copy(this.origin).addScaledVector(this.direction,C)}lookAt(C){return this.direction.copy(C).sub(this.origin).normalize(),this}recast(C){return this.origin.copy(this.at(C,Nm)),this}closestPointToPoint(C,Rn){Rn.subVectors(C,this.origin);const or=Rn.dot(this.direction);return or<0?Rn.copy(this.origin):Rn.copy(this.origin).addScaledVector(this.direction,or)}distanceToPoint(C){return Math.sqrt(this.distanceSqToPoint(C))}distanceSqToPoint(C){const Rn=Nm.subVectors(C,this.origin).dot(this.direction);return Rn<0?this.origin.distanceToSquared(C):(Nm.copy(this.origin).addScaledVector(this.direction,Rn),Nm.distanceToSquared(C))}distanceSqToSegment(C,Rn,or,So){Um.copy(C).add(Rn).multiplyScalar(.5),Bm.copy(Rn).sub(C).normalize(),Fm.copy(this.origin).sub(Um);const To=.5*C.distanceTo(Rn),Ro=-this.direction.dot(Bm),Uo=Fm.dot(this.direction),Oo=-Fm.dot(Bm),Ho=Fm.lengthSq(),qo=Math.abs(1-Ro*Ro);let dl,ml,fl,vl;if(qo>0)if(dl=Ro*Oo-Uo,ml=Ro*Uo-Oo,vl=To*qo,dl>=0)if(ml>=-vl)if(ml<=vl){const C=1/qo;dl*=C,ml*=C,fl=dl*(dl+Ro*ml+2*Uo)+ml*(Ro*dl+ml+2*Oo)+Ho}else ml=To,dl=Math.max(0,-(Ro*ml+Uo)),fl=-dl*dl+ml*(ml+2*Oo)+Ho;else ml=-To,dl=Math.max(0,-(Ro*ml+Uo)),fl=-dl*dl+ml*(ml+2*Oo)+Ho;else ml<=-vl?(dl=Math.max(0,-(-Ro*To+Uo)),ml=dl>0?-To:Math.min(Math.max(-To,-Oo),To),fl=-dl*dl+ml*(ml+2*Oo)+Ho):ml<=vl?(dl=0,ml=Math.min(Math.max(-To,-Oo),To),fl=ml*(ml+2*Oo)+Ho):(dl=Math.max(0,-(Ro*To+Uo)),ml=dl>0?To:Math.min(Math.max(-To,-Oo),To),fl=-dl*dl+ml*(ml+2*Oo)+Ho);else ml=Ro>0?-To:To,dl=Math.max(0,-(Ro*ml+Uo)),fl=-dl*dl+ml*(ml+2*Oo)+Ho;return or&&or.copy(this.origin).addScaledVector(this.direction,dl),So&&So.copy(Um).addScaledVector(Bm,ml),fl}intersectSphere(C,Rn){Nm.subVectors(C.center,this.origin);const or=Nm.dot(this.direction),So=Nm.dot(Nm)-or*or,To=C.radius*C.radius;if(So>To)return null;const Ro=Math.sqrt(To-So),Uo=or-Ro,Oo=or+Ro;return Oo<0?null:Uo<0?this.at(Oo,Rn):this.at(Uo,Rn)}intersectsSphere(C){return this.distanceSqToPoint(C.center)<=C.radius*C.radius}distanceToPlane(C){const Rn=C.normal.dot(this.direction);if(0===Rn)return 0===C.distanceToPoint(this.origin)?0:null;const or=-(this.origin.dot(C.normal)+C.constant)/Rn;return or>=0?or:null}intersectPlane(C,Rn){const or=this.distanceToPlane(C);return null===or?null:this.at(or,Rn)}intersectsPlane(C){const Rn=C.distanceToPoint(this.origin);if(0===Rn)return!0;return C.normal.dot(this.direction)*Rn<0}intersectBox(C,Rn){let or,So,To,Ro,Uo,Oo;const Ho=1/this.direction.x,qo=1/this.direction.y,dl=1/this.direction.z,ml=this.origin;return Ho>=0?(or=(C.min.x-ml.x)*Ho,So=(C.max.x-ml.x)*Ho):(or=(C.max.x-ml.x)*Ho,So=(C.min.x-ml.x)*Ho),qo>=0?(To=(C.min.y-ml.y)*qo,Ro=(C.max.y-ml.y)*qo):(To=(C.max.y-ml.y)*qo,Ro=(C.min.y-ml.y)*qo),or>Ro||To>So?null:((To>or||isNaN(or))&&(or=To),(Ro<So||isNaN(So))&&(So=Ro),dl>=0?(Uo=(C.min.z-ml.z)*dl,Oo=(C.max.z-ml.z)*dl):(Uo=(C.max.z-ml.z)*dl,Oo=(C.min.z-ml.z)*dl),or>Oo||Uo>So?null:((Uo>or||or!==or)&&(or=Uo),(Oo<So||So!==So)&&(So=Oo),So<0?null:this.at(or>=0?or:So,Rn)))}intersectsBox(C){return null!==this.intersectBox(C,Nm)}intersectTriangle(C,Rn,or,So,To){Om.subVectors(Rn,C),Vm.subVectors(or,C),jm.crossVectors(Om,Vm);let Ro,Uo=this.direction.dot(jm);if(Uo>0){if(So)return null;Ro=1}else{if(!(Uo<0))return null;Ro=-1,Uo=-Uo}Fm.subVectors(this.origin,C);const Oo=Ro*this.direction.dot(Vm.crossVectors(Fm,Vm));if(Oo<0)return null;const Ho=Ro*this.direction.dot(Om.cross(Fm));if(Ho<0)return null;if(Oo+Ho>Uo)return null;const qo=-Ro*Fm.dot(jm);return qo<0?null:this.at(qo/Uo,To)}applyMatrix4(C){return this.origin.applyMatrix4(C),this.direction.transformDirection(C),this}equals(C){return C.origin.equals(this.origin)&&C.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Matrix4{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl,bl,kl){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==C&&this.set(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl,bl,kl)}set(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl,bl,kl){const Ll=this.elements;return Ll[0]=C,Ll[4]=Rn,Ll[8]=or,Ll[12]=So,Ll[1]=To,Ll[5]=Ro,Ll[9]=Uo,Ll[13]=Oo,Ll[2]=Ho,Ll[6]=qo,Ll[10]=dl,Ll[14]=ml,Ll[3]=fl,Ll[7]=vl,Ll[11]=bl,Ll[15]=kl,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 Matrix4).fromArray(this.elements)}copy(C){const Rn=this.elements,or=C.elements;return Rn[0]=or[0],Rn[1]=or[1],Rn[2]=or[2],Rn[3]=or[3],Rn[4]=or[4],Rn[5]=or[5],Rn[6]=or[6],Rn[7]=or[7],Rn[8]=or[8],Rn[9]=or[9],Rn[10]=or[10],Rn[11]=or[11],Rn[12]=or[12],Rn[13]=or[13],Rn[14]=or[14],Rn[15]=or[15],this}copyPosition(C){const Rn=this.elements,or=C.elements;return Rn[12]=or[12],Rn[13]=or[13],Rn[14]=or[14],this}setFromMatrix3(C){const Rn=C.elements;return this.set(Rn[0],Rn[3],Rn[6],0,Rn[1],Rn[4],Rn[7],0,Rn[2],Rn[5],Rn[8],0,0,0,0,1),this}extractBasis(C,Rn,or){return C.setFromMatrixColumn(this,0),Rn.setFromMatrixColumn(this,1),or.setFromMatrixColumn(this,2),this}makeBasis(C,Rn,or){return this.set(C.x,Rn.x,or.x,0,C.y,Rn.y,or.y,0,C.z,Rn.z,or.z,0,0,0,0,1),this}extractRotation(C){const Rn=this.elements,or=C.elements,So=1/Gm.setFromMatrixColumn(C,0).length(),To=1/Gm.setFromMatrixColumn(C,1).length(),Ro=1/Gm.setFromMatrixColumn(C,2).length();return Rn[0]=or[0]*So,Rn[1]=or[1]*So,Rn[2]=or[2]*So,Rn[3]=0,Rn[4]=or[4]*To,Rn[5]=or[5]*To,Rn[6]=or[6]*To,Rn[7]=0,Rn[8]=or[8]*Ro,Rn[9]=or[9]*Ro,Rn[10]=or[10]*Ro,Rn[11]=0,Rn[12]=0,Rn[13]=0,Rn[14]=0,Rn[15]=1,this}makeRotationFromEuler(C){const Rn=this.elements,or=C.x,So=C.y,To=C.z,Ro=Math.cos(or),Uo=Math.sin(or),Oo=Math.cos(So),Ho=Math.sin(So),qo=Math.cos(To),dl=Math.sin(To);if("XYZ"===C.order){const C=Ro*qo,or=Ro*dl,So=Uo*qo,To=Uo*dl;Rn[0]=Oo*qo,Rn[4]=-Oo*dl,Rn[8]=Ho,Rn[1]=or+So*Ho,Rn[5]=C-To*Ho,Rn[9]=-Uo*Oo,Rn[2]=To-C*Ho,Rn[6]=So+or*Ho,Rn[10]=Ro*Oo}else if("YXZ"===C.order){const C=Oo*qo,or=Oo*dl,So=Ho*qo,To=Ho*dl;Rn[0]=C+To*Uo,Rn[4]=So*Uo-or,Rn[8]=Ro*Ho,Rn[1]=Ro*dl,Rn[5]=Ro*qo,Rn[9]=-Uo,Rn[2]=or*Uo-So,Rn[6]=To+C*Uo,Rn[10]=Ro*Oo}else if("ZXY"===C.order){const C=Oo*qo,or=Oo*dl,So=Ho*qo,To=Ho*dl;Rn[0]=C-To*Uo,Rn[4]=-Ro*dl,Rn[8]=So+or*Uo,Rn[1]=or+So*Uo,Rn[5]=Ro*qo,Rn[9]=To-C*Uo,Rn[2]=-Ro*Ho,Rn[6]=Uo,Rn[10]=Ro*Oo}else if("ZYX"===C.order){const C=Ro*qo,or=Ro*dl,So=Uo*qo,To=Uo*dl;Rn[0]=Oo*qo,Rn[4]=So*Ho-or,Rn[8]=C*Ho+To,Rn[1]=Oo*dl,Rn[5]=To*Ho+C,Rn[9]=or*Ho-So,Rn[2]=-Ho,Rn[6]=Uo*Oo,Rn[10]=Ro*Oo}else if("YZX"===C.order){const C=Ro*Oo,or=Ro*Ho,So=Uo*Oo,To=Uo*Ho;Rn[0]=Oo*qo,Rn[4]=To-C*dl,Rn[8]=So*dl+or,Rn[1]=dl,Rn[5]=Ro*qo,Rn[9]=-Uo*qo,Rn[2]=-Ho*qo,Rn[6]=or*dl+So,Rn[10]=C-To*dl}else if("XZY"===C.order){const C=Ro*Oo,or=Ro*Ho,So=Uo*Oo,To=Uo*Ho;Rn[0]=Oo*qo,Rn[4]=-dl,Rn[8]=Ho*qo,Rn[1]=C*dl+To,Rn[5]=Ro*qo,Rn[9]=or*dl-So,Rn[2]=So*dl-or,Rn[6]=Uo*qo,Rn[10]=To*dl+C}return Rn[3]=0,Rn[7]=0,Rn[11]=0,Rn[12]=0,Rn[13]=0,Rn[14]=0,Rn[15]=1,this}makeRotationFromQuaternion(C){return this.compose(Zm,C,Wm)}lookAt(C,Rn,or){const So=this.elements;return Qm.subVectors(C,Rn),0===Qm.lengthSq()&&(Qm.z=1),Qm.normalize(),qm.crossVectors(or,Qm),0===qm.lengthSq()&&(1===Math.abs(or.z)?Qm.x+=1e-4:Qm.z+=1e-4,Qm.normalize(),qm.crossVectors(or,Qm)),qm.normalize(),Km.crossVectors(Qm,qm),So[0]=qm.x,So[4]=Km.x,So[8]=Qm.x,So[1]=qm.y,So[5]=Km.y,So[9]=Qm.y,So[2]=qm.z,So[6]=Km.z,So[10]=Qm.z,this}multiply(C){return this.multiplyMatrices(this,C)}premultiply(C){return this.multiplyMatrices(C,this)}multiplyMatrices(C,Rn){const or=C.elements,So=Rn.elements,To=this.elements,Ro=or[0],Uo=or[4],Oo=or[8],Ho=or[12],qo=or[1],dl=or[5],ml=or[9],fl=or[13],vl=or[2],bl=or[6],kl=or[10],Ll=or[14],Dl=or[3],Nc=or[7],jc=or[11],Zc=or[15],eu=So[0],Ku=So[4],Yu=So[8],Eh=So[12],Th=So[1],Ch=So[5],Lh=So[9],Dh=So[13],Rh=So[2],Nh=So[6],Uh=So[10],Bh=So[14],Fh=So[3],Oh=So[7],Vh=So[11],jh=So[15];return To[0]=Ro*eu+Uo*Th+Oo*Rh+Ho*Fh,To[4]=Ro*Ku+Uo*Ch+Oo*Nh+Ho*Oh,To[8]=Ro*Yu+Uo*Lh+Oo*Uh+Ho*Vh,To[12]=Ro*Eh+Uo*Dh+Oo*Bh+Ho*jh,To[1]=qo*eu+dl*Th+ml*Rh+fl*Fh,To[5]=qo*Ku+dl*Ch+ml*Nh+fl*Oh,To[9]=qo*Yu+dl*Lh+ml*Uh+fl*Vh,To[13]=qo*Eh+dl*Dh+ml*Bh+fl*jh,To[2]=vl*eu+bl*Th+kl*Rh+Ll*Fh,To[6]=vl*Ku+bl*Ch+kl*Nh+Ll*Oh,To[10]=vl*Yu+bl*Lh+kl*Uh+Ll*Vh,To[14]=vl*Eh+bl*Dh+kl*Bh+Ll*jh,To[3]=Dl*eu+Nc*Th+jc*Rh+Zc*Fh,To[7]=Dl*Ku+Nc*Ch+jc*Nh+Zc*Oh,To[11]=Dl*Yu+Nc*Lh+jc*Uh+Zc*Vh,To[15]=Dl*Eh+Nc*Dh+jc*Bh+Zc*jh,this}multiplyScalar(C){const Rn=this.elements;return Rn[0]*=C,Rn[4]*=C,Rn[8]*=C,Rn[12]*=C,Rn[1]*=C,Rn[5]*=C,Rn[9]*=C,Rn[13]*=C,Rn[2]*=C,Rn[6]*=C,Rn[10]*=C,Rn[14]*=C,Rn[3]*=C,Rn[7]*=C,Rn[11]*=C,Rn[15]*=C,this}determinant(){const C=this.elements,Rn=C[0],or=C[4],So=C[8],To=C[12],Ro=C[1],Uo=C[5],Oo=C[9],Ho=C[13],qo=C[2],dl=C[6],ml=C[10],fl=C[14];return C[3]*(+To*Oo*dl-So*Ho*dl-To*Uo*ml+or*Ho*ml+So*Uo*fl-or*Oo*fl)+C[7]*(+Rn*Oo*fl-Rn*Ho*ml+To*Ro*ml-So*Ro*fl+So*Ho*qo-To*Oo*qo)+C[11]*(+Rn*Ho*dl-Rn*Uo*fl-To*Ro*dl+or*Ro*fl+To*Uo*qo-or*Ho*qo)+C[15]*(-So*Uo*qo-Rn*Oo*dl+Rn*Uo*ml+So*Ro*dl-or*Ro*ml+or*Oo*qo)}transpose(){const C=this.elements;let Rn;return Rn=C[1],C[1]=C[4],C[4]=Rn,Rn=C[2],C[2]=C[8],C[8]=Rn,Rn=C[6],C[6]=C[9],C[9]=Rn,Rn=C[3],C[3]=C[12],C[12]=Rn,Rn=C[7],C[7]=C[13],C[13]=Rn,Rn=C[11],C[11]=C[14],C[14]=Rn,this}setPosition(C,Rn,or){const So=this.elements;return C.isVector3?(So[12]=C.x,So[13]=C.y,So[14]=C.z):(So[12]=C,So[13]=Rn,So[14]=or),this}invert(){const C=this.elements,Rn=C[0],or=C[1],So=C[2],To=C[3],Ro=C[4],Uo=C[5],Oo=C[6],Ho=C[7],qo=C[8],dl=C[9],ml=C[10],fl=C[11],vl=C[12],bl=C[13],kl=C[14],Ll=C[15],Dl=dl*kl*Ho-bl*ml*Ho+bl*Oo*fl-Uo*kl*fl-dl*Oo*Ll+Uo*ml*Ll,Nc=vl*ml*Ho-qo*kl*Ho-vl*Oo*fl+Ro*kl*fl+qo*Oo*Ll-Ro*ml*Ll,jc=qo*bl*Ho-vl*dl*Ho+vl*Uo*fl-Ro*bl*fl-qo*Uo*Ll+Ro*dl*Ll,Zc=vl*dl*Oo-qo*bl*Oo-vl*Uo*ml+Ro*bl*ml+qo*Uo*kl-Ro*dl*kl,eu=Rn*Dl+or*Nc+So*jc+To*Zc;if(0===eu)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Ku=1/eu;return C[0]=Dl*Ku,C[1]=(bl*ml*To-dl*kl*To-bl*So*fl+or*kl*fl+dl*So*Ll-or*ml*Ll)*Ku,C[2]=(Uo*kl*To-bl*Oo*To+bl*So*Ho-or*kl*Ho-Uo*So*Ll+or*Oo*Ll)*Ku,C[3]=(dl*Oo*To-Uo*ml*To-dl*So*Ho+or*ml*Ho+Uo*So*fl-or*Oo*fl)*Ku,C[4]=Nc*Ku,C[5]=(qo*kl*To-vl*ml*To+vl*So*fl-Rn*kl*fl-qo*So*Ll+Rn*ml*Ll)*Ku,C[6]=(vl*Oo*To-Ro*kl*To-vl*So*Ho+Rn*kl*Ho+Ro*So*Ll-Rn*Oo*Ll)*Ku,C[7]=(Ro*ml*To-qo*Oo*To+qo*So*Ho-Rn*ml*Ho-Ro*So*fl+Rn*Oo*fl)*Ku,C[8]=jc*Ku,C[9]=(vl*dl*To-qo*bl*To-vl*or*fl+Rn*bl*fl+qo*or*Ll-Rn*dl*Ll)*Ku,C[10]=(Ro*bl*To-vl*Uo*To+vl*or*Ho-Rn*bl*Ho-Ro*or*Ll+Rn*Uo*Ll)*Ku,C[11]=(qo*Uo*To-Ro*dl*To-qo*or*Ho+Rn*dl*Ho+Ro*or*fl-Rn*Uo*fl)*Ku,C[12]=Zc*Ku,C[13]=(qo*bl*So-vl*dl*So+vl*or*ml-Rn*bl*ml-qo*or*kl+Rn*dl*kl)*Ku,C[14]=(vl*Uo*So-Ro*bl*So-vl*or*Oo+Rn*bl*Oo+Ro*or*kl-Rn*Uo*kl)*Ku,C[15]=(Ro*dl*So-qo*Uo*So+qo*or*Oo-Rn*dl*Oo-Ro*or*ml+Rn*Uo*ml)*Ku,this}scale(C){const Rn=this.elements,or=C.x,So=C.y,To=C.z;return Rn[0]*=or,Rn[4]*=So,Rn[8]*=To,Rn[1]*=or,Rn[5]*=So,Rn[9]*=To,Rn[2]*=or,Rn[6]*=So,Rn[10]*=To,Rn[3]*=or,Rn[7]*=So,Rn[11]*=To,this}getMaxScaleOnAxis(){const C=this.elements,Rn=C[0]*C[0]+C[1]*C[1]+C[2]*C[2],or=C[4]*C[4]+C[5]*C[5]+C[6]*C[6],So=C[8]*C[8]+C[9]*C[9]+C[10]*C[10];return Math.sqrt(Math.max(Rn,or,So))}makeTranslation(C,Rn,or){return C.isVector3?this.set(1,0,0,C.x,0,1,0,C.y,0,0,1,C.z,0,0,0,1):this.set(1,0,0,C,0,1,0,Rn,0,0,1,or,0,0,0,1),this}makeRotationX(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(1,0,0,0,0,Rn,-or,0,0,or,Rn,0,0,0,0,1),this}makeRotationY(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(Rn,0,or,0,0,1,0,0,-or,0,Rn,0,0,0,0,1),this}makeRotationZ(C){const Rn=Math.cos(C),or=Math.sin(C);return this.set(Rn,-or,0,0,or,Rn,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(C,Rn){const or=Math.cos(Rn),So=Math.sin(Rn),To=1-or,Ro=C.x,Uo=C.y,Oo=C.z,Ho=To*Ro,qo=To*Uo;return this.set(Ho*Ro+or,Ho*Uo-So*Oo,Ho*Oo+So*Uo,0,Ho*Uo+So*Oo,qo*Uo+or,qo*Oo-So*Ro,0,Ho*Oo-So*Uo,qo*Oo+So*Ro,To*Oo*Oo+or,0,0,0,0,1),this}makeScale(C,Rn,or){return this.set(C,0,0,0,0,Rn,0,0,0,0,or,0,0,0,0,1),this}makeShear(C,Rn,or,So,To,Ro){return this.set(1,or,To,0,C,1,Ro,0,Rn,So,1,0,0,0,0,1),this}compose(C,Rn,or){const So=this.elements,To=Rn._x,Ro=Rn._y,Uo=Rn._z,Oo=Rn._w,Ho=To+To,qo=Ro+Ro,dl=Uo+Uo,ml=To*Ho,fl=To*qo,vl=To*dl,bl=Ro*qo,kl=Ro*dl,Ll=Uo*dl,Dl=Oo*Ho,Nc=Oo*qo,jc=Oo*dl,Zc=or.x,eu=or.y,Ku=or.z;return So[0]=(1-(bl+Ll))*Zc,So[1]=(fl+jc)*Zc,So[2]=(vl-Nc)*Zc,So[3]=0,So[4]=(fl-jc)*eu,So[5]=(1-(ml+Ll))*eu,So[6]=(kl+Dl)*eu,So[7]=0,So[8]=(vl+Nc)*Ku,So[9]=(kl-Dl)*Ku,So[10]=(1-(ml+bl))*Ku,So[11]=0,So[12]=C.x,So[13]=C.y,So[14]=C.z,So[15]=1,this}decompose(C,Rn,or){const So=this.elements;let To=Gm.set(So[0],So[1],So[2]).length();const Ro=Gm.set(So[4],So[5],So[6]).length(),Uo=Gm.set(So[8],So[9],So[10]).length();this.determinant()<0&&(To=-To),C.x=So[12],C.y=So[13],C.z=So[14],Hm.copy(this);const Oo=1/To,Ho=1/Ro,qo=1/Uo;return Hm.elements[0]*=Oo,Hm.elements[1]*=Oo,Hm.elements[2]*=Oo,Hm.elements[4]*=Ho,Hm.elements[5]*=Ho,Hm.elements[6]*=Ho,Hm.elements[8]*=qo,Hm.elements[9]*=qo,Hm.elements[10]*=qo,Rn.setFromRotationMatrix(Hm),or.x=To,or.y=Ro,or.z=Uo,this}makePerspective(C,Rn,or,So,To,Ro,Uo){void 0===Uo&&(Uo=tm);const Oo=this.elements,Ho=2*To/(Rn-C),qo=2*To/(or-So),dl=(Rn+C)/(Rn-C),ml=(or+So)/(or-So);let fl,vl;if(Uo===tm)fl=-(Ro+To)/(Ro-To),vl=-2*Ro*To/(Ro-To);else{if(Uo!==im)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Uo);fl=-Ro/(Ro-To),vl=-Ro*To/(Ro-To)}return Oo[0]=Ho,Oo[4]=0,Oo[8]=dl,Oo[12]=0,Oo[1]=0,Oo[5]=qo,Oo[9]=ml,Oo[13]=0,Oo[2]=0,Oo[6]=0,Oo[10]=fl,Oo[14]=vl,Oo[3]=0,Oo[7]=0,Oo[11]=-1,Oo[15]=0,this}makeOrthographic(C,Rn,or,So,To,Ro,Uo){void 0===Uo&&(Uo=tm);const Oo=this.elements,Ho=1/(Rn-C),qo=1/(or-So),dl=1/(Ro-To),ml=(Rn+C)*Ho,fl=(or+So)*qo;let vl,bl;if(Uo===tm)vl=(Ro+To)*dl,bl=-2*dl;else{if(Uo!==im)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Uo);vl=To*dl,bl=-1*dl}return Oo[0]=2*Ho,Oo[4]=0,Oo[8]=0,Oo[12]=-ml,Oo[1]=0,Oo[5]=2*qo,Oo[9]=0,Oo[13]=-fl,Oo[2]=0,Oo[6]=0,Oo[10]=bl,Oo[14]=-vl,Oo[3]=0,Oo[7]=0,Oo[11]=0,Oo[15]=1,this}equals(C){const Rn=this.elements,or=C.elements;for(let So=0;So<16;So++)if(Rn[So]!==or[So])return!1;return!0}fromArray(C,Rn){void 0===Rn&&(Rn=0);for(let or=0;or<16;or++)this.elements[or]=C[or+Rn];return this}toArray(C,Rn){void 0===C&&(C=[]),void 0===Rn&&(Rn=0);const or=this.elements;return C[Rn]=or[0],C[Rn+1]=or[1],C[Rn+2]=or[2],C[Rn+3]=or[3],C[Rn+4]=or[4],C[Rn+5]=or[5],C[Rn+6]=or[6],C[Rn+7]=or[7],C[Rn+8]=or[8],C[Rn+9]=or[9],C[Rn+10]=or[10],C[Rn+11]=or[11],C[Rn+12]=or[12],C[Rn+13]=or[13],C[Rn+14]=or[14],C[Rn+15]=or[15],C}}const Gm=new Vector3,Hm=new Matrix4,Zm=new Vector3(0,0,0),Wm=new Vector3(1,1,1),qm=new Vector3,Km=new Vector3,Qm=new Vector3,Xm=new Matrix4,Ym=new Quaternion;class Euler{constructor(C,Rn,or,So){void 0===C&&(C=0),void 0===Rn&&(Rn=0),void 0===or&&(or=0),void 0===So&&(So=Euler.DEFAULT_ORDER),this.isEuler=!0,this._x=C,this._y=Rn,this._z=or,this._order=So}get x(){return this._x}set x(C){this._x=C,this._onChangeCallback()}get y(){return this._y}set y(C){this._y=C,this._onChangeCallback()}get z(){return this._z}set z(C){this._z=C,this._onChangeCallback()}get order(){return this._order}set order(C){this._order=C,this._onChangeCallback()}set(C,Rn,or,So){return void 0===So&&(So=this._order),this._x=C,this._y=Rn,this._z=or,this._order=So,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(C){return this._x=C._x,this._y=C._y,this._z=C._z,this._order=C._order,this._onChangeCallback(),this}setFromRotationMatrix(C,Rn,or){void 0===Rn&&(Rn=this._order),void 0===or&&(or=!0);const So=C.elements,To=So[0],Ro=So[4],Uo=So[8],Oo=So[1],Ho=So[5],qo=So[9],dl=So[2],ml=So[6],fl=So[10];switch(Rn){case"XYZ":this._y=Math.asin(clamp(Uo,-1,1)),Math.abs(Uo)<.9999999?(this._x=Math.atan2(-qo,fl),this._z=Math.atan2(-Ro,To)):(this._x=Math.atan2(ml,Ho),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(qo,-1,1)),Math.abs(qo)<.9999999?(this._y=Math.atan2(Uo,fl),this._z=Math.atan2(Oo,Ho)):(this._y=Math.atan2(-dl,To),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(ml,-1,1)),Math.abs(ml)<.9999999?(this._y=Math.atan2(-dl,fl),this._z=Math.atan2(-Ro,Ho)):(this._y=0,this._z=Math.atan2(Oo,To));break;case"ZYX":this._y=Math.asin(-clamp(dl,-1,1)),Math.abs(dl)<.9999999?(this._x=Math.atan2(ml,fl),this._z=Math.atan2(Oo,To)):(this._x=0,this._z=Math.atan2(-Ro,Ho));break;case"YZX":this._z=Math.asin(clamp(Oo,-1,1)),Math.abs(Oo)<.9999999?(this._x=Math.atan2(-qo,Ho),this._y=Math.atan2(-dl,To)):(this._x=0,this._y=Math.atan2(Uo,fl));break;case"XZY":this._z=Math.asin(-clamp(Ro,-1,1)),Math.abs(Ro)<.9999999?(this._x=Math.atan2(ml,Ho),this._y=Math.atan2(Uo,To)):(this._x=Math.atan2(-qo,fl),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+Rn)}return this._order=Rn,!0===or&&this._onChangeCallback(),this}setFromQuaternion(C,Rn,or){return Xm.makeRotationFromQuaternion(C),this.setFromRotationMatrix(Xm,Rn,or)}setFromVector3(C,Rn){return void 0===Rn&&(Rn=this._order),this.set(C.x,C.y,C.z,Rn)}reorder(C){return Ym.setFromEuler(this),this.setFromQuaternion(Ym,C)}equals(C){return C._x===this._x&&C._y===this._y&&C._z===this._z&&C._order===this._order}fromArray(C){return this._x=C[0],this._y=C[1],this._z=C[2],void 0!==C[3]&&(this._order=C[3]),this._onChangeCallback(),this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this._x,C[Rn+1]=this._y,C[Rn+2]=this._z,C[Rn+3]=this._order,C}_onChange(C){return this._onChangeCallback=C,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Euler.DEFAULT_ORDER="XYZ";class Layers{constructor(){this.mask=1}set(C){this.mask=(1<<C|0)>>>0}enable(C){this.mask|=1<<C|0}enableAll(){this.mask=-1}toggle(C){this.mask^=1<<C|0}disable(C){this.mask&=~(1<<C|0)}disableAll(){this.mask=0}test(C){return 0!==(this.mask&C.mask)}isEnabled(C){return 0!==(this.mask&(1<<C|0))}}let Jm=0;const $m=new Vector3,ef=new Quaternion,tf=new Matrix4,nf=new Vector3,rf=new Vector3,af=new Vector3,sf=new Quaternion,of=new Vector3(1,0,0),lf=new Vector3(0,1,0),cf=new Vector3(0,0,1),uf={type:"added"},hf={type:"removed"},df={type:"childadded",child:null},pf={type:"childremoved",child:null};class Object3D extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Jm++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();const C=new Vector3,Rn=new Euler,or=new Quaternion,So=new Vector3(1,1,1);Rn._onChange((function(){or.setFromEuler(Rn,!1)})),or._onChange((function(){Rn.setFromQuaternion(or,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:C},rotation:{configurable:!0,enumerable:!0,value:Rn},quaternion:{configurable:!0,enumerable:!0,value:or},scale:{configurable:!0,enumerable:!0,value:So},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(C){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(C),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(C){return this.quaternion.premultiply(C),this}setRotationFromAxisAngle(C,Rn){this.quaternion.setFromAxisAngle(C,Rn)}setRotationFromEuler(C){this.quaternion.setFromEuler(C,!0)}setRotationFromMatrix(C){this.quaternion.setFromRotationMatrix(C)}setRotationFromQuaternion(C){this.quaternion.copy(C)}rotateOnAxis(C,Rn){return ef.setFromAxisAngle(C,Rn),this.quaternion.multiply(ef),this}rotateOnWorldAxis(C,Rn){return ef.setFromAxisAngle(C,Rn),this.quaternion.premultiply(ef),this}rotateX(C){return this.rotateOnAxis(of,C)}rotateY(C){return this.rotateOnAxis(lf,C)}rotateZ(C){return this.rotateOnAxis(cf,C)}translateOnAxis(C,Rn){return $m.copy(C).applyQuaternion(this.quaternion),this.position.add($m.multiplyScalar(Rn)),this}translateX(C){return this.translateOnAxis(of,C)}translateY(C){return this.translateOnAxis(lf,C)}translateZ(C){return this.translateOnAxis(cf,C)}localToWorld(C){return this.updateWorldMatrix(!0,!1),C.applyMatrix4(this.matrixWorld)}worldToLocal(C){return this.updateWorldMatrix(!0,!1),C.applyMatrix4(tf.copy(this.matrixWorld).invert())}lookAt(C,Rn,or){C.isVector3?nf.copy(C):nf.set(C,Rn,or);const So=this.parent;this.updateWorldMatrix(!0,!1),rf.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tf.lookAt(rf,nf,this.up):tf.lookAt(nf,rf,this.up),this.quaternion.setFromRotationMatrix(tf),So&&(tf.extractRotation(So.matrixWorld),ef.setFromRotationMatrix(tf),this.quaternion.premultiply(ef.invert()))}add(C){if(arguments.length>1){for(let C=0;C<arguments.length;C++)this.add(arguments[C]);return this}return C===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",C),this):(C&&C.isObject3D?(C.removeFromParent(),C.parent=this,this.children.push(C),C.dispatchEvent(uf),df.child=C,this.dispatchEvent(df),df.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",C),this)}remove(C){if(arguments.length>1){for(let C=0;C<arguments.length;C++)this.remove(arguments[C]);return this}const Rn=this.children.indexOf(C);return-1!==Rn&&(C.parent=null,this.children.splice(Rn,1),C.dispatchEvent(hf),pf.child=C,this.dispatchEvent(pf),pf.child=null),this}removeFromParent(){const C=this.parent;return null!==C&&C.remove(this),this}clear(){return this.remove(...this.children)}attach(C){return this.updateWorldMatrix(!0,!1),tf.copy(this.matrixWorld).invert(),null!==C.parent&&(C.parent.updateWorldMatrix(!0,!1),tf.multiply(C.parent.matrixWorld)),C.applyMatrix4(tf),C.removeFromParent(),C.parent=this,this.children.push(C),C.updateWorldMatrix(!1,!0),C.dispatchEvent(uf),df.child=C,this.dispatchEvent(df),df.child=null,this}getObjectById(C){return this.getObjectByProperty("id",C)}getObjectByName(C){return this.getObjectByProperty("name",C)}getObjectByProperty(C,Rn){if(this[C]===Rn)return this;for(let or=0,So=this.children.length;or<So;or++){const So=this.children[or].getObjectByProperty(C,Rn);if(void 0!==So)return So}}getObjectsByProperty(C,Rn,or){void 0===or&&(or=[]),this[C]===Rn&&or.push(this);const So=this.children;for(let To=0,Ro=So.length;To<Ro;To++)So[To].getObjectsByProperty(C,Rn,or);return or}getWorldPosition(C){return this.updateWorldMatrix(!0,!1),C.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(C){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rf,C,af),C}getWorldScale(C){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rf,sf,C),C}getWorldDirection(C){this.updateWorldMatrix(!0,!1);const Rn=this.matrixWorld.elements;return C.set(Rn[8],Rn[9],Rn[10]).normalize()}raycast(){}traverse(C){C(this);const Rn=this.children;for(let or=0,So=Rn.length;or<So;or++)Rn[or].traverse(C)}traverseVisible(C){if(!1===this.visible)return;C(this);const Rn=this.children;for(let or=0,So=Rn.length;or<So;or++)Rn[or].traverseVisible(C)}traverseAncestors(C){const Rn=this.parent;null!==Rn&&(C(Rn),Rn.traverseAncestors(C))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(C){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||C)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,C=!0);const Rn=this.children;for(let or=0,So=Rn.length;or<So;or++){Rn[or].updateMatrixWorld(C)}}updateWorldMatrix(C,Rn){const or=this.parent;if(!0===C&&null!==or&&or.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===Rn){const C=this.children;for(let Rn=0,or=C.length;Rn<or;Rn++){C[Rn].updateWorldMatrix(!1,!0)}}}toJSON(C){const Rn=void 0===C||"string"===typeof C,or={};Rn&&(C={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},or.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const So={};function serialize(Rn,or){return void 0===Rn[or.uuid]&&(Rn[or.uuid]=or.toJSON(C)),or.uuid}if(So.uuid=this.uuid,So.type=this.type,""!==this.name&&(So.name=this.name),!0===this.castShadow&&(So.castShadow=!0),!0===this.receiveShadow&&(So.receiveShadow=!0),!1===this.visible&&(So.visible=!1),!1===this.frustumCulled&&(So.frustumCulled=!1),0!==this.renderOrder&&(So.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(So.userData=this.userData),So.layers=this.layers.mask,So.matrix=this.matrix.toArray(),So.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(So.matrixAutoUpdate=!1),this.isInstancedMesh&&(So.type="InstancedMesh",So.count=this.count,So.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(So.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(So.type="BatchedMesh",So.perObjectFrustumCulled=this.perObjectFrustumCulled,So.sortObjects=this.sortObjects,So.drawRanges=this._drawRanges,So.reservedRanges=this._reservedRanges,So.visibility=this._visibility,So.active=this._active,So.bounds=this._bounds.map((C=>({boxInitialized:C.boxInitialized,boxMin:C.box.min.toArray(),boxMax:C.box.max.toArray(),sphereInitialized:C.sphereInitialized,sphereRadius:C.sphere.radius,sphereCenter:C.sphere.center.toArray()}))),So.maxInstanceCount=this._maxInstanceCount,So.maxVertexCount=this._maxVertexCount,So.maxIndexCount=this._maxIndexCount,So.geometryInitialized=this._geometryInitialized,So.geometryCount=this._geometryCount,So.matricesTexture=this._matricesTexture.toJSON(C),null!==this._colorsTexture&&(So.colorsTexture=this._colorsTexture.toJSON(C)),null!==this.boundingSphere&&(So.boundingSphere={center:So.boundingSphere.center.toArray(),radius:So.boundingSphere.radius}),null!==this.boundingBox&&(So.boundingBox={min:So.boundingBox.min.toArray(),max:So.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?So.background=this.background.toJSON():this.background.isTexture&&(So.background=this.background.toJSON(C).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(So.environment=this.environment.toJSON(C).uuid);else if(this.isMesh||this.isLine||this.isPoints){So.geometry=serialize(C.geometries,this.geometry);const Rn=this.geometry.parameters;if(void 0!==Rn&&void 0!==Rn.shapes){const or=Rn.shapes;if(Array.isArray(or))for(let Rn=0,So=or.length;Rn<So;Rn++){const So=or[Rn];serialize(C.shapes,So)}else serialize(C.shapes,or)}}if(this.isSkinnedMesh&&(So.bindMode=this.bindMode,So.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(serialize(C.skeletons,this.skeleton),So.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const Rn=[];for(let or=0,So=this.material.length;or<So;or++)Rn.push(serialize(C.materials,this.material[or]));So.material=Rn}else So.material=serialize(C.materials,this.material);if(this.children.length>0){So.children=[];for(let Rn=0;Rn<this.children.length;Rn++)So.children.push(this.children[Rn].toJSON(C).object)}if(this.animations.length>0){So.animations=[];for(let Rn=0;Rn<this.animations.length;Rn++){const or=this.animations[Rn];So.animations.push(serialize(C.animations,or))}}if(Rn){const Rn=extractFromCache(C.geometries),So=extractFromCache(C.materials),To=extractFromCache(C.textures),Ro=extractFromCache(C.images),Uo=extractFromCache(C.shapes),Oo=extractFromCache(C.skeletons),Ho=extractFromCache(C.animations),qo=extractFromCache(C.nodes);Rn.length>0&&(or.geometries=Rn),So.length>0&&(or.materials=So),To.length>0&&(or.textures=To),Ro.length>0&&(or.images=Ro),Uo.length>0&&(or.shapes=Uo),Oo.length>0&&(or.skeletons=Oo),Ho.length>0&&(or.animations=Ho),qo.length>0&&(or.nodes=qo)}return or.object=So,or;function extractFromCache(C){const Rn=[];for(const or in C){const So=C[or];delete So.metadata,Rn.push(So)}return Rn}}clone(C){return(new this.constructor).copy(this,C)}copy(C,Rn){if(void 0===Rn&&(Rn=!0),this.name=C.name,this.up.copy(C.up),this.position.copy(C.position),this.rotation.order=C.rotation.order,this.quaternion.copy(C.quaternion),this.scale.copy(C.scale),this.matrix.copy(C.matrix),this.matrixWorld.copy(C.matrixWorld),this.matrixAutoUpdate=C.matrixAutoUpdate,this.matrixWorldAutoUpdate=C.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=C.matrixWorldNeedsUpdate,this.layers.mask=C.layers.mask,this.visible=C.visible,this.castShadow=C.castShadow,this.receiveShadow=C.receiveShadow,this.frustumCulled=C.frustumCulled,this.renderOrder=C.renderOrder,this.animations=C.animations.slice(),this.userData=JSON.parse(JSON.stringify(C.userData)),!0===Rn)for(let or=0;or<C.children.length;or++){const Rn=C.children[or];this.add(Rn.clone())}return this}}Object3D.DEFAULT_UP=new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const mf=new Vector3,ff=new Vector3,gf=new Vector3,Af=new Vector3,yf=new Vector3,vf=new Vector3,xf=new Vector3,_f=new Vector3,bf=new Vector3,wf=new Vector3;class Triangle{constructor(C,Rn,or){void 0===C&&(C=new Vector3),void 0===Rn&&(Rn=new Vector3),void 0===or&&(or=new Vector3),this.a=C,this.b=Rn,this.c=or}static getNormal(C,Rn,or,So){So.subVectors(or,Rn),mf.subVectors(C,Rn),So.cross(mf);const To=So.lengthSq();return To>0?So.multiplyScalar(1/Math.sqrt(To)):So.set(0,0,0)}static getBarycoord(C,Rn,or,So,To){mf.subVectors(So,Rn),ff.subVectors(or,Rn),gf.subVectors(C,Rn);const Ro=mf.dot(mf),Uo=mf.dot(ff),Oo=mf.dot(gf),Ho=ff.dot(ff),qo=ff.dot(gf),dl=Ro*Ho-Uo*Uo;if(0===dl)return To.set(0,0,0),null;const ml=1/dl,fl=(Ho*Oo-Uo*qo)*ml,vl=(Ro*qo-Uo*Oo)*ml;return To.set(1-fl-vl,vl,fl)}static containsPoint(C,Rn,or,So){return null!==this.getBarycoord(C,Rn,or,So,Af)&&(Af.x>=0&&Af.y>=0&&Af.x+Af.y<=1)}static getInterpolation(C,Rn,or,So,To,Ro,Uo,Oo){return null===this.getBarycoord(C,Rn,or,So,Af)?(Oo.x=0,Oo.y=0,"z"in Oo&&(Oo.z=0),"w"in Oo&&(Oo.w=0),null):(Oo.setScalar(0),Oo.addScaledVector(To,Af.x),Oo.addScaledVector(Ro,Af.y),Oo.addScaledVector(Uo,Af.z),Oo)}static isFrontFacing(C,Rn,or,So){return mf.subVectors(or,Rn),ff.subVectors(C,Rn),mf.cross(ff).dot(So)<0}set(C,Rn,or){return this.a.copy(C),this.b.copy(Rn),this.c.copy(or),this}setFromPointsAndIndices(C,Rn,or,So){return this.a.copy(C[Rn]),this.b.copy(C[or]),this.c.copy(C[So]),this}setFromAttributeAndIndices(C,Rn,or,So){return this.a.fromBufferAttribute(C,Rn),this.b.fromBufferAttribute(C,or),this.c.fromBufferAttribute(C,So),this}clone(){return(new this.constructor).copy(this)}copy(C){return this.a.copy(C.a),this.b.copy(C.b),this.c.copy(C.c),this}getArea(){return mf.subVectors(this.c,this.b),ff.subVectors(this.a,this.b),.5*mf.cross(ff).length()}getMidpoint(C){return C.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(C){return Triangle.getNormal(this.a,this.b,this.c,C)}getPlane(C){return C.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(C,Rn){return Triangle.getBarycoord(C,this.a,this.b,this.c,Rn)}getInterpolation(C,Rn,or,So,To){return Triangle.getInterpolation(C,this.a,this.b,this.c,Rn,or,So,To)}containsPoint(C){return Triangle.containsPoint(C,this.a,this.b,this.c)}isFrontFacing(C){return Triangle.isFrontFacing(this.a,this.b,this.c,C)}intersectsBox(C){return C.intersectsTriangle(this)}closestPointToPoint(C,Rn){const or=this.a,So=this.b,To=this.c;let Ro,Uo;yf.subVectors(So,or),vf.subVectors(To,or),_f.subVectors(C,or);const Oo=yf.dot(_f),Ho=vf.dot(_f);if(Oo<=0&&Ho<=0)return Rn.copy(or);bf.subVectors(C,So);const qo=yf.dot(bf),dl=vf.dot(bf);if(qo>=0&&dl<=qo)return Rn.copy(So);const ml=Oo*dl-qo*Ho;if(ml<=0&&Oo>=0&&qo<=0)return Ro=Oo/(Oo-qo),Rn.copy(or).addScaledVector(yf,Ro);wf.subVectors(C,To);const fl=yf.dot(wf),vl=vf.dot(wf);if(vl>=0&&fl<=vl)return Rn.copy(To);const bl=fl*Ho-Oo*vl;if(bl<=0&&Ho>=0&&vl<=0)return Uo=Ho/(Ho-vl),Rn.copy(or).addScaledVector(vf,Uo);const kl=qo*vl-fl*dl;if(kl<=0&&dl-qo>=0&&fl-vl>=0)return xf.subVectors(To,So),Uo=(dl-qo)/(dl-qo+(fl-vl)),Rn.copy(So).addScaledVector(xf,Uo);const Ll=1/(kl+bl+ml);return Ro=bl*Ll,Uo=ml*Ll,Rn.copy(or).addScaledVector(yf,Ro).addScaledVector(vf,Uo)}equals(C){return C.a.equals(this.a)&&C.b.equals(this.b)&&C.c.equals(this.c)}}const Ef={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},Mf={h:0,s:0,l:0},Sf={h:0,s:0,l:0};function hue2rgb(C,Rn,or){return or<0&&(or+=1),or>1&&(or-=1),or<1/6?C+6*(Rn-C)*or:or<.5?Rn:or<2/3?C+6*(Rn-C)*(2/3-or):C}class Color{constructor(C,Rn,or){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(C,Rn,or)}set(C,Rn,or){if(void 0===Rn&&void 0===or){const Rn=C;Rn&&Rn.isColor?this.copy(Rn):"number"===typeof Rn?this.setHex(Rn):"string"===typeof Rn&&this.setStyle(Rn)}else this.setRGB(C,Rn,or);return this}setScalar(C){return this.r=C,this.g=C,this.b=C,this}setHex(C,Rn){return void 0===Rn&&(Rn=Np),C=Math.floor(C),this.r=(C>>16&255)/255,this.g=(C>>8&255)/255,this.b=(255&C)/255,mm.toWorkingColorSpace(this,Rn),this}setRGB(C,Rn,or,So){return void 0===So&&(So=mm.workingColorSpace),this.r=C,this.g=Rn,this.b=or,mm.toWorkingColorSpace(this,So),this}setHSL(C,Rn,or,So){if(void 0===So&&(So=mm.workingColorSpace),C=euclideanModulo(C,1),Rn=clamp(Rn,0,1),or=clamp(or,0,1),0===Rn)this.r=this.g=this.b=or;else{const So=or<=.5?or*(1+Rn):or+Rn-or*Rn,To=2*or-So;this.r=hue2rgb(To,So,C+1/3),this.g=hue2rgb(To,So,C),this.b=hue2rgb(To,So,C-1/3)}return mm.toWorkingColorSpace(this,So),this}setStyle(C,Rn){function handleAlpha(Rn){void 0!==Rn&&parseFloat(Rn)<1&&console.warn("THREE.Color: Alpha component of "+C+" will be ignored.")}let or;if(void 0===Rn&&(Rn=Np),or=/^(\w+)\(([^\)]*)\)/.exec(C)){let So;const To=or[1],Ro=or[2];switch(To){case"rgb":case"rgba":if(So=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Ro))return handleAlpha(So[4]),this.setRGB(Math.min(255,parseInt(So[1],10))/255,Math.min(255,parseInt(So[2],10))/255,Math.min(255,parseInt(So[3],10))/255,Rn);if(So=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Ro))return handleAlpha(So[4]),this.setRGB(Math.min(100,parseInt(So[1],10))/100,Math.min(100,parseInt(So[2],10))/100,Math.min(100,parseInt(So[3],10))/100,Rn);break;case"hsl":case"hsla":if(So=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(Ro))return handleAlpha(So[4]),this.setHSL(parseFloat(So[1])/360,parseFloat(So[2])/100,parseFloat(So[3])/100,Rn);break;default:console.warn("THREE.Color: Unknown color model "+C)}}else if(or=/^\#([A-Fa-f\d]+)$/.exec(C)){const So=or[1],To=So.length;if(3===To)return this.setRGB(parseInt(So.charAt(0),16)/15,parseInt(So.charAt(1),16)/15,parseInt(So.charAt(2),16)/15,Rn);if(6===To)return this.setHex(parseInt(So,16),Rn);console.warn("THREE.Color: Invalid hex color "+C)}else if(C&&C.length>0)return this.setColorName(C,Rn);return this}setColorName(C,Rn){void 0===Rn&&(Rn=Np);const or=Ef[C.toLowerCase()];return void 0!==or?this.setHex(or,Rn):console.warn("THREE.Color: Unknown color "+C),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(C){return this.r=C.r,this.g=C.g,this.b=C.b,this}copySRGBToLinear(C){return this.r=SRGBToLinear(C.r),this.g=SRGBToLinear(C.g),this.b=SRGBToLinear(C.b),this}copyLinearToSRGB(C){return this.r=LinearToSRGB(C.r),this.g=LinearToSRGB(C.g),this.b=LinearToSRGB(C.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(C){return void 0===C&&(C=Np),mm.fromWorkingColorSpace(kf.copy(this),C),65536*Math.round(clamp(255*kf.r,0,255))+256*Math.round(clamp(255*kf.g,0,255))+Math.round(clamp(255*kf.b,0,255))}getHexString(C){return void 0===C&&(C=Np),("000000"+this.getHex(C).toString(16)).slice(-6)}getHSL(C,Rn){void 0===Rn&&(Rn=mm.workingColorSpace),mm.fromWorkingColorSpace(kf.copy(this),Rn);const or=kf.r,So=kf.g,To=kf.b,Ro=Math.max(or,So,To),Uo=Math.min(or,So,To);let Oo,Ho;const qo=(Uo+Ro)/2;if(Uo===Ro)Oo=0,Ho=0;else{const C=Ro-Uo;switch(Ho=qo<=.5?C/(Ro+Uo):C/(2-Ro-Uo),Ro){case or:Oo=(So-To)/C+(So<To?6:0);break;case So:Oo=(To-or)/C+2;break;case To:Oo=(or-So)/C+4}Oo/=6}return C.h=Oo,C.s=Ho,C.l=qo,C}getRGB(C,Rn){return void 0===Rn&&(Rn=mm.workingColorSpace),mm.fromWorkingColorSpace(kf.copy(this),Rn),C.r=kf.r,C.g=kf.g,C.b=kf.b,C}getStyle(C){void 0===C&&(C=Np),mm.fromWorkingColorSpace(kf.copy(this),C);const Rn=kf.r,or=kf.g,So=kf.b;return C!==Np?"color("+C+" "+Rn.toFixed(3)+" "+or.toFixed(3)+" "+So.toFixed(3)+")":"rgb("+Math.round(255*Rn)+","+Math.round(255*or)+","+Math.round(255*So)+")"}offsetHSL(C,Rn,or){return this.getHSL(Mf),this.setHSL(Mf.h+C,Mf.s+Rn,Mf.l+or)}add(C){return this.r+=C.r,this.g+=C.g,this.b+=C.b,this}addColors(C,Rn){return this.r=C.r+Rn.r,this.g=C.g+Rn.g,this.b=C.b+Rn.b,this}addScalar(C){return this.r+=C,this.g+=C,this.b+=C,this}sub(C){return this.r=Math.max(0,this.r-C.r),this.g=Math.max(0,this.g-C.g),this.b=Math.max(0,this.b-C.b),this}multiply(C){return this.r*=C.r,this.g*=C.g,this.b*=C.b,this}multiplyScalar(C){return this.r*=C,this.g*=C,this.b*=C,this}lerp(C,Rn){return this.r+=(C.r-this.r)*Rn,this.g+=(C.g-this.g)*Rn,this.b+=(C.b-this.b)*Rn,this}lerpColors(C,Rn,or){return this.r=C.r+(Rn.r-C.r)*or,this.g=C.g+(Rn.g-C.g)*or,this.b=C.b+(Rn.b-C.b)*or,this}lerpHSL(C,Rn){this.getHSL(Mf),C.getHSL(Sf);const or=lerp(Mf.h,Sf.h,Rn),So=lerp(Mf.s,Sf.s,Rn),To=lerp(Mf.l,Sf.l,Rn);return this.setHSL(or,So,To),this}setFromVector3(C){return this.r=C.x,this.g=C.y,this.b=C.z,this}applyMatrix3(C){const Rn=this.r,or=this.g,So=this.b,To=C.elements;return this.r=To[0]*Rn+To[3]*or+To[6]*So,this.g=To[1]*Rn+To[4]*or+To[7]*So,this.b=To[2]*Rn+To[5]*or+To[8]*So,this}equals(C){return C.r===this.r&&C.g===this.g&&C.b===this.b}fromArray(C,Rn){return void 0===Rn&&(Rn=0),this.r=C[Rn],this.g=C[Rn+1],this.b=C[Rn+2],this}toArray(C,Rn){return void 0===C&&(C=[]),void 0===Rn&&(Rn=0),C[Rn]=this.r,C[Rn+1]=this.g,C[Rn+2]=this.b,C}fromBufferAttribute(C,Rn){return this.r=C.getX(Rn),this.g=C.getY(Rn),this.b=C.getZ(Rn),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const kf=new Color;Color.NAMES=Ef;let Tf=0;class Material extends EventDispatcher{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Tf++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=bl,this.side=dl,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Dh,this.blendDst=Rh,this.blendEquation=jc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Color(0,0,0),this.blendAlpha=0,this.depthFunc=Kh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Hp,this.stencilZFail=Hp,this.stencilZPass=Hp,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(C){this._alphaTest>0!==C>0&&this.version++,this._alphaTest=C}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(C){if(void 0!==C)for(const Rn in C){const or=C[Rn];if(void 0===or){console.warn("THREE.Material: parameter '"+Rn+"' has value of undefined.");continue}const So=this[Rn];void 0!==So?So&&So.isColor?So.set(or):So&&So.isVector3&&or&&or.isVector3?So.copy(or):this[Rn]=or:console.warn("THREE.Material: '"+Rn+"' is not a property of THREE."+this.type+".")}}toJSON(C){const Rn=void 0===C||"string"===typeof C;Rn&&(C={textures:{},images:{}});const or={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function extractFromCache(C){const Rn=[];for(const or in C){const So=C[or];delete So.metadata,Rn.push(So)}return Rn}if(or.uuid=this.uuid,or.type=this.type,""!==this.name&&(or.name=this.name),this.color&&this.color.isColor&&(or.color=this.color.getHex()),void 0!==this.roughness&&(or.roughness=this.roughness),void 0!==this.metalness&&(or.metalness=this.metalness),void 0!==this.sheen&&(or.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(or.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(or.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(or.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(or.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(or.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(or.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(or.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(or.shininess=this.shininess),void 0!==this.clearcoat&&(or.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(or.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(or.clearcoatMap=this.clearcoatMap.toJSON(C).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(or.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(C).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(or.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(C).uuid,or.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(or.dispersion=this.dispersion),void 0!==this.iridescence&&(or.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(or.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(or.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(or.iridescenceMap=this.iridescenceMap.toJSON(C).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(or.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(C).uuid),void 0!==this.anisotropy&&(or.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(or.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(or.anisotropyMap=this.anisotropyMap.toJSON(C).uuid),this.map&&this.map.isTexture&&(or.map=this.map.toJSON(C).uuid),this.matcap&&this.matcap.isTexture&&(or.matcap=this.matcap.toJSON(C).uuid),this.alphaMap&&this.alphaMap.isTexture&&(or.alphaMap=this.alphaMap.toJSON(C).uuid),this.lightMap&&this.lightMap.isTexture&&(or.lightMap=this.lightMap.toJSON(C).uuid,or.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(or.aoMap=this.aoMap.toJSON(C).uuid,or.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(or.bumpMap=this.bumpMap.toJSON(C).uuid,or.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(or.normalMap=this.normalMap.toJSON(C).uuid,or.normalMapType=this.normalMapType,or.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(or.displacementMap=this.displacementMap.toJSON(C).uuid,or.displacementScale=this.displacementScale,or.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(or.roughnessMap=this.roughnessMap.toJSON(C).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(or.metalnessMap=this.metalnessMap.toJSON(C).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(or.emissiveMap=this.emissiveMap.toJSON(C).uuid),this.specularMap&&this.specularMap.isTexture&&(or.specularMap=this.specularMap.toJSON(C).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(or.specularIntensityMap=this.specularIntensityMap.toJSON(C).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(or.specularColorMap=this.specularColorMap.toJSON(C).uuid),this.envMap&&this.envMap.isTexture&&(or.envMap=this.envMap.toJSON(C).uuid,void 0!==this.combine&&(or.combine=this.combine)),void 0!==this.envMapRotation&&(or.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(or.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(or.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(or.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(or.gradientMap=this.gradientMap.toJSON(C).uuid),void 0!==this.transmission&&(or.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(or.transmissionMap=this.transmissionMap.toJSON(C).uuid),void 0!==this.thickness&&(or.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(or.thicknessMap=this.thicknessMap.toJSON(C).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(or.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(or.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(or.size=this.size),null!==this.shadowSide&&(or.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(or.sizeAttenuation=this.sizeAttenuation),this.blending!==bl&&(or.blending=this.blending),this.side!==dl&&(or.side=this.side),!0===this.vertexColors&&(or.vertexColors=!0),this.opacity<1&&(or.opacity=this.opacity),!0===this.transparent&&(or.transparent=!0),this.blendSrc!==Dh&&(or.blendSrc=this.blendSrc),this.blendDst!==Rh&&(or.blendDst=this.blendDst),this.blendEquation!==jc&&(or.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(or.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(or.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(or.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(or.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(or.blendAlpha=this.blendAlpha),this.depthFunc!==Kh&&(or.depthFunc=this.depthFunc),!1===this.depthTest&&(or.depthTest=this.depthTest),!1===this.depthWrite&&(or.depthWrite=this.depthWrite),!1===this.colorWrite&&(or.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(or.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(or.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(or.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(or.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Hp&&(or.stencilFail=this.stencilFail),this.stencilZFail!==Hp&&(or.stencilZFail=this.stencilZFail),this.stencilZPass!==Hp&&(or.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(or.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(or.rotation=this.rotation),!0===this.polygonOffset&&(or.polygonOffset=!0),0!==this.polygonOffsetFactor&&(or.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(or.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(or.linewidth=this.linewidth),void 0!==this.dashSize&&(or.dashSize=this.dashSize),void 0!==this.gapSize&&(or.gapSize=this.gapSize),void 0!==this.scale&&(or.scale=this.scale),!0===this.dithering&&(or.dithering=!0),this.alphaTest>0&&(or.alphaTest=this.alphaTest),!0===this.alphaHash&&(or.alphaHash=!0),!0===this.alphaToCoverage&&(or.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(or.premultipliedAlpha=!0),!0===this.forceSinglePass&&(or.forceSinglePass=!0),!0===this.wireframe&&(or.wireframe=!0),this.wireframeLinewidth>1&&(or.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(or.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(or.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(or.flatShading=!0),!1===this.visible&&(or.visible=!1),!1===this.toneMapped&&(or.toneMapped=!1),!1===this.fog&&(or.fog=!1),Object.keys(this.userData).length>0&&(or.userData=this.userData),Rn){const Rn=extractFromCache(C.textures),So=extractFromCache(C.images);Rn.length>0&&(or.textures=Rn),So.length>0&&(or.images=So)}return or}clone(){return(new this.constructor).copy(this)}copy(C){this.name=C.name,this.blending=C.blending,this.side=C.side,this.vertexColors=C.vertexColors,this.opacity=C.opacity,this.transparent=C.transparent,this.blendSrc=C.blendSrc,this.blendDst=C.blendDst,this.blendEquation=C.blendEquation,this.blendSrcAlpha=C.blendSrcAlpha,this.blendDstAlpha=C.blendDstAlpha,this.blendEquationAlpha=C.blendEquationAlpha,this.blendColor.copy(C.blendColor),this.blendAlpha=C.blendAlpha,this.depthFunc=C.depthFunc,this.depthTest=C.depthTest,this.depthWrite=C.depthWrite,this.stencilWriteMask=C.stencilWriteMask,this.stencilFunc=C.stencilFunc,this.stencilRef=C.stencilRef,this.stencilFuncMask=C.stencilFuncMask,this.stencilFail=C.stencilFail,this.stencilZFail=C.stencilZFail,this.stencilZPass=C.stencilZPass,this.stencilWrite=C.stencilWrite;const Rn=C.clippingPlanes;let or=null;if(null!==Rn){const C=Rn.length;or=new Array(C);for(let So=0;So!==C;++So)or[So]=Rn[So].clone()}return this.clippingPlanes=or,this.clipIntersection=C.clipIntersection,this.clipShadows=C.clipShadows,this.shadowSide=C.shadowSide,this.colorWrite=C.colorWrite,this.precision=C.precision,this.polygonOffset=C.polygonOffset,this.polygonOffsetFactor=C.polygonOffsetFactor,this.polygonOffsetUnits=C.polygonOffsetUnits,this.dithering=C.dithering,this.alphaTest=C.alphaTest,this.alphaHash=C.alphaHash,this.alphaToCoverage=C.alphaToCoverage,this.premultipliedAlpha=C.premultipliedAlpha,this.forceSinglePass=C.forceSinglePass,this.visible=C.visible,this.toneMapped=C.toneMapped,this.userData=JSON.parse(JSON.stringify(C.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(C){!0===C&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class MeshBasicMaterial extends Material{constructor(C){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Euler,this.combine=$h,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(C)}copy(C){return super.copy(C),this.color.copy(C.color),this.map=C.map,this.lightMap=C.lightMap,this.lightMapIntensity=C.lightMapIntensity,this.aoMap=C.aoMap,this.aoMapIntensity=C.aoMapIntensity,this.specularMap=C.specularMap,this.alphaMap=C.alphaMap,this.envMap=C.envMap,this.envMapRotation.copy(C.envMapRotation),this.combine=C.combine,this.reflectivity=C.reflectivity,this.refractionRatio=C.refractionRatio,this.wireframe=C.wireframe,this.wireframeLinewidth=C.wireframeLinewidth,this.wireframeLinecap=C.wireframeLinecap,this.wireframeLinejoin=C.wireframeLinejoin,this.fog=C.fog,this}}const If=new Vector3,Cf=new Vector2;class BufferAttribute{constructor(C,Rn,or){if(void 0===or&&(or=!1),Array.isArray(C))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=C,this.itemSize=Rn,this.count=void 0!==C?C.length/Rn:0,this.normalized=or,this.usage=$p,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Cd,this.version=0}onUploadCallback(){}set needsUpdate(C){!0===C&&this.version++}get updateRange(){return warnOnce("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(C){return this.usage=C,this}addUpdateRange(C,Rn){this.updateRanges.push({start:C,count:Rn})}clearUpdateRanges(){this.updateRanges.length=0}copy(C){return this.name=C.name,this.array=new C.array.constructor(C.array),this.itemSize=C.itemSize,this.count=C.count,this.normalized=C.normalized,this.usage=C.usage,this.gpuType=C.gpuType,this}copyAt(C,Rn,or){C*=this.itemSize,or*=Rn.itemSize;for(let So=0,To=this.itemSize;So<To;So++)this.array[C+So]=Rn.array[or+So];return this}copyArray(C){return this.array.set(C),this}applyMatrix3(C){if(2===this.itemSize)for(let Rn=0,or=this.count;Rn<or;Rn++)Cf.fromBufferAttribute(this,Rn),Cf.applyMatrix3(C),this.setXY(Rn,Cf.x,Cf.y);else if(3===this.itemSize)for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.applyMatrix3(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}applyMatrix4(C){for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.applyMatrix4(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}applyNormalMatrix(C){for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.applyNormalMatrix(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}transformDirection(C){for(let Rn=0,or=this.count;Rn<or;Rn++)If.fromBufferAttribute(this,Rn),If.transformDirection(C),this.setXYZ(Rn,If.x,If.y,If.z);return this}set(C,Rn){return void 0===Rn&&(Rn=0),this.array.set(C,Rn),this}getComponent(C,Rn){let or=this.array[C*this.itemSize+Rn];return this.normalized&&(or=denormalize(or,this.array)),or}setComponent(C,Rn,or){return this.normalized&&(or=normalize(or,this.array)),this.array[C*this.itemSize+Rn]=or,this}getX(C){let Rn=this.array[C*this.itemSize];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setX(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize]=Rn,this}getY(C){let Rn=this.array[C*this.itemSize+1];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setY(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize+1]=Rn,this}getZ(C){let Rn=this.array[C*this.itemSize+2];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setZ(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize+2]=Rn,this}getW(C){let Rn=this.array[C*this.itemSize+3];return this.normalized&&(Rn=denormalize(Rn,this.array)),Rn}setW(C,Rn){return this.normalized&&(Rn=normalize(Rn,this.array)),this.array[C*this.itemSize+3]=Rn,this}setXY(C,Rn,or){return C*=this.itemSize,this.normalized&&(Rn=normalize(Rn,this.array),or=normalize(or,this.array)),this.array[C+0]=Rn,this.array[C+1]=or,this}setXYZ(C,Rn,or,So){return C*=this.itemSize,this.normalized&&(Rn=normalize(Rn,this.array),or=normalize(or,this.array),So=normalize(So,this.array)),this.array[C+0]=Rn,this.array[C+1]=or,this.array[C+2]=So,this}setXYZW(C,Rn,or,So,To){return C*=this.itemSize,this.normalized&&(Rn=normalize(Rn,this.array),or=normalize(or,this.array),So=normalize(So,this.array),To=normalize(To,this.array)),this.array[C+0]=Rn,this.array[C+1]=or,this.array[C+2]=So,this.array[C+3]=To,this}onUpload(C){return this.onUploadCallback=C,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const C={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(C.name=this.name),this.usage!==$p&&(C.usage=this.usage),C}}class Uint16BufferAttribute extends BufferAttribute{constructor(C,Rn,or){super(new Uint16Array(C),Rn,or)}}class Uint32BufferAttribute extends BufferAttribute{constructor(C,Rn,or){super(new Uint32Array(C),Rn,or)}}class Float32BufferAttribute extends BufferAttribute{constructor(C,Rn,or){super(new Float32Array(C),Rn,or)}}let Lf=0;const Pf=new Matrix4,zf=new Object3D,Df=new Vector3,Rf=new Box3,Nf=new Box3,Uf=new Vector3;class BufferGeometry extends EventDispatcher{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Lf++}),this.uuid=generateUUID(),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(C){return Array.isArray(C)?this.index=new(arrayNeedsUint32(C)?Uint32BufferAttribute:Uint16BufferAttribute)(C,1):this.index=C,this}getAttribute(C){return this.attributes[C]}setAttribute(C,Rn){return this.attributes[C]=Rn,this}deleteAttribute(C){return delete this.attributes[C],this}hasAttribute(C){return void 0!==this.attributes[C]}addGroup(C,Rn,or){void 0===or&&(or=0),this.groups.push({start:C,count:Rn,materialIndex:or})}clearGroups(){this.groups=[]}setDrawRange(C,Rn){this.drawRange.start=C,this.drawRange.count=Rn}applyMatrix4(C){const Rn=this.attributes.position;void 0!==Rn&&(Rn.applyMatrix4(C),Rn.needsUpdate=!0);const or=this.attributes.normal;if(void 0!==or){const Rn=(new Matrix3).getNormalMatrix(C);or.applyNormalMatrix(Rn),or.needsUpdate=!0}const So=this.attributes.tangent;return void 0!==So&&(So.transformDirection(C),So.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(C){return Pf.makeRotationFromQuaternion(C),this.applyMatrix4(Pf),this}rotateX(C){return Pf.makeRotationX(C),this.applyMatrix4(Pf),this}rotateY(C){return Pf.makeRotationY(C),this.applyMatrix4(Pf),this}rotateZ(C){return Pf.makeRotationZ(C),this.applyMatrix4(Pf),this}translate(C,Rn,or){return Pf.makeTranslation(C,Rn,or),this.applyMatrix4(Pf),this}scale(C,Rn,or){return Pf.makeScale(C,Rn,or),this.applyMatrix4(Pf),this}lookAt(C){return zf.lookAt(C),zf.updateMatrix(),this.applyMatrix4(zf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Df).negate(),this.translate(Df.x,Df.y,Df.z),this}setFromPoints(C){const Rn=[];for(let or=0,So=C.length;or<So;or++){const So=C[or];Rn.push(So.x,So.y,So.z||0)}return this.setAttribute("position",new Float32BufferAttribute(Rn,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);const C=this.attributes.position,Rn=this.morphAttributes.position;if(C&&C.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3(1/0,1/0,1/0));if(void 0!==C){if(this.boundingBox.setFromBufferAttribute(C),Rn)for(let or=0,So=Rn.length;or<So;or++){const C=Rn[or];Rf.setFromBufferAttribute(C),this.morphTargetsRelative?(Uf.addVectors(this.boundingBox.min,Rf.min),this.boundingBox.expandByPoint(Uf),Uf.addVectors(this.boundingBox.max,Rf.max),this.boundingBox.expandByPoint(Uf)):(this.boundingBox.expandByPoint(Rf.min),this.boundingBox.expandByPoint(Rf.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 Sphere);const C=this.attributes.position,Rn=this.morphAttributes.position;if(C&&C.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Vector3,1/0);if(C){const or=this.boundingSphere.center;if(Rf.setFromBufferAttribute(C),Rn)for(let C=0,To=Rn.length;C<To;C++){const or=Rn[C];Nf.setFromBufferAttribute(or),this.morphTargetsRelative?(Uf.addVectors(Rf.min,Nf.min),Rf.expandByPoint(Uf),Uf.addVectors(Rf.max,Nf.max),Rf.expandByPoint(Uf)):(Rf.expandByPoint(Nf.min),Rf.expandByPoint(Nf.max))}Rf.getCenter(or);let So=0;for(let Rn=0,To=C.count;Rn<To;Rn++)Uf.fromBufferAttribute(C,Rn),So=Math.max(So,or.distanceToSquared(Uf));if(Rn)for(let To=0,Ro=Rn.length;To<Ro;To++){const Ro=Rn[To],Uo=this.morphTargetsRelative;for(let Rn=0,To=Ro.count;Rn<To;Rn++)Uf.fromBufferAttribute(Ro,Rn),Uo&&(Df.fromBufferAttribute(C,Rn),Uf.add(Df)),So=Math.max(So,or.distanceToSquared(Uf))}this.boundingSphere.radius=Math.sqrt(So),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 C=this.index,Rn=this.attributes;if(null===C||void 0===Rn.position||void 0===Rn.normal||void 0===Rn.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const or=Rn.position,So=Rn.normal,To=Rn.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new BufferAttribute(new Float32Array(4*or.count),4));const Ro=this.getAttribute("tangent"),Uo=[],Oo=[];for(let eu=0;eu<or.count;eu++)Uo[eu]=new Vector3,Oo[eu]=new Vector3;const Ho=new Vector3,qo=new Vector3,dl=new Vector3,ml=new Vector2,fl=new Vector2,vl=new Vector2,bl=new Vector3,kl=new Vector3;function handleTriangle(C,Rn,So){Ho.fromBufferAttribute(or,C),qo.fromBufferAttribute(or,Rn),dl.fromBufferAttribute(or,So),ml.fromBufferAttribute(To,C),fl.fromBufferAttribute(To,Rn),vl.fromBufferAttribute(To,So),qo.sub(Ho),dl.sub(Ho),fl.sub(ml),vl.sub(ml);const Ro=1/(fl.x*vl.y-vl.x*fl.y);isFinite(Ro)&&(bl.copy(qo).multiplyScalar(vl.y).addScaledVector(dl,-fl.y).multiplyScalar(Ro),kl.copy(dl).multiplyScalar(fl.x).addScaledVector(qo,-vl.x).multiplyScalar(Ro),Uo[C].add(bl),Uo[Rn].add(bl),Uo[So].add(bl),Oo[C].add(kl),Oo[Rn].add(kl),Oo[So].add(kl))}let Ll=this.groups;0===Ll.length&&(Ll=[{start:0,count:C.count}]);for(let eu=0,Ku=Ll.length;eu<Ku;++eu){const Rn=Ll[eu],or=Rn.start;for(let So=or,To=or+Rn.count;So<To;So+=3)handleTriangle(C.getX(So+0),C.getX(So+1),C.getX(So+2))}const Dl=new Vector3,Nc=new Vector3,jc=new Vector3,Zc=new Vector3;function handleVertex(C){jc.fromBufferAttribute(So,C),Zc.copy(jc);const Rn=Uo[C];Dl.copy(Rn),Dl.sub(jc.multiplyScalar(jc.dot(Rn))).normalize(),Nc.crossVectors(Zc,Rn);const or=Nc.dot(Oo[C])<0?-1:1;Ro.setXYZW(C,Dl.x,Dl.y,Dl.z,or)}for(let eu=0,Ku=Ll.length;eu<Ku;++eu){const Rn=Ll[eu],or=Rn.start;for(let So=or,To=or+Rn.count;So<To;So+=3)handleVertex(C.getX(So+0)),handleVertex(C.getX(So+1)),handleVertex(C.getX(So+2))}}computeVertexNormals(){const C=this.index,Rn=this.getAttribute("position");if(void 0!==Rn){let or=this.getAttribute("normal");if(void 0===or)or=new BufferAttribute(new Float32Array(3*Rn.count),3),this.setAttribute("normal",or);else for(let C=0,Rn=or.count;C<Rn;C++)or.setXYZ(C,0,0,0);const So=new Vector3,To=new Vector3,Ro=new Vector3,Uo=new Vector3,Oo=new Vector3,Ho=new Vector3,qo=new Vector3,dl=new Vector3;if(C)for(let ml=0,fl=C.count;ml<fl;ml+=3){const fl=C.getX(ml+0),vl=C.getX(ml+1),bl=C.getX(ml+2);So.fromBufferAttribute(Rn,fl),To.fromBufferAttribute(Rn,vl),Ro.fromBufferAttribute(Rn,bl),qo.subVectors(Ro,To),dl.subVectors(So,To),qo.cross(dl),Uo.fromBufferAttribute(or,fl),Oo.fromBufferAttribute(or,vl),Ho.fromBufferAttribute(or,bl),Uo.add(qo),Oo.add(qo),Ho.add(qo),or.setXYZ(fl,Uo.x,Uo.y,Uo.z),or.setXYZ(vl,Oo.x,Oo.y,Oo.z),or.setXYZ(bl,Ho.x,Ho.y,Ho.z)}else for(let C=0,ml=Rn.count;C<ml;C+=3)So.fromBufferAttribute(Rn,C+0),To.fromBufferAttribute(Rn,C+1),Ro.fromBufferAttribute(Rn,C+2),qo.subVectors(Ro,To),dl.subVectors(So,To),qo.cross(dl),or.setXYZ(C+0,qo.x,qo.y,qo.z),or.setXYZ(C+1,qo.x,qo.y,qo.z),or.setXYZ(C+2,qo.x,qo.y,qo.z);this.normalizeNormals(),or.needsUpdate=!0}}normalizeNormals(){const C=this.attributes.normal;for(let Rn=0,or=C.count;Rn<or;Rn++)Uf.fromBufferAttribute(C,Rn),Uf.normalize(),C.setXYZ(Rn,Uf.x,Uf.y,Uf.z)}toNonIndexed(){function convertBufferAttribute(C,Rn){const or=C.array,So=C.itemSize,To=C.normalized,Ro=new or.constructor(Rn.length*So);let Uo=0,Oo=0;for(let Ho=0,qo=Rn.length;Ho<qo;Ho++){Uo=C.isInterleavedBufferAttribute?Rn[Ho]*C.data.stride+C.offset:Rn[Ho]*So;for(let C=0;C<So;C++)Ro[Oo++]=or[Uo++]}return new BufferAttribute(Ro,So,To)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const C=new BufferGeometry,Rn=this.index.array,or=this.attributes;for(const Ro in or){const So=convertBufferAttribute(or[Ro],Rn);C.setAttribute(Ro,So)}const So=this.morphAttributes;for(const Ro in So){const or=[],To=So[Ro];for(let C=0,So=To.length;C<So;C++){const So=convertBufferAttribute(To[C],Rn);or.push(So)}C.morphAttributes[Ro]=or}C.morphTargetsRelative=this.morphTargetsRelative;const To=this.groups;for(let Ro=0,Uo=To.length;Ro<Uo;Ro++){const Rn=To[Ro];C.addGroup(Rn.start,Rn.count,Rn.materialIndex)}return C}toJSON(){const C={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(C.uuid=this.uuid,C.type=this.type,""!==this.name&&(C.name=this.name),Object.keys(this.userData).length>0&&(C.userData=this.userData),void 0!==this.parameters){const Rn=this.parameters;for(const or in Rn)void 0!==Rn[or]&&(C[or]=Rn[or]);return C}C.data={attributes:{}};const Rn=this.index;null!==Rn&&(C.data.index={type:Rn.array.constructor.name,array:Array.prototype.slice.call(Rn.array)});const or=this.attributes;for(const Oo in or){const Rn=or[Oo];C.data.attributes[Oo]=Rn.toJSON(C.data)}const So={};let To=!1;for(const Oo in this.morphAttributes){const Rn=this.morphAttributes[Oo],or=[];for(let So=0,To=Rn.length;So<To;So++){const To=Rn[So];or.push(To.toJSON(C.data))}or.length>0&&(So[Oo]=or,To=!0)}To&&(C.data.morphAttributes=So,C.data.morphTargetsRelative=this.morphTargetsRelative);const Ro=this.groups;Ro.length>0&&(C.data.groups=JSON.parse(JSON.stringify(Ro)));const Uo=this.boundingSphere;return null!==Uo&&(C.data.boundingSphere={center:Uo.center.toArray(),radius:Uo.radius}),C}clone(){return(new this.constructor).copy(this)}copy(C){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const Rn={};this.name=C.name;const or=C.index;null!==or&&this.setIndex(or.clone(Rn));const So=C.attributes;for(const Ho in So){const C=So[Ho];this.setAttribute(Ho,C.clone(Rn))}const To=C.morphAttributes;for(const Ho in To){const C=[],or=To[Ho];for(let So=0,To=or.length;So<To;So++)C.push(or[So].clone(Rn));this.morphAttributes[Ho]=C}this.morphTargetsRelative=C.morphTargetsRelative;const Ro=C.groups;for(let Ho=0,qo=Ro.length;Ho<qo;Ho++){const C=Ro[Ho];this.addGroup(C.start,C.count,C.materialIndex)}const Uo=C.boundingBox;null!==Uo&&(this.boundingBox=Uo.clone());const Oo=C.boundingSphere;return null!==Oo&&(this.boundingSphere=Oo.clone()),this.drawRange.start=C.drawRange.start,this.drawRange.count=C.drawRange.count,this.userData=C.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Bf=new Matrix4,Ff=new Ray,Of=new Sphere,Vf=new Vector3,jf=new Vector3,Gf=new Vector3,Hf=new Vector3,Zf=new Vector3,Wf=new Vector3,qf=new Vector2,Kf=new Vector2,Qf=new Vector2,Xf=new Vector3,Yf=new Vector3,Jf=new Vector3,$f=new Vector3,eg=new Vector3;class Mesh extends Object3D{constructor(C,Rn){void 0===C&&(C=new BufferGeometry),void 0===Rn&&(Rn=new MeshBasicMaterial),super(),this.isMesh=!0,this.type="Mesh",this.geometry=C,this.material=Rn,this.updateMorphTargets()}copy(C,Rn){return super.copy(C,Rn),void 0!==C.morphTargetInfluences&&(this.morphTargetInfluences=C.morphTargetInfluences.slice()),void 0!==C.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},C.morphTargetDictionary)),this.material=Array.isArray(C.material)?C.material.slice():C.material,this.geometry=C.geometry,this}updateMorphTargets(){const C=this.geometry.morphAttributes,Rn=Object.keys(C);if(Rn.length>0){const or=C[Rn[0]];if(void 0!==or){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let C=0,Rn=or.length;C<Rn;C++){const Rn=or[C].name||String(C);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Rn]=C}}}}getVertexPosition(C,Rn){const or=this.geometry,So=or.attributes.position,To=or.morphAttributes.position,Ro=or.morphTargetsRelative;Rn.fromBufferAttribute(So,C);const Uo=this.morphTargetInfluences;if(To&&Uo){Wf.set(0,0,0);for(let or=0,So=To.length;or<So;or++){const So=Uo[or],Oo=To[or];0!==So&&(Zf.fromBufferAttribute(Oo,C),Ro?Wf.addScaledVector(Zf,So):Wf.addScaledVector(Zf.sub(Rn),So))}Rn.add(Wf)}return Rn}raycast(C,Rn){const or=this.geometry,So=this.material,To=this.matrixWorld;if(void 0!==So){if(null===or.boundingSphere&&or.computeBoundingSphere(),Of.copy(or.boundingSphere),Of.applyMatrix4(To),Ff.copy(C.ray).recast(C.near),!1===Of.containsPoint(Ff.origin)){if(null===Ff.intersectSphere(Of,Vf))return;if(Ff.origin.distanceToSquared(Vf)>(C.far-C.near)**2)return}Bf.copy(To).invert(),Ff.copy(C.ray).applyMatrix4(Bf),null!==or.boundingBox&&!1===Ff.intersectsBox(or.boundingBox)||this._computeIntersections(C,Rn,Ff)}}_computeIntersections(C,Rn,or){let So;const To=this.geometry,Ro=this.material,Uo=To.index,Oo=To.attributes.position,Ho=To.attributes.uv,qo=To.attributes.uv1,dl=To.attributes.normal,ml=To.groups,fl=To.drawRange;if(null!==Uo)if(Array.isArray(Ro))for(let vl=0,bl=ml.length;vl<bl;vl++){const To=ml[vl],Oo=Ro[To.materialIndex];for(let Ro=Math.max(To.start,fl.start),ml=Math.min(Uo.count,Math.min(To.start+To.count,fl.start+fl.count));Ro<ml;Ro+=3){So=checkGeometryIntersection(this,Oo,C,or,Ho,qo,dl,Uo.getX(Ro),Uo.getX(Ro+1),Uo.getX(Ro+2)),So&&(So.faceIndex=Math.floor(Ro/3),So.face.materialIndex=To.materialIndex,Rn.push(So))}}else{for(let To=Math.max(0,fl.start),Oo=Math.min(Uo.count,fl.start+fl.count);To<Oo;To+=3){So=checkGeometryIntersection(this,Ro,C,or,Ho,qo,dl,Uo.getX(To),Uo.getX(To+1),Uo.getX(To+2)),So&&(So.faceIndex=Math.floor(To/3),Rn.push(So))}}else if(void 0!==Oo)if(Array.isArray(Ro))for(let vl=0,bl=ml.length;vl<bl;vl++){const To=ml[vl],Uo=Ro[To.materialIndex];for(let Ro=Math.max(To.start,fl.start),ml=Math.min(Oo.count,Math.min(To.start+To.count,fl.start+fl.count));Ro<ml;Ro+=3){So=checkGeometryIntersection(this,Uo,C,or,Ho,qo,dl,Ro,Ro+1,Ro+2),So&&(So.faceIndex=Math.floor(Ro/3),So.face.materialIndex=To.materialIndex,Rn.push(So))}}else{for(let To=Math.max(0,fl.start),Uo=Math.min(Oo.count,fl.start+fl.count);To<Uo;To+=3){So=checkGeometryIntersection(this,Ro,C,or,Ho,qo,dl,To,To+1,To+2),So&&(So.faceIndex=Math.floor(To/3),Rn.push(So))}}}}function checkGeometryIntersection(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){C.getVertexPosition(Oo,jf),C.getVertexPosition(Ho,Gf),C.getVertexPosition(qo,Hf);const fl=function(C,Rn,or,So,To,Ro,Uo,Oo){let Ho;if(Ho=Rn.side===ml?So.intersectTriangle(Uo,Ro,To,!0,Oo):So.intersectTriangle(To,Ro,Uo,Rn.side===dl,Oo),null===Ho)return null;eg.copy(Oo),eg.applyMatrix4(C.matrixWorld);const qo=or.ray.origin.distanceTo(eg);return qo<or.near||qo>or.far?null:{distance:qo,point:eg.clone(),object:C}}(C,Rn,or,So,jf,Gf,Hf,$f);if(fl){To&&(qf.fromBufferAttribute(To,Oo),Kf.fromBufferAttribute(To,Ho),Qf.fromBufferAttribute(To,qo),fl.uv=Triangle.getInterpolation($f,jf,Gf,Hf,qf,Kf,Qf,new Vector2)),Ro&&(qf.fromBufferAttribute(Ro,Oo),Kf.fromBufferAttribute(Ro,Ho),Qf.fromBufferAttribute(Ro,qo),fl.uv1=Triangle.getInterpolation($f,jf,Gf,Hf,qf,Kf,Qf,new Vector2)),Uo&&(Xf.fromBufferAttribute(Uo,Oo),Yf.fromBufferAttribute(Uo,Ho),Jf.fromBufferAttribute(Uo,qo),fl.normal=Triangle.getInterpolation($f,jf,Gf,Hf,Xf,Yf,Jf,new Vector3),fl.normal.dot(So.direction)>0&&fl.normal.multiplyScalar(-1));const C={a:Oo,b:Ho,c:qo,normal:new Vector3,materialIndex:0};Triangle.getNormal(jf,Gf,Hf,C.normal),fl.face=C}return fl}class BoxGeometry extends BufferGeometry{constructor(C,Rn,or,So,To,Ro){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),void 0===To&&(To=1),void 0===Ro&&(Ro=1),super(),this.type="BoxGeometry",this.parameters={width:C,height:Rn,depth:or,widthSegments:So,heightSegments:To,depthSegments:Ro};const Uo=this;So=Math.floor(So),To=Math.floor(To),Ro=Math.floor(Ro);const Oo=[],Ho=[],qo=[],dl=[];let ml=0,fl=0;function buildPlane(C,Rn,or,So,To,Ro,vl,bl,kl,Ll,Dl){const Nc=Ro/kl,jc=vl/Ll,Zc=Ro/2,eu=vl/2,Ku=bl/2,Yu=kl+1,Eh=Ll+1;let Th=0,Ch=0;const Lh=new Vector3;for(let Uo=0;Uo<Eh;Uo++){const Ro=Uo*jc-eu;for(let Oo=0;Oo<Yu;Oo++){const ml=Oo*Nc-Zc;Lh[C]=ml*So,Lh[Rn]=Ro*To,Lh[or]=Ku,Ho.push(Lh.x,Lh.y,Lh.z),Lh[C]=0,Lh[Rn]=0,Lh[or]=bl>0?1:-1,qo.push(Lh.x,Lh.y,Lh.z),dl.push(Oo/kl),dl.push(1-Uo/Ll),Th+=1}}for(let Uo=0;Uo<Ll;Uo++)for(let C=0;C<kl;C++){const Rn=ml+C+Yu*Uo,or=ml+C+Yu*(Uo+1),So=ml+(C+1)+Yu*(Uo+1),To=ml+(C+1)+Yu*Uo;Oo.push(Rn,or,To),Oo.push(or,So,To),Ch+=6}Uo.addGroup(fl,Ch,Dl),fl+=Ch,ml+=Th}buildPlane("z","y","x",-1,-1,or,Rn,C,Ro,To,0),buildPlane("z","y","x",1,-1,or,Rn,-C,Ro,To,1),buildPlane("x","z","y",1,1,C,or,Rn,So,Ro,2),buildPlane("x","z","y",1,-1,C,or,-Rn,So,Ro,3),buildPlane("x","y","z",1,-1,C,Rn,or,So,To,4),buildPlane("x","y","z",-1,-1,C,Rn,-or,So,To,5),this.setIndex(Oo),this.setAttribute("position",new Float32BufferAttribute(Ho,3)),this.setAttribute("normal",new Float32BufferAttribute(qo,3)),this.setAttribute("uv",new Float32BufferAttribute(dl,2))}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}static fromJSON(C){return new BoxGeometry(C.width,C.height,C.depth,C.widthSegments,C.heightSegments,C.depthSegments)}}function cloneUniforms(C){const Rn={};for(const or in C){Rn[or]={};for(const So in C[or]){const To=C[or][So];To&&(To.isColor||To.isMatrix3||To.isMatrix4||To.isVector2||To.isVector3||To.isVector4||To.isTexture||To.isQuaternion)?To.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Rn[or][So]=null):Rn[or][So]=To.clone():Array.isArray(To)?Rn[or][So]=To.slice():Rn[or][So]=To}}return Rn}function mergeUniforms(C){const Rn={};for(let or=0;or<C.length;or++){const So=cloneUniforms(C[or]);for(const C in So)Rn[C]=So[C]}return Rn}function getUnlitUniformColorSpace(C){const Rn=C.getRenderTarget();return null===Rn?C.outputColorSpace:!0===Rn.isXRRenderTarget?Rn.texture.colorSpace:mm.workingColorSpace}const tg={clone:cloneUniforms,merge:mergeUniforms};class ShaderMaterial extends Material{constructor(C){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={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==C&&this.setValues(C)}copy(C){return super.copy(C),this.fragmentShader=C.fragmentShader,this.vertexShader=C.vertexShader,this.uniforms=cloneUniforms(C.uniforms),this.uniformsGroups=function(C){const Rn=[];for(let or=0;or<C.length;or++)Rn.push(C[or].clone());return Rn}(C.uniformsGroups),this.defines=Object.assign({},C.defines),this.wireframe=C.wireframe,this.wireframeLinewidth=C.wireframeLinewidth,this.fog=C.fog,this.lights=C.lights,this.clipping=C.clipping,this.extensions=Object.assign({},C.extensions),this.glslVersion=C.glslVersion,this}toJSON(C){const Rn=super.toJSON(C);Rn.glslVersion=this.glslVersion,Rn.uniforms={};for(const So in this.uniforms){const or=this.uniforms[So].value;or&&or.isTexture?Rn.uniforms[So]={type:"t",value:or.toJSON(C).uuid}:or&&or.isColor?Rn.uniforms[So]={type:"c",value:or.getHex()}:or&&or.isVector2?Rn.uniforms[So]={type:"v2",value:or.toArray()}:or&&or.isVector3?Rn.uniforms[So]={type:"v3",value:or.toArray()}:or&&or.isVector4?Rn.uniforms[So]={type:"v4",value:or.toArray()}:or&&or.isMatrix3?Rn.uniforms[So]={type:"m3",value:or.toArray()}:or&&or.isMatrix4?Rn.uniforms[So]={type:"m4",value:or.toArray()}:Rn.uniforms[So]={value:or}}Object.keys(this.defines).length>0&&(Rn.defines=this.defines),Rn.vertexShader=this.vertexShader,Rn.fragmentShader=this.fragmentShader,Rn.lights=this.lights,Rn.clipping=this.clipping;const or={};for(const So in this.extensions)!0===this.extensions[So]&&(or[So]=!0);return Object.keys(or).length>0&&(Rn.extensions=or),Rn}}class Camera extends Object3D{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4,this.coordinateSystem=tm}copy(C,Rn){return super.copy(C,Rn),this.matrixWorldInverse.copy(C.matrixWorldInverse),this.projectionMatrix.copy(C.projectionMatrix),this.projectionMatrixInverse.copy(C.projectionMatrixInverse),this.coordinateSystem=C.coordinateSystem,this}getWorldDirection(C){return super.getWorldDirection(C).negate()}updateMatrixWorld(C){super.updateMatrixWorld(C),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(C,Rn){super.updateWorldMatrix(C,Rn),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const ig=new Vector3,ng=new Vector2,rg=new Vector2;class PerspectiveCamera extends Camera{constructor(C,Rn,or,So){void 0===C&&(C=50),void 0===Rn&&(Rn=1),void 0===or&&(or=.1),void 0===So&&(So=2e3),super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=C,this.zoom=1,this.near=or,this.far=So,this.focus=10,this.aspect=Rn,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(C,Rn){return super.copy(C,Rn),this.fov=C.fov,this.zoom=C.zoom,this.near=C.near,this.far=C.far,this.focus=C.focus,this.aspect=C.aspect,this.view=null===C.view?null:Object.assign({},C.view),this.filmGauge=C.filmGauge,this.filmOffset=C.filmOffset,this}setFocalLength(C){const Rn=.5*this.getFilmHeight()/C;this.fov=2*sm*Math.atan(Rn),this.updateProjectionMatrix()}getFocalLength(){const C=Math.tan(.5*am*this.fov);return.5*this.getFilmHeight()/C}getEffectiveFOV(){return 2*sm*Math.atan(Math.tan(.5*am*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(C,Rn,or){ig.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),Rn.set(ig.x,ig.y).multiplyScalar(-C/ig.z),ig.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),or.set(ig.x,ig.y).multiplyScalar(-C/ig.z)}getViewSize(C,Rn){return this.getViewBounds(C,ng,rg),Rn.subVectors(rg,ng)}setViewOffset(C,Rn,or,So,To,Ro){this.aspect=C/Rn,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=C,this.view.fullHeight=Rn,this.view.offsetX=or,this.view.offsetY=So,this.view.width=To,this.view.height=Ro,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const C=this.near;let Rn=C*Math.tan(.5*am*this.fov)/this.zoom,or=2*Rn,So=this.aspect*or,To=-.5*So;const Ro=this.view;if(null!==this.view&&this.view.enabled){const C=Ro.fullWidth,Uo=Ro.fullHeight;To+=Ro.offsetX*So/C,Rn-=Ro.offsetY*or/Uo,So*=Ro.width/C,or*=Ro.height/Uo}const Uo=this.filmOffset;0!==Uo&&(To+=C*Uo/this.getFilmWidth()),this.projectionMatrix.makePerspective(To,To+So,Rn,Rn-or,C,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(C){const Rn=super.toJSON(C);return Rn.object.fov=this.fov,Rn.object.zoom=this.zoom,Rn.object.near=this.near,Rn.object.far=this.far,Rn.object.focus=this.focus,Rn.object.aspect=this.aspect,null!==this.view&&(Rn.object.view=Object.assign({},this.view)),Rn.object.filmGauge=this.filmGauge,Rn.object.filmOffset=this.filmOffset,Rn}}const ag=-90;class CubeCamera extends Object3D{constructor(C,Rn,or){super(),this.type="CubeCamera",this.renderTarget=or,this.coordinateSystem=null,this.activeMipmapLevel=0;const So=new PerspectiveCamera(ag,1,C,Rn);So.layers=this.layers,this.add(So);const To=new PerspectiveCamera(ag,1,C,Rn);To.layers=this.layers,this.add(To);const Ro=new PerspectiveCamera(ag,1,C,Rn);Ro.layers=this.layers,this.add(Ro);const Uo=new PerspectiveCamera(ag,1,C,Rn);Uo.layers=this.layers,this.add(Uo);const Oo=new PerspectiveCamera(ag,1,C,Rn);Oo.layers=this.layers,this.add(Oo);const Ho=new PerspectiveCamera(ag,1,C,Rn);Ho.layers=this.layers,this.add(Ho)}updateCoordinateSystem(){const C=this.coordinateSystem,Rn=this.children.concat(),[or,So,To,Ro,Uo,Oo]=Rn;for(const Ho of Rn)this.remove(Ho);if(C===tm)or.up.set(0,1,0),or.lookAt(1,0,0),So.up.set(0,1,0),So.lookAt(-1,0,0),To.up.set(0,0,-1),To.lookAt(0,1,0),Ro.up.set(0,0,1),Ro.lookAt(0,-1,0),Uo.up.set(0,1,0),Uo.lookAt(0,0,1),Oo.up.set(0,1,0),Oo.lookAt(0,0,-1);else{if(C!==im)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+C);or.up.set(0,-1,0),or.lookAt(-1,0,0),So.up.set(0,-1,0),So.lookAt(1,0,0),To.up.set(0,0,1),To.lookAt(0,1,0),Ro.up.set(0,0,-1),Ro.lookAt(0,-1,0),Uo.up.set(0,-1,0),Uo.lookAt(0,0,1),Oo.up.set(0,-1,0),Oo.lookAt(0,0,-1)}for(const Ho of Rn)this.add(Ho),Ho.updateMatrixWorld()}update(C,Rn){null===this.parent&&this.updateMatrixWorld();const{renderTarget:or,activeMipmapLevel:So}=this;this.coordinateSystem!==C.coordinateSystem&&(this.coordinateSystem=C.coordinateSystem,this.updateCoordinateSystem());const[To,Ro,Uo,Oo,Ho,qo]=this.children,dl=C.getRenderTarget(),ml=C.getActiveCubeFace(),fl=C.getActiveMipmapLevel(),vl=C.xr.enabled;C.xr.enabled=!1;const bl=or.texture.generateMipmaps;or.texture.generateMipmaps=!1,C.setRenderTarget(or,0,So),C.render(Rn,To),C.setRenderTarget(or,1,So),C.render(Rn,Ro),C.setRenderTarget(or,2,So),C.render(Rn,Uo),C.setRenderTarget(or,3,So),C.render(Rn,Oo),C.setRenderTarget(or,4,So),C.render(Rn,Ho),or.texture.generateMipmaps=bl,C.setRenderTarget(or,5,So),C.render(Rn,qo),C.setRenderTarget(dl,ml,fl),C.xr.enabled=vl,or.texture.needsPMREMUpdate=!0}}class CubeTexture extends Texture{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){super(C=void 0!==C?C:[],Rn=void 0!==Rn?Rn:ud,or,So,To,Ro,Uo,Oo,Ho,qo),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(C){this.image=C}}class WebGLCubeRenderTarget extends WebGLRenderTarget{constructor(C,Rn){void 0===C&&(C=1),void 0===Rn&&(Rn={}),super(C,C,Rn),this.isWebGLCubeRenderTarget=!0;const or={width:C,height:C,depth:1},So=[or,or,or,or,or,or];this.texture=new CubeTexture(So,Rn.mapping,Rn.wrapS,Rn.wrapT,Rn.magFilter,Rn.minFilter,Rn.format,Rn.type,Rn.anisotropy,Rn.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==Rn.generateMipmaps&&Rn.generateMipmaps,this.texture.minFilter=void 0!==Rn.minFilter?Rn.minFilter:_d}fromEquirectangularTexture(C,Rn){this.texture.type=Rn.type,this.texture.colorSpace=Rn.colorSpace,this.texture.generateMipmaps=Rn.generateMipmaps,this.texture.minFilter=Rn.minFilter,this.texture.magFilter=Rn.magFilter;const or={tEquirect:{value:null}},So="\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",To="\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",Ro=new BoxGeometry(5,5,5),Uo=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(or),vertexShader:So,fragmentShader:To,side:ml,blending:vl});Uo.uniforms.tEquirect.value=Rn;const Oo=new Mesh(Ro,Uo),Ho=Rn.minFilter;Rn.minFilter===wd&&(Rn.minFilter=_d);return new CubeCamera(1,10,this).update(C,Oo),Rn.minFilter=Ho,Oo.geometry.dispose(),Oo.material.dispose(),this}clear(C,Rn,or,So){const To=C.getRenderTarget();for(let Ro=0;Ro<6;Ro++)C.setRenderTarget(this,Ro),C.clear(Rn,or,So);C.setRenderTarget(To)}}const sg=new Vector3,og=new Vector3,lg=new Matrix3;class Plane{constructor(C,Rn){void 0===C&&(C=new Vector3(1,0,0)),void 0===Rn&&(Rn=0),this.isPlane=!0,this.normal=C,this.constant=Rn}set(C,Rn){return this.normal.copy(C),this.constant=Rn,this}setComponents(C,Rn,or,So){return this.normal.set(C,Rn,or),this.constant=So,this}setFromNormalAndCoplanarPoint(C,Rn){return this.normal.copy(C),this.constant=-Rn.dot(this.normal),this}setFromCoplanarPoints(C,Rn,or){const So=sg.subVectors(or,Rn).cross(og.subVectors(C,Rn)).normalize();return this.setFromNormalAndCoplanarPoint(So,C),this}copy(C){return this.normal.copy(C.normal),this.constant=C.constant,this}normalize(){const C=1/this.normal.length();return this.normal.multiplyScalar(C),this.constant*=C,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(C){return this.normal.dot(C)+this.constant}distanceToSphere(C){return this.distanceToPoint(C.center)-C.radius}projectPoint(C,Rn){return Rn.copy(C).addScaledVector(this.normal,-this.distanceToPoint(C))}intersectLine(C,Rn){const or=C.delta(sg),So=this.normal.dot(or);if(0===So)return 0===this.distanceToPoint(C.start)?Rn.copy(C.start):null;const To=-(C.start.dot(this.normal)+this.constant)/So;return To<0||To>1?null:Rn.copy(C.start).addScaledVector(or,To)}intersectsLine(C){const Rn=this.distanceToPoint(C.start),or=this.distanceToPoint(C.end);return Rn<0&&or>0||or<0&&Rn>0}intersectsBox(C){return C.intersectsPlane(this)}intersectsSphere(C){return C.intersectsPlane(this)}coplanarPoint(C){return C.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(C,Rn){const or=Rn||lg.getNormalMatrix(C),So=this.coplanarPoint(sg).applyMatrix4(C),To=this.normal.applyMatrix3(or).normalize();return this.constant=-So.dot(To),this}translate(C){return this.constant-=C.dot(this.normal),this}equals(C){return C.normal.equals(this.normal)&&C.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const cg=new Sphere,ug=new Vector3;class Frustum{constructor(C,Rn,or,So,To,Ro){void 0===C&&(C=new Plane),void 0===Rn&&(Rn=new Plane),void 0===or&&(or=new Plane),void 0===So&&(So=new Plane),void 0===To&&(To=new Plane),void 0===Ro&&(Ro=new Plane),this.planes=[C,Rn,or,So,To,Ro]}set(C,Rn,or,So,To,Ro){const Uo=this.planes;return Uo[0].copy(C),Uo[1].copy(Rn),Uo[2].copy(or),Uo[3].copy(So),Uo[4].copy(To),Uo[5].copy(Ro),this}copy(C){const Rn=this.planes;for(let or=0;or<6;or++)Rn[or].copy(C.planes[or]);return this}setFromProjectionMatrix(C,Rn){void 0===Rn&&(Rn=tm);const or=this.planes,So=C.elements,To=So[0],Ro=So[1],Uo=So[2],Oo=So[3],Ho=So[4],qo=So[5],dl=So[6],ml=So[7],fl=So[8],vl=So[9],bl=So[10],kl=So[11],Ll=So[12],Dl=So[13],Nc=So[14],jc=So[15];if(or[0].setComponents(Oo-To,ml-Ho,kl-fl,jc-Ll).normalize(),or[1].setComponents(Oo+To,ml+Ho,kl+fl,jc+Ll).normalize(),or[2].setComponents(Oo+Ro,ml+qo,kl+vl,jc+Dl).normalize(),or[3].setComponents(Oo-Ro,ml-qo,kl-vl,jc-Dl).normalize(),or[4].setComponents(Oo-Uo,ml-dl,kl-bl,jc-Nc).normalize(),Rn===tm)or[5].setComponents(Oo+Uo,ml+dl,kl+bl,jc+Nc).normalize();else{if(Rn!==im)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+Rn);or[5].setComponents(Uo,dl,bl,Nc).normalize()}return this}intersectsObject(C){if(void 0!==C.boundingSphere)null===C.boundingSphere&&C.computeBoundingSphere(),cg.copy(C.boundingSphere).applyMatrix4(C.matrixWorld);else{const Rn=C.geometry;null===Rn.boundingSphere&&Rn.computeBoundingSphere(),cg.copy(Rn.boundingSphere).applyMatrix4(C.matrixWorld)}return this.intersectsSphere(cg)}intersectsSprite(C){return cg.center.set(0,0,0),cg.radius=.7071067811865476,cg.applyMatrix4(C.matrixWorld),this.intersectsSphere(cg)}intersectsSphere(C){const Rn=this.planes,or=C.center,So=-C.radius;for(let To=0;To<6;To++){if(Rn[To].distanceToPoint(or)<So)return!1}return!0}intersectsBox(C){const Rn=this.planes;for(let or=0;or<6;or++){const So=Rn[or];if(ug.x=So.normal.x>0?C.max.x:C.min.x,ug.y=So.normal.y>0?C.max.y:C.min.y,ug.z=So.normal.z>0?C.max.z:C.min.z,So.distanceToPoint(ug)<0)return!1}return!0}containsPoint(C){const Rn=this.planes;for(let or=0;or<6;or++)if(Rn[or].distanceToPoint(C)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function WebGLAnimation(){let C=null,Rn=!1,or=null,So=null;function onAnimationFrame(Rn,To){or(Rn,To),So=C.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==Rn&&null!==or&&(So=C.requestAnimationFrame(onAnimationFrame),Rn=!0)},stop:function(){C.cancelAnimationFrame(So),Rn=!1},setAnimationLoop:function(C){or=C},setContext:function(Rn){C=Rn}}}function WebGLAttributes(C){const Rn=new WeakMap;return{get:function(C){return C.isInterleavedBufferAttribute&&(C=C.data),Rn.get(C)},remove:function(or){or.isInterleavedBufferAttribute&&(or=or.data);const So=Rn.get(or);So&&(C.deleteBuffer(So.buffer),Rn.delete(or))},update:function(or,So){if(or.isInterleavedBufferAttribute&&(or=or.data),or.isGLBufferAttribute){const C=Rn.get(or);return void((!C||C.version<or.version)&&Rn.set(or,{buffer:or.buffer,type:or.type,bytesPerElement:or.elementSize,version:or.version}))}const To=Rn.get(or);if(void 0===To)Rn.set(or,function(Rn,or){const So=Rn.array,To=Rn.usage,Ro=So.byteLength,Uo=C.createBuffer();let Oo;if(C.bindBuffer(or,Uo),C.bufferData(or,So,To),Rn.onUploadCallback(),So instanceof Float32Array)Oo=C.FLOAT;else if(So instanceof Uint16Array)Oo=Rn.isFloat16BufferAttribute?C.HALF_FLOAT:C.UNSIGNED_SHORT;else if(So instanceof Int16Array)Oo=C.SHORT;else if(So instanceof Uint32Array)Oo=C.UNSIGNED_INT;else if(So instanceof Int32Array)Oo=C.INT;else if(So instanceof Int8Array)Oo=C.BYTE;else if(So instanceof Uint8Array)Oo=C.UNSIGNED_BYTE;else{if(!(So instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+So);Oo=C.UNSIGNED_BYTE}return{buffer:Uo,type:Oo,bytesPerElement:So.BYTES_PER_ELEMENT,version:Rn.version,size:Ro}}(or,So));else if(To.version<or.version){if(To.size!==or.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(Rn,or,So){const To=or.array,Ro=or._updateRange,Uo=or.updateRanges;if(C.bindBuffer(So,Rn),-1===Ro.count&&0===Uo.length&&C.bufferSubData(So,0,To),0!==Uo.length){for(let Rn=0,or=Uo.length;Rn<or;Rn++){const or=Uo[Rn];C.bufferSubData(So,or.start*To.BYTES_PER_ELEMENT,To,or.start,or.count)}or.clearUpdateRanges()}-1!==Ro.count&&(C.bufferSubData(So,Ro.offset*To.BYTES_PER_ELEMENT,To,Ro.offset,Ro.count),Ro.count=-1),or.onUploadCallback()}(To.buffer,or,So),To.version=or.version}}}}class PlaneGeometry extends BufferGeometry{constructor(C,Rn,or,So){void 0===C&&(C=1),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=1),super(),this.type="PlaneGeometry",this.parameters={width:C,height:Rn,widthSegments:or,heightSegments:So};const To=C/2,Ro=Rn/2,Uo=Math.floor(or),Oo=Math.floor(So),Ho=Uo+1,qo=Oo+1,dl=C/Uo,ml=Rn/Oo,fl=[],vl=[],bl=[],kl=[];for(let Ll=0;Ll<qo;Ll++){const C=Ll*ml-Ro;for(let Rn=0;Rn<Ho;Rn++){const or=Rn*dl-To;vl.push(or,-C,0),bl.push(0,0,1),kl.push(Rn/Uo),kl.push(1-Ll/Oo)}}for(let Ll=0;Ll<Oo;Ll++)for(let C=0;C<Uo;C++){const Rn=C+Ho*Ll,or=C+Ho*(Ll+1),So=C+1+Ho*(Ll+1),To=C+1+Ho*Ll;fl.push(Rn,or,To),fl.push(or,So,To)}this.setIndex(fl),this.setAttribute("position",new Float32BufferAttribute(vl,3)),this.setAttribute("normal",new Float32BufferAttribute(bl,3)),this.setAttribute("uv",new Float32BufferAttribute(kl,2))}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}static fromJSON(C){return new PlaneGeometry(C.width,C.height,C.widthSegments,C.heightSegments)}}const hg={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\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\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\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\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\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\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#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\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 ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.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}\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_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\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}",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, envMapRotation * 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\tuniform mat3 envMapRotation;\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, envMapRotation * 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, envMapRotation * 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_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\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\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_DISPERSION\n\tmaterial.dispersion = dispersion;\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\tfloat dispersion;\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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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 )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\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",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\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\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\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.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in 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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, 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 mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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 CineonToneMapping( 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}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\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.dispersion, 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 dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\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;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * 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#include <morphinstance_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\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\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#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\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#include <morphinstance_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\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\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 ), diffuseColor.a );\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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_DISPERSION\n\tuniform float dispersion;\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\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 <morphinstance_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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\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}"},dg={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new Matrix3},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Matrix3},normalScale:{value:new Vector2(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new Matrix3},alphaTest:{value:0}}},pg={basic:{uniforms:mergeUniforms([dg.common,dg.specularmap,dg.envmap,dg.aomap,dg.lightmap,dg.fog]),vertexShader:hg.meshbasic_vert,fragmentShader:hg.meshbasic_frag},lambert:{uniforms:mergeUniforms([dg.common,dg.specularmap,dg.envmap,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.fog,dg.lights,{emissive:{value:new Color(0)}}]),vertexShader:hg.meshlambert_vert,fragmentShader:hg.meshlambert_frag},phong:{uniforms:mergeUniforms([dg.common,dg.specularmap,dg.envmap,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.fog,dg.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:hg.meshphong_vert,fragmentShader:hg.meshphong_frag},standard:{uniforms:mergeUniforms([dg.common,dg.envmap,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.roughnessmap,dg.metalnessmap,dg.fog,dg.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hg.meshphysical_vert,fragmentShader:hg.meshphysical_frag},toon:{uniforms:mergeUniforms([dg.common,dg.aomap,dg.lightmap,dg.emissivemap,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.gradientmap,dg.fog,dg.lights,{emissive:{value:new Color(0)}}]),vertexShader:hg.meshtoon_vert,fragmentShader:hg.meshtoon_frag},matcap:{uniforms:mergeUniforms([dg.common,dg.bumpmap,dg.normalmap,dg.displacementmap,dg.fog,{matcap:{value:null}}]),vertexShader:hg.meshmatcap_vert,fragmentShader:hg.meshmatcap_frag},points:{uniforms:mergeUniforms([dg.points,dg.fog]),vertexShader:hg.points_vert,fragmentShader:hg.points_frag},dashed:{uniforms:mergeUniforms([dg.common,dg.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hg.linedashed_vert,fragmentShader:hg.linedashed_frag},depth:{uniforms:mergeUniforms([dg.common,dg.displacementmap]),vertexShader:hg.depth_vert,fragmentShader:hg.depth_frag},normal:{uniforms:mergeUniforms([dg.common,dg.bumpmap,dg.normalmap,dg.displacementmap,{opacity:{value:1}}]),vertexShader:hg.meshnormal_vert,fragmentShader:hg.meshnormal_frag},sprite:{uniforms:mergeUniforms([dg.sprite,dg.fog]),vertexShader:hg.sprite_vert,fragmentShader:hg.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hg.background_vert,fragmentShader:hg.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Matrix3}},vertexShader:hg.backgroundCube_vert,fragmentShader:hg.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hg.cube_vert,fragmentShader:hg.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hg.equirect_vert,fragmentShader:hg.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([dg.common,dg.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hg.distanceRGBA_vert,fragmentShader:hg.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([dg.lights,dg.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:hg.shadow_vert,fragmentShader:hg.shadow_frag}};pg.physical={uniforms:mergeUniforms([pg.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Matrix3},clearcoatNormalScale:{value:new Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Matrix3},sheen:{value:0},sheenColor:{value:new Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Matrix3},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Matrix3},anisotropyVector:{value:new Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Matrix3}}]),vertexShader:hg.meshphysical_vert,fragmentShader:hg.meshphysical_frag};const mg={r:0,b:0,g:0},fg=new Euler,gg=new Matrix4;function WebGLBackground(C,Rn,or,So,To,Ro,Uo){const Oo=new Color(0);let Ho,qo,fl=!0===Ro?0:1,vl=null,bl=0,kl=null;function getBackground(C){let So=!0===C.isScene?C.background:null;if(So&&So.isTexture){So=(C.backgroundBlurriness>0?or:Rn).get(So)}return So}function setClear(Rn,or){Rn.getRGB(mg,getUnlitUniformColorSpace(C)),So.buffers.color.setClear(mg.r,mg.g,mg.b,or,Uo)}return{getClearColor:function(){return Oo},setClearColor:function(C,Rn){void 0===Rn&&(Rn=1),Oo.set(C),fl=Rn,setClear(Oo,fl)},getClearAlpha:function(){return fl},setClearAlpha:function(C){fl=C,setClear(Oo,fl)},render:function(Rn){let or=!1;const To=getBackground(Rn);null===To?setClear(Oo,fl):To&&To.isColor&&(setClear(To,1),or=!0);const Ro=C.xr.getEnvironmentBlendMode();"additive"===Ro?So.buffers.color.setClear(0,0,0,1,Uo):"alpha-blend"===Ro&&So.buffers.color.setClear(0,0,0,0,Uo),(C.autoClear||or)&&(So.buffers.depth.setTest(!0),So.buffers.depth.setMask(!0),So.buffers.color.setMask(!0),C.clear(C.autoClearColor,C.autoClearDepth,C.autoClearStencil))},addToRenderList:function(Rn,or){const So=getBackground(or);So&&(So.isCubeTexture||So.mapping===md)?(void 0===qo&&(qo=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(pg.backgroundCube.uniforms),vertexShader:pg.backgroundCube.vertexShader,fragmentShader:pg.backgroundCube.fragmentShader,side:ml,depthTest:!1,depthWrite:!1,fog:!1})),qo.geometry.deleteAttribute("normal"),qo.geometry.deleteAttribute("uv"),qo.onBeforeRender=function(C,Rn,or){this.matrixWorld.copyPosition(or.matrixWorld)},Object.defineProperty(qo.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),To.update(qo)),fg.copy(or.backgroundRotation),fg.x*=-1,fg.y*=-1,fg.z*=-1,So.isCubeTexture&&!1===So.isRenderTargetTexture&&(fg.y*=-1,fg.z*=-1),qo.material.uniforms.envMap.value=So,qo.material.uniforms.flipEnvMap.value=So.isCubeTexture&&!1===So.isRenderTargetTexture?-1:1,qo.material.uniforms.backgroundBlurriness.value=or.backgroundBlurriness,qo.material.uniforms.backgroundIntensity.value=or.backgroundIntensity,qo.material.uniforms.backgroundRotation.value.setFromMatrix4(gg.makeRotationFromEuler(fg)),qo.material.toneMapped=mm.getTransfer(So.colorSpace)!==Vp,vl===So&&bl===So.version&&kl===C.toneMapping||(qo.material.needsUpdate=!0,vl=So,bl=So.version,kl=C.toneMapping),qo.layers.enableAll(),Rn.unshift(qo,qo.geometry,qo.material,0,0,null)):So&&So.isTexture&&(void 0===Ho&&(Ho=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(pg.background.uniforms),vertexShader:pg.background.vertexShader,fragmentShader:pg.background.fragmentShader,side:dl,depthTest:!1,depthWrite:!1,fog:!1})),Ho.geometry.deleteAttribute("normal"),Object.defineProperty(Ho.material,"map",{get:function(){return this.uniforms.t2D.value}}),To.update(Ho)),Ho.material.uniforms.t2D.value=So,Ho.material.uniforms.backgroundIntensity.value=or.backgroundIntensity,Ho.material.toneMapped=mm.getTransfer(So.colorSpace)!==Vp,!0===So.matrixAutoUpdate&&So.updateMatrix(),Ho.material.uniforms.uvTransform.value.copy(So.matrix),vl===So&&bl===So.version&&kl===C.toneMapping||(Ho.material.needsUpdate=!0,vl=So,bl=So.version,kl=C.toneMapping),Ho.layers.enableAll(),Rn.unshift(Ho,Ho.geometry,Ho.material,0,0,null))}}}function WebGLBindingStates(C,Rn){const or=C.getParameter(C.MAX_VERTEX_ATTRIBS),So={},To=createBindingState(null);let Ro=To,Uo=!1;function bindVertexArrayObject(Rn){return C.bindVertexArray(Rn)}function deleteVertexArrayObject(Rn){return C.deleteVertexArray(Rn)}function createBindingState(C){const Rn=[],So=[],To=[];for(let Ro=0;Ro<or;Ro++)Rn[Ro]=0,So[Ro]=0,To[Ro]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Rn,enabledAttributes:So,attributeDivisors:To,object:C,attributes:{},index:null}}function initAttributes(){const C=Ro.newAttributes;for(let Rn=0,or=C.length;Rn<or;Rn++)C[Rn]=0}function enableAttribute(C){enableAttributeAndDivisor(C,0)}function enableAttributeAndDivisor(Rn,or){const So=Ro.newAttributes,To=Ro.enabledAttributes,Uo=Ro.attributeDivisors;So[Rn]=1,0===To[Rn]&&(C.enableVertexAttribArray(Rn),To[Rn]=1),Uo[Rn]!==or&&(C.vertexAttribDivisor(Rn,or),Uo[Rn]=or)}function disableUnusedAttributes(){const Rn=Ro.newAttributes,or=Ro.enabledAttributes;for(let So=0,To=or.length;So<To;So++)or[So]!==Rn[So]&&(C.disableVertexAttribArray(So),or[So]=0)}function vertexAttribPointer(Rn,or,So,To,Ro,Uo,Oo){!0===Oo?C.vertexAttribIPointer(Rn,or,So,Ro,Uo):C.vertexAttribPointer(Rn,or,So,To,Ro,Uo)}function reset(){resetDefaultState(),Uo=!0,Ro!==To&&(Ro=To,bindVertexArrayObject(Ro.object))}function resetDefaultState(){To.geometry=null,To.program=null,To.wireframe=!1}return{setup:function(or,To,Oo,Ho,qo){let dl=!1;const ml=function(Rn,or,To){const Ro=!0===To.wireframe;let Uo=So[Rn.id];void 0===Uo&&(Uo={},So[Rn.id]=Uo);let Oo=Uo[or.id];void 0===Oo&&(Oo={},Uo[or.id]=Oo);let Ho=Oo[Ro];void 0===Ho&&(Ho=createBindingState(C.createVertexArray()),Oo[Ro]=Ho);return Ho}(Ho,Oo,To);Ro!==ml&&(Ro=ml,bindVertexArrayObject(Ro.object)),dl=function(C,Rn,or,So){const To=Ro.attributes,Uo=Rn.attributes;let Oo=0;const Ho=or.getAttributes();for(const Ro in Ho){if(Ho[Ro].location>=0){const Rn=To[Ro];let or=Uo[Ro];if(void 0===or&&("instanceMatrix"===Ro&&C.instanceMatrix&&(or=C.instanceMatrix),"instanceColor"===Ro&&C.instanceColor&&(or=C.instanceColor)),void 0===Rn)return!0;if(Rn.attribute!==or)return!0;if(or&&Rn.data!==or.data)return!0;Oo++}}return Ro.attributesNum!==Oo||Ro.index!==So}(or,Ho,Oo,qo),dl&&function(C,Rn,or,So){const To={},Uo=Rn.attributes;let Oo=0;const Ho=or.getAttributes();for(const Ro in Ho){if(Ho[Ro].location>=0){let Rn=Uo[Ro];void 0===Rn&&("instanceMatrix"===Ro&&C.instanceMatrix&&(Rn=C.instanceMatrix),"instanceColor"===Ro&&C.instanceColor&&(Rn=C.instanceColor));const or={};or.attribute=Rn,Rn&&Rn.data&&(or.data=Rn.data),To[Ro]=or,Oo++}}Ro.attributes=To,Ro.attributesNum=Oo,Ro.index=So}(or,Ho,Oo,qo),null!==qo&&Rn.update(qo,C.ELEMENT_ARRAY_BUFFER),(dl||Uo)&&(Uo=!1,function(or,So,To,Ro){initAttributes();const Uo=Ro.attributes,Oo=To.getAttributes(),Ho=So.defaultAttributeValues;for(const qo in Oo){const So=Oo[qo];if(So.location>=0){let To=Uo[qo];if(void 0===To&&("instanceMatrix"===qo&&or.instanceMatrix&&(To=or.instanceMatrix),"instanceColor"===qo&&or.instanceColor&&(To=or.instanceColor)),void 0!==To){const Uo=To.normalized,Oo=To.itemSize,Ho=Rn.get(To);if(void 0===Ho)continue;const qo=Ho.buffer,dl=Ho.type,ml=Ho.bytesPerElement,fl=dl===C.INT||dl===C.UNSIGNED_INT||To.gpuType===Td;if(To.isInterleavedBufferAttribute){const Rn=To.data,Ho=Rn.stride,vl=To.offset;if(Rn.isInstancedInterleavedBuffer){for(let C=0;C<So.locationSize;C++)enableAttributeAndDivisor(So.location+C,Rn.meshPerAttribute);!0!==or.isInstancedMesh&&void 0===Ro._maxInstanceCount&&(Ro._maxInstanceCount=Rn.meshPerAttribute*Rn.count)}else for(let C=0;C<So.locationSize;C++)enableAttribute(So.location+C);C.bindBuffer(C.ARRAY_BUFFER,qo);for(let C=0;C<So.locationSize;C++)vertexAttribPointer(So.location+C,Oo/So.locationSize,dl,Uo,Ho*ml,(vl+Oo/So.locationSize*C)*ml,fl)}else{if(To.isInstancedBufferAttribute){for(let C=0;C<So.locationSize;C++)enableAttributeAndDivisor(So.location+C,To.meshPerAttribute);!0!==or.isInstancedMesh&&void 0===Ro._maxInstanceCount&&(Ro._maxInstanceCount=To.meshPerAttribute*To.count)}else for(let C=0;C<So.locationSize;C++)enableAttribute(So.location+C);C.bindBuffer(C.ARRAY_BUFFER,qo);for(let C=0;C<So.locationSize;C++)vertexAttribPointer(So.location+C,Oo/So.locationSize,dl,Uo,Oo*ml,Oo/So.locationSize*C*ml,fl)}}else if(void 0!==Ho){const Rn=Ho[qo];if(void 0!==Rn)switch(Rn.length){case 2:C.vertexAttrib2fv(So.location,Rn);break;case 3:C.vertexAttrib3fv(So.location,Rn);break;case 4:C.vertexAttrib4fv(So.location,Rn);break;default:C.vertexAttrib1fv(So.location,Rn)}}}}disableUnusedAttributes()}(or,To,Oo,Ho),null!==qo&&C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,Rn.get(qo).buffer))},reset:reset,resetDefaultState:resetDefaultState,dispose:function(){reset();for(const C in So){const Rn=So[C];for(const C in Rn){const or=Rn[C];for(const C in or)deleteVertexArrayObject(or[C].object),delete or[C];delete Rn[C]}delete So[C]}},releaseStatesOfGeometry:function(C){if(void 0===So[C.id])return;const Rn=So[C.id];for(const or in Rn){const C=Rn[or];for(const Rn in C)deleteVertexArrayObject(C[Rn].object),delete C[Rn];delete Rn[or]}delete So[C.id]},releaseStatesOfProgram:function(C){for(const Rn in So){const or=So[Rn];if(void 0===or[C.id])continue;const To=or[C.id];for(const C in To)deleteVertexArrayObject(To[C].object),delete To[C];delete or[C.id]}},initAttributes:initAttributes,enableAttribute:enableAttribute,disableUnusedAttributes:disableUnusedAttributes}}function WebGLBufferRenderer(C,Rn,or){let So;function renderInstances(Rn,To,Ro){0!==Ro&&(C.drawArraysInstanced(So,Rn,To,Ro),or.update(To,So,Ro))}this.setMode=function(C){So=C},this.render=function(Rn,To){C.drawArrays(So,Rn,To),or.update(To,So,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function(C,To,Ro){if(0===Ro)return;Rn.get("WEBGL_multi_draw").multiDrawArraysWEBGL(So,C,0,To,0,Ro);let Uo=0;for(let Rn=0;Rn<Ro;Rn++)Uo+=To[Rn];or.update(Uo,So,1)},this.renderMultiDrawInstances=function(C,To,Ro,Uo){if(0===Ro)return;const Oo=Rn.get("WEBGL_multi_draw");if(null===Oo)for(let Rn=0;Rn<C.length;Rn++)renderInstances(C[Rn],To[Rn],Uo[Rn]);else{Oo.multiDrawArraysInstancedWEBGL(So,C,0,To,0,Uo,0,Ro);let Rn=0;for(let C=0;C<Ro;C++)Rn+=To[C];for(let C=0;C<Uo.length;C++)or.update(Rn,So,Uo[C])}}}function WebGLCapabilities(C,Rn,or,So){let To;function getMaxPrecision(Rn){if("highp"===Rn){if(C.getShaderPrecisionFormat(C.VERTEX_SHADER,C.HIGH_FLOAT).precision>0&&C.getShaderPrecisionFormat(C.FRAGMENT_SHADER,C.HIGH_FLOAT).precision>0)return"highp";Rn="mediump"}return"mediump"===Rn&&C.getShaderPrecisionFormat(C.VERTEX_SHADER,C.MEDIUM_FLOAT).precision>0&&C.getShaderPrecisionFormat(C.FRAGMENT_SHADER,C.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let Ro=void 0!==or.precision?or.precision:"highp";const Uo=getMaxPrecision(Ro);Uo!==Ro&&(console.warn("THREE.WebGLRenderer:",Ro,"not supported, using",Uo,"instead."),Ro=Uo);const Oo=!0===or.logarithmicDepthBuffer,Ho=C.getParameter(C.MAX_TEXTURE_IMAGE_UNITS),qo=C.getParameter(C.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==To)return To;if(!0===Rn.has("EXT_texture_filter_anisotropic")){const or=Rn.get("EXT_texture_filter_anisotropic");To=C.getParameter(or.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else To=0;return To},getMaxPrecision:getMaxPrecision,textureFormatReadable:function(Rn){return Rn===Bd||So.convert(Rn)===C.getParameter(C.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(or){const To=or===Ld&&(Rn.has("EXT_color_buffer_half_float")||Rn.has("EXT_color_buffer_float"));return!(or!==Ed&&So.convert(or)!==C.getParameter(C.IMPLEMENTATION_COLOR_READ_TYPE)&&or!==Cd&&!To)},precision:Ro,logarithmicDepthBuffer:Oo,maxTextures:Ho,maxVertexTextures:qo,maxTextureSize:C.getParameter(C.MAX_TEXTURE_SIZE),maxCubemapSize:C.getParameter(C.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:C.getParameter(C.MAX_VERTEX_ATTRIBS),maxVertexUniforms:C.getParameter(C.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:C.getParameter(C.MAX_VARYING_VECTORS),maxFragmentUniforms:C.getParameter(C.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:qo>0,maxSamples:C.getParameter(C.MAX_SAMPLES)}}function WebGLClipping(C){const Rn=this;let or=null,So=0,To=!1,Ro=!1;const Uo=new Plane,Oo=new Matrix3,Ho={value:null,needsUpdate:!1};function projectPlanes(C,or,So,To){const Ro=null!==C?C.length:0;let qo=null;if(0!==Ro){if(qo=Ho.value,!0!==To||null===qo){const Rn=So+4*Ro,To=or.matrixWorldInverse;Oo.getNormalMatrix(To),(null===qo||qo.length<Rn)&&(qo=new Float32Array(Rn));for(let or=0,Ho=So;or!==Ro;++or,Ho+=4)Uo.copy(C[or]).applyMatrix4(To,Oo),Uo.normal.toArray(qo,Ho),qo[Ho+3]=Uo.constant}Ho.value=qo,Ho.needsUpdate=!0}return Rn.numPlanes=Ro,Rn.numIntersection=0,qo}this.uniform=Ho,this.numPlanes=0,this.numIntersection=0,this.init=function(C,Rn){const or=0!==C.length||Rn||0!==So||To;return To=Rn,So=C.length,or},this.beginShadows=function(){Ro=!0,projectPlanes(null)},this.endShadows=function(){Ro=!1},this.setGlobalState=function(C,Rn){or=projectPlanes(C,Rn,0)},this.setState=function(Uo,Oo,qo){const dl=Uo.clippingPlanes,ml=Uo.clipIntersection,fl=Uo.clipShadows,vl=C.get(Uo);if(!To||null===dl||0===dl.length||Ro&&!fl)Ro?projectPlanes(null):function(){Ho.value!==or&&(Ho.value=or,Ho.needsUpdate=So>0);Rn.numPlanes=So,Rn.numIntersection=0}();else{const C=Ro?0:So,Rn=4*C;let To=vl.clippingState||null;Ho.value=To,To=projectPlanes(dl,Oo,Rn,qo);for(let So=0;So!==Rn;++So)To[So]=or[So];vl.clippingState=To,this.numIntersection=ml?this.numPlanes:0,this.numPlanes+=C}}}function WebGLCubeMaps(C){let Rn=new WeakMap;function mapTextureMapping(C,Rn){return Rn===dd?C.mapping=ud:Rn===pd&&(C.mapping=hd),C}function onTextureDispose(C){const or=C.target;or.removeEventListener("dispose",onTextureDispose);const So=Rn.get(or);void 0!==So&&(Rn.delete(or),So.dispose())}return{get:function(or){if(or&&or.isTexture){const So=or.mapping;if(So===dd||So===pd){if(Rn.has(or)){return mapTextureMapping(Rn.get(or).texture,or.mapping)}{const So=or.image;if(So&&So.height>0){const To=new WebGLCubeRenderTarget(So.height);return To.fromEquirectangularTexture(C,or),Rn.set(or,To),or.addEventListener("dispose",onTextureDispose),mapTextureMapping(To.texture,or.mapping)}return null}}}return or},dispose:function(){Rn=new WeakMap}}}class OrthographicCamera extends Camera{constructor(C,Rn,or,So,To,Ro){void 0===C&&(C=-1),void 0===Rn&&(Rn=1),void 0===or&&(or=1),void 0===So&&(So=-1),void 0===To&&(To=.1),void 0===Ro&&(Ro=2e3),super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=C,this.right=Rn,this.top=or,this.bottom=So,this.near=To,this.far=Ro,this.updateProjectionMatrix()}copy(C,Rn){return super.copy(C,Rn),this.left=C.left,this.right=C.right,this.top=C.top,this.bottom=C.bottom,this.near=C.near,this.far=C.far,this.zoom=C.zoom,this.view=null===C.view?null:Object.assign({},C.view),this}setViewOffset(C,Rn,or,So,To,Ro){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=C,this.view.fullHeight=Rn,this.view.offsetX=or,this.view.offsetY=So,this.view.width=To,this.view.height=Ro,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const C=(this.right-this.left)/(2*this.zoom),Rn=(this.top-this.bottom)/(2*this.zoom),or=(this.right+this.left)/2,So=(this.top+this.bottom)/2;let To=or-C,Ro=or+C,Uo=So+Rn,Oo=So-Rn;if(null!==this.view&&this.view.enabled){const C=(this.right-this.left)/this.view.fullWidth/this.zoom,Rn=(this.top-this.bottom)/this.view.fullHeight/this.zoom;To+=C*this.view.offsetX,Ro=To+C*this.view.width,Uo-=Rn*this.view.offsetY,Oo=Uo-Rn*this.view.height}this.projectionMatrix.makeOrthographic(To,Ro,Uo,Oo,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(C){const Rn=super.toJSON(C);return Rn.object.zoom=this.zoom,Rn.object.left=this.left,Rn.object.right=this.right,Rn.object.top=this.top,Rn.object.bottom=this.bottom,Rn.object.near=this.near,Rn.object.far=this.far,null!==this.view&&(Rn.object.view=Object.assign({},this.view)),Rn}}const Ag=4,yg=[.125,.215,.35,.446,.526,.582],vg=20,xg=new OrthographicCamera,_g=new Color;let bg=null,wg=0,Eg=0,Mg=!1;const Sg=(1+Math.sqrt(5))/2,kg=1/Sg,Tg=[new Vector3(-Sg,kg,0),new Vector3(Sg,kg,0),new Vector3(-kg,0,Sg),new Vector3(kg,0,Sg),new Vector3(0,Sg,-kg),new Vector3(0,Sg,kg),new Vector3(-1,1,-1),new Vector3(1,1,-1),new Vector3(-1,1,1),new Vector3(1,1,1)];class PMREMGenerator{constructor(C){this._renderer=C,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(C,Rn,or,So){void 0===Rn&&(Rn=0),void 0===or&&(or=.1),void 0===So&&(So=100),bg=this._renderer.getRenderTarget(),wg=this._renderer.getActiveCubeFace(),Eg=this._renderer.getActiveMipmapLevel(),Mg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const To=this._allocateTargets();return To.depthBuffer=!0,this._sceneToCubeUV(C,or,So,To),Rn>0&&this._blur(To,0,0,Rn),this._applyPMREM(To),this._cleanup(To),To}fromEquirectangular(C,Rn){return void 0===Rn&&(Rn=null),this._fromTexture(C,Rn)}fromCubemap(C,Rn){return void 0===Rn&&(Rn=null),this._fromTexture(C,Rn)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(C){this._lodMax=Math.floor(Math.log2(C)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let C=0;C<this._lodPlanes.length;C++)this._lodPlanes[C].dispose()}_cleanup(C){this._renderer.setRenderTarget(bg,wg,Eg),this._renderer.xr.enabled=Mg,C.scissorTest=!1,_setViewport(C,0,0,C.width,C.height)}_fromTexture(C,Rn){C.mapping===ud||C.mapping===hd?this._setSize(0===C.image.length?16:C.image[0].width||C.image[0].image.width):this._setSize(C.image.width/4),bg=this._renderer.getRenderTarget(),wg=this._renderer.getActiveCubeFace(),Eg=this._renderer.getActiveMipmapLevel(),Mg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const or=Rn||this._allocateTargets();return this._textureToCubeUV(C,or),this._applyPMREM(or),this._cleanup(or),or}_allocateTargets(){const C=3*Math.max(this._cubeSize,112),Rn=4*this._cubeSize,or={magFilter:_d,minFilter:_d,generateMipmaps:!1,type:Ld,format:Bd,colorSpace:Up,depthBuffer:!1},So=_createRenderTarget(C,Rn,or);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==C||this._pingPongRenderTarget.height!==Rn){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(C,Rn,or);const{_lodMax:So}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(C){const Rn=[],or=[],So=[];let To=C;const Ro=C-Ag+1+yg.length;for(let Uo=0;Uo<Ro;Uo++){const Ro=Math.pow(2,To);or.push(Ro);let Oo=1/Ro;Uo>C-Ag?Oo=yg[Uo-C+Ag-1]:0===Uo&&(Oo=0),So.push(Oo);const Ho=1/(Ro-2),qo=-Ho,dl=1+Ho,ml=[qo,qo,dl,qo,dl,dl,qo,qo,dl,dl,qo,dl],fl=6,vl=6,bl=3,kl=2,Ll=1,Dl=new Float32Array(bl*vl*fl),Nc=new Float32Array(kl*vl*fl),jc=new Float32Array(Ll*vl*fl);for(let C=0;C<fl;C++){const Rn=C%3*2/3-1,or=C>2?0:-1,So=[Rn,or,0,Rn+2/3,or,0,Rn+2/3,or+1,0,Rn,or,0,Rn+2/3,or+1,0,Rn,or+1,0];Dl.set(So,bl*vl*C),Nc.set(ml,kl*vl*C);const To=[C,C,C,C,C,C];jc.set(To,Ll*vl*C)}const Zc=new BufferGeometry;Zc.setAttribute("position",new BufferAttribute(Dl,bl)),Zc.setAttribute("uv",new BufferAttribute(Nc,kl)),Zc.setAttribute("faceIndex",new BufferAttribute(jc,Ll)),Rn.push(Zc),To>Ag&&To--}return{lodPlanes:Rn,sizeLods:or,sigmas:So}}(So)),this._blurMaterial=function(C,Rn,or){const So=new Float32Array(vg),To=new Vector3(0,1,0),Ro=new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:vg,CUBEUV_TEXEL_WIDTH:1/Rn,CUBEUV_TEXEL_HEIGHT:1/or,CUBEUV_MAX_MIP:C+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:So},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:To}},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:vl,depthTest:!1,depthWrite:!1});return Ro}(So,C,Rn)}return So}_compileMaterial(C){const Rn=new Mesh(this._lodPlanes[0],C);this._renderer.compile(Rn,xg)}_sceneToCubeUV(C,Rn,or,So){const To=new PerspectiveCamera(90,1,Rn,or),Ro=[1,-1,1,1,1,1],Uo=[1,1,1,-1,-1,-1],Oo=this._renderer,Ho=Oo.autoClear,qo=Oo.toneMapping;Oo.getClearColor(_g),Oo.toneMapping=id,Oo.autoClear=!1;const dl=new MeshBasicMaterial({name:"PMREM.Background",side:ml,depthWrite:!1,depthTest:!1}),fl=new Mesh(new BoxGeometry,dl);let vl=!1;const bl=C.background;bl?bl.isColor&&(dl.color.copy(bl),C.background=null,vl=!0):(dl.color.copy(_g),vl=!0);for(let ml=0;ml<6;ml++){const Rn=ml%3;0===Rn?(To.up.set(0,Ro[ml],0),To.lookAt(Uo[ml],0,0)):1===Rn?(To.up.set(0,0,Ro[ml]),To.lookAt(0,Uo[ml],0)):(To.up.set(0,Ro[ml],0),To.lookAt(0,0,Uo[ml]));const or=this._cubeSize;_setViewport(So,Rn*or,ml>2?or:0,or,or),Oo.setRenderTarget(So),vl&&Oo.render(fl,To),Oo.render(C,To)}fl.geometry.dispose(),fl.material.dispose(),Oo.toneMapping=qo,Oo.autoClear=Ho,C.background=bl}_textureToCubeUV(C,Rn){const or=this._renderer,So=C.mapping===ud||C.mapping===hd;So?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===C.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());const To=So?this._cubemapMaterial:this._equirectMaterial,Ro=new Mesh(this._lodPlanes[0],To);To.uniforms.envMap.value=C;const Uo=this._cubeSize;_setViewport(Rn,0,0,3*Uo,2*Uo),or.setRenderTarget(Rn),or.render(Ro,xg)}_applyPMREM(C){const Rn=this._renderer,or=Rn.autoClear;Rn.autoClear=!1;const So=this._lodPlanes.length;for(let To=1;To<So;To++){const Rn=Math.sqrt(this._sigmas[To]*this._sigmas[To]-this._sigmas[To-1]*this._sigmas[To-1]),or=Tg[(So-To-1)%Tg.length];this._blur(C,To-1,To,Rn,or)}Rn.autoClear=or}_blur(C,Rn,or,So,To){const Ro=this._pingPongRenderTarget;this._halfBlur(C,Ro,Rn,or,So,"latitudinal",To),this._halfBlur(Ro,C,or,or,So,"longitudinal",To)}_halfBlur(C,Rn,or,So,To,Ro,Uo){const Oo=this._renderer,Ho=this._blurMaterial;"latitudinal"!==Ro&&"longitudinal"!==Ro&&console.error("blur direction must be either latitudinal or longitudinal!");const qo=new Mesh(this._lodPlanes[So],Ho),dl=Ho.uniforms,ml=this._sizeLods[or]-1,fl=isFinite(To)?Math.PI/(2*ml):2*Math.PI/(2*vg-1),vl=To/fl,bl=isFinite(To)?1+Math.floor(3*vl):vg;bl>vg&&console.warn("sigmaRadians, "+To+", is too large and will clip, as it requested "+bl+" samples when the maximum is set to "+vg);const kl=[];let Ll=0;for(let jc=0;jc<vg;++jc){const C=jc/vl,Rn=Math.exp(-C*C/2);kl.push(Rn),0===jc?Ll+=Rn:jc<bl&&(Ll+=2*Rn)}for(let jc=0;jc<kl.length;jc++)kl[jc]=kl[jc]/Ll;dl.envMap.value=C.texture,dl.samples.value=bl,dl.weights.value=kl,dl.latitudinal.value="latitudinal"===Ro,Uo&&(dl.poleAxis.value=Uo);const{_lodMax:Dl}=this;dl.dTheta.value=fl,dl.mipInt.value=Dl-or;const Nc=this._sizeLods[So];_setViewport(Rn,3*Nc*(So>Dl-Ag?So-Dl+Ag:0),4*(this._cubeSize-Nc),3*Nc,2*Nc),Oo.setRenderTarget(Rn),Oo.render(qo,xg)}}function _createRenderTarget(C,Rn,or){const So=new WebGLRenderTarget(C,Rn,or);return So.texture.mapping=md,So.texture.name="PMREM.cubeUv",So.scissorTest=!0,So}function _setViewport(C,Rn,or,So,To){C.viewport.set(Rn,or,So,To),C.scissor.set(Rn,or,So,To)}function _getEquirectMaterial(){return new ShaderMaterial({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:vl,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({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:vl,depthTest:!1,depthWrite:!1})}function WebGLCubeUVMaps(C){let Rn=new WeakMap,or=null;function onTextureDispose(C){const or=C.target;or.removeEventListener("dispose",onTextureDispose);const So=Rn.get(or);void 0!==So&&(Rn.delete(or),So.dispose())}return{get:function(So){if(So&&So.isTexture){const To=So.mapping,Ro=To===dd||To===pd,Uo=To===ud||To===hd;if(Ro||Uo){let To=Rn.get(So);const Oo=void 0!==To?To.texture.pmremVersion:0;if(So.isRenderTargetTexture&&So.pmremVersion!==Oo)return null===or&&(or=new PMREMGenerator(C)),To=Ro?or.fromEquirectangular(So,To):or.fromCubemap(So,To),To.texture.pmremVersion=So.pmremVersion,Rn.set(So,To),To.texture;if(void 0!==To)return To.texture;{const Oo=So.image;return Ro&&Oo&&Oo.height>0||Uo&&Oo&&function(C){let Rn=0;const or=6;for(let So=0;So<or;So++)void 0!==C[So]&&Rn++;return Rn===or}(Oo)?(null===or&&(or=new PMREMGenerator(C)),To=Ro?or.fromEquirectangular(So):or.fromCubemap(So),To.texture.pmremVersion=So.pmremVersion,Rn.set(So,To),So.addEventListener("dispose",onTextureDispose),To.texture):null}}}return So},dispose:function(){Rn=new WeakMap,null!==or&&(or.dispose(),or=null)}}}function WebGLExtensions(C){const Rn={};function getExtension(or){if(void 0!==Rn[or])return Rn[or];let So;switch(or){case"WEBGL_depth_texture":So=C.getExtension("WEBGL_depth_texture")||C.getExtension("MOZ_WEBGL_depth_texture")||C.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":So=C.getExtension("EXT_texture_filter_anisotropic")||C.getExtension("MOZ_EXT_texture_filter_anisotropic")||C.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":So=C.getExtension("WEBGL_compressed_texture_s3tc")||C.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||C.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":So=C.getExtension("WEBGL_compressed_texture_pvrtc")||C.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:So=C.getExtension(or)}return Rn[or]=So,So}return{has:function(C){return null!==getExtension(C)},init:function(){getExtension("EXT_color_buffer_float"),getExtension("WEBGL_clip_cull_distance"),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture"),getExtension("WEBGL_render_shared_exponent")},get:function(C){const Rn=getExtension(C);return null===Rn&&warnOnce("THREE.WebGLRenderer: "+C+" extension not supported."),Rn}}}function WebGLGeometries(C,Rn,or,So){const To={},Ro=new WeakMap;function onGeometryDispose(C){const Uo=C.target;null!==Uo.index&&Rn.remove(Uo.index);for(const or in Uo.attributes)Rn.remove(Uo.attributes[or]);for(const or in Uo.morphAttributes){const C=Uo.morphAttributes[or];for(let or=0,So=C.length;or<So;or++)Rn.remove(C[or])}Uo.removeEventListener("dispose",onGeometryDispose),delete To[Uo.id];const Oo=Ro.get(Uo);Oo&&(Rn.remove(Oo),Ro.delete(Uo)),So.releaseStatesOfGeometry(Uo),!0===Uo.isInstancedBufferGeometry&&delete Uo._maxInstanceCount,or.memory.geometries--}function updateWireframeAttribute(C){const or=[],So=C.index,To=C.attributes.position;let Uo=0;if(null!==So){const C=So.array;Uo=So.version;for(let Rn=0,So=C.length;Rn<So;Rn+=3){const So=C[Rn+0],To=C[Rn+1],Ro=C[Rn+2];or.push(So,To,To,Ro,Ro,So)}}else{if(void 0===To)return;{const C=To.array;Uo=To.version;for(let Rn=0,So=C.length/3-1;Rn<So;Rn+=3){const C=Rn+0,So=Rn+1,To=Rn+2;or.push(C,So,So,To,To,C)}}}const Oo=new(arrayNeedsUint32(or)?Uint32BufferAttribute:Uint16BufferAttribute)(or,1);Oo.version=Uo;const Ho=Ro.get(C);Ho&&Rn.remove(Ho),Ro.set(C,Oo)}return{get:function(C,Rn){return!0===To[Rn.id]||(Rn.addEventListener("dispose",onGeometryDispose),To[Rn.id]=!0,or.memory.geometries++),Rn},update:function(or){const So=or.attributes;for(const Ro in So)Rn.update(So[Ro],C.ARRAY_BUFFER);const To=or.morphAttributes;for(const Ro in To){const or=To[Ro];for(let So=0,To=or.length;So<To;So++)Rn.update(or[So],C.ARRAY_BUFFER)}},getWireframeAttribute:function(C){const Rn=Ro.get(C);if(Rn){const or=C.index;null!==or&&Rn.version<or.version&&updateWireframeAttribute(C)}else updateWireframeAttribute(C);return Ro.get(C)}}}function WebGLIndexedBufferRenderer(C,Rn,or){let So,To,Ro;function renderInstances(Rn,Uo,Oo){0!==Oo&&(C.drawElementsInstanced(So,Uo,To,Rn*Ro,Oo),or.update(Uo,So,Oo))}this.setMode=function(C){So=C},this.setIndex=function(C){To=C.type,Ro=C.bytesPerElement},this.render=function(Rn,Uo){C.drawElements(So,Uo,To,Rn*Ro),or.update(Uo,So,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function(C,Ro,Uo){if(0===Uo)return;Rn.get("WEBGL_multi_draw").multiDrawElementsWEBGL(So,Ro,0,To,C,0,Uo);let Oo=0;for(let Rn=0;Rn<Uo;Rn++)Oo+=Ro[Rn];or.update(Oo,So,1)},this.renderMultiDrawInstances=function(C,Uo,Oo,Ho){if(0===Oo)return;const qo=Rn.get("WEBGL_multi_draw");if(null===qo)for(let Rn=0;Rn<C.length;Rn++)renderInstances(C[Rn]/Ro,Uo[Rn],Ho[Rn]);else{qo.multiDrawElementsInstancedWEBGL(So,Uo,0,To,C,0,Ho,0,Oo);let Rn=0;for(let C=0;C<Oo;C++)Rn+=Uo[C];for(let C=0;C<Ho.length;C++)or.update(Rn,So,Ho[C])}}}function WebGLInfo(C){const Rn={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:Rn,programs:null,autoReset:!0,reset:function(){Rn.calls=0,Rn.triangles=0,Rn.points=0,Rn.lines=0},update:function(or,So,To){switch(Rn.calls++,So){case C.TRIANGLES:Rn.triangles+=To*(or/3);break;case C.LINES:Rn.lines+=To*(or/2);break;case C.LINE_STRIP:Rn.lines+=To*(or-1);break;case C.LINE_LOOP:Rn.lines+=To*or;break;case C.POINTS:Rn.points+=To*or;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",So)}}}}function WebGLMorphtargets(C,Rn,or){const So=new WeakMap,To=new Vector4;return{update:function(Ro,Uo,Oo){const Ho=Ro.morphTargetInfluences,qo=Uo.morphAttributes.position||Uo.morphAttributes.normal||Uo.morphAttributes.color,dl=void 0!==qo?qo.length:0;let ml=So.get(Uo);if(void 0===ml||ml.count!==dl){void 0!==ml&&ml.texture.dispose();const fl=void 0!==Uo.morphAttributes.position,vl=void 0!==Uo.morphAttributes.normal,bl=void 0!==Uo.morphAttributes.color,kl=Uo.morphAttributes.position||[],Ll=Uo.morphAttributes.normal||[],Dl=Uo.morphAttributes.color||[];let Nc=0;!0===fl&&(Nc=1),!0===vl&&(Nc=2),!0===bl&&(Nc=3);let jc=Uo.attributes.position.count*Nc,Zc=1;jc>Rn.maxTextureSize&&(Zc=Math.ceil(jc/Rn.maxTextureSize),jc=Rn.maxTextureSize);const eu=new Float32Array(jc*Zc*4*dl),Ku=new DataArrayTexture(eu,jc,Zc,dl);Ku.type=Cd,Ku.needsUpdate=!0;const Yu=4*Nc;for(let Eh=0;Eh<dl;Eh++){const Th=kl[Eh],Ch=Ll[Eh],Lh=Dl[Eh],Dh=jc*Zc*4*Eh;for(let Rh=0;Rh<Th.count;Rh++){const Nh=Rh*Yu;!0===fl&&(To.fromBufferAttribute(Th,Rh),eu[Dh+Nh+0]=To.x,eu[Dh+Nh+1]=To.y,eu[Dh+Nh+2]=To.z,eu[Dh+Nh+3]=0),!0===vl&&(To.fromBufferAttribute(Ch,Rh),eu[Dh+Nh+4]=To.x,eu[Dh+Nh+5]=To.y,eu[Dh+Nh+6]=To.z,eu[Dh+Nh+7]=0),!0===bl&&(To.fromBufferAttribute(Lh,Rh),eu[Dh+Nh+8]=To.x,eu[Dh+Nh+9]=To.y,eu[Dh+Nh+10]=To.z,eu[Dh+Nh+11]=4===Lh.itemSize?To.w:1)}}function disposeTexture(){Ku.dispose(),So.delete(Uo),Uo.removeEventListener("dispose",disposeTexture)}ml={count:dl,texture:Ku,size:new Vector2(jc,Zc)},So.set(Uo,ml),Uo.addEventListener("dispose",disposeTexture)}if(!0===Ro.isInstancedMesh&&null!==Ro.morphTexture)Oo.getUniforms().setValue(C,"morphTexture",Ro.morphTexture,or);else{let Uh=0;for(let Fh=0;Fh<Ho.length;Fh++)Uh+=Ho[Fh];const Bh=Uo.morphTargetsRelative?1:1-Uh;Oo.getUniforms().setValue(C,"morphTargetBaseInfluence",Bh),Oo.getUniforms().setValue(C,"morphTargetInfluences",Ho)}Oo.getUniforms().setValue(C,"morphTargetsTexture",ml.texture,or),Oo.getUniforms().setValue(C,"morphTargetsTextureSize",ml.size)}}}function WebGLObjects(C,Rn,or,So){let To=new WeakMap;function onInstancedMeshDispose(C){const Rn=C.target;Rn.removeEventListener("dispose",onInstancedMeshDispose),or.remove(Rn.instanceMatrix),null!==Rn.instanceColor&&or.remove(Rn.instanceColor)}return{update:function(Ro){const Uo=So.render.frame,Oo=Ro.geometry,Ho=Rn.get(Ro,Oo);if(To.get(Ho)!==Uo&&(Rn.update(Ho),To.set(Ho,Uo)),Ro.isInstancedMesh&&(!1===Ro.hasEventListener("dispose",onInstancedMeshDispose)&&Ro.addEventListener("dispose",onInstancedMeshDispose),To.get(Ro)!==Uo&&(or.update(Ro.instanceMatrix,C.ARRAY_BUFFER),null!==Ro.instanceColor&&or.update(Ro.instanceColor,C.ARRAY_BUFFER),To.set(Ro,Uo))),Ro.isSkinnedMesh){const C=Ro.skeleton;To.get(C)!==Uo&&(C.update(),To.set(C,Uo))}return Ho},dispose:function(){To=new WeakMap}}}class DepthTexture extends Texture{constructor(C,Rn,or,So,To,Ro,Uo,Oo,Ho,qo){if(void 0===qo&&(qo=Vd),qo!==Vd&&qo!==jd)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===or&&qo===Vd&&(or=Id),void 0===or&&qo===jd&&(or=Dd),super(null,So,To,Ro,Uo,Oo,qo,or,Ho),this.isDepthTexture=!0,this.image={width:C,height:Rn},this.magFilter=void 0!==Uo?Uo:yd,this.minFilter=void 0!==Oo?Oo:yd,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(C){return super.copy(C),this.compareFunction=C.compareFunction,this}toJSON(C){const Rn=super.toJSON(C);return null!==this.compareFunction&&(Rn.compareFunction=this.compareFunction),Rn}}const Ig=new Texture,Cg=new DepthTexture(1,1),Lg=new DataArrayTexture,Pg=new Data3DTexture,zg=new CubeTexture,Dg=[],Rg=[],Ng=new Float32Array(16),Ug=new Float32Array(9),Bg=new Float32Array(4);function flatten(C,Rn,or){const So=C[0];if(So<=0||So>0)return C;const To=Rn*or;let Ro=Dg[To];if(void 0===Ro&&(Ro=new Float32Array(To),Dg[To]=Ro),0!==Rn){So.toArray(Ro,0);for(let So=1,To=0;So!==Rn;++So)To+=or,C[So].toArray(Ro,To)}return Ro}function arraysEqual(C,Rn){if(C.length!==Rn.length)return!1;for(let or=0,So=C.length;or<So;or++)if(C[or]!==Rn[or])return!1;return!0}function copyArray(C,Rn){for(let or=0,So=Rn.length;or<So;or++)C[or]=Rn[or]}function allocTexUnits(C,Rn){let or=Rg[Rn];void 0===or&&(or=new Int32Array(Rn),Rg[Rn]=or);for(let So=0;So!==Rn;++So)or[So]=C.allocateTextureUnit();return or}function setValueV1f(C,Rn){const or=this.cache;or[0]!==Rn&&(C.uniform1f(this.addr,Rn),or[0]=Rn)}function setValueV2f(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y||(C.uniform2f(this.addr,Rn.x,Rn.y),or[0]=Rn.x,or[1]=Rn.y);else{if(arraysEqual(or,Rn))return;C.uniform2fv(this.addr,Rn),copyArray(or,Rn)}}function setValueV3f(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z||(C.uniform3f(this.addr,Rn.x,Rn.y,Rn.z),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z);else if(void 0!==Rn.r)or[0]===Rn.r&&or[1]===Rn.g&&or[2]===Rn.b||(C.uniform3f(this.addr,Rn.r,Rn.g,Rn.b),or[0]=Rn.r,or[1]=Rn.g,or[2]=Rn.b);else{if(arraysEqual(or,Rn))return;C.uniform3fv(this.addr,Rn),copyArray(or,Rn)}}function setValueV4f(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z&&or[3]===Rn.w||(C.uniform4f(this.addr,Rn.x,Rn.y,Rn.z,Rn.w),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z,or[3]=Rn.w);else{if(arraysEqual(or,Rn))return;C.uniform4fv(this.addr,Rn),copyArray(or,Rn)}}function setValueM2(C,Rn){const or=this.cache,So=Rn.elements;if(void 0===So){if(arraysEqual(or,Rn))return;C.uniformMatrix2fv(this.addr,!1,Rn),copyArray(or,Rn)}else{if(arraysEqual(or,So))return;Bg.set(So),C.uniformMatrix2fv(this.addr,!1,Bg),copyArray(or,So)}}function setValueM3(C,Rn){const or=this.cache,So=Rn.elements;if(void 0===So){if(arraysEqual(or,Rn))return;C.uniformMatrix3fv(this.addr,!1,Rn),copyArray(or,Rn)}else{if(arraysEqual(or,So))return;Ug.set(So),C.uniformMatrix3fv(this.addr,!1,Ug),copyArray(or,So)}}function setValueM4(C,Rn){const or=this.cache,So=Rn.elements;if(void 0===So){if(arraysEqual(or,Rn))return;C.uniformMatrix4fv(this.addr,!1,Rn),copyArray(or,Rn)}else{if(arraysEqual(or,So))return;Ng.set(So),C.uniformMatrix4fv(this.addr,!1,Ng),copyArray(or,So)}}function setValueV1i(C,Rn){const or=this.cache;or[0]!==Rn&&(C.uniform1i(this.addr,Rn),or[0]=Rn)}function setValueV2i(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y||(C.uniform2i(this.addr,Rn.x,Rn.y),or[0]=Rn.x,or[1]=Rn.y);else{if(arraysEqual(or,Rn))return;C.uniform2iv(this.addr,Rn),copyArray(or,Rn)}}function setValueV3i(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z||(C.uniform3i(this.addr,Rn.x,Rn.y,Rn.z),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z);else{if(arraysEqual(or,Rn))return;C.uniform3iv(this.addr,Rn),copyArray(or,Rn)}}function setValueV4i(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z&&or[3]===Rn.w||(C.uniform4i(this.addr,Rn.x,Rn.y,Rn.z,Rn.w),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z,or[3]=Rn.w);else{if(arraysEqual(or,Rn))return;C.uniform4iv(this.addr,Rn),copyArray(or,Rn)}}function setValueV1ui(C,Rn){const or=this.cache;or[0]!==Rn&&(C.uniform1ui(this.addr,Rn),or[0]=Rn)}function setValueV2ui(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y||(C.uniform2ui(this.addr,Rn.x,Rn.y),or[0]=Rn.x,or[1]=Rn.y);else{if(arraysEqual(or,Rn))return;C.uniform2uiv(this.addr,Rn),copyArray(or,Rn)}}function setValueV3ui(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z||(C.uniform3ui(this.addr,Rn.x,Rn.y,Rn.z),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z);else{if(arraysEqual(or,Rn))return;C.uniform3uiv(this.addr,Rn),copyArray(or,Rn)}}function setValueV4ui(C,Rn){const or=this.cache;if(void 0!==Rn.x)or[0]===Rn.x&&or[1]===Rn.y&&or[2]===Rn.z&&or[3]===Rn.w||(C.uniform4ui(this.addr,Rn.x,Rn.y,Rn.z,Rn.w),or[0]=Rn.x,or[1]=Rn.y,or[2]=Rn.z,or[3]=Rn.w);else{if(arraysEqual(or,Rn))return;C.uniform4uiv(this.addr,Rn),copyArray(or,Rn)}}function setValueT1(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();let Ro;So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),this.type===C.SAMPLER_2D_SHADOW?(Cg.compareFunction=Kp,Ro=Cg):Ro=Ig,or.setTexture2D(Rn||Ro,To)}function setValueT3D1(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),or.setTexture3D(Rn||Pg,To)}function setValueT6(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),or.setTextureCube(Rn||zg,To)}function setValueT2DArray1(C,Rn,or){const So=this.cache,To=or.allocateTextureUnit();So[0]!==To&&(C.uniform1i(this.addr,To),So[0]=To),or.setTexture2DArray(Rn||Lg,To)}function setValueV1fArray(C,Rn){C.uniform1fv(this.addr,Rn)}function setValueV2fArray(C,Rn){const or=flatten(Rn,this.size,2);C.uniform2fv(this.addr,or)}function setValueV3fArray(C,Rn){const or=flatten(Rn,this.size,3);C.uniform3fv(this.addr,or)}function setValueV4fArray(C,Rn){const or=flatten(Rn,this.size,4);C.uniform4fv(this.addr,or)}function setValueM2Array(C,Rn){const or=flatten(Rn,this.size,4);C.uniformMatrix2fv(this.addr,!1,or)}function setValueM3Array(C,Rn){const or=flatten(Rn,this.size,9);C.uniformMatrix3fv(this.addr,!1,or)}function setValueM4Array(C,Rn){const or=flatten(Rn,this.size,16);C.uniformMatrix4fv(this.addr,!1,or)}function setValueV1iArray(C,Rn){C.uniform1iv(this.addr,Rn)}function setValueV2iArray(C,Rn){C.uniform2iv(this.addr,Rn)}function setValueV3iArray(C,Rn){C.uniform3iv(this.addr,Rn)}function setValueV4iArray(C,Rn){C.uniform4iv(this.addr,Rn)}function setValueV1uiArray(C,Rn){C.uniform1uiv(this.addr,Rn)}function setValueV2uiArray(C,Rn){C.uniform2uiv(this.addr,Rn)}function setValueV3uiArray(C,Rn){C.uniform3uiv(this.addr,Rn)}function setValueV4uiArray(C,Rn){C.uniform4uiv(this.addr,Rn)}function setValueT1Array(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTexture2D(Rn[Uo]||Ig,Ro[Uo])}function setValueT3DArray(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTexture3D(Rn[Uo]||Pg,Ro[Uo])}function setValueT6Array(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTextureCube(Rn[Uo]||zg,Ro[Uo])}function setValueT2DArrayArray(C,Rn,or){const So=this.cache,To=Rn.length,Ro=allocTexUnits(or,To);arraysEqual(So,Ro)||(C.uniform1iv(this.addr,Ro),copyArray(So,Ro));for(let Uo=0;Uo!==To;++Uo)or.setTexture2DArray(Rn[Uo]||Lg,Ro[Uo])}class SingleUniform{constructor(C,Rn,or){this.id=C,this.addr=or,this.cache=[],this.type=Rn.type,this.setValue=function(C){switch(C){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(Rn.type)}}class PureArrayUniform{constructor(C,Rn,or){this.id=C,this.addr=or,this.cache=[],this.type=Rn.type,this.size=Rn.size,this.setValue=function(C){switch(C){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(Rn.type)}}class StructuredUniform{constructor(C){this.id=C,this.seq=[],this.map={}}setValue(C,Rn,or){const So=this.seq;for(let To=0,Ro=So.length;To!==Ro;++To){const Ro=So[To];Ro.setValue(C,Rn[Ro.id],or)}}}const Fg=/(\w+)(\])?(\[|\.)?/g;function addUniform(C,Rn){C.seq.push(Rn),C.map[Rn.id]=Rn}function parseUniform(C,Rn,or){const So=C.name,To=So.length;for(Fg.lastIndex=0;;){const Ro=Fg.exec(So),Uo=Fg.lastIndex;let Oo=Ro[1];const Ho="]"===Ro[2],qo=Ro[3];if(Ho&&(Oo|=0),void 0===qo||"["===qo&&Uo+2===To){addUniform(or,void 0===qo?new SingleUniform(Oo,C,Rn):new PureArrayUniform(Oo,C,Rn));break}{let C=or.map[Oo];void 0===C&&(C=new StructuredUniform(Oo),addUniform(or,C)),or=C}}}class WebGLUniforms{constructor(C,Rn){this.seq=[],this.map={};const or=C.getProgramParameter(Rn,C.ACTIVE_UNIFORMS);for(let So=0;So<or;++So){const or=C.getActiveUniform(Rn,So);parseUniform(or,C.getUniformLocation(Rn,or.name),this)}}setValue(C,Rn,or,So){const To=this.map[Rn];void 0!==To&&To.setValue(C,or,So)}setOptional(C,Rn,or){const So=Rn[or];void 0!==So&&this.setValue(C,or,So)}static upload(C,Rn,or,So){for(let To=0,Ro=Rn.length;To!==Ro;++To){const Ro=Rn[To],Uo=or[Ro.id];!1!==Uo.needsUpdate&&Ro.setValue(C,Uo.value,So)}}static seqWithValue(C,Rn){const or=[];for(let So=0,To=C.length;So!==To;++So){const To=C[So];To.id in Rn&&or.push(To)}return or}}function WebGLShader(C,Rn,or){const So=C.createShader(Rn);return C.shaderSource(So,or),C.compileShader(So),So}const Og=37297;let Vg=0;function getShaderErrors(C,Rn,or){const So=C.getShaderParameter(Rn,C.COMPILE_STATUS),To=C.getShaderInfoLog(Rn).trim();if(So&&""===To)return"";const Ro=/ERROR: 0:(\d+)/.exec(To);if(Ro){const So=parseInt(Ro[1]);return or.toUpperCase()+"\n\n"+To+"\n\n"+function(C,Rn){const or=C.split("\n"),So=[],To=Math.max(Rn-6,0),Ro=Math.min(Rn+6,or.length);for(let Uo=To;Uo<Ro;Uo++){const C=Uo+1;So.push((C===Rn?">":" ")+" "+C+": "+or[Uo])}return So.join("\n")}(C.getShaderSource(Rn),So)}return To}function getTexelEncodingFunction(C,Rn){const or=function(C){const Rn=mm.getPrimaries(mm.workingColorSpace),or=mm.getPrimaries(C);let So;switch(Rn===or?So="":Rn===Gp&&or===jp?So="LinearDisplayP3ToLinearSRGB":Rn===jp&&or===Gp&&(So="LinearSRGBToLinearDisplayP3"),C){case Up:case Fp:return[So,"LinearTransferOETF"];case Np:case Bp:return[So,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",C),[So,"LinearTransferOETF"]}}(Rn);return"vec4 "+C+"( vec4 value ) { return "+or[0]+"( "+or[1]+"( value ) ); }"}function getToneMappingFunction(C,Rn){let or;switch(Rn){case nd:or="Linear";break;case rd:or="Reinhard";break;case ad:or="Cineon";break;case sd:or="ACESFilmic";break;case ld:or="AgX";break;case cd:or="Neutral";break;case od:or="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",Rn),or="Linear"}return"vec3 "+C+"( vec3 color ) { return "+or+"ToneMapping( color ); }"}const jg=new Vector3;function getLuminanceFunction(){mm.getLuminanceCoefficients(jg);return["float luminance( const in vec3 rgb ) {","\tconst vec3 weights = vec3( "+jg.x.toFixed(4)+", "+jg.y.toFixed(4)+", "+jg.z.toFixed(4)+" );","\treturn dot( weights, rgb );","}"].join("\n")}function filterEmptyLine(C){return""!==C}function replaceLightNums(C,Rn){const or=Rn.numSpotLightShadows+Rn.numSpotLightMaps-Rn.numSpotLightShadowsWithMaps;return C.replace(/NUM_DIR_LIGHTS/g,Rn.numDirLights).replace(/NUM_SPOT_LIGHTS/g,Rn.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,Rn.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,or).replace(/NUM_RECT_AREA_LIGHTS/g,Rn.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,Rn.numPointLights).replace(/NUM_HEMI_LIGHTS/g,Rn.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,Rn.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,Rn.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,Rn.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,Rn.numPointLightShadows)}function replaceClippingPlaneNums(C,Rn){return C.replace(/NUM_CLIPPING_PLANES/g,Rn.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Rn.numClippingPlanes-Rn.numClipIntersection)}const Gg=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(C){return C.replace(Gg,includeReplacer)}const Hg=new Map;function includeReplacer(C,Rn){let or=hg[Rn];if(void 0===or){const C=Hg.get(Rn);if(void 0===C)throw new Error("Can not resolve #include <"+Rn+">");or=hg[C],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Rn,C)}return resolveIncludes(or)}const Zg=/#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 unrollLoops(C){return C.replace(Zg,loopReplacer)}function loopReplacer(C,Rn,or,So){let To="";for(let Ro=parseInt(Rn);Ro<parseInt(or);Ro++)To+=So.replace(/\[\s*i\s*\]/g,"[ "+Ro+" ]").replace(/UNROLLED_LOOP_INDEX/g,Ro);return To}function generatePrecision(C){let Rn="precision "+C.precision+" float;\n\tprecision "+C.precision+" int;\n\tprecision "+C.precision+" sampler2D;\n\tprecision "+C.precision+" samplerCube;\n\tprecision "+C.precision+" sampler3D;\n\tprecision "+C.precision+" sampler2DArray;\n\tprecision "+C.precision+" sampler2DShadow;\n\tprecision "+C.precision+" samplerCubeShadow;\n\tprecision "+C.precision+" sampler2DArrayShadow;\n\tprecision "+C.precision+" isampler2D;\n\tprecision "+C.precision+" isampler3D;\n\tprecision "+C.precision+" isamplerCube;\n\tprecision "+C.precision+" isampler2DArray;\n\tprecision "+C.precision+" usampler2D;\n\tprecision "+C.precision+" usampler3D;\n\tprecision "+C.precision+" usamplerCube;\n\tprecision "+C.precision+" usampler2DArray;\n\t";return"highp"===C.precision?Rn+="\n#define HIGH_PRECISION":"mediump"===C.precision?Rn+="\n#define MEDIUM_PRECISION":"lowp"===C.precision&&(Rn+="\n#define LOW_PRECISION"),Rn}function WebGLProgram(C,Rn,or,So){const To=C.getContext(),Ro=or.defines;let Uo=or.vertexShader,dl=or.fragmentShader;const ml=function(C){let Rn="SHADOWMAP_TYPE_BASIC";return C.shadowMapType===Oo?Rn="SHADOWMAP_TYPE_PCF":C.shadowMapType===Ho?Rn="SHADOWMAP_TYPE_PCF_SOFT":C.shadowMapType===qo&&(Rn="SHADOWMAP_TYPE_VSM"),Rn}(or),fl=function(C){let Rn="ENVMAP_TYPE_CUBE";if(C.envMap)switch(C.envMapMode){case ud:case hd:Rn="ENVMAP_TYPE_CUBE";break;case md:Rn="ENVMAP_TYPE_CUBE_UV"}return Rn}(or),vl=function(C){let Rn="ENVMAP_MODE_REFLECTION";C.envMap&&C.envMapMode===hd&&(Rn="ENVMAP_MODE_REFRACTION");return Rn}(or),bl=function(C){let Rn="ENVMAP_BLENDING_NONE";if(C.envMap)switch(C.combine){case $h:Rn="ENVMAP_BLENDING_MULTIPLY";break;case ed:Rn="ENVMAP_BLENDING_MIX";break;case td:Rn="ENVMAP_BLENDING_ADD"}return Rn}(or),kl=function(C){const Rn=C.envMapCubeUVHeight;if(null===Rn)return null;const or=Math.log2(Rn)-2,So=1/Rn;return{texelWidth:1/(3*Math.max(Math.pow(2,or),112)),texelHeight:So,maxMip:or}}(or),Ll=function(C){return[C.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",C.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(filterEmptyLine).join("\n")}(or),Dl=function(C){const Rn=[];for(const or in C){const So=C[or];!1!==So&&Rn.push("#define "+or+" "+So)}return Rn.join("\n")}(Ro),Nc=To.createProgram();let jc,Zc,eu=or.glslVersion?"#version "+or.glslVersion+"\n":"";or.isRawShaderMaterial?(jc=["#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl].filter(filterEmptyLine).join("\n"),jc.length>0&&(jc+="\n"),Zc=["#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl].filter(filterEmptyLine).join("\n"),Zc.length>0&&(Zc+="\n")):(jc=[generatePrecision(or),"#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl,or.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",or.batching?"#define USE_BATCHING":"",or.batchingColor?"#define USE_BATCHING_COLOR":"",or.instancing?"#define USE_INSTANCING":"",or.instancingColor?"#define USE_INSTANCING_COLOR":"",or.instancingMorph?"#define USE_INSTANCING_MORPH":"",or.useFog&&or.fog?"#define USE_FOG":"",or.useFog&&or.fogExp2?"#define FOG_EXP2":"",or.map?"#define USE_MAP":"",or.envMap?"#define USE_ENVMAP":"",or.envMap?"#define "+vl:"",or.lightMap?"#define USE_LIGHTMAP":"",or.aoMap?"#define USE_AOMAP":"",or.bumpMap?"#define USE_BUMPMAP":"",or.normalMap?"#define USE_NORMALMAP":"",or.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",or.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",or.displacementMap?"#define USE_DISPLACEMENTMAP":"",or.emissiveMap?"#define USE_EMISSIVEMAP":"",or.anisotropy?"#define USE_ANISOTROPY":"",or.anisotropyMap?"#define USE_ANISOTROPYMAP":"",or.clearcoatMap?"#define USE_CLEARCOATMAP":"",or.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",or.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",or.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",or.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",or.specularMap?"#define USE_SPECULARMAP":"",or.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",or.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",or.roughnessMap?"#define USE_ROUGHNESSMAP":"",or.metalnessMap?"#define USE_METALNESSMAP":"",or.alphaMap?"#define USE_ALPHAMAP":"",or.alphaHash?"#define USE_ALPHAHASH":"",or.transmission?"#define USE_TRANSMISSION":"",or.transmissionMap?"#define USE_TRANSMISSIONMAP":"",or.thicknessMap?"#define USE_THICKNESSMAP":"",or.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",or.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",or.mapUv?"#define MAP_UV "+or.mapUv:"",or.alphaMapUv?"#define ALPHAMAP_UV "+or.alphaMapUv:"",or.lightMapUv?"#define LIGHTMAP_UV "+or.lightMapUv:"",or.aoMapUv?"#define AOMAP_UV "+or.aoMapUv:"",or.emissiveMapUv?"#define EMISSIVEMAP_UV "+or.emissiveMapUv:"",or.bumpMapUv?"#define BUMPMAP_UV "+or.bumpMapUv:"",or.normalMapUv?"#define NORMALMAP_UV "+or.normalMapUv:"",or.displacementMapUv?"#define DISPLACEMENTMAP_UV "+or.displacementMapUv:"",or.metalnessMapUv?"#define METALNESSMAP_UV "+or.metalnessMapUv:"",or.roughnessMapUv?"#define ROUGHNESSMAP_UV "+or.roughnessMapUv:"",or.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+or.anisotropyMapUv:"",or.clearcoatMapUv?"#define CLEARCOATMAP_UV "+or.clearcoatMapUv:"",or.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+or.clearcoatNormalMapUv:"",or.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+or.clearcoatRoughnessMapUv:"",or.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+or.iridescenceMapUv:"",or.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+or.iridescenceThicknessMapUv:"",or.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+or.sheenColorMapUv:"",or.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+or.sheenRoughnessMapUv:"",or.specularMapUv?"#define SPECULARMAP_UV "+or.specularMapUv:"",or.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+or.specularColorMapUv:"",or.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+or.specularIntensityMapUv:"",or.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+or.transmissionMapUv:"",or.thicknessMapUv?"#define THICKNESSMAP_UV "+or.thicknessMapUv:"",or.vertexTangents&&!1===or.flatShading?"#define USE_TANGENT":"",or.vertexColors?"#define USE_COLOR":"",or.vertexAlphas?"#define USE_COLOR_ALPHA":"",or.vertexUv1s?"#define USE_UV1":"",or.vertexUv2s?"#define USE_UV2":"",or.vertexUv3s?"#define USE_UV3":"",or.pointsUvs?"#define USE_POINTS_UV":"",or.flatShading?"#define FLAT_SHADED":"",or.skinning?"#define USE_SKINNING":"",or.morphTargets?"#define USE_MORPHTARGETS":"",or.morphNormals&&!1===or.flatShading?"#define USE_MORPHNORMALS":"",or.morphColors?"#define USE_MORPHCOLORS":"",or.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+or.morphTextureStride:"",or.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+or.morphTargetsCount:"",or.doubleSided?"#define DOUBLE_SIDED":"",or.flipSided?"#define FLIP_SIDED":"",or.shadowMapEnabled?"#define USE_SHADOWMAP":"",or.shadowMapEnabled?"#define "+ml:"",or.sizeAttenuation?"#define USE_SIZEATTENUATION":"",or.numLightProbes>0?"#define USE_LIGHT_PROBES":"",or.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#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","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),Zc=[generatePrecision(or),"#define SHADER_TYPE "+or.shaderType,"#define SHADER_NAME "+or.shaderName,Dl,or.useFog&&or.fog?"#define USE_FOG":"",or.useFog&&or.fogExp2?"#define FOG_EXP2":"",or.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",or.map?"#define USE_MAP":"",or.matcap?"#define USE_MATCAP":"",or.envMap?"#define USE_ENVMAP":"",or.envMap?"#define "+fl:"",or.envMap?"#define "+vl:"",or.envMap?"#define "+bl:"",kl?"#define CUBEUV_TEXEL_WIDTH "+kl.texelWidth:"",kl?"#define CUBEUV_TEXEL_HEIGHT "+kl.texelHeight:"",kl?"#define CUBEUV_MAX_MIP "+kl.maxMip+".0":"",or.lightMap?"#define USE_LIGHTMAP":"",or.aoMap?"#define USE_AOMAP":"",or.bumpMap?"#define USE_BUMPMAP":"",or.normalMap?"#define USE_NORMALMAP":"",or.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",or.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",or.emissiveMap?"#define USE_EMISSIVEMAP":"",or.anisotropy?"#define USE_ANISOTROPY":"",or.anisotropyMap?"#define USE_ANISOTROPYMAP":"",or.clearcoat?"#define USE_CLEARCOAT":"",or.clearcoatMap?"#define USE_CLEARCOATMAP":"",or.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",or.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",or.dispersion?"#define USE_DISPERSION":"",or.iridescence?"#define USE_IRIDESCENCE":"",or.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",or.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",or.specularMap?"#define USE_SPECULARMAP":"",or.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",or.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",or.roughnessMap?"#define USE_ROUGHNESSMAP":"",or.metalnessMap?"#define USE_METALNESSMAP":"",or.alphaMap?"#define USE_ALPHAMAP":"",or.alphaTest?"#define USE_ALPHATEST":"",or.alphaHash?"#define USE_ALPHAHASH":"",or.sheen?"#define USE_SHEEN":"",or.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",or.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",or.transmission?"#define USE_TRANSMISSION":"",or.transmissionMap?"#define USE_TRANSMISSIONMAP":"",or.thicknessMap?"#define USE_THICKNESSMAP":"",or.vertexTangents&&!1===or.flatShading?"#define USE_TANGENT":"",or.vertexColors||or.instancingColor||or.batchingColor?"#define USE_COLOR":"",or.vertexAlphas?"#define USE_COLOR_ALPHA":"",or.vertexUv1s?"#define USE_UV1":"",or.vertexUv2s?"#define USE_UV2":"",or.vertexUv3s?"#define USE_UV3":"",or.pointsUvs?"#define USE_POINTS_UV":"",or.gradientMap?"#define USE_GRADIENTMAP":"",or.flatShading?"#define FLAT_SHADED":"",or.doubleSided?"#define DOUBLE_SIDED":"",or.flipSided?"#define FLIP_SIDED":"",or.shadowMapEnabled?"#define USE_SHADOWMAP":"",or.shadowMapEnabled?"#define "+ml:"",or.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",or.numLightProbes>0?"#define USE_LIGHT_PROBES":"",or.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",or.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",or.toneMapping!==id?"#define TONE_MAPPING":"",or.toneMapping!==id?hg.tonemapping_pars_fragment:"",or.toneMapping!==id?getToneMappingFunction("toneMapping",or.toneMapping):"",or.dithering?"#define DITHERING":"",or.opaque?"#define OPAQUE":"",hg.colorspace_pars_fragment,getTexelEncodingFunction("linearToOutputTexel",or.outputColorSpace),getLuminanceFunction(),or.useDepthPacking?"#define DEPTH_PACKING "+or.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),Uo=resolveIncludes(Uo),Uo=replaceLightNums(Uo,or),Uo=replaceClippingPlaneNums(Uo,or),dl=resolveIncludes(dl),dl=replaceLightNums(dl,or),dl=replaceClippingPlaneNums(dl,or),Uo=unrollLoops(Uo),dl=unrollLoops(dl),!0!==or.isRawShaderMaterial&&(eu="#version 300 es\n",jc=[Ll,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+jc,Zc=["#define varying in",or.glslVersion===em?"":"layout(location = 0) out highp vec4 pc_fragColor;",or.glslVersion===em?"":"#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"+Zc);const Ku=eu+jc+Uo,Yu=eu+Zc+dl,Eh=WebGLShader(To,To.VERTEX_SHADER,Ku),Th=WebGLShader(To,To.FRAGMENT_SHADER,Yu);function onFirstUse(Rn){if(C.debug.checkShaderErrors){const or=To.getProgramInfoLog(Nc).trim(),So=To.getShaderInfoLog(Eh).trim(),Ro=To.getShaderInfoLog(Th).trim();let Uo=!0,Oo=!0;if(!1===To.getProgramParameter(Nc,To.LINK_STATUS))if(Uo=!1,"function"===typeof C.debug.onShaderError)C.debug.onShaderError(To,Nc,Eh,Th);else{const C=getShaderErrors(To,Eh,"vertex"),So=getShaderErrors(To,Th,"fragment");console.error("THREE.WebGLProgram: Shader Error "+To.getError()+" - VALIDATE_STATUS "+To.getProgramParameter(Nc,To.VALIDATE_STATUS)+"\n\nMaterial Name: "+Rn.name+"\nMaterial Type: "+Rn.type+"\n\nProgram Info Log: "+or+"\n"+C+"\n"+So)}else""!==or?console.warn("THREE.WebGLProgram: Program Info Log:",or):""!==So&&""!==Ro||(Oo=!1);Oo&&(Rn.diagnostics={runnable:Uo,programLog:or,vertexShader:{log:So,prefix:jc},fragmentShader:{log:Ro,prefix:Zc}})}To.deleteShader(Eh),To.deleteShader(Th),Ch=new WebGLUniforms(To,Nc),Lh=function(C,Rn){const or={},So=C.getProgramParameter(Rn,C.ACTIVE_ATTRIBUTES);for(let To=0;To<So;To++){const So=C.getActiveAttrib(Rn,To),Ro=So.name;let Uo=1;So.type===C.FLOAT_MAT2&&(Uo=2),So.type===C.FLOAT_MAT3&&(Uo=3),So.type===C.FLOAT_MAT4&&(Uo=4),or[Ro]={type:So.type,location:C.getAttribLocation(Rn,Ro),locationSize:Uo}}return or}(To,Nc)}let Ch,Lh;To.attachShader(Nc,Eh),To.attachShader(Nc,Th),void 0!==or.index0AttributeName?To.bindAttribLocation(Nc,0,or.index0AttributeName):!0===or.morphTargets&&To.bindAttribLocation(Nc,0,"position"),To.linkProgram(Nc),this.getUniforms=function(){return void 0===Ch&&onFirstUse(this),Ch},this.getAttributes=function(){return void 0===Lh&&onFirstUse(this),Lh};let Dh=!1===or.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===Dh&&(Dh=To.getProgramParameter(Nc,Og)),Dh},this.destroy=function(){So.releaseStatesOfProgram(this),To.deleteProgram(Nc),this.program=void 0},this.type=or.shaderType,this.name=or.shaderName,this.id=Vg++,this.cacheKey=Rn,this.usedTimes=1,this.program=Nc,this.vertexShader=Eh,this.fragmentShader=Th,this}let Wg=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(C){const Rn=C.vertexShader,or=C.fragmentShader,So=this._getShaderStage(Rn),To=this._getShaderStage(or),Ro=this._getShaderCacheForMaterial(C);return!1===Ro.has(So)&&(Ro.add(So),So.usedTimes++),!1===Ro.has(To)&&(Ro.add(To),To.usedTimes++),this}remove(C){const Rn=this.materialCache.get(C);for(const or of Rn)or.usedTimes--,0===or.usedTimes&&this.shaderCache.delete(or.code);return this.materialCache.delete(C),this}getVertexShaderID(C){return this._getShaderStage(C.vertexShader).id}getFragmentShaderID(C){return this._getShaderStage(C.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(C){const Rn=this.materialCache;let or=Rn.get(C);return void 0===or&&(or=new Set,Rn.set(C,or)),or}_getShaderStage(C){const Rn=this.shaderCache;let or=Rn.get(C);return void 0===or&&(or=new WebGLShaderStage(C),Rn.set(C,or)),or}}class WebGLShaderStage{constructor(C){this.id=Wg++,this.code=C,this.usedTimes=0}}function WebGLPrograms(C,Rn,or,So,To,Ro,Uo){const Oo=new Layers,Ho=new WebGLShaderCache,qo=new Set,dl=[],vl=To.logarithmicDepthBuffer,kl=To.vertexTextures;let Ll=To.precision;const Dl={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 getChannel(C){return qo.add(C),0===C?"uv":"uv"+C}return{getParameters:function(Ro,Oo,dl,Nc,jc){const Zc=Nc.fog,eu=jc.geometry,Ku=Ro.isMeshStandardMaterial?Nc.environment:null,Yu=(Ro.isMeshStandardMaterial?or:Rn).get(Ro.envMap||Ku),Eh=Yu&&Yu.mapping===md?Yu.image.height:null,Th=Dl[Ro.type];null!==Ro.precision&&(Ll=To.getMaxPrecision(Ro.precision),Ll!==Ro.precision&&console.warn("THREE.WebGLProgram.getParameters:",Ro.precision,"not supported, using",Ll,"instead."));const Ch=eu.morphAttributes.position||eu.morphAttributes.normal||eu.morphAttributes.color,Lh=void 0!==Ch?Ch.length:0;let Dh,Rh,Nh,Uh,Bh=0;if(void 0!==eu.morphAttributes.position&&(Bh=1),void 0!==eu.morphAttributes.normal&&(Bh=2),void 0!==eu.morphAttributes.color&&(Bh=3),Th){const C=pg[Th];Dh=C.vertexShader,Rh=C.fragmentShader}else Dh=Ro.vertexShader,Rh=Ro.fragmentShader,Ho.update(Ro),Nh=Ho.getVertexShaderID(Ro),Uh=Ho.getFragmentShaderID(Ro);const Fh=C.getRenderTarget(),Oh=!0===jc.isInstancedMesh,Vh=!0===jc.isBatchedMesh,jh=!!Ro.map,Gh=!!Ro.matcap,Hh=!!Yu,Zh=!!Ro.aoMap,Wh=!!Ro.lightMap,qh=!!Ro.bumpMap,Kh=!!Ro.normalMap,Qh=!!Ro.displacementMap,Xh=!!Ro.emissiveMap,Yh=!!Ro.metalnessMap,Jh=!!Ro.roughnessMap,$h=Ro.anisotropy>0,ed=Ro.clearcoat>0,td=Ro.dispersion>0,nd=Ro.iridescence>0,rd=Ro.sheen>0,ad=Ro.transmission>0,sd=$h&&!!Ro.anisotropyMap,od=ed&&!!Ro.clearcoatMap,ld=ed&&!!Ro.clearcoatNormalMap,cd=ed&&!!Ro.clearcoatRoughnessMap,ud=nd&&!!Ro.iridescenceMap,hd=nd&&!!Ro.iridescenceThicknessMap,dd=rd&&!!Ro.sheenColorMap,pd=rd&&!!Ro.sheenRoughnessMap,fd=!!Ro.specularMap,gd=!!Ro.specularColorMap,Ad=!!Ro.specularIntensityMap,yd=ad&&!!Ro.transmissionMap,vd=ad&&!!Ro.thicknessMap,xd=!!Ro.gradientMap,_d=!!Ro.alphaMap,bd=Ro.alphaTest>0,wd=!!Ro.alphaHash,Ed=!!Ro.extensions;let Md=id;Ro.toneMapped&&(null!==Fh&&!0!==Fh.isXRRenderTarget||(Md=C.toneMapping));const Sd={shaderID:Th,shaderType:Ro.type,shaderName:Ro.name,vertexShader:Dh,fragmentShader:Rh,defines:Ro.defines,customVertexShaderID:Nh,customFragmentShaderID:Uh,isRawShaderMaterial:!0===Ro.isRawShaderMaterial,glslVersion:Ro.glslVersion,precision:Ll,batching:Vh,batchingColor:Vh&&null!==jc._colorsTexture,instancing:Oh,instancingColor:Oh&&null!==jc.instanceColor,instancingMorph:Oh&&null!==jc.morphTexture,supportsVertexTextures:kl,outputColorSpace:null===Fh?C.outputColorSpace:!0===Fh.isXRRenderTarget?Fh.texture.colorSpace:Up,alphaToCoverage:!!Ro.alphaToCoverage,map:jh,matcap:Gh,envMap:Hh,envMapMode:Hh&&Yu.mapping,envMapCubeUVHeight:Eh,aoMap:Zh,lightMap:Wh,bumpMap:qh,normalMap:Kh,displacementMap:kl&&Qh,emissiveMap:Xh,normalMapObjectSpace:Kh&&Ro.normalMapType===Dp,normalMapTangentSpace:Kh&&Ro.normalMapType===zp,metalnessMap:Yh,roughnessMap:Jh,anisotropy:$h,anisotropyMap:sd,clearcoat:ed,clearcoatMap:od,clearcoatNormalMap:ld,clearcoatRoughnessMap:cd,dispersion:td,iridescence:nd,iridescenceMap:ud,iridescenceThicknessMap:hd,sheen:rd,sheenColorMap:dd,sheenRoughnessMap:pd,specularMap:fd,specularColorMap:gd,specularIntensityMap:Ad,transmission:ad,transmissionMap:yd,thicknessMap:vd,gradientMap:xd,opaque:!1===Ro.transparent&&Ro.blending===bl&&!1===Ro.alphaToCoverage,alphaMap:_d,alphaTest:bd,alphaHash:wd,combine:Ro.combine,mapUv:jh&&getChannel(Ro.map.channel),aoMapUv:Zh&&getChannel(Ro.aoMap.channel),lightMapUv:Wh&&getChannel(Ro.lightMap.channel),bumpMapUv:qh&&getChannel(Ro.bumpMap.channel),normalMapUv:Kh&&getChannel(Ro.normalMap.channel),displacementMapUv:Qh&&getChannel(Ro.displacementMap.channel),emissiveMapUv:Xh&&getChannel(Ro.emissiveMap.channel),metalnessMapUv:Yh&&getChannel(Ro.metalnessMap.channel),roughnessMapUv:Jh&&getChannel(Ro.roughnessMap.channel),anisotropyMapUv:sd&&getChannel(Ro.anisotropyMap.channel),clearcoatMapUv:od&&getChannel(Ro.clearcoatMap.channel),clearcoatNormalMapUv:ld&&getChannel(Ro.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:cd&&getChannel(Ro.clearcoatRoughnessMap.channel),iridescenceMapUv:ud&&getChannel(Ro.iridescenceMap.channel),iridescenceThicknessMapUv:hd&&getChannel(Ro.iridescenceThicknessMap.channel),sheenColorMapUv:dd&&getChannel(Ro.sheenColorMap.channel),sheenRoughnessMapUv:pd&&getChannel(Ro.sheenRoughnessMap.channel),specularMapUv:fd&&getChannel(Ro.specularMap.channel),specularColorMapUv:gd&&getChannel(Ro.specularColorMap.channel),specularIntensityMapUv:Ad&&getChannel(Ro.specularIntensityMap.channel),transmissionMapUv:yd&&getChannel(Ro.transmissionMap.channel),thicknessMapUv:vd&&getChannel(Ro.thicknessMap.channel),alphaMapUv:_d&&getChannel(Ro.alphaMap.channel),vertexTangents:!!eu.attributes.tangent&&(Kh||$h),vertexColors:Ro.vertexColors,vertexAlphas:!0===Ro.vertexColors&&!!eu.attributes.color&&4===eu.attributes.color.itemSize,pointsUvs:!0===jc.isPoints&&!!eu.attributes.uv&&(jh||_d),fog:!!Zc,useFog:!0===Ro.fog,fogExp2:!!Zc&&Zc.isFogExp2,flatShading:!0===Ro.flatShading,sizeAttenuation:!0===Ro.sizeAttenuation,logarithmicDepthBuffer:vl,skinning:!0===jc.isSkinnedMesh,morphTargets:void 0!==eu.morphAttributes.position,morphNormals:void 0!==eu.morphAttributes.normal,morphColors:void 0!==eu.morphAttributes.color,morphTargetsCount:Lh,morphTextureStride:Bh,numDirLights:Oo.directional.length,numPointLights:Oo.point.length,numSpotLights:Oo.spot.length,numSpotLightMaps:Oo.spotLightMap.length,numRectAreaLights:Oo.rectArea.length,numHemiLights:Oo.hemi.length,numDirLightShadows:Oo.directionalShadowMap.length,numPointLightShadows:Oo.pointShadowMap.length,numSpotLightShadows:Oo.spotShadowMap.length,numSpotLightShadowsWithMaps:Oo.numSpotLightShadowsWithMaps,numLightProbes:Oo.numLightProbes,numClippingPlanes:Uo.numPlanes,numClipIntersection:Uo.numIntersection,dithering:Ro.dithering,shadowMapEnabled:C.shadowMap.enabled&&dl.length>0,shadowMapType:C.shadowMap.type,toneMapping:Md,decodeVideoTexture:jh&&!0===Ro.map.isVideoTexture&&mm.getTransfer(Ro.map.colorSpace)===Vp,premultipliedAlpha:Ro.premultipliedAlpha,doubleSided:Ro.side===fl,flipSided:Ro.side===ml,useDepthPacking:Ro.depthPacking>=0,depthPacking:Ro.depthPacking||0,index0AttributeName:Ro.index0AttributeName,extensionClipCullDistance:Ed&&!0===Ro.extensions.clipCullDistance&&So.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ed&&!0===Ro.extensions.multiDraw||Vh)&&So.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:So.has("KHR_parallel_shader_compile"),customProgramCacheKey:Ro.customProgramCacheKey()};return Sd.vertexUv1s=qo.has(1),Sd.vertexUv2s=qo.has(2),Sd.vertexUv3s=qo.has(3),qo.clear(),Sd},getProgramCacheKey:function(Rn){const or=[];if(Rn.shaderID?or.push(Rn.shaderID):(or.push(Rn.customVertexShaderID),or.push(Rn.customFragmentShaderID)),void 0!==Rn.defines)for(const C in Rn.defines)or.push(C),or.push(Rn.defines[C]);return!1===Rn.isRawShaderMaterial&&(!function(C,Rn){C.push(Rn.precision),C.push(Rn.outputColorSpace),C.push(Rn.envMapMode),C.push(Rn.envMapCubeUVHeight),C.push(Rn.mapUv),C.push(Rn.alphaMapUv),C.push(Rn.lightMapUv),C.push(Rn.aoMapUv),C.push(Rn.bumpMapUv),C.push(Rn.normalMapUv),C.push(Rn.displacementMapUv),C.push(Rn.emissiveMapUv),C.push(Rn.metalnessMapUv),C.push(Rn.roughnessMapUv),C.push(Rn.anisotropyMapUv),C.push(Rn.clearcoatMapUv),C.push(Rn.clearcoatNormalMapUv),C.push(Rn.clearcoatRoughnessMapUv),C.push(Rn.iridescenceMapUv),C.push(Rn.iridescenceThicknessMapUv),C.push(Rn.sheenColorMapUv),C.push(Rn.sheenRoughnessMapUv),C.push(Rn.specularMapUv),C.push(Rn.specularColorMapUv),C.push(Rn.specularIntensityMapUv),C.push(Rn.transmissionMapUv),C.push(Rn.thicknessMapUv),C.push(Rn.combine),C.push(Rn.fogExp2),C.push(Rn.sizeAttenuation),C.push(Rn.morphTargetsCount),C.push(Rn.morphAttributeCount),C.push(Rn.numDirLights),C.push(Rn.numPointLights),C.push(Rn.numSpotLights),C.push(Rn.numSpotLightMaps),C.push(Rn.numHemiLights),C.push(Rn.numRectAreaLights),C.push(Rn.numDirLightShadows),C.push(Rn.numPointLightShadows),C.push(Rn.numSpotLightShadows),C.push(Rn.numSpotLightShadowsWithMaps),C.push(Rn.numLightProbes),C.push(Rn.shadowMapType),C.push(Rn.toneMapping),C.push(Rn.numClippingPlanes),C.push(Rn.numClipIntersection),C.push(Rn.depthPacking)}(or,Rn),function(C,Rn){Oo.disableAll(),Rn.supportsVertexTextures&&Oo.enable(0);Rn.instancing&&Oo.enable(1);Rn.instancingColor&&Oo.enable(2);Rn.instancingMorph&&Oo.enable(3);Rn.matcap&&Oo.enable(4);Rn.envMap&&Oo.enable(5);Rn.normalMapObjectSpace&&Oo.enable(6);Rn.normalMapTangentSpace&&Oo.enable(7);Rn.clearcoat&&Oo.enable(8);Rn.iridescence&&Oo.enable(9);Rn.alphaTest&&Oo.enable(10);Rn.vertexColors&&Oo.enable(11);Rn.vertexAlphas&&Oo.enable(12);Rn.vertexUv1s&&Oo.enable(13);Rn.vertexUv2s&&Oo.enable(14);Rn.vertexUv3s&&Oo.enable(15);Rn.vertexTangents&&Oo.enable(16);Rn.anisotropy&&Oo.enable(17);Rn.alphaHash&&Oo.enable(18);Rn.batching&&Oo.enable(19);Rn.dispersion&&Oo.enable(20);Rn.batchingColor&&Oo.enable(21);C.push(Oo.mask),Oo.disableAll(),Rn.fog&&Oo.enable(0);Rn.useFog&&Oo.enable(1);Rn.flatShading&&Oo.enable(2);Rn.logarithmicDepthBuffer&&Oo.enable(3);Rn.skinning&&Oo.enable(4);Rn.morphTargets&&Oo.enable(5);Rn.morphNormals&&Oo.enable(6);Rn.morphColors&&Oo.enable(7);Rn.premultipliedAlpha&&Oo.enable(8);Rn.shadowMapEnabled&&Oo.enable(9);Rn.doubleSided&&Oo.enable(10);Rn.flipSided&&Oo.enable(11);Rn.useDepthPacking&&Oo.enable(12);Rn.dithering&&Oo.enable(13);Rn.transmission&&Oo.enable(14);Rn.sheen&&Oo.enable(15);Rn.opaque&&Oo.enable(16);Rn.pointsUvs&&Oo.enable(17);Rn.decodeVideoTexture&&Oo.enable(18);Rn.alphaToCoverage&&Oo.enable(19);C.push(Oo.mask)}(or,Rn),or.push(C.outputColorSpace)),or.push(Rn.customProgramCacheKey),or.join()},getUniforms:function(C){const Rn=Dl[C.type];let or;if(Rn){const C=pg[Rn];or=tg.clone(C.uniforms)}else or=C.uniforms;return or},acquireProgram:function(Rn,or){let So;for(let C=0,To=dl.length;C<To;C++){const Rn=dl[C];if(Rn.cacheKey===or){So=Rn,++So.usedTimes;break}}return void 0===So&&(So=new WebGLProgram(C,or,Rn,Ro),dl.push(So)),So},releaseProgram:function(C){if(0===--C.usedTimes){const Rn=dl.indexOf(C);dl[Rn]=dl[dl.length-1],dl.pop(),C.destroy()}},releaseShaderCache:function(C){Ho.remove(C)},programs:dl,dispose:function(){Ho.dispose()}}}function WebGLProperties(){let C=new WeakMap;return{has:function(Rn){return C.has(Rn)},get:function(Rn){let or=C.get(Rn);return void 0===or&&(or={},C.set(Rn,or)),or},remove:function(Rn){C.delete(Rn)},update:function(Rn,or,So){C.get(Rn)[or]=So},dispose:function(){C=new WeakMap}}}function painterSortStable(C,Rn){return C.groupOrder!==Rn.groupOrder?C.groupOrder-Rn.groupOrder:C.renderOrder!==Rn.renderOrder?C.renderOrder-Rn.renderOrder:C.material.id!==Rn.material.id?C.material.id-Rn.material.id:C.z!==Rn.z?C.z-Rn.z:C.id-Rn.id}function reversePainterSortStable(C,Rn){return C.groupOrder!==Rn.groupOrder?C.groupOrder-Rn.groupOrder:C.renderOrder!==Rn.renderOrder?C.renderOrder-Rn.renderOrder:C.z!==Rn.z?Rn.z-C.z:C.id-Rn.id}function WebGLRenderList(){const C=[];let Rn=0;const or=[],So=[],To=[];function getNextRenderItem(or,So,To,Ro,Uo,Oo){let Ho=C[Rn];return void 0===Ho?(Ho={id:or.id,object:or,geometry:So,material:To,groupOrder:Ro,renderOrder:or.renderOrder,z:Uo,group:Oo},C[Rn]=Ho):(Ho.id=or.id,Ho.object=or,Ho.geometry=So,Ho.material=To,Ho.groupOrder=Ro,Ho.renderOrder=or.renderOrder,Ho.z=Uo,Ho.group=Oo),Rn++,Ho}return{opaque:or,transmissive:So,transparent:To,init:function(){Rn=0,or.length=0,So.length=0,To.length=0},push:function(C,Rn,Ro,Uo,Oo,Ho){const qo=getNextRenderItem(C,Rn,Ro,Uo,Oo,Ho);Ro.transmission>0?So.push(qo):!0===Ro.transparent?To.push(qo):or.push(qo)},unshift:function(C,Rn,Ro,Uo,Oo,Ho){const qo=getNextRenderItem(C,Rn,Ro,Uo,Oo,Ho);Ro.transmission>0?So.unshift(qo):!0===Ro.transparent?To.unshift(qo):or.unshift(qo)},finish:function(){for(let or=Rn,So=C.length;or<So;or++){const Rn=C[or];if(null===Rn.id)break;Rn.id=null,Rn.object=null,Rn.geometry=null,Rn.material=null,Rn.group=null}},sort:function(C,Rn){or.length>1&&or.sort(C||painterSortStable),So.length>1&&So.sort(Rn||reversePainterSortStable),To.length>1&&To.sort(Rn||reversePainterSortStable)}}}function WebGLRenderLists(){let C=new WeakMap;return{get:function(Rn,or){const So=C.get(Rn);let To;return void 0===So?(To=new WebGLRenderList,C.set(Rn,[To])):or>=So.length?(To=new WebGLRenderList,So.push(To)):To=So[or],To},dispose:function(){C=new WeakMap}}}function UniformsCache(){const C={};return{get:function(Rn){if(void 0!==C[Rn.id])return C[Rn.id];let or;switch(Rn.type){case"DirectionalLight":or={direction:new Vector3,color:new Color};break;case"SpotLight":or={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":or={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":or={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":or={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3}}return C[Rn.id]=or,or}}}let qg=0;function shadowCastingAndTexturingLightsFirst(C,Rn){return(Rn.castShadow?2:0)-(C.castShadow?2:0)+(Rn.map?1:0)-(C.map?1:0)}function WebGLLights(C){const Rn=new UniformsCache,or=function(){const C={};return{get:function(Rn){if(void 0!==C[Rn.id])return C[Rn.id];let or;switch(Rn.type){case"DirectionalLight":case"SpotLight":or={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":or={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return C[Rn.id]=or,or}}}(),So={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 Oo=0;Oo<9;Oo++)So.probe.push(new Vector3);const To=new Vector3,Ro=new Matrix4,Uo=new Matrix4;return{setup:function(To){let Ro=0,Uo=0,Oo=0;for(let C=0;C<9;C++)So.probe[C].set(0,0,0);let Ho=0,qo=0,dl=0,ml=0,fl=0,vl=0,bl=0,kl=0,Ll=0,Dl=0,Nc=0;To.sort(shadowCastingAndTexturingLightsFirst);for(let C=0,Zc=To.length;C<Zc;C++){const jc=To[C],Zc=jc.color,eu=jc.intensity,Ku=jc.distance,Yu=jc.shadow&&jc.shadow.map?jc.shadow.map.texture:null;if(jc.isAmbientLight)Ro+=Zc.r*eu,Uo+=Zc.g*eu,Oo+=Zc.b*eu;else if(jc.isLightProbe){for(let C=0;C<9;C++)So.probe[C].addScaledVector(jc.sh.coefficients[C],eu);Nc++}else if(jc.isDirectionalLight){const C=Rn.get(jc);if(C.color.copy(jc.color).multiplyScalar(jc.intensity),jc.castShadow){const C=jc.shadow,Rn=or.get(jc);Rn.shadowIntensity=C.intensity,Rn.shadowBias=C.bias,Rn.shadowNormalBias=C.normalBias,Rn.shadowRadius=C.radius,Rn.shadowMapSize=C.mapSize,So.directionalShadow[Ho]=Rn,So.directionalShadowMap[Ho]=Yu,So.directionalShadowMatrix[Ho]=jc.shadow.matrix,vl++}So.directional[Ho]=C,Ho++}else if(jc.isSpotLight){const C=Rn.get(jc);C.position.setFromMatrixPosition(jc.matrixWorld),C.color.copy(Zc).multiplyScalar(eu),C.distance=Ku,C.coneCos=Math.cos(jc.angle),C.penumbraCos=Math.cos(jc.angle*(1-jc.penumbra)),C.decay=jc.decay,So.spot[dl]=C;const To=jc.shadow;if(jc.map&&(So.spotLightMap[Ll]=jc.map,Ll++,To.updateMatrices(jc),jc.castShadow&&Dl++),So.spotLightMatrix[dl]=To.matrix,jc.castShadow){const C=or.get(jc);C.shadowIntensity=To.intensity,C.shadowBias=To.bias,C.shadowNormalBias=To.normalBias,C.shadowRadius=To.radius,C.shadowMapSize=To.mapSize,So.spotShadow[dl]=C,So.spotShadowMap[dl]=Yu,kl++}dl++}else if(jc.isRectAreaLight){const C=Rn.get(jc);C.color.copy(Zc).multiplyScalar(eu),C.halfWidth.set(.5*jc.width,0,0),C.halfHeight.set(0,.5*jc.height,0),So.rectArea[ml]=C,ml++}else if(jc.isPointLight){const C=Rn.get(jc);if(C.color.copy(jc.color).multiplyScalar(jc.intensity),C.distance=jc.distance,C.decay=jc.decay,jc.castShadow){const C=jc.shadow,Rn=or.get(jc);Rn.shadowIntensity=C.intensity,Rn.shadowBias=C.bias,Rn.shadowNormalBias=C.normalBias,Rn.shadowRadius=C.radius,Rn.shadowMapSize=C.mapSize,Rn.shadowCameraNear=C.camera.near,Rn.shadowCameraFar=C.camera.far,So.pointShadow[qo]=Rn,So.pointShadowMap[qo]=Yu,So.pointShadowMatrix[qo]=jc.shadow.matrix,bl++}So.point[qo]=C,qo++}else if(jc.isHemisphereLight){const C=Rn.get(jc);C.skyColor.copy(jc.color).multiplyScalar(eu),C.groundColor.copy(jc.groundColor).multiplyScalar(eu),So.hemi[fl]=C,fl++}}ml>0&&(!0===C.has("OES_texture_float_linear")?(So.rectAreaLTC1=dg.LTC_FLOAT_1,So.rectAreaLTC2=dg.LTC_FLOAT_2):(So.rectAreaLTC1=dg.LTC_HALF_1,So.rectAreaLTC2=dg.LTC_HALF_2)),So.ambient[0]=Ro,So.ambient[1]=Uo,So.ambient[2]=Oo;const jc=So.hash;jc.directionalLength===Ho&&jc.pointLength===qo&&jc.spotLength===dl&&jc.rectAreaLength===ml&&jc.hemiLength===fl&&jc.numDirectionalShadows===vl&&jc.numPointShadows===bl&&jc.numSpotShadows===kl&&jc.numSpotMaps===Ll&&jc.numLightProbes===Nc||(So.directional.length=Ho,So.spot.length=dl,So.rectArea.length=ml,So.point.length=qo,So.hemi.length=fl,So.directionalShadow.length=vl,So.directionalShadowMap.length=vl,So.pointShadow.length=bl,So.pointShadowMap.length=bl,So.spotShadow.length=kl,So.spotShadowMap.length=kl,So.directionalShadowMatrix.length=vl,So.pointShadowMatrix.length=bl,So.spotLightMatrix.length=kl+Ll-Dl,So.spotLightMap.length=Ll,So.numSpotLightShadowsWithMaps=Dl,So.numLightProbes=Nc,jc.directionalLength=Ho,jc.pointLength=qo,jc.spotLength=dl,jc.rectAreaLength=ml,jc.hemiLength=fl,jc.numDirectionalShadows=vl,jc.numPointShadows=bl,jc.numSpotShadows=kl,jc.numSpotMaps=Ll,jc.numLightProbes=Nc,So.version=qg++)},setupView:function(C,Rn){let or=0,Oo=0,Ho=0,qo=0,dl=0;const ml=Rn.matrixWorldInverse;for(let fl=0,vl=C.length;fl<vl;fl++){const Rn=C[fl];if(Rn.isDirectionalLight){const C=So.directional[or];C.direction.setFromMatrixPosition(Rn.matrixWorld),To.setFromMatrixPosition(Rn.target.matrixWorld),C.direction.sub(To),C.direction.transformDirection(ml),or++}else if(Rn.isSpotLight){const C=So.spot[Ho];C.position.setFromMatrixPosition(Rn.matrixWorld),C.position.applyMatrix4(ml),C.direction.setFromMatrixPosition(Rn.matrixWorld),To.setFromMatrixPosition(Rn.target.matrixWorld),C.direction.sub(To),C.direction.transformDirection(ml),Ho++}else if(Rn.isRectAreaLight){const C=So.rectArea[qo];C.position.setFromMatrixPosition(Rn.matrixWorld),C.position.applyMatrix4(ml),Uo.identity(),Ro.copy(Rn.matrixWorld),Ro.premultiply(ml),Uo.extractRotation(Ro),C.halfWidth.set(.5*Rn.width,0,0),C.halfHeight.set(0,.5*Rn.height,0),C.halfWidth.applyMatrix4(Uo),C.halfHeight.applyMatrix4(Uo),qo++}else if(Rn.isPointLight){const C=So.point[Oo];C.position.setFromMatrixPosition(Rn.matrixWorld),C.position.applyMatrix4(ml),Oo++}else if(Rn.isHemisphereLight){const C=So.hemi[dl];C.direction.setFromMatrixPosition(Rn.matrixWorld),C.direction.transformDirection(ml),dl++}}},state:So}}function WebGLRenderState(C){const Rn=new WebGLLights(C),or=[],So=[];const To={lightsArray:or,shadowsArray:So,camera:null,lights:Rn,transmissionRenderTarget:{}};return{init:function(C){To.camera=C,or.length=0,So.length=0},state:To,setupLights:function(){Rn.setup(or)},setupLightsView:function(C){Rn.setupView(or,C)},pushLight:function(C){or.push(C)},pushShadow:function(C){So.push(C)}}}function WebGLRenderStates(C){let Rn=new WeakMap;return{get:function(or,So){void 0===So&&(So=0);const To=Rn.get(or);let Ro;return void 0===To?(Ro=new WebGLRenderState(C),Rn.set(or,[Ro])):So>=To.length?(Ro=new WebGLRenderState(C),To.push(Ro)):Ro=To[So],Ro},dispose:function(){Rn=new WeakMap}}}class MeshDepthMaterial extends Material{constructor(C){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(C)}copy(C){return super.copy(C),this.depthPacking=C.depthPacking,this.map=C.map,this.alphaMap=C.alphaMap,this.displacementMap=C.displacementMap,this.displacementScale=C.displacementScale,this.displacementBias=C.displacementBias,this.wireframe=C.wireframe,this.wireframeLinewidth=C.wireframeLinewidth,this}}class MeshDistanceMaterial extends Material{constructor(C){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(C)}copy(C){return super.copy(C),this.map=C.map,this.alphaMap=C.alphaMap,this.displacementMap=C.displacementMap,this.displacementScale=C.displacementScale,this.displacementBias=C.displacementBias,this}}const Kg="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Qg="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}";function WebGLShadowMap(C,Rn,or){let So=new Frustum;const To=new Vector2,Ro=new Vector2,Uo=new Vector4,Ho=new MeshDepthMaterial({depthPacking:Pp}),bl=new MeshDistanceMaterial,kl={},Ll=or.maxTextureSize,Dl={[dl]:ml,[ml]:dl,[fl]:fl},Nc=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:Kg,fragmentShader:Qg}),jc=Nc.clone();jc.defines.HORIZONTAL_PASS=1;const Zc=new BufferGeometry;Zc.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const eu=new Mesh(Zc,Nc),Ku=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Oo;let Yu=this.type;function VSMPass(or,So){const Ro=Rn.update(eu);Nc.defines.VSM_SAMPLES!==or.blurSamples&&(Nc.defines.VSM_SAMPLES=or.blurSamples,jc.defines.VSM_SAMPLES=or.blurSamples,Nc.needsUpdate=!0,jc.needsUpdate=!0),null===or.mapPass&&(or.mapPass=new WebGLRenderTarget(To.x,To.y)),Nc.uniforms.shadow_pass.value=or.map.texture,Nc.uniforms.resolution.value=or.mapSize,Nc.uniforms.radius.value=or.radius,C.setRenderTarget(or.mapPass),C.clear(),C.renderBufferDirect(So,null,Ro,Nc,eu,null),jc.uniforms.shadow_pass.value=or.mapPass.texture,jc.uniforms.resolution.value=or.mapSize,jc.uniforms.radius.value=or.radius,C.setRenderTarget(or.map),C.clear(),C.renderBufferDirect(So,null,Ro,jc,eu,null)}function getDepthMaterial(Rn,or,So,To){let Ro=null;const Uo=!0===So.isPointLight?Rn.customDistanceMaterial:Rn.customDepthMaterial;if(void 0!==Uo)Ro=Uo;else if(Ro=!0===So.isPointLight?bl:Ho,C.localClippingEnabled&&!0===or.clipShadows&&Array.isArray(or.clippingPlanes)&&0!==or.clippingPlanes.length||or.displacementMap&&0!==or.displacementScale||or.alphaMap&&or.alphaTest>0||or.map&&or.alphaTest>0){const C=Ro.uuid,Rn=or.uuid;let So=kl[C];void 0===So&&(So={},kl[C]=So);let To=So[Rn];void 0===To&&(To=Ro.clone(),So[Rn]=To,or.addEventListener("dispose",onMaterialDispose)),Ro=To}if(Ro.visible=or.visible,Ro.wireframe=or.wireframe,Ro.side=To===qo?null!==or.shadowSide?or.shadowSide:or.side:null!==or.shadowSide?or.shadowSide:Dl[or.side],Ro.alphaMap=or.alphaMap,Ro.alphaTest=or.alphaTest,Ro.map=or.map,Ro.clipShadows=or.clipShadows,Ro.clippingPlanes=or.clippingPlanes,Ro.clipIntersection=or.clipIntersection,Ro.displacementMap=or.displacementMap,Ro.displacementScale=or.displacementScale,Ro.displacementBias=or.displacementBias,Ro.wireframeLinewidth=or.wireframeLinewidth,Ro.linewidth=or.linewidth,!0===So.isPointLight&&!0===Ro.isMeshDistanceMaterial){C.properties.get(Ro).light=So}return Ro}function renderObject(or,To,Ro,Uo,Oo){if(!1===or.visible)return;if(or.layers.test(To.layers)&&(or.isMesh||or.isLine||or.isPoints)&&(or.castShadow||or.receiveShadow&&Oo===qo)&&(!or.frustumCulled||So.intersectsObject(or))){or.modelViewMatrix.multiplyMatrices(Ro.matrixWorldInverse,or.matrixWorld);const So=Rn.update(or),Ho=or.material;if(Array.isArray(Ho)){const Rn=So.groups;for(let qo=0,dl=Rn.length;qo<dl;qo++){const dl=Rn[qo],ml=Ho[dl.materialIndex];if(ml&&ml.visible){const Rn=getDepthMaterial(or,ml,Uo,Oo);or.onBeforeShadow(C,or,To,Ro,So,Rn,dl),C.renderBufferDirect(Ro,null,So,Rn,or,dl),or.onAfterShadow(C,or,To,Ro,So,Rn,dl)}}}else if(Ho.visible){const Rn=getDepthMaterial(or,Ho,Uo,Oo);or.onBeforeShadow(C,or,To,Ro,So,Rn,null),C.renderBufferDirect(Ro,null,So,Rn,or,null),or.onAfterShadow(C,or,To,Ro,So,Rn,null)}}const Ho=or.children;for(let C=0,Rn=Ho.length;C<Rn;C++)renderObject(Ho[C],To,Ro,Uo,Oo)}function onMaterialDispose(C){C.target.removeEventListener("dispose",onMaterialDispose);for(const Rn in kl){const or=kl[Rn],So=C.target.uuid;if(So in or){or[So].dispose(),delete or[So]}}}this.render=function(Rn,or,Oo){if(!1===Ku.enabled)return;if(!1===Ku.autoUpdate&&!1===Ku.needsUpdate)return;if(0===Rn.length)return;const Ho=C.getRenderTarget(),dl=C.getActiveCubeFace(),ml=C.getActiveMipmapLevel(),fl=C.state;fl.setBlending(vl),fl.buffers.color.setClear(1,1,1,1),fl.buffers.depth.setTest(!0),fl.setScissorTest(!1);const bl=Yu!==qo&&this.type===qo,kl=Yu===qo&&this.type!==qo;for(let vl=0,Dl=Rn.length;vl<Dl;vl++){const Ho=Rn[vl],dl=Ho.shadow;if(void 0===dl){console.warn("THREE.WebGLShadowMap:",Ho,"has no shadow.");continue}if(!1===dl.autoUpdate&&!1===dl.needsUpdate)continue;To.copy(dl.mapSize);const ml=dl.getFrameExtents();if(To.multiply(ml),Ro.copy(dl.mapSize),(To.x>Ll||To.y>Ll)&&(To.x>Ll&&(Ro.x=Math.floor(Ll/ml.x),To.x=Ro.x*ml.x,dl.mapSize.x=Ro.x),To.y>Ll&&(Ro.y=Math.floor(Ll/ml.y),To.y=Ro.y*ml.y,dl.mapSize.y=Ro.y)),null===dl.map||!0===bl||!0===kl){const C=this.type!==qo?{minFilter:yd,magFilter:yd}:{};null!==dl.map&&dl.map.dispose(),dl.map=new WebGLRenderTarget(To.x,To.y,C),dl.map.texture.name=Ho.name+".shadowMap",dl.camera.updateProjectionMatrix()}C.setRenderTarget(dl.map),C.clear();const Dl=dl.getViewportCount();for(let C=0;C<Dl;C++){const Rn=dl.getViewport(C);Uo.set(Ro.x*Rn.x,Ro.y*Rn.y,Ro.x*Rn.z,Ro.y*Rn.w),fl.viewport(Uo),dl.updateMatrices(Ho,C),So=dl.getFrustum(),renderObject(or,Oo,dl.camera,Ho,this.type)}!0!==dl.isPointLightShadow&&this.type===qo&&VSMPass(dl,Oo),dl.needsUpdate=!1}Yu=this.type,Ku.needsUpdate=!1,C.setRenderTarget(Ho,dl,ml)}}function WebGLState(C){const Rn=new function(){let Rn=!1;const or=new Vector4;let So=null;const To=new Vector4(0,0,0,0);return{setMask:function(or){So===or||Rn||(C.colorMask(or,or,or,or),So=or)},setLocked:function(C){Rn=C},setClear:function(Rn,So,Ro,Uo,Oo){!0===Oo&&(Rn*=Uo,So*=Uo,Ro*=Uo),or.set(Rn,So,Ro,Uo),!1===To.equals(or)&&(C.clearColor(Rn,So,Ro,Uo),To.copy(or))},reset:function(){Rn=!1,So=null,To.set(-1,0,0,0)}}},or=new function(){let Rn=!1,or=null,So=null,To=null;return{setTest:function(Rn){Rn?enable(C.DEPTH_TEST):disable(C.DEPTH_TEST)},setMask:function(So){or===So||Rn||(C.depthMask(So),or=So)},setFunc:function(Rn){if(So!==Rn){switch(Rn){case Zh:C.depthFunc(C.NEVER);break;case Wh:C.depthFunc(C.ALWAYS);break;case qh:C.depthFunc(C.LESS);break;case Kh:C.depthFunc(C.LEQUAL);break;case Qh:C.depthFunc(C.EQUAL);break;case Xh:C.depthFunc(C.GEQUAL);break;case Yh:C.depthFunc(C.GREATER);break;case Jh:C.depthFunc(C.NOTEQUAL);break;default:C.depthFunc(C.LEQUAL)}So=Rn}},setLocked:function(C){Rn=C},setClear:function(Rn){To!==Rn&&(C.clearDepth(Rn),To=Rn)},reset:function(){Rn=!1,or=null,So=null,To=null}}},So=new function(){let Rn=!1,or=null,So=null,To=null,Ro=null,Uo=null,Oo=null,Ho=null,qo=null;return{setTest:function(or){Rn||(or?enable(C.STENCIL_TEST):disable(C.STENCIL_TEST))},setMask:function(So){or===So||Rn||(C.stencilMask(So),or=So)},setFunc:function(Rn,or,Uo){So===Rn&&To===or&&Ro===Uo||(C.stencilFunc(Rn,or,Uo),So=Rn,To=or,Ro=Uo)},setOp:function(Rn,or,So){Uo===Rn&&Oo===or&&Ho===So||(C.stencilOp(Rn,or,So),Uo=Rn,Oo=or,Ho=So)},setLocked:function(C){Rn=C},setClear:function(Rn){qo!==Rn&&(C.clearStencil(Rn),qo=Rn)},reset:function(){Rn=!1,or=null,So=null,To=null,Ro=null,Uo=null,Oo=null,Ho=null,qo=null}}},Oo=new WeakMap,Ho=new WeakMap;let qo={},dl={},$h=new WeakMap,ed=[],td=null,id=!1,nd=null,rd=null,ad=null,sd=null,od=null,ld=null,cd=null,ud=new Color(0,0,0),hd=0,dd=!1,pd=null,md=null,fd=null,gd=null,Ad=null;const yd=C.getParameter(C.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let vd=!1,xd=0;const _d=C.getParameter(C.VERSION);-1!==_d.indexOf("WebGL")?(xd=parseFloat(/^WebGL (\d)/.exec(_d)[1]),vd=xd>=1):-1!==_d.indexOf("OpenGL ES")&&(xd=parseFloat(/^OpenGL ES (\d)/.exec(_d)[1]),vd=xd>=2);let bd=null,wd={};const Ed=C.getParameter(C.SCISSOR_BOX),Md=C.getParameter(C.VIEWPORT),Sd=(new Vector4).fromArray(Ed),kd=(new Vector4).fromArray(Md);function createTexture(Rn,or,So,To){const Ro=new Uint8Array(4),Uo=C.createTexture();C.bindTexture(Rn,Uo),C.texParameteri(Rn,C.TEXTURE_MIN_FILTER,C.NEAREST),C.texParameteri(Rn,C.TEXTURE_MAG_FILTER,C.NEAREST);for(let Oo=0;Oo<So;Oo++)Rn===C.TEXTURE_3D||Rn===C.TEXTURE_2D_ARRAY?C.texImage3D(or,0,C.RGBA,1,1,To,0,C.RGBA,C.UNSIGNED_BYTE,Ro):C.texImage2D(or+Oo,0,C.RGBA,1,1,0,C.RGBA,C.UNSIGNED_BYTE,Ro);return Uo}const Td={};function enable(Rn){!0!==qo[Rn]&&(C.enable(Rn),qo[Rn]=!0)}function disable(Rn){!1!==qo[Rn]&&(C.disable(Rn),qo[Rn]=!1)}Td[C.TEXTURE_2D]=createTexture(C.TEXTURE_2D,C.TEXTURE_2D,1),Td[C.TEXTURE_CUBE_MAP]=createTexture(C.TEXTURE_CUBE_MAP,C.TEXTURE_CUBE_MAP_POSITIVE_X,6),Td[C.TEXTURE_2D_ARRAY]=createTexture(C.TEXTURE_2D_ARRAY,C.TEXTURE_2D_ARRAY,1,1),Td[C.TEXTURE_3D]=createTexture(C.TEXTURE_3D,C.TEXTURE_3D,1,1),Rn.setClear(0,0,0,1),or.setClear(1),So.setClear(0),enable(C.DEPTH_TEST),or.setFunc(Kh),setFlipSided(!1),setCullFace(Ro),enable(C.CULL_FACE),setBlending(vl);const Id={[jc]:C.FUNC_ADD,[Zc]:C.FUNC_SUBTRACT,[eu]:C.FUNC_REVERSE_SUBTRACT};Id[Ku]=C.MIN,Id[Yu]=C.MAX;const Cd={[Eh]:C.ZERO,[Th]:C.ONE,[Ch]:C.SRC_COLOR,[Dh]:C.SRC_ALPHA,[Oh]:C.SRC_ALPHA_SATURATE,[Bh]:C.DST_COLOR,[Nh]:C.DST_ALPHA,[Lh]:C.ONE_MINUS_SRC_COLOR,[Rh]:C.ONE_MINUS_SRC_ALPHA,[Fh]:C.ONE_MINUS_DST_COLOR,[Uh]:C.ONE_MINUS_DST_ALPHA,[Vh]:C.CONSTANT_COLOR,[jh]:C.ONE_MINUS_CONSTANT_COLOR,[Gh]:C.CONSTANT_ALPHA,[Hh]:C.ONE_MINUS_CONSTANT_ALPHA};function setBlending(Rn,or,So,To,Ro,Uo,Oo,Ho,qo,dl){if(Rn!==vl){if(!1===id&&(enable(C.BLEND),id=!0),Rn===Nc)Ro=Ro||or,Uo=Uo||So,Oo=Oo||To,or===rd&&Ro===od||(C.blendEquationSeparate(Id[or],Id[Ro]),rd=or,od=Ro),So===ad&&To===sd&&Uo===ld&&Oo===cd||(C.blendFuncSeparate(Cd[So],Cd[To],Cd[Uo],Cd[Oo]),ad=So,sd=To,ld=Uo,cd=Oo),!1!==Ho.equals(ud)&&qo===hd||(C.blendColor(Ho.r,Ho.g,Ho.b,qo),ud.copy(Ho),hd=qo),nd=Rn,dd=!1;else if(Rn!==nd||dl!==dd){if(rd===jc&&od===jc||(C.blendEquation(C.FUNC_ADD),rd=jc,od=jc),dl)switch(Rn){case bl:C.blendFuncSeparate(C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA);break;case kl:C.blendFunc(C.ONE,C.ONE);break;case Ll:C.blendFuncSeparate(C.ZERO,C.ONE_MINUS_SRC_COLOR,C.ZERO,C.ONE);break;case Dl:C.blendFuncSeparate(C.ZERO,C.SRC_COLOR,C.ZERO,C.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",Rn)}else switch(Rn){case bl:C.blendFuncSeparate(C.SRC_ALPHA,C.ONE_MINUS_SRC_ALPHA,C.ONE,C.ONE_MINUS_SRC_ALPHA);break;case kl:C.blendFunc(C.SRC_ALPHA,C.ONE);break;case Ll:C.blendFuncSeparate(C.ZERO,C.ONE_MINUS_SRC_COLOR,C.ZERO,C.ONE);break;case Dl:C.blendFunc(C.ZERO,C.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",Rn)}ad=null,sd=null,ld=null,cd=null,ud.set(0,0,0),hd=0,nd=Rn,dd=dl}}else!0===id&&(disable(C.BLEND),id=!1)}function setFlipSided(Rn){pd!==Rn&&(Rn?C.frontFace(C.CW):C.frontFace(C.CCW),pd=Rn)}function setCullFace(Rn){Rn!==To?(enable(C.CULL_FACE),Rn!==md&&(Rn===Ro?C.cullFace(C.BACK):Rn===Uo?C.cullFace(C.FRONT):C.cullFace(C.FRONT_AND_BACK))):disable(C.CULL_FACE),md=Rn}function setPolygonOffset(Rn,or,So){Rn?(enable(C.POLYGON_OFFSET_FILL),gd===or&&Ad===So||(C.polygonOffset(or,So),gd=or,Ad=So)):disable(C.POLYGON_OFFSET_FILL)}return{buffers:{color:Rn,depth:or,stencil:So},enable:enable,disable:disable,bindFramebuffer:function(Rn,or){return dl[Rn]!==or&&(C.bindFramebuffer(Rn,or),dl[Rn]=or,Rn===C.DRAW_FRAMEBUFFER&&(dl[C.FRAMEBUFFER]=or),Rn===C.FRAMEBUFFER&&(dl[C.DRAW_FRAMEBUFFER]=or),!0)},drawBuffers:function(Rn,or){let So=ed,To=!1;if(Rn){So=$h.get(or),void 0===So&&(So=[],$h.set(or,So));const Ro=Rn.textures;if(So.length!==Ro.length||So[0]!==C.COLOR_ATTACHMENT0){for(let Rn=0,or=Ro.length;Rn<or;Rn++)So[Rn]=C.COLOR_ATTACHMENT0+Rn;So.length=Ro.length,To=!0}}else So[0]!==C.BACK&&(So[0]=C.BACK,To=!0);To&&C.drawBuffers(So)},useProgram:function(Rn){return td!==Rn&&(C.useProgram(Rn),td=Rn,!0)},setBlending:setBlending,setMaterial:function(To,Ro){To.side===fl?disable(C.CULL_FACE):enable(C.CULL_FACE);let Uo=To.side===ml;Ro&&(Uo=!Uo),setFlipSided(Uo),To.blending===bl&&!1===To.transparent?setBlending(vl):setBlending(To.blending,To.blendEquation,To.blendSrc,To.blendDst,To.blendEquationAlpha,To.blendSrcAlpha,To.blendDstAlpha,To.blendColor,To.blendAlpha,To.premultipliedAlpha),or.setFunc(To.depthFunc),or.setTest(To.depthTest),or.setMask(To.depthWrite),Rn.setMask(To.colorWrite);const Oo=To.stencilWrite;So.setTest(Oo),Oo&&(So.setMask(To.stencilWriteMask),So.setFunc(To.stencilFunc,To.stencilRef,To.stencilFuncMask),So.setOp(To.stencilFail,To.stencilZFail,To.stencilZPass)),setPolygonOffset(To.polygonOffset,To.polygonOffsetFactor,To.polygonOffsetUnits),!0===To.alphaToCoverage?enable(C.SAMPLE_ALPHA_TO_COVERAGE):disable(C.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:setFlipSided,setCullFace:setCullFace,setLineWidth:function(Rn){Rn!==fd&&(vd&&C.lineWidth(Rn),fd=Rn)},setPolygonOffset:setPolygonOffset,setScissorTest:function(Rn){Rn?enable(C.SCISSOR_TEST):disable(C.SCISSOR_TEST)},activeTexture:function(Rn){void 0===Rn&&(Rn=C.TEXTURE0+yd-1),bd!==Rn&&(C.activeTexture(Rn),bd=Rn)},bindTexture:function(Rn,or,So){void 0===So&&(So=null===bd?C.TEXTURE0+yd-1:bd);let To=wd[So];void 0===To&&(To={type:void 0,texture:void 0},wd[So]=To),To.type===Rn&&To.texture===or||(bd!==So&&(C.activeTexture(So),bd=So),C.bindTexture(Rn,or||Td[Rn]),To.type=Rn,To.texture=or)},unbindTexture:function(){const Rn=wd[bd];void 0!==Rn&&void 0!==Rn.type&&(C.bindTexture(Rn.type,null),Rn.type=void 0,Rn.texture=void 0)},compressedTexImage2D:function(){try{C.compressedTexImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},compressedTexImage3D:function(){try{C.compressedTexImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texImage2D:function(){try{C.texImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texImage3D:function(){try{C.texImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},updateUBOMapping:function(Rn,or){let So=Ho.get(or);void 0===So&&(So=new WeakMap,Ho.set(or,So));let To=So.get(Rn);void 0===To&&(To=C.getUniformBlockIndex(or,Rn.name),So.set(Rn,To))},uniformBlockBinding:function(Rn,or){const So=Ho.get(or).get(Rn);Oo.get(or)!==So&&(C.uniformBlockBinding(or,So,Rn.__bindingPointIndex),Oo.set(or,So))},texStorage2D:function(){try{C.texStorage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texStorage3D:function(){try{C.texStorage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texSubImage2D:function(){try{C.texSubImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},texSubImage3D:function(){try{C.texSubImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},compressedTexSubImage2D:function(){try{C.compressedTexSubImage2D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},compressedTexSubImage3D:function(){try{C.compressedTexSubImage3D.apply(C,arguments)}catch(Rn){console.error("THREE.WebGLState:",Rn)}},scissor:function(Rn){!1===Sd.equals(Rn)&&(C.scissor(Rn.x,Rn.y,Rn.z,Rn.w),Sd.copy(Rn))},viewport:function(Rn){!1===kd.equals(Rn)&&(C.viewport(Rn.x,Rn.y,Rn.z,Rn.w),kd.copy(Rn))},reset:function(){C.disable(C.BLEND),C.disable(C.CULL_FACE),C.disable(C.DEPTH_TEST),C.disable(C.POLYGON_OFFSET_FILL),C.disable(C.SCISSOR_TEST),C.disable(C.STENCIL_TEST),C.disable(C.SAMPLE_ALPHA_TO_COVERAGE),C.blendEquation(C.FUNC_ADD),C.blendFunc(C.ONE,C.ZERO),C.blendFuncSeparate(C.ONE,C.ZERO,C.ONE,C.ZERO),C.blendColor(0,0,0,0),C.colorMask(!0,!0,!0,!0),C.clearColor(0,0,0,0),C.depthMask(!0),C.depthFunc(C.LESS),C.clearDepth(1),C.stencilMask(4294967295),C.stencilFunc(C.ALWAYS,0,4294967295),C.stencilOp(C.KEEP,C.KEEP,C.KEEP),C.clearStencil(0),C.cullFace(C.BACK),C.frontFace(C.CCW),C.polygonOffset(0,0),C.activeTexture(C.TEXTURE0),C.bindFramebuffer(C.FRAMEBUFFER,null),C.bindFramebuffer(C.DRAW_FRAMEBUFFER,null),C.bindFramebuffer(C.READ_FRAMEBUFFER,null),C.useProgram(null),C.lineWidth(1),C.scissor(0,0,C.canvas.width,C.canvas.height),C.viewport(0,0,C.canvas.width,C.canvas.height),qo={},bd=null,wd={},dl={},$h=new WeakMap,ed=[],td=null,id=!1,nd=null,rd=null,ad=null,sd=null,od=null,ld=null,cd=null,ud=new Color(0,0,0),hd=0,dd=!1,pd=null,md=null,fd=null,gd=null,Ad=null,Sd.set(0,0,C.canvas.width,C.canvas.height),kd.set(0,0,C.canvas.width,C.canvas.height),Rn.reset(),or.reset(),So.reset()}}}function getByteLength(C,Rn,or,So){const To=function(C){switch(C){case Ed:case Md:return{byteLength:1,components:1};case kd:case Sd:case Ld:return{byteLength:2,components:1};case Pd:case zd:return{byteLength:2,components:4};case Id:case Td:case Cd:return{byteLength:4,components:1};case Rd:return{byteLength:4,components:3}}throw new Error("Unknown texture type "+C+".")}(So);switch(or){case Nd:case Fd:return C*Rn;case Od:return C*Rn*2;case Gd:case Hd:return C*Rn/To.components*To.byteLength;case Zd:case Wd:return C*Rn*2/To.components*To.byteLength;case Ud:return C*Rn*3/To.components*To.byteLength;case Bd:case qd:return C*Rn*4/To.components*To.byteLength;case Kd:case Qd:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*8;case Xd:case Yd:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*16;case $d:case tp:return Math.max(C,16)*Math.max(Rn,8)/4;case Jd:case ep:return Math.max(C,8)*Math.max(Rn,8)/2;case ip:case np:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*8;case rp:case ap:return Math.floor((C+3)/4)*Math.floor((Rn+3)/4)*16;case sp:return Math.floor((C+4)/5)*Math.floor((Rn+3)/4)*16;case op:return Math.floor((C+4)/5)*Math.floor((Rn+4)/5)*16;case lp:return Math.floor((C+5)/6)*Math.floor((Rn+4)/5)*16;case cp:return Math.floor((C+5)/6)*Math.floor((Rn+5)/6)*16;case up:return Math.floor((C+7)/8)*Math.floor((Rn+4)/5)*16;case hp:return Math.floor((C+7)/8)*Math.floor((Rn+5)/6)*16;case dp:return Math.floor((C+7)/8)*Math.floor((Rn+7)/8)*16;case pp:return Math.floor((C+9)/10)*Math.floor((Rn+4)/5)*16;case mp:return Math.floor((C+9)/10)*Math.floor((Rn+5)/6)*16;case fp:return Math.floor((C+9)/10)*Math.floor((Rn+7)/8)*16;case gp:return Math.floor((C+9)/10)*Math.floor((Rn+9)/10)*16;case Ap:return Math.floor((C+11)/12)*Math.floor((Rn+9)/10)*16;case yp:return Math.floor((C+11)/12)*Math.floor((Rn+11)/12)*16;case vp:case xp:case _p:return Math.ceil(C/4)*Math.ceil(Rn/4)*16;case bp:case wp:return Math.ceil(C/4)*Math.ceil(Rn/4)*8;case Ep:case Mp:return Math.ceil(C/4)*Math.ceil(Rn/4)*16}throw new Error("Unable to determine texture byte length for "+or+" format.")}function WebGLTextures(C,Rn,or,So,To,Ro,Uo){const Oo=Rn.has("WEBGL_multisampled_render_to_texture")?Rn.get("WEBGL_multisampled_render_to_texture"):null,Ho="undefined"!==typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),qo=new Vector2,dl=new WeakMap;let ml;const fl=new WeakMap;let vl=!1;try{vl="undefined"!==typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(Zc){}function createCanvas(C,Rn){return vl?new OffscreenCanvas(C,Rn):createElementNS("canvas")}function resizeImage(C,Rn,or){let So=1;const To=getDimensions(C);if((To.width>or||To.height>or)&&(So=or/Math.max(To.width,To.height)),So<1){if("undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&C instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&C instanceof ImageBitmap||"undefined"!==typeof VideoFrame&&C instanceof VideoFrame){const or=Math.floor(So*To.width),Ro=Math.floor(So*To.height);void 0===ml&&(ml=createCanvas(or,Ro));const Uo=Rn?createCanvas(or,Ro):ml;Uo.width=or,Uo.height=Ro;return Uo.getContext("2d").drawImage(C,0,0,or,Ro),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+To.width+"x"+To.height+") to ("+or+"x"+Ro+")."),Uo}return"data"in C&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+To.width+"x"+To.height+")."),C}return C}function textureNeedsGenerateMipmaps(C){return C.generateMipmaps&&C.minFilter!==yd&&C.minFilter!==_d}function generateMipmap(Rn){C.generateMipmap(Rn)}function getInternalFormat(or,So,To,Ro,Uo){if(void 0===Uo&&(Uo=!1),null!==or){if(void 0!==C[or])return C[or];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+or+"'")}let Oo=So;if(So===C.RED&&(To===C.FLOAT&&(Oo=C.R32F),To===C.HALF_FLOAT&&(Oo=C.R16F),To===C.UNSIGNED_BYTE&&(Oo=C.R8)),So===C.RED_INTEGER&&(To===C.UNSIGNED_BYTE&&(Oo=C.R8UI),To===C.UNSIGNED_SHORT&&(Oo=C.R16UI),To===C.UNSIGNED_INT&&(Oo=C.R32UI),To===C.BYTE&&(Oo=C.R8I),To===C.SHORT&&(Oo=C.R16I),To===C.INT&&(Oo=C.R32I)),So===C.RG&&(To===C.FLOAT&&(Oo=C.RG32F),To===C.HALF_FLOAT&&(Oo=C.RG16F),To===C.UNSIGNED_BYTE&&(Oo=C.RG8)),So===C.RG_INTEGER&&(To===C.UNSIGNED_BYTE&&(Oo=C.RG8UI),To===C.UNSIGNED_SHORT&&(Oo=C.RG16UI),To===C.UNSIGNED_INT&&(Oo=C.RG32UI),To===C.BYTE&&(Oo=C.RG8I),To===C.SHORT&&(Oo=C.RG16I),To===C.INT&&(Oo=C.RG32I)),So===C.RGB&&To===C.UNSIGNED_INT_5_9_9_9_REV&&(Oo=C.RGB9_E5),So===C.RGBA){const Rn=Uo?Op:mm.getTransfer(Ro);To===C.FLOAT&&(Oo=C.RGBA32F),To===C.HALF_FLOAT&&(Oo=C.RGBA16F),To===C.UNSIGNED_BYTE&&(Oo=Rn===Vp?C.SRGB8_ALPHA8:C.RGBA8),To===C.UNSIGNED_SHORT_4_4_4_4&&(Oo=C.RGBA4),To===C.UNSIGNED_SHORT_5_5_5_1&&(Oo=C.RGB5_A1)}return Oo!==C.R16F&&Oo!==C.R32F&&Oo!==C.RG16F&&Oo!==C.RG32F&&Oo!==C.RGBA16F&&Oo!==C.RGBA32F||Rn.get("EXT_color_buffer_float"),Oo}function getInternalDepthFormat(Rn,or){let So;return Rn?null===or||or===Id||or===Dd?So=C.DEPTH24_STENCIL8:or===Cd?So=C.DEPTH32F_STENCIL8:or===kd&&(So=C.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===or||or===Id||or===Dd?So=C.DEPTH_COMPONENT24:or===Cd?So=C.DEPTH_COMPONENT32F:or===kd&&(So=C.DEPTH_COMPONENT16),So}function getMipLevels(C,Rn){return!0===textureNeedsGenerateMipmaps(C)||C.isFramebufferTexture&&C.minFilter!==yd&&C.minFilter!==_d?Math.log2(Math.max(Rn.width,Rn.height))+1:void 0!==C.mipmaps&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?Rn.mipmaps.length:1}function onTextureDispose(C){const Rn=C.target;Rn.removeEventListener("dispose",onTextureDispose),function(C){const Rn=So.get(C);if(void 0===Rn.__webglInit)return;const or=C.source,To=fl.get(or);if(To){const So=To[Rn.__cacheKey];So.usedTimes--,0===So.usedTimes&&deleteTexture(C),0===Object.keys(To).length&&fl.delete(or)}So.remove(C)}(Rn),Rn.isVideoTexture&&dl.delete(Rn)}function onRenderTargetDispose(Rn){const or=Rn.target;or.removeEventListener("dispose",onRenderTargetDispose),function(Rn){const or=So.get(Rn);Rn.depthTexture&&Rn.depthTexture.dispose();if(Rn.isWebGLCubeRenderTarget)for(let So=0;So<6;So++){if(Array.isArray(or.__webglFramebuffer[So]))for(let Rn=0;Rn<or.__webglFramebuffer[So].length;Rn++)C.deleteFramebuffer(or.__webglFramebuffer[So][Rn]);else C.deleteFramebuffer(or.__webglFramebuffer[So]);or.__webglDepthbuffer&&C.deleteRenderbuffer(or.__webglDepthbuffer[So])}else{if(Array.isArray(or.__webglFramebuffer))for(let Rn=0;Rn<or.__webglFramebuffer.length;Rn++)C.deleteFramebuffer(or.__webglFramebuffer[Rn]);else C.deleteFramebuffer(or.__webglFramebuffer);if(or.__webglDepthbuffer&&C.deleteRenderbuffer(or.__webglDepthbuffer),or.__webglMultisampledFramebuffer&&C.deleteFramebuffer(or.__webglMultisampledFramebuffer),or.__webglColorRenderbuffer)for(let Rn=0;Rn<or.__webglColorRenderbuffer.length;Rn++)or.__webglColorRenderbuffer[Rn]&&C.deleteRenderbuffer(or.__webglColorRenderbuffer[Rn]);or.__webglDepthRenderbuffer&&C.deleteRenderbuffer(or.__webglDepthRenderbuffer)}const To=Rn.textures;for(let Ro=0,Oo=To.length;Ro<Oo;Ro++){const Rn=So.get(To[Ro]);Rn.__webglTexture&&(C.deleteTexture(Rn.__webglTexture),Uo.memory.textures--),So.remove(To[Ro])}So.remove(Rn)}(or)}function deleteTexture(Rn){const or=So.get(Rn);C.deleteTexture(or.__webglTexture);const To=Rn.source;delete fl.get(To)[or.__cacheKey],Uo.memory.textures--}let bl=0;function setTexture2D(Rn,To){const Ro=So.get(Rn);if(Rn.isVideoTexture&&function(C){const Rn=Uo.render.frame;dl.get(C)!==Rn&&(dl.set(C,Rn),C.update())}(Rn),!1===Rn.isRenderTargetTexture&&Rn.version>0&&Ro.__version!==Rn.version){const C=Rn.image;if(null===C)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==C.complete)return void uploadTexture(Ro,Rn,To);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}or.bindTexture(C.TEXTURE_2D,Ro.__webglTexture,C.TEXTURE0+To)}const kl={[fd]:C.REPEAT,[gd]:C.CLAMP_TO_EDGE,[Ad]:C.MIRRORED_REPEAT},Ll={[yd]:C.NEAREST,[vd]:C.NEAREST_MIPMAP_NEAREST,[xd]:C.NEAREST_MIPMAP_LINEAR,[_d]:C.LINEAR,[bd]:C.LINEAR_MIPMAP_NEAREST,[wd]:C.LINEAR_MIPMAP_LINEAR},Dl={[Zp]:C.NEVER,[Jp]:C.ALWAYS,[Wp]:C.LESS,[Kp]:C.LEQUAL,[qp]:C.EQUAL,[Yp]:C.GEQUAL,[Qp]:C.GREATER,[Xp]:C.NOTEQUAL};function setTextureParameters(or,Ro){if(Ro.type!==Cd||!1!==Rn.has("OES_texture_float_linear")||Ro.magFilter!==_d&&Ro.magFilter!==bd&&Ro.magFilter!==xd&&Ro.magFilter!==wd&&Ro.minFilter!==_d&&Ro.minFilter!==bd&&Ro.minFilter!==xd&&Ro.minFilter!==wd||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),C.texParameteri(or,C.TEXTURE_WRAP_S,kl[Ro.wrapS]),C.texParameteri(or,C.TEXTURE_WRAP_T,kl[Ro.wrapT]),or!==C.TEXTURE_3D&&or!==C.TEXTURE_2D_ARRAY||C.texParameteri(or,C.TEXTURE_WRAP_R,kl[Ro.wrapR]),C.texParameteri(or,C.TEXTURE_MAG_FILTER,Ll[Ro.magFilter]),C.texParameteri(or,C.TEXTURE_MIN_FILTER,Ll[Ro.minFilter]),Ro.compareFunction&&(C.texParameteri(or,C.TEXTURE_COMPARE_MODE,C.COMPARE_REF_TO_TEXTURE),C.texParameteri(or,C.TEXTURE_COMPARE_FUNC,Dl[Ro.compareFunction])),!0===Rn.has("EXT_texture_filter_anisotropic")){if(Ro.magFilter===yd)return;if(Ro.minFilter!==xd&&Ro.minFilter!==wd)return;if(Ro.type===Cd&&!1===Rn.has("OES_texture_float_linear"))return;if(Ro.anisotropy>1||So.get(Ro).__currentAnisotropy){const Uo=Rn.get("EXT_texture_filter_anisotropic");C.texParameterf(or,Uo.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Ro.anisotropy,To.getMaxAnisotropy())),So.get(Ro).__currentAnisotropy=Ro.anisotropy}}}function initTexture(Rn,or){let So=!1;void 0===Rn.__webglInit&&(Rn.__webglInit=!0,or.addEventListener("dispose",onTextureDispose));const To=or.source;let Ro=fl.get(To);void 0===Ro&&(Ro={},fl.set(To,Ro));const Oo=function(C){const Rn=[];return Rn.push(C.wrapS),Rn.push(C.wrapT),Rn.push(C.wrapR||0),Rn.push(C.magFilter),Rn.push(C.minFilter),Rn.push(C.anisotropy),Rn.push(C.internalFormat),Rn.push(C.format),Rn.push(C.type),Rn.push(C.generateMipmaps),Rn.push(C.premultiplyAlpha),Rn.push(C.flipY),Rn.push(C.unpackAlignment),Rn.push(C.colorSpace),Rn.join()}(or);if(Oo!==Rn.__cacheKey){void 0===Ro[Oo]&&(Ro[Oo]={texture:C.createTexture(),usedTimes:0},Uo.memory.textures++,So=!0),Ro[Oo].usedTimes++;const To=Ro[Rn.__cacheKey];void 0!==To&&(Ro[Rn.__cacheKey].usedTimes--,0===To.usedTimes&&deleteTexture(or)),Rn.__cacheKey=Oo,Rn.__webglTexture=Ro[Oo].texture}return So}function uploadTexture(Rn,Uo,Oo){let Ho=C.TEXTURE_2D;(Uo.isDataArrayTexture||Uo.isCompressedArrayTexture)&&(Ho=C.TEXTURE_2D_ARRAY),Uo.isData3DTexture&&(Ho=C.TEXTURE_3D);const qo=initTexture(Rn,Uo),dl=Uo.source;or.bindTexture(Ho,Rn.__webglTexture,C.TEXTURE0+Oo);const ml=So.get(dl);if(dl.version!==ml.__version||!0===qo){or.activeTexture(C.TEXTURE0+Oo);const Rn=mm.getPrimaries(mm.workingColorSpace),So=Uo.colorSpace===Rp?null:mm.getPrimaries(Uo.colorSpace),fl=Uo.colorSpace===Rp||Rn===So?C.NONE:C.BROWSER_DEFAULT_WEBGL;C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,Uo.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Uo.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,Uo.unpackAlignment),C.pixelStorei(C.UNPACK_COLORSPACE_CONVERSION_WEBGL,fl);let vl=resizeImage(Uo.image,!1,To.maxTextureSize);vl=verifyColorSpace(Uo,vl);const bl=Ro.convert(Uo.format,Uo.colorSpace),kl=Ro.convert(Uo.type);let Ll,Dl=getInternalFormat(Uo.internalFormat,bl,kl,Uo.colorSpace,Uo.isVideoTexture);setTextureParameters(Ho,Uo);const Nc=Uo.mipmaps,jc=!0!==Uo.isVideoTexture,Zc=void 0===ml.__version||!0===qo,eu=dl.dataReady,Ku=getMipLevels(Uo,vl);if(Uo.isDepthTexture)Dl=getInternalDepthFormat(Uo.format===jd,Uo.type),Zc&&(jc?or.texStorage2D(C.TEXTURE_2D,1,Dl,vl.width,vl.height):or.texImage2D(C.TEXTURE_2D,0,Dl,vl.width,vl.height,0,bl,kl,null));else if(Uo.isDataTexture)if(Nc.length>0){jc&&Zc&&or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Nc[0].width,Nc[0].height);for(let Rn=0,So=Nc.length;Rn<So;Rn++)Ll=Nc[Rn],jc?eu&&or.texSubImage2D(C.TEXTURE_2D,Rn,0,0,Ll.width,Ll.height,bl,kl,Ll.data):or.texImage2D(C.TEXTURE_2D,Rn,Dl,Ll.width,Ll.height,0,bl,kl,Ll.data);Uo.generateMipmaps=!1}else jc?(Zc&&or.texStorage2D(C.TEXTURE_2D,Ku,Dl,vl.width,vl.height),eu&&or.texSubImage2D(C.TEXTURE_2D,0,0,0,vl.width,vl.height,bl,kl,vl.data)):or.texImage2D(C.TEXTURE_2D,0,Dl,vl.width,vl.height,0,bl,kl,vl.data);else if(Uo.isCompressedTexture)if(Uo.isCompressedArrayTexture){jc&&Zc&&or.texStorage3D(C.TEXTURE_2D_ARRAY,Ku,Dl,Nc[0].width,Nc[0].height,vl.depth);for(let Rn=0,So=Nc.length;Rn<So;Rn++)if(Ll=Nc[Rn],Uo.format!==Bd)if(null!==bl)if(jc){if(eu)if(Uo.layerUpdates.size>0){const So=getByteLength(Ll.width,Ll.height,Uo.format,Uo.type);for(const To of Uo.layerUpdates){const Ro=Ll.data.subarray(To*So/Ll.data.BYTES_PER_ELEMENT,(To+1)*So/Ll.data.BYTES_PER_ELEMENT);or.compressedTexSubImage3D(C.TEXTURE_2D_ARRAY,Rn,0,0,To,Ll.width,Ll.height,1,bl,Ro,0,0)}Uo.clearLayerUpdates()}else or.compressedTexSubImage3D(C.TEXTURE_2D_ARRAY,Rn,0,0,0,Ll.width,Ll.height,vl.depth,bl,Ll.data,0,0)}else or.compressedTexImage3D(C.TEXTURE_2D_ARRAY,Rn,Dl,Ll.width,Ll.height,vl.depth,0,Ll.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else jc?eu&&or.texSubImage3D(C.TEXTURE_2D_ARRAY,Rn,0,0,0,Ll.width,Ll.height,vl.depth,bl,kl,Ll.data):or.texImage3D(C.TEXTURE_2D_ARRAY,Rn,Dl,Ll.width,Ll.height,vl.depth,0,bl,kl,Ll.data)}else{jc&&Zc&&or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Nc[0].width,Nc[0].height);for(let Rn=0,So=Nc.length;Rn<So;Rn++)Ll=Nc[Rn],Uo.format!==Bd?null!==bl?jc?eu&&or.compressedTexSubImage2D(C.TEXTURE_2D,Rn,0,0,Ll.width,Ll.height,bl,Ll.data):or.compressedTexImage2D(C.TEXTURE_2D,Rn,Dl,Ll.width,Ll.height,0,Ll.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):jc?eu&&or.texSubImage2D(C.TEXTURE_2D,Rn,0,0,Ll.width,Ll.height,bl,kl,Ll.data):or.texImage2D(C.TEXTURE_2D,Rn,Dl,Ll.width,Ll.height,0,bl,kl,Ll.data)}else if(Uo.isDataArrayTexture)if(jc){if(Zc&&or.texStorage3D(C.TEXTURE_2D_ARRAY,Ku,Dl,vl.width,vl.height,vl.depth),eu)if(Uo.layerUpdates.size>0){const Rn=getByteLength(vl.width,vl.height,Uo.format,Uo.type);for(const So of Uo.layerUpdates){const To=vl.data.subarray(So*Rn/vl.data.BYTES_PER_ELEMENT,(So+1)*Rn/vl.data.BYTES_PER_ELEMENT);or.texSubImage3D(C.TEXTURE_2D_ARRAY,0,0,0,So,vl.width,vl.height,1,bl,kl,To)}Uo.clearLayerUpdates()}else or.texSubImage3D(C.TEXTURE_2D_ARRAY,0,0,0,0,vl.width,vl.height,vl.depth,bl,kl,vl.data)}else or.texImage3D(C.TEXTURE_2D_ARRAY,0,Dl,vl.width,vl.height,vl.depth,0,bl,kl,vl.data);else if(Uo.isData3DTexture)jc?(Zc&&or.texStorage3D(C.TEXTURE_3D,Ku,Dl,vl.width,vl.height,vl.depth),eu&&or.texSubImage3D(C.TEXTURE_3D,0,0,0,0,vl.width,vl.height,vl.depth,bl,kl,vl.data)):or.texImage3D(C.TEXTURE_3D,0,Dl,vl.width,vl.height,vl.depth,0,bl,kl,vl.data);else if(Uo.isFramebufferTexture){if(Zc)if(jc)or.texStorage2D(C.TEXTURE_2D,Ku,Dl,vl.width,vl.height);else{let Rn=vl.width,So=vl.height;for(let To=0;To<Ku;To++)or.texImage2D(C.TEXTURE_2D,To,Dl,Rn,So,0,bl,kl,null),Rn>>=1,So>>=1}}else if(Nc.length>0){if(jc&&Zc){const Rn=getDimensions(Nc[0]);or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Rn.width,Rn.height)}for(let Rn=0,So=Nc.length;Rn<So;Rn++)Ll=Nc[Rn],jc?eu&&or.texSubImage2D(C.TEXTURE_2D,Rn,0,0,bl,kl,Ll):or.texImage2D(C.TEXTURE_2D,Rn,Dl,bl,kl,Ll);Uo.generateMipmaps=!1}else if(jc){if(Zc){const Rn=getDimensions(vl);or.texStorage2D(C.TEXTURE_2D,Ku,Dl,Rn.width,Rn.height)}eu&&or.texSubImage2D(C.TEXTURE_2D,0,0,0,bl,kl,vl)}else or.texImage2D(C.TEXTURE_2D,0,Dl,bl,kl,vl);textureNeedsGenerateMipmaps(Uo)&&generateMipmap(Ho),ml.__version=dl.version,Uo.onUpdate&&Uo.onUpdate(Uo)}Rn.__version=Uo.version}function setupFrameBufferTexture(Rn,To,Uo,Ho,qo,dl){const ml=Ro.convert(Uo.format,Uo.colorSpace),fl=Ro.convert(Uo.type),vl=getInternalFormat(Uo.internalFormat,ml,fl,Uo.colorSpace);if(!So.get(To).__hasExternalTextures){const Rn=Math.max(1,To.width>>dl),So=Math.max(1,To.height>>dl);qo===C.TEXTURE_3D||qo===C.TEXTURE_2D_ARRAY?or.texImage3D(qo,dl,vl,Rn,So,To.depth,0,ml,fl,null):or.texImage2D(qo,dl,vl,Rn,So,0,ml,fl,null)}or.bindFramebuffer(C.FRAMEBUFFER,Rn),useMultisampledRTT(To)?Oo.framebufferTexture2DMultisampleEXT(C.FRAMEBUFFER,Ho,qo,So.get(Uo).__webglTexture,0,getRenderTargetSamples(To)):(qo===C.TEXTURE_2D||qo>=C.TEXTURE_CUBE_MAP_POSITIVE_X&&qo<=C.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&C.framebufferTexture2D(C.FRAMEBUFFER,Ho,qo,So.get(Uo).__webglTexture,dl),or.bindFramebuffer(C.FRAMEBUFFER,null)}function setupRenderBufferStorage(Rn,or,So){if(C.bindRenderbuffer(C.RENDERBUFFER,Rn),or.depthBuffer){const To=or.depthTexture,Ro=To&&To.isDepthTexture?To.type:null,Uo=getInternalDepthFormat(or.stencilBuffer,Ro),Ho=or.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,qo=getRenderTargetSamples(or);useMultisampledRTT(or)?Oo.renderbufferStorageMultisampleEXT(C.RENDERBUFFER,qo,Uo,or.width,or.height):So?C.renderbufferStorageMultisample(C.RENDERBUFFER,qo,Uo,or.width,or.height):C.renderbufferStorage(C.RENDERBUFFER,Uo,or.width,or.height),C.framebufferRenderbuffer(C.FRAMEBUFFER,Ho,C.RENDERBUFFER,Rn)}else{const Rn=or.textures;for(let To=0;To<Rn.length;To++){const Uo=Rn[To],Ho=Ro.convert(Uo.format,Uo.colorSpace),qo=Ro.convert(Uo.type),dl=getInternalFormat(Uo.internalFormat,Ho,qo,Uo.colorSpace),ml=getRenderTargetSamples(or);So&&!1===useMultisampledRTT(or)?C.renderbufferStorageMultisample(C.RENDERBUFFER,ml,dl,or.width,or.height):useMultisampledRTT(or)?Oo.renderbufferStorageMultisampleEXT(C.RENDERBUFFER,ml,dl,or.width,or.height):C.renderbufferStorage(C.RENDERBUFFER,dl,or.width,or.height)}}C.bindRenderbuffer(C.RENDERBUFFER,null)}function setupDepthRenderbuffer(Rn){const To=So.get(Rn),Ro=!0===Rn.isWebGLCubeRenderTarget;if(To.__boundDepthTexture!==Rn.depthTexture){const C=Rn.depthTexture;if(To.__depthDisposeCallback&&To.__depthDisposeCallback(),C){const disposeEvent=()=>{delete To.__boundDepthTexture,delete To.__depthDisposeCallback,C.removeEventListener("dispose",disposeEvent)};C.addEventListener("dispose",disposeEvent),To.__depthDisposeCallback=disposeEvent}To.__boundDepthTexture=C}if(Rn.depthTexture&&!To.__autoAllocateDepthBuffer){if(Ro)throw new Error("target.depthTexture not supported in Cube render targets");!function(Rn,To){if(To&&To.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(or.bindFramebuffer(C.FRAMEBUFFER,Rn),!To.depthTexture||!To.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");So.get(To.depthTexture).__webglTexture&&To.depthTexture.image.width===To.width&&To.depthTexture.image.height===To.height||(To.depthTexture.image.width=To.width,To.depthTexture.image.height=To.height,To.depthTexture.needsUpdate=!0),setTexture2D(To.depthTexture,0);const Ro=So.get(To.depthTexture).__webglTexture,Uo=getRenderTargetSamples(To);if(To.depthTexture.format===Vd)useMultisampledRTT(To)?Oo.framebufferTexture2DMultisampleEXT(C.FRAMEBUFFER,C.DEPTH_ATTACHMENT,C.TEXTURE_2D,Ro,0,Uo):C.framebufferTexture2D(C.FRAMEBUFFER,C.DEPTH_ATTACHMENT,C.TEXTURE_2D,Ro,0);else{if(To.depthTexture.format!==jd)throw new Error("Unknown depthTexture format");useMultisampledRTT(To)?Oo.framebufferTexture2DMultisampleEXT(C.FRAMEBUFFER,C.DEPTH_STENCIL_ATTACHMENT,C.TEXTURE_2D,Ro,0,Uo):C.framebufferTexture2D(C.FRAMEBUFFER,C.DEPTH_STENCIL_ATTACHMENT,C.TEXTURE_2D,Ro,0)}}(To.__webglFramebuffer,Rn)}else if(Ro){To.__webglDepthbuffer=[];for(let So=0;So<6;So++)if(or.bindFramebuffer(C.FRAMEBUFFER,To.__webglFramebuffer[So]),void 0===To.__webglDepthbuffer[So])To.__webglDepthbuffer[So]=C.createRenderbuffer(),setupRenderBufferStorage(To.__webglDepthbuffer[So],Rn,!1);else{const or=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,Ro=To.__webglDepthbuffer[So];C.bindRenderbuffer(C.RENDERBUFFER,Ro),C.framebufferRenderbuffer(C.FRAMEBUFFER,or,C.RENDERBUFFER,Ro)}}else if(or.bindFramebuffer(C.FRAMEBUFFER,To.__webglFramebuffer),void 0===To.__webglDepthbuffer)To.__webglDepthbuffer=C.createRenderbuffer(),setupRenderBufferStorage(To.__webglDepthbuffer,Rn,!1);else{const or=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,So=To.__webglDepthbuffer;C.bindRenderbuffer(C.RENDERBUFFER,So),C.framebufferRenderbuffer(C.FRAMEBUFFER,or,C.RENDERBUFFER,So)}or.bindFramebuffer(C.FRAMEBUFFER,null)}const Nc=[],jc=[];function getRenderTargetSamples(C){return Math.min(To.maxSamples,C.samples)}function useMultisampledRTT(C){const or=So.get(C);return C.samples>0&&!0===Rn.has("WEBGL_multisampled_render_to_texture")&&!1!==or.__useRenderToTexture}function verifyColorSpace(C,Rn){const or=C.colorSpace,So=C.format,To=C.type;return!0===C.isCompressedTexture||!0===C.isVideoTexture||or!==Up&&or!==Rp&&(mm.getTransfer(or)===Vp?So===Bd&&To===Ed||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",or)),Rn}function getDimensions(C){return"undefined"!==typeof HTMLImageElement&&C instanceof HTMLImageElement?(qo.width=C.naturalWidth||C.width,qo.height=C.naturalHeight||C.height):"undefined"!==typeof VideoFrame&&C instanceof VideoFrame?(qo.width=C.displayWidth,qo.height=C.displayHeight):(qo.width=C.width,qo.height=C.height),qo}this.allocateTextureUnit=function(){const C=bl;return C>=To.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+To.maxTextures),bl+=1,C},this.resetTextureUnits=function(){bl=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function(Rn,To){const Ro=So.get(Rn);Rn.version>0&&Ro.__version!==Rn.version?uploadTexture(Ro,Rn,To):or.bindTexture(C.TEXTURE_2D_ARRAY,Ro.__webglTexture,C.TEXTURE0+To)},this.setTexture3D=function(Rn,To){const Ro=So.get(Rn);Rn.version>0&&Ro.__version!==Rn.version?uploadTexture(Ro,Rn,To):or.bindTexture(C.TEXTURE_3D,Ro.__webglTexture,C.TEXTURE0+To)},this.setTextureCube=function(Rn,Uo){const Oo=So.get(Rn);Rn.version>0&&Oo.__version!==Rn.version?function(Rn,Uo,Oo){if(6!==Uo.image.length)return;const Ho=initTexture(Rn,Uo),qo=Uo.source;or.bindTexture(C.TEXTURE_CUBE_MAP,Rn.__webglTexture,C.TEXTURE0+Oo);const dl=So.get(qo);if(qo.version!==dl.__version||!0===Ho){or.activeTexture(C.TEXTURE0+Oo);const Rn=mm.getPrimaries(mm.workingColorSpace),So=Uo.colorSpace===Rp?null:mm.getPrimaries(Uo.colorSpace),ml=Uo.colorSpace===Rp||Rn===So?C.NONE:C.BROWSER_DEFAULT_WEBGL;C.pixelStorei(C.UNPACK_FLIP_Y_WEBGL,Uo.flipY),C.pixelStorei(C.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Uo.premultiplyAlpha),C.pixelStorei(C.UNPACK_ALIGNMENT,Uo.unpackAlignment),C.pixelStorei(C.UNPACK_COLORSPACE_CONVERSION_WEBGL,ml);const fl=Uo.isCompressedTexture||Uo.image[0].isCompressedTexture,vl=Uo.image[0]&&Uo.image[0].isDataTexture,bl=[];for(let C=0;C<6;C++)bl[C]=fl||vl?vl?Uo.image[C].image:Uo.image[C]:resizeImage(Uo.image[C],!0,To.maxCubemapSize),bl[C]=verifyColorSpace(Uo,bl[C]);const kl=bl[0],Ll=Ro.convert(Uo.format,Uo.colorSpace),Dl=Ro.convert(Uo.type),Nc=getInternalFormat(Uo.internalFormat,Ll,Dl,Uo.colorSpace),jc=!0!==Uo.isVideoTexture,Zc=void 0===dl.__version||!0===Ho,eu=qo.dataReady;let Ku,Yu=getMipLevels(Uo,kl);if(setTextureParameters(C.TEXTURE_CUBE_MAP,Uo),fl){jc&&Zc&&or.texStorage2D(C.TEXTURE_CUBE_MAP,Yu,Nc,kl.width,kl.height);for(let Rn=0;Rn<6;Rn++){Ku=bl[Rn].mipmaps;for(let So=0;So<Ku.length;So++){const To=Ku[So];Uo.format!==Bd?null!==Ll?jc?eu&&or.compressedTexSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,0,0,To.width,To.height,Ll,To.data):or.compressedTexImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,Nc,To.width,To.height,0,To.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,0,0,To.width,To.height,Ll,Dl,To.data):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So,Nc,To.width,To.height,0,Ll,Dl,To.data)}}}else{if(Ku=Uo.mipmaps,jc&&Zc){Ku.length>0&&Yu++;const Rn=getDimensions(bl[0]);or.texStorage2D(C.TEXTURE_CUBE_MAP,Yu,Nc,Rn.width,Rn.height)}for(let Rn=0;Rn<6;Rn++)if(vl){jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,0,0,bl[Rn].width,bl[Rn].height,Ll,Dl,bl[Rn].data):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,Nc,bl[Rn].width,bl[Rn].height,0,Ll,Dl,bl[Rn].data);for(let So=0;So<Ku.length;So++){const To=Ku[So].image[Rn].image;jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,0,0,To.width,To.height,Ll,Dl,To.data):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,Nc,To.width,To.height,0,Ll,Dl,To.data)}}else{jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,0,0,Ll,Dl,bl[Rn]):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,0,Nc,Ll,Dl,bl[Rn]);for(let So=0;So<Ku.length;So++){const To=Ku[So];jc?eu&&or.texSubImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,0,0,Ll,Dl,To.image[Rn]):or.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So+1,Nc,Ll,Dl,To.image[Rn])}}}textureNeedsGenerateMipmaps(Uo)&&generateMipmap(C.TEXTURE_CUBE_MAP),dl.__version=qo.version,Uo.onUpdate&&Uo.onUpdate(Uo)}Rn.__version=Uo.version}(Oo,Rn,Uo):or.bindTexture(C.TEXTURE_CUBE_MAP,Oo.__webglTexture,C.TEXTURE0+Uo)},this.rebindTextures=function(Rn,or,To){const Ro=So.get(Rn);void 0!==or&&setupFrameBufferTexture(Ro.__webglFramebuffer,Rn,Rn.texture,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,0),void 0!==To&&setupDepthRenderbuffer(Rn)},this.setupRenderTarget=function(Rn){const To=Rn.texture,Oo=So.get(Rn),Ho=So.get(To);Rn.addEventListener("dispose",onRenderTargetDispose);const qo=Rn.textures,dl=!0===Rn.isWebGLCubeRenderTarget,ml=qo.length>1;if(ml||(void 0===Ho.__webglTexture&&(Ho.__webglTexture=C.createTexture()),Ho.__version=To.version,Uo.memory.textures++),dl){Oo.__webglFramebuffer=[];for(let Rn=0;Rn<6;Rn++)if(To.mipmaps&&To.mipmaps.length>0){Oo.__webglFramebuffer[Rn]=[];for(let or=0;or<To.mipmaps.length;or++)Oo.__webglFramebuffer[Rn][or]=C.createFramebuffer()}else Oo.__webglFramebuffer[Rn]=C.createFramebuffer()}else{if(To.mipmaps&&To.mipmaps.length>0){Oo.__webglFramebuffer=[];for(let Rn=0;Rn<To.mipmaps.length;Rn++)Oo.__webglFramebuffer[Rn]=C.createFramebuffer()}else Oo.__webglFramebuffer=C.createFramebuffer();if(ml)for(let Rn=0,or=qo.length;Rn<or;Rn++){const or=So.get(qo[Rn]);void 0===or.__webglTexture&&(or.__webglTexture=C.createTexture(),Uo.memory.textures++)}if(Rn.samples>0&&!1===useMultisampledRTT(Rn)){Oo.__webglMultisampledFramebuffer=C.createFramebuffer(),Oo.__webglColorRenderbuffer=[],or.bindFramebuffer(C.FRAMEBUFFER,Oo.__webglMultisampledFramebuffer);for(let or=0;or<qo.length;or++){const So=qo[or];Oo.__webglColorRenderbuffer[or]=C.createRenderbuffer(),C.bindRenderbuffer(C.RENDERBUFFER,Oo.__webglColorRenderbuffer[or]);const To=Ro.convert(So.format,So.colorSpace),Uo=Ro.convert(So.type),Ho=getInternalFormat(So.internalFormat,To,Uo,So.colorSpace,!0===Rn.isXRRenderTarget),dl=getRenderTargetSamples(Rn);C.renderbufferStorageMultisample(C.RENDERBUFFER,dl,Ho,Rn.width,Rn.height),C.framebufferRenderbuffer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0+or,C.RENDERBUFFER,Oo.__webglColorRenderbuffer[or])}C.bindRenderbuffer(C.RENDERBUFFER,null),Rn.depthBuffer&&(Oo.__webglDepthRenderbuffer=C.createRenderbuffer(),setupRenderBufferStorage(Oo.__webglDepthRenderbuffer,Rn,!0)),or.bindFramebuffer(C.FRAMEBUFFER,null)}}if(dl){or.bindTexture(C.TEXTURE_CUBE_MAP,Ho.__webglTexture),setTextureParameters(C.TEXTURE_CUBE_MAP,To);for(let or=0;or<6;or++)if(To.mipmaps&&To.mipmaps.length>0)for(let So=0;So<To.mipmaps.length;So++)setupFrameBufferTexture(Oo.__webglFramebuffer[or][So],Rn,To,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+or,So);else setupFrameBufferTexture(Oo.__webglFramebuffer[or],Rn,To,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+or,0);textureNeedsGenerateMipmaps(To)&&generateMipmap(C.TEXTURE_CUBE_MAP),or.unbindTexture()}else if(ml){for(let To=0,Ro=qo.length;To<Ro;To++){const Ro=qo[To],Uo=So.get(Ro);or.bindTexture(C.TEXTURE_2D,Uo.__webglTexture),setTextureParameters(C.TEXTURE_2D,Ro),setupFrameBufferTexture(Oo.__webglFramebuffer,Rn,Ro,C.COLOR_ATTACHMENT0+To,C.TEXTURE_2D,0),textureNeedsGenerateMipmaps(Ro)&&generateMipmap(C.TEXTURE_2D)}or.unbindTexture()}else{let So=C.TEXTURE_2D;if((Rn.isWebGL3DRenderTarget||Rn.isWebGLArrayRenderTarget)&&(So=Rn.isWebGL3DRenderTarget?C.TEXTURE_3D:C.TEXTURE_2D_ARRAY),or.bindTexture(So,Ho.__webglTexture),setTextureParameters(So,To),To.mipmaps&&To.mipmaps.length>0)for(let or=0;or<To.mipmaps.length;or++)setupFrameBufferTexture(Oo.__webglFramebuffer[or],Rn,To,C.COLOR_ATTACHMENT0,So,or);else setupFrameBufferTexture(Oo.__webglFramebuffer,Rn,To,C.COLOR_ATTACHMENT0,So,0);textureNeedsGenerateMipmaps(To)&&generateMipmap(So),or.unbindTexture()}Rn.depthBuffer&&setupDepthRenderbuffer(Rn)},this.updateRenderTargetMipmap=function(Rn){const To=Rn.textures;for(let Ro=0,Uo=To.length;Ro<Uo;Ro++){const Uo=To[Ro];if(textureNeedsGenerateMipmaps(Uo)){const To=Rn.isWebGLCubeRenderTarget?C.TEXTURE_CUBE_MAP:C.TEXTURE_2D,Ro=So.get(Uo).__webglTexture;or.bindTexture(To,Ro),generateMipmap(To),or.unbindTexture()}}},this.updateMultisampleRenderTarget=function(Rn){if(Rn.samples>0)if(!1===useMultisampledRTT(Rn)){const To=Rn.textures,Ro=Rn.width,Uo=Rn.height;let Oo=C.COLOR_BUFFER_BIT;const qo=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT,dl=So.get(Rn),ml=To.length>1;if(ml)for(let Rn=0;Rn<To.length;Rn++)or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglMultisampledFramebuffer),C.framebufferRenderbuffer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.RENDERBUFFER,null),or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglFramebuffer),C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.TEXTURE_2D,null,0);or.bindFramebuffer(C.READ_FRAMEBUFFER,dl.__webglMultisampledFramebuffer),or.bindFramebuffer(C.DRAW_FRAMEBUFFER,dl.__webglFramebuffer);for(let or=0;or<To.length;or++){if(Rn.resolveDepthBuffer&&(Rn.depthBuffer&&(Oo|=C.DEPTH_BUFFER_BIT),Rn.stencilBuffer&&Rn.resolveStencilBuffer&&(Oo|=C.STENCIL_BUFFER_BIT)),ml){C.framebufferRenderbuffer(C.READ_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.RENDERBUFFER,dl.__webglColorRenderbuffer[or]);const Rn=So.get(To[or]).__webglTexture;C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_2D,Rn,0)}C.blitFramebuffer(0,0,Ro,Uo,0,0,Ro,Uo,Oo,C.NEAREST),!0===Ho&&(Nc.length=0,jc.length=0,Nc.push(C.COLOR_ATTACHMENT0+or),Rn.depthBuffer&&!1===Rn.resolveDepthBuffer&&(Nc.push(qo),jc.push(qo),C.invalidateFramebuffer(C.DRAW_FRAMEBUFFER,jc)),C.invalidateFramebuffer(C.READ_FRAMEBUFFER,Nc))}if(or.bindFramebuffer(C.READ_FRAMEBUFFER,null),or.bindFramebuffer(C.DRAW_FRAMEBUFFER,null),ml)for(let Rn=0;Rn<To.length;Rn++){or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglMultisampledFramebuffer),C.framebufferRenderbuffer(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.RENDERBUFFER,dl.__webglColorRenderbuffer[Rn]);const Ro=So.get(To[Rn]).__webglTexture;or.bindFramebuffer(C.FRAMEBUFFER,dl.__webglFramebuffer),C.framebufferTexture2D(C.DRAW_FRAMEBUFFER,C.COLOR_ATTACHMENT0+Rn,C.TEXTURE_2D,Ro,0)}or.bindFramebuffer(C.DRAW_FRAMEBUFFER,dl.__webglMultisampledFramebuffer)}else if(Rn.depthBuffer&&!1===Rn.resolveDepthBuffer&&Ho){const or=Rn.stencilBuffer?C.DEPTH_STENCIL_ATTACHMENT:C.DEPTH_ATTACHMENT;C.invalidateFramebuffer(C.DRAW_FRAMEBUFFER,[or])}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(C,Rn){return{convert:function(or,So){let To;void 0===So&&(So=Rp);const Ro=mm.getTransfer(So);if(or===Ed)return C.UNSIGNED_BYTE;if(or===Pd)return C.UNSIGNED_SHORT_4_4_4_4;if(or===zd)return C.UNSIGNED_SHORT_5_5_5_1;if(or===Rd)return C.UNSIGNED_INT_5_9_9_9_REV;if(or===Md)return C.BYTE;if(or===Sd)return C.SHORT;if(or===kd)return C.UNSIGNED_SHORT;if(or===Td)return C.INT;if(or===Id)return C.UNSIGNED_INT;if(or===Cd)return C.FLOAT;if(or===Ld)return C.HALF_FLOAT;if(or===Nd)return C.ALPHA;if(or===Ud)return C.RGB;if(or===Bd)return C.RGBA;if(or===Fd)return C.LUMINANCE;if(or===Od)return C.LUMINANCE_ALPHA;if(or===Vd)return C.DEPTH_COMPONENT;if(or===jd)return C.DEPTH_STENCIL;if(or===Gd)return C.RED;if(or===Hd)return C.RED_INTEGER;if(or===Zd)return C.RG;if(or===Wd)return C.RG_INTEGER;if(or===qd)return C.RGBA_INTEGER;if(or===Kd||or===Qd||or===Xd||or===Yd)if(Ro===Vp){if(To=Rn.get("WEBGL_compressed_texture_s3tc_srgb"),null===To)return null;if(or===Kd)return To.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(or===Qd)return To.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(or===Xd)return To.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(or===Yd)return To.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(To=Rn.get("WEBGL_compressed_texture_s3tc"),null===To)return null;if(or===Kd)return To.COMPRESSED_RGB_S3TC_DXT1_EXT;if(or===Qd)return To.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(or===Xd)return To.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(or===Yd)return To.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(or===Jd||or===$d||or===ep||or===tp){if(To=Rn.get("WEBGL_compressed_texture_pvrtc"),null===To)return null;if(or===Jd)return To.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(or===$d)return To.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(or===ep)return To.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(or===tp)return To.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(or===ip||or===np||or===rp){if(To=Rn.get("WEBGL_compressed_texture_etc"),null===To)return null;if(or===ip||or===np)return Ro===Vp?To.COMPRESSED_SRGB8_ETC2:To.COMPRESSED_RGB8_ETC2;if(or===rp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:To.COMPRESSED_RGBA8_ETC2_EAC}if(or===ap||or===sp||or===op||or===lp||or===cp||or===up||or===hp||or===dp||or===pp||or===mp||or===fp||or===gp||or===Ap||or===yp){if(To=Rn.get("WEBGL_compressed_texture_astc"),null===To)return null;if(or===ap)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:To.COMPRESSED_RGBA_ASTC_4x4_KHR;if(or===sp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:To.COMPRESSED_RGBA_ASTC_5x4_KHR;if(or===op)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:To.COMPRESSED_RGBA_ASTC_5x5_KHR;if(or===lp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:To.COMPRESSED_RGBA_ASTC_6x5_KHR;if(or===cp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:To.COMPRESSED_RGBA_ASTC_6x6_KHR;if(or===up)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:To.COMPRESSED_RGBA_ASTC_8x5_KHR;if(or===hp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:To.COMPRESSED_RGBA_ASTC_8x6_KHR;if(or===dp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:To.COMPRESSED_RGBA_ASTC_8x8_KHR;if(or===pp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:To.COMPRESSED_RGBA_ASTC_10x5_KHR;if(or===mp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:To.COMPRESSED_RGBA_ASTC_10x6_KHR;if(or===fp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:To.COMPRESSED_RGBA_ASTC_10x8_KHR;if(or===gp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:To.COMPRESSED_RGBA_ASTC_10x10_KHR;if(or===Ap)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:To.COMPRESSED_RGBA_ASTC_12x10_KHR;if(or===yp)return Ro===Vp?To.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:To.COMPRESSED_RGBA_ASTC_12x12_KHR}if(or===vp||or===xp||or===_p){if(To=Rn.get("EXT_texture_compression_bptc"),null===To)return null;if(or===vp)return Ro===Vp?To.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:To.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(or===xp)return To.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(or===_p)return To.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(or===bp||or===wp||or===Ep||or===Mp){if(To=Rn.get("EXT_texture_compression_rgtc"),null===To)return null;if(or===vp)return To.COMPRESSED_RED_RGTC1_EXT;if(or===wp)return To.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(or===Ep)return To.COMPRESSED_RED_GREEN_RGTC2_EXT;if(or===Mp)return To.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return or===Dd?C.UNSIGNED_INT_24_8:void 0!==C[or]?C[or]:null}}}class ArrayCamera extends PerspectiveCamera{constructor(C){void 0===C&&(C=[]),super(),this.isArrayCamera=!0,this.cameras=C}}class Group extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Xg={type:"move"};class WebXRController{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Group,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 Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(C){return null!==this._targetRay&&this._targetRay.dispatchEvent(C),null!==this._grip&&this._grip.dispatchEvent(C),null!==this._hand&&this._hand.dispatchEvent(C),this}connect(C){if(C&&C.hand){const Rn=this._hand;if(Rn)for(const or of C.hand.values())this._getHandJoint(Rn,or)}return this.dispatchEvent({type:"connected",data:C}),this}disconnect(C){return this.dispatchEvent({type:"disconnected",data:C}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(C,Rn,or){let So=null,To=null,Ro=null;const Uo=this._targetRay,Oo=this._grip,Ho=this._hand;if(C&&"visible-blurred"!==Rn.session.visibilityState){if(Ho&&C.hand){Ro=!0;for(const Ro of C.hand.values()){const C=Rn.getJointPose(Ro,or),So=this._getHandJoint(Ho,Ro);null!==C&&(So.matrix.fromArray(C.transform.matrix),So.matrix.decompose(So.position,So.rotation,So.scale),So.matrixWorldNeedsUpdate=!0,So.jointRadius=C.radius),So.visible=null!==C}const So=Ho.joints["index-finger-tip"],To=Ho.joints["thumb-tip"],Uo=So.position.distanceTo(To.position),Oo=.02,qo=.005;Ho.inputState.pinching&&Uo>Oo+qo?(Ho.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:C.handedness,target:this})):!Ho.inputState.pinching&&Uo<=Oo-qo&&(Ho.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:C.handedness,target:this}))}else null!==Oo&&C.gripSpace&&(To=Rn.getPose(C.gripSpace,or),null!==To&&(Oo.matrix.fromArray(To.transform.matrix),Oo.matrix.decompose(Oo.position,Oo.rotation,Oo.scale),Oo.matrixWorldNeedsUpdate=!0,To.linearVelocity?(Oo.hasLinearVelocity=!0,Oo.linearVelocity.copy(To.linearVelocity)):Oo.hasLinearVelocity=!1,To.angularVelocity?(Oo.hasAngularVelocity=!0,Oo.angularVelocity.copy(To.angularVelocity)):Oo.hasAngularVelocity=!1));null!==Uo&&(So=Rn.getPose(C.targetRaySpace,or),null===So&&null!==To&&(So=To),null!==So&&(Uo.matrix.fromArray(So.transform.matrix),Uo.matrix.decompose(Uo.position,Uo.rotation,Uo.scale),Uo.matrixWorldNeedsUpdate=!0,So.linearVelocity?(Uo.hasLinearVelocity=!0,Uo.linearVelocity.copy(So.linearVelocity)):Uo.hasLinearVelocity=!1,So.angularVelocity?(Uo.hasAngularVelocity=!0,Uo.angularVelocity.copy(So.angularVelocity)):Uo.hasAngularVelocity=!1,this.dispatchEvent(Xg)))}return null!==Uo&&(Uo.visible=null!==So),null!==Oo&&(Oo.visible=null!==To),null!==Ho&&(Ho.visible=null!==Ro),this}_getHandJoint(C,Rn){if(void 0===C.joints[Rn.jointName]){const or=new Group;or.matrixAutoUpdate=!1,or.visible=!1,C.joints[Rn.jointName]=or,C.add(or)}return C.joints[Rn.jointName]}}class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(C,Rn,or){if(null===this.texture){const So=new Texture;C.properties.get(So).__webglTexture=Rn.texture,Rn.depthNear==or.depthNear&&Rn.depthFar==or.depthFar||(this.depthNear=Rn.depthNear,this.depthFar=Rn.depthFar),this.texture=So}}getMesh(C){if(null!==this.texture&&null===this.mesh){const Rn=C.cameras[0].viewport,or=new ShaderMaterial({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:Rn.z},depthHeight:{value:Rn.w}}});this.mesh=new Mesh(new PlaneGeometry(20,20),or)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class WebXRManager extends EventDispatcher{constructor(C,Rn){super();const or=this;let So=null,To=1,Ro=null,Uo="local-floor",Oo=1,Ho=null,qo=null,dl=null,ml=null,fl=null,vl=null;const bl=new WebXRDepthSensing,kl=Rn.getContextAttributes();let Ll=null,Dl=null;const Nc=[],jc=[],Zc=new Vector2;let eu=null;const Ku=new PerspectiveCamera;Ku.layers.enable(1),Ku.viewport=new Vector4;const Yu=new PerspectiveCamera;Yu.layers.enable(2),Yu.viewport=new Vector4;const Eh=[Ku,Yu],Th=new ArrayCamera;Th.layers.enable(1),Th.layers.enable(2);let Ch=null,Lh=null;function onSessionEvent(C){const Rn=jc.indexOf(C.inputSource);if(-1===Rn)return;const or=Nc[Rn];void 0!==or&&(or.update(C.inputSource,C.frame,Ho||Ro),or.dispatchEvent({type:C.type,data:C.inputSource}))}function onSessionEnd(){So.removeEventListener("select",onSessionEvent),So.removeEventListener("selectstart",onSessionEvent),So.removeEventListener("selectend",onSessionEvent),So.removeEventListener("squeeze",onSessionEvent),So.removeEventListener("squeezestart",onSessionEvent),So.removeEventListener("squeezeend",onSessionEvent),So.removeEventListener("end",onSessionEnd),So.removeEventListener("inputsourceschange",onInputSourcesChange);for(let C=0;C<Nc.length;C++){const Rn=jc[C];null!==Rn&&(jc[C]=null,Nc[C].disconnect(Rn))}Ch=null,Lh=null,bl.reset(),C.setRenderTarget(Ll),fl=null,ml=null,dl=null,So=null,Dl=null,Uh.stop(),or.isPresenting=!1,C.setPixelRatio(eu),C.setSize(Zc.width,Zc.height,!1),or.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(C){for(let Rn=0;Rn<C.removed.length;Rn++){const or=C.removed[Rn],So=jc.indexOf(or);So>=0&&(jc[So]=null,Nc[So].disconnect(or))}for(let Rn=0;Rn<C.added.length;Rn++){const or=C.added[Rn];let So=jc.indexOf(or);if(-1===So){for(let C=0;C<Nc.length;C++){if(C>=jc.length){jc.push(or),So=C;break}if(null===jc[C]){jc[C]=or,So=C;break}}if(-1===So)break}const To=Nc[So];To&&To.connect(or)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(C){let Rn=Nc[C];return void 0===Rn&&(Rn=new WebXRController,Nc[C]=Rn),Rn.getTargetRaySpace()},this.getControllerGrip=function(C){let Rn=Nc[C];return void 0===Rn&&(Rn=new WebXRController,Nc[C]=Rn),Rn.getGripSpace()},this.getHand=function(C){let Rn=Nc[C];return void 0===Rn&&(Rn=new WebXRController,Nc[C]=Rn),Rn.getHandSpace()},this.setFramebufferScaleFactor=function(C){To=C,!0===or.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(C){Uo=C,!0===or.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return Ho||Ro},this.setReferenceSpace=function(C){Ho=C},this.getBaseLayer=function(){return null!==ml?ml:fl},this.getBinding=function(){return dl},this.getFrame=function(){return vl},this.getSession=function(){return So},this.setSession=async function(qo){if(So=qo,null!==So){if(Ll=C.getRenderTarget(),So.addEventListener("select",onSessionEvent),So.addEventListener("selectstart",onSessionEvent),So.addEventListener("selectend",onSessionEvent),So.addEventListener("squeeze",onSessionEvent),So.addEventListener("squeezestart",onSessionEvent),So.addEventListener("squeezeend",onSessionEvent),So.addEventListener("end",onSessionEnd),So.addEventListener("inputsourceschange",onInputSourcesChange),!0!==kl.xrCompatible&&await Rn.makeXRCompatible(),eu=C.getPixelRatio(),C.getSize(Zc),void 0===So.renderState.layers){const or={antialias:kl.antialias,alpha:!0,depth:kl.depth,stencil:kl.stencil,framebufferScaleFactor:To};fl=new XRWebGLLayer(So,Rn,or),So.updateRenderState({baseLayer:fl}),C.setPixelRatio(1),C.setSize(fl.framebufferWidth,fl.framebufferHeight,!1),Dl=new WebGLRenderTarget(fl.framebufferWidth,fl.framebufferHeight,{format:Bd,type:Ed,colorSpace:C.outputColorSpace,stencilBuffer:kl.stencil})}else{let or=null,Ro=null,Uo=null;kl.depth&&(Uo=kl.stencil?Rn.DEPTH24_STENCIL8:Rn.DEPTH_COMPONENT24,or=kl.stencil?jd:Vd,Ro=kl.stencil?Dd:Id);const Oo={colorFormat:Rn.RGBA8,depthFormat:Uo,scaleFactor:To};dl=new XRWebGLBinding(So,Rn),ml=dl.createProjectionLayer(Oo),So.updateRenderState({layers:[ml]}),C.setPixelRatio(1),C.setSize(ml.textureWidth,ml.textureHeight,!1),Dl=new WebGLRenderTarget(ml.textureWidth,ml.textureHeight,{format:Bd,type:Ed,depthTexture:new DepthTexture(ml.textureWidth,ml.textureHeight,Ro,void 0,void 0,void 0,void 0,void 0,void 0,or),stencilBuffer:kl.stencil,colorSpace:C.outputColorSpace,samples:kl.antialias?4:0,resolveDepthBuffer:!1===ml.ignoreDepthValues})}Dl.isXRRenderTarget=!0,this.setFoveation(Oo),Ho=null,Ro=await So.requestReferenceSpace(Uo),Uh.setContext(So),Uh.start(),or.isPresenting=!0,or.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==So)return So.environmentBlendMode},this.getDepthTexture=function(){return bl.getDepthTexture()};const Dh=new Vector3,Rh=new Vector3;function updateCamera(C,Rn){null===Rn?C.matrixWorld.copy(C.matrix):C.matrixWorld.multiplyMatrices(Rn.matrixWorld,C.matrix),C.matrixWorldInverse.copy(C.matrixWorld).invert()}this.updateCamera=function(C){if(null===So)return;let Rn=C.near,or=C.far;null!==bl.texture&&(bl.depthNear>0&&(Rn=bl.depthNear),bl.depthFar>0&&(or=bl.depthFar)),Th.near=Yu.near=Ku.near=Rn,Th.far=Yu.far=Ku.far=or,Ch===Th.near&&Lh===Th.far||(So.updateRenderState({depthNear:Th.near,depthFar:Th.far}),Ch=Th.near,Lh=Th.far);const To=C.parent,Ro=Th.cameras;updateCamera(Th,To);for(let So=0;So<Ro.length;So++)updateCamera(Ro[So],To);2===Ro.length?function(C,Rn,or){Dh.setFromMatrixPosition(Rn.matrixWorld),Rh.setFromMatrixPosition(or.matrixWorld);const So=Dh.distanceTo(Rh),To=Rn.projectionMatrix.elements,Ro=or.projectionMatrix.elements,Uo=To[14]/(To[10]-1),Oo=To[14]/(To[10]+1),Ho=(To[9]+1)/To[5],qo=(To[9]-1)/To[5],dl=(To[8]-1)/To[0],ml=(Ro[8]+1)/Ro[0],fl=Uo*dl,vl=Uo*ml,bl=So/(-dl+ml),kl=bl*-dl;if(Rn.matrixWorld.decompose(C.position,C.quaternion,C.scale),C.translateX(kl),C.translateZ(bl),C.matrixWorld.compose(C.position,C.quaternion,C.scale),C.matrixWorldInverse.copy(C.matrixWorld).invert(),-1===To[10])C.projectionMatrix.copy(Rn.projectionMatrix),C.projectionMatrixInverse.copy(Rn.projectionMatrixInverse);else{const Rn=Uo+bl,or=Oo+bl,To=fl-kl,Ro=vl+(So-kl),dl=Ho*Oo/or*Rn,ml=qo*Oo/or*Rn;C.projectionMatrix.makePerspective(To,Ro,dl,ml,Rn,or),C.projectionMatrixInverse.copy(C.projectionMatrix).invert()}}(Th,Ku,Yu):Th.projectionMatrix.copy(Ku.projectionMatrix),function(C,Rn,or){null===or?C.matrix.copy(Rn.matrixWorld):(C.matrix.copy(or.matrixWorld),C.matrix.invert(),C.matrix.multiply(Rn.matrixWorld));C.matrix.decompose(C.position,C.quaternion,C.scale),C.updateMatrixWorld(!0),C.projectionMatrix.copy(Rn.projectionMatrix),C.projectionMatrixInverse.copy(Rn.projectionMatrixInverse),C.isPerspectiveCamera&&(C.fov=2*sm*Math.atan(1/C.projectionMatrix.elements[5]),C.zoom=1)}(C,Th,To)},this.getCamera=function(){return Th},this.getFoveation=function(){if(null!==ml||null!==fl)return Oo},this.setFoveation=function(C){Oo=C,null!==ml&&(ml.fixedFoveation=C),null!==fl&&void 0!==fl.fixedFoveation&&(fl.fixedFoveation=C)},this.hasDepthSensing=function(){return null!==bl.texture},this.getDepthSensingMesh=function(){return bl.getMesh(Th)};let Nh=null;const Uh=new WebGLAnimation;Uh.setAnimationLoop((function(Rn,To){if(qo=To.getViewerPose(Ho||Ro),vl=To,null!==qo){const Rn=qo.views;null!==fl&&(C.setRenderTargetFramebuffer(Dl,fl.framebuffer),C.setRenderTarget(Dl));let or=!1;Rn.length!==Th.cameras.length&&(Th.cameras.length=0,or=!0);for(let So=0;So<Rn.length;So++){const To=Rn[So];let Ro=null;if(null!==fl)Ro=fl.getViewport(To);else{const Rn=dl.getViewSubImage(ml,To);Ro=Rn.viewport,0===So&&(C.setRenderTargetTextures(Dl,Rn.colorTexture,ml.ignoreDepthValues?void 0:Rn.depthStencilTexture),C.setRenderTarget(Dl))}let Uo=Eh[So];void 0===Uo&&(Uo=new PerspectiveCamera,Uo.layers.enable(So),Uo.viewport=new Vector4,Eh[So]=Uo),Uo.matrix.fromArray(To.transform.matrix),Uo.matrix.decompose(Uo.position,Uo.quaternion,Uo.scale),Uo.projectionMatrix.fromArray(To.projectionMatrix),Uo.projectionMatrixInverse.copy(Uo.projectionMatrix).invert(),Uo.viewport.set(Ro.x,Ro.y,Ro.width,Ro.height),0===So&&(Th.matrix.copy(Uo.matrix),Th.matrix.decompose(Th.position,Th.quaternion,Th.scale)),!0===or&&Th.cameras.push(Uo)}const To=So.enabledFeatures;if(To&&To.includes("depth-sensing")){const or=dl.getDepthInformation(Rn[0]);or&&or.isValid&&or.texture&&bl.init(C,or,So.renderState)}}for(let C=0;C<Nc.length;C++){const Rn=jc[C],or=Nc[C];null!==Rn&&void 0!==or&&or.update(Rn,To,Ho||Ro)}Nh&&Nh(Rn,To),To.detectedPlanes&&or.dispatchEvent({type:"planesdetected",data:To}),vl=null})),this.setAnimationLoop=function(C){Nh=C},this.dispose=function(){}}}const Yg=new Euler,Jg=new Matrix4;function WebGLMaterials(C,Rn){function refreshTransformUniform(C,Rn){!0===C.matrixAutoUpdate&&C.updateMatrix(),Rn.value.copy(C.matrix)}function refreshUniformsCommon(C,or){C.opacity.value=or.opacity,or.color&&C.diffuse.value.copy(or.color),or.emissive&&C.emissive.value.copy(or.emissive).multiplyScalar(or.emissiveIntensity),or.map&&(C.map.value=or.map,refreshTransformUniform(or.map,C.mapTransform)),or.alphaMap&&(C.alphaMap.value=or.alphaMap,refreshTransformUniform(or.alphaMap,C.alphaMapTransform)),or.bumpMap&&(C.bumpMap.value=or.bumpMap,refreshTransformUniform(or.bumpMap,C.bumpMapTransform),C.bumpScale.value=or.bumpScale,or.side===ml&&(C.bumpScale.value*=-1)),or.normalMap&&(C.normalMap.value=or.normalMap,refreshTransformUniform(or.normalMap,C.normalMapTransform),C.normalScale.value.copy(or.normalScale),or.side===ml&&C.normalScale.value.negate()),or.displacementMap&&(C.displacementMap.value=or.displacementMap,refreshTransformUniform(or.displacementMap,C.displacementMapTransform),C.displacementScale.value=or.displacementScale,C.displacementBias.value=or.displacementBias),or.emissiveMap&&(C.emissiveMap.value=or.emissiveMap,refreshTransformUniform(or.emissiveMap,C.emissiveMapTransform)),or.specularMap&&(C.specularMap.value=or.specularMap,refreshTransformUniform(or.specularMap,C.specularMapTransform)),or.alphaTest>0&&(C.alphaTest.value=or.alphaTest);const So=Rn.get(or),To=So.envMap,Ro=So.envMapRotation;To&&(C.envMap.value=To,Yg.copy(Ro),Yg.x*=-1,Yg.y*=-1,Yg.z*=-1,To.isCubeTexture&&!1===To.isRenderTargetTexture&&(Yg.y*=-1,Yg.z*=-1),C.envMapRotation.value.setFromMatrix4(Jg.makeRotationFromEuler(Yg)),C.flipEnvMap.value=To.isCubeTexture&&!1===To.isRenderTargetTexture?-1:1,C.reflectivity.value=or.reflectivity,C.ior.value=or.ior,C.refractionRatio.value=or.refractionRatio),or.lightMap&&(C.lightMap.value=or.lightMap,C.lightMapIntensity.value=or.lightMapIntensity,refreshTransformUniform(or.lightMap,C.lightMapTransform)),or.aoMap&&(C.aoMap.value=or.aoMap,C.aoMapIntensity.value=or.aoMapIntensity,refreshTransformUniform(or.aoMap,C.aoMapTransform))}return{refreshFogUniforms:function(Rn,or){or.color.getRGB(Rn.fogColor.value,getUnlitUniformColorSpace(C)),or.isFog?(Rn.fogNear.value=or.near,Rn.fogFar.value=or.far):or.isFogExp2&&(Rn.fogDensity.value=or.density)},refreshMaterialUniforms:function(C,or,So,To,Ro){or.isMeshBasicMaterial||or.isMeshLambertMaterial?refreshUniformsCommon(C,or):or.isMeshToonMaterial?(refreshUniformsCommon(C,or),function(C,Rn){Rn.gradientMap&&(C.gradientMap.value=Rn.gradientMap)}(C,or)):or.isMeshPhongMaterial?(refreshUniformsCommon(C,or),function(C,Rn){C.specular.value.copy(Rn.specular),C.shininess.value=Math.max(Rn.shininess,1e-4)}(C,or)):or.isMeshStandardMaterial?(refreshUniformsCommon(C,or),function(C,Rn){C.metalness.value=Rn.metalness,Rn.metalnessMap&&(C.metalnessMap.value=Rn.metalnessMap,refreshTransformUniform(Rn.metalnessMap,C.metalnessMapTransform));C.roughness.value=Rn.roughness,Rn.roughnessMap&&(C.roughnessMap.value=Rn.roughnessMap,refreshTransformUniform(Rn.roughnessMap,C.roughnessMapTransform));Rn.envMap&&(C.envMapIntensity.value=Rn.envMapIntensity)}(C,or),or.isMeshPhysicalMaterial&&function(C,Rn,or){C.ior.value=Rn.ior,Rn.sheen>0&&(C.sheenColor.value.copy(Rn.sheenColor).multiplyScalar(Rn.sheen),C.sheenRoughness.value=Rn.sheenRoughness,Rn.sheenColorMap&&(C.sheenColorMap.value=Rn.sheenColorMap,refreshTransformUniform(Rn.sheenColorMap,C.sheenColorMapTransform)),Rn.sheenRoughnessMap&&(C.sheenRoughnessMap.value=Rn.sheenRoughnessMap,refreshTransformUniform(Rn.sheenRoughnessMap,C.sheenRoughnessMapTransform)));Rn.clearcoat>0&&(C.clearcoat.value=Rn.clearcoat,C.clearcoatRoughness.value=Rn.clearcoatRoughness,Rn.clearcoatMap&&(C.clearcoatMap.value=Rn.clearcoatMap,refreshTransformUniform(Rn.clearcoatMap,C.clearcoatMapTransform)),Rn.clearcoatRoughnessMap&&(C.clearcoatRoughnessMap.value=Rn.clearcoatRoughnessMap,refreshTransformUniform(Rn.clearcoatRoughnessMap,C.clearcoatRoughnessMapTransform)),Rn.clearcoatNormalMap&&(C.clearcoatNormalMap.value=Rn.clearcoatNormalMap,refreshTransformUniform(Rn.clearcoatNormalMap,C.clearcoatNormalMapTransform),C.clearcoatNormalScale.value.copy(Rn.clearcoatNormalScale),Rn.side===ml&&C.clearcoatNormalScale.value.negate()));Rn.dispersion>0&&(C.dispersion.value=Rn.dispersion);Rn.iridescence>0&&(C.iridescence.value=Rn.iridescence,C.iridescenceIOR.value=Rn.iridescenceIOR,C.iridescenceThicknessMinimum.value=Rn.iridescenceThicknessRange[0],C.iridescenceThicknessMaximum.value=Rn.iridescenceThicknessRange[1],Rn.iridescenceMap&&(C.iridescenceMap.value=Rn.iridescenceMap,refreshTransformUniform(Rn.iridescenceMap,C.iridescenceMapTransform)),Rn.iridescenceThicknessMap&&(C.iridescenceThicknessMap.value=Rn.iridescenceThicknessMap,refreshTransformUniform(Rn.iridescenceThicknessMap,C.iridescenceThicknessMapTransform)));Rn.transmission>0&&(C.transmission.value=Rn.transmission,C.transmissionSamplerMap.value=or.texture,C.transmissionSamplerSize.value.set(or.width,or.height),Rn.transmissionMap&&(C.transmissionMap.value=Rn.transmissionMap,refreshTransformUniform(Rn.transmissionMap,C.transmissionMapTransform)),C.thickness.value=Rn.thickness,Rn.thicknessMap&&(C.thicknessMap.value=Rn.thicknessMap,refreshTransformUniform(Rn.thicknessMap,C.thicknessMapTransform)),C.attenuationDistance.value=Rn.attenuationDistance,C.attenuationColor.value.copy(Rn.attenuationColor));Rn.anisotropy>0&&(C.anisotropyVector.value.set(Rn.anisotropy*Math.cos(Rn.anisotropyRotation),Rn.anisotropy*Math.sin(Rn.anisotropyRotation)),Rn.anisotropyMap&&(C.anisotropyMap.value=Rn.anisotropyMap,refreshTransformUniform(Rn.anisotropyMap,C.anisotropyMapTransform)));C.specularIntensity.value=Rn.specularIntensity,C.specularColor.value.copy(Rn.specularColor),Rn.specularColorMap&&(C.specularColorMap.value=Rn.specularColorMap,refreshTransformUniform(Rn.specularColorMap,C.specularColorMapTransform));Rn.specularIntensityMap&&(C.specularIntensityMap.value=Rn.specularIntensityMap,refreshTransformUniform(Rn.specularIntensityMap,C.specularIntensityMapTransform))}(C,or,Ro)):or.isMeshMatcapMaterial?(refreshUniformsCommon(C,or),function(C,Rn){Rn.matcap&&(C.matcap.value=Rn.matcap)}(C,or)):or.isMeshDepthMaterial?refreshUniformsCommon(C,or):or.isMeshDistanceMaterial?(refreshUniformsCommon(C,or),function(C,or){const So=Rn.get(or).light;C.referencePosition.value.setFromMatrixPosition(So.matrixWorld),C.nearDistance.value=So.shadow.camera.near,C.farDistance.value=So.shadow.camera.far}(C,or)):or.isMeshNormalMaterial?refreshUniformsCommon(C,or):or.isLineBasicMaterial?(function(C,Rn){C.diffuse.value.copy(Rn.color),C.opacity.value=Rn.opacity,Rn.map&&(C.map.value=Rn.map,refreshTransformUniform(Rn.map,C.mapTransform))}(C,or),or.isLineDashedMaterial&&function(C,Rn){C.dashSize.value=Rn.dashSize,C.totalSize.value=Rn.dashSize+Rn.gapSize,C.scale.value=Rn.scale}(C,or)):or.isPointsMaterial?function(C,Rn,or,So){C.diffuse.value.copy(Rn.color),C.opacity.value=Rn.opacity,C.size.value=Rn.size*or,C.scale.value=.5*So,Rn.map&&(C.map.value=Rn.map,refreshTransformUniform(Rn.map,C.uvTransform));Rn.alphaMap&&(C.alphaMap.value=Rn.alphaMap,refreshTransformUniform(Rn.alphaMap,C.alphaMapTransform));Rn.alphaTest>0&&(C.alphaTest.value=Rn.alphaTest)}(C,or,So,To):or.isSpriteMaterial?function(C,Rn){C.diffuse.value.copy(Rn.color),C.opacity.value=Rn.opacity,C.rotation.value=Rn.rotation,Rn.map&&(C.map.value=Rn.map,refreshTransformUniform(Rn.map,C.mapTransform));Rn.alphaMap&&(C.alphaMap.value=Rn.alphaMap,refreshTransformUniform(Rn.alphaMap,C.alphaMapTransform));Rn.alphaTest>0&&(C.alphaTest.value=Rn.alphaTest)}(C,or):or.isShadowMaterial?(C.color.value.copy(or.color),C.opacity.value=or.opacity):or.isShaderMaterial&&(or.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(C,Rn,or,So){let To={},Ro={},Uo=[];const Oo=C.getParameter(C.MAX_UNIFORM_BUFFER_BINDINGS);function hasUniformChanged(C,Rn,or,So){const To=C.value,Ro=Rn+"_"+or;if(void 0===So[Ro])return So[Ro]="number"===typeof To||"boolean"===typeof To?To:To.clone(),!0;{const C=So[Ro];if("number"===typeof To||"boolean"===typeof To){if(C!==To)return So[Ro]=To,!0}else if(!1===C.equals(To))return C.copy(To),!0}return!1}function getUniformSize(C){const Rn={boundary:0,storage:0};return"number"===typeof C||"boolean"===typeof C?(Rn.boundary=4,Rn.storage=4):C.isVector2?(Rn.boundary=8,Rn.storage=8):C.isVector3||C.isColor?(Rn.boundary=16,Rn.storage=12):C.isVector4?(Rn.boundary=16,Rn.storage=16):C.isMatrix3?(Rn.boundary=48,Rn.storage=48):C.isMatrix4?(Rn.boundary=64,Rn.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),Rn}function onUniformsGroupsDispose(Rn){const or=Rn.target;or.removeEventListener("dispose",onUniformsGroupsDispose);const So=Uo.indexOf(or.__bindingPointIndex);Uo.splice(So,1),C.deleteBuffer(To[or.id]),delete To[or.id],delete Ro[or.id]}return{bind:function(C,Rn){const or=Rn.program;So.uniformBlockBinding(C,or)},update:function(or,Ho){let qo=To[or.id];void 0===qo&&(!function(C){const Rn=C.uniforms;let or=0;const So=16;for(let Ro=0,Uo=Rn.length;Ro<Uo;Ro++){const C=Array.isArray(Rn[Ro])?Rn[Ro]:[Rn[Ro]];for(let Rn=0,To=C.length;Rn<To;Rn++){const To=C[Rn],Ro=Array.isArray(To.value)?To.value:[To.value];for(let C=0,Rn=Ro.length;C<Rn;C++){const Rn=getUniformSize(Ro[C]),Uo=or%So,Oo=Uo%Rn.boundary,Ho=Uo+Oo;or+=Oo,0!==Ho&&So-Ho<Rn.storage&&(or+=So-Ho),To.__data=new Float32Array(Rn.storage/Float32Array.BYTES_PER_ELEMENT),To.__offset=or,or+=Rn.storage}}}const To=or%So;To>0&&(or+=So-To);C.__size=or,C.__cache={}}(or),qo=function(Rn){const or=function(){for(let C=0;C<Oo;C++)if(-1===Uo.indexOf(C))return Uo.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();Rn.__bindingPointIndex=or;const So=C.createBuffer(),To=Rn.__size,Ro=Rn.usage;return C.bindBuffer(C.UNIFORM_BUFFER,So),C.bufferData(C.UNIFORM_BUFFER,To,Ro),C.bindBuffer(C.UNIFORM_BUFFER,null),C.bindBufferBase(C.UNIFORM_BUFFER,or,So),So}(or),To[or.id]=qo,or.addEventListener("dispose",onUniformsGroupsDispose));const dl=Ho.program;So.updateUBOMapping(or,dl);const ml=Rn.render.frame;Ro[or.id]!==ml&&(!function(Rn){const or=To[Rn.id],So=Rn.uniforms,Ro=Rn.__cache;C.bindBuffer(C.UNIFORM_BUFFER,or);for(let To=0,Uo=So.length;To<Uo;To++){const Rn=Array.isArray(So[To])?So[To]:[So[To]];for(let or=0,So=Rn.length;or<So;or++){const So=Rn[or];if(!0===hasUniformChanged(So,To,or,Ro)){const Rn=So.__offset,or=Array.isArray(So.value)?So.value:[So.value];let To=0;for(let Ro=0;Ro<or.length;Ro++){const Uo=or[Ro],Oo=getUniformSize(Uo);"number"===typeof Uo||"boolean"===typeof Uo?(So.__data[0]=Uo,C.bufferSubData(C.UNIFORM_BUFFER,Rn+To,So.__data)):Uo.isMatrix3?(So.__data[0]=Uo.elements[0],So.__data[1]=Uo.elements[1],So.__data[2]=Uo.elements[2],So.__data[3]=0,So.__data[4]=Uo.elements[3],So.__data[5]=Uo.elements[4],So.__data[6]=Uo.elements[5],So.__data[7]=0,So.__data[8]=Uo.elements[6],So.__data[9]=Uo.elements[7],So.__data[10]=Uo.elements[8],So.__data[11]=0):(Uo.toArray(So.__data,To),To+=Oo.storage/Float32Array.BYTES_PER_ELEMENT)}C.bufferSubData(C.UNIFORM_BUFFER,Rn,So.__data)}}}C.bindBuffer(C.UNIFORM_BUFFER,null)}(or),Ro[or.id]=ml)},dispose:function(){for(const Rn in To)C.deleteBuffer(To[Rn]);Uo=[],To={},Ro={}}}}class WebGLRenderer{constructor(C){void 0===C&&(C={});const{canvas:Rn=createCanvasElement(),context:or=null,depth:To=!0,stencil:Ro=!1,alpha:Uo=!1,antialias:Oo=!1,premultipliedAlpha:Ho=!0,preserveDrawingBuffer:qo=!1,powerPreference:vl="default",failIfMajorPerformanceCaveat:bl=!1}=C;let kl;if(this.isWebGLRenderer=!0,null!==or){if("undefined"!==typeof WebGLRenderingContext&&or instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");kl=or.getContextAttributes().alpha}else kl=Uo;const Ll=new Uint32Array(4),Dl=new Int32Array(4);let Nc=null,jc=null;const Zc=[],eu=[];this.domElement=Rn,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=Np,this.toneMapping=id,this.toneMappingExposure=1;const Ku=this;let Yu=!1,Eh=0,Th=0,Ch=null,Lh=-1,Dh=null;const Rh=new Vector4,Nh=new Vector4;let Uh=null;const Bh=new Color(0);let Fh=0,Oh=Rn.width,Vh=Rn.height,jh=1,Gh=null,Hh=null;const Zh=new Vector4(0,0,Oh,Vh),Wh=new Vector4(0,0,Oh,Vh);let qh=!1;const Kh=new Frustum;let Qh=!1,Xh=!1;const Yh=new Matrix4,Jh=new Vector3,$h=new Vector4,ed={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let td=!1;function getTargetPixelRatio(){return null===Ch?jh:1}let nd,rd,ad,sd,od,ld,cd,ud,hd,dd,pd,md,fd,gd,Ad,yd,vd,xd,_d,bd,Md,Sd,Td,Cd,Rd=or;function getContext(C,or){return Rn.getContext(C,or)}try{const C={alpha:!0,depth:To,stencil:Ro,antialias:Oo,premultipliedAlpha:Ho,preserveDrawingBuffer:qo,powerPreference:vl,failIfMajorPerformanceCaveat:bl};if("setAttribute"in Rn&&Rn.setAttribute("data-engine","three.js r"+So),Rn.addEventListener("webglcontextlost",onContextLost,!1),Rn.addEventListener("webglcontextrestored",onContextRestore,!1),Rn.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===Rd){const Rn="webgl2";if(Rd=getContext(Rn,C),null===Rd)throw getContext(Rn)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Fd){throw console.error("THREE.WebGLRenderer: "+Fd.message),Fd}function initGLContext(){nd=new WebGLExtensions(Rd),nd.init(),Sd=new WebGLUtils(Rd,nd),rd=new WebGLCapabilities(Rd,nd,C,Sd),ad=new WebGLState(Rd),sd=new WebGLInfo(Rd),od=new WebGLProperties,ld=new WebGLTextures(Rd,nd,ad,od,rd,Sd,sd),cd=new WebGLCubeMaps(Ku),ud=new WebGLCubeUVMaps(Ku),hd=new WebGLAttributes(Rd),Td=new WebGLBindingStates(Rd,hd),dd=new WebGLGeometries(Rd,hd,sd,Td),pd=new WebGLObjects(Rd,dd,hd,sd),_d=new WebGLMorphtargets(Rd,rd,ld),yd=new WebGLClipping(od),md=new WebGLPrograms(Ku,cd,ud,nd,rd,Td,yd),fd=new WebGLMaterials(Ku,od),gd=new WebGLRenderLists,Ad=new WebGLRenderStates(nd),xd=new WebGLBackground(Ku,cd,ud,ad,pd,kl,Ho),vd=new WebGLShadowMap(Ku,pd,rd),Cd=new WebGLUniformsGroups(Rd,sd,rd,ad),bd=new WebGLBufferRenderer(Rd,nd,sd),Md=new WebGLIndexedBufferRenderer(Rd,nd,sd),sd.programs=md.programs,Ku.capabilities=rd,Ku.extensions=nd,Ku.properties=od,Ku.renderLists=gd,Ku.shadowMap=vd,Ku.state=ad,Ku.info=sd}initGLContext();const Nd=new WebXRManager(Ku,Rd);function onContextLost(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),Yu=!0}function onContextRestore(){console.log("THREE.WebGLRenderer: Context Restored."),Yu=!1;const C=sd.autoReset,Rn=vd.enabled,or=vd.autoUpdate,So=vd.needsUpdate,To=vd.type;initGLContext(),sd.autoReset=C,vd.enabled=Rn,vd.autoUpdate=or,vd.needsUpdate=So,vd.type=To}function onContextCreationError(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function onMaterialDispose(C){const Rn=C.target;Rn.removeEventListener("dispose",onMaterialDispose),function(C){(function(C){const Rn=od.get(C).programs;void 0!==Rn&&(Rn.forEach((function(C){md.releaseProgram(C)})),C.isShaderMaterial&&md.releaseShaderCache(C))})(C),od.remove(C)}(Rn)}function prepareMaterial(C,Rn,or){!0===C.transparent&&C.side===fl&&!1===C.forceSinglePass?(C.side=ml,C.needsUpdate=!0,getProgram(C,Rn,or),C.side=dl,C.needsUpdate=!0,getProgram(C,Rn,or),C.side=fl):getProgram(C,Rn,or)}this.xr=Nd,this.getContext=function(){return Rd},this.getContextAttributes=function(){return Rd.getContextAttributes()},this.forceContextLoss=function(){const C=nd.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=nd.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return jh},this.setPixelRatio=function(C){void 0!==C&&(jh=C,this.setSize(Oh,Vh,!1))},this.getSize=function(C){return C.set(Oh,Vh)},this.setSize=function(C,or,So){void 0===So&&(So=!0),Nd.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Oh=C,Vh=or,Rn.width=Math.floor(C*jh),Rn.height=Math.floor(or*jh),!0===So&&(Rn.style.width=C+"px",Rn.style.height=or+"px"),this.setViewport(0,0,C,or))},this.getDrawingBufferSize=function(C){return C.set(Oh*jh,Vh*jh).floor()},this.setDrawingBufferSize=function(C,or,So){Oh=C,Vh=or,jh=So,Rn.width=Math.floor(C*So),Rn.height=Math.floor(or*So),this.setViewport(0,0,C,or)},this.getCurrentViewport=function(C){return C.copy(Rh)},this.getViewport=function(C){return C.copy(Zh)},this.setViewport=function(C,Rn,or,So){C.isVector4?Zh.set(C.x,C.y,C.z,C.w):Zh.set(C,Rn,or,So),ad.viewport(Rh.copy(Zh).multiplyScalar(jh).round())},this.getScissor=function(C){return C.copy(Wh)},this.setScissor=function(C,Rn,or,So){C.isVector4?Wh.set(C.x,C.y,C.z,C.w):Wh.set(C,Rn,or,So),ad.scissor(Nh.copy(Wh).multiplyScalar(jh).round())},this.getScissorTest=function(){return qh},this.setScissorTest=function(C){ad.setScissorTest(qh=C)},this.setOpaqueSort=function(C){Gh=C},this.setTransparentSort=function(C){Hh=C},this.getClearColor=function(C){return C.copy(xd.getClearColor())},this.setClearColor=function(){xd.setClearColor.apply(xd,arguments)},this.getClearAlpha=function(){return xd.getClearAlpha()},this.setClearAlpha=function(){xd.setClearAlpha.apply(xd,arguments)},this.clear=function(C,Rn,or){void 0===C&&(C=!0),void 0===Rn&&(Rn=!0),void 0===or&&(or=!0);let So=0;if(C){let C=!1;if(null!==Ch){const Rn=Ch.texture.format;C=Rn===qd||Rn===Wd||Rn===Hd}if(C){const C=Ch.texture.type,Rn=C===Ed||C===Id||C===kd||C===Dd||C===Pd||C===zd,or=xd.getClearColor(),So=xd.getClearAlpha(),To=or.r,Ro=or.g,Uo=or.b;Rn?(Ll[0]=To,Ll[1]=Ro,Ll[2]=Uo,Ll[3]=So,Rd.clearBufferuiv(Rd.COLOR,0,Ll)):(Dl[0]=To,Dl[1]=Ro,Dl[2]=Uo,Dl[3]=So,Rd.clearBufferiv(Rd.COLOR,0,Dl))}else So|=Rd.COLOR_BUFFER_BIT}Rn&&(So|=Rd.DEPTH_BUFFER_BIT),or&&(So|=Rd.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Rd.clear(So)},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(){Rn.removeEventListener("webglcontextlost",onContextLost,!1),Rn.removeEventListener("webglcontextrestored",onContextRestore,!1),Rn.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),gd.dispose(),Ad.dispose(),od.dispose(),cd.dispose(),ud.dispose(),pd.dispose(),Td.dispose(),Cd.dispose(),md.dispose(),Nd.dispose(),Nd.removeEventListener("sessionstart",onXRSessionStart),Nd.removeEventListener("sessionend",onXRSessionEnd),Bd.stop()},this.renderBufferDirect=function(C,Rn,or,So,To,Ro){null===Rn&&(Rn=ed);const Uo=To.isMesh&&To.matrixWorld.determinant()<0,Oo=function(C,Rn,or,So,To){!0!==Rn.isScene&&(Rn=ed);ld.resetTextureUnits();const Ro=Rn.fog,Uo=So.isMeshStandardMaterial?Rn.environment:null,Oo=null===Ch?Ku.outputColorSpace:!0===Ch.isXRRenderTarget?Ch.texture.colorSpace:Up,Ho=(So.isMeshStandardMaterial?ud:cd).get(So.envMap||Uo),qo=!0===So.vertexColors&&!!or.attributes.color&&4===or.attributes.color.itemSize,dl=!!or.attributes.tangent&&(!!So.normalMap||So.anisotropy>0),ml=!!or.morphAttributes.position,fl=!!or.morphAttributes.normal,vl=!!or.morphAttributes.color;let bl=id;So.toneMapped&&(null!==Ch&&!0!==Ch.isXRRenderTarget||(bl=Ku.toneMapping));const kl=or.morphAttributes.position||or.morphAttributes.normal||or.morphAttributes.color,Ll=void 0!==kl?kl.length:0,Dl=od.get(So),Nc=jc.state.lights;if(!0===Qh&&(!0===Xh||C!==Dh)){const Rn=C===Dh&&So.id===Lh;yd.setState(So,C,Rn)}let Zc=!1;So.version===Dl.__version?Dl.needsLights&&Dl.lightsStateVersion!==Nc.state.version||Dl.outputColorSpace!==Oo||To.isBatchedMesh&&!1===Dl.batching?Zc=!0:To.isBatchedMesh||!0!==Dl.batching?To.isBatchedMesh&&!0===Dl.batchingColor&&null===To.colorTexture||To.isBatchedMesh&&!1===Dl.batchingColor&&null!==To.colorTexture||To.isInstancedMesh&&!1===Dl.instancing?Zc=!0:To.isInstancedMesh||!0!==Dl.instancing?To.isSkinnedMesh&&!1===Dl.skinning?Zc=!0:To.isSkinnedMesh||!0!==Dl.skinning?To.isInstancedMesh&&!0===Dl.instancingColor&&null===To.instanceColor||To.isInstancedMesh&&!1===Dl.instancingColor&&null!==To.instanceColor||To.isInstancedMesh&&!0===Dl.instancingMorph&&null===To.morphTexture||To.isInstancedMesh&&!1===Dl.instancingMorph&&null!==To.morphTexture||Dl.envMap!==Ho||!0===So.fog&&Dl.fog!==Ro?Zc=!0:void 0===Dl.numClippingPlanes||Dl.numClippingPlanes===yd.numPlanes&&Dl.numIntersection===yd.numIntersection?(Dl.vertexAlphas!==qo||Dl.vertexTangents!==dl||Dl.morphTargets!==ml||Dl.morphNormals!==fl||Dl.morphColors!==vl||Dl.toneMapping!==bl||Dl.morphTargetsCount!==Ll)&&(Zc=!0):Zc=!0:Zc=!0:Zc=!0:Zc=!0:(Zc=!0,Dl.__version=So.version);let eu=Dl.currentProgram;!0===Zc&&(eu=getProgram(So,Rn,To));let Yu=!1,Eh=!1,Th=!1;const Rh=eu.getUniforms(),Nh=Dl.uniforms;ad.useProgram(eu.program)&&(Yu=!0,Eh=!0,Th=!0);So.id!==Lh&&(Lh=So.id,Eh=!0);if(Yu||Dh!==C){Rh.setValue(Rd,"projectionMatrix",C.projectionMatrix),Rh.setValue(Rd,"viewMatrix",C.matrixWorldInverse);const Rn=Rh.map.cameraPosition;void 0!==Rn&&Rn.setValue(Rd,Jh.setFromMatrixPosition(C.matrixWorld)),rd.logarithmicDepthBuffer&&Rh.setValue(Rd,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(So.isMeshPhongMaterial||So.isMeshToonMaterial||So.isMeshLambertMaterial||So.isMeshBasicMaterial||So.isMeshStandardMaterial||So.isShaderMaterial)&&Rh.setValue(Rd,"isOrthographic",!0===C.isOrthographicCamera),Dh!==C&&(Dh=C,Eh=!0,Th=!0)}if(To.isSkinnedMesh){Rh.setOptional(Rd,To,"bindMatrix"),Rh.setOptional(Rd,To,"bindMatrixInverse");const C=To.skeleton;C&&(null===C.boneTexture&&C.computeBoneTexture(),Rh.setValue(Rd,"boneTexture",C.boneTexture,ld))}To.isBatchedMesh&&(Rh.setOptional(Rd,To,"batchingTexture"),Rh.setValue(Rd,"batchingTexture",To._matricesTexture,ld),Rh.setOptional(Rd,To,"batchingIdTexture"),Rh.setValue(Rd,"batchingIdTexture",To._indirectTexture,ld),Rh.setOptional(Rd,To,"batchingColorTexture"),null!==To._colorsTexture&&Rh.setValue(Rd,"batchingColorTexture",To._colorsTexture,ld));const Uh=or.morphAttributes;void 0===Uh.position&&void 0===Uh.normal&&void 0===Uh.color||_d.update(To,or,eu);(Eh||Dl.receiveShadow!==To.receiveShadow)&&(Dl.receiveShadow=To.receiveShadow,Rh.setValue(Rd,"receiveShadow",To.receiveShadow));So.isMeshGouraudMaterial&&null!==So.envMap&&(Nh.envMap.value=Ho,Nh.flipEnvMap.value=Ho.isCubeTexture&&!1===Ho.isRenderTargetTexture?-1:1);So.isMeshStandardMaterial&&null===So.envMap&&null!==Rn.environment&&(Nh.envMapIntensity.value=Rn.environmentIntensity);Eh&&(Rh.setValue(Rd,"toneMappingExposure",Ku.toneMappingExposure),Dl.needsLights&&(Fh=Th,(Bh=Nh).ambientLightColor.needsUpdate=Fh,Bh.lightProbe.needsUpdate=Fh,Bh.directionalLights.needsUpdate=Fh,Bh.directionalLightShadows.needsUpdate=Fh,Bh.pointLights.needsUpdate=Fh,Bh.pointLightShadows.needsUpdate=Fh,Bh.spotLights.needsUpdate=Fh,Bh.spotLightShadows.needsUpdate=Fh,Bh.rectAreaLights.needsUpdate=Fh,Bh.hemisphereLights.needsUpdate=Fh),Ro&&!0===So.fog&&fd.refreshFogUniforms(Nh,Ro),fd.refreshMaterialUniforms(Nh,So,jh,Vh,jc.state.transmissionRenderTarget[C.id]),WebGLUniforms.upload(Rd,getUniformList(Dl),Nh,ld));var Bh,Fh;So.isShaderMaterial&&!0===So.uniformsNeedUpdate&&(WebGLUniforms.upload(Rd,getUniformList(Dl),Nh,ld),So.uniformsNeedUpdate=!1);So.isSpriteMaterial&&Rh.setValue(Rd,"center",To.center);if(Rh.setValue(Rd,"modelViewMatrix",To.modelViewMatrix),Rh.setValue(Rd,"normalMatrix",To.normalMatrix),Rh.setValue(Rd,"modelMatrix",To.matrixWorld),So.isShaderMaterial||So.isRawShaderMaterial){const C=So.uniformsGroups;for(let Rn=0,or=C.length;Rn<or;Rn++){const or=C[Rn];Cd.update(or,eu),Cd.bind(or,eu)}}return eu}(C,Rn,or,So,To);ad.setMaterial(So,Uo);let Ho=or.index,qo=1;if(!0===So.wireframe){if(Ho=dd.getWireframeAttribute(or),void 0===Ho)return;qo=2}const dl=or.drawRange,ml=or.attributes.position;let fl=dl.start*qo,vl=(dl.start+dl.count)*qo;null!==Ro&&(fl=Math.max(fl,Ro.start*qo),vl=Math.min(vl,(Ro.start+Ro.count)*qo)),null!==Ho?(fl=Math.max(fl,0),vl=Math.min(vl,Ho.count)):void 0!==ml&&null!==ml&&(fl=Math.max(fl,0),vl=Math.min(vl,ml.count));const bl=vl-fl;if(bl<0||bl===1/0)return;let kl;Td.setup(To,So,Oo,or,Ho);let Ll=bd;if(null!==Ho&&(kl=hd.get(Ho),Ll=Md,Ll.setIndex(kl)),To.isMesh)!0===So.wireframe?(ad.setLineWidth(So.wireframeLinewidth*getTargetPixelRatio()),Ll.setMode(Rd.LINES)):Ll.setMode(Rd.TRIANGLES);else if(To.isLine){let C=So.linewidth;void 0===C&&(C=1),ad.setLineWidth(C*getTargetPixelRatio()),To.isLineSegments?Ll.setMode(Rd.LINES):To.isLineLoop?Ll.setMode(Rd.LINE_LOOP):Ll.setMode(Rd.LINE_STRIP)}else To.isPoints?Ll.setMode(Rd.POINTS):To.isSprite&&Ll.setMode(Rd.TRIANGLES);if(To.isBatchedMesh)if(null!==To._multiDrawInstances)Ll.renderMultiDrawInstances(To._multiDrawStarts,To._multiDrawCounts,To._multiDrawCount,To._multiDrawInstances);else if(nd.get("WEBGL_multi_draw"))Ll.renderMultiDraw(To._multiDrawStarts,To._multiDrawCounts,To._multiDrawCount);else{const C=To._multiDrawStarts,Rn=To._multiDrawCounts,or=To._multiDrawCount,Ro=Ho?hd.get(Ho).bytesPerElement:1,Uo=od.get(So).currentProgram.getUniforms();for(let So=0;So<or;So++)Uo.setValue(Rd,"_gl_DrawID",So),Ll.render(C[So]/Ro,Rn[So])}else if(To.isInstancedMesh)Ll.renderInstances(fl,bl,To.count);else if(or.isInstancedBufferGeometry){const C=void 0!==or._maxInstanceCount?or._maxInstanceCount:1/0,Rn=Math.min(or.instanceCount,C);Ll.renderInstances(fl,bl,Rn)}else Ll.render(fl,bl)},this.compile=function(C,Rn,or){void 0===or&&(or=null),null===or&&(or=C),jc=Ad.get(or),jc.init(Rn),eu.push(jc),or.traverseVisible((function(C){C.isLight&&C.layers.test(Rn.layers)&&(jc.pushLight(C),C.castShadow&&jc.pushShadow(C))})),C!==or&&C.traverseVisible((function(C){C.isLight&&C.layers.test(Rn.layers)&&(jc.pushLight(C),C.castShadow&&jc.pushShadow(C))})),jc.setupLights();const So=new Set;return C.traverse((function(C){const Rn=C.material;if(Rn)if(Array.isArray(Rn))for(let To=0;To<Rn.length;To++){const Ro=Rn[To];prepareMaterial(Ro,or,C),So.add(Ro)}else prepareMaterial(Rn,or,C),So.add(Rn)})),eu.pop(),jc=null,So},this.compileAsync=function(C,Rn,or){void 0===or&&(or=null);const So=this.compile(C,Rn,or);return new Promise((Rn=>{function checkMaterialsReady(){So.forEach((function(C){od.get(C).currentProgram.isReady()&&So.delete(C)})),0!==So.size?setTimeout(checkMaterialsReady,10):Rn(C)}null!==nd.get("KHR_parallel_shader_compile")?checkMaterialsReady():setTimeout(checkMaterialsReady,10)}))};let Ud=null;function onXRSessionStart(){Bd.stop()}function onXRSessionEnd(){Bd.start()}const Bd=new WebGLAnimation;function projectObject(C,Rn,or,So){if(!1===C.visible)return;if(C.layers.test(Rn.layers))if(C.isGroup)or=C.renderOrder;else if(C.isLOD)!0===C.autoUpdate&&C.update(Rn);else if(C.isLight)jc.pushLight(C),C.castShadow&&jc.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||Kh.intersectsSprite(C)){So&&$h.setFromMatrixPosition(C.matrixWorld).applyMatrix4(Yh);const Rn=pd.update(C),To=C.material;To.visible&&Nc.push(C,Rn,To,or,$h.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||Kh.intersectsObject(C))){const Rn=pd.update(C),To=C.material;if(So&&(void 0!==C.boundingSphere?(null===C.boundingSphere&&C.computeBoundingSphere(),$h.copy(C.boundingSphere.center)):(null===Rn.boundingSphere&&Rn.computeBoundingSphere(),$h.copy(Rn.boundingSphere.center)),$h.applyMatrix4(C.matrixWorld).applyMatrix4(Yh)),Array.isArray(To)){const So=Rn.groups;for(let Ro=0,Uo=So.length;Ro<Uo;Ro++){const Uo=So[Ro],Oo=To[Uo.materialIndex];Oo&&Oo.visible&&Nc.push(C,Rn,Oo,or,$h.z,Uo)}}else To.visible&&Nc.push(C,Rn,To,or,$h.z,null)}const To=C.children;for(let Ro=0,Uo=To.length;Ro<Uo;Ro++)projectObject(To[Ro],Rn,or,So)}function renderScene(C,Rn,or,So){const To=C.opaque,Ro=C.transmissive,Uo=C.transparent;jc.setupLightsView(or),!0===Qh&&yd.setGlobalState(Ku.clippingPlanes,or),So&&ad.viewport(Rh.copy(So)),To.length>0&&renderObjects(To,Rn,or),Ro.length>0&&renderObjects(Ro,Rn,or),Uo.length>0&&renderObjects(Uo,Rn,or),ad.buffers.depth.setTest(!0),ad.buffers.depth.setMask(!0),ad.buffers.color.setMask(!0),ad.setPolygonOffset(!1)}function renderTransmissionPass(C,Rn,or,So){if(null!==(!0===or.isScene?or.overrideMaterial:null))return;void 0===jc.state.transmissionRenderTarget[So.id]&&(jc.state.transmissionRenderTarget[So.id]=new WebGLRenderTarget(1,1,{generateMipmaps:!0,type:nd.has("EXT_color_buffer_half_float")||nd.has("EXT_color_buffer_float")?Ld:Ed,minFilter:wd,samples:4,stencilBuffer:Ro,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:mm.workingColorSpace}));const To=jc.state.transmissionRenderTarget[So.id],Uo=So.viewport||Rh;To.setSize(Uo.z,Uo.w);const Oo=Ku.getRenderTarget();Ku.setRenderTarget(To),Ku.getClearColor(Bh),Fh=Ku.getClearAlpha(),Fh<1&&Ku.setClearColor(16777215,.5),Ku.clear(),td&&xd.render(or);const Ho=Ku.toneMapping;Ku.toneMapping=id;const qo=So.viewport;if(void 0!==So.viewport&&(So.viewport=void 0),jc.setupLightsView(So),!0===Qh&&yd.setGlobalState(Ku.clippingPlanes,So),renderObjects(C,or,So),ld.updateMultisampleRenderTarget(To),ld.updateRenderTargetMipmap(To),!1===nd.has("WEBGL_multisampled_render_to_texture")){let C=!1;for(let To=0,Ro=Rn.length;To<Ro;To++){const Ro=Rn[To],Uo=Ro.object,Oo=Ro.geometry,Ho=Ro.material,qo=Ro.group;if(Ho.side===fl&&Uo.layers.test(So.layers)){const Rn=Ho.side;Ho.side=ml,Ho.needsUpdate=!0,renderObject(Uo,or,So,Oo,Ho,qo),Ho.side=Rn,Ho.needsUpdate=!0,C=!0}}!0===C&&(ld.updateMultisampleRenderTarget(To),ld.updateRenderTargetMipmap(To))}Ku.setRenderTarget(Oo),Ku.setClearColor(Bh,Fh),void 0!==qo&&(So.viewport=qo),Ku.toneMapping=Ho}function renderObjects(C,Rn,or){const So=!0===Rn.isScene?Rn.overrideMaterial:null;for(let To=0,Ro=C.length;To<Ro;To++){const Ro=C[To],Uo=Ro.object,Oo=Ro.geometry,Ho=null===So?Ro.material:So,qo=Ro.group;Uo.layers.test(or.layers)&&renderObject(Uo,Rn,or,Oo,Ho,qo)}}function renderObject(C,Rn,or,So,To,Ro){C.onBeforeRender(Ku,Rn,or,So,To,Ro),C.modelViewMatrix.multiplyMatrices(or.matrixWorldInverse,C.matrixWorld),C.normalMatrix.getNormalMatrix(C.modelViewMatrix),To.onBeforeRender(Ku,Rn,or,So,C,Ro),!0===To.transparent&&To.side===fl&&!1===To.forceSinglePass?(To.side=ml,To.needsUpdate=!0,Ku.renderBufferDirect(or,Rn,So,To,C,Ro),To.side=dl,To.needsUpdate=!0,Ku.renderBufferDirect(or,Rn,So,To,C,Ro),To.side=fl):Ku.renderBufferDirect(or,Rn,So,To,C,Ro),C.onAfterRender(Ku,Rn,or,So,To,Ro)}function getProgram(C,Rn,or){!0!==Rn.isScene&&(Rn=ed);const So=od.get(C),To=jc.state.lights,Ro=jc.state.shadowsArray,Uo=To.state.version,Oo=md.getParameters(C,To.state,Ro,Rn,or),Ho=md.getProgramCacheKey(Oo);let qo=So.programs;So.environment=C.isMeshStandardMaterial?Rn.environment:null,So.fog=Rn.fog,So.envMap=(C.isMeshStandardMaterial?ud:cd).get(C.envMap||So.environment),So.envMapRotation=null!==So.environment&&null===C.envMap?Rn.environmentRotation:C.envMapRotation,void 0===qo&&(C.addEventListener("dispose",onMaterialDispose),qo=new Map,So.programs=qo);let dl=qo.get(Ho);if(void 0!==dl){if(So.currentProgram===dl&&So.lightsStateVersion===Uo)return updateCommonMaterialProperties(C,Oo),dl}else Oo.uniforms=md.getUniforms(C),C.onBeforeCompile(Oo,Ku),dl=md.acquireProgram(Oo,Ho),qo.set(Ho,dl),So.uniforms=Oo.uniforms;const ml=So.uniforms;return(C.isShaderMaterial||C.isRawShaderMaterial)&&!0!==C.clipping||(ml.clippingPlanes=yd.uniform),updateCommonMaterialProperties(C,Oo),So.needsLights=function(C){return C.isMeshLambertMaterial||C.isMeshToonMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isShadowMaterial||C.isShaderMaterial&&!0===C.lights}(C),So.lightsStateVersion=Uo,So.needsLights&&(ml.ambientLightColor.value=To.state.ambient,ml.lightProbe.value=To.state.probe,ml.directionalLights.value=To.state.directional,ml.directionalLightShadows.value=To.state.directionalShadow,ml.spotLights.value=To.state.spot,ml.spotLightShadows.value=To.state.spotShadow,ml.rectAreaLights.value=To.state.rectArea,ml.ltc_1.value=To.state.rectAreaLTC1,ml.ltc_2.value=To.state.rectAreaLTC2,ml.pointLights.value=To.state.point,ml.pointLightShadows.value=To.state.pointShadow,ml.hemisphereLights.value=To.state.hemi,ml.directionalShadowMap.value=To.state.directionalShadowMap,ml.directionalShadowMatrix.value=To.state.directionalShadowMatrix,ml.spotShadowMap.value=To.state.spotShadowMap,ml.spotLightMatrix.value=To.state.spotLightMatrix,ml.spotLightMap.value=To.state.spotLightMap,ml.pointShadowMap.value=To.state.pointShadowMap,ml.pointShadowMatrix.value=To.state.pointShadowMatrix),So.currentProgram=dl,So.uniformsList=null,dl}function getUniformList(C){if(null===C.uniformsList){const Rn=C.currentProgram.getUniforms();C.uniformsList=WebGLUniforms.seqWithValue(Rn.seq,C.uniforms)}return C.uniformsList}function updateCommonMaterialProperties(C,Rn){const or=od.get(C);or.outputColorSpace=Rn.outputColorSpace,or.batching=Rn.batching,or.batchingColor=Rn.batchingColor,or.instancing=Rn.instancing,or.instancingColor=Rn.instancingColor,or.instancingMorph=Rn.instancingMorph,or.skinning=Rn.skinning,or.morphTargets=Rn.morphTargets,or.morphNormals=Rn.morphNormals,or.morphColors=Rn.morphColors,or.morphTargetsCount=Rn.morphTargetsCount,or.numClippingPlanes=Rn.numClippingPlanes,or.numIntersection=Rn.numClipIntersection,or.vertexAlphas=Rn.vertexAlphas,or.vertexTangents=Rn.vertexTangents,or.toneMapping=Rn.toneMapping}Bd.setAnimationLoop((function(C){Ud&&Ud(C)})),"undefined"!==typeof self&&Bd.setContext(self),this.setAnimationLoop=function(C){Ud=C,Nd.setAnimationLoop(C),null===C?Bd.stop():Bd.start()},Nd.addEventListener("sessionstart",onXRSessionStart),Nd.addEventListener("sessionend",onXRSessionEnd),this.render=function(C,Rn){if(void 0!==Rn&&!0!==Rn.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===Yu)return;if(!0===C.matrixWorldAutoUpdate&&C.updateMatrixWorld(),null===Rn.parent&&!0===Rn.matrixWorldAutoUpdate&&Rn.updateMatrixWorld(),!0===Nd.enabled&&!0===Nd.isPresenting&&(!0===Nd.cameraAutoUpdate&&Nd.updateCamera(Rn),Rn=Nd.getCamera()),!0===C.isScene&&C.onBeforeRender(Ku,C,Rn,Ch),jc=Ad.get(C,eu.length),jc.init(Rn),eu.push(jc),Yh.multiplyMatrices(Rn.projectionMatrix,Rn.matrixWorldInverse),Kh.setFromProjectionMatrix(Yh),Xh=this.localClippingEnabled,Qh=yd.init(this.clippingPlanes,Xh),Nc=gd.get(C,Zc.length),Nc.init(),Zc.push(Nc),!0===Nd.enabled&&!0===Nd.isPresenting){const C=Ku.xr.getDepthSensingMesh();null!==C&&projectObject(C,Rn,-1/0,Ku.sortObjects)}projectObject(C,Rn,0,Ku.sortObjects),Nc.finish(),!0===Ku.sortObjects&&Nc.sort(Gh,Hh),td=!1===Nd.enabled||!1===Nd.isPresenting||!1===Nd.hasDepthSensing(),td&&xd.addToRenderList(Nc,C),this.info.render.frame++,!0===Qh&&yd.beginShadows();const or=jc.state.shadowsArray;vd.render(or,C,Rn),!0===Qh&&yd.endShadows(),!0===this.info.autoReset&&this.info.reset();const So=Nc.opaque,To=Nc.transmissive;if(jc.setupLights(),Rn.isArrayCamera){const or=Rn.cameras;if(To.length>0)for(let Rn=0,Ro=or.length;Rn<Ro;Rn++){renderTransmissionPass(So,To,C,or[Rn])}td&&xd.render(C);for(let Rn=0,So=or.length;Rn<So;Rn++){const So=or[Rn];renderScene(Nc,C,So,So.viewport)}}else To.length>0&&renderTransmissionPass(So,To,C,Rn),td&&xd.render(C),renderScene(Nc,C,Rn);null!==Ch&&(ld.updateMultisampleRenderTarget(Ch),ld.updateRenderTargetMipmap(Ch)),!0===C.isScene&&C.onAfterRender(Ku,C,Rn),Td.resetDefaultState(),Lh=-1,Dh=null,eu.pop(),eu.length>0?(jc=eu[eu.length-1],!0===Qh&&yd.setGlobalState(Ku.clippingPlanes,jc.state.camera)):jc=null,Zc.pop(),Nc=Zc.length>0?Zc[Zc.length-1]:null},this.getActiveCubeFace=function(){return Eh},this.getActiveMipmapLevel=function(){return Th},this.getRenderTarget=function(){return Ch},this.setRenderTargetTextures=function(C,Rn,or){od.get(C.texture).__webglTexture=Rn,od.get(C.depthTexture).__webglTexture=or;const So=od.get(C);So.__hasExternalTextures=!0,So.__autoAllocateDepthBuffer=void 0===or,So.__autoAllocateDepthBuffer||!0===nd.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),So.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(C,Rn){const or=od.get(C);or.__webglFramebuffer=Rn,or.__useDefaultFramebuffer=void 0===Rn},this.setRenderTarget=function(C,Rn,or){void 0===Rn&&(Rn=0),void 0===or&&(or=0),Ch=C,Eh=Rn,Th=or;let So=!0,To=null,Ro=!1,Uo=!1;if(C){const Oo=od.get(C);if(void 0!==Oo.__useDefaultFramebuffer)ad.bindFramebuffer(Rd.FRAMEBUFFER,null),So=!1;else if(void 0===Oo.__webglFramebuffer)ld.setupRenderTarget(C);else if(Oo.__hasExternalTextures)ld.rebindTextures(C,od.get(C.texture).__webglTexture,od.get(C.depthTexture).__webglTexture);else if(C.depthBuffer){const Rn=C.depthTexture;if(Oo.__boundDepthTexture!==Rn){if(null!==Rn&&od.has(Rn)&&(C.width!==Rn.image.width||C.height!==Rn.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ld.setupDepthRenderbuffer(C)}}const Ho=C.texture;(Ho.isData3DTexture||Ho.isDataArrayTexture||Ho.isCompressedArrayTexture)&&(Uo=!0);const qo=od.get(C).__webglFramebuffer;C.isWebGLCubeRenderTarget?(To=Array.isArray(qo[Rn])?qo[Rn][or]:qo[Rn],Ro=!0):To=C.samples>0&&!1===ld.useMultisampledRTT(C)?od.get(C).__webglMultisampledFramebuffer:Array.isArray(qo)?qo[or]:qo,Rh.copy(C.viewport),Nh.copy(C.scissor),Uh=C.scissorTest}else Rh.copy(Zh).multiplyScalar(jh).floor(),Nh.copy(Wh).multiplyScalar(jh).floor(),Uh=qh;if(ad.bindFramebuffer(Rd.FRAMEBUFFER,To)&&So&&ad.drawBuffers(C,To),ad.viewport(Rh),ad.scissor(Nh),ad.setScissorTest(Uh),Ro){const So=od.get(C.texture);Rd.framebufferTexture2D(Rd.FRAMEBUFFER,Rd.COLOR_ATTACHMENT0,Rd.TEXTURE_CUBE_MAP_POSITIVE_X+Rn,So.__webglTexture,or)}else if(Uo){const So=od.get(C.texture),To=Rn||0;Rd.framebufferTextureLayer(Rd.FRAMEBUFFER,Rd.COLOR_ATTACHMENT0,So.__webglTexture,or||0,To)}Lh=-1},this.readRenderTargetPixels=function(C,Rn,or,So,To,Ro,Uo){if(!C||!C.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oo=od.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&void 0!==Uo&&(Oo=Oo[Uo]),Oo){ad.bindFramebuffer(Rd.FRAMEBUFFER,Oo);try{const Uo=C.texture,Oo=Uo.format,Ho=Uo.type;if(!rd.textureFormatReadable(Oo))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!rd.textureTypeReadable(Ho))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Rn>=0&&Rn<=C.width-So&&or>=0&&or<=C.height-To&&Rd.readPixels(Rn,or,So,To,Sd.convert(Oo),Sd.convert(Ho),Ro)}finally{const C=null!==Ch?od.get(Ch).__webglFramebuffer:null;ad.bindFramebuffer(Rd.FRAMEBUFFER,C)}}},this.readRenderTargetPixelsAsync=async function(C,Rn,or,So,To,Ro,Uo){if(!C||!C.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oo=od.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&void 0!==Uo&&(Oo=Oo[Uo]),Oo){ad.bindFramebuffer(Rd.FRAMEBUFFER,Oo);try{const Uo=C.texture,Oo=Uo.format,Ho=Uo.type;if(!rd.textureFormatReadable(Oo))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!rd.textureTypeReadable(Ho))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(Rn>=0&&Rn<=C.width-So&&or>=0&&or<=C.height-To){const C=Rd.createBuffer();Rd.bindBuffer(Rd.PIXEL_PACK_BUFFER,C),Rd.bufferData(Rd.PIXEL_PACK_BUFFER,Ro.byteLength,Rd.STREAM_READ),Rd.readPixels(Rn,or,So,To,Sd.convert(Oo),Sd.convert(Ho),0),Rd.flush();const Uo=Rd.fenceSync(Rd.SYNC_GPU_COMMANDS_COMPLETE,0);await function(C,Rn,or){return new Promise((function(So,To){setTimeout((function probe(){switch(C.clientWaitSync(Rn,C.SYNC_FLUSH_COMMANDS_BIT,0)){case C.WAIT_FAILED:To();break;case C.TIMEOUT_EXPIRED:setTimeout(probe,or);break;default:So()}}),or)}))}(Rd,Uo,4);try{Rd.bindBuffer(Rd.PIXEL_PACK_BUFFER,C),Rd.getBufferSubData(Rd.PIXEL_PACK_BUFFER,0,Ro)}finally{Rd.deleteBuffer(C),Rd.deleteSync(Uo)}return Ro}}finally{const C=null!==Ch?od.get(Ch).__webglFramebuffer:null;ad.bindFramebuffer(Rd.FRAMEBUFFER,C)}}},this.copyFramebufferToTexture=function(C,Rn,or){void 0===Rn&&(Rn=null),void 0===or&&(or=0),!0!==C.isTexture&&(warnOnce("WebGLRenderer: copyFramebufferToTexture function signature has changed."),Rn=arguments[0]||null,C=arguments[1]);const So=Math.pow(2,-or),To=Math.floor(C.image.width*So),Ro=Math.floor(C.image.height*So),Uo=null!==Rn?Rn.x:0,Oo=null!==Rn?Rn.y:0;ld.setTexture2D(C,0),Rd.copyTexSubImage2D(Rd.TEXTURE_2D,or,0,0,Uo,Oo,To,Ro),ad.unbindTexture()},this.copyTextureToTexture=function(C,Rn,or,So,To){let Ro,Uo,Oo,Ho,qo,dl;void 0===or&&(or=null),void 0===So&&(So=null),void 0===To&&(To=0),!0!==C.isTexture&&(warnOnce("WebGLRenderer: copyTextureToTexture function signature has changed."),So=arguments[0]||null,C=arguments[1],Rn=arguments[2],To=arguments[3]||0,or=null),null!==or?(Ro=or.max.x-or.min.x,Uo=or.max.y-or.min.y,Oo=or.min.x,Ho=or.min.y):(Ro=C.image.width,Uo=C.image.height,Oo=0,Ho=0),null!==So?(qo=So.x,dl=So.y):(qo=0,dl=0);const ml=Sd.convert(Rn.format),fl=Sd.convert(Rn.type);ld.setTexture2D(Rn,0),Rd.pixelStorei(Rd.UNPACK_FLIP_Y_WEBGL,Rn.flipY),Rd.pixelStorei(Rd.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Rn.premultiplyAlpha),Rd.pixelStorei(Rd.UNPACK_ALIGNMENT,Rn.unpackAlignment);const vl=Rd.getParameter(Rd.UNPACK_ROW_LENGTH),bl=Rd.getParameter(Rd.UNPACK_IMAGE_HEIGHT),kl=Rd.getParameter(Rd.UNPACK_SKIP_PIXELS),Ll=Rd.getParameter(Rd.UNPACK_SKIP_ROWS),Dl=Rd.getParameter(Rd.UNPACK_SKIP_IMAGES),Nc=C.isCompressedTexture?C.mipmaps[To]:C.image;Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,Nc.width),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,Nc.height),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,Oo),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,Ho),C.isDataTexture?Rd.texSubImage2D(Rd.TEXTURE_2D,To,qo,dl,Ro,Uo,ml,fl,Nc.data):C.isCompressedTexture?Rd.compressedTexSubImage2D(Rd.TEXTURE_2D,To,qo,dl,Nc.width,Nc.height,ml,Nc.data):Rd.texSubImage2D(Rd.TEXTURE_2D,To,qo,dl,Ro,Uo,ml,fl,Nc),Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,vl),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,bl),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,kl),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,Ll),Rd.pixelStorei(Rd.UNPACK_SKIP_IMAGES,Dl),0===To&&Rn.generateMipmaps&&Rd.generateMipmap(Rd.TEXTURE_2D),ad.unbindTexture()},this.copyTextureToTexture3D=function(C,Rn,or,So,To){let Ro,Uo,Oo,Ho,qo,dl,ml,fl,vl;void 0===or&&(or=null),void 0===So&&(So=null),void 0===To&&(To=0),!0!==C.isTexture&&(warnOnce("WebGLRenderer: copyTextureToTexture3D function signature has changed."),or=arguments[0]||null,So=arguments[1]||null,C=arguments[2],Rn=arguments[3],To=arguments[4]||0);const bl=C.isCompressedTexture?C.mipmaps[To]:C.image;null!==or?(Ro=or.max.x-or.min.x,Uo=or.max.y-or.min.y,Oo=or.max.z-or.min.z,Ho=or.min.x,qo=or.min.y,dl=or.min.z):(Ro=bl.width,Uo=bl.height,Oo=bl.depth,Ho=0,qo=0,dl=0),null!==So?(ml=So.x,fl=So.y,vl=So.z):(ml=0,fl=0,vl=0);const kl=Sd.convert(Rn.format),Ll=Sd.convert(Rn.type);let Dl;if(Rn.isData3DTexture)ld.setTexture3D(Rn,0),Dl=Rd.TEXTURE_3D;else{if(!Rn.isDataArrayTexture&&!Rn.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ld.setTexture2DArray(Rn,0),Dl=Rd.TEXTURE_2D_ARRAY}Rd.pixelStorei(Rd.UNPACK_FLIP_Y_WEBGL,Rn.flipY),Rd.pixelStorei(Rd.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Rn.premultiplyAlpha),Rd.pixelStorei(Rd.UNPACK_ALIGNMENT,Rn.unpackAlignment);const Nc=Rd.getParameter(Rd.UNPACK_ROW_LENGTH),jc=Rd.getParameter(Rd.UNPACK_IMAGE_HEIGHT),Zc=Rd.getParameter(Rd.UNPACK_SKIP_PIXELS),eu=Rd.getParameter(Rd.UNPACK_SKIP_ROWS),Ku=Rd.getParameter(Rd.UNPACK_SKIP_IMAGES);Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,bl.width),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,bl.height),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,Ho),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,qo),Rd.pixelStorei(Rd.UNPACK_SKIP_IMAGES,dl),C.isDataTexture||C.isData3DTexture?Rd.texSubImage3D(Dl,To,ml,fl,vl,Ro,Uo,Oo,kl,Ll,bl.data):Rn.isCompressedArrayTexture?Rd.compressedTexSubImage3D(Dl,To,ml,fl,vl,Ro,Uo,Oo,kl,bl.data):Rd.texSubImage3D(Dl,To,ml,fl,vl,Ro,Uo,Oo,kl,Ll,bl),Rd.pixelStorei(Rd.UNPACK_ROW_LENGTH,Nc),Rd.pixelStorei(Rd.UNPACK_IMAGE_HEIGHT,jc),Rd.pixelStorei(Rd.UNPACK_SKIP_PIXELS,Zc),Rd.pixelStorei(Rd.UNPACK_SKIP_ROWS,eu),Rd.pixelStorei(Rd.UNPACK_SKIP_IMAGES,Ku),0===To&&Rn.generateMipmaps&&Rd.generateMipmap(Dl),ad.unbindTexture()},this.initRenderTarget=function(C){void 0===od.get(C).__webglFramebuffer&&ld.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?ld.setTextureCube(C,0):C.isData3DTexture?ld.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?ld.setTexture2DArray(C,0):ld.setTexture2D(C,0),ad.unbindTexture()},this.resetState=function(){Eh=0,Th=0,Ch=null,ad.reset(),Td.reset()},"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tm}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(C){this._outputColorSpace=C;const Rn=this.getContext();Rn.drawingBufferColorSpace=C===Bp?"display-p3":"srgb",Rn.unpackColorSpace=mm.workingColorSpace===Fp?"display-p3":"srgb"}}class Scene extends Object3D{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(C,Rn){return super.copy(C,Rn),null!==C.background&&(this.background=C.background.clone()),null!==C.environment&&(this.environment=C.environment.clone()),null!==C.fog&&(this.fog=C.fog.clone()),this.backgroundBlurriness=C.backgroundBlurriness,this.backgroundIntensity=C.backgroundIntensity,this.backgroundRotation.copy(C.backgroundRotation),this.environmentIntensity=C.environmentIntensity,this.environmentRotation.copy(C.environmentRotation),null!==C.overrideMaterial&&(this.overrideMaterial=C.overrideMaterial.clone()),this.matrixAutoUpdate=C.matrixAutoUpdate,this}toJSON(C){const Rn=super.toJSON(C);return null!==this.fog&&(Rn.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(Rn.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(Rn.object.backgroundIntensity=this.backgroundIntensity),Rn.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(Rn.object.environmentIntensity=this.environmentIntensity),Rn.object.environmentRotation=this.environmentRotation.toArray(),Rn}}class LineBasicMaterial extends Material{constructor(C){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(C)}copy(C){return super.copy(C),this.color.copy(C.color),this.map=C.map,this.linewidth=C.linewidth,this.linecap=C.linecap,this.linejoin=C.linejoin,this.fog=C.fog,this}}const $g=new Vector3,eA=new Vector3,tA=new Matrix4,iA=new Ray,nA=new Sphere,rA=new Vector3,aA=new Vector3;class Line extends Object3D{constructor(C,Rn){void 0===C&&(C=new BufferGeometry),void 0===Rn&&(Rn=new LineBasicMaterial),super(),this.isLine=!0,this.type="Line",this.geometry=C,this.material=Rn,this.updateMorphTargets()}copy(C,Rn){return super.copy(C,Rn),this.material=Array.isArray(C.material)?C.material.slice():C.material,this.geometry=C.geometry,this}computeLineDistances(){const C=this.geometry;if(null===C.index){const Rn=C.attributes.position,or=[0];for(let C=1,So=Rn.count;C<So;C++)$g.fromBufferAttribute(Rn,C-1),eA.fromBufferAttribute(Rn,C),or[C]=or[C-1],or[C]+=$g.distanceTo(eA);C.setAttribute("lineDistance",new Float32BufferAttribute(or,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(C,Rn){const or=this.geometry,So=this.matrixWorld,To=C.params.Line.threshold,Ro=or.drawRange;if(null===or.boundingSphere&&or.computeBoundingSphere(),nA.copy(or.boundingSphere),nA.applyMatrix4(So),nA.radius+=To,!1===C.ray.intersectsSphere(nA))return;tA.copy(So).invert(),iA.copy(C.ray).applyMatrix4(tA);const Uo=To/((this.scale.x+this.scale.y+this.scale.z)/3),Oo=Uo*Uo,Ho=this.isLineSegments?2:1,qo=or.index,dl=or.attributes.position;if(null!==qo){const or=Math.max(0,Ro.start),So=Math.min(qo.count,Ro.start+Ro.count);for(let To=or,Ro=So-1;To<Ro;To+=Ho){const or=qo.getX(To),So=qo.getX(To+1),Ro=checkIntersection(this,C,iA,Oo,or,So);Ro&&Rn.push(Ro)}if(this.isLineLoop){const To=qo.getX(So-1),Ro=qo.getX(or),Uo=checkIntersection(this,C,iA,Oo,To,Ro);Uo&&Rn.push(Uo)}}else{const or=Math.max(0,Ro.start),So=Math.min(dl.count,Ro.start+Ro.count);for(let To=or,Ro=So-1;To<Ro;To+=Ho){const or=checkIntersection(this,C,iA,Oo,To,To+1);or&&Rn.push(or)}if(this.isLineLoop){const To=checkIntersection(this,C,iA,Oo,So-1,or);To&&Rn.push(To)}}}updateMorphTargets(){const C=this.geometry.morphAttributes,Rn=Object.keys(C);if(Rn.length>0){const or=C[Rn[0]];if(void 0!==or){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let C=0,Rn=or.length;C<Rn;C++){const Rn=or[C].name||String(C);this.morphTargetInfluences.push(0),this.morphTargetDictionary[Rn]=C}}}}}function checkIntersection(C,Rn,or,So,To,Ro){const Uo=C.geometry.attributes.position;$g.fromBufferAttribute(Uo,To),eA.fromBufferAttribute(Uo,Ro);if(or.distanceSqToSegment($g,eA,rA,aA)>So)return;rA.applyMatrix4(C.matrixWorld);const Oo=Rn.ray.origin.distanceTo(rA);return Oo<Rn.near||Oo>Rn.far?void 0:{distance:Oo,point:aA.clone().applyMatrix4(C.matrixWorld),index:To,face:null,faceIndex:null,object:C}}const sA=new Vector3,oA=new Vector3;class LineSegments extends Line{constructor(C,Rn){super(C,Rn),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const C=this.geometry;if(null===C.index){const Rn=C.attributes.position,or=[];for(let C=0,So=Rn.count;C<So;C+=2)sA.fromBufferAttribute(Rn,C),oA.fromBufferAttribute(Rn,C+1),or[C]=0===C?0:or[C-1],or[C+1]=or[C]+sA.distanceTo(oA);C.setAttribute("lineDistance",new Float32BufferAttribute(or,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Curve{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(C,Rn){const or=this.getUtoTmapping(C);return this.getPoint(or,Rn)}getPoints(C){void 0===C&&(C=5);const Rn=[];for(let or=0;or<=C;or++)Rn.push(this.getPoint(or/C));return Rn}getSpacedPoints(C){void 0===C&&(C=5);const Rn=[];for(let or=0;or<=C;or++)Rn.push(this.getPointAt(or/C));return Rn}getLength(){const C=this.getLengths();return C[C.length-1]}getLengths(C){if(void 0===C&&(C=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===C+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const Rn=[];let or,So=this.getPoint(0),To=0;Rn.push(0);for(let Ro=1;Ro<=C;Ro++)or=this.getPoint(Ro/C),To+=or.distanceTo(So),Rn.push(To),So=or;return this.cacheArcLengths=Rn,Rn}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(C,Rn){const or=this.getLengths();let So=0;const To=or.length;let Ro;Ro=Rn||C*or[To-1];let Uo,Oo=0,Ho=To-1;for(;Oo<=Ho;)if(So=Math.floor(Oo+(Ho-Oo)/2),Uo=or[So]-Ro,Uo<0)Oo=So+1;else{if(!(Uo>0)){Ho=So;break}Ho=So-1}if(So=Ho,or[So]===Ro)return So/(To-1);const qo=or[So];return(So+(Ro-qo)/(or[So+1]-qo))/(To-1)}getTangent(C,Rn){const or=1e-4;let So=C-or,To=C+or;So<0&&(So=0),To>1&&(To=1);const Ro=this.getPoint(So),Uo=this.getPoint(To),Oo=Rn||(Ro.isVector2?new Vector2:new Vector3);return Oo.copy(Uo).sub(Ro).normalize(),Oo}getTangentAt(C,Rn){const or=this.getUtoTmapping(C);return this.getTangent(or,Rn)}computeFrenetFrames(C,Rn){const or=new Vector3,So=[],To=[],Ro=[],Uo=new Vector3,Oo=new Matrix4;for(let fl=0;fl<=C;fl++){const Rn=fl/C;So[fl]=this.getTangentAt(Rn,new Vector3)}To[0]=new Vector3,Ro[0]=new Vector3;let Ho=Number.MAX_VALUE;const qo=Math.abs(So[0].x),dl=Math.abs(So[0].y),ml=Math.abs(So[0].z);qo<=Ho&&(Ho=qo,or.set(1,0,0)),dl<=Ho&&(Ho=dl,or.set(0,1,0)),ml<=Ho&&or.set(0,0,1),Uo.crossVectors(So[0],or).normalize(),To[0].crossVectors(So[0],Uo),Ro[0].crossVectors(So[0],To[0]);for(let fl=1;fl<=C;fl++){if(To[fl]=To[fl-1].clone(),Ro[fl]=Ro[fl-1].clone(),Uo.crossVectors(So[fl-1],So[fl]),Uo.length()>Number.EPSILON){Uo.normalize();const C=Math.acos(clamp(So[fl-1].dot(So[fl]),-1,1));To[fl].applyMatrix4(Oo.makeRotationAxis(Uo,C))}Ro[fl].crossVectors(So[fl],To[fl])}if(!0===Rn){let Rn=Math.acos(clamp(To[0].dot(To[C]),-1,1));Rn/=C,So[0].dot(Uo.crossVectors(To[0],To[C]))>0&&(Rn=-Rn);for(let or=1;or<=C;or++)To[or].applyMatrix4(Oo.makeRotationAxis(So[or],Rn*or)),Ro[or].crossVectors(So[or],To[or])}return{tangents:So,normals:To,binormals:Ro}}clone(){return(new this.constructor).copy(this)}copy(C){return this.arcLengthDivisions=C.arcLengthDivisions,this}toJSON(){const C={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return C.arcLengthDivisions=this.arcLengthDivisions,C.type=this.type,C}fromJSON(C){return this.arcLengthDivisions=C.arcLengthDivisions,this}}function CatmullRom(C,Rn,or,So,To){const Ro=.5*(So-Rn),Uo=.5*(To-or),Oo=C*C;return(2*or-2*So+Ro+Uo)*(C*Oo)+(-3*or+3*So-2*Ro-Uo)*Oo+Ro*C+or}class SplineCurve extends Curve{constructor(C){void 0===C&&(C=[]),super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=C}getPoint(C,Rn){void 0===Rn&&(Rn=new Vector2);const or=Rn,So=this.points,To=(So.length-1)*C,Ro=Math.floor(To),Uo=To-Ro,Oo=So[0===Ro?Ro:Ro-1],Ho=So[Ro],qo=So[Ro>So.length-2?So.length-1:Ro+1],dl=So[Ro>So.length-3?So.length-1:Ro+2];return or.set(CatmullRom(Uo,Oo.x,Ho.x,qo.x,dl.x),CatmullRom(Uo,Oo.y,Ho.y,qo.y,dl.y)),or}copy(C){super.copy(C),this.points=[];for(let Rn=0,or=C.points.length;Rn<or;Rn++){const or=C.points[Rn];this.points.push(or.clone())}return this}toJSON(){const C=super.toJSON();C.points=[];for(let Rn=0,or=this.points.length;Rn<or;Rn++){const or=this.points[Rn];C.points.push(or.toArray())}return C}fromJSON(C){super.fromJSON(C),this.points=[];for(let Rn=0,or=C.points.length;Rn<or;Rn++){const or=C.points[Rn];this.points.push((new Vector2).fromArray(or))}return this}}class SphereGeometry extends BufferGeometry{constructor(C,Rn,or,So,To,Ro,Uo){void 0===C&&(C=1),void 0===Rn&&(Rn=32),void 0===or&&(or=16),void 0===So&&(So=0),void 0===To&&(To=2*Math.PI),void 0===Ro&&(Ro=0),void 0===Uo&&(Uo=Math.PI),super(),this.type="SphereGeometry",this.parameters={radius:C,widthSegments:Rn,heightSegments:or,phiStart:So,phiLength:To,thetaStart:Ro,thetaLength:Uo},Rn=Math.max(3,Math.floor(Rn)),or=Math.max(2,Math.floor(or));const Oo=Math.min(Ro+Uo,Math.PI);let Ho=0;const qo=[],dl=new Vector3,ml=new Vector3,fl=[],vl=[],bl=[],kl=[];for(let Ll=0;Ll<=or;Ll++){const fl=[],Dl=Ll/or;let Nc=0;0===Ll&&0===Ro?Nc=.5/Rn:Ll===or&&Oo===Math.PI&&(Nc=-.5/Rn);for(let or=0;or<=Rn;or++){const Oo=or/Rn;dl.x=-C*Math.cos(So+Oo*To)*Math.sin(Ro+Dl*Uo),dl.y=C*Math.cos(Ro+Dl*Uo),dl.z=C*Math.sin(So+Oo*To)*Math.sin(Ro+Dl*Uo),vl.push(dl.x,dl.y,dl.z),ml.copy(dl).normalize(),bl.push(ml.x,ml.y,ml.z),kl.push(Oo+Nc,1-Dl),fl.push(Ho++)}qo.push(fl)}for(let Ll=0;Ll<or;Ll++)for(let C=0;C<Rn;C++){const Rn=qo[Ll][C+1],So=qo[Ll][C],To=qo[Ll+1][C],Uo=qo[Ll+1][C+1];(0!==Ll||Ro>0)&&fl.push(Rn,So,Uo),(Ll!==or-1||Oo<Math.PI)&&fl.push(So,To,Uo)}this.setIndex(fl),this.setAttribute("position",new Float32BufferAttribute(vl,3)),this.setAttribute("normal",new Float32BufferAttribute(bl,3)),this.setAttribute("uv",new Float32BufferAttribute(kl,2))}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}static fromJSON(C){return new SphereGeometry(C.radius,C.widthSegments,C.heightSegments,C.phiStart,C.phiLength,C.thetaStart,C.thetaLength)}}class WireframeGeometry extends BufferGeometry{constructor(C){if(void 0===C&&(C=null),super(),this.type="WireframeGeometry",this.parameters={geometry:C},null!==C){const Rn=[],or=new Set,So=new Vector3,To=new Vector3;if(null!==C.index){const Ro=C.attributes.position,Uo=C.index;let Oo=C.groups;0===Oo.length&&(Oo=[{start:0,count:Uo.count,materialIndex:0}]);for(let C=0,Ho=Oo.length;C<Ho;++C){const Ho=Oo[C],qo=Ho.start;for(let C=qo,Oo=qo+Ho.count;C<Oo;C+=3)for(let Ho=0;Ho<3;Ho++){const Oo=Uo.getX(C+Ho),qo=Uo.getX(C+(Ho+1)%3);So.fromBufferAttribute(Ro,Oo),To.fromBufferAttribute(Ro,qo),!0===isUniqueEdge(So,To,or)&&(Rn.push(So.x,So.y,So.z),Rn.push(To.x,To.y,To.z))}}}else{const Ro=C.attributes.position;for(let C=0,Uo=Ro.count/3;C<Uo;C++)for(let Oo=0;Oo<3;Oo++){const Uo=3*C+Oo,Ho=3*C+(Oo+1)%3;So.fromBufferAttribute(Ro,Uo),To.fromBufferAttribute(Ro,Ho),!0===isUniqueEdge(So,To,or)&&(Rn.push(So.x,So.y,So.z),Rn.push(To.x,To.y,To.z))}}this.setAttribute("position",new Float32BufferAttribute(Rn,3))}}copy(C){return super.copy(C),this.parameters=Object.assign({},C.parameters),this}}function isUniqueEdge(C,Rn,or){const So=C.x+","+C.y+","+C.z+"-"+Rn.x+","+Rn.y+","+Rn.z,To=Rn.x+","+Rn.y+","+Rn.z+"-"+C.x+","+C.y+","+C.z;return!0!==or.has(So)&&!0!==or.has(To)&&(or.add(So),or.add(To),!0)}function convertArray(C,Rn,or){return!C||!or&&C.constructor===Rn?C:"number"===typeof Rn.BYTES_PER_ELEMENT?new Rn(C):Array.prototype.slice.call(C)}function isTypedArray(C){return ArrayBuffer.isView(C)&&!(C instanceof DataView)}class Interpolant{constructor(C,Rn,or,So){this.parameterPositions=C,this._cachedIndex=0,this.resultBuffer=void 0!==So?So:new Rn.constructor(or),this.sampleValues=Rn,this.valueSize=or,this.settings=null,this.DefaultSettings_={}}evaluate(C){const Rn=this.parameterPositions;let or=this._cachedIndex,So=Rn[or],To=Rn[or-1];e:{t:{let Ro;i:{n:if(!(C<So)){for(let Ro=or+2;;){if(void 0===So){if(C<To)break n;return or=Rn.length,this._cachedIndex=or,this.copySampleValue_(or-1)}if(or===Ro)break;if(To=So,So=Rn[++or],C<So)break t}Ro=Rn.length;break i}if(C>=To)break e;{const Uo=Rn[1];C<Uo&&(or=2,To=Uo);for(let Ro=or-2;;){if(void 0===To)return this._cachedIndex=0,this.copySampleValue_(0);if(or===Ro)break;if(So=To,To=Rn[--or-1],C>=To)break t}Ro=or,or=0}}for(;or<Ro;){const So=or+Ro>>>1;C<Rn[So]?Ro=So:or=So+1}if(So=Rn[or],To=Rn[or-1],void 0===To)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===So)return or=Rn.length,this._cachedIndex=or,this.copySampleValue_(or-1)}this._cachedIndex=or,this.intervalChanged_(or,To,So)}return this.interpolate_(or,To,C,So)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(C){const Rn=this.resultBuffer,or=this.sampleValues,So=this.valueSize,To=C*So;for(let Ro=0;Ro!==So;++Ro)Rn[Ro]=or[To+Ro];return Rn}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class CubicInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ip,endingEnd:Ip}}intervalChanged_(C,Rn,or){const So=this.parameterPositions;let To=C-2,Ro=C+1,Uo=So[To],Oo=So[Ro];if(void 0===Uo)switch(this.getSettings_().endingStart){case Cp:To=C,Uo=2*Rn-or;break;case Lp:To=So.length-2,Uo=Rn+So[To]-So[To+1];break;default:To=C,Uo=or}if(void 0===Oo)switch(this.getSettings_().endingEnd){case Cp:Ro=C,Oo=2*or-Rn;break;case Lp:Ro=1,Oo=or+So[1]-So[0];break;default:Ro=C-1,Oo=Rn}const Ho=.5*(or-Rn),qo=this.valueSize;this._weightPrev=Ho/(Rn-Uo),this._weightNext=Ho/(Oo-or),this._offsetPrev=To*qo,this._offsetNext=Ro*qo}interpolate_(C,Rn,or,So){const To=this.resultBuffer,Ro=this.sampleValues,Uo=this.valueSize,Oo=C*Uo,Ho=Oo-Uo,qo=this._offsetPrev,dl=this._offsetNext,ml=this._weightPrev,fl=this._weightNext,vl=(or-Rn)/(So-Rn),bl=vl*vl,kl=bl*vl,Ll=-ml*kl+2*ml*bl-ml*vl,Dl=(1+ml)*kl+(-1.5-2*ml)*bl+(-.5+ml)*vl+1,Nc=(-1-fl)*kl+(1.5+fl)*bl+.5*vl,jc=fl*kl-fl*bl;for(let Zc=0;Zc!==Uo;++Zc)To[Zc]=Ll*Ro[qo+Zc]+Dl*Ro[Ho+Zc]+Nc*Ro[Oo+Zc]+jc*Ro[dl+Zc];return To}}class LinearInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So)}interpolate_(C,Rn,or,So){const To=this.resultBuffer,Ro=this.sampleValues,Uo=this.valueSize,Oo=C*Uo,Ho=Oo-Uo,qo=(or-Rn)/(So-Rn),dl=1-qo;for(let ml=0;ml!==Uo;++ml)To[ml]=Ro[Ho+ml]*dl+Ro[Oo+ml]*qo;return To}}class DiscreteInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So)}interpolate_(C){return this.copySampleValue_(C-1)}}class KeyframeTrack{constructor(C,Rn,or,So){if(void 0===C)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===Rn||0===Rn.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+C);this.name=C,this.times=convertArray(Rn,this.TimeBufferType),this.values=convertArray(or,this.ValueBufferType),this.setInterpolation(So||this.DefaultInterpolation)}static toJSON(C){const Rn=C.constructor;let or;if(Rn.toJSON!==this.toJSON)or=Rn.toJSON(C);else{or={name:C.name,times:convertArray(C.times,Array),values:convertArray(C.values,Array)};const Rn=C.getInterpolation();Rn!==C.DefaultInterpolation&&(or.interpolation=Rn)}return or.type=C.ValueTypeName,or}InterpolantFactoryMethodDiscrete(C){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),C)}InterpolantFactoryMethodLinear(C){return new LinearInterpolant(this.times,this.values,this.getValueSize(),C)}InterpolantFactoryMethodSmooth(C){return new CubicInterpolant(this.times,this.values,this.getValueSize(),C)}setInterpolation(C){let Rn;switch(C){case Sp:Rn=this.InterpolantFactoryMethodDiscrete;break;case kp:Rn=this.InterpolantFactoryMethodLinear;break;case Tp:Rn=this.InterpolantFactoryMethodSmooth}if(void 0===Rn){const Rn="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(C===this.DefaultInterpolation)throw new Error(Rn);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",Rn),this}return this.createInterpolant=Rn,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Sp;case this.InterpolantFactoryMethodLinear:return kp;case this.InterpolantFactoryMethodSmooth:return Tp}}getValueSize(){return this.values.length/this.times.length}shift(C){if(0!==C){const Rn=this.times;for(let or=0,So=Rn.length;or!==So;++or)Rn[or]+=C}return this}scale(C){if(1!==C){const Rn=this.times;for(let or=0,So=Rn.length;or!==So;++or)Rn[or]*=C}return this}trim(C,Rn){const or=this.times,So=or.length;let To=0,Ro=So-1;for(;To!==So&&or[To]<C;)++To;for(;-1!==Ro&&or[Ro]>Rn;)--Ro;if(++Ro,0!==To||Ro!==So){To>=Ro&&(Ro=Math.max(Ro,1),To=Ro-1);const C=this.getValueSize();this.times=or.slice(To,Ro),this.values=this.values.slice(To*C,Ro*C)}return this}validate(){let C=!0;const Rn=this.getValueSize();Rn-Math.floor(Rn)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),C=!1);const or=this.times,So=this.values,To=or.length;0===To&&(console.error("THREE.KeyframeTrack: Track is empty.",this),C=!1);let Ro=null;for(let Uo=0;Uo!==To;Uo++){const Rn=or[Uo];if("number"===typeof Rn&&isNaN(Rn)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,Uo,Rn),C=!1;break}if(null!==Ro&&Ro>Rn){console.error("THREE.KeyframeTrack: Out of order keys.",this,Uo,Rn,Ro),C=!1;break}Ro=Rn}if(void 0!==So&&isTypedArray(So))for(let Uo=0,Oo=So.length;Uo!==Oo;++Uo){const Rn=So[Uo];if(isNaN(Rn)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,Uo,Rn),C=!1;break}}return C}optimize(){const C=this.times.slice(),Rn=this.values.slice(),or=this.getValueSize(),So=this.getInterpolation()===Tp,To=C.length-1;let Ro=1;for(let Uo=1;Uo<To;++Uo){let To=!1;const Oo=C[Uo];if(Oo!==C[Uo+1]&&(1!==Uo||Oo!==C[0]))if(So)To=!0;else{const C=Uo*or,So=C-or,Ro=C+or;for(let Uo=0;Uo!==or;++Uo){const or=Rn[C+Uo];if(or!==Rn[So+Uo]||or!==Rn[Ro+Uo]){To=!0;break}}}if(To){if(Uo!==Ro){C[Ro]=C[Uo];const So=Uo*or,To=Ro*or;for(let C=0;C!==or;++C)Rn[To+C]=Rn[So+C]}++Ro}}if(To>0){C[Ro]=C[To];for(let C=To*or,So=Ro*or,Uo=0;Uo!==or;++Uo)Rn[So+Uo]=Rn[C+Uo];++Ro}return Ro!==C.length?(this.times=C.slice(0,Ro),this.values=Rn.slice(0,Ro*or)):(this.times=C,this.values=Rn),this}clone(){const C=this.times.slice(),Rn=this.values.slice(),or=new(0,this.constructor)(this.name,C,Rn);return or.createInterpolant=this.createInterpolant,or}}KeyframeTrack.prototype.TimeBufferType=Float32Array,KeyframeTrack.prototype.ValueBufferType=Float32Array,KeyframeTrack.prototype.DefaultInterpolation=kp;class BooleanKeyframeTrack extends KeyframeTrack{constructor(C,Rn,or){super(C,Rn,or)}}BooleanKeyframeTrack.prototype.ValueTypeName="bool",BooleanKeyframeTrack.prototype.ValueBufferType=Array,BooleanKeyframeTrack.prototype.DefaultInterpolation=Sp,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class ColorKeyframeTrack extends KeyframeTrack{}ColorKeyframeTrack.prototype.ValueTypeName="color";class NumberKeyframeTrack extends KeyframeTrack{}NumberKeyframeTrack.prototype.ValueTypeName="number";class QuaternionLinearInterpolant extends Interpolant{constructor(C,Rn,or,So){super(C,Rn,or,So)}interpolate_(C,Rn,or,So){const To=this.resultBuffer,Ro=this.sampleValues,Uo=this.valueSize,Oo=(or-Rn)/(So-Rn);let Ho=C*Uo;for(let qo=Ho+Uo;Ho!==qo;Ho+=4)Quaternion.slerpFlat(To,0,Ro,Ho-Uo,Ro,Ho,Oo);return To}}class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(C){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),C)}}QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion",QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class StringKeyframeTrack extends KeyframeTrack{constructor(C,Rn,or){super(C,Rn,or)}}StringKeyframeTrack.prototype.ValueTypeName="string",StringKeyframeTrack.prototype.ValueBufferType=Array,StringKeyframeTrack.prototype.DefaultInterpolation=Sp,StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;class VectorKeyframeTrack extends KeyframeTrack{}VectorKeyframeTrack.prototype.ValueTypeName="vector";const lA={enabled:!1,files:{},add:function(C,Rn){!1!==this.enabled&&(this.files[C]=Rn)},get:function(C){if(!1!==this.enabled)return this.files[C]},remove:function(C){delete this.files[C]},clear:function(){this.files={}}};class LoadingManager{constructor(C,Rn,or){const So=this;let To,Ro=!1,Uo=0,Oo=0;const Ho=[];this.onStart=void 0,this.onLoad=C,this.onProgress=Rn,this.onError=or,this.itemStart=function(C){Oo++,!1===Ro&&void 0!==So.onStart&&So.onStart(C,Uo,Oo),Ro=!0},this.itemEnd=function(C){Uo++,void 0!==So.onProgress&&So.onProgress(C,Uo,Oo),Uo===Oo&&(Ro=!1,void 0!==So.onLoad&&So.onLoad())},this.itemError=function(C){void 0!==So.onError&&So.onError(C)},this.resolveURL=function(C){return To?To(C):C},this.setURLModifier=function(C){return To=C,this},this.addHandler=function(C,Rn){return Ho.push(C,Rn),this},this.removeHandler=function(C){const Rn=Ho.indexOf(C);return-1!==Rn&&Ho.splice(Rn,2),this},this.getHandler=function(C){for(let Rn=0,or=Ho.length;Rn<or;Rn+=2){const or=Ho[Rn],So=Ho[Rn+1];if(or.global&&(or.lastIndex=0),or.test(C))return So}return null}}}const cA=new LoadingManager;class Loader{constructor(C){this.manager=void 0!==C?C:cA,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(C,Rn){const or=this;return new Promise((function(So,To){or.load(C,So,Rn,To)}))}parse(){}setCrossOrigin(C){return this.crossOrigin=C,this}setWithCredentials(C){return this.withCredentials=C,this}setPath(C){return this.path=C,this}setResourcePath(C){return this.resourcePath=C,this}setRequestHeader(C){return this.requestHeader=C,this}}Loader.DEFAULT_MATERIAL_NAME="__DEFAULT";class HttpError extends Error{constructor(C,Rn){super(C),this.response=Rn}}const uA="\\[\\]\\.:\\/",hA=new RegExp("["+uA+"]","g"),dA="[^"+uA+"]",pA="[^"+uA.replace("\\.","")+"]",mA=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",dA)+/(WCOD+)?/.source.replace("WCOD",pA)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dA)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dA)+"$"),fA=["material","materials","bones","map"];class PropertyBinding{constructor(C,Rn,or){this.path=Rn,this.parsedPath=or||PropertyBinding.parseTrackName(Rn),this.node=PropertyBinding.findNode(C,this.parsedPath.nodeName),this.rootNode=C,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(C,Rn,or){return C&&C.isAnimationObjectGroup?new PropertyBinding.Composite(C,Rn,or):new PropertyBinding(C,Rn,or)}static sanitizeNodeName(C){return C.replace(/\s/g,"_").replace(hA,"")}static parseTrackName(C){const Rn=mA.exec(C);if(null===Rn)throw new Error("PropertyBinding: Cannot parse trackName: "+C);const or={nodeName:Rn[2],objectName:Rn[3],objectIndex:Rn[4],propertyName:Rn[5],propertyIndex:Rn[6]},So=or.nodeName&&or.nodeName.lastIndexOf(".");if(void 0!==So&&-1!==So){const C=or.nodeName.substring(So+1);-1!==fA.indexOf(C)&&(or.nodeName=or.nodeName.substring(0,So),or.objectName=C)}if(null===or.propertyName||0===or.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+C);return or}static findNode(C,Rn){if(void 0===Rn||""===Rn||"."===Rn||-1===Rn||Rn===C.name||Rn===C.uuid)return C;if(C.skeleton){const or=C.skeleton.getBoneByName(Rn);if(void 0!==or)return or}if(C.children){const searchNodeSubtree=function(C){for(let or=0;or<C.length;or++){const So=C[or];if(So.name===Rn||So.uuid===Rn)return So;const To=searchNodeSubtree(So.children);if(To)return To}return null},or=searchNodeSubtree(C.children);if(or)return or}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(C,Rn){C[Rn]=this.targetObject[this.propertyName]}_getValue_array(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)C[Rn++]=or[So]}_getValue_arrayElement(C,Rn){C[Rn]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(C,Rn){this.resolvedProperty.toArray(C,Rn)}_setValue_direct(C,Rn){this.targetObject[this.propertyName]=C[Rn]}_setValue_direct_setNeedsUpdate(C,Rn){this.targetObject[this.propertyName]=C[Rn],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(C,Rn){this.targetObject[this.propertyName]=C[Rn],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)or[So]=C[Rn++]}_setValue_array_setNeedsUpdate(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)or[So]=C[Rn++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(C,Rn){const or=this.resolvedProperty;for(let So=0,To=or.length;So!==To;++So)or[So]=C[Rn++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(C,Rn){this.resolvedProperty[this.propertyIndex]=C[Rn]}_setValue_arrayElement_setNeedsUpdate(C,Rn){this.resolvedProperty[this.propertyIndex]=C[Rn],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(C,Rn){this.resolvedProperty[this.propertyIndex]=C[Rn],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(C,Rn){this.resolvedProperty.fromArray(C,Rn)}_setValue_fromArray_setNeedsUpdate(C,Rn){this.resolvedProperty.fromArray(C,Rn),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(C,Rn){this.resolvedProperty.fromArray(C,Rn),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(C,Rn){this.bind(),this.getValue(C,Rn)}_setValue_unbound(C,Rn){this.bind(),this.setValue(C,Rn)}bind(){let C=this.node;const Rn=this.parsedPath,or=Rn.objectName,So=Rn.propertyName;let To=Rn.propertyIndex;if(C||(C=PropertyBinding.findNode(this.rootNode,Rn.nodeName),this.node=C),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!C)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(or){let So=Rn.objectIndex;switch(or){case"materials":if(!C.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!C.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);C=C.material.materials;break;case"bones":if(!C.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);C=C.skeleton.bones;for(let Rn=0;Rn<C.length;Rn++)if(C[Rn].name===So){So=Rn;break}break;case"map":if("map"in C){C=C.map;break}if(!C.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!C.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);C=C.material.map;break;default:if(void 0===C[or])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);C=C[or]}if(void 0!==So){if(void 0===C[So])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,C);C=C[So]}}const Ro=C[So];if(void 0===Ro){const or=Rn.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+or+"."+So+" but it wasn't found.",C)}let Uo=this.Versioning.None;this.targetObject=C,void 0!==C.needsUpdate?Uo=this.Versioning.NeedsUpdate:void 0!==C.matrixWorldNeedsUpdate&&(Uo=this.Versioning.MatrixWorldNeedsUpdate);let Oo=this.BindingType.Direct;if(void 0!==To){if("morphTargetInfluences"===So){if(!C.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!C.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==C.morphTargetDictionary[To]&&(To=C.morphTargetDictionary[To])}Oo=this.BindingType.ArrayElement,this.resolvedProperty=Ro,this.propertyIndex=To}else void 0!==Ro.fromArray&&void 0!==Ro.toArray?(Oo=this.BindingType.HasFromToArray,this.resolvedProperty=Ro):Array.isArray(Ro)?(Oo=this.BindingType.EntireArray,this.resolvedProperty=Ro):this.propertyName=So;this.getValue=this.GetterByBindingType[Oo],this.setValue=this.SetterByBindingTypeAndVersioning[Oo][Uo]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}PropertyBinding.Composite=class{constructor(C,Rn,or){const So=or||PropertyBinding.parseTrackName(Rn);this._targetGroup=C,this._bindings=C.subscribe_(Rn,So)}getValue(C,Rn){this.bind();const or=this._targetGroup.nCachedObjects_,So=this._bindings[or];void 0!==So&&So.getValue(C,Rn)}setValue(C,Rn){const or=this._bindings;for(let So=this._targetGroup.nCachedObjects_,To=or.length;So!==To;++So)or[So].setValue(C,Rn)}bind(){const C=this._bindings;for(let Rn=this._targetGroup.nCachedObjects_,or=C.length;Rn!==or;++Rn)C[Rn].bind()}unbind(){const C=this._bindings;for(let Rn=this._targetGroup.nCachedObjects_,or=C.length;Rn!==or;++Rn)C[Rn].unbind()}},PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray],PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];new Float32Array(1);const gA=new Matrix4;class Raycaster{constructor(C,Rn,or,So){void 0===or&&(or=0),void 0===So&&(So=1/0),this.ray=new Ray(C,Rn),this.near=or,this.far=So,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(C,Rn){this.ray.set(C,Rn)}setFromCamera(C,Rn){Rn.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(Rn.matrixWorld),this.ray.direction.set(C.x,C.y,.5).unproject(Rn).sub(this.ray.origin).normalize(),this.camera=Rn):Rn.isOrthographicCamera?(this.ray.origin.set(C.x,C.y,(Rn.near+Rn.far)/(Rn.near-Rn.far)).unproject(Rn),this.ray.direction.set(0,0,-1).transformDirection(Rn.matrixWorld),this.camera=Rn):console.error("THREE.Raycaster: Unsupported camera type: "+Rn.type)}setFromXRController(C){return gA.identity().extractRotation(C.matrixWorld),this.ray.origin.setFromMatrixPosition(C.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(gA),this}intersectObject(C,Rn,or){return void 0===Rn&&(Rn=!0),void 0===or&&(or=[]),intersect(C,this,or,Rn),or.sort(ascSort),or}intersectObjects(C,Rn,or){void 0===Rn&&(Rn=!0),void 0===or&&(or=[]);for(let So=0,To=C.length;So<To;So++)intersect(C[So],this,or,Rn);return or.sort(ascSort),or}}function ascSort(C,Rn){return C.distance-Rn.distance}function intersect(C,Rn,or,So){let To=!0;if(C.layers.test(Rn.layers)){!1===C.raycast(Rn,or)&&(To=!1)}if(!0===To&&!0===So){const So=C.children;for(let C=0,To=So.length;C<To;C++)intersect(So[C],Rn,or,!0)}}"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:So}})),"undefined"!==typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=So)},4147:C=>{"use strict";C.exports=JSON.parse('{"i8":"3.1.0","cj":{"H":"https://gitlab.com/panoramax/clients/web-viewer"}}')},3517:C=>{"use strict";C.exports=JSON.parse('{"gvs":{"options":"Optionen","filters":"Filter","search":"Suche","layers":"Ebenen","share_links":"Links","share_page":"Link zu dieser Seite","loading_labels_fun":["\ud83e\udd8c Erkennung der \\"Reh kreuzt\\"-Schilder","\ud83d\ude98 Suche Panoramax-Auto \xa9","\u2615 Koffeininjektion","\ud83d\ude00 L\xe4chle, du wirst kartografiert!","\ud83d\udc08 Katzenfotos teilen","\ud83d\ude34 Reduzieren der Prokrastination","\ud83c\udf7a\ufe0f Bier brauen","\ud83d\udc27 Quellcode \xf6ffnen","\ud83d\udee3\ufe0f Indizierung der Autobahnen","\ud83e\uddf9 Metadatenreinigung","\ud83d\ude92 Senden der Fotos der Feuerwehren","\ud83d\udeb2 Gr\xfcne Radwege identifiziert","\ud83d\ude89 Durchgang zum Bahnsteig","\ud83d\udef0\ufe0f Suche Satelliten","\ud83d\udc65 Personas anlegen","\ud83c\udf2d\ufe0f Lokalisierung der Currywurst","\ud83e\uddd1\u200d\ud83d\udcbb Debugging des Interfaces","\ud83d\udcc8 Hochz\xe4hlen der Statistiken"],"search_empty":"Keine Ergebnisse gefunden","share":"Teilen","metadata_general_picid":"Bild-Identifier","zoom":"Zoom","zoomOut":"Herauszoomen","zoomIn":"Hereinzoomen","moveUp":"Nach oben","moveDown":"Nach unten","moveRight":"Nach rechts","moveMiddle":"Sicht zentrieren","map_theme_age":"Nach Aufnahmedatum","expand":"Vergr\xf6\xdfern","expand_info":"Widget im Vollbild anzeigen","show_psv":"Bildbetrachter anzeigen","show_map":"Karte anzeigen","search_user":"Benutzernamen suchen\u2026","filter_zoom_in":"Hereinzoomen um Filter sichtbar zu machen","picture_flat":"Klassisch","picture_360":"360\xb0","filter_camera_model":"Nach Kameramodell","filter_reset":"Filter l\xf6schen","map_background":"Kartenhintergrund","map_background_aerial":"Satelliten","map_background_streets":"Stra\xdfen","map_theme":"Karten-Art","metadata_exif_name":"Schlagwort","metadata_exif_value":"Wert","map_theme_age_2":"<2 Jahre","map_theme_age_3":"<1 Jahr","map_theme_type":"Nach Kameratyp","contrast":"H\xf6heren Bildkontrast aktivieren","metadata":"Bildmetadaten","metadata_general_seqid":"Sequenzidentifier","metadata_general_picid_link":"Zur JOSN-Beschreibung des Bildes gehen","loading_labels_serious":["\ud83d\uddfa\ufe0f Laden der Kartendaten","\ud83d\udda5\ufe0f API anfragen","\ud83d\uddbc\ufe0f Vorschaubilder laden","\ud83d\udd0d EXIF Metadaten analysieren","\ud83c\udfd8\ufe0f 3D-Rendering","\ud83d\udcf7 360\xb0 Fotos initialisieren","\ud83d\udfe0 Farben balancieren"],"search_address":"Suchen sie eine Adresse, Stadt, \u2026","share_image":"HD Bild","share_rss":"RSS Feed","share_embed":"Auf Webseite einbetten","share_print":"Druck","copy":"Kopieren","copied":"Kopiert","error":"Panoramax ist abgest\xfcrzt\u2026","sequence_next":"N\xe4chstes Foto in der Sequenz","sequence_play":"Sequenz abspielen","sequence_pause":"Sequenz pausieren","sequence_prev":"Vorheriges Foto in der Sequenz","sequence_more":"Mehr Abspieloptionen","sequence_speed":"Abspielgeschwindigkeit","legend_license":"Lizenz: {l}","edit_osm":"OSM editieren","id":"iD","josm":"JOSM","josm_live":"Einschalten der automatischen JOSM-Synchronisierung beim Laden eines Bildes","error_psv":"Betrachter f\xfcr die Photospheres wurde nicht richtig geladen","error_pic":"Gesuchtes Foto wurde nicht gefunden","error_nopic":"Kein Foto verf\xfcgbar an dieser Position","error_api":"Foto-Server ist nicht verf\xfcgbar","error_josm":"JOSM reagiert nicht, ist es ge\xf6ffnet und die Remote eingeschaltet?","error_api_compatibility":"Der Foto-Server ist nicht mit dieser Version des Betrachters kompatibel","filter_date":"Nach Datum","filter_user":"Nach Benutzer","filter_picture":"Nach Foto-Art","map_theme_default":"Nach standard","map_theme_age_1":">2 Jahre","metadata_general_seqid_link":"Zur JSON-Beschreibung der Sequenz gehen","metadata_general_author":"Autor","metadata_general_license":"Lizenz","metadata_general_date":"Aufnahmedatum","metadata_camera":"Kamera","metadata_camera_make":"Hersteller","metadata_camera_model":"Modell","metadata_camera_type":"Typ","metadata_camera_focal_length":"Brennweite","metadata_location":"Ort","metadata_location_longitude":"L\xe4ngengrad","metadata_location_latitude":"Breitengrad","metadata_location_orientation":"Aufnahmerichtung","metadata_location_precision":"Pr\xe4zision der Positionierung","metadata_exif":"EXIF / XMP","minimize":"Widget verbergen, sie k\xf6nnen es \xfcber die Schaltfl\xe4che in der linken unteren Ecke wieder einblenden","map_theme_age_4":"< 1 Monat","error_subtitle":"Bitte versuchen sie es sp\xe4ter erneut, oder schauen sie in die Web-Browser-Konsole f\xfcr mehr Details.","moveLeft":"Nach links","share_rss_title":"RSS Feed neuer Sequenzen auf der aktuell sichtbaren Karte","error_webgl":"WebGL wird von diesem Browser nicht unterst\xfctzt","metadata_general_license_link":"Zur vollen Lizenzbeschreibung gehen","share_embed_docs":"Mehr \xfcber die Einbettungs-Konfiguration lesen","report_nature":{"":"Art des Problems ausw\xe4hlen\u2026","inappropriate":"Bild ist unangemessen (irrelevant, Nacktheit, ...)","picture_low_quality":"Bild hat eine sehr schlechte Qualit\xe4t","blur_missing":"Das Gesicht einer Person oder ein KFZ-Kennzeichen ist sichtbar","blur_excess":"Ein Objekt das nicht unkenntlich gemacht werden muss wurde unkenntlich gemacht","privacy":"Ein privater Pfad oder ein privates Grundst\xfcck ist sichtbar","mislocated":"Bild ist falsch auf der Karte verortet","copyright":"Bild verletzt das Urheberrecht","other":"Andere Art von Problem"},"report_details_placeholder":"Sie k\xf6nnen optionale Details \xfcber das Problem hinzuf\xfcgen","report_auth":"Dieser Report wird durch ihren Account \\"{a}\\" gesendet","report_nature_label":"Art des Problems","report_whole_sequence":"Dies betrifft die gesamte Sequenz","report_details":"Weitere Details","report_email":"Ihre Email","report_email_placeholder":"Optional","report_submit":"Absenden","report_success":"Ihr Report wurde erfolgreich gesendet. Er wird so schnell wie m\xf6glich \xfcberpr\xfcft.","report_failure":"Ein Fehler ist bei der Erstellung des Reports aufgetreten: {e}. Bitte versuchen sie es erneut.","report":"Foto melden"},"psv":{"twoFingers":"Nutzen sie zwei Finger zum navigieren","ctrlZoom":"Nutzen sie Strg+Scrollen um das Bild zu zoomen","loadError":"Das Panorama konnte nicht geladen werden"},"map":{"thumbnail":"Vorschau des marktierten Fotos","no_thumbnail":"Keine Vorschau","not_public":"Nicht \xf6ffentlich sichtbar","loading":"Laden\u2026"},"maplibre":{"GeolocateControl.FindMyLocation":"Meinen Standort finden","GeolocateControl.LocationNotAvailable":"Standort nicht verf\xfcgbar"}}')},1700:C=>{"use strict";C.exports=JSON.parse('{"psv":{"twoFingers":"Use two fingers to navigate","ctrlZoom":"Use ctrl + scroll to zoom the image","loadError":"The panorama can\'t be loaded"},"maplibre":{"GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available"},"gvs":{"zoom":"Zoom","zoomOut":"Zoom out","zoomIn":"Zoom in","moveUp":"Move up","moveDown":"Move down","moveLeft":"Move left","moveRight":"Move right","moveMiddle":"Center view","expand":"Expand","expand_info":"Make the widget appear in full page","show_psv":"Show the picture viewer","show_map":"Show the map","minimize":"Hide this widget, you can show it again using button in bottom left corner","options":"Options","filters":"Filters","layers":"Layers","search":"Search","search_empty":"No results found","search_address":"Search an address, city\u2026","search_user":"Search a username\u2026","share":"Share","share_links":"Links","share_page":"Link to this page","share_image":"HD Image","share_rss":"RSS feed","share_rss_title":"RSS feed of new sequences on the map visible area","share_embed":"Embed on your website","share_embed_docs":"Read more about embed configuration","share_print":"Print","copy":"Copy","copied":"Copied","error":"We have a problem\u2026","error_click":"Click to continue","error_retry":"Please retry later","sequence_next":"Next picture in sequence","sequence_play":"Play along this sequence","sequence_pause":"Pause sequence","sequence_prev":"Previous picture in sequence","sequence_more":"More play options","sequence_speed":"Player speed","legend_license":"License: {l}","legend_title":"Show details of picture","edit_osm":"Edit OSM","id":"iD","josm":"JOSM","josm_live":"Enable JOSM automatic sync on picture loading","loading_labels_serious":["\ud83d\uddfa\ufe0f Loading map data","\ud83d\udda5\ufe0f Querying API","\ud83d\uddbc\ufe0f Loading thumbnails","\ud83d\udd0d Analyzing EXIF metadata","\ud83c\udfd8\ufe0f 3D rendering","\ud83d\udcf7 Initializing 360\xb0 pictures","\ud83d\udfe0 Colour balancing"],"loading_labels_fun":["\ud83e\udd8c Deer crossing sign detection","\ud83d\ude98 Searching Panoramax Car \xa9","\u2615 Caffeine injection","\ud83d\ude00 Smile, you\'re mapped!","\ud83d\udc08 Sharing cat pictures","\ud83d\ude34 Reducing procrastination","\ud83e\uded6 Brewing tea","\ud83d\udc27 Opening source code","\ud83d\ude87 Indexing Underground stations","\ud83e\uddf9 Metadata cleanup","\ud83d\ude92 Sending fire station photos","\ud83d\udeb2 Greenways update","\ud83d\ude89 Station platform walkthrough","\ud83d\udef0\ufe0f Searching satellites","\ud83d\udc65 Writing personas","\ud83d\udc1f Locating chip shops","\ud83e\uddd1\u200d\ud83d\udcbb Debugging interface","\ud83d\udcc8 Incrementing statistics"],"error_psv":"Photo Sphere Viewer is not loading properly","error_pic":"Wanted picture wasn\'t found","error_nopic":"No picture available at given position","error_api":"The pictures server is not available","error_webgl":"WebGL is not supported on this browser","error_josm":"JOSM doesn\'t respond, is it running and is remote enabled?","error_api_compatibility":"The pictures server is not compatible with this viewer version","filter_date":"By date","filter_user":"By user","filter_picture":"By picture type","filter_zoom_in":"Zoom-in for filters to be visible","picture_flat":"Classic","picture_360":"360\xb0","filter_camera_model":"By camera model","filter_reset":"Clear filters","map_background":"Map background","map_background_aerial":"Aerial","map_background_streets":"Streets","map_theme":"Map theme","map_theme_default":"By default","map_theme_age":"By capture date","map_theme_age_1":"> 2 years","map_theme_age_2":"< 2 years","map_theme_age_3":"< 1 year","map_theme_age_4":"< 1 month","map_theme_type":"By camera type","contrast":"Enable higher image contrast","metadata":"Picture metadata","metadata_general_picid":"Picture identifier","metadata_general_seqid":"Sequence identifier","metadata_general_picid_link":"Go to JSON description of the picture","metadata_general_seqid_link":"Go to JSON description of the sequence","metadata_general_author":"Author","metadata_general_license":"License","metadata_general_license_link":"Go to license full description page","metadata_general_date":"Capture date","metadata_camera":"Camera","metadata_camera_make":"Make","metadata_camera_model":"Model","metadata_camera_type":"Type","metadata_camera_focal_length":"Focal length","metadata_location":"Location","metadata_location_longitude":"Longitude","metadata_location_latitude":"Latitude","metadata_location_orientation":"Capture direction","metadata_location_precision":"Positioning precision","metadata_exif":"EXIF / XMP","metadata_exif_name":"Tag","metadata_exif_value":"Value","report":"Report picture","report_auth":"This report will be sent using your account \\"{a}\\"","report_nature_label":"Nature of the issue","report_nature":{"":"Select the nature of issue\u2026","blur_missing":"A person face or car plate is visible","blur_excess":"An object not needing blur is blurred","inappropriate":"Picture is inappropriate (unrelated, nudity\u2026)","privacy":"A private path or property is visible","picture_low_quality":"Picture is of very bad quality","mislocated":"Picture is badly positioned on map","copyright":"Picture infringes copyright","other":"Any other kind of issue"},"report_whole_sequence":"This concerns the entire sequence","report_details":"Additional details","report_details_placeholder":"Optional, you can add details about the issue and how this is concerning","report_email":"Your email","report_email_placeholder":"Optional","report_submit":"Submit","report_wait":"Sending report...","report_success":"Report has been successfully sent. It will be reviewed as soon as possible.","report_failure":"An error occurred when creating report: {e}. Please try again later."},"map":{"loading":"Loading\u2026","thumbnail":"Thumbnail of hovered picture","no_thumbnail":"No thumbnail","not_public":"Not publicly visible"}}')},6980:C=>{"use strict";C.exports=JSON.parse('{"gvs":{"report_auth":"La denuncia se enviar\xe1 usando tu cuenta \xab{a}\xbb","report":"Denunciar imagen","report_nature_label":"Tipo de problema","report_nature":{"":"Selecciona el tipo de problema\u2026","blur_missing":"Se ve el rostro de una persona, o una matr\xedcula","blur_excess":"Est\xe1 borroso un objeto que no hac\xeda falta ocultar","inappropriate":"La imagen no es apropiada (irrelevante, desnudez, \u2026)","privacy":"Se ve un camino privado, o una propiedad privada","mislocated":"La localizaci\xf3n de la imagen en el mapa no es correcta","picture_low_quality":"La calidad de la imagen es pobre","copyright":"La imagen infringe derechos de autor","other":"Otro tipo de problema"},"sequence_more":"M\xe1s opciones de reproducci\xf3n","sequence_speed":"Velocidad de reproducci\xf3n","legend_license":"Licencia: {l}","edit_osm":"Editar OpenStreetMap","id":"iD","josm":"JOSM","josm_live":"Activar la sincronizaci\xf3n autom\xe1tica de JOSM cuando se carga una imagen","loading_labels_serious":["\ud83d\uddfa\ufe0f Cargando datos del mapa","\ud83d\udda5\ufe0f Consultando la API","\ud83d\uddbc\ufe0f Cargando vistas previas","\ud83d\udd0d Analizando metadatos EXIF","\ud83c\udfd8\ufe0f Renderizado 3D","\ud83d\udcf7 Preparando im\xe1genes 360\xb0","\ud83d\udfe0 Ajustando balance de color"],"metadata":"Metadatos de la imagen","map_theme_type":"Por tipo de c\xe1mara","contrast":"Dar m\xe1s contraste a la imagen","zoom":"Acercar/alejar","zoomOut":"Alejar","map_background_streets":"Calles","loading_labels_fun":["\ud83e\udd8c Detectando paneles de cruce de alces","\ud83d\ude98 Buscando el Coche Panoramax \xa9","\u2615 Inyectando cafe\xedna","\ud83d\ude00 \xa1Sonr\xede, est\xe1s siendo mapeado!","\ud83d\udc08 Compartiendo fotos de gatos","\ud83d\ude34 Reduciendo la procrastinaci\xf3n","\ud83e\uded6 Preparando el t\xe9","\ud83d\udc27 Abriendo el c\xf3digo fuente","\ud83d\ude87 Indexando estaciones del metro","\ud83e\uddf9 Limpieza de metadatos","\ud83d\ude92 Enviando fotos de estaciones de bomberos","\ud83d\udeb2 Actualizando v\xedas verdes","\ud83d\ude89 Paseo por el and\xe9n de la estaci\xf3n","\ud83d\udef0\ufe0f Buscando sat\xe9lites","\ud83d\udc65 Describiendo tipolog\xedas de persona","\ud83d\udc1f Localizando tiendas de fish & chips","\ud83e\uddd1\u200d\ud83d\udcbb Buscando gazapos de la interfaz","\ud83d\udcc8 Incrementando estad\xedsticas"],"metadata_general_license_link":"Ir a la descripci\xf3n completa de la licencia","metadata_general_picid":"Identificador de la imagen","metadata_general_license":"Licencia","report_details_placeholder":"Opcional; puedes a\xf1adir m\xe1s detalles sobre el problema y por qu\xe9 te preocupa","expand":"Expandir","expand_info":"Mostrar el elemento ocupando toda la p\xe1gina","show_psv":"Mostrar el visor de im\xe1genes","show_map":"Mostrar el mapa","zoomIn":"Acercar","moveUp":"Desplazar hacia arriba","moveDown":"Desplazar hacia abajo","moveLeft":"Desplazar hacia la izquierda","moveRight":"Desplazar hacia la derecha","moveMiddle":"Centrar la vista","minimize":"Esconder este elemento. Para mostrarlo de nuevo, pulsa el bot\xf3n en la esquina inferior izquierda","options":"Opciones","filters":"Filtros","layers":"Capas","search":"Buscar","search_empty":"No se encontraron resultados","search_address":"Buscar una direcci\xf3n, una ciudad, \u2026","search_user":"Buscar un usuario\u2026","share":"Compartir","share_links":"Enlaces","share_page":"Enlace a esta p\xe1gina","share_image":"Imagen de alta calidad","share_rss":"Flujo RSS","share_rss_title":"Flujo RSS de las nuevas secuencias en el \xe1rea visible del mapa","share_embed":"Incrustar en tu p\xe1gina web","share_embed_docs":"M\xe1s informaci\xf3n sobre c\xf3mo configurar el incrustado","share_print":"Imprimir","copy":"Copiar","copied":"Copiado","error":"Hay un problema\u2026","sequence_next":"Siguiente imagen de la secuencia","sequence_play":"Reproducir esta secuencia","sequence_pause":"Pausar la secuencia","sequence_prev":"Imagen anterior de la secuencia","error_click":"Haz click para continuar","error_retry":"Por favor, int\xe9ntalo m\xe1s tarde","error_psv":"El visor de fotos esf\xe9ricas no se carga correctamente","error_pic":"No se encuentra la imagen que quer\xedamos","error_nopic":"No hay im\xe1genes para la posici\xf3n dada","error_api":"El servidor de im\xe1genes no est\xe1 disponible","error_webgl":"Este navegador no admite WebGL","error_josm":"JOSM no responde. \xbfEst\xe1 abierto, y admite el modo de Control Remoto?","error_api_compatibility":"El servidor de im\xe1genes no es compatible con esta versi\xf3n del visor","filter_date":"Por fecha","filter_user":"Por usuario","filter_picture":"Por tipo de imagen","filter_zoom_in":"Ac\xe9rcate para poder ver filtros","picture_flat":"Cl\xe1sico","picture_360":"360\xb0","filter_camera_model":"Por modelo de c\xe1mara","filter_reset":"Quitar filtros","map_background":"Fondo de mapa","map_background_aerial":"Vista a\xe9rea","map_theme":"Tema de mapa","map_theme_default":"Por defecto","map_theme_age":"Por fecha de toma de imagen","map_theme_age_1":"M\xe1s de dos a\xf1os","map_theme_age_2":"Menos de dos a\xf1os","map_theme_age_3":"Menos de un a\xf1o","map_theme_age_4":"Menos de un mes","metadata_general_seqid":"Identificador de la secuencia","metadata_general_picid_link":"Ir a la descripci\xf3n de la imagen en formato JSON","metadata_general_seqid_link":"Ir a la descripci\xf3n de la secuencia en formato JSON","metadata_general_author":"Autor","metadata_general_date":"Fecha de toma de imagen","metadata_camera":"C\xe1mara","metadata_camera_make":"Marca","metadata_camera_model":"Modelo","metadata_camera_type":"Tipo","metadata_camera_focal_length":"Distancia focal","metadata_location":"Localizaci\xf3n","metadata_location_longitude":"Longitud","metadata_location_latitude":"Latitud","metadata_location_orientation":"Orientaci\xf3n","metadata_location_precision":"Precisi\xf3n de la localizaci\xf3n","metadata_exif":"EXIF / XMP","metadata_exif_name":"Etiqueta","metadata_exif_value":"Valor","report_whole_sequence":"El problema afecta a la secuencia entera","report_details":"M\xe1s detalles","report_email":"Tu direcci\xf3n de correo electr\xf3nico","report_email_placeholder":"Opcional","report_submit":"Enviar","report_success":"La denuncia se ha enviado correctamente. Ser\xe1 revisada lo antes posible.","report_failure":"Ocurri\xf3 un error al crear la denuncia: {e}. Por favor, int\xe9ntalo m\xe1s tarde."},"psv":{"ctrlZoom":"Utiliza Control+rueda de desplazamiento para acercar/alejar","loadError":"Este panorama no se puede cargar","twoFingers":"Desplaza el mapa con dos dedos"},"maplibre":{"GeolocateControl.FindMyLocation":"Local\xedzame","GeolocateControl.LocationNotAvailable":"Localizaci\xf3n no disponible"},"map":{"loading":"Cargando\u2026","thumbnail":"Vista previa de la imagen bajo el cursor","no_thumbnail":"No hay vista previa","not_public":"No es visible p\xfablicamente"}}')},6493:C=>{"use strict";C.exports=JSON.parse('{"psv":{"twoFingers":"Utilisez deux doigts pour vous d\xe9placer","ctrlZoom":"Utilisez ctrl + scroll pour zoomer dans l\'image","loadError":"L\'image ne peut pas \xeatre charg\xe9e"},"maplibre":{"GeolocateControl.FindMyLocation":"Afficher ma position","GeolocateControl.LocationNotAvailable":"GPS non-disponible"},"gvs":{"zoom":"Zoom","zoomOut":"D\xe9zoomer","zoomIn":"Zoomer","moveUp":"Vers le haut","moveDown":"Vers le bas","moveLeft":"Vers la gauche","moveRight":"Vers la droite","moveMiddle":"Centrer la vue","expand":"Agrandir","expand_info":"Faire appara\xeetre ce widget en pleine page","show_psv":"Afficher la visionneuse de photos","show_map":"Afficher la carte","minimize":"Masquer ce widget, vous pouvez l\'afficher de nouveau gr\xe2ce au bouton dans le coin en bas \xe0 gauche","options":"Options","filters":"Filtres","layers":"Calques","search":"Rechercher","search_empty":"Aucun r\xe9sultat","search_address":"Rechercher une adresse, ville\u2026","search_user":"Rechercher un nom d\'utilisateur\u2026","share":"Partager","share_links":"Liens utiles","share_page":"Lien de la page","share_image":"Image HD","share_rss":"Flux RSS","share_rss_title":"Flux RSS des nouvelles s\xe9quences dans la zone visible sur la carte","share_embed":"Int\xe9gration sur votre site","share_embed_docs":"D\xe9couvrir plus de possibilit\xe9s pour l\'int\xe9gration sur votre site","share_print":"Imprimer","copy":"Copier","copied":"Copi\xe9","error":"On a un probl\xe8me\u2026","error_click":"Cliquez pour continuer","error_retry":"Merci de r\xe9essayer plus tard","sequence_next":"Photo suivante dans la s\xe9quence","sequence_play":"Parcourir cette s\xe9quence","sequence_pause":"Mettre en pause la s\xe9quence","sequence_prev":"Photo pr\xe9c\xe9dente dans la s\xe9quence","sequence_more":"Plus d\'options de lecture","sequence_speed":"Vitesse de lecture","legend_license":"Licence : {l}","legend_title":"Afficher les d\xe9tails de l\'image","edit_osm":"Contribuer sur OSM","id":"iD","josm":"JOSM","josm_live":"Active la synchronisation automatique de JOSM lors du chargement d\'une photo","loading_labels_serious":["\ud83d\uddfa\ufe0f Chargement du fond de carte","\ud83d\udda5\ufe0f Interrogation de l\'API","\ud83d\uddbc\ufe0f Chargement des miniatures","\ud83d\udd0d Analyse des m\xe9tadonn\xe9es EXIF","\ud83c\udfd8\ufe0f Cr\xe9ation du rendu 3D","\ud83d\udcf7 Initialisation des vues 360\xb0","\ud83d\udfe0 \xc9quilibrage des couleurs"],"loading_labels_fun":["\ud83e\udd8c D\xe9tection des panneaux biche","\ud83d\ude98 Recherche de la Panoramax Car \xa9","\u2615 Injection de caf\xe9ine","\ud83d\ude00 Souriez, vous \xeates mapp\xe9s !","\ud83d\udc08 Partage de photos de chats","\ud83d\ude34 R\xe9duction de la procrastination","\ud83c\uddf7\ud83c\uddea Chargement : 974%","\ud83d\udc27 Ouverture du code source","\ud83e\udd81 Indexation des traboules","\ud83e\uddf9 Nettoyage des m\xe9tadonn\xe9es","\ud83d\ude92 Envoi des photos du SDIS","\ud83d\udeb2 Mise \xe0 jour des voies vertes","\ud83d\ude89 Remont\xe9e des quais de gare","\ud83d\udef0\ufe0f Recherche de satellites","\ud83d\udc65 \xc9criture des personas","\ud83e\udd5e Localisation des cr\xeaperies","\ud83e\uddd1\u200d\ud83d\udcbb D\xe9boguage de l\'interface","\ud83d\udcc8 Incr\xe9mentation des statistiques"],"error_psv":"Photo Sphere Viewer ne s\'est pas charg\xe9 correctement","error_pic":"La photo demand\xe9e est introuvable","error_nopic":"Aucune photo disponible autour de la localisation recherch\xe9e","error_api":"Le serveur de photos n\'est pas disponible","error_webgl":"WebGL n\'est pas support\xe9 par ce navigateur","error_josm":"JOSM n\'a pas r\xe9pondu, est-il bien lanc\xe9 et la t\xe9l\xe9commande activ\xe9e ?","error_api_compatibility":"Le serveur de photos n\'est pas compatible avec cette visionneuse","filter_date":"Par date","filter_user":"Par utilisateur","filter_picture":"Par type d\'image","picture_flat":"Classique","picture_360":"360\xb0","filter_camera_model":"Par mod\xe8le d\'appareil","filter_reset":"Retirer les filtres","filter_zoom_in":"Zoomez plus pour voir les filtres","map_background":"Fond de carte","map_background_aerial":"Satellite","map_background_streets":"Plan","map_theme":"Rendu de carte","map_theme_default":"Par d\xe9faut","map_theme_age":"Par date de prise de vue","map_theme_age_1":"> 2 ans","map_theme_age_2":"< 2 ans","map_theme_age_3":"< 1 an","map_theme_age_4":"< 1 mois","map_theme_type":"Par type de cam\xe9ra","contrast":"Augmenter le contraste de l\'image","metadata":"M\xe9tadonn\xe9es de la photo","metadata_general_picid":"Identifiant de photo","metadata_general_seqid":"Identifiant de s\xe9quence","metadata_general_picid_link":"Aller au descriptif JSON de la photo","metadata_general_seqid_link":"Aller au descriptif JSON de la s\xe9quence","metadata_general_author":"Auteur","metadata_general_license":"Licence","metadata_general_license_link":"Aller \xe0 la page de pr\xe9sentation de la licence","metadata_general_date":"Date de prise de vue","metadata_camera":"Appareil","metadata_camera_make":"Fabricant","metadata_camera_model":"Mod\xe8le","metadata_camera_type":"Type","metadata_camera_focal_length":"Longueur focale","metadata_location":"Localisation","metadata_location_longitude":"Longitude","metadata_location_latitude":"Latitude","metadata_location_orientation":"Direction de prise de vue","metadata_location_precision":"Pr\xe9cision du positionnement","metadata_exif":"EXIF / XMP","metadata_exif_name":"Balise","metadata_exif_value":"Valeur","report":"Signaler la photo","report_auth":"Ce signalement sera envoy\xe9 en utilisant votre compte \\"{a}\\"","report_nature_label":"Nature du probl\xe8me","report_nature":{"":"S\xe9lectionnez la nature du probl\xe8me\u2026","blur_missing":"Un visage ou une plaque d\'immatriculation est visible","blur_excess":"Un objet qui ne n\xe9cessite pas de floutage est flout\xe9","inappropriate":"L\'image est inappropri\xe9e (non pertinente, nudit\xe9\u2026)","privacy":"Un chemin priv\xe9 ou une propri\xe9t\xe9 priv\xe9e est visible","picture_low_quality":"L\'image est de mauvaise qualit\xe9","mislocated":"L\'image est mal g\xe9olocalis\xe9e","copyright":"L\'image enfreint les droits d\'auteur","other":"Tout autre type de probl\xe8me"},"report_whole_sequence":"Cela concerne toute la s\xe9quence","report_details":"D\xe9tails suppl\xe9mentaires","report_details_placeholder":"Optionnel, vous pouvez ajouter des d\xe9tails sur le probl\xe8me","report_email":"Votre email","report_email_placeholder":"Optionnel","report_submit":"Envoyer","report_wait":"Envoi du signalement en cours...","report_success":"Le signalement a \xe9t\xe9 envoy\xe9 avec succ\xe8s. Il sera examin\xe9 d\xe8s que possible.","report_failure":"Une erreur est survenue lors de la cr\xe9ation du signalement : {e}. Veuillez r\xe9essayer plus tard."},"map":{"loading":"Chargement\u2026","thumbnail":"Miniature de la photo survol\xe9e","no_thumbnail":"Pas de miniature","not_public":"Masqu\xe9 au public"}}')},6254:C=>{"use strict";C.exports=JSON.parse('{"psv":{"twoFingers":"Haszn\xe1ljon k\xe9t ujjat a navig\xe1ci\xf3hoz","ctrlZoom":"Haszn\xe1ljon Ctrl + g\xf6rget\xe9st a k\xe9p nagy\xedt\xe1s\xe1hoz","loadError":"A panor\xe1ma nem t\xf6lthet\u0151 be"},"gvs":{"zoom":"Nagy\xedt\xe1s","zoomOut":"Nagy\xedt\xe1s","zoomIn":"Kicsiny\xedt\xe1s","moveUp":"Mozg\xe1s fel","moveDown":"Mozg\xe1s le","moveLeft":"Mozg\xe1s balra","moveRight":"Mozg\xe1s jobbra","moveMiddle":"N\xe9zet k\xf6z\xe9pre hoz\xe1sa","expand":"B\u0151v\xedteni","expand_info":"A widget teljes oldalon t\xf6rt\xe9n\u0151 megjelen\xedt\xe9se","show_psv":"A k\xe9pn\xe9zeget\u0151 megjelen\xedt\xe9se","show_map":"A t\xe9rk\xe9p megjelen\xedt\xe9se","minimize":"Kis m\xe9ret","options":"Be\xe1ll\xedt\xe1sok","filters":"Sz\u0171r\u0151k","layers":"R\xe9tegek","share":"Megoszt\xe1s","search":"Keres\xe9s","search_empty":"Nincs eredm\xe9ny","share_links":"Hivatkoz\xe1sok","share_page":"Ez az oldal","share_image":"HD felbont\xe1s\xfa k\xe9p","share_rss":"RSS","share_rss_title":"A t\xe9rk\xe9p l\xe1that\xf3 ter\xfclet\xe9n l\xe9v\u0151 \xfaj sorozatok RSS-h\xedrcsatorn\xe1ja","share_embed":"Be\xe1gyaz\xe1s a weboldal\xe1n","share_print":"Nyomtat\xe1s","copy":"M\xe1sol\xe1s","copied":"M\xe1solva","error":"A Panoramax \xf6sszeomlott\u2026","error_subtitle":"Pr\xf3b\xe1lja \xfajra k\xe9s\u0151bb, vagy n\xe9zze meg a b\xf6ng\xe9sz\u0151konzolt a tov\xe1bbi r\xe9szletek\xe9rt.","sequence_next":"A sorozat k\xf6vetkez\u0151 k\xe9pe","sequence_play":"V\xe9gigl\xe9pked\xe9s a sorozaton","sequence_pause":"Sorozat sz\xfcnetelt\xe9se","sequence_prev":"A sorozat el\u0151z\u0151 k\xe9pe","sequence_more":"Tov\xe1bbi lej\xe1tsz\xe1si lehet\u0151s\xe9gek","sequence_speed":"Lej\xe1tsz\xf3 sebess\xe9ge","legend_license":"Licenc: {l}","edit_osm":"Az OSM szerkeszt\xe9se","id":"iD","josm":"JOSM","josm_live":"A JOSM automatikus szinkroniz\xe1l\xe1s\xe1nak enged\xe9lyez\xe9se k\xe9pbet\xf6lt\xe9skor","loading_labels_serious":["\ud83d\uddfa\ufe0f Loading map data","\ud83d\udda5\ufe0f Querying API","\ud83d\uddbc\ufe0f Loading thumbnails","\ud83d\udd0d Analyzing EXIF metadata","\ud83c\udfd8\ufe0f 3D rendering","\ud83d\udcf7 Initializing 360\xb0 pictures","\ud83d\udfe0 Colour balancing"],"loading_labels_fun":["\ud83e\udd8c Deer crossing sign detection","\ud83d\ude98 Searching Panoramax Car \xa9","\u2615 Caffeine injection","\ud83d\ude00 Smile, you\'re mapped!","\ud83d\udc08 Sharing cat pictures","\ud83d\ude34 Reducing procrastination","\ud83e\uded6 Brewing tea","\ud83d\udc27 Opening source code","\ud83d\ude87 Indexing Underground stations","\ud83e\uddf9 Metadata cleanup","\ud83d\ude92 Sending fire station photos","\ud83d\udeb2 Greenways update","\ud83d\ude89 Station platform walkthrough","\ud83d\udef0\ufe0f Searching satellites","\ud83d\udc65 Writing personas","\ud83d\udc1f Locating chip shops","\ud83e\uddd1\u200d\ud83d\udcbb Debugging interface","\ud83d\udcc8 Incrementing statistics"],"error_psv":"A f\xe9nyk\xe9pek g\xf6mbmegjelen\xedt\u0151je nem megfelel\u0151en t\xf6lt\u0151dik be","error_pic":"A k\xe9rt k\xe9p nem t\xf6lthet\u0151 be","error_nopic":"Nem \xe9rhet\u0151 el k\xe9p a megadott helyen","error_api":"A k\xe9pkiszolg\xe1l\xf3 nem \xe9rhet\u0151 el","error_webgl":"A WebGL nem t\xe1mogatott ebben a b\xf6ng\xe9sz\u0151ben","error_josm":"A JOSM nem v\xe1laszol, fut \xe9s el\xe9rhet\u0151 t\xe1volr\xf3l?","error_api_compatibility":"A fot\xf3kiszolg\xe1l\xf3 nem kompatibilis ezzel a megjelen\xedt\u0151vel","filter_date":"D\xe1tum szerint","filter_user":"Felhaszn\xe1l\xf3 szerint","filter_picture":"K\xe9p t\xedpusa szerint","picture_flat":"Klasszikus","picture_360":"360\xb0","filter_camera_model":"Kameramodell szerint","filter_reset":"Sz\u0171r\u0151k t\xf6rl\xe9se","map_background":"T\xe9rk\xe9pes h\xe1tt\xe9r","map_background_aerial":"L\xe9gi","map_background_streets":"Utc\xe1k","map_theme":"T\xe9rk\xe9p t\xe9m\xe1ja","map_theme_default":"Alap\xe9rtelmez\xe9s szerint","map_theme_age":"R\xf6gz\xedt\xe9s ideje szerint","map_theme_age_1":"> 2 \xe9ve","map_theme_age_2":"< 2 \xe9ve","map_theme_age_3":"< 1 \xe9ve","map_theme_age_4":"< 1 h\xf3napja","map_theme_type":"Kamerat\xedpus szerint","contrast":"Magas k\xe9pkontraszt bekapcsol\xe1sa","metadata":"Fot\xf3 metaadatok","metadata_general_picid":"F\xe9nyk\xe9p azonos\xedt\xf3ja","metadata_general_seqid":"Sorozat azonos\xedt\xf3","metadata_general_picid_link":"Tov\xe1bb a f\xe9nyk\xe9p JSON le\xedr\xe1s\xe1hoz","metadata_general_seqid_link":"Tov\xe1bb a sorozat JSON le\xedr\xe1s\xe1hoz","metadata_general_author":"Szerz\u0151","metadata_general_license":"Enged\xe9ly","metadata_general_license_link":"Tov\xe1bb a licenc bemutat\xf3 oldal\xe1ra","metadata_general_date":"K\xe9sz\xedt\xe9s d\xe1tuma","metadata_camera":"Kamera","metadata_camera_make":"Gy\xe1rt\xf3","metadata_camera_model":"Modell","metadata_camera_type":"T\xedpus","metadata_camera_focal_length":"Gy\xfajt\xf3t\xe1vols\xe1g","metadata_location":"Helysz\xedn","metadata_location_longitude":"Hossz\xfas\xe1g","metadata_location_latitude":"Sz\xe9less\xe9g","metadata_location_orientation":"Felv\xe9teli ir\xe1ny","metadata_location_precision":"Helymeghat\xe1roz\xe1si pontoss\xe1g","metadata_exif":"EXIF / XMP","metadata_exif_name":"C\xedmke","metadata_exif_value":"\xc9rt\xe9k"},"map":{"loading":"Bet\xf6lt\xe9s\u2026","thumbnail":"A kurzorral mutatott k\xe9p b\xe9lyegk\xe9pe","no_thumbnail":"Nincs b\xe9lyegk\xe9p","not_public":"Nem l\xe1that\xf3 nyilv\xe1nosan"}}')},1392:C=>{"use strict";C.exports=JSON.parse('{"gvs":{"contrast":"\u589e\u52a0\u76f8\u7247\u5c0d\u6bd4\u5ea6","copied":"\u5df2\u8907\u88fd","copy":"\u8907\u88fd","edit_osm":"\u7de8\u8f2f OSM","error":"Panoramax \u7576\u6a5f\u4e86\u2026","error_api":"\u76f8\u7247\u4f3a\u670d\u5668\u7121\u6cd5\u4f7f\u7528","error_api_compatibility":"\u76f8\u7247\u4f3a\u670d\u5668\u548c\u6b64\u6aa2\u8996\u5668\u7684\u7248\u672c\u4e0d\u76f8\u5bb9","error_josm":"JOSM \u6c92\u6709\u56de\u61c9\uff0c\u5b83\u5df2\u7d93\u555f\u52d5\u4e14\u555f\u7528\u9060\u7aef\u63a7\u5236\u4e86\u55ce?","error_nopic":"\u641c\u5c0b\u7684\u4f4d\u7f6e\u9644\u8fd1\u6c92\u6709\u76f8\u7247","error_pic":"\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u76f8\u7247","error_psv":"\u7121\u6cd5\u6b63\u78ba\u8f09\u5165 Photo Sphere Viewer","error_subtitle":"\u8acb\u7a0d\u5f8c\u91cd\u8a66\u6216\u6aa2\u67e5\u700f\u89bd\u5668\u7684\u4e3b\u63a7\u53f0\u4ee5\u4e86\u89e3\u8a73\u60c5\u3002","error_webgl":"\u6b64\u700f\u89bd\u5668\u4e0d\u652f\u63f4 WebGL","expand":"\u5c55\u958b","expand_info":"\u5728\u6574\u500b\u756b\u9762\u986f\u793a\u6b64\u5c0f\u5de5\u5177","filter_camera_model":"\u6309\u76f8\u6a5f\u578b\u865f","filter_date":"\u6309\u65e5\u671f","filter_picture":"\u6309\u76f8\u7247\u985e\u578b","filter_reset":"\u91cd\u8a2d","filter_user":"\u6309\u4f7f\u7528\u8005","filter_zoom_in":"\u62c9\u8fd1\u5730\u5716\u4ee5\u986f\u793a\u7be9\u9078\u7d50\u679c","filters":"\u7be9\u9078\u5668","id":"iD","josm":"JOSM","josm_live":"\u555f\u7528\u8f09\u5165\u76f8\u7247\u6642\u81ea\u52d5\u540c\u6b65 JOSM","layers":"\u5716\u5c64","legend_license":"\u6388\u6b0a: {l}","loading_labels_fun":["\ud83e\udd8c \u5075\u6e2c\u5230\u7576\u5fc3\u6885\u82b1\u9e7f\u6a19\u8a8c","\ud83d\ude98 \u6b63\u5728\u641c\u5c0b Panoramax \u6c7d\u8eca \xa9","\u2615 \u6ce8\u5165\u5496\u5561\u56e0","\ud83d\ude00 \u8acb\u5fae\u7b11\uff0c\u60a8\u5df2\u88ab\u6a19\u8a18\u5728\u5730\u5716\u4e0a\u4e86\uff01","\ud83d\udc08 \u6b63\u5728\u5206\u4eab\u8c93\u54aa\u7684\u76f8\u7247","\ud83d\ude34 \u6b63\u5728\u6e1b\u5c11\u5ef6\u9072","\ud83e\uded6 \u6b63\u5728\u6c8f\u58fa\u597d\u8336","\ud83d\udc27 \u6b63\u5728\u958b\u555f\u539f\u59cb\u78bc","\ud83d\ude87 \u6b63\u5728\u7d22\u5f15\u5730\u9435\u8eca\u7ad9","\ud83e\uddf9 \u6e05\u7406\u8a6e\u91cb\u8cc7\u6599","\ud83d\ude92 \u6b63\u5728\u50b3\u9001\u6d88\u9632\u968a\u7684\u76f8\u7247","\ud83d\udeb2 \u66f4\u65b0\u7da0\u9053","\ud83d\ude89 \u6b63\u5728\u901a\u904e\u8eca\u7ad9\u6708\u53f0","\ud83d\udef0\ufe0f \u6b63\u5728\u641c\u5c0b\u885b\u661f","\ud83d\udc65 \u6b63\u5728\u64b0\u5beb\u4eba\u7269\u8a8c","\ud83c\udf57 \u6b63\u5728\u5b9a\u4f4d\u9e79\u9165\u96de\u5e97","\ud83e\uddd1\u200d\ud83d\udcbb \u6b63\u5728\u5075\u932f\u4ecb\u9762","\ud83d\udcc8 \u7d71\u8a08\u6578\u64da\u6b63\u5728\u589e\u52a0"],"loading_labels_serious":["\ud83d\uddfa\ufe0f \u6b63\u5728\u8f09\u5165\u5730\u5716\u8cc7\u6599","\ud83d\udda5\ufe0f \u6b63\u5728\u67e5\u8a62 API","\ud83d\uddbc\ufe0f \u6b63\u5728\u8f09\u5165\u7e2e\u5716","\ud83d\udd0d \u6b63\u5728\u5206\u6790 EXIF \u8a6e\u91cb\u8cc7\u6599","\ud83c\udfd8\ufe0f \u6b63\u5728\u7b97\u7e6a 3D","\ud83d\udcf7 \u6b63\u5728\u521d\u59cb\u5316 360\xb0 \u76f8\u7247","\ud83d\udfe0 \u6b63\u5728\u5e73\u8861\u8272\u5f69"],"map_background":"\u5730\u5716\u80cc\u666f","map_background_aerial":"\u885b\u661f","map_background_streets":"\u9810\u8a2d","map_theme":"\u5730\u5716\u4e3b\u984c","map_theme_age":"\u62cd\u651d\u6642\u9593","map_theme_age_1":"> 2 \u5e74","map_theme_age_2":"< 2 \u5e74","map_theme_age_3":"< 1 \u5e74","map_theme_age_4":"< 1 \u500b\u6708","map_theme_default":"\u9810\u8a2d","map_theme_type":"\u76f8\u6a5f\u985e\u578b","metadata":"\u76f8\u7247\u8a6e\u91cb\u8cc7\u6599","metadata_camera":"\u76f8\u6a5f","metadata_camera_focal_length":"\u7126\u8ddd","metadata_camera_make":"\u88fd\u9020\u5546","metadata_camera_model":"\u578b\u865f","metadata_camera_type":"\u985e\u578b","metadata_exif":"EXIF / XMP","metadata_exif_name":"\u6a19\u7c64","metadata_exif_value":"\u503c","metadata_general_author":"\u4f5c\u8005","metadata_general_date":"\u62cd\u651d\u6642\u9593","metadata_general_license":"\u6388\u6b0a","metadata_general_license_link":"\u524d\u5f80\u6388\u6b0a\u689d\u6b3e\u8aaa\u660e\u9801","metadata_general_picid":"\u76f8\u7247\u8b58\u5225\u78bc","metadata_general_picid_link":"\u524d\u5f80\u672c\u76f8\u7247\u7684 JSON \u8aaa\u660e","metadata_general_seqid":"\u5e8f\u5217\u8b58\u5225\u78bc","metadata_general_seqid_link":"\u524d\u5f80\u672c\u5e8f\u5217\u7684 JSON \u8aaa\u660e","metadata_location":"\u5730\u9ede","metadata_location_latitude":"\u7def\u5ea6","metadata_location_longitude":"\u7d93\u5ea6","metadata_location_orientation":"\u62cd\u651d\u65b9\u5411","metadata_location_precision":"\u5b9a\u4f4d\u7cbe\u5ea6","minimize":"\u96b1\u85cf\u9019\u500b\u5c0f\u5de5\u5177\uff0c\u60a8\u53ef\u4ee5\u6309\u5de6\u4e0b\u89d2\u7684\u6309\u9215\u518d\u6b21\u986f\u793a\u5b83","moveDown":"\u4e0b\u79fb","moveLeft":"\u5de6\u79fb","moveMiddle":"\u756b\u9762\u7f6e\u4e2d","moveRight":"\u53f3\u79fb","moveUp":"\u4e0a\u79fb","options":"\u9078\u9805","picture_360":"360\xb0","picture_flat":"\u7d93\u5178","search":"\u641c\u5c0b","search_address":"\u641c\u5c0b\u5730\u5740\u3001\u57ce\u5e02\u2026","search_empty":"\u627e\u4e0d\u5230\u7d50\u679c","search_user":"\u641c\u5c0b\u5e33\u865f\u2026","sequence_more":"\u66f4\u591a\u64ad\u653e\u9078\u9805","sequence_next":"\u5e8f\u5217\u4e2d\u7684\u4e0b\u4e00\u5f35\u76f8\u7247","sequence_pause":"\u66ab\u505c\u5e8f\u5217","sequence_play":"\u64ad\u653e\u5e8f\u5217","sequence_prev":"\u5e8f\u5217\u4e2d\u7684\u4e0a\u4e00\u5f35\u76f8\u7247","sequence_speed":"\u64ad\u653e\u901f\u5ea6","share":"\u5206\u4eab","share_embed":"\u5d4c\u5165\u5230\u60a8\u7684\u7db2\u7ad9","share_image":"\u9ad8\u756b\u8cea\u76f8\u7247","share_links":"\u8d85\u9023\u7d50","share_page":"\u672c\u9801\u7684\u8d85\u9023\u7d50","share_print":"\u5217\u5370","share_rss":"RSS \u6458\u8981","share_rss_title":"\u5730\u5716\u53ef\u898b\u5340\u57df\u65b0\u76f8\u7247\u5e8f\u5217\u7684 RSS \u6458\u8981","show_map":"\u986f\u793a\u5730\u5716","show_psv":"\u986f\u793a\u76f8\u7247\u6aa2\u8996\u5668","zoom":"\u7e2e\u653e","zoomIn":"\u62c9\u8fd1","zoomOut":"\u62c9\u9060"},"map":{"loading":"\u6b63\u5728\u8f09\u5165\u2026","no_thumbnail":"\u6c92\u6709\u7e2e\u5716","not_public":"\u672a\u516c\u958b\u986f\u793a","thumbnail":"\u904a\u6a19\u61f8\u505c\u76f8\u7247\u7684\u7e2e\u5716"},"psv":{"ctrlZoom":"\u4f7f\u7528 CTRL + \u6ed1\u9f20\u6efe\u8f2a\u7e2e\u653e\u5716\u7247","loadError":"\u7121\u6cd5\u8f09\u5165\u5168\u666f\u5716","twoFingers":"\u4f7f\u7528\u96d9\u6307\u79fb\u52d5"}}')}},Rn={};function __webpack_require__(or){var So=Rn[or];if(void 0!==So)return So.exports;var To=Rn[or]={exports:{}};return C[or].call(To.exports,To,To.exports,__webpack_require__),To.exports}__webpack_require__.n=C=>{var Rn=C&&C.__esModule?()=>C.default:()=>C;return __webpack_require__.d(Rn,{a:Rn}),Rn},__webpack_require__.d=(C,Rn)=>{for(var or in Rn)__webpack_require__.o(Rn,or)&&!__webpack_require__.o(C,or)&&Object.defineProperty(C,or,{enumerable:!0,get:Rn[or]})},__webpack_require__.o=(C,Rn)=>Object.prototype.hasOwnProperty.call(C,Rn),__webpack_require__.r=C=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(C,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(C,"__esModule",{value:!0})};var or={};return(()=>{"use strict";__webpack_require__.r(or),__webpack_require__.d(or,{Editor:()=>So.Z,StandaloneMap:()=>Rn.Z,Viewer:()=>C.ZP,default:()=>C.ZP});var C=__webpack_require__(1707),Rn=__webpack_require__(9323),So=__webpack_require__(2244)})(),or})()));
|
|
25
25
|
//# sourceMappingURL=index.js.map
|