From 9ef0c32d171b6be5d0958173bef2bb3afe85bd85 Mon Sep 17 00:00:00 2001 From: ajmas Date: Mon, 8 Jan 2024 21:21:34 +0000 Subject: [PATCH] deploy: 21e477c6c9a3921e22ddd310222bcf52fac63d2e --- assets/index-PO5TO8ie.js | 19 + assets/index-gvP1ssBq.js | 19 - assets/vendor-AS6r1VG_.js | 2064 ------------------------------------- assets/vendor-tzzAqV-x.js | 2020 ++++++++++++++++++++++++++++++++++++ index.html | 4 +- 5 files changed, 2041 insertions(+), 2085 deletions(-) create mode 100644 assets/index-PO5TO8ie.js delete mode 100644 assets/index-gvP1ssBq.js delete mode 100644 assets/vendor-AS6r1VG_.js create mode 100644 assets/vendor-tzzAqV-x.js diff --git a/assets/index-PO5TO8ie.js b/assets/index-PO5TO8ie.js new file mode 100644 index 0000000..079ddd1 --- /dev/null +++ b/assets/index-PO5TO8ie.js @@ -0,0 +1,19 @@ +var re=Object.defineProperty;var oe=(a,e,t)=>e in a?re(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var o=(a,e,t)=>(oe(a,typeof e!="symbol"?e+"":e,t),t);import{T as W,S as D,M as z,a as E,U as ae,b as V,B as ne,A as le,G as $,C as B,D as he,P as ce,F as g,c as _,d as de,e as ue,O as fe,f as ge,L as pe,g as me,h as Se,i as j,j as we,k as ye,W as be,l as ve,R as xe,V as Le,m as De}from"./vendor-tzzAqV-x.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const n of r.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&s(n)}).observe(document,{childList:!0,subtree:!0});function t(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=t(i);fetch(i.href,r)}})();class Ee{constructor(){o(this,"baseUrl","");o(this,"basePath","/StuffInSpace/images");o(this,"radiusInKm",6371);o(this,"pxToRadius",3185.5);o(this,"addAtmosphere",!1);o(this,"addClouds",!0);o(this,"sphere");o(this,"group")}async loadTexture(e){const t=new W;return new Promise((s,i)=>{t.load(e,r=>s(r),void 0,r=>i(r))})}async initClouds(e,t){const s=await this.loadTexture(`${this.basePath}/Earth_Cloud.jpg`),i=e.km2pixels(this.radiusInKm+.02),r=new D(i,32,32),n=new z({map:s,opacity:.3,transparent:!0}),l=new E(r,n),h=1.01;l.scale.set(h,h,h),t.add(l)}initAtmosphere(e,t){const s=["varying vec3 vNormal;","varying vec3 vPosition;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","vPosition = gl_Position.xyz;","}"].join(` +`),i=["varying vec3 vNormal;","varying vec3 vPosition;","void main() {"," float intensity = pow( 0.8 + dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );"," intensity = min(intensity, 1.7);"," gl_FragColor = vec4( 0.37, 0.71, 0.93, 0.6 ) * intensity;","}"].join(` +`),r=ae.clone({}),n=new V({uniforms:r,vertexShader:s,fragmentShader:i,side:ne,blending:le,transparent:!0}),l=e.km2pixels(this.radiusInKm+.1),h=new D(l,32,32),c=new E(h,n),d=1.019;c.scale.set(d,d,d),t.add(c)}async init(e,t){t.config&&(this.baseUrl=t.config.baseUrl),this.group=new $;const s=`${this.baseUrl}images`,i=await this.loadTexture(`${s}/earth-blue-marble.jpg`),r=await this.loadTexture(`${s}/nightearth-4096.png`),n=await this.loadTexture(`${s}/8081_earthbump4k.jpg`),l=await this.loadTexture(`${s}/earth-water.png`),h=new z({map:i,bumpMap:n,emissiveMap:r,emissive:new B(8947848),emissiveIntensity:5,specularMap:l,specular:1,shininess:15,bumpScale:1}),c=e.km2pixels(this.radiusInKm),d=new D(c,32,32);this.sphere=new E(d,h),this.group.add(this.sphere),this.addClouds&&this.initClouds(e,this.group),this.addAtmosphere&&this.initAtmosphere(e,this.group),e.add(this.group),this.sphere.geometry.computeBoundingBox(),this.sphere.geometry.computeBoundingSphere()}update(){}getMesh(){return this.sphere}}const A=class A{constructor(){o(this,"fastTime",!1);o(this,"showGeometry",!1);o(this,"lightSouce");o(this,"lightSourceGeometery");o(this,"hour",0);o(this,"objectGroup");o(this,"scene");o(this,"visible",!0)}degreesToReadians(e){return e*A.deg2RadMult}calculateSunLoc(){let t=this.hour;(t===void 0||t===-1)&&(t=he.utc().hour);const s=t/24*360+180;return{x:25*Math.cos(this.degreesToReadians(s)),z:25*Math.sin(this.degreesToReadians(s))}}init(e){this.fastTime?setInterval(()=>{this.hour+=.05},100):this.hour=-1,this.calculateSunLoc();const t=this.calculateSunLoc(),s={x:t.x,y:0,z:t.z};if(this.scene=e,this.objectGroup=new $,this.lightSouce=new ce(16777215,2e3),this.lightSouce.position.set(s.x,s.y,s.z),this.objectGroup.add(this.lightSouce),this.showGeometry){const i=new D(.1,32,32);this.lightSourceGeometery=new E(i),this.lightSourceGeometery.position.set(s.x,s.y,s.z),this.objectGroup.add(this.lightSourceGeometery)}e.add(this.objectGroup)}update(){}setVisible(e){var t,s;e?this.visible||(t=this.scene)==null||t.add(this.objectGroup):this.visible&&((s=this.scene)==null||s.remove(this.objectGroup)),this.visible=e}};o(A,"deg2RadMult",Math.PI/180);let I=A;class Te{init(e,t){const s=t.config.baseUrl,i=new W().load(`${s}textures/example_render.jpg`);e.background=i}update(){}}function Ae(a){return new Worker("/StuffInSpace/assets/SatCruncherWorker-BkJiidUT.js",{name:a==null?void 0:a.name})}const Ge="debug",v=["error","warn","info","debug"];let y={},x=new Proxy({logLevel:Ge,enabledOutputs:{},error:y.error,warn:y.warn,info:y.info,debug:y.debug,setLogLevel:J},{});function L(a,e,t,...s){a.enabledOutputs[e]&&t(e.toUpperCase(),...s)}function J(a){const e=v.indexOf(a.toLowerCase());if(e<0)throw new Error("Unknown log level");for(let t=0;t{let t=[1,1,0,1],s=!1;return e&&(s=!0,e.OBJECT_TYPE==="PAYLOAD"?t=[1,.2,0,1]:e.OBJECT_TYPE==="ROCKET BODY"?t=[.2,.5,1,.85]:e.OBJECT_TYPE==="DEBRIS"&&(t=[.5,.5,.5,.85])),{color:t,pickable:s}})}}class Ie extends Z{constructor(){super("Group color scheme",(e,t)=>e&&t&&t.hasSat(e.id)?{color:[1,.2,0,1],pickable:!0}:{color:[1,1,1,.2],pickable:!0})}}class Me{constructor(){o(this,"baseUrl","");o(this,"worker");o(this,"currentColorScheme",new U);o(this,"numSats",1);o(this,"maxSize",0);o(this,"satPos",new Float32Array);o(this,"satVel",new Float32Array);o(this,"satAlt",new Float32Array);o(this,"satelliteColors",[]);o(this,"cruncherReady",!1);o(this,"scene");o(this,"particles");o(this,"geometry");o(this,"satelliteStore");o(this,"shaderStore");o(this,"selectedSatelliteIndexes",[]);o(this,"satelliteGroup");o(this,"hoverSatelliteIdx",-1)}setColorScheme(e){this.currentColorScheme=e}debugRaycastSelection(){if(this.satelliteStore&&(this.satelliteColors.length===0&&this.satelliteStore.satData.length>0&&(this.satelliteColors=new Array(this.satelliteStore.satData.length*4),this.satelliteColors.fill(1,0,this.satelliteColors.length),this.geometry&&this.geometry.setAttribute("color",new g(this.satelliteColors,4))),this.selectedSatelliteIndexes.length>0&&this.geometry)){for(let e=0;e0&&(e=this.geometry)!=null&&e.attributes){const t=this.satelliteStore.satData,s=t.length;this.updateSatellitesGeometry(),this.updateSatellitesMaterial(s,t)}this.debugRaycastSelection()}}updateSatellitesMaterial(e,t){var s,i,r;if((s=this.geometry)!=null&&s.attributes.color&&this.currentColorScheme&&this.satelliteStore){(this.satelliteColors.length===0||e*4!==this.satelliteColors.length)&&(this.satelliteColors=new Array(this.satelliteStore.satData.length*4),this.satelliteColors.fill(1,0,this.satelliteColors.length));for(let n=0;n{var c;(c=this.worker)==null||c.postMessage(JSON.stringify({state:{running:document.visibilityState==="visible"}}))})}getObject3D(){return this.particles}initSatWorker(e={}){f.info("Kicking off sat-cruncher-worker"),this.worker=new Ae,this.worker.onmessage=this.onMessage.bind(this),this.worker.postMessage(JSON.stringify({config:e}))}async init(e,t){this.satelliteStore=t.satelliteStore,this.shaderStore=t.shaderStore,this.scene=e;const s=t.config||{};let i={};s.satWorker&&(i={...s.satWorker,logLevel:s.logLevel}),this.initSatWorker(i),t!=null&&t.config&&(this.baseUrl=t.config.baseUrl),this.satelliteStore&&(this.satelliteStore.addEventListener("satdataloaded",this.onSatDataLoaded.bind(this)),await this.satelliteStore.loadSatelliteData(),this.initGeometry(),this.satelliteStore.gotExtraData&&this.updateSatellites())}update(){}}function ke(a){return new Worker("/StuffInSpace/assets/OrbitCalculationWorker-_Yyn1p1l.js",{name:a==null?void 0:a.name})}class Pe{constructor(){o(this,"config",{});o(this,"segmentCount",255);o(this,"orbitWorker");o(this,"selectedSatellites",[]);o(this,"hoverSatelliteIdx",-1);o(this,"satelliteGroups");o(this,"satelliteGroup");o(this,"inProgress",[]);o(this,"scene");o(this,"selectColor",[0,1,0,1]);o(this,"hoverColor",[1,.92,.23,1]);o(this,"groupColor",[.3,.5,1,.4]);o(this,"orbitTracks",[]);o(this,"satelliteStore");o(this,"satelliteOrbitGroup")}calculateOrbits(e){e=e.filter(t=>!this.inProgress[t]),this.orbitWorker?this.orbitWorker.postMessage(JSON.stringify({isInit:!1,satId:e})):f.error("Orbit worker is undefined"),e.forEach(t=>this.inProgress[t]=!0)}onSatellitesLoaded(){this.satelliteStore&&(this.inProgress=new Array(this.satelliteStore.size()),this.orbitTracks=new Array(this.satelliteStore.size()),this.orbitWorker&&this.orbitWorker.postMessage(JSON.stringify({isInit:!0,satData:this.satelliteStore.satData,numSegs:this.segmentCount})))}isTrackVisible(e){return this.selectedSatellites.indexOf(e)>-1||e===this.hoverSatelliteIdx||this.satelliteGroup&&this.satelliteGroup.hasSat(e)}getTrackColor(e){let t=[1,1,0];return e===this.hoverSatelliteIdx?t=this.hoverColor:this.selectedSatellites.indexOf(e)>-1?t=this.selectColor:this.satelliteGroup&&this.satelliteGroup.hasSat(e)&&(t=this.groupColor),new B(t[0],t[1],t[2])}addOrbitTrack(e,t){const s=this.getTrackColor(e),i=new pe({color:s,linewidth:10}),r=new _;r.setAttribute("position",new g(t,3));const n=new me(r,i);n.name=`${e}`,this.satelliteOrbitGroup&&this.satelliteOrbitGroup.add(n),this.orbitTracks[e]=n}updateOrbitTrack(e,t){const s=this.orbitTracks[e];if(s){const i=s.material;i.color=this.getTrackColor(e),i.needsUpdate=!0,t&&(s.geometry.setAttribute("position",new g(t,3)),s.geometry.computeBoundingBox(),s.geometry.computeBoundingSphere())}}removeOrbitTrack(e){var t;if(this.orbitTracks[e]){const s=this.orbitTracks[e];(t=this.satelliteOrbitGroup)==null||t.remove(s),s.geometry&&s.geometry.dispose(),this.orbitTracks[e]=void 0}}onMessage(e){const{satId:t}=e.data;this.scene&&(this.orbitTracks[t]?this.updateOrbitTrack(t,e.data.pointsOut):this.isTrackVisible(t)&&this.addOrbitTrack(t,e.data.pointsOut)),this.inProgress[t]=!1}isHoverSatellite(e){return this.hoverSatelliteIdx!==void 0&&e!==-1&&this.hoverSatelliteIdx===e}isSelectedSatellite(e){return this.selectedSatellites.length>0?this.selectedSatellites.indexOf(e)>-1:!1}refreshOrbits(){if(this.satelliteGroup){const e=this.satelliteGroup.sats;for(let t=0;t0)for(let t=0;t-1&&(t=this.selectedSatellites.indexOf(this.hoverSatelliteIdx)<0,t=t&&(!this.satelliteGroup||!this.satelliteGroup.hasSat(this.hoverSatelliteIdx))),this.hoverSatelliteIdx=e,t?this.removeOrbitTrack(s):this.updateOrbitTrack(s),this.calculateOrbits([e]),this.refreshOrbits()}setSatelliteGroup(e){if(this.satelliteGroup){this.setSelectedSatellites([]),this.setHoverSatellite(-1);for(let t=0;ti.satId);this.calculateOrbits(s)}}init(e,t){this.config=t.config,this.scene=e,this.orbitWorker=new ke,this.orbitWorker.onmessage=this.onMessage.bind(this),this.satelliteStore=t.satelliteStore,this.orbitWorker.postMessage(JSON.stringify({config:{logLevel:this.config.logLevel}})),this.satelliteStore&&(this.satelliteStore.addEventListener("satdataloaded",this.onSatellitesLoaded.bind(this)),this.satelliteStore.size()>0&&(this.inProgress=new Array(this.satelliteStore.size()),this.onSatellitesLoaded())),t.satelliteGroups&&(this.satelliteGroups=t.satelliteGroups),this.satelliteOrbitGroup=new $,this.scene.add(this.satelliteOrbitGroup)}update(){}}const G=class G extends Se{constructor(){super();o(this,"pxToRadius",3185.5)}setPixels2Radius(t){this.pxToRadius=t}getPixels2Radius(){return this.pxToRadius}km2pixels(t){return t/this.pxToRadius}alitudeToPixels(t){return(G.earthRadiusInKm+t)/this.pxToRadius}};o(G,"earthRadiusInKm",6371);let M=G;class Y{constructor(e,t,s,i,r){o(this,"sats",[]);o(this,"id");o(this,"name");o(this,"groupType");o(this,"data");o(this,"satelliteStore");if(this.id=e,this.name=t,this.groupType=s,this.data=i,this.satelliteStore=r,!this.satelliteStore)throw new Error("satelliteStore is required")}reload(){switch(this.sats=[],this.groupType){case"intlDes":this.searchIntlDes();break;case"nameRegex":this.searchNameRegex();break;case"idList":this.searchIdList();break;case"objectType":this.searchObjectType();break;default:throw new Error("Invalid groupType")}}searchObjectType(){if(typeof this.data!="string")throw new Error("objectType must be a string");const t=this.satelliteStore.search({["OBJECT_TYPE"]:this.data});for(const s of t)this.sats.push({satId:s.id,isIntlDes:!1,strIndex:0})}searchIdList(){if(typeof this.data=="string")throw new Error("idList must be an array");for(const e of this.data)this.sats.push({satId:e,isIntlDes:!1,strIndex:0})}searchNameRegex(){if(typeof this.data!="string")throw new Error("nameRegex must be a string");const e=new RegExp(this.data),t=this.satelliteStore.searchNameRegex(e);for(const s of t)this.sats.push({satId:s,isIntlDes:!1,strIndex:0})}searchIntlDes(){if(typeof this.data=="string")throw new Error("intlDes must be an array");for(const e of this.data)this.sats.push({satId:this.satelliteStore.getIdFromIntlDes(e),isIntlDes:!0,strIndex:0})}getSat(e){return this.satelliteStore.satData.find(t=>t.id===e)}hasSat(e){for(const t of this.sats)if(t.satId===e)return!0;return!1}}class Re{constructor(e,t){o(this,"groups",{});o(this,"selectedGroup");o(this,"sats",[]);o(this,"satelliteStore");if(!t)throw new Error("satelliteStore is required");this.satelliteStore=t,this.resetConfig(e),this.satelliteStore.addEventListener("satdataloaded",this.onSatDataLoaded.bind(this))}asArray(){return Object.values(this.groups)}selectGroup(e){if(this.selectedGroup=e,!e){this.clearSelect();return}}forEach(e){for(let t=0;t{i(t)})}}const We={baseUrl:"/StuffInSpace/"};class $e{constructor(e={}){o(this,"tleUrl",`${We.baseUrl}/data/attributed-TLE.json`);o(this,"eventManager");o(this,"satData",[]);o(this,"attribution");o(this,"updateDate");o(this,"satelliteVelocities",new Float32Array);o(this,"satellitePositions",new Float32Array);o(this,"satelliteAltitudes",new Float32Array);o(this,"gotExtraData",!1);o(this,"gotPositionalData",!1);o(this,"loaded",!1);this.eventManager=new K,e.tleUrl&&(this.tleUrl=e.tleUrl)}async loadSatelliteData(){try{const e=await j.get(this.tleUrl,{params:{t:Date.now()}});if(e.data){Array.isArray(e.data)?this.satData=e.data:(this.satData=e.data.data,this.attribution=e.data.source,this.updateDate=e.data.date);for(let t=0;t50?"19":"20")+s.toString(),n=this.satData[t].INTLDES.substring(2);this.satData[t].intlDes=`${r}-${n}`}else this.satData[t].intlDes="unknown";this.satData[t].id=t}}this.eventManager.fireEvent("satdataloaded",this.satData),this.loaded=!0}catch(e){f.error("error loading TLE data",e)}}getAttribution(){return this.attribution}getUpdatedDate(){return this.updateDate}setSatelliteData(e,t=!1){this.satData=e,this.gotExtraData=t,t&&this.eventManager.fireEvent("satextradataloaded",this.satData)}setPositionalData(e,t,s){this.satelliteVelocities=e,this.satellitePositions=t,this.satelliteAltitudes=s,this.gotPositionalData=!0}getSatellitePosition(e){const t=e*3;if(this.satellitePositions&&tr[i]===e[i]);return s}searchName(e){const t=[];for(let s=0;s0){r.sort((h,c)=>h.object.type==="Line"&&c.object.type==="Points"?1:h.object.type==="Points"&&c.object.type==="Line"?-1:0);let l=r.map(h=>h.object.type==="Points"?h.index:h.object.type==="Line"?parseInt(h.object.name):-1).filter(h=>h!==-1);if(l.length>0){const h=[];for(const c of l)this.isValidTarget(c)&&h.push(c);l=h}return l}return[]}isValidTarget(e){var s;const t=(s=this.satellites)==null?void 0:s.getSatellitegroup();return t?t.hasSat(e):!0}onClick(e){var n,l,h,c;const t=(n=this.renderer)==null?void 0:n.domElement;if(!this.raycaster||!this.scene||!this.camera||!t)return;const s=this.findSatellitesAtMouse({x:e.clientX,y:e.clientY});let i=-1,r;s&&s.length>0&&(i=s[0],r=(l=this.satelliteStore)==null?void 0:l.getSatellite(i)),this.selectedSatelliteIdx=i,(h=this.satellites)==null||h.setSelectedSatellite(i),(c=this.orbits)==null||c.setSelectedSatellite(i),this.eventManager.fireEvent("selectedSatChange",r)}onMouseMove(){this.mouseMoved=!0}onMouseDown(){this.mouseMoved=!1,this.controls&&(this.controls.autoRotate=!1),window.addEventListener("mousemove",this.onMouseMove.bind(this))}onMouseUp(e){this.mouseMoved||this.onClick(e),this.mouseMoved=!1,window.removeEventListener("mousemove",this.onMouseMove.bind(this))}onHover(e){var n,l,h,c;const t=(n=this.renderer)==null?void 0:n.domElement;if(!this.raycaster||!this.scene||!this.camera||!t)return;const s=this.findSatellitesAtMouse({x:e.clientX,y:e.clientY});let i=-1,r;s&&s.length>0&&(i=s[0],r=(l=this.satelliteStore)==null?void 0:l.getSatellite(i)),(h=this.satellites)==null||h.setHoverSatellite(i),(c=this.orbits)==null||c.setHoverSatellite(i),this.eventManager.fireEvent("sathoverChange",r),this.mouseMoved=!0}async init(){var e;try{this.scene=new M,this.camera=new ye(45,window.innerWidth/window.innerHeight,.1,1e3),this.camera.position.z=15,this.camera.zoom=1,this.renderer=new be({antialias:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),(e=document.querySelector(this.config.canvasSelector))==null||e.appendChild(this.renderer.domElement),f.debug(`Using WebGL 2: ${this.renderer.capabilities.isWebGL2}`),this.controls=new ve(this.camera,this.renderer.domElement),this.controls.rotateSpeed=.33,this.controls.enablePan=!1,this.controls.enableZoom=!0,this.controls.enableDamping=!0,this.controls.dampingFactor=.05,this.controls.zoomSpeed=3,this.controls.maxZoom=10,this.controls.minZoom=3,this.controls.autoRotate=!0,this.controls.autoRotateSpeed=.5,this.controls.maxDistance=50,this.controls.minDistance=3,this.controls.update(),this.raycaster=new xe,this.satelliteStore=new $e(this.config),this.satelliteGroups=new Re(this.config.satelliteGroups,this.satelliteStore),this.shaderStore=new Be(this.config.baseUrl),f.debug("loading shaders"),await this.shaderStore.load(),this.context.satelliteGroups=this.satelliteGroups,this.context.config=this.config,this.context.satelliteStore=this.satelliteStore,this.context.shaderStore=this.shaderStore,this.satelliteStore.addEventListener("satdataloaded",this.onSatDataLoaded.bind(this)),this.earth=new Ee,await this.registerSceneComponent("earth",this.earth),await this.registerSceneComponent("sun",new I),await this.registerSceneComponent("universe",new Te),this.satellites=new Me,await this.registerSceneComponent("satellites",this.satellites),this.orbits=new Pe,await this.registerSceneComponent("orbits",this.orbits);const t=this.getCenterPoint(this.earth.getMesh());t&&(this.controls.target=t),this.camera.updateProjectionMatrix(),window.addEventListener("resize",this.onWindowResize.bind(this));const s=this.renderer.domElement;s.addEventListener("mousedown",this.onMouseDown.bind(this)),s.addEventListener("mouseup",this.onMouseUp.bind(this)),s.addEventListener("mousemove",this.onHover.bind(this))}catch(t){f.error("Error while initialising scene",t)}}animate(){requestAnimationFrame(this.animate.bind(this));for(const e of this.sceneComponents)e.update(this.scene);this.controls&&this.controls.update(),this.renderer&&this.renderer.render(this.scene,this.camera)}getSatelliteStore(){return this.satelliteStore}getSatelliteGroups(){return this.satelliteGroups}zoomToSatellite(e){var t;(t=this.satelliteStore)==null||t.getSatellitePosition(e)}clampZoom(){this.camera&&(this.targetZoom>this.camera.zoom*5?this.targetZoom=this.camera.zoom*5:this.targetZoom{this.close()})}moveTo(e,t){this.element&&(this.element.style.top=`${t}px`,this.element.style.left=`${e}px`)}getLocation(){if(!this.element)return{x:0,y:0};const e=this.element.style;return e.x?{x:e.x,y:e.y}:{x:this.element.offsetLeft,y:this.element.offsetTop}}addEventListener(e,t){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e])this.listeners[e].add(t);else throw new Error("unknown event")}fireEvent(e,t){this.listeners[e]&&this.listeners[e].forEach(i=>{i(t)})}}const qe=100;class He{constructor(){o(this,"windows",[]);o(this,"windowsById",{});o(this,"initialOpen",!1)}bringWindowToFront(e){const t=e.element;let s=-1;for(let i=0;i-1&&(this.windows.splice(s,1),this.windows.push(e));for(let i=0;i=0;e--)if(this.windows[e].isOpen())return this.windows[e]}openWindow(e){const s={x:100,y:100},i=this.windowsById[e],r=this.getTopWindow();let n=!1;if(i){let{x:l,y:h}=i.getLocation();if(r||(l=s.x,h=s.y,this.initialOpen=!1),n=i.firstOpen,n&&r){const c=r.getLocation();c&&(c.x>window.innerWidth/2?l=c.x-42-300:l=c.x+42,c.y>window.innerHeight/2?h=c.y-42-300:h=c.y+42)}if(i.open(),!this.initialOpen&&!n){const c=i.getLocation();c&&(l=c.x,h=c.y)}(l>window.innerWidth||l<0)&&(l=s.x),(h>window.innerHeight||h<0)&&(h=s.y),this.bringWindowToFront(i),i.moveTo(l,h),this.initialOpen=!1}}closeWindow(e){const t=this.windowsById[e];t&&t.close()}makeDraggable(e){let t=0,s=0,i=0,r=0;const n=e.element;if(!n)return;const l=n.querySelector(".drag-zone")||n;function h(c){const d=`${t-(r-c.clientY)}px`,b=`${s-(i-c.clientX)}px`;n&&n.style&&(n.style.top=d,n.style.left=b)}n.classList.add("draggable"),n.addEventListener("click",()=>{this.bringWindowToFront(e)}),l.addEventListener("mousedown",c=>{c.preventDefault(),s=n.offsetLeft,t=n.offsetTop,i=c.clientX,r=c.clientY,this.bringWindowToFront(e),n.style.right="unset",n.style.bottom="unset",n.style.left=`${s}px`,n.style.top=`${t}px`,n.classList.add("dragging"),l.addEventListener("mousemove",h)}),n.addEventListener("mouseup",c=>{c.preventDefault(),l.removeEventListener("mousemove",h),n.classList.remove("dragging")}),n.addEventListener("mouseout",c=>{c.preventDefault(),l.removeEventListener("mousemove",h),n.classList.remove("dragging")})}}const F=200;let m,k,X=!1,P=-1,C=!1,Q;function ee(){return C}function Ve(){return Q}function _e(){return C?document.querySelector("#search").value:null}function Je(){return X}function Ze(){return P}function Ye(){X=!1,P=-1,m.setHoverSatellite(P)}function O(a){const e=document.querySelector("#search-results");e&&(a?e.style.display="block":e.style.display="none",C=a)}function Ke(){O(!ee())}function Xe(){O(!0)}function te(){O(!1);const a=m.getSatelliteGroups();a&&a.clearSelect()}function se(a,e){const t=document.querySelector("#search-results"),s=m.getSatelliteStore();if(!s)return;let i="";for(const r of a){if(r.satId===void 0)continue;const n=s.getSatellite(r.satId);if(!n){f.warn("satellite not found",r.satId);continue}i+=`
`,r.type!=="name"?i+=n.OBJECT_NAME:i+=` + ${n.OBJECT_NAME.substring(0,r.strIndex)} + + ${n.OBJECT_NAME.substring(r.strIndex,r.strIndex+e.length)} + + ${n.OBJECT_NAME.substring(r.strIndex+e.length)}`,i+='
',r.type==="intlDes"?i+=` + ${n.intlDes.substring(0,r.strIndex)} + + ${n.intlDes.substring(r.strIndex,r.strIndex+e.length)} + + ${n.intlDes.substring(r.strIndex+e.length)}`:r.type==="noradId"?i+=` + ${n.NORAD_CAT_ID.substring(0,r.strIndex)} + + ${n.NORAD_CAT_ID.substring(r.strIndex,r.strIndex+e.length)} + + ${n.NORAD_CAT_ID.substring(r.strIndex+e.length)}`:i+=n.intlDes,i+="
"}t.innerHTML=i,t.style.display="block",C=!0}function Qe(){const a=document.querySelector("#search-results");a&&(a.innerHTML="")}function R(a){var l,h,c;const e=m.getSatelliteStore();if(!e)return;const t=e.getSatData();if(m.setSelectedSatellite(-1),a.length===0){te();return}a=a.toUpperCase();const s=[];for(let d=0;dF&&(s.length=F);const i=[];for(const d of s)i.push(d.satId);const r=new Y("search-results","Search Results","idList",i,e);r.reload(),Q=r;const n=m.getSatelliteGroups();n&&(n.selectGroup(r),m.setSelectedSatelliteGroup(r)),se(s,a)}function et(){var e,t;const a=document.querySelector("#search-results");a&&(a.addEventListener("click",s=>{let i=s.target;if(i.className!=="search-result"&&(i=i.closest(".search-result")),!i)return;const r=i==null?void 0:i.dataset.satId;Ye(),m.setSelectedSatellite(parseInt(r))}),(e=document.querySelector("#search"))==null||e.addEventListener("input",()=>{var i;const s=(i=document.querySelector("#search"))==null?void 0:i.value;R(s)}),(t=document.querySelector("#all-objects-link"))==null||t.addEventListener("click",()=>{const s=m.getSelectedSatellite();if(s){const r=s.intlDes.slice(0,8);R(r),document.querySelector("#search").value=r,k&&k.openWindow("search-window")}}))}function tt(a,e){m=a,k=e,et()}const w={init:tt,clearResults:Qe,getHoverSat:Ze,isHovering:Je,showResults:Xe,hideResults:te,doSearch:R,getCurrentSearch:_e,getLastResultGroup:Ve,fillResultBox:se,isResultBoxOpen:ee,setResultsVisible:O,toggleResultsVisible:Ke},st=[],S=new He,it=[];let q=!1,u;function rt(a){var t;let e=document.querySelector(".attribution");if(e||(e=document.createElement("div"),e.className="attribution",(t=document.querySelector("body"))==null||t.appendChild(e)),e)if(a){const s=u.getSatelliteStore();if(s&&s.getAttribution()){const i=s.getAttribution()||{},r=s.getUpdatedDate();e.innerHTML=`Orbital object data from ${i.name} (updated ${r})`}e.classList.remove("hidden")}else e.classList.add("hidden")}function ie(a){var e,t;a?(e=document.querySelector("body"))==null||e.classList.add("loading"):(t=document.querySelector("body"))==null||t.classList.remove("loading")}function ot(){const a=document.querySelector("#groups-display"),e=u.getSatelliteGroups();let t=[];e&&(t=e.asArray().sort((i,r)=>i.name.localeCompare(r.name)));let s="";for(let i=0;i${t[i].name} +`;a.innerHTML=s}function p(a,e){const t=document.querySelector(a);t&&(t.innerHTML=e)}function at(a){var e,t,s,i,r;a?((e=document.querySelector("#sat-infobox"))==null||e.classList.add("visible"),p("#sat-info-title",a.OBJECT_NAME),p("#sat-intl-des",a.intlDes),p("#sat-type",a.OBJECT_TYPE),p("#sat-apogee",`${(t=a.apogee)==null?void 0:t.toFixed(0)} km`),p("#sat-perigee",`${(s=a.perigee)==null?void 0:s.toFixed(0)} km`),p("#sat-inclination",`${(a.inclination*Ne).toFixed(2)}°`),p("#sat-period",`${(i=a.period)==null?void 0:i.toFixed(2)} min`)):(r=document.querySelector("#sat-infobox"))==null||r.classList.remove("visible")}function nt(a){const{satId:e,satX:t,satY:s,satellite:i}=a||{};if(!e||e===-1){p("#sat-hoverbox","(none)");let r=document.querySelector("#sat-hoverbox");r&&(r.style.display="none"),r=document.querySelector("#canvas"),r&&(r.style.cursor="default")}else{const r=document.querySelector("#sat-hoverbox");r&&(r.innerHTML=i.OBJECT_NAME,r.style.display="block",r.style.position="absolute",r.style.left=`${t+20}px`,r.style.top=`${s-10}px`);const n=document.querySelector("#canvas");n&&(n.style.cursor="pointer")}}function lt(){var e;(e=document.querySelector("#groups-display"))==null||e.addEventListener("mouseout",()=>{if(!q){const t=u.getSatelliteGroups();t&&(w.isResultBoxOpen()?t.selectGroup(w.getLastResultGroup()):t.clearSelect())}});const a=document.querySelectorAll("#groups-display>li");for(let t=0;t{const n=i.currentTarget.dataset.group,l=u.getSatelliteGroups();l&&l.selectGroup(l.getGroupById(n))}),s.addEventListener("mouseout",()=>{const i=u.getSatelliteGroups();if(i){const r=document.querySelector("#groups-display>li.selected");r?i.selectGroup(i.getGroupById(r.dataset.group)):i.selectGroup(void 0)}}),s.addEventListener("click",i=>{i.preventDefault();const r=i.currentTarget;q=!0;const n=document.querySelector("#groups-display>li.selected");let l;n&&(l=n.dataset.group);for(let b=0;b{s.preventDefault(),u.zoomIn()}),(t=document.querySelector("#zoom-out"))==null||t.addEventListener("click",s=>{s.preventDefault(),u.zoomOut()}),window.addEventListener("resize",()=>{it.forEach(s=>{window.visualViewport&&(s.offsetLeft+s.offsetWidth>window.visualViewport.width&&(s.style.right="unset",s.style.left=`${window.visualViewport.width-s.offsetWidth}px`),s.offsetTop+s.offsetHeight>window.visualViewport.height&&(s.style.bottom="unset",s.style.offsetTop=`${window.visualViewport.height-s.offsetHeight}px`))})}),ie(!1)}function ct(a){a.satId&&(p("#sat-altitude",`${a.altitude.toFixed(2)} km`),p("#sat-velocity",`${a.velocity.toFixed(2)} km/s`))}function H(){ht(),ot(),setTimeout(()=>lt(),0);const a=document.querySelector("#load-cover");a&&a.classList.add("hidden"),rt(!0)}function dt(){return st}function ut(){const a=document.querySelectorAll(".menu-item");for(let e=0;e{const s=t.dataset.action;if(s&&s.startsWith("open:")){const i=s.split(":");S.openWindow(i[1])}})}}function ft(){return w.getCurrentSearch()}function gt(a){var e;u=a,S.registerWindow("sat-infobox"),S.registerWindow("about-window"),S.registerWindow("help-window"),S.registerWindow("groups-window"),S.registerWindow("search-window"),(e=S.getWindow("search-window"))==null||e.addEventListener("close",()=>{var s;(s=u.getSatelliteGroups())==null||s.clearSelect(),u.setSelectedSatelliteGroup();const t=document.querySelectorAll("#groups-display>li");for(const i of t)i.classList.remove("selected")}),w.init(u,S),ut(),u.addEventListener(T.satMovementChange,ct),u.ready?H():u.addEventListener(T.satDataLoaded,H)}const pt={setLoading:ie,init:gt,getSupportedEvents:dt,getCurrentSearch:ft};async function mt(){const e=await j.get("./config.json");let t=N;return e.data&&(t={...N,...e.data}),f.info(`.... ${t.baseUrl}`),t}async function St(){const a=await mt();J(a.logLevel);const e=ze(a);await e.init(),e.animate(),pt.init(e)}document.addEventListener("DOMContentLoaded",()=>{St().catch(a=>console.error(a))}); diff --git a/assets/index-gvP1ssBq.js b/assets/index-gvP1ssBq.js deleted file mode 100644 index 120ee6a..0000000 --- a/assets/index-gvP1ssBq.js +++ /dev/null @@ -1,19 +0,0 @@ -var re=Object.defineProperty;var oe=(r,e,t)=>e in r?re(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e,t)=>(oe(r,typeof e!="symbol"?e+"":e,t),t);import{T as w,S as E,M as z,a as A,U as ae,b as V,B as ne,A as le,G as $,C as B,D as he,P as ce,F as g,c as _,d as de,e as ue,O as fe,f as ge,L as pe,g as me,h as Se,i as j,j as we,k as ye,W as be,l as ve,R as xe,V as Le,m as De}from"./vendor-AS6r1VG_.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const n of o.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&s(n)}).observe(document,{childList:!0,subtree:!0});function t(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=t(i);fetch(i.href,o)}})();class Ee{constructor(){a(this,"baseUrl","");a(this,"basePath","/StuffInSpace/images");a(this,"radiusInKm",6371);a(this,"pxToRadius",3185.5);a(this,"addAtmosphere",!1);a(this,"addClouds",!0);a(this,"sphere");a(this,"group")}initClouds(e,t){const s=new w().load(`${this.basePath}/Earth_Cloud.jpg`),i=e.km2pixels(this.radiusInKm+.02),o=new E(i,32,32),n=new z({map:s,opacity:.3,transparent:!0}),l=new A(o,n),h=1.01;l.scale.set(h,h,h),t.add(l)}initAtmosphere(e,t){const s=["varying vec3 vNormal;","varying vec3 vPosition;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","vPosition = gl_Position.xyz;","}"].join(` -`),i=["varying vec3 vNormal;","varying vec3 vPosition;","void main() {"," float intensity = pow( 0.8 + dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );"," intensity = min(intensity, 1.7);"," gl_FragColor = vec4( 0.37, 0.71, 0.93, 0.6 ) * intensity;","}"].join(` -`),o=ae.clone({}),n=new V({uniforms:o,vertexShader:s,fragmentShader:i,side:ne,blending:le,transparent:!0}),l=e.km2pixels(this.radiusInKm+.1),h=new E(l,32,32),c=new A(h,n),d=1.019;c.scale.set(d,d,d),t.add(c)}init(e,t){t.config&&(this.baseUrl=t.config.baseUrl),this.group=new $;const s=`${this.baseUrl}images`,i=new w().load(`${s}/earth-blue-marble.jpg`),o=new w().load(`${s}/nightearth-4096.png`),n=new w().load(`${s}/8081_earthbump4k.jpg`),l=new w().load(`${s}/earth-water.png`),h=new z({map:i,bumpMap:n,emissiveMap:o,emissive:new B(8947848),emissiveIntensity:5,specularMap:l,specular:1,shininess:15,bumpScale:1}),c=e.km2pixels(this.radiusInKm),d=new E(c,32,32);this.sphere=new A(d,h),this.group.add(this.sphere),this.addClouds&&this.initClouds(e,this.group),this.addAtmosphere&&this.initAtmosphere(e,this.group),e.add(this.group),this.sphere.geometry.computeBoundingBox(),this.sphere.geometry.computeBoundingSphere()}update(){}getMesh(){return this.sphere}}const T=class T{constructor(){a(this,"fastTime",!1);a(this,"showGeometry",!1);a(this,"lightSouce");a(this,"lightSourceGeometery");a(this,"hour",0);a(this,"objectGroup");a(this,"scene");a(this,"visible",!0)}degreesToReadians(e){return e*T.deg2RadMult}calculateSunLoc(){let t=this.hour;(t===void 0||t===-1)&&(t=he.utc().hour);const s=t/24*360+180;return{x:25*Math.cos(this.degreesToReadians(s)),z:25*Math.sin(this.degreesToReadians(s))}}init(e){this.fastTime?setInterval(()=>{this.hour+=.05},100):this.hour=-1,this.calculateSunLoc();const t=this.calculateSunLoc(),s={x:t.x,y:0,z:t.z};if(this.scene=e,this.objectGroup=new $,this.lightSouce=new ce(16777215,2e3),this.lightSouce.position.set(s.x,s.y,s.z),this.objectGroup.add(this.lightSouce),this.showGeometry){const i=new E(.1,32,32);this.lightSourceGeometery=new A(i),this.lightSourceGeometery.position.set(s.x,s.y,s.z),this.objectGroup.add(this.lightSourceGeometery)}e.add(this.objectGroup)}update(){}setVisible(e){var t,s;e?this.visible||(t=this.scene)==null||t.add(this.objectGroup):this.visible&&((s=this.scene)==null||s.remove(this.objectGroup)),this.visible=e}};a(T,"deg2RadMult",Math.PI/180);let M=T;class Ae{init(e,t){const s=t.config.baseUrl,i=new w().load(`${s}textures/example_render.jpg`);e.background=i}update(){}}function Ge(r){return new Worker("/StuffInSpace/assets/SatCruncherWorker-BkJiidUT.js",{name:r==null?void 0:r.name})}const Te="debug",x=["error","warn","info","debug"];let b={},L=new Proxy({logLevel:Te,enabledOutputs:{},error:b.error,warn:b.warn,info:b.info,debug:b.debug,setLogLevel:J},{});function D(r,e,t,...s){r.enabledOutputs[e]&&t(e.toUpperCase(),...s)}function J(r){const e=x.indexOf(r.toLowerCase());if(e<0)throw new Error("Unknown log level");for(let t=0;t{let t=[1,1,0,1],s=!1;return e&&(s=!0,e.OBJECT_TYPE==="PAYLOAD"?t=[1,.2,0,1]:e.OBJECT_TYPE==="ROCKET BODY"?t=[.2,.5,1,.85]:e.OBJECT_TYPE==="DEBRIS"&&(t=[.5,.5,.5,.85])),{color:t,pickable:s}})}}class Ie extends Z{constructor(){super("Group color scheme",(e,t)=>e&&t&&t.hasSat(e.id)?{color:[1,.2,0,1],pickable:!0}:{color:[1,1,1,.2],pickable:!0})}}class Me{constructor(){a(this,"baseUrl","");a(this,"worker");a(this,"currentColorScheme",new U);a(this,"numSats",1);a(this,"maxSize",0);a(this,"satPos",new Float32Array);a(this,"satVel",new Float32Array);a(this,"satAlt",new Float32Array);a(this,"satelliteColors",[]);a(this,"cruncherReady",!1);a(this,"scene");a(this,"particles");a(this,"geometry");a(this,"satelliteStore");a(this,"shaderStore");a(this,"selectedSatelliteIndexes",[]);a(this,"satelliteGroup");a(this,"hoverSatelliteIdx",-1)}setColorScheme(e){this.currentColorScheme=e}debugRaycastSelection(){if(this.satelliteStore&&(this.satelliteColors.length===0&&this.satelliteStore.satData.length>0&&(this.satelliteColors=new Array(this.satelliteStore.satData.length*4),this.satelliteColors.fill(1,0,this.satelliteColors.length),this.geometry&&this.geometry.setAttribute("color",new g(this.satelliteColors,4))),this.selectedSatelliteIndexes.length>0&&this.geometry)){for(let e=0;e0&&(e=this.geometry)!=null&&e.attributes){const t=this.satelliteStore.satData,s=t.length;this.updateSatellitesGeometry(),this.updateSatellitesMaterial(s,t)}this.debugRaycastSelection()}}updateSatellitesMaterial(e,t){var s,i,o;if((s=this.geometry)!=null&&s.attributes.color&&this.currentColorScheme&&this.satelliteStore){(this.satelliteColors.length===0||e*4!==this.satelliteColors.length)&&(this.satelliteColors=new Array(this.satelliteStore.satData.length*4),this.satelliteColors.fill(1,0,this.satelliteColors.length));for(let n=0;n{var c;(c=this.worker)==null||c.postMessage(JSON.stringify({state:{running:document.visibilityState==="visible"}}))})}getObject3D(){return this.particles}initSatWorker(e={}){f.info("Kicking off sat-cruncher-worker"),this.worker=new Ge,this.worker.onmessage=this.onMessage.bind(this),this.worker.postMessage(JSON.stringify({config:e}))}async init(e,t){this.satelliteStore=t.satelliteStore,this.shaderStore=t.shaderStore,this.scene=e;const s=t.config||{};let i={};s.satWorker&&(i={...s.satWorker,logLevel:s.logLevel}),this.initSatWorker(i),t!=null&&t.config&&(this.baseUrl=t.config.baseUrl),this.satelliteStore&&(this.satelliteStore.addEventListener("satdataloaded",this.onSatDataLoaded.bind(this)),await this.satelliteStore.loadSatelliteData(),this.initGeometry(),this.satelliteStore.gotExtraData&&this.updateSatellites())}update(){}}function ke(r){return new Worker("/StuffInSpace/assets/OrbitCalculationWorker-_Yyn1p1l.js",{name:r==null?void 0:r.name})}class Pe{constructor(){a(this,"config",{});a(this,"segmentCount",255);a(this,"orbitWorker");a(this,"selectedSatellites",[]);a(this,"hoverSatelliteIdx",-1);a(this,"satelliteGroups");a(this,"satelliteGroup");a(this,"inProgress",[]);a(this,"scene");a(this,"selectColor",[0,1,0,1]);a(this,"hoverColor",[1,.92,.23,1]);a(this,"groupColor",[.3,.5,1,.4]);a(this,"orbitTracks",[]);a(this,"satelliteStore");a(this,"satelliteOrbitGroup")}calculateOrbits(e){e=e.filter(t=>!this.inProgress[t]),this.orbitWorker?this.orbitWorker.postMessage(JSON.stringify({isInit:!1,satId:e})):f.error("Orbit worker is undefined"),e.forEach(t=>this.inProgress[t]=!0)}onSatellitesLoaded(){this.satelliteStore&&(this.inProgress=new Array(this.satelliteStore.size()),this.orbitTracks=new Array(this.satelliteStore.size()),this.orbitWorker&&this.orbitWorker.postMessage(JSON.stringify({isInit:!0,satData:this.satelliteStore.satData,numSegs:this.segmentCount})))}isTrackVisible(e){return this.selectedSatellites.indexOf(e)>-1||e===this.hoverSatelliteIdx||this.satelliteGroup&&this.satelliteGroup.hasSat(e)}getTrackColor(e){let t=[1,1,0];return e===this.hoverSatelliteIdx?t=this.hoverColor:this.selectedSatellites.indexOf(e)>-1?t=this.selectColor:this.satelliteGroup&&this.satelliteGroup.hasSat(e)&&(t=this.groupColor),new B(t[0],t[1],t[2])}addOrbitTrack(e,t){const s=this.getTrackColor(e),i=new pe({color:s,linewidth:10}),o=new _;o.setAttribute("position",new g(t,3));const n=new me(o,i);n.name=`${e}`,this.satelliteOrbitGroup&&this.satelliteOrbitGroup.add(n),this.orbitTracks[e]=n}updateOrbitTrack(e,t){const s=this.orbitTracks[e];if(s){const i=s.material;i.color=this.getTrackColor(e),i.needsUpdate=!0,t&&(s.geometry.setAttribute("position",new g(t,3)),s.geometry.computeBoundingBox(),s.geometry.computeBoundingSphere())}}removeOrbitTrack(e){var t;if(this.orbitTracks[e]){const s=this.orbitTracks[e];(t=this.satelliteOrbitGroup)==null||t.remove(s),s.geometry&&s.geometry.dispose(),this.orbitTracks[e]=void 0}}onMessage(e){const{satId:t}=e.data;this.scene&&(this.orbitTracks[t]?this.updateOrbitTrack(t,e.data.pointsOut):this.isTrackVisible(t)&&this.addOrbitTrack(t,e.data.pointsOut)),this.inProgress[t]=!1}isHoverSatellite(e){return this.hoverSatelliteIdx!==void 0&&e!==-1&&this.hoverSatelliteIdx===e}isSelectedSatellite(e){return this.selectedSatellites.length>0?this.selectedSatellites.indexOf(e)>-1:!1}refreshOrbits(){if(this.satelliteGroup){const e=this.satelliteGroup.sats;for(let t=0;t0)for(let t=0;t-1&&(t=this.selectedSatellites.indexOf(this.hoverSatelliteIdx)<0,t=t&&(!this.satelliteGroup||!this.satelliteGroup.hasSat(this.hoverSatelliteIdx))),this.hoverSatelliteIdx=e,t?this.removeOrbitTrack(s):this.updateOrbitTrack(s),this.calculateOrbits([e]),this.refreshOrbits()}setSatelliteGroup(e){if(this.satelliteGroup){this.setSelectedSatellites([]),this.setHoverSatellite(-1);for(let t=0;ti.satId);this.calculateOrbits(s)}}init(e,t){this.config=t.config,this.scene=e,this.orbitWorker=new ke,this.orbitWorker.onmessage=this.onMessage.bind(this),this.satelliteStore=t.satelliteStore,this.orbitWorker.postMessage(JSON.stringify({config:{logLevel:this.config.logLevel}})),this.satelliteStore&&(this.satelliteStore.addEventListener("satdataloaded",this.onSatellitesLoaded.bind(this)),this.satelliteStore.size()>0&&(this.inProgress=new Array(this.satelliteStore.size()),this.onSatellitesLoaded())),t.satelliteGroups&&(this.satelliteGroups=t.satelliteGroups),this.satelliteOrbitGroup=new $,this.scene.add(this.satelliteOrbitGroup)}update(){}}const C=class C extends Se{constructor(){super();a(this,"pxToRadius",3185.5)}setPixels2Radius(t){this.pxToRadius=t}getPixels2Radius(){return this.pxToRadius}km2pixels(t){return t/this.pxToRadius}alitudeToPixels(t){return(C.earthRadiusInKm+t)/this.pxToRadius}};a(C,"earthRadiusInKm",6371);let k=C;class Y{constructor(e,t,s,i,o){a(this,"sats",[]);a(this,"id");a(this,"name");a(this,"groupType");a(this,"data");a(this,"satelliteStore");if(this.id=e,this.name=t,this.groupType=s,this.data=i,this.satelliteStore=o,!this.satelliteStore)throw new Error("satelliteStore is required")}reload(){switch(this.sats=[],this.groupType){case"intlDes":this.searchIntlDes();break;case"nameRegex":this.searchNameRegex();break;case"idList":this.searchIdList();break;case"objectType":this.searchObjectType();break;default:throw new Error("Invalid groupType")}}searchObjectType(){if(typeof this.data!="string")throw new Error("objectType must be a string");const t=this.satelliteStore.search({["OBJECT_TYPE"]:this.data});for(const s of t)this.sats.push({satId:s.id,isIntlDes:!1,strIndex:0})}searchIdList(){if(typeof this.data=="string")throw new Error("idList must be an array");for(const e of this.data)this.sats.push({satId:e,isIntlDes:!1,strIndex:0})}searchNameRegex(){if(typeof this.data!="string")throw new Error("nameRegex must be a string");const e=new RegExp(this.data),t=this.satelliteStore.searchNameRegex(e);for(const s of t)this.sats.push({satId:s,isIntlDes:!1,strIndex:0})}searchIntlDes(){if(typeof this.data=="string")throw new Error("intlDes must be an array");for(const e of this.data)this.sats.push({satId:this.satelliteStore.getIdFromIntlDes(e),isIntlDes:!0,strIndex:0})}getSat(e){return this.satelliteStore.satData.find(t=>t.id===e)}hasSat(e){for(const t of this.sats)if(t.satId===e)return!0;return!1}}class Re{constructor(e,t){a(this,"groups",{});a(this,"selectedGroup");a(this,"sats",[]);a(this,"satelliteStore");if(!t)throw new Error("satelliteStore is required");this.satelliteStore=t,this.resetConfig(e),this.satelliteStore.addEventListener("satdataloaded",this.onSatDataLoaded.bind(this))}asArray(){return Object.values(this.groups)}selectGroup(e){if(this.selectedGroup=e,!e){this.clearSelect();return}}forEach(e){for(let t=0;t{i(t)})}}const We={baseUrl:"/StuffInSpace"};class $e{constructor(e={}){a(this,"tleUrl",`${We.baseUrl}/data/attributed-TLE.json`);a(this,"eventManager");a(this,"satData",[]);a(this,"attribution");a(this,"updateDate");a(this,"satelliteVelocities",new Float32Array);a(this,"satellitePositions",new Float32Array);a(this,"satelliteAltitudes",new Float32Array);a(this,"gotExtraData",!1);a(this,"gotPositionalData",!1);a(this,"loaded",!1);this.eventManager=new K,e.tleUrl&&(this.tleUrl=e.tleUrl)}async loadSatelliteData(){try{const e=await j.get(this.tleUrl,{params:{t:Date.now()}});if(e.data){Array.isArray(e.data)?this.satData=e.data:(this.satData=e.data.data,this.attribution=e.data.source,this.updateDate=e.data.date);for(let t=0;t50?"19":"20")+s.toString(),n=this.satData[t].INTLDES.substring(2);this.satData[t].intlDes=`${o}-${n}`}else this.satData[t].intlDes="unknown";this.satData[t].id=t}}this.eventManager.fireEvent("satdataloaded",this.satData),this.loaded=!0}catch(e){f.error("error loading TLE data",e)}}getAttribution(){return this.attribution}getUpdatedDate(){return this.updateDate}setSatelliteData(e,t=!1){this.satData=e,this.gotExtraData=t,t&&this.eventManager.fireEvent("satextradataloaded",this.satData)}setPositionalData(e,t,s){this.satelliteVelocities=e,this.satellitePositions=t,this.satelliteAltitudes=s,this.gotPositionalData=!0}getSatellitePosition(e){const t=e*3;if(this.satellitePositions&&to[i]===e[i]);return s}searchName(e){const t=[];for(let s=0;s0){o.sort((h,c)=>h.object.type==="Line"&&c.object.type==="Points"?1:h.object.type==="Points"&&c.object.type==="Line"?-1:0);let l=o.map(h=>h.object.type==="Points"?h.index:h.object.type==="Line"?parseInt(h.object.name):-1).filter(h=>h!==-1);if(l.length>0){const h=[];for(const c of l)this.isValidTarget(c)&&h.push(c);l=h}return l}return[]}isValidTarget(e){var s;const t=(s=this.satellites)==null?void 0:s.getSatellitegroup();return t?t.hasSat(e):!0}onClick(e){var n,l,h,c;const t=(n=this.renderer)==null?void 0:n.domElement;if(!this.raycaster||!this.scene||!this.camera||!t)return;const s=this.findSatellitesAtMouse({x:e.clientX,y:e.clientY});let i=-1,o;s&&s.length>0&&(i=s[0],o=(l=this.satelliteStore)==null?void 0:l.getSatellite(i)),this.selectedSatelliteIdx=i,(h=this.satellites)==null||h.setSelectedSatellite(i),(c=this.orbits)==null||c.setSelectedSatellite(i),this.eventManager.fireEvent("selectedSatChange",o)}onMouseMove(){this.mouseMoved=!0}onMouseDown(){this.mouseMoved=!1,this.controls&&(this.controls.autoRotate=!1),window.addEventListener("mousemove",this.onMouseMove.bind(this))}onMouseUp(e){this.mouseMoved||this.onClick(e),this.mouseMoved=!1,window.removeEventListener("mousemove",this.onMouseMove.bind(this))}onHover(e){var n,l,h,c;const t=(n=this.renderer)==null?void 0:n.domElement;if(!this.raycaster||!this.scene||!this.camera||!t)return;const s=this.findSatellitesAtMouse({x:e.clientX,y:e.clientY});let i=-1,o;s&&s.length>0&&(i=s[0],o=(l=this.satelliteStore)==null?void 0:l.getSatellite(i)),(h=this.satellites)==null||h.setHoverSatellite(i),(c=this.orbits)==null||c.setHoverSatellite(i),this.eventManager.fireEvent("sathoverChange",o),this.mouseMoved=!0}async init(){var e;try{this.scene=new k,this.camera=new ye(45,window.innerWidth/window.innerHeight,.1,1e3),this.camera.position.z=15,this.camera.zoom=1,this.renderer=new be({antialias:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),(e=document.querySelector(this.config.canvasSelector))==null||e.appendChild(this.renderer.domElement),f.debug(`Using WebGL 2: ${this.renderer.capabilities.isWebGL2}`),this.controls=new ve(this.camera,this.renderer.domElement),this.controls.rotateSpeed=.33,this.controls.enablePan=!1,this.controls.enableZoom=!0,this.controls.enableDamping=!0,this.controls.dampingFactor=.05,this.controls.zoomSpeed=3,this.controls.maxZoom=10,this.controls.minZoom=3,this.controls.autoRotate=!0,this.controls.autoRotateSpeed=.5,this.controls.maxDistance=50,this.controls.minDistance=3,this.controls.update(),this.raycaster=new xe,this.satelliteStore=new $e(this.config),this.satelliteGroups=new Re(this.config.satelliteGroups,this.satelliteStore),this.shaderStore=new Be(this.config.baseUrl),f.debug("loading shaders"),await this.shaderStore.load(),this.context.satelliteGroups=this.satelliteGroups,this.context.config=this.config,this.context.satelliteStore=this.satelliteStore,this.context.shaderStore=this.shaderStore,this.satelliteStore.addEventListener("satdataloaded",this.onSatDataLoaded.bind(this)),this.earth=new Ee,await this.registerSceneComponent("earth",this.earth),await this.registerSceneComponent("sun",new M),await this.registerSceneComponent("universe",new Ae),this.satellites=new Me,await this.registerSceneComponent("satellites",this.satellites),this.orbits=new Pe,await this.registerSceneComponent("orbits",this.orbits);const t=this.getCenterPoint(this.earth.getMesh());t&&(this.controls.target=t),this.camera.updateProjectionMatrix(),window.addEventListener("resize",this.onWindowResize.bind(this));const s=this.renderer.domElement;s.addEventListener("mousedown",this.onMouseDown.bind(this)),s.addEventListener("mouseup",this.onMouseUp.bind(this)),s.addEventListener("mousemove",this.onHover.bind(this))}catch(t){f.error("Error while initialising scene",t)}}animate(){requestAnimationFrame(this.animate.bind(this));for(const e of this.sceneComponents)e.update(this.scene);this.controls&&this.controls.update(),this.renderer&&this.renderer.render(this.scene,this.camera)}getSatelliteStore(){return this.satelliteStore}getSatelliteGroups(){return this.satelliteGroups}zoomToSatellite(e){var t;(t=this.satelliteStore)==null||t.getSatellitePosition(e)}clampZoom(){this.camera&&(this.targetZoom>this.camera.zoom*5?this.targetZoom=this.camera.zoom*5:this.targetZoom{this.close()})}moveTo(e,t){this.element&&(this.element.style.top=`${t}px`,this.element.style.left=`${e}px`)}getLocation(){if(!this.element)return{x:0,y:0};const e=this.element.style;return e.x?{x:e.x,y:e.y}:{x:this.element.offsetLeft,y:this.element.offsetTop}}addEventListener(e,t){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e])this.listeners[e].add(t);else throw new Error("unknown event")}fireEvent(e,t){this.listeners[e]&&this.listeners[e].forEach(i=>{i(t)})}}const qe=100;class He{constructor(){a(this,"windows",[]);a(this,"windowsById",{});a(this,"initialOpen",!1)}bringWindowToFront(e){const t=e.element;let s=-1;for(let i=0;i-1&&(this.windows.splice(s,1),this.windows.push(e));for(let i=0;i=0;e--)if(this.windows[e].isOpen())return this.windows[e]}openWindow(e){const s={x:100,y:100},i=this.windowsById[e],o=this.getTopWindow();let n=!1;if(i){let{x:l,y:h}=i.getLocation();if(o||(l=s.x,h=s.y,this.initialOpen=!1),n=i.firstOpen,n&&o){const c=o.getLocation();c&&(c.x>window.innerWidth/2?l=c.x-42-300:l=c.x+42,c.y>window.innerHeight/2?h=c.y-42-300:h=c.y+42)}if(i.open(),!this.initialOpen&&!n){const c=i.getLocation();c&&(l=c.x,h=c.y)}(l>window.innerWidth||l<0)&&(l=s.x),(h>window.innerHeight||h<0)&&(h=s.y),this.bringWindowToFront(i),i.moveTo(l,h),this.initialOpen=!1}}closeWindow(e){const t=this.windowsById[e];t&&t.close()}makeDraggable(e){let t=0,s=0,i=0,o=0;const n=e.element;if(!n)return;const l=n.querySelector(".drag-zone")||n;function h(c){const d=`${t-(o-c.clientY)}px`,v=`${s-(i-c.clientX)}px`;n&&n.style&&(n.style.top=d,n.style.left=v)}n.classList.add("draggable"),n.addEventListener("click",()=>{this.bringWindowToFront(e)}),l.addEventListener("mousedown",c=>{c.preventDefault(),s=n.offsetLeft,t=n.offsetTop,i=c.clientX,o=c.clientY,this.bringWindowToFront(e),n.style.right="unset",n.style.bottom="unset",n.style.left=`${s}px`,n.style.top=`${t}px`,n.classList.add("dragging"),l.addEventListener("mousemove",h)}),n.addEventListener("mouseup",c=>{c.preventDefault(),l.removeEventListener("mousemove",h),n.classList.remove("dragging")}),n.addEventListener("mouseout",c=>{c.preventDefault(),l.removeEventListener("mousemove",h),n.classList.remove("dragging")})}}const F=200;let m,P,X=!1,R=-1,O=!1,Q;function ee(){return O}function Ve(){return Q}function _e(){return O?document.querySelector("#search").value:null}function Je(){return X}function Ze(){return R}function Ye(){X=!1,R=-1,m.setHoverSatellite(R)}function I(r){const e=document.querySelector("#search-results");e&&(r?e.style.display="block":e.style.display="none",O=r)}function Ke(){I(!ee())}function Xe(){I(!0)}function te(){I(!1);const r=m.getSatelliteGroups();r&&r.clearSelect()}function se(r,e){const t=document.querySelector("#search-results"),s=m.getSatelliteStore();if(!s)return;let i="";for(const o of r){if(o.satId===void 0)continue;const n=s.getSatellite(o.satId);if(!n){f.warn("satellite not found",o.satId);continue}i+=`
`,o.type!=="name"?i+=n.OBJECT_NAME:i+=` - ${n.OBJECT_NAME.substring(0,o.strIndex)} - - ${n.OBJECT_NAME.substring(o.strIndex,o.strIndex+e.length)} - - ${n.OBJECT_NAME.substring(o.strIndex+e.length)}`,i+='
',o.type==="intlDes"?i+=` - ${n.intlDes.substring(0,o.strIndex)} - - ${n.intlDes.substring(o.strIndex,o.strIndex+e.length)} - - ${n.intlDes.substring(o.strIndex+e.length)}`:o.type==="noradId"?i+=` - ${n.NORAD_CAT_ID.substring(0,o.strIndex)} - - ${n.NORAD_CAT_ID.substring(o.strIndex,o.strIndex+e.length)} - - ${n.NORAD_CAT_ID.substring(o.strIndex+e.length)}`:i+=n.intlDes,i+="
"}t.innerHTML=i,t.style.display="block",O=!0}function Qe(){const r=document.querySelector("#search-results");r&&(r.innerHTML="")}function W(r){var l,h,c;const e=m.getSatelliteStore();if(!e)return;const t=e.getSatData();if(m.setSelectedSatellite(-1),r.length===0){te();return}r=r.toUpperCase();const s=[];for(let d=0;dF&&(s.length=F);const i=[];for(const d of s)i.push(d.satId);const o=new Y("search-results","Search Results","idList",i,e);o.reload(),Q=o;const n=m.getSatelliteGroups();n&&(n.selectGroup(o),m.setSelectedSatelliteGroup(o)),se(s,r)}function et(){var e,t;const r=document.querySelector("#search-results");r&&(r.addEventListener("click",s=>{let i=s.target;if(i.className!=="search-result"&&(i=i.closest(".search-result")),!i)return;const o=i==null?void 0:i.dataset.satId;Ye(),m.setSelectedSatellite(parseInt(o))}),(e=document.querySelector("#search"))==null||e.addEventListener("input",()=>{var i;const s=(i=document.querySelector("#search"))==null?void 0:i.value;W(s)}),(t=document.querySelector("#all-objects-link"))==null||t.addEventListener("click",()=>{const s=m.getSelectedSatellite();if(s){const o=s.intlDes.slice(0,8);W(o),document.querySelector("#search").value=o,P&&P.openWindow("search-window")}}))}function tt(r,e){m=r,P=e,et()}const y={init:tt,clearResults:Qe,getHoverSat:Ze,isHovering:Je,showResults:Xe,hideResults:te,doSearch:W,getCurrentSearch:_e,getLastResultGroup:Ve,fillResultBox:se,isResultBoxOpen:ee,setResultsVisible:I,toggleResultsVisible:Ke},st=[],S=new He,it=[];let q=!1,u;function rt(r){var t;let e=document.querySelector(".attribution");if(e||(e=document.createElement("div"),e.className="attribution",(t=document.querySelector("body"))==null||t.appendChild(e)),e)if(r){const s=u.getSatelliteStore();if(s&&s.getAttribution()){const i=s.getAttribution()||{},o=s.getUpdatedDate();e.innerHTML=`Orbital object data from ${i.name} (updated ${o})`}e.classList.remove("hidden")}else e.classList.add("hidden")}function ie(r){var e,t;r?(e=document.querySelector("body"))==null||e.classList.add("loading"):(t=document.querySelector("body"))==null||t.classList.remove("loading")}function ot(){const r=document.querySelector("#groups-display"),e=u.getSatelliteGroups();let t=[];e&&(t=e.asArray().sort((i,o)=>i.name.localeCompare(o.name)));let s="";for(let i=0;i${t[i].name} -`;r.innerHTML=s}function p(r,e){const t=document.querySelector(r);t&&(t.innerHTML=e)}function at(r){var e,t,s,i,o;r?((e=document.querySelector("#sat-infobox"))==null||e.classList.add("visible"),p("#sat-info-title",r.OBJECT_NAME),p("#sat-intl-des",r.intlDes),p("#sat-type",r.OBJECT_TYPE),p("#sat-apogee",`${(t=r.apogee)==null?void 0:t.toFixed(0)} km`),p("#sat-perigee",`${(s=r.perigee)==null?void 0:s.toFixed(0)} km`),p("#sat-inclination",`${(r.inclination*Ne).toFixed(2)}°`),p("#sat-period",`${(i=r.period)==null?void 0:i.toFixed(2)} min`)):(o=document.querySelector("#sat-infobox"))==null||o.classList.remove("visible")}function nt(r){const{satId:e,satX:t,satY:s,satellite:i}=r||{};if(!e||e===-1){p("#sat-hoverbox","(none)");let o=document.querySelector("#sat-hoverbox");o&&(o.style.display="none"),o=document.querySelector("#canvas"),o&&(o.style.cursor="default")}else{const o=document.querySelector("#sat-hoverbox");o&&(o.innerHTML=i.OBJECT_NAME,o.style.display="block",o.style.position="absolute",o.style.left=`${t+20}px`,o.style.top=`${s-10}px`);const n=document.querySelector("#canvas");n&&(n.style.cursor="pointer")}}function lt(){var e;(e=document.querySelector("#groups-display"))==null||e.addEventListener("mouseout",()=>{if(!q){const t=u.getSatelliteGroups();t&&(y.isResultBoxOpen()?t.selectGroup(y.getLastResultGroup()):t.clearSelect())}});const r=document.querySelectorAll("#groups-display>li");for(let t=0;t{const n=i.currentTarget.dataset.group,l=u.getSatelliteGroups();l&&l.selectGroup(l.getGroupById(n))}),s.addEventListener("mouseout",()=>{const i=u.getSatelliteGroups();if(i){const o=document.querySelector("#groups-display>li.selected");o?i.selectGroup(i.getGroupById(o.dataset.group)):i.selectGroup(void 0)}}),s.addEventListener("click",i=>{i.preventDefault();const o=i.currentTarget;q=!0;const n=document.querySelector("#groups-display>li.selected");let l;n&&(l=n.dataset.group);for(let v=0;v{s.preventDefault(),u.zoomIn()}),(t=document.querySelector("#zoom-out"))==null||t.addEventListener("click",s=>{s.preventDefault(),u.zoomOut()}),window.addEventListener("resize",()=>{it.forEach(s=>{window.visualViewport&&(s.offsetLeft+s.offsetWidth>window.visualViewport.width&&(s.style.right="unset",s.style.left=`${window.visualViewport.width-s.offsetWidth}px`),s.offsetTop+s.offsetHeight>window.visualViewport.height&&(s.style.bottom="unset",s.style.offsetTop=`${window.visualViewport.height-s.offsetHeight}px`))})}),ie(!1)}function ct(r){r.satId&&(p("#sat-altitude",`${r.altitude.toFixed(2)} km`),p("#sat-velocity",`${r.velocity.toFixed(2)} km/s`))}function H(){ht(),ot(),setTimeout(()=>lt(),0);const r=document.querySelector("#load-cover");r&&r.classList.add("hidden"),rt(!0)}function dt(){return st}function ut(){const r=document.querySelectorAll(".menu-item");for(let e=0;e{const s=t.dataset.action;if(s&&s.startsWith("open:")){const i=s.split(":");S.openWindow(i[1])}})}}function ft(){return y.getCurrentSearch()}function gt(r){var e;u=r,S.registerWindow("sat-infobox"),S.registerWindow("about-window"),S.registerWindow("help-window"),S.registerWindow("groups-window"),S.registerWindow("search-window"),(e=S.getWindow("search-window"))==null||e.addEventListener("close",()=>{var s;(s=u.getSatelliteGroups())==null||s.clearSelect(),u.setSelectedSatelliteGroup();const t=document.querySelectorAll("#groups-display>li");for(const i of t)i.classList.remove("selected")}),y.init(u,S),ut(),u.addEventListener(G.satMovementChange,ct),u.ready?H():u.addEventListener(G.satDataLoaded,H)}const pt={setLoading:ie,init:gt,getSupportedEvents:dt,getCurrentSearch:ft};async function mt(){const e=await j.get(".//config.json");let t=N;return e.data&&(t={...N,...e.data}),t}async function St(){const r=await mt();J(r.logLevel);const e=ze(r);await e.init(),e.animate(),pt.init(e)}document.addEventListener("DOMContentLoaded",()=>{St().catch(r=>console.error(r))}); diff --git a/assets/vendor-AS6r1VG_.js b/assets/vendor-AS6r1VG_.js deleted file mode 100644 index 897d1bc..0000000 --- a/assets/vendor-AS6r1VG_.js +++ /dev/null @@ -1,2064 +0,0 @@ -function lu(n,e){return function(){return n.apply(e,arguments)}}const{toString:hf}=Object.prototype,{getPrototypeOf:oo}=Object,Ls=(n=>e=>{const t=hf.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),fi=n=>(n=n.toLowerCase(),e=>Ls(e)===n),Ps=n=>e=>typeof e===n,{isArray:Xn}=Array,dr=Ps("undefined");function ff(n){return n!==null&&!dr(n)&&n.constructor!==null&&!dr(n.constructor)&&$t(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const cu=fi("ArrayBuffer");function df(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&cu(n.buffer),e}const pf=Ps("string"),$t=Ps("function"),uu=Ps("number"),Rs=n=>n!==null&&typeof n=="object",mf=n=>n===!0||n===!1,fs=n=>{if(Ls(n)!=="object")return!1;const e=oo(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},gf=fi("Date"),_f=fi("File"),xf=fi("Blob"),vf=fi("FileList"),yf=n=>Rs(n)&&$t(n.pipe),Sf=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||$t(n.append)&&((e=Ls(n))==="formdata"||e==="object"&&$t(n.toString)&&n.toString()==="[object FormData]"))},Mf=fi("URLSearchParams"),bf=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vr(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),Xn(n))for(i=0,r=n.length;i0;)if(r=t[i],e===r.toLowerCase())return r;return null}const fu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,du=n=>!dr(n)&&n!==fu;function za(){const{caseless:n}=du(this)&&this||{},e={},t=(i,r)=>{const s=n&&hu(e,r)||r;fs(e[s])&&fs(i)?e[s]=za(e[s],i):fs(i)?e[s]=za({},i):Xn(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i(vr(e,(r,s)=>{t&&$t(r)?n[s]=lu(r,t):n[s]=r},{allOwnKeys:i}),n),Ef=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Tf=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Af=(n,e,t,i)=>{let r,s,a;const o={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)a=r[s],(!i||i(a,n,e))&&!o[a]&&(e[a]=n[a],o[a]=!0);n=t!==!1&&oo(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Cf=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},Lf=n=>{if(!n)return null;if(Xn(n))return n;let e=n.length;if(!uu(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},Pf=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&oo(Uint8Array)),Rf=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},Df=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},If=fi("HTMLFormElement"),Nf=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),Bo=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Of=fi("RegExp"),pu=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};vr(t,(r,s)=>{let a;(a=e(r,s,n))!==!1&&(i[s]=a||r)}),Object.defineProperties(n,i)},Uf=n=>{pu(n,(e,t)=>{if($t(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if($t(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Ff=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return Xn(n)?i(n):i(String(n).split(e)),t},kf=()=>{},zf=(n,e)=>(n=+n,Number.isFinite(n)?n:e),Ys="abcdefghijklmnopqrstuvwxyz",Vo="0123456789",mu={DIGIT:Vo,ALPHA:Ys,ALPHA_DIGIT:Ys+Ys.toUpperCase()+Vo},Bf=(n=16,e=mu.ALPHA_DIGIT)=>{let t="";const{length:i}=e;for(;n--;)t+=e[Math.random()*i|0];return t};function Vf(n){return!!(n&&$t(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Hf=n=>{const e=new Array(10),t=(i,r)=>{if(Rs(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=Xn(i)?[]:{};return vr(i,(a,o)=>{const l=t(a,r+1);!dr(l)&&(s[o]=l)}),e[r]=void 0,s}}return i};return t(n,0)},Gf=fi("AsyncFunction"),Wf=n=>n&&(Rs(n)||$t(n))&&$t(n.then)&&$t(n.catch),q={isArray:Xn,isArrayBuffer:cu,isBuffer:ff,isFormData:Sf,isArrayBufferView:df,isString:pf,isNumber:uu,isBoolean:mf,isObject:Rs,isPlainObject:fs,isUndefined:dr,isDate:gf,isFile:_f,isBlob:xf,isRegExp:Of,isFunction:$t,isStream:yf,isURLSearchParams:Mf,isTypedArray:Pf,isFileList:vf,forEach:vr,merge:za,extend:wf,trim:bf,stripBOM:Ef,inherits:Tf,toFlatObject:Af,kindOf:Ls,kindOfTest:fi,endsWith:Cf,toArray:Lf,forEachEntry:Rf,matchAll:Df,isHTMLForm:If,hasOwnProperty:Bo,hasOwnProp:Bo,reduceDescriptors:pu,freezeMethods:Uf,toObjectSet:Ff,toCamelCase:Nf,noop:kf,toFiniteNumber:zf,findKey:hu,global:fu,isContextDefined:du,ALPHABET:mu,generateString:Bf,isSpecCompliantForm:Vf,toJSONObject:Hf,isAsyncFn:Gf,isThenable:Wf};function je(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r)}q.inherits(je,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:q.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const gu=je.prototype,_u={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{_u[n]={value:n}});Object.defineProperties(je,_u);Object.defineProperty(gu,"isAxiosError",{value:!0});je.from=(n,e,t,i,r,s)=>{const a=Object.create(gu);return q.toFlatObject(n,a,function(l){return l!==Error.prototype},o=>o!=="isAxiosError"),je.call(a,n.message,e,t,i,r),a.cause=n,a.name=n.name,s&&Object.assign(a,s),a};const qf=null;function Ba(n){return q.isPlainObject(n)||q.isArray(n)}function xu(n){return q.endsWith(n,"[]")?n.slice(0,-2):n}function Ho(n,e,t){return n?n.concat(e).map(function(r,s){return r=xu(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function Xf(n){return q.isArray(n)&&!n.some(Ba)}const Yf=q.toFlatObject(q,{},null,function(e){return/^is[A-Z]/.test(e)});function Ds(n,e,t){if(!q.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=q.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,p){return!q.isUndefined(p[_])});const i=t.metaTokens,r=t.visitor||u,s=t.dots,a=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&q.isSpecCompliantForm(e);if(!q.isFunction(r))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(q.isDate(g))return g.toISOString();if(!l&&q.isBlob(g))throw new je("Blob is not supported. Use a Buffer instead.");return q.isArrayBuffer(g)||q.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function u(g,_,p){let f=g;if(g&&!p&&typeof g=="object"){if(q.endsWith(_,"{}"))_=i?_:_.slice(0,-2),g=JSON.stringify(g);else if(q.isArray(g)&&Xf(g)||(q.isFileList(g)||q.endsWith(_,"[]"))&&(f=q.toArray(g)))return _=xu(_),f.forEach(function(x,A){!(q.isUndefined(x)||x===null)&&e.append(a===!0?Ho([_],A,s):a===null?_:_+"[]",c(x))}),!1}return Ba(g)?!0:(e.append(Ho(p,_,s),c(g)),!1)}const h=[],d=Object.assign(Yf,{defaultVisitor:u,convertValue:c,isVisitable:Ba});function m(g,_){if(!q.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+_.join("."));h.push(g),q.forEach(g,function(f,w){(!(q.isUndefined(f)||f===null)&&r.call(e,f,q.isString(w)?w.trim():w,_,d))===!0&&m(f,_?_.concat(w):[w])}),h.pop()}}if(!q.isObject(n))throw new TypeError("data must be an object");return m(n),e}function Go(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function lo(n,e){this._pairs=[],n&&Ds(n,this,e)}const vu=lo.prototype;vu.append=function(e,t){this._pairs.push([e,t])};vu.toString=function(e){const t=e?function(i){return e.call(this,i,Go)}:Go;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function jf(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function yu(n,e,t){if(!e)return n;const i=t&&t.encode||jf,r=t&&t.serialize;let s;if(r?s=r(e,t):s=q.isURLSearchParams(e)?e.toString():new lo(e,t).toString(i),s){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class Wo{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){q.forEach(this.handlers,function(i){i!==null&&e(i)})}}const Su={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Zf=typeof URLSearchParams<"u"?URLSearchParams:lo,$f=typeof FormData<"u"?FormData:null,Jf=typeof Blob<"u"?Blob:null,Kf={isBrowser:!0,classes:{URLSearchParams:Zf,FormData:$f,Blob:Jf},protocols:["http","https","file","blob","url","data"]},Mu=typeof window<"u"&&typeof document<"u",Qf=(n=>Mu&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),ed=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",td=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Mu,hasStandardBrowserEnv:Qf,hasStandardBrowserWebWorkerEnv:ed},Symbol.toStringTag,{value:"Module"})),ui={...td,...Kf};function id(n,e){return Ds(n,new ui.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return ui.isNode&&q.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function nd(n){return q.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function rd(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i=t.length;return a=!a&&q.isArray(r)?r.length:a,l?(q.hasOwnProp(r,a)?r[a]=[r[a],i]:r[a]=i,!o):((!r[a]||!q.isObject(r[a]))&&(r[a]=[]),e(t,i,r[a],s)&&q.isArray(r[a])&&(r[a]=rd(r[a])),!o)}if(q.isFormData(n)&&q.isFunction(n.entries)){const t={};return q.forEachEntry(n,(i,r)=>{e(nd(i),r,t,0)}),t}return null}function sd(n,e,t){if(q.isString(n))try{return(e||JSON.parse)(n),q.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(n)}const co={transitional:Su,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=q.isObject(e);if(s&&q.isHTMLForm(e)&&(e=new FormData(e)),q.isFormData(e))return r&&r?JSON.stringify(bu(e)):e;if(q.isArrayBuffer(e)||q.isBuffer(e)||q.isStream(e)||q.isFile(e)||q.isBlob(e))return e;if(q.isArrayBufferView(e))return e.buffer;if(q.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return id(e,this.formSerializer).toString();if((o=q.isFileList(e))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Ds(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),sd(e)):e}],transformResponse:[function(e){const t=this.transitional||co.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(e&&q.isString(e)&&(i&&!this.responseType||r)){const a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?je.from(o,je.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ui.classes.FormData,Blob:ui.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};q.forEach(["delete","get","head","post","put","patch"],n=>{co.headers[n]={}});const uo=co,ad=q.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),od=n=>{const e={};let t,i,r;return n&&n.split(` -`).forEach(function(a){r=a.indexOf(":"),t=a.substring(0,r).trim().toLowerCase(),i=a.substring(r+1).trim(),!(!t||e[t]&&ad[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},qo=Symbol("internals");function er(n){return n&&String(n).trim().toLowerCase()}function ds(n){return n===!1||n==null?n:q.isArray(n)?n.map(ds):String(n)}function ld(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const cd=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function js(n,e,t,i,r){if(q.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!q.isString(e)){if(q.isString(i))return e.indexOf(i)!==-1;if(q.isRegExp(i))return i.test(e)}}function ud(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function hd(n,e){const t=q.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(n,i+t,{value:function(r,s,a){return this[i].call(this,e,r,s,a)},configurable:!0})})}class Is{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(o,l,c){const u=er(l);if(!u)throw new Error("header name must be a non-empty string");const h=q.findKey(r,u);(!h||r[h]===void 0||c===!0||c===void 0&&r[h]!==!1)&&(r[h||l]=ds(o))}const a=(o,l)=>q.forEach(o,(c,u)=>s(c,u,l));return q.isPlainObject(e)||e instanceof this.constructor?a(e,t):q.isString(e)&&(e=e.trim())&&!cd(e)?a(od(e),t):e!=null&&s(t,e,i),this}get(e,t){if(e=er(e),e){const i=q.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return ld(r);if(q.isFunction(t))return t.call(this,r,i);if(q.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=er(e),e){const i=q.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||js(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function s(a){if(a=er(a),a){const o=q.findKey(i,a);o&&(!t||js(i,i[o],o,t))&&(delete i[o],r=!0)}}return q.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];(!e||js(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return q.forEach(this,(r,s)=>{const a=q.findKey(i,s);if(a){t[a]=ds(r),delete t[s];return}const o=e?ud(s):String(s).trim();o!==s&&delete t[s],t[o]=ds(r),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return q.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&q.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[qo]=this[qo]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=er(a);i[o]||(hd(r,a),i[o]=!0)}return q.isArray(e)?e.forEach(s):s(e),this}}Is.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);q.reduceDescriptors(Is.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(i){this[t]=i}}});q.freezeMethods(Is);const bi=Is;function Zs(n,e){const t=this||uo,i=e||t,r=bi.from(i.headers);let s=i.data;return q.forEach(n,function(o){s=o.call(t,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function wu(n){return!!(n&&n.__CANCEL__)}function yr(n,e,t){je.call(this,n??"canceled",je.ERR_CANCELED,e,t),this.name="CanceledError"}q.inherits(yr,je,{__CANCEL__:!0});function fd(n,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?n(t):e(new je("Request failed with status code "+t.status,[je.ERR_BAD_REQUEST,je.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const dd=ui.hasStandardBrowserEnv?{write(n,e,t,i,r,s){const a=[n+"="+encodeURIComponent(e)];q.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),q.isString(i)&&a.push("path="+i),q.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pd(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function md(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Eu(n,e){return n&&!pd(e)?md(n,e):e}const gd=ui.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function r(s){let a=s;return e&&(t.setAttribute("href",a),a=t.href),t.setAttribute("href",a),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return i=r(window.location.href),function(a){const o=q.isString(a)?r(a):a;return o.protocol===i.protocol&&o.host===i.host}}():function(){return function(){return!0}}();function _d(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function xd(n,e){n=n||10;const t=new Array(n),i=new Array(n);let r=0,s=0,a;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=i[s];a||(a=c),t[r]=l,i[r]=c;let h=s,d=0;for(;h!==r;)d+=t[h++],h=h%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),c-a{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-t,l=i(o),c=s<=a;t=s;const u={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:r};u[e?"download":"upload"]=!0,n(u)}}const vd=typeof XMLHttpRequest<"u",yd=vd&&function(n){return new Promise(function(t,i){let r=n.data;const s=bi.from(n.headers).normalize();let{responseType:a,withXSRFToken:o}=n,l;function c(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let u;if(q.isFormData(r)){if(ui.hasStandardBrowserEnv||ui.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((u=s.getContentType())!==!1){const[_,...p]=u?u.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([_||"multipart/form-data",...p].join("; "))}}let h=new XMLHttpRequest;if(n.auth){const _=n.auth.username||"",p=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(_+":"+p))}const d=Eu(n.baseURL,n.url);h.open(n.method.toUpperCase(),yu(d,n.params,n.paramsSerializer),!0),h.timeout=n.timeout;function m(){if(!h)return;const _=bi.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),f={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:_,config:n,request:h};fd(function(x){t(x),c()},function(x){i(x),c()},f),h=null}if("onloadend"in h?h.onloadend=m:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(m)},h.onabort=function(){h&&(i(new je("Request aborted",je.ECONNABORTED,n,h)),h=null)},h.onerror=function(){i(new je("Network Error",je.ERR_NETWORK,n,h)),h=null},h.ontimeout=function(){let p=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const f=n.transitional||Su;n.timeoutErrorMessage&&(p=n.timeoutErrorMessage),i(new je(p,f.clarifyTimeoutError?je.ETIMEDOUT:je.ECONNABORTED,n,h)),h=null},ui.hasStandardBrowserEnv&&(o&&q.isFunction(o)&&(o=o(n)),o||o!==!1&&gd(d))){const _=n.xsrfHeaderName&&n.xsrfCookieName&&dd.read(n.xsrfCookieName);_&&s.set(n.xsrfHeaderName,_)}r===void 0&&s.setContentType(null),"setRequestHeader"in h&&q.forEach(s.toJSON(),function(p,f){h.setRequestHeader(f,p)}),q.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),a&&a!=="json"&&(h.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&h.addEventListener("progress",Xo(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",Xo(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=_=>{h&&(i(!_||_.type?new yr(null,n,h):_),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const g=_d(d);if(g&&ui.protocols.indexOf(g)===-1){i(new je("Unsupported protocol "+g+":",je.ERR_BAD_REQUEST,n));return}h.send(r||null)})},Va={http:qf,xhr:yd};q.forEach(Va,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const Yo=n=>`- ${n}`,Sd=n=>q.isFunction(n)||n===null||n===!1,Tu={getAdapter:n=>{n=q.isArray(n)?n:[n];const{length:e}=n;let t,i;const r={};for(let s=0;s`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since : -`+s.map(Yo).join(` -`):" "+Yo(s[0]):"as no adapter specified";throw new je("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i},adapters:Va};function $s(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new yr(null,n)}function jo(n){return $s(n),n.headers=bi.from(n.headers),n.data=Zs.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Tu.getAdapter(n.adapter||uo.adapter)(n).then(function(i){return $s(n),i.data=Zs.call(n,n.transformResponse,i),i.headers=bi.from(i.headers),i},function(i){return wu(i)||($s(n),i&&i.response&&(i.response.data=Zs.call(n,n.transformResponse,i.response),i.response.headers=bi.from(i.response.headers))),Promise.reject(i)})}const Zo=n=>n instanceof bi?n.toJSON():n;function Bn(n,e){e=e||{};const t={};function i(c,u,h){return q.isPlainObject(c)&&q.isPlainObject(u)?q.merge.call({caseless:h},c,u):q.isPlainObject(u)?q.merge({},u):q.isArray(u)?u.slice():u}function r(c,u,h){if(q.isUndefined(u)){if(!q.isUndefined(c))return i(void 0,c,h)}else return i(c,u,h)}function s(c,u){if(!q.isUndefined(u))return i(void 0,u)}function a(c,u){if(q.isUndefined(u)){if(!q.isUndefined(c))return i(void 0,c)}else return i(void 0,u)}function o(c,u,h){if(h in e)return i(c,u);if(h in n)return i(void 0,c)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,u)=>r(Zo(c),Zo(u),!0)};return q.forEach(Object.keys(Object.assign({},n,e)),function(u){const h=l[u]||r,d=h(n[u],e[u],u);q.isUndefined(d)&&h!==o||(t[u]=d)}),t}const Au="1.6.4",ho={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{ho[n]=function(i){return typeof i===n||"a"+(e<1?"n ":" ")+n}});const $o={};ho.transitional=function(e,t,i){function r(s,a){return"[Axios v"+Au+"] Transitional option '"+s+"'"+a+(i?". "+i:"")}return(s,a,o)=>{if(e===!1)throw new je(r(a," has been removed"+(t?" in "+t:"")),je.ERR_DEPRECATED);return t&&!$o[a]&&($o[a]=!0,console.warn(r(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,a,o):!0}};function Md(n,e,t){if(typeof n!="object")throw new je("options must be an object",je.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let r=i.length;for(;r-- >0;){const s=i[r],a=e[s];if(a){const o=n[s],l=o===void 0||a(o,s,n);if(l!==!0)throw new je("option "+s+" must be "+l,je.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new je("Unknown option "+s,je.ERR_BAD_OPTION)}}const Ha={assertOptions:Md,validators:ho},Ti=Ha.validators;class xs{constructor(e){this.defaults=e,this.interceptors={request:new Wo,response:new Wo}}request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Bn(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;i!==void 0&&Ha.assertOptions(i,{silentJSONParsing:Ti.transitional(Ti.boolean),forcedJSONParsing:Ti.transitional(Ti.boolean),clarifyTimeoutError:Ti.transitional(Ti.boolean)},!1),r!=null&&(q.isFunction(r)?t.paramsSerializer={serialize:r}:Ha.assertOptions(r,{encode:Ti.function,serialize:Ti.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=s&&q.merge(s.common,s[t.method]);s&&q.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),t.headers=bi.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(t)===!1||(l=l&&_.synchronous,o.unshift(_.fulfilled,_.rejected))});const c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let u,h=0,d;if(!l){const g=[jo.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,c),d=g.length,u=Promise.resolve(t);h{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{i.subscribe(o),s=o}).then(r);return a.cancel=function(){i.unsubscribe(s)},a},e(function(s,a,o){i.reason||(i.reason=new yr(s,a,o),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new fo(function(r){e=r}),cancel:e}}}const bd=fo;function wd(n){return function(t){return n.apply(null,t)}}function Ed(n){return q.isObject(n)&&n.isAxiosError===!0}const Ga={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ga).forEach(([n,e])=>{Ga[e]=n});const Td=Ga;function Cu(n){const e=new ps(n),t=lu(ps.prototype.request,e);return q.extend(t,ps.prototype,e,{allOwnKeys:!0}),q.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Cu(Bn(n,r))},t}const pt=Cu(uo);pt.Axios=ps;pt.CanceledError=yr;pt.CancelToken=bd;pt.isCancel=wu;pt.VERSION=Au;pt.toFormData=Ds;pt.AxiosError=je;pt.Cancel=pt.CanceledError;pt.all=function(e){return Promise.all(e)};pt.spread=wd;pt.isAxiosError=Ed;pt.mergeConfig=Bn;pt.AxiosHeaders=bi;pt.formToJSON=n=>bu(q.isHTMLForm(n)?new FormData(n):n);pt.getAdapter=Tu.getAdapter;pt.HttpStatusCode=Td;pt.default=pt;const wt=["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 Jo=1234567;const cr=Math.PI/180,pr=180/Math.PI;function Yn(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(wt[n&255]+wt[n>>8&255]+wt[n>>16&255]+wt[n>>24&255]+"-"+wt[e&255]+wt[e>>8&255]+"-"+wt[e>>16&15|64]+wt[e>>24&255]+"-"+wt[t&63|128]+wt[t>>8&255]+"-"+wt[t>>16&255]+wt[t>>24&255]+wt[i&255]+wt[i>>8&255]+wt[i>>16&255]+wt[i>>24&255]).toLowerCase()}function Tt(n,e,t){return Math.max(e,Math.min(t,n))}function po(n,e){return(n%e+e)%e}function Ad(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function Cd(n,e,t){return n!==e?(t-n)/(e-n):0}function ur(n,e,t){return(1-t)*n+t*e}function Ld(n,e,t,i){return ur(n,e,1-Math.exp(-t*i))}function Pd(n,e=1){return e-Math.abs(po(n,e*2)-e)}function Rd(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Dd(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Id(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Nd(n,e){return n+Math.random()*(e-n)}function Od(n){return n*(.5-Math.random())}function Ud(n){n!==void 0&&(Jo=n);let e=Jo+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Fd(n){return n*cr}function kd(n){return n*pr}function Wa(n){return(n&n-1)===0&&n!==0}function zd(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function vs(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Bd(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),u=a((e+i)/2),h=s((e-i)/2),d=a((e-i)/2),m=s((i-e)/2),g=a((i-e)/2);switch(r){case"XYX":n.set(o*u,l*h,l*d,o*c);break;case"YZY":n.set(l*d,o*u,l*h,o*c);break;case"ZXZ":n.set(l*h,l*d,o*u,o*c);break;case"XZX":n.set(o*u,l*g,l*m,o*c);break;case"YXY":n.set(l*m,o*u,l*g,o*c);break;case"ZYZ":n.set(l*g,l*m,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Dn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Pt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Vd={DEG2RAD:cr,RAD2DEG:pr,generateUUID:Yn,clamp:Tt,euclideanModulo:po,mapLinear:Ad,inverseLerp:Cd,lerp:ur,damp:Ld,pingpong:Pd,smoothstep:Rd,smootherstep:Dd,randInt:Id,randFloat:Nd,randFloatSpread:Od,seededRandom:Ud,degToRad:Fd,radToDeg:kd,isPowerOfTwo:Wa,ceilPowerOfTwo:zd,floorPowerOfTwo:vs,setQuaternionFromProperEuler:Bd,normalize:Pt,denormalize:Dn},mo="160",fn={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},dn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Hd=0,Ko=1,Gd=2,Lu=1,Wd=2,vi=3,Hi=0,Ut=1,yi=2,zi=0,Un=1,Qo=2,el=3,tl=4,qd=5,Ki=100,Xd=101,Yd=102,il=103,nl=104,jd=200,Zd=201,$d=202,Jd=203,qa=204,Xa=205,Kd=206,Qd=207,ep=208,tp=209,ip=210,np=211,rp=212,sp=213,ap=214,op=0,lp=1,cp=2,ys=3,up=4,hp=5,fp=6,dp=7,go=0,pp=1,mp=2,Bi=0,gp=1,_p=2,xp=3,vp=4,yp=5,Sp=6,Pu=300,Vn=301,Hn=302,Ya=303,ja=304,Ns=306,Za=1e3,ri=1001,$a=1002,Dt=1003,rl=1004,Js=1005,qt=1006,Mp=1007,mr=1008,Vi=1009,bp=1010,wp=1011,_o=1012,Ru=1013,Fi=1014,ki=1015,gr=1016,Du=1017,Iu=1018,tn=1020,Ep=1021,si=1023,Tp=1024,Ap=1025,nn=1026,Gn=1027,Cp=1028,Nu=1029,Lp=1030,Ou=1031,Uu=1033,Ks=33776,Qs=33777,ea=33778,ta=33779,sl=35840,al=35841,ol=35842,ll=35843,Fu=36196,cl=37492,ul=37496,hl=37808,fl=37809,dl=37810,pl=37811,ml=37812,gl=37813,_l=37814,xl=37815,vl=37816,yl=37817,Sl=37818,Ml=37819,bl=37820,wl=37821,ia=36492,El=36494,Tl=36495,Pp=36283,Al=36284,Cl=36285,Ll=36286,ku=3e3,rn=3001,Rp=3200,Dp=3201,zu=0,Ip=1,Yt="",St="srgb",wi="srgb-linear",xo="display-p3",Os="display-p3-linear",Ss="linear",rt="srgb",Ms="rec709",bs="p3",pn=7680,Pl=519,Np=512,Op=513,Up=514,Bu=515,Fp=516,kp=517,zp=518,Bp=519,Rl=35044,Dl="300 es",Ja=1035,Si=2e3,ws=2001;class We{constructor(e,t,i,r,s,a,o,l,c){We.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],m=i[5],g=i[8],_=r[0],p=r[3],f=r[6],w=r[1],x=r[4],A=r[7],D=r[2],C=r[5],T=r[8];return s[0]=a*_+o*w+l*D,s[3]=a*p+o*x+l*C,s[6]=a*f+o*A+l*T,s[1]=c*_+u*w+h*D,s[4]=c*p+u*x+h*C,s[7]=c*f+u*A+h*T,s[2]=d*_+m*w+g*D,s[5]=d*p+m*x+g*C,s[8]=d*f+m*A+g*T,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,d=o*l-u*s,m=c*s-a*l,g=t*h+i*d+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(r*c-u*i)*_,e[2]=(o*i-r*a)*_,e[3]=d*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=m*_,e[7]=(i*l-c*t)*_,e[8]=(a*t-i*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(na.makeScale(e,t)),this}rotate(e){return this.premultiply(na.makeRotation(-e)),this}translate(e,t){return this.premultiply(na.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const na=new We,Il=new We().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Nl=new We().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Rr={[wi]:{transfer:Ss,primaries:Ms,toReference:n=>n,fromReference:n=>n},[St]:{transfer:rt,primaries:Ms,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Os]:{transfer:Ss,primaries:bs,toReference:n=>n.applyMatrix3(Nl),fromReference:n=>n.applyMatrix3(Il)},[xo]:{transfer:rt,primaries:bs,toReference:n=>n.convertSRGBToLinear().applyMatrix3(Nl),fromReference:n=>n.applyMatrix3(Il).convertLinearToSRGB()}},Vp=new Set([wi,Os]),et={enabled:!0,_workingColorSpace:wi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Vp.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Rr[e].toReference,r=Rr[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Rr[n].primaries},getTransfer:function(n){return n===Yt?Ss:Rr[n].transfer}};function Fn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ra(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const Vu={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},Ai={h:0,s:0,l:0},Dr={h:0,s:0,l:0};function sa(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ze{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=St){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,et.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=et.workingColorSpace){return this.r=e,this.g=t,this.b=i,et.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=et.workingColorSpace){if(e=po(e,1),t=Tt(t,0,1),i=Tt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=sa(a,s,e+1/3),this.g=sa(a,s,e),this.b=sa(a,s,e-1/3)}return et.toWorkingColorSpace(this,r),this}setStyle(e,t=St){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=St){const i=Vu[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Fn(e.r),this.g=Fn(e.g),this.b=Fn(e.b),this}copyLinearToSRGB(e){return this.r=ra(e.r),this.g=ra(e.g),this.b=ra(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=St){return et.fromWorkingColorSpace(Et.copy(this),e),Math.round(Tt(Et.r*255,0,255))*65536+Math.round(Tt(Et.g*255,0,255))*256+Math.round(Tt(Et.b*255,0,255))}getHexString(e=St){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=et.workingColorSpace){et.fromWorkingColorSpace(Et.copy(this),t);const i=Et.r,r=Et.g,s=Et.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case i:l=(r-s)/h+(r=0;--e)if(n[e]>=65535)return!0;return!1}function _r(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Wp(){const n=_r("canvas");return n.style.display="block",n}const Ul={};function hr(n){n in Ul||(Ul[n]=!0,console.warn(n))}class qp extends vo{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Ol.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=_r("img");function l(){u(),Ol.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class cn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{mn===void 0&&(mn=_r("canvas")),mn.width=e.width,mn.height=e.height;const i=mn.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=mn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=_r("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Pu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Za:e.x=e.x-Math.floor(e.x);break;case ri:e.x=e.x<0?0:1;break;case $a:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Za:e.y=e.y-Math.floor(e.y);break;case ri:e.y=e.y<0?0:1;break;case $a:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return hr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===St?rn:ku}set encoding(e){hr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===rn?St:Yt}}Ft.DEFAULT_IMAGE=null;Ft.DEFAULT_MAPPING=Pu;Ft.DEFAULT_ANISOTROPY=1;class tS extends vo{constructor(e){super(e)}load(e,t,i,r){const s=new Ft,a=new qp(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class an{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const d=s[a+0],m=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=d,e[t+1]=m,e[t+2]=g,e[t+3]=_;return}if(h!==_||l!==d||c!==m||u!==g){let p=1-o;const f=l*d+c*m+u*g+h*_,w=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const D=Math.sqrt(x),C=Math.atan2(D,f*w);p=Math.sin(p*C)/D,o=Math.sin(o*C)/D}const A=o*w;if(l=l*p+d*A,c=c*p+m*A,u=u*p+g*A,h=h*p+_*A,p===1-o){const D=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=D,c*=D,u*=D,h*=D}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[a],d=s[a+1],m=s[a+2],g=s[a+3];return e[t]=o*g+u*h+l*m-c*d,e[t+1]=l*g+u*d+c*h-o*m,e[t+2]=c*g+u*m+o*d-l*h,e[t+3]=u*g-o*h-l*d-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(r/2),h=o(s/2),d=l(i/2),m=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=d*u*h+c*m*g,this._y=c*m*h-d*u*g,this._z=c*u*g+d*m*h,this._w=c*u*h-d*m*g;break;case"YXZ":this._x=d*u*h+c*m*g,this._y=c*m*h-d*u*g,this._z=c*u*g-d*m*h,this._w=c*u*h+d*m*g;break;case"ZXY":this._x=d*u*h-c*m*g,this._y=c*m*h+d*u*g,this._z=c*u*g+d*m*h,this._w=c*u*h-d*m*g;break;case"ZYX":this._x=d*u*h-c*m*g,this._y=c*m*h+d*u*g,this._z=c*u*g-d*m*h,this._w=c*u*h+d*m*g;break;case"YZX":this._x=d*u*h+c*m*g,this._y=c*m*h+d*u*g,this._z=c*u*g-d*m*h,this._w=c*u*h-d*m*g;break;case"XZY":this._x=d*u*h-c*m*g,this._y=c*m*h-d*u*g,this._z=c*u*g+d*m*h,this._w=c*u*h+d*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+o+h;if(d>0){const m=.5/Math.sqrt(d+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(i>o&&i>h){const m=2*Math.sqrt(1+i-o-h);this._w=(u-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>h){const m=2*Math.sqrt(1+o-i-h);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+h-i-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Tt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-r*o,this._w=a*u-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=i*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(e=0,t=0,i=0){R.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Fl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Fl.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),u=2*(o*t-s*r),h=2*(s*i-a*t);return this.x=t+l*c+a*h-o*u,this.y=i+l*u+o*c-s*h,this.z=r+l*h+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return oa.copy(this).projectOnVector(e),this.sub(oa)}reflect(e){return this.sub(oa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const oa=new R,Fl=new an;class ct{constructor(e,t,i,r,s,a,o,l,c,u,h,d,m,g,_,p){ct.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,u,h,d,m,g,_,p)}set(e,t,i,r,s,a,o,l,c,u,h,d,m,g,_,p){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=u,f[10]=h,f[14]=d,f[3]=m,f[7]=g,f[11]=_,f[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ct().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/gn.setFromMatrixColumn(e,0).length(),s=1/gn.setFromMatrixColumn(e,1).length(),a=1/gn.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*u,m=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=m+g*c,t[5]=d-_*c,t[9]=-o*l,t[2]=_-d*c,t[6]=g+m*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*u,m=l*h,g=c*u,_=c*h;t[0]=d+_*o,t[4]=g*o-m,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=_+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*u,m=l*h,g=c*u,_=c*h;t[0]=d-_*o,t[4]=-a*h,t[8]=g+m*o,t[1]=m+g*o,t[5]=a*u,t[9]=_-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*u,m=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=g*c-m,t[8]=d*c+_,t[1]=l*h,t[5]=_*c+d,t[9]=m*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,m=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-d*h,t[8]=g*h+m,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=m*h+g,t[10]=d-_*h}else if(e.order==="XZY"){const d=a*l,m=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+_,t[5]=a*u,t[9]=m*h-g,t[2]=g*h-m,t[6]=o*u,t[10]=_*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(jp,e,Zp)}lookAt(e,t,i){const r=this.elements;return zt.subVectors(e,t),zt.lengthSq()===0&&(zt.z=1),zt.normalize(),Ci.crossVectors(i,zt),Ci.lengthSq()===0&&(Math.abs(i.z)===1?zt.x+=1e-4:zt.z+=1e-4,zt.normalize(),Ci.crossVectors(i,zt)),Ci.normalize(),Ir.crossVectors(zt,Ci),r[0]=Ci.x,r[4]=Ir.x,r[8]=zt.x,r[1]=Ci.y,r[5]=Ir.y,r[9]=zt.y,r[2]=Ci.z,r[6]=Ir.z,r[10]=zt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],m=i[13],g=i[2],_=i[6],p=i[10],f=i[14],w=i[3],x=i[7],A=i[11],D=i[15],C=r[0],T=r[4],H=r[8],y=r[12],b=r[1],F=r[5],G=r[9],re=r[13],P=r[2],N=r[6],V=r[10],Y=r[14],X=r[3],W=r[7],K=r[11],ie=r[15];return s[0]=a*C+o*b+l*P+c*X,s[4]=a*T+o*F+l*N+c*W,s[8]=a*H+o*G+l*V+c*K,s[12]=a*y+o*re+l*Y+c*ie,s[1]=u*C+h*b+d*P+m*X,s[5]=u*T+h*F+d*N+m*W,s[9]=u*H+h*G+d*V+m*K,s[13]=u*y+h*re+d*Y+m*ie,s[2]=g*C+_*b+p*P+f*X,s[6]=g*T+_*F+p*N+f*W,s[10]=g*H+_*G+p*V+f*K,s[14]=g*y+_*re+p*Y+f*ie,s[3]=w*C+x*b+A*P+D*X,s[7]=w*T+x*F+A*N+D*W,s[11]=w*H+x*G+A*V+D*K,s[15]=w*y+x*re+A*Y+D*ie,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],m=e[14],g=e[3],_=e[7],p=e[11],f=e[15];return g*(+s*l*h-r*c*h-s*o*d+i*c*d+r*o*m-i*l*m)+_*(+t*l*m-t*c*d+s*a*d-r*a*m+r*c*u-s*l*u)+p*(+t*c*h-t*o*m-s*a*h+i*a*m+s*o*u-i*c*u)+f*(-r*o*u-t*l*h+t*o*d+r*a*h-i*a*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],m=e[11],g=e[12],_=e[13],p=e[14],f=e[15],w=h*p*c-_*d*c+_*l*m-o*p*m-h*l*f+o*d*f,x=g*d*c-u*p*c-g*l*m+a*p*m+u*l*f-a*d*f,A=u*_*c-g*h*c+g*o*m-a*_*m-u*o*f+a*h*f,D=g*h*l-u*_*l-g*o*d+a*_*d+u*o*p-a*h*p,C=t*w+i*x+r*A+s*D;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/C;return e[0]=w*T,e[1]=(_*d*s-h*p*s-_*r*m+i*p*m+h*r*f-i*d*f)*T,e[2]=(o*p*s-_*l*s+_*r*c-i*p*c-o*r*f+i*l*f)*T,e[3]=(h*l*s-o*d*s-h*r*c+i*d*c+o*r*m-i*l*m)*T,e[4]=x*T,e[5]=(u*p*s-g*d*s+g*r*m-t*p*m-u*r*f+t*d*f)*T,e[6]=(g*l*s-a*p*s-g*r*c+t*p*c+a*r*f-t*l*f)*T,e[7]=(a*d*s-u*l*s+u*r*c-t*d*c-a*r*m+t*l*m)*T,e[8]=A*T,e[9]=(g*h*s-u*_*s-g*i*m+t*_*m+u*i*f-t*h*f)*T,e[10]=(a*_*s-g*o*s+g*i*c-t*_*c-a*i*f+t*o*f)*T,e[11]=(u*o*s-a*h*s-u*i*c+t*h*c+a*i*m-t*o*m)*T,e[12]=D*T,e[13]=(u*_*r-g*h*r+g*i*d-t*_*d-u*i*p+t*h*p)*T,e[14]=(g*o*r-a*_*r-g*i*l+t*_*l+a*i*p-t*o*p)*T,e[15]=(a*h*r-u*o*r+u*i*l-t*h*l-a*i*d+t*o*d)*T,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+i,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,d=s*c,m=s*u,g=s*h,_=a*u,p=a*h,f=o*h,w=l*c,x=l*u,A=l*h,D=i.x,C=i.y,T=i.z;return r[0]=(1-(_+f))*D,r[1]=(m+A)*D,r[2]=(g-x)*D,r[3]=0,r[4]=(m-A)*C,r[5]=(1-(d+f))*C,r[6]=(p+w)*C,r[7]=0,r[8]=(g+x)*T,r[9]=(p-w)*T,r[10]=(1-(d+_))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=gn.set(r[0],r[1],r[2]).length();const a=gn.set(r[4],r[5],r[6]).length(),o=gn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Kt.copy(this);const c=1/s,u=1/a,h=1/o;return Kt.elements[0]*=c,Kt.elements[1]*=c,Kt.elements[2]*=c,Kt.elements[4]*=u,Kt.elements[5]*=u,Kt.elements[6]*=u,Kt.elements[8]*=h,Kt.elements[9]*=h,Kt.elements[10]*=h,t.setFromRotationMatrix(Kt),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a,o=Si){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),d=(i+r)/(i-r);let m,g;if(o===Si)m=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===ws)m=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Si){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(a-s),d=(t+e)*c,m=(i+r)*u;let g,_;if(o===Si)g=(a+s)*h,_=-2*h;else if(o===ws)g=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const gn=new R,Kt=new ct,jp=new R(0,0,0),Zp=new R(1,1,1),Ci=new R,Ir=new R,zt=new R,kl=new ct,zl=new an;class Us{constructor(e=0,t=0,i=0,r=Us.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Tt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Tt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Tt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-Tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return kl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kl,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return zl.setFromEuler(this),this.setFromQuaternion(zl,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Us.DEFAULT_ORDER="XYZ";class yo{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let o=0;o0){r.animations=[];for(let o=0;o0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),m.length>0&&(i.animations=m),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;iA&&x>D?x<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(x),r=C/i,s=T/i):A>D?A<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(A),i=C/r,s=H/r):D<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(D),i=T/s,r=H/s),this.set(i,r,s,t),this}let w=Math.sqrt((p-g)*(p-g)+(h-_)*(h-_)+(d-u)*(d-u));return Math.abs(w)<.001&&(w=1),this.x=(p-g)/w,this.y=(h-_)/w,this.z=(d-u)/w,this.w=Math.acos((c+m+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Sr{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Qt),Qt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ir),Ur.subVectors(this.max,ir),xn.subVectors(e.a,ir),vn.subVectors(e.b,ir),yn.subVectors(e.c,ir),Li.subVectors(vn,xn),Pi.subVectors(yn,vn),qi.subVectors(xn,yn);let t=[0,-Li.z,Li.y,0,-Pi.z,Pi.y,0,-qi.z,qi.y,Li.z,0,-Li.x,Pi.z,0,-Pi.x,qi.z,0,-qi.x,-Li.y,Li.x,0,-Pi.y,Pi.x,0,-qi.y,qi.x,0];return!la(t,xn,vn,yn,Ur)||(t=[1,0,0,0,1,0,0,0,1],!la(t,xn,vn,yn,Ur))?!1:(Fr.crossVectors(Li,Pi),t=[Fr.x,Fr.y,Fr.z],la(t,xn,vn,yn,Ur))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(mi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const mi=[new R,new R,new R,new R,new R,new R,new R,new R],Qt=new R,Or=new Sr,xn=new R,vn=new R,yn=new R,Li=new R,Pi=new R,qi=new R,ir=new R,Ur=new R,Fr=new R,Xi=new R;function la(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Xi.fromArray(n,s);const o=r.x*Math.abs(Xi.x)+r.y*Math.abs(Xi.y)+r.z*Math.abs(Xi.z),l=e.dot(Xi),c=t.dot(Xi),u=i.dot(Xi);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const im=new Sr,nr=new R,ca=new R;class Mr{constructor(e=new R,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):im.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;nr.subVectors(e,this.center);const t=nr.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(nr,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ca.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(nr.copy(e.center).add(ca)),this.expandByPoint(nr.copy(e.center).sub(ca))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ua=new R,nm=new R,rm=new We;class Ni{constructor(e=new R(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=ua.subVectors(i,t).cross(nm.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(ua),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||rm.getNormalMatrix(e),r=this.coplanarPoint(ua).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Yi=new Mr,kr=new R;class So{constructor(e=new Ni,t=new Ni,i=new Ni,r=new Ni,s=new Ni,a=new Ni){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Si){const i=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],h=r[6],d=r[7],m=r[8],g=r[9],_=r[10],p=r[11],f=r[12],w=r[13],x=r[14],A=r[15];if(i[0].setComponents(l-s,d-c,p-m,A-f).normalize(),i[1].setComponents(l+s,d+c,p+m,A+f).normalize(),i[2].setComponents(l+a,d+u,p+g,A+w).normalize(),i[3].setComponents(l-a,d-u,p-g,A-w).normalize(),i[4].setComponents(l-o,d-h,p-_,A-x).normalize(),t===Si)i[5].setComponents(l+o,d+h,p+_,A+x).normalize();else if(t===ws)i[5].setComponents(o,h,_,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Yi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Yi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Yi)}intersectsSprite(e){return Yi.center.set(0,0,0),Yi.radius=.7071067811865476,Yi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Yi)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,kr.y=r.normal.y>0?e.max.y:e.min.y,kr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(kr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const ha=new ct,Wl=new R,ql=new R;class sm{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new De(512,512),this.map=null,this.mapPass=null,this.matrix=new ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new So,this._frameExtents=new De(1,1),this._viewportCount=1,this._viewports=[new st(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Wl.setFromMatrixPosition(e.matrixWorld),t.position.copy(Wl),ql.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ql),t.updateMatrixWorld(),ha.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ha),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ha)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class qu extends Mt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,this.coordinateSystem=Si}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Xt extends qu{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=pr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(cr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return pr*2*Math.atan(Math.tan(cr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(cr*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Xl=new ct,rr=new R,fa=new R;class am extends sm{constructor(){super(new Xt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new De(4,2),this._viewportCount=6,this._viewports=[new st(2,1,1,1),new st(0,1,1,1),new st(3,1,1,1),new st(1,1,1,1),new st(3,0,1,1),new st(1,0,1,1)],this._cubeDirections=[new R(1,0,0),new R(-1,0,0),new R(0,0,1),new R(0,0,-1),new R(0,1,0),new R(0,-1,0)],this._cubeUps=[new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,0,1),new R(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),rr.setFromMatrixPosition(e.matrixWorld),i.position.copy(rr),fa.copy(i.position),fa.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(fa),i.updateMatrixWorld(),r.makeTranslation(-rr.x,-rr.y,-rr.z),Xl.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xl)}}class iS extends tm{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new am}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}let om=0;class un extends cn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:om++}),this.uuid=Yn(),this.name="",this.type="Material",this.blending=Un,this.side=Hi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=qa,this.blendDst=Xa,this.blendEquation=Ki,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ze(0,0,0),this.blendAlpha=0,this.depthFunc=ys,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Pl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=pn,this.stencilZFail=pn,this.stencilZPass=pn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Un&&(i.blending=this.blending),this.side!==Hi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==qa&&(i.blendSrc=this.blendSrc),this.blendDst!==Xa&&(i.blendDst=this.blendDst),this.blendEquation!==Ki&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ys&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Pl&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==pn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==pn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==pn&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class nS extends un{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ze(16777215),this.specular=new Ze(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=zu,this.normalScale=new De(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=go,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Xu extends un{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ze(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}class lm extends un{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ze(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}function Wn(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function Rt(n){const e={};for(let t=0;t0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}const gi=new R,da=new R,zr=new R,Ri=new R,pa=new R,Br=new R,ma=new R;class br{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,gi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=gi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(gi.copy(this.origin).addScaledVector(this.direction,t),gi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){da.copy(e).add(t).multiplyScalar(.5),zr.copy(t).sub(e).normalize(),Ri.copy(this.origin).sub(da);const s=e.distanceTo(t)*.5,a=-this.direction.dot(zr),o=Ri.dot(this.direction),l=-Ri.dot(zr),c=Ri.lengthSq(),u=Math.abs(1-a*a);let h,d,m,g;if(u>0)if(h=a*l-o,d=a*o-l,g=s*u,h>=0)if(d>=-g)if(d<=g){const _=1/u;h*=_,d*=_,m=h*(h+a*d+2*o)+d*(a*h+d+2*l)+c}else d=s,h=Math.max(0,-(a*d+o)),m=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(a*d+o)),m=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-l),s),m=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-s,-l),s),m=d*(d+2*l)+c):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-l),s),m=-h*h+d*(d+2*l)+c);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),m=-h*h+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(da).addScaledVector(zr,d),m}intersectSphere(e,t){gi.subVectors(e.center,this.origin);const i=gi.dot(this.direction),r=gi.dot(gi)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a=0?(o=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||o>r)||((o>i||i!==i)&&(i=o),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,gi)!==null}intersectTriangle(e,t,i,r,s){pa.subVectors(t,e),Br.subVectors(i,e),ma.crossVectors(pa,Br);let a=this.direction.dot(ma),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Ri.subVectors(this.origin,e);const l=o*this.direction.dot(Br.crossVectors(Ri,Br));if(l<0)return null;const c=o*this.direction.dot(pa.cross(Ri));if(c<0||l+c>a)return null;const u=-o*Ri.dot(ma);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}const ei=new R,_i=new R,ga=new R,xi=new R,Sn=new R,Mn=new R,Yl=new R,_a=new R,xa=new R,va=new R;let Vr=!1;class ni{constructor(e=new R,t=new R,i=new R){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),ei.subVectors(e,t),r.cross(ei);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ei.subVectors(r,t),_i.subVectors(i,t),ga.subVectors(e,t);const a=ei.dot(ei),o=ei.dot(_i),l=ei.dot(ga),c=_i.dot(_i),u=_i.dot(ga),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const d=1/h,m=(c*l-o*u)*d,g=(a*u-o*l)*d;return s.set(1-m-g,g,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,xi)===null?!1:xi.x>=0&&xi.y>=0&&xi.x+xi.y<=1}static getUV(e,t,i,r,s,a,o,l){return Vr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Vr=!0),this.getInterpolation(e,t,i,r,s,a,o,l)}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,xi)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,xi.x),l.addScaledVector(a,xi.y),l.addScaledVector(o,xi.z),l)}static isFrontFacing(e,t,i,r){return ei.subVectors(i,t),_i.subVectors(e,t),ei.cross(_i).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ei.subVectors(this.c,this.b),_i.subVectors(this.a,this.b),ei.cross(_i).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ni.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ni.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return Vr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Vr=!0),ni.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return ni.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ni.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ni.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;Sn.subVectors(r,i),Mn.subVectors(s,i),_a.subVectors(e,i);const l=Sn.dot(_a),c=Mn.dot(_a);if(l<=0&&c<=0)return t.copy(i);xa.subVectors(e,r);const u=Sn.dot(xa),h=Mn.dot(xa);if(u>=0&&h<=u)return t.copy(r);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(Sn,a);va.subVectors(e,s);const m=Sn.dot(va),g=Mn.dot(va);if(g>=0&&m<=g)return t.copy(s);const _=m*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(i).addScaledVector(Mn,o);const p=u*g-m*h;if(p<=0&&h-u>=0&&m-g>=0)return Yl.subVectors(s,r),o=(h-u)/(h-u+(m-g)),t.copy(r).addScaledVector(Yl,o);const f=1/(p+_+d);return a=_*f,o=d*f,t.copy(i).addScaledVector(Sn,a).addScaledVector(Mn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Mo extends un{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=go,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ft=new R,Hr=new De;class hi{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Rl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ki,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,m=h.length;d0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(e.far-e.near)**2))&&(jl.copy(s).invert(),ji.copy(e.ray).applyMatrix4(jl),!(i.boundingBox!==null&&ji.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ji)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const p=d[g],f=a[p.materialIndex],w=Math.max(p.start,m.start),x=Math.min(o.count,Math.min(p.start+p.count,m.start+m.count));for(let A=w,D=x;At.far?null:{distance:c,point:Zr.clone(),object:n}}function $r(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,wn),n.getVertexPosition(l,En),n.getVertexPosition(c,Tn);const u=pm(n,e,t,i,wn,En,Tn,jr);if(u){r&&(qr.fromBufferAttribute(r,o),Xr.fromBufferAttribute(r,l),Yr.fromBufferAttribute(r,c),u.uv=ni.getInterpolation(jr,wn,En,Tn,qr,Xr,Yr,new De)),s&&(qr.fromBufferAttribute(s,o),Xr.fromBufferAttribute(s,l),Yr.fromBufferAttribute(s,c),u.uv1=ni.getInterpolation(jr,wn,En,Tn,qr,Xr,Yr,new De),u.uv2=u.uv1),a&&($l.fromBufferAttribute(a,o),Jl.fromBufferAttribute(a,l),Kl.fromBufferAttribute(a,c),u.normal=ni.getInterpolation(jr,wn,En,Tn,$l,Jl,Kl,new R),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new R,materialIndex:0};ni.getNormal(wn,En,Tn,h.normal),u.face=h}return u}class Jr extends Mt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ql=new R,ec=new R,tc=new ct,Ma=new br,Kr=new Mr;class mm extends Mt{constructor(e=new Jt,t=new Xu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;rl)continue;d.applyMatrix4(this.matrixWorld);const H=e.ray.origin.distanceTo(d);He.far||t.push({distance:H,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,a.start),w=Math.min(p.count,a.start+a.count);for(let x=f,A=w-1;xl)continue;d.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(d);Ce.far||t.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class $u extends Jt{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(a+o,Math.PI);let c=0;const u=[],h=new R,d=new R,m=[],g=[],_=[],p=[];for(let f=0;f<=i;f++){const w=[],x=f/i;let A=0;f===0&&a===0?A=.5/t:f===i&&l===Math.PI&&(A=-.5/t);for(let D=0;D<=t;D++){const C=D/t;h.x=-e*Math.cos(r+C*s)*Math.sin(a+x*o),h.y=e*Math.cos(a+x*o),h.z=e*Math.sin(r+C*s)*Math.sin(a+x*o),g.push(h.x,h.y,h.z),d.copy(h).normalize(),_.push(d.x,d.y,d.z),p.push(C+A,1-x),w.push(c++)}u.push(w)}for(let f=0;f0)&&m.push(x,A,C),(f!==i-1||l0?1:-1,u.push(W.x,W.y,W.z),h.push(de/T),h.push(1-K/H),Y+=1}}for(let K=0;K0 -vec4 plane; -#pragma unroll_loop_start -for(int i=0;iplane.w)discard;} -#pragma unroll_loop_end -#if UNION_CLIPPING_PLANESplane.w)&&clipped;} -#pragma unroll_loop_end -if(clipped)discard; -#endif -#endif`,Im=`#if NUM_CLIPPING_PLANES>0 -varying vec3 vClipPosition;uniform vec4 clippingPlanes[NUM_CLIPPING_PLANES]; -#endif`,Nm=`#if NUM_CLIPPING_PLANES>0 -varying vec3 vClipPosition; -#endif`,Om=`#if NUM_CLIPPING_PLANES>0 -vClipPosition=-mvPosition.xyz; -#endif`,Um=`#if defined(USE_COLOR_ALPHA) -diffuseColor*=vColor; -#elif defined(USE_COLOR) -diffuseColor.rgb*=vColor; -#endif`,Fm=`#if defined(USE_COLOR_ALPHA) -varying vec4 vColor; -#elif defined(USE_COLOR) -varying vec3 vColor; -#endif`,km=`#if defined(USE_COLOR_ALPHA) -varying vec4 vColor; -#elif defined(USE_COLOR)||defined(USE_INSTANCING_COLOR) -varying vec3 vColor; -#endif`,zm=`#if defined(USE_COLOR_ALPHA) -vColor=vec4(1.0); -#elif defined(USE_COLOR)||defined(USE_INSTANCING_COLOR) -vColor=vec3(1.0); -#endif -#ifdef USE_COLOR -vColor*=color; -#endif -#ifdef USE_INSTANCING_COLOR -vColor.xyz*=instanceColor.xyz; -#endif`,Bm=`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate(a)clamp(a,0.0,1.0) -#endif -#define whiteComplement(a)(1.0-saturate(a)) -float pow2(const in float x){return x*x;}vec3 pow2(const in vec3 x){return x*x;}float pow3(const in float x){return x*x*x;}float pow4(const in float x){float x2=x*x;return x2*x2;}float max3(const in vec3 v){return max(max(v.x,v.y),v.z);}float average(const in vec3 v){return dot(v,vec3(0.3333333));}highp float rand(const in vec2 uv){const highp float a=12.9898,b=78.233,c=43758.5453;highp float dt=dot(uv.xy,vec2(a,b)),sn=mod(dt,PI);return fract(sin(sn)*c);} -#ifdef HIGH_PRECISION -float precisionSafeLength(vec3 v){return length(v);} -#else -float precisionSafeLength(vec3 v){float maxComponent=max3(abs(v));return length(v/maxComponent)*maxComponent;} -#endif -struct IncidentLight{vec3 color;vec3 direction;bool visible;};struct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;}; -#ifdef USE_ALPHAHASH -varying vec3 vPosition; -#endif -vec3 transformDirection(in vec3 dir,in mat4 matrix){return normalize((matrix*vec4(dir,0.0)).xyz);}vec3 inverseTransformDirection(in vec3 dir,in mat4 matrix){return normalize((vec4(dir,0.0)*matrix).xyz);}mat3 transposeMat3(const in mat3 m){mat3 tmp;tmp[0]=vec3(m[0].x,m[1].x,m[2].x);tmp[1]=vec3(m[0].y,m[1].y,m[2].y);tmp[2]=vec3(m[0].z,m[1].z,m[2].z);return tmp;}float luminance(const in vec3 rgb){const vec3 weights=vec3(0.2126729,0.7151522,0.0721750);return dot(weights,rgb);}bool isPerspectiveMatrix(mat4 m){return m[2][3]==-1.0;}vec2 equirectUv(in vec3 dir){float u=atan(dir.z,dir.x)*RECIPROCAL_PI2+0.5;float v=asin(clamp(dir.y,-1.0,1.0))*RECIPROCAL_PI+0.5;return vec2(u,v);}vec3 BRDF_Lambert(const in vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}vec3 F_Schlick(const in vec3 f0,const in float f90,const in float dotVH){float fresnel=exp2((-5.55473*dotVH-6.98316)*dotVH);return f0*(1.0-fresnel)+(f90*fresnel);}float F_Schlick(const in float f0,const in float f90,const in float dotVH){float fresnel=exp2((-5.55473*dotVH-6.98316)*dotVH);return f0*(1.0-fresnel)+(f90*fresnel);}`,Vm=`#ifdef ENVMAP_TYPE_CUBE_UV -#define cubeUV_minMipLevel 4.0 -#define cubeUV_minTileSize 16.0 -float getFace(vec3 direction){vec3 absDirection=abs(direction);float face=-1.0;if(absDirection.x>absDirection.z){if(absDirection.x>absDirection.y)face=direction.x>0.0?0.0:3.0;else face=direction.y>0.0?1.0:4.0;}else{if(absDirection.z>absDirection.y)face=direction.z>0.0?2.0:5.0;else face=direction.y>0.0?1.0:4.0;}return face;}vec2 getUV(vec3 direction,float face){vec2 uv;if(face==0.0){uv=vec2(direction.z,direction.y)/abs(direction.x);}else if(face==1.0){uv=vec2(-direction.x,-direction.z)/abs(direction.y);}else if(face==2.0){uv=vec2(-direction.x,direction.y)/abs(direction.z);}else if(face==3.0){uv=vec2(-direction.z,direction.y)/abs(direction.x);}else if(face==4.0){uv=vec2(-direction.x,direction.z)/abs(direction.y);}else{uv=vec2(direction.x,direction.y)/abs(direction.z);}return 0.5*(uv+1.0);}vec3 bilinearCubeUV(sampler2D envMap,vec3 direction,float mipInt){float face=getFace(direction);float filterInt=max(cubeUV_minMipLevel-mipInt,0.0);mipInt=max(mipInt,cubeUV_minMipLevel);float faceSize=exp2(mipInt);highp vec2 uv=getUV(direction,face)*(faceSize-2.0)+1.0;if(face>2.0){uv.y+=faceSize;face-=3.0;}uv.x+=face*faceSize;uv.x+=filterInt*3.0*cubeUV_minTileSize;uv.y+=4.0*(exp2(CUBEUV_MAX_MIP)-faceSize);uv.x*=CUBEUV_TEXEL_WIDTH;uv.y*=CUBEUV_TEXEL_HEIGHT; -#ifdef texture2DGradEXT -return texture2DGradEXT(envMap,uv,vec2(0.0),vec2(0.0)).rgb; -#else -return texture2D(envMap,uv).rgb; -#endif -} -#define cubeUV_r0 1.0 -#define cubeUV_m0-2.0 -#define cubeUV_r1 0.8 -#define cubeUV_m1-1.0 -#define cubeUV_r4 0.4 -#define cubeUV_m4 2.0 -#define cubeUV_r5 0.305 -#define cubeUV_m5 3.0 -#define cubeUV_r6 0.21 -#define cubeUV_m6 4.0 -float roughnessToMip(float roughness){float mip=0.0;if(roughness>=cubeUV_r1){mip=(cubeUV_r0-roughness)*(cubeUV_m1-cubeUV_m0)/(cubeUV_r0-cubeUV_r1)+cubeUV_m0;}else if(roughness>=cubeUV_r4){mip=(cubeUV_r1-roughness)*(cubeUV_m4-cubeUV_m1)/(cubeUV_r1-cubeUV_r4)+cubeUV_m1;}else if(roughness>=cubeUV_r5){mip=(cubeUV_r4-roughness)*(cubeUV_m5-cubeUV_m4)/(cubeUV_r4-cubeUV_r5)+cubeUV_m4;}else if(roughness>=cubeUV_r6){mip=(cubeUV_r5-roughness)*(cubeUV_m6-cubeUV_m5)/(cubeUV_r5-cubeUV_r6)+cubeUV_m5;}else{mip=-2.0*log2(1.16*roughness);}return mip;}vec4 textureCubeUV(sampler2D envMap,vec3 sampleDir,float roughness){float mip=clamp(roughnessToMip(roughness),cubeUV_m0,CUBEUV_MAX_MIP);float mipF=fract(mip);float mipInt=floor(mip);vec3 color0=bilinearCubeUV(envMap,sampleDir,mipInt);if(mipF==0.0){return vec4(color0,1.0);}else{vec3 color1=bilinearCubeUV(envMap,sampleDir,mipInt+1.0);return vec4(mix(color0,color1,mipF),1.0);}} -#endif`,Hm=`vec3 transformedNormal=objectNormal; -#ifdef USE_TANGENT -vec3 transformedTangent=objectTangent; -#endif -#ifdef USE_BATCHING -mat3 bm=mat3(batchingMatrix);transformedNormal/=vec3(dot(bm[0],bm[0]),dot(bm[1],bm[1]),dot(bm[2],bm[2]));transformedNormal=bm*transformedNormal; -#ifdef USE_TANGENT -transformedTangent=bm*transformedTangent; -#endif -#endif -#ifdef USE_INSTANCING -mat3 im=mat3(instanceMatrix);transformedNormal/=vec3(dot(im[0],im[0]),dot(im[1],im[1]),dot(im[2],im[2]));transformedNormal=im*transformedNormal; -#ifdef USE_TANGENT -transformedTangent=im*transformedTangent; -#endif -#endif -transformedNormal=normalMatrix*transformedNormal; -#ifdef FLIP_SIDED -transformedNormal=-transformedNormal; -#endif -#ifdef USE_TANGENT -transformedTangent=(modelViewMatrix*vec4(transformedTangent,0.0)).xyz; -#ifdef FLIP_SIDED -transformedTangent=-transformedTangent; -#endif -#endif`,Gm=`#ifdef USE_DISPLACEMENTMAP -uniform sampler2D displacementMap;uniform float displacementScale;uniform float displacementBias; -#endif`,Wm=`#ifdef USE_DISPLACEMENTMAP -transformed+=normalize(objectNormal)*(texture2D(displacementMap,vDisplacementMapUv).x*displacementScale+displacementBias); -#endif`,qm=`#ifdef USE_EMISSIVEMAP -vec4 emissiveColor=texture2D(emissiveMap,vEmissiveMapUv);totalEmissiveRadiance*=emissiveColor.rgb; -#endif`,Xm=`#ifdef USE_EMISSIVEMAP -uniform sampler2D emissiveMap; -#endif`,Ym="gl_FragColor=linearToOutputTexel(gl_FragColor);",jm="const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3=mat3(vec3(0.8224621,0.177538,0.0),vec3(0.0331941,0.9668058,0.0),vec3(0.0170827,0.0723974,0.9105199));const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB=mat3(vec3(1.2249401,-0.2249404,0.0),vec3(-0.0420569,1.0420571,0.0),vec3(-0.0196376,-0.0786361,1.0982735));vec4 LinearSRGBToLinearDisplayP3(in vec4 value){return vec4(value.rgb*LINEAR_SRGB_TO_LINEAR_DISPLAY_P3,value.a);}vec4 LinearDisplayP3ToLinearSRGB(in vec4 value){return vec4(value.rgb*LINEAR_DISPLAY_P3_TO_LINEAR_SRGB,value.a);}vec4 LinearTransferOETF(in vec4 value){return value;}vec4 sRGBTransferOETF(in vec4 value){return vec4(mix(pow(value.rgb,vec3(0.41666))*1.055-vec3(0.055),value.rgb*12.92,vec3(lessThanEqual(value.rgb,vec3(0.0031308)))),value.a);}vec4 LinearToLinear(in vec4 value){return value;}vec4 LinearTosRGB(in vec4 value){return sRGBTransferOETF(value);}",Zm=`#ifdef USE_ENVMAP -#ifdef ENV_WORLDPOS -vec3 cameraToFrag;if(isOrthographic){cameraToFrag=normalize(vec3(-viewMatrix[0][2],-viewMatrix[1][2],-viewMatrix[2][2]));}else{cameraToFrag=normalize(vWorldPosition-cameraPosition);}vec3 worldNormal=inverseTransformDirection(normal,viewMatrix); -#ifdef ENVMAP_MODE_REFLECTION -vec3 reflectVec=reflect(cameraToFrag,worldNormal); -#else -vec3 reflectVec=refract(cameraToFrag,worldNormal,refractionRatio); -#endif -#else -vec3 reflectVec=vReflect; -#endif -#ifdef ENVMAP_TYPE_CUBE -vec4 envColor=textureCube(envMap,vec3(flipEnvMap*reflectVec.x,reflectVec.yz)); -#else -vec4 envColor=vec4(0.0); -#endif -#ifdef ENVMAP_BLENDING_MULTIPLY -outgoingLight=mix(outgoingLight,outgoingLight*envColor.xyz,specularStrength*reflectivity); -#elif defined(ENVMAP_BLENDING_MIX) -outgoingLight=mix(outgoingLight,envColor.xyz,specularStrength*reflectivity); -#elif defined(ENVMAP_BLENDING_ADD) -outgoingLight+=envColor.xyz*specularStrength*reflectivity; -#endif -#endif`,$m=`#ifdef USE_ENVMAP -uniform float envMapIntensity;uniform float flipEnvMap; -#ifdef ENVMAP_TYPE_CUBE -uniform samplerCube envMap; -#else -uniform sampler2D envMap; -#endif -#endif`,Jm=`#ifdef USE_ENVMAP -uniform float reflectivity; -#if defined(USE_BUMPMAP)||defined(USE_NORMALMAP)||defined(PHONG)||defined(LAMBERT) -#define ENV_WORLDPOS -#endif -#ifdef ENV_WORLDPOS -varying vec3 vWorldPosition;uniform float refractionRatio; -#else -varying vec3 vReflect; -#endif -#endif`,Km=`#ifdef USE_ENVMAP -#if defined(USE_BUMPMAP)||defined(USE_NORMALMAP)||defined(PHONG)||defined(LAMBERT) -#define ENV_WORLDPOS -#endif -#ifdef ENV_WORLDPOS -varying vec3 vWorldPosition; -#else -varying vec3 vReflect;uniform float refractionRatio; -#endif -#endif`,Qm=`#ifdef USE_ENVMAP -#ifdef ENV_WORLDPOS -vWorldPosition=worldPosition.xyz; -#else -vec3 cameraToVertex;if(isOrthographic){cameraToVertex=normalize(vec3(-viewMatrix[0][2],-viewMatrix[1][2],-viewMatrix[2][2]));}else{cameraToVertex=normalize(worldPosition.xyz-cameraPosition);}vec3 worldNormal=inverseTransformDirection(transformedNormal,viewMatrix); -#ifdef ENVMAP_MODE_REFLECTION -vReflect=reflect(cameraToVertex,worldNormal); -#else -vReflect=refract(cameraToVertex,worldNormal,refractionRatio); -#endif -#endif -#endif`,eg=`#ifdef USE_FOG -vFogDepth=-mvPosition.z; -#endif`,tg=`#ifdef USE_FOG -varying float vFogDepth; -#endif`,ig=`#ifdef USE_FOG -#ifdef FOG_EXP2 -float fogFactor=1.0-exp(-fogDensity*fogDensity*vFogDepth*vFogDepth); -#else -float fogFactor=smoothstep(fogNear,fogFar,vFogDepth); -#endif -gl_FragColor.rgb=mix(gl_FragColor.rgb,fogColor,fogFactor); -#endif`,ng=`#ifdef USE_FOG -uniform vec3 fogColor;varying float vFogDepth; -#ifdef FOG_EXP2 -uniform float fogDensity; -#else -uniform float fogNear;uniform float fogFar; -#endif -#endif`,rg=`#ifdef USE_GRADIENTMAP -uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance(vec3 normal,vec3 lightDirection){float dotNL=dot(normal,lightDirection);vec2 coord=vec2(dotNL*0.5+0.5,0.0); -#ifdef USE_GRADIENTMAP -return vec3(texture2D(gradientMap,coord).r); -#else -vec2 fw=fwidth(coord)*0.5;return mix(vec3(0.7),vec3(1.0),smoothstep(0.7-fw.x,0.7+fw.x,coord.x)); -#endif -}`,sg=`#ifdef USE_LIGHTMAP -vec4 lightMapTexel=texture2D(lightMap,vLightMapUv);vec3 lightMapIrradiance=lightMapTexel.rgb*lightMapIntensity;reflectedLight.indirectDiffuse+=lightMapIrradiance; -#endif`,ag=`#ifdef USE_LIGHTMAP -uniform sampler2D lightMap;uniform float lightMapIntensity; -#endif`,og="LambertMaterial material;material.diffuseColor=diffuseColor.rgb;material.specularStrength=specularStrength;",lg=`varying vec3 vViewPosition;struct LambertMaterial{vec3 diffuseColor;float specularStrength;};void 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){float dotNL=saturate(dot(geometryNormal,directLight.direction));vec3 irradiance=dotNL*directLight.color;reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,cg=`uniform bool receiveShadow;uniform vec3 ambientLightColor; -#if defined(USE_LIGHT_PROBES) -uniform vec3 lightProbe[9]; -#endif -vec3 shGetIrradianceAt(in vec3 normal,in vec3 shCoefficients[9]){float x=normal.x,y=normal.y,z=normal.z;vec3 result=shCoefficients[0]*0.886227;result+=shCoefficients[1]*2.0*0.511664*y;result+=shCoefficients[2]*2.0*0.511664*z;result+=shCoefficients[3]*2.0*0.511664*x;result+=shCoefficients[4]*2.0*0.429043*x*y;result+=shCoefficients[5]*2.0*0.429043*y*z;result+=shCoefficients[6]*(0.743125*z*z-0.247708);result+=shCoefficients[7]*2.0*0.429043*x*z;result+=shCoefficients[8]*0.429043*(x*x-y*y);return result;}vec3 getLightProbeIrradiance(const in vec3 lightProbe[9],const in vec3 normal){vec3 worldNormal=inverseTransformDirection(normal,viewMatrix);vec3 irradiance=shGetIrradianceAt(worldNormal,lightProbe);return irradiance;}vec3 getAmbientLightIrradiance(const in vec3 ambientLightColor){vec3 irradiance=ambientLightColor;return irradiance;}float getDistanceAttenuation(const in float lightDistance,const in float cutoffDistance,const in float decayExponent){ -#if defined(LEGACY_LIGHTS) -if(cutoffDistance>0.0&&decayExponent>0.0){return pow(saturate(-lightDistance/cutoffDistance+1.0),decayExponent);}return 1.0; -#else -float distanceFalloff=1.0/max(pow(lightDistance,decayExponent),0.01);if(cutoffDistance>0.0){distanceFalloff*=pow2(saturate(1.0-pow4(lightDistance/cutoffDistance)));}return distanceFalloff; -#endif -}float getSpotAttenuation(const in float coneCosine,const in float penumbraCosine,const in float angleCosine){return smoothstep(coneCosine,penumbraCosine,angleCosine);} -#if NUM_DIR_LIGHTS>0 -struct DirectionalLight{vec3 direction;vec3 color;};uniform DirectionalLight directionalLights[NUM_DIR_LIGHTS];void getDirectionalLightInfo(const in DirectionalLight directionalLight,out IncidentLight light){light.color=directionalLight.color;light.direction=directionalLight.direction;light.visible=true;} -#endif -#if NUM_POINT_LIGHTS>0 -struct PointLight{vec3 position;vec3 color;float distance;float decay;};uniform PointLight pointLights[NUM_POINT_LIGHTS];void getPointLightInfo(const in PointLight pointLight,const in vec3 geometryPosition,out IncidentLight light){vec3 lVector=pointLight.position-geometryPosition;light.direction=normalize(lVector);float lightDistance=length(lVector);light.color=pointLight.color;light.color*=getDistanceAttenuation(lightDistance,pointLight.distance,pointLight.decay);light.visible=(light.color!=vec3(0.0));} -#endif -#if NUM_SPOT_LIGHTS>0 -struct SpotLight{vec3 position;vec3 direction;vec3 color;float distance;float decay;float coneCos;float penumbraCos;};uniform SpotLight spotLights[NUM_SPOT_LIGHTS];void getSpotLightInfo(const in SpotLight spotLight,const in vec3 geometryPosition,out IncidentLight light){vec3 lVector=spotLight.position-geometryPosition;light.direction=normalize(lVector);float angleCos=dot(light.direction,spotLight.direction);float spotAttenuation=getSpotAttenuation(spotLight.coneCos,spotLight.penumbraCos,angleCos);if(spotAttenuation>0.0){float lightDistance=length(lVector);light.color=spotLight.color*spotAttenuation;light.color*=getDistanceAttenuation(lightDistance,spotLight.distance,spotLight.decay);light.visible=(light.color!=vec3(0.0));}else{light.color=vec3(0.0);light.visible=false;}} -#endif -#if NUM_RECT_AREA_LIGHTS>0 -struct RectAreaLight{vec3 color;vec3 position;vec3 halfWidth;vec3 halfHeight;};uniform sampler2D ltc_1;uniform sampler2D ltc_2;uniform RectAreaLight rectAreaLights[NUM_RECT_AREA_LIGHTS]; -#endif -#if NUM_HEMI_LIGHTS>0 -struct HemisphereLight{vec3 direction;vec3 skyColor;vec3 groundColor;};uniform HemisphereLight hemisphereLights[NUM_HEMI_LIGHTS];vec3 getHemisphereLightIrradiance(const in HemisphereLight hemiLight,const in vec3 normal){float dotNL=dot(normal,hemiLight.direction);float hemiDiffuseWeight=0.5*dotNL+0.5;vec3 irradiance=mix(hemiLight.groundColor,hemiLight.skyColor,hemiDiffuseWeight);return irradiance;} -#endif`,ug=`#ifdef USE_ENVMAP -vec3 getIBLIrradiance(const in vec3 normal){ -#ifdef ENVMAP_TYPE_CUBE_UV -vec3 worldNormal=inverseTransformDirection(normal,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,worldNormal,1.0);return PI*envMapColor.rgb*envMapIntensity; -#else -return vec3(0.0); -#endif -}vec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness){ -#ifdef ENVMAP_TYPE_CUBE_UV -vec3 reflectVec=reflect(-viewDir,normal);reflectVec=normalize(mix(reflectVec,normal,roughness*roughness));reflectVec=inverseTransformDirection(reflectVec,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,reflectVec,roughness);return envMapColor.rgb*envMapIntensity; -#else -return vec3(0.0); -#endif -} -#ifdef USE_ANISOTROPY -vec3 getIBLAnisotropyRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness,const in vec3 bitangent,const in float anisotropy){ -#ifdef ENVMAP_TYPE_CUBE_UV -vec3 bentNormal=cross(bitangent,viewDir);bentNormal=normalize(cross(bentNormal,bitangent));bentNormal=normalize(mix(bentNormal,normal,pow2(pow2(1.0-anisotropy*(1.0-roughness)))));return getIBLRadiance(viewDir,bentNormal,roughness); -#else -return vec3(0.0); -#endif -} -#endif -#endif`,hg="ToonMaterial material;material.diffuseColor=diffuseColor.rgb;",fg=`varying vec3 vViewPosition;struct ToonMaterial{vec3 diffuseColor;};void 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){vec3 irradiance=getGradientIrradiance(geometryNormal,directLight.direction)*directLight.color;reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,dg="BlinnPhongMaterial material;material.diffuseColor=diffuseColor.rgb;material.specularColor=specular;material.specularShininess=shininess;material.specularStrength=specularStrength;",pg=`varying vec3 vViewPosition;struct BlinnPhongMaterial{vec3 diffuseColor;vec3 specularColor;float specularShininess;float specularStrength;};void 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){float dotNL=saturate(dot(geometryNormal,directLight.direction));vec3 irradiance=dotNL*directLight.color;reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);reflectedLight.directSpecular+=irradiance*BRDF_BlinnPhong(directLight.direction,geometryViewDir,geometryNormal,material.specularColor,material.specularShininess)*material.specularStrength;}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,mg=`PhysicalMaterial material;material.diffuseColor=diffuseColor.rgb*(1.0-metalnessFactor);vec3 dxy=max(abs(dFdx(nonPerturbedNormal)),abs(dFdy(nonPerturbedNormal)));float geometryRoughness=max(max(dxy.x,dxy.y),dxy.z);material.roughness=max(roughnessFactor,0.0525);material.roughness+=geometryRoughness;material.roughness=min(material.roughness,1.0); -#ifdef IOR -material.ior=ior; -#ifdef USE_SPECULAR -float specularIntensityFactor=specularIntensity;vec3 specularColorFactor=specularColor; -#ifdef USE_SPECULAR_COLORMAP -specularColorFactor*=texture2D(specularColorMap,vSpecularColorMapUv).rgb; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP -specularIntensityFactor*=texture2D(specularIntensityMap,vSpecularIntensityMapUv).a; -#endif -material.specularF90=mix(specularIntensityFactor,1.0,metalnessFactor); -#else -float specularIntensityFactor=1.0;vec3 specularColorFactor=vec3(1.0);material.specularF90=1.0; -#endif -material.specularColor=mix(min(pow2((material.ior-1.0)/(material.ior+1.0))*specularColorFactor,vec3(1.0))*specularIntensityFactor,diffuseColor.rgb,metalnessFactor); -#else -material.specularColor=mix(vec3(0.04),diffuseColor.rgb,metalnessFactor);material.specularF90=1.0; -#endif -#ifdef USE_CLEARCOAT -material.clearcoat=clearcoat;material.clearcoatRoughness=clearcoatRoughness;material.clearcoatF0=vec3(0.04);material.clearcoatF90=1.0; -#ifdef USE_CLEARCOATMAP -material.clearcoat*=texture2D(clearcoatMap,vClearcoatMapUv).x; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP -material.clearcoatRoughness*=texture2D(clearcoatRoughnessMap,vClearcoatRoughnessMapUv).y; -#endif -material.clearcoat=saturate(material.clearcoat);material.clearcoatRoughness=max(material.clearcoatRoughness,0.0525);material.clearcoatRoughness+=geometryRoughness;material.clearcoatRoughness=min(material.clearcoatRoughness,1.0); -#endif -#ifdef USE_IRIDESCENCE -material.iridescence=iridescence;material.iridescenceIOR=iridescenceIOR; -#ifdef USE_IRIDESCENCEMAP -material.iridescence*=texture2D(iridescenceMap,vIridescenceMapUv).r; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP -material.iridescenceThickness=(iridescenceThicknessMaximum-iridescenceThicknessMinimum)*texture2D(iridescenceThicknessMap,vIridescenceThicknessMapUv).g+iridescenceThicknessMinimum; -#else -material.iridescenceThickness=iridescenceThicknessMaximum; -#endif -#endif -#ifdef USE_SHEEN -material.sheenColor=sheenColor; -#ifdef USE_SHEEN_COLORMAP -material.sheenColor*=texture2D(sheenColorMap,vSheenColorMapUv).rgb; -#endif -material.sheenRoughness=clamp(sheenRoughness,0.07,1.0); -#ifdef USE_SHEEN_ROUGHNESSMAP -material.sheenRoughness*=texture2D(sheenRoughnessMap,vSheenRoughnessMapUv).a; -#endif -#endif -#ifdef USE_ANISOTROPY -#ifdef USE_ANISOTROPYMAP -mat2 anisotropyMat=mat2(anisotropyVector.x,anisotropyVector.y,-anisotropyVector.y,anisotropyVector.x);vec3 anisotropyPolar=texture2D(anisotropyMap,vAnisotropyMapUv).rgb;vec2 anisotropyV=anisotropyMat*normalize(2.0*anisotropyPolar.rg-vec2(1.0))*anisotropyPolar.b; -#else -vec2 anisotropyV=anisotropyVector; -#endif -material.anisotropy=length(anisotropyV);if(material.anisotropy==0.0){anisotropyV=vec2(1.0,0.0);}else{anisotropyV/=material.anisotropy;material.anisotropy=saturate(material.anisotropy);}material.alphaT=mix(pow2(material.roughness),1.0,pow2(material.anisotropy));material.anisotropyT=tbn[0]*anisotropyV.x+tbn[1]*anisotropyV.y;material.anisotropyB=tbn[1]*anisotropyV.x-tbn[0]*anisotropyV.y; -#endif`,gg=`struct PhysicalMaterial{vec3 diffuseColor;float roughness;vec3 specularColor;float specularF90; -#ifdef USE_CLEARCOAT -float clearcoat;float clearcoatRoughness;vec3 clearcoatF0;float clearcoatF90; -#endif -#ifdef USE_IRIDESCENCE -float iridescence;float iridescenceIOR;float iridescenceThickness;vec3 iridescenceFresnel;vec3 iridescenceF0; -#endif -#ifdef USE_SHEEN -vec3 sheenColor;float sheenRoughness; -#endif -#ifdef IOR -float ior; -#endif -#ifdef USE_TRANSMISSION -float transmission;float transmissionAlpha;float thickness;float attenuationDistance;vec3 attenuationColor; -#endif -#ifdef USE_ANISOTROPY -float anisotropy;float alphaT;vec3 anisotropyT;vec3 anisotropyB; -#endif -};vec3 clearcoatSpecularDirect=vec3(0.0);vec3 clearcoatSpecularIndirect=vec3(0.0);vec3 sheenSpecularDirect=vec3(0.0);vec3 sheenSpecularIndirect=vec3(0.0);vec3 Schlick_to_F0(const in vec3 f,const in float f90,const in float dotVH){float x=clamp(1.0-dotVH,0.0,1.0);float x2=x*x;float x5=clamp(x*x2*x2,0.0,0.9999);return(f-vec3(f90)*x5)/(1.0-x5);}float V_GGX_SmithCorrelated(const in float alpha,const in float dotNL,const in float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}float D_GGX(const in float alpha,const in float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);} -#ifdef USE_ANISOTROPY -float 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){float gv=dotNL*length(vec3(alphaT*dotTV,alphaB*dotBV,dotNV));float gl=dotNV*length(vec3(alphaT*dotTL,alphaB*dotBL,dotNL));float v=0.5/(gv+gl);return saturate(v);}float D_GGX_Anisotropic(const in float alphaT,const in float alphaB,const in float dotNH,const in float dotTH,const in float dotBH){float a2=alphaT*alphaB;highp vec3 v=vec3(alphaB*dotTH,alphaT*dotBH,a2*dotNH);highp float v2=dot(v,v);float w2=a2/v2;return RECIPROCAL_PI*a2*pow2(w2);} -#endif -#ifdef USE_CLEARCOAT -vec3 BRDF_GGX_Clearcoat(const in vec3 lightDir,const in vec3 viewDir,const in vec3 normal,const in PhysicalMaterial material){vec3 f0=material.clearcoatF0;float f90=material.clearcoatF90;float roughness=material.clearcoatRoughness;float alpha=pow2(roughness);vec3 halfDir=normalize(lightDir+viewDir);float dotNL=saturate(dot(normal,lightDir));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotVH=saturate(dot(viewDir,halfDir));vec3 F=F_Schlick(f0,f90,dotVH);float V=V_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH);return F*(V*D);} -#endif -vec3 BRDF_GGX(const in vec3 lightDir,const in vec3 viewDir,const in vec3 normal,const in PhysicalMaterial material){vec3 f0=material.specularColor;float f90=material.specularF90;float roughness=material.roughness;float alpha=pow2(roughness);vec3 halfDir=normalize(lightDir+viewDir);float dotNL=saturate(dot(normal,lightDir));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotVH=saturate(dot(viewDir,halfDir));vec3 F=F_Schlick(f0,f90,dotVH); -#ifdef USE_IRIDESCENCE -F=mix(F,material.iridescenceFresnel,material.iridescence); -#endif -#ifdef USE_ANISOTROPY -float dotTL=dot(material.anisotropyT,lightDir);float dotTV=dot(material.anisotropyT,viewDir);float dotTH=dot(material.anisotropyT,halfDir);float dotBL=dot(material.anisotropyB,lightDir);float dotBV=dot(material.anisotropyB,viewDir);float dotBH=dot(material.anisotropyB,halfDir);float V=V_GGX_SmithCorrelated_Anisotropic(material.alphaT,alpha,dotTV,dotBV,dotTL,dotBL,dotNV,dotNL);float D=D_GGX_Anisotropic(material.alphaT,alpha,dotNH,dotTH,dotBH); -#else -float V=V_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH); -#endif -return F*(V*D);}vec2 LTC_Uv(const in vec3 N,const in vec3 V,const in float roughness){const float LUT_SIZE=64.0;const float LUT_SCALE=(LUT_SIZE-1.0)/LUT_SIZE;const float LUT_BIAS=0.5/LUT_SIZE;float dotNV=saturate(dot(N,V));vec2 uv=vec2(roughness,sqrt(1.0-dotNV));uv=uv*LUT_SCALE+LUT_BIAS;return uv;}float LTC_ClippedSphereFormFactor(const in vec3 f){float l=length(f);return max((l*l+f.z)/(l+1.0),0.0);}vec3 LTC_EdgeVectorFormFactor(const in vec3 v1,const in vec3 v2){float x=dot(v1,v2);float y=abs(x);float a=0.8543985+(0.4965155+0.0145206*y)*y;float b=3.4175940+(4.1616724+y)*y;float v=a/b;float theta_sintheta=(x>0.0)?v:0.5*inversesqrt(max(1.0-x*x,1e-7))-v;return cross(v1,v2)*theta_sintheta;}vec3 LTC_Evaluate(const in vec3 N,const in vec3 V,const in vec3 P,const in mat3 mInv,const in vec3 rectCoords[4]){vec3 v1=rectCoords[1]-rectCoords[0];vec3 v2=rectCoords[3]-rectCoords[0];vec3 lightNormal=cross(v1,v2);if(dot(lightNormal,P-rectCoords[0])<0.0)return vec3(0.0);vec3 T1,T2;T1=normalize(V-N*dot(V,N));T2=-cross(N,T1);mat3 mat=mInv*transposeMat3(mat3(T1,T2,N));vec3 coords[4];coords[0]=mat*(rectCoords[0]-P);coords[1]=mat*(rectCoords[1]-P);coords[2]=mat*(rectCoords[2]-P);coords[3]=mat*(rectCoords[3]-P);coords[0]=normalize(coords[0]);coords[1]=normalize(coords[1]);coords[2]=normalize(coords[2]);coords[3]=normalize(coords[3]);vec3 vectorFormFactor=vec3(0.0);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[0],coords[1]);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[1],coords[2]);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[2],coords[3]);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[3],coords[0]);float result=LTC_ClippedSphereFormFactor(vectorFormFactor);return vec3(result);} -#if defined(USE_SHEEN) -float D_Charlie(float roughness,float dotNH){float alpha=pow2(roughness);float invAlpha=1.0/alpha;float cos2h=dotNH*dotNH;float sin2h=max(1.0-cos2h,0.0078125);return(2.0+invAlpha)*pow(sin2h,invAlpha*0.5)/(2.0*PI);}float V_Neubelt(float dotNV,float dotNL){return saturate(1.0/(4.0*(dotNL+dotNV-dotNL*dotNV)));}vec3 BRDF_Sheen(const in vec3 lightDir,const in vec3 viewDir,const in vec3 normal,vec3 sheenColor,const in float sheenRoughness){vec3 halfDir=normalize(lightDir+viewDir);float dotNL=saturate(dot(normal,lightDir));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float D=D_Charlie(sheenRoughness,dotNH);float V=V_Neubelt(dotNV,dotNL);return sheenColor*(D*V);} -#endif -float IBLSheenBRDF(const in vec3 normal,const in vec3 viewDir,const in float roughness){float dotNV=saturate(dot(normal,viewDir));float r2=roughness*roughness;float a=roughness<0.25?-339.2*r2+161.4*roughness-25.9:-8.48*r2+14.3*roughness-9.95;float b=roughness<0.25?44.0*r2-23.7*roughness+3.26:1.97*r2-3.27*roughness+0.72;float DG=exp(a*dotNV+b)+(roughness<0.25?0.0:0.1*(roughness-0.25));return saturate(DG*RECIPROCAL_PI);}vec2 DFGApprox(const in vec3 normal,const in vec3 viewDir,const in float roughness){float dotNV=saturate(dot(normal,viewDir));const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 fab=vec2(-1.04,1.04)*a004+r.zw;return fab;}vec3 EnvironmentBRDF(const in vec3 normal,const in vec3 viewDir,const in vec3 specularColor,const in float specularF90,const in float roughness){vec2 fab=DFGApprox(normal,viewDir,roughness);return specularColor*fab.x+specularF90*fab.y;} -#ifdef USE_IRIDESCENCE -void 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){ -#else -void 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){ -#endif -vec2 fab=DFGApprox(normal,viewDir,roughness); -#ifdef USE_IRIDESCENCE -vec3 Fr=mix(specularColor,iridescenceF0,iridescence); -#else -vec3 Fr=specularColor; -#endif -vec3 FssEss=Fr*fab.x+specularF90*fab.y;float Ess=fab.x+fab.y;float Ems=1.0-Ess;vec3 Favg=Fr+(1.0-Fr)*0.047619;vec3 Fms=FssEss*Favg/(1.0-Ems*Favg);singleScatter+=FssEss;multiScatter+=Fms*Ems;} -#if NUM_RECT_AREA_LIGHTS>0 -void 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){vec3 normal=geometryNormal;vec3 viewDir=geometryViewDir;vec3 position=geometryPosition;vec3 lightPos=rectAreaLight.position;vec3 halfWidth=rectAreaLight.halfWidth;vec3 halfHeight=rectAreaLight.halfHeight;vec3 lightColor=rectAreaLight.color;float roughness=material.roughness;vec3 rectCoords[4];rectCoords[0]=lightPos+halfWidth-halfHeight;rectCoords[1]=lightPos-halfWidth-halfHeight;rectCoords[2]=lightPos-halfWidth+halfHeight;rectCoords[3]=lightPos+halfWidth+halfHeight;vec2 uv=LTC_Uv(normal,viewDir,roughness);vec4 t1=texture2D(ltc_1,uv);vec4 t2=texture2D(ltc_2,uv);mat3 mInv=mat3(vec3(t1.x,0,t1.y),vec3(0,1,0),vec3(t1.z,0,t1.w));vec3 fresnel=(material.specularColor*t2.x+(vec3(1.0)-material.specularColor)*t2.y);reflectedLight.directSpecular+=lightColor*fresnel*LTC_Evaluate(normal,viewDir,position,mInv,rectCoords);reflectedLight.directDiffuse+=lightColor*material.diffuseColor*LTC_Evaluate(normal,viewDir,position,mat3(1.0),rectCoords);} -#endif -void 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){float dotNL=saturate(dot(geometryNormal,directLight.direction));vec3 irradiance=dotNL*directLight.color; -#ifdef USE_CLEARCOAT -float dotNLcc=saturate(dot(geometryClearcoatNormal,directLight.direction));vec3 ccIrradiance=dotNLcc*directLight.color;clearcoatSpecularDirect+=ccIrradiance*BRDF_GGX_Clearcoat(directLight.direction,geometryViewDir,geometryClearcoatNormal,material); -#endif -#ifdef USE_SHEEN -sheenSpecularDirect+=irradiance*BRDF_Sheen(directLight.direction,geometryViewDir,geometryNormal,material.sheenColor,material.sheenRoughness); -#endif -reflectedLight.directSpecular+=irradiance*BRDF_GGX(directLight.direction,geometryViewDir,geometryNormal,material);reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){ -#ifdef USE_CLEARCOAT -clearcoatSpecularIndirect+=clearcoatRadiance*EnvironmentBRDF(geometryClearcoatNormal,geometryViewDir,material.clearcoatF0,material.clearcoatF90,material.clearcoatRoughness); -#endif -#ifdef USE_SHEEN -sheenSpecularIndirect+=irradiance*material.sheenColor*IBLSheenBRDF(geometryNormal,geometryViewDir,material.sheenRoughness); -#endif -vec3 singleScattering=vec3(0.0);vec3 multiScattering=vec3(0.0);vec3 cosineWeightedIrradiance=irradiance*RECIPROCAL_PI; -#ifdef USE_IRIDESCENCE -computeMultiscatteringIridescence(geometryNormal,geometryViewDir,material.specularColor,material.specularF90,material.iridescence,material.iridescenceFresnel,material.roughness,singleScattering,multiScattering); -#else -computeMultiscattering(geometryNormal,geometryViewDir,material.specularColor,material.specularF90,material.roughness,singleScattering,multiScattering); -#endif -vec3 totalScattering=singleScattering+multiScattering;vec3 diffuse=material.diffuseColor*(1.0-max(max(totalScattering.r,totalScattering.g),totalScattering.b));reflectedLight.indirectSpecular+=radiance*singleScattering;reflectedLight.indirectSpecular+=multiScattering*cosineWeightedIrradiance;reflectedLight.indirectDiffuse+=diffuse*cosineWeightedIrradiance;} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion(const in float dotNV,const in float ambientOcclusion,const in float roughness){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}`,_g=`vec3 geometryPosition=-vViewPosition;vec3 geometryNormal=normal;vec3 geometryViewDir=(isOrthographic)?vec3(0,0,1):normalize(vViewPosition);vec3 geometryClearcoatNormal=vec3(0.0); -#ifdef USE_CLEARCOAT -geometryClearcoatNormal=clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE -float dotNVi=saturate(dot(normal,geometryViewDir));if(material.iridescenceThickness==0.0){material.iridescence=0.0;}else{material.iridescence=saturate(material.iridescence);}if(material.iridescence>0.0){material.iridescenceFresnel=evalIridescence(1.0,material.iridescenceIOR,dotNVi,material.iridescenceThickness,material.specularColor);material.iridescenceF0=Schlick_to_F0(material.iridescenceFresnel,1.0,dotNVi);} -#endif -IncidentLight directLight; -#if (NUM_POINT_LIGHTS>0)&&defined(RE_Direct) -PointLight pointLight; -#if defined(USE_SHADOWMAP)&&NUM_POINT_LIGHT_SHADOWS>0 -PointLightShadow pointLightShadow; -#endif -#pragma unroll_loop_start -for(int i=0;i0)&&defined(RE_Direct) -SpotLight spotLight;vec4 spotColor;vec3 spotLightCoord;bool inSpotLightMap; -#if defined(USE_SHADOWMAP)&&NUM_SPOT_LIGHT_SHADOWS>0 -SpotLightShadow spotLightShadow; -#endif -#pragma unroll_loop_start -for(int i=0;i0)&&defined(RE_Direct) -DirectionalLight directionalLight; -#if defined(USE_SHADOWMAP)&&NUM_DIR_LIGHT_SHADOWS>0 -DirectionalLightShadow directionalLightShadow; -#endif -#pragma unroll_loop_start -for(int i=0;i0)&&defined(RE_Direct_RectArea) -RectAreaLight rectAreaLight; -#pragma unroll_loop_start -for(int i=0;i0) -#pragma unroll_loop_start -for(int i=0;i0 -varying vec4 vSpotLightCoord[NUM_SPOT_LIGHT_COORDS]; -#endif -#if NUM_SPOT_LIGHT_MAPS>0 -uniform sampler2D spotLightMap[NUM_SPOT_LIGHT_MAPS]; -#endif -#ifdef USE_SHADOWMAP -#if NUM_DIR_LIGHT_SHADOWS>0 -uniform sampler2D directionalShadowMap[NUM_DIR_LIGHT_SHADOWS];varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHT_SHADOWS];struct DirectionalLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform DirectionalLightShadow directionalLightShadows[NUM_DIR_LIGHT_SHADOWS]; -#endif -#if NUM_SPOT_LIGHT_SHADOWS>0 -uniform sampler2D spotShadowMap[NUM_SPOT_LIGHT_SHADOWS];struct SpotLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform SpotLightShadow spotLightShadows[NUM_SPOT_LIGHT_SHADOWS]; -#endif -#if NUM_POINT_LIGHT_SHADOWS>0 -uniform sampler2D pointShadowMap[NUM_POINT_LIGHT_SHADOWS];varying vec4 vPointShadowCoord[NUM_POINT_LIGHT_SHADOWS];struct PointLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;float shadowCameraNear;float shadowCameraFar;};uniform PointLightShadow pointLightShadows[NUM_POINT_LIGHT_SHADOWS]; -#endif -float texture2DCompare(sampler2D depths,vec2 uv,float compare){return step(compare,unpackRGBAToDepth(texture2D(depths,uv)));}vec2 texture2DDistribution(sampler2D shadow,vec2 uv){return unpackRGBATo2Half(texture2D(shadow,uv));}float VSMShadow(sampler2D shadow,vec2 uv,float compare){float occlusion=1.0;vec2 distribution=texture2DDistribution(shadow,uv);float hard_shadow=step(compare,distribution.x);if(hard_shadow!=1.0){float distance=compare-distribution.x;float variance=max(0.00000,distribution.y*distribution.y);float softness_probability=variance/(variance+distance*distance);softness_probability=clamp((softness_probability-0.3)/(0.95-0.3),0.0,1.0);occlusion=clamp(max(hard_shadow,softness_probability),0.0,1.0);}return occlusion;}float getShadow(sampler2D shadowMap,vec2 shadowMapSize,float shadowBias,float shadowRadius,vec4 shadowCoord){float shadow=1.0;shadowCoord.xyz/=shadowCoord.w;shadowCoord.z+=shadowBias;bool inFrustum=shadowCoord.x>=0.0&&shadowCoord.x<=1.0&&shadowCoord.y>=0.0&&shadowCoord.y<=1.0;bool frustumTest=inFrustum&&shadowCoord.z<=1.0;if(frustumTest){ -#if defined(SHADOWMAP_TYPE_PCF) -vec2 texelSize=vec2(1.0)/shadowMapSize;float dx0=-texelSize.x*shadowRadius;float dy0=-texelSize.y*shadowRadius;float dx1=+texelSize.x*shadowRadius;float dy1=+texelSize.y*shadowRadius;float dx2=dx0/2.0;float dy2=dy0/2.0;float dx3=dx1/2.0;float dy3=dy1/2.0;shadow=(texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx0,dy0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx1,dy0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx2,dy2),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy2),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx3,dy2),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx0,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx2,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy,shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx3,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx1,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx2,dy3),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy3),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx3,dy3),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx0,dy1),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy1),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx1,dy1),shadowCoord.z))*(1.0/17.0); -#elif defined(SHADOWMAP_TYPE_PCF_SOFT) -vec2 texelSize=vec2(1.0)/shadowMapSize;float dx=texelSize.x;float dy=texelSize.y;vec2 uv=shadowCoord.xy;vec2 f=fract(uv*shadowMapSize+0.5);uv-=f*texelSize;shadow=(texture2DCompare(shadowMap,uv,shadowCoord.z)+texture2DCompare(shadowMap,uv+vec2(dx,0.0),shadowCoord.z)+texture2DCompare(shadowMap,uv+vec2(0.0,dy),shadowCoord.z)+texture2DCompare(shadowMap,uv+texelSize,shadowCoord.z)+mix(texture2DCompare(shadowMap,uv+vec2(-dx,0.0),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,0.0),shadowCoord.z),f.x)+mix(texture2DCompare(shadowMap,uv+vec2(-dx,dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,dy),shadowCoord.z),f.x)+mix(texture2DCompare(shadowMap,uv+vec2(0.0,-dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(0.0,2.0*dy),shadowCoord.z),f.y)+mix(texture2DCompare(shadowMap,uv+vec2(dx,-dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(dx,2.0*dy),shadowCoord.z),f.y)+mix(mix(texture2DCompare(shadowMap,uv+vec2(-dx,-dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,-dy),shadowCoord.z),f.x),mix(texture2DCompare(shadowMap,uv+vec2(-dx,2.0*dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,2.0*dy),shadowCoord.z),f.x),f.y))*(1.0/9.0); -#elif defined(SHADOWMAP_TYPE_VSM) -shadow=VSMShadow(shadowMap,shadowCoord.xy,shadowCoord.z); -#else -shadow=texture2DCompare(shadowMap,shadowCoord.xy,shadowCoord.z); -#endif -}return shadow;}vec2 cubeToUV(vec3 v,float texelSizeY){vec3 absV=abs(v);float scaleToCube=1.0/max(absV.x,max(absV.y,absV.z));absV*=scaleToCube;v*=scaleToCube*(1.0-2.0*texelSizeY);vec2 planar=v.xy;float almostATexel=1.5*texelSizeY;float almostOne=1.0-almostATexel;if(absV.z>=almostOne){if(v.z>0.0)planar.x=4.0-v.x;}else if(absV.x>=almostOne){float signX=sign(v.x);planar.x=v.z*signX+2.0*signX;}else if(absV.y>=almostOne){float signY=sign(v.y);planar.x=v.x+2.0*signY+2.0;planar.y=v.z*signY-2.0;}return vec2(0.125,0.25)*planar+vec2(0.375,0.75);}float getPointShadow(sampler2D shadowMap,vec2 shadowMapSize,float shadowBias,float shadowRadius,vec4 shadowCoord,float shadowCameraNear,float shadowCameraFar){vec2 texelSize=vec2(1.0)/(shadowMapSize*vec2(4.0,2.0));vec3 lightToPosition=shadowCoord.xyz;float dp=(length(lightToPosition)-shadowCameraNear)/(shadowCameraFar-shadowCameraNear);dp+=shadowBias;vec3 bd3D=normalize(lightToPosition); -#if defined(SHADOWMAP_TYPE_PCF)||defined(SHADOWMAP_TYPE_PCF_SOFT)||defined(SHADOWMAP_TYPE_VSM) -vec2 offset=vec2(-1,1)*shadowRadius*texelSize.y;return(texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xyy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yyy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xyx,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yyx,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xxy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yxy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xxx,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yxx,texelSize.y),dp))*(1.0/9.0); -#else -return texture2DCompare(shadowMap,cubeToUV(bd3D,texelSize.y),dp); -#endif -} -#endif`,Qg=`#if NUM_SPOT_LIGHT_COORDS>0 -uniform mat4 spotLightMatrix[NUM_SPOT_LIGHT_COORDS];varying vec4 vSpotLightCoord[NUM_SPOT_LIGHT_COORDS]; -#endif -#ifdef USE_SHADOWMAP -#if NUM_DIR_LIGHT_SHADOWS>0 -uniform mat4 directionalShadowMatrix[NUM_DIR_LIGHT_SHADOWS];varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHT_SHADOWS];struct DirectionalLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform DirectionalLightShadow directionalLightShadows[NUM_DIR_LIGHT_SHADOWS]; -#endif -#if NUM_SPOT_LIGHT_SHADOWS>0 -struct SpotLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform SpotLightShadow spotLightShadows[NUM_SPOT_LIGHT_SHADOWS]; -#endif -#if NUM_POINT_LIGHT_SHADOWS>0 -uniform mat4 pointShadowMatrix[NUM_POINT_LIGHT_SHADOWS];varying vec4 vPointShadowCoord[NUM_POINT_LIGHT_SHADOWS];struct PointLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;float shadowCameraNear;float shadowCameraFar;};uniform PointLightShadow pointLightShadows[NUM_POINT_LIGHT_SHADOWS]; -#endif -#endif`,e_=`#if (defined(USE_SHADOWMAP)&&(NUM_DIR_LIGHT_SHADOWS>0||NUM_POINT_LIGHT_SHADOWS>0))||(NUM_SPOT_LIGHT_COORDS>0) -vec3 shadowWorldNormal=inverseTransformDirection(transformedNormal,viewMatrix);vec4 shadowWorldPosition; -#endif -#if defined(USE_SHADOWMAP) -#if NUM_DIR_LIGHT_SHADOWS>0 -#pragma unroll_loop_start -for(int i=0;i0 -#pragma unroll_loop_start -for(int i=0;i0 -#pragma unroll_loop_start -for(int i=0;i0 -DirectionalLightShadow directionalLight; -#pragma unroll_loop_start -for(int i=0;i0 -SpotLightShadow spotLight; -#pragma unroll_loop_start -for(int i=0;i0 -PointLightShadow pointLight; -#pragma unroll_loop_start -for(int i=0;i0 -vec4 worldPosition=vec4(transformed,1.0); -#ifdef USE_BATCHING -worldPosition=batchingMatrix*worldPosition; -#endif -#ifdef USE_INSTANCING -worldPosition=instanceMatrix*worldPosition; -#endif -worldPosition=modelMatrix*worldPosition; -#endif`,g_="varying vec2 vUv;uniform mat3 uvTransform;void main(){vUv=(uvTransform*vec3(uv,1)).xy;gl_Position=vec4(position.xy,1.0,1.0);}",__=`uniform sampler2D t2D;uniform float backgroundIntensity;varying vec2 vUv;void main(){vec4 texColor=texture2D(t2D,vUv); -#ifdef DECODE_VIDEO_TEXTURE -texColor=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); -#endif -texColor.rgb*=backgroundIntensity;gl_FragColor=texColor; -#include -#include -}`,x_=`varying vec3 vWorldDirection; -#include -void main(){vWorldDirection=transformDirection(position,modelMatrix); -#include -#include -gl_Position.z=gl_Position.w;}`,v_=`#ifdef ENVMAP_TYPE_CUBE -uniform samplerCube envMap; -#elif defined(ENVMAP_TYPE_CUBE_UV) -uniform sampler2D envMap; -#endif -uniform float flipEnvMap;uniform float backgroundBlurriness;uniform float backgroundIntensity;varying vec3 vWorldDirection; -#include -void main(){ -#ifdef ENVMAP_TYPE_CUBE -vec4 texColor=textureCube(envMap,vec3(flipEnvMap*vWorldDirection.x,vWorldDirection.yz)); -#elif defined(ENVMAP_TYPE_CUBE_UV) -vec4 texColor=textureCubeUV(envMap,vWorldDirection,backgroundBlurriness); -#else -vec4 texColor=vec4(0.0,0.0,0.0,1.0); -#endif -texColor.rgb*=backgroundIntensity;gl_FragColor=texColor; -#include -#include -}`,y_=`varying vec3 vWorldDirection; -#include -void main(){vWorldDirection=transformDirection(position,modelMatrix); -#include -#include -gl_Position.z=gl_Position.w;}`,S_=`uniform samplerCube tCube;uniform float tFlip;uniform float opacity;varying vec3 vWorldDirection;void main(){vec4 texColor=textureCube(tCube,vec3(tFlip*vWorldDirection.x,vWorldDirection.yz));gl_FragColor=texColor;gl_FragColor.a*=opacity; -#include -#include -}`,M_=`#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW;void main(){ -#include -#include -#include -#ifdef USE_DISPLACEMENTMAP -#include -#include -#include -#endif -#include -#include -#include -#include -#include -#include -#include -vHighPrecisionZW=gl_Position.zw;}`,b_=`#if DEPTH_PACKING==3200 -uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW;void main(){ -#include -vec4 diffuseColor=vec4(1.0); -#if DEPTH_PACKING==3200 -diffuseColor.a=opacity; -#endif -#include -#include -#include -#include -#include -float fragCoordZ=0.5*vHighPrecisionZW[0]/vHighPrecisionZW[1]+0.5; -#if DEPTH_PACKING==3200 -gl_FragColor=vec4(vec3(1.0-fragCoordZ),opacity); -#elif DEPTH_PACKING==3201 -gl_FragColor=packDepthToRGBA(fragCoordZ); -#endif -}`,w_=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#ifdef USE_DISPLACEMENTMAP -#include -#include -#include -#endif -#include -#include -#include -#include -#include -#include -#include -vWorldPosition=worldPosition.xyz;}`,E_=`#define DISTANCE -uniform vec3 referencePosition;uniform float nearDistance;uniform float farDistance;varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec4 diffuseColor=vec4(1.0); -#include -#include -#include -#include -float dist=length(vWorldPosition-referencePosition);dist=(dist-nearDistance)/(farDistance-nearDistance);dist=saturate(dist);gl_FragColor=packDepthToRGBA(dist);}`,T_=`varying vec3 vWorldDirection; -#include -void main(){vWorldDirection=transformDirection(position,modelMatrix); -#include -#include -}`,A_=`uniform sampler2D tEquirect;varying vec3 vWorldDirection; -#include -void main(){vec3 direction=normalize(vWorldDirection);vec2 sampleUV=equirectUv(direction);gl_FragColor=texture2D(tEquirect,sampleUV); -#include -#include -}`,C_=`uniform float scale;attribute float lineDistance;varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main(){vLineDistance=scale*lineDistance; -#include -#include -#include -#include -#include -#include -#include -#include -#include -}`,L_=`uniform vec3 diffuse;uniform float opacity;uniform float dashSize;uniform float totalSize;varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -if(mod(vLineDistance,totalSize)>dashSize){discard;}vec3 outgoingLight=vec3(0.0);vec4 diffuseColor=vec4(diffuse,opacity); -#include -#include -#include -outgoingLight=diffuseColor.rgb; -#include -#include -#include -#include -#include -}`,P_=`#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#if defined(USE_ENVMAP)||defined(USE_SKINNING) -#include -#include -#include -#include -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -}`,R_=`uniform vec3 diffuse;uniform float opacity; -#ifndef FLAT_SHADED -varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec4 diffuseColor=vec4(diffuse,opacity); -#include -#include -#include -#include -#include -#include -#include -ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0)); -#ifdef USE_LIGHTMAP -vec4 lightMapTexel=texture2D(lightMap,vLightMapUv);reflectedLight.indirectDiffuse+=lightMapTexel.rgb*lightMapIntensity*RECIPROCAL_PI; -#else -reflectedLight.indirectDiffuse+=vec3(1.0); -#endif -#include -reflectedLight.indirectDiffuse*=diffuseColor.rgb;vec3 outgoingLight=reflectedLight.indirectDiffuse; -#include -#include -#include -#include -#include -#include -#include -}`,D_=`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vViewPosition=-mvPosition.xyz; -#include -#include -#include -#include -}`,I_=`#define LAMBERT -uniform vec3 diffuse;uniform vec3 emissive;uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vec3 outgoingLight=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+totalEmissiveRadiance; -#include -#include -#include -#include -#include -#include -#include -}`,N_=`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vViewPosition=-mvPosition.xyz;}`,O_=`#define MATCAP -uniform vec3 diffuse;uniform float opacity;uniform sampler2D matcap;varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec4 diffuseColor=vec4(diffuse,opacity); -#include -#include -#include -#include -#include -#include -#include -#include -vec3 viewDir=normalize(vViewPosition);vec3 x=normalize(vec3(viewDir.z,0.0,-viewDir.x));vec3 y=cross(viewDir,x);vec2 uv=vec2(dot(x,normal),dot(y,normal))*0.495+0.5; -#ifdef USE_MATCAP -vec4 matcapColor=texture2D(matcap,uv); -#else -vec4 matcapColor=vec4(vec3(mix(0.2,0.8,uv.y)),1.0); -#endif -vec3 outgoingLight=diffuseColor.rgb*matcapColor.rgb; -#include -#include -#include -#include -#include -#include -}`,U_=`#define NORMAL -#if defined(FLAT_SHADED)||defined(USE_BUMPMAP)||defined(USE_NORMALMAP_TANGENTSPACE) -varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(FLAT_SHADED)||defined(USE_BUMPMAP)||defined(USE_NORMALMAP_TANGENTSPACE) -vViewPosition=-mvPosition.xyz; -#endif -}`,F_=`#define NORMAL -uniform float opacity; -#if defined(FLAT_SHADED)||defined(USE_BUMPMAP)||defined(USE_NORMALMAP_TANGENTSPACE) -varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -gl_FragColor=vec4(packNormalToRGB(normal),opacity); -#ifdef OPAQUE -gl_FragColor.a=1.0; -#endif -}`,k_=`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vViewPosition=-mvPosition.xyz; -#include -#include -#include -#include -}`,z_=`#define PHONG -uniform vec3 diffuse;uniform vec3 emissive;uniform vec3 specular;uniform float shininess;uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vec3 outgoingLight=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+reflectedLight.directSpecular+reflectedLight.indirectSpecular+totalEmissiveRadiance; -#include -#include -#include -#include -#include -#include -#include -}`,B_=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION -varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vViewPosition=-mvPosition.xyz; -#include -#include -#include -#ifdef USE_TRANSMISSION -vWorldPosition=worldPosition.xyz; -#endif -}`,V_=`#define STANDARD -#ifdef PHYSICAL -#define IOR -#define USE_SPECULAR -#endif -uniform vec3 diffuse;uniform vec3 emissive;uniform float roughness;uniform float metalness;uniform float opacity; -#ifdef IOR -uniform float ior; -#endif -#ifdef USE_SPECULAR -uniform float specularIntensity;uniform vec3 specularColor; -#ifdef USE_SPECULAR_COLORMAP -uniform sampler2D specularColorMap; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP -uniform sampler2D specularIntensityMap; -#endif -#endif -#ifdef USE_CLEARCOAT -uniform float clearcoat;uniform float clearcoatRoughness; -#endif -#ifdef USE_IRIDESCENCE -uniform float iridescence;uniform float iridescenceIOR;uniform float iridescenceThicknessMinimum;uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN -uniform vec3 sheenColor;uniform float sheenRoughness; -#ifdef USE_SHEEN_COLORMAP -uniform sampler2D sheenColorMap; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP -uniform sampler2D sheenRoughnessMap; -#endif -#endif -#ifdef USE_ANISOTROPY -uniform vec2 anisotropyVector; -#ifdef USE_ANISOTROPYMAP -uniform sampler2D anisotropyMap; -#endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vec3 totalDiffuse=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse;vec3 totalSpecular=reflectedLight.directSpecular+reflectedLight.indirectSpecular; -#include -vec3 outgoingLight=totalDiffuse+totalSpecular+totalEmissiveRadiance; -#ifdef USE_SHEEN -float sheenEnergyComp=1.0-0.157*max3(material.sheenColor);outgoingLight=outgoingLight*sheenEnergyComp+sheenSpecularDirect+sheenSpecularIndirect; -#endif -#ifdef USE_CLEARCOAT -float dotNVcc=saturate(dot(geometryClearcoatNormal,geometryViewDir));vec3 Fcc=F_Schlick(material.clearcoatF0,material.clearcoatF90,dotNVcc);outgoingLight=outgoingLight*(1.0-material.clearcoat*Fcc)+(clearcoatSpecularDirect+clearcoatSpecularIndirect)*material.clearcoat; -#endif -#include -#include -#include -#include -#include -#include -}`,H_=`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vViewPosition=-mvPosition.xyz; -#include -#include -#include -}`,G_=`#define TOON -uniform vec3 diffuse;uniform vec3 emissive;uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -vec3 outgoingLight=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+totalEmissiveRadiance; -#include -#include -#include -#include -#include -#include -}`,W_=`uniform float size;uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV -varying vec2 vUv;uniform mat3 uvTransform; -#endif -void main(){ -#ifdef USE_POINTS_UV -vUv=(uvTransform*vec3(uv,1)).xy; -#endif -#include -#include -#include -#include -#include -gl_PointSize=size; -#ifdef USE_SIZEATTENUATION -bool isPerspective=isPerspectiveMatrix(projectionMatrix);if(isPerspective)gl_PointSize*=(scale/-mvPosition.z); -#endif -#include -#include -#include -#include -}`,q_=`uniform vec3 diffuse;uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec3 outgoingLight=vec3(0.0);vec4 diffuseColor=vec4(diffuse,opacity); -#include -#include -#include -#include -#include -outgoingLight=diffuseColor.rgb; -#include -#include -#include -#include -#include -}`,X_=`#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -}`,Y_=`uniform vec3 color;uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -gl_FragColor=vec4(color,opacity*(1.0-getShadowMask())); -#include -#include -#include -}`,j_=`uniform float rotation;uniform vec2 center; -#include -#include -#include -#include -#include -void main(){ -#include -vec4 mvPosition=modelViewMatrix*vec4(0.0,0.0,0.0,1.0);vec2 scale;scale.x=length(vec3(modelMatrix[0].x,modelMatrix[0].y,modelMatrix[0].z));scale.y=length(vec3(modelMatrix[1].x,modelMatrix[1].y,modelMatrix[1].z)); -#ifndef USE_SIZEATTENUATION -bool isPerspective=isPerspectiveMatrix(projectionMatrix);if(isPerspective)scale*=-mvPosition.z; -#endif -vec2 alignedPosition=(position.xy-(center-vec2(0.5)))*scale;vec2 rotatedPosition;rotatedPosition.x=cos(rotation)*alignedPosition.x-sin(rotation)*alignedPosition.y;rotatedPosition.y=sin(rotation)*alignedPosition.x+cos(rotation)*alignedPosition.y;mvPosition.xy+=rotatedPosition;gl_Position=projectionMatrix*mvPosition; -#include -#include -#include -}`,Z_=`uniform vec3 diffuse;uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main(){ -#include -vec3 outgoingLight=vec3(0.0);vec4 diffuseColor=vec4(diffuse,opacity); -#include -#include -#include -#include -#include -outgoingLight=diffuseColor.rgb; -#include -#include -#include -#include -}`,ze={alphahash_fragment:_m,alphahash_pars_fragment:xm,alphamap_fragment:vm,alphamap_pars_fragment:ym,alphatest_fragment:Sm,alphatest_pars_fragment:Mm,aomap_fragment:bm,aomap_pars_fragment:wm,batching_pars_vertex:Em,batching_vertex:Tm,begin_vertex:Am,beginnormal_vertex:Cm,bsdfs:Lm,iridescence_fragment:Pm,bumpmap_pars_fragment:Rm,clipping_planes_fragment:Dm,clipping_planes_pars_fragment:Im,clipping_planes_pars_vertex:Nm,clipping_planes_vertex:Om,color_fragment:Um,color_pars_fragment:Fm,color_pars_vertex:km,color_vertex:zm,common:Bm,cube_uv_reflection_fragment:Vm,defaultnormal_vertex:Hm,displacementmap_pars_vertex:Gm,displacementmap_vertex:Wm,emissivemap_fragment:qm,emissivemap_pars_fragment:Xm,colorspace_fragment:Ym,colorspace_pars_fragment:jm,envmap_fragment:Zm,envmap_common_pars_fragment:$m,envmap_pars_fragment:Jm,envmap_pars_vertex:Km,envmap_physical_pars_fragment:ug,envmap_vertex:Qm,fog_vertex:eg,fog_pars_vertex:tg,fog_fragment:ig,fog_pars_fragment:ng,gradientmap_pars_fragment:rg,lightmap_fragment:sg,lightmap_pars_fragment:ag,lights_lambert_fragment:og,lights_lambert_pars_fragment:lg,lights_pars_begin:cg,lights_toon_fragment:hg,lights_toon_pars_fragment:fg,lights_phong_fragment:dg,lights_phong_pars_fragment:pg,lights_physical_fragment:mg,lights_physical_pars_fragment:gg,lights_fragment_begin:_g,lights_fragment_maps:xg,lights_fragment_end:vg,logdepthbuf_fragment:yg,logdepthbuf_pars_fragment:Sg,logdepthbuf_pars_vertex:Mg,logdepthbuf_vertex:bg,map_fragment:wg,map_pars_fragment:Eg,map_particle_fragment:Tg,map_particle_pars_fragment:Ag,metalnessmap_fragment:Cg,metalnessmap_pars_fragment:Lg,morphcolor_vertex:Pg,morphnormal_vertex:Rg,morphtarget_pars_vertex:Dg,morphtarget_vertex:Ig,normal_fragment_begin:Ng,normal_fragment_maps:Og,normal_pars_fragment:Ug,normal_pars_vertex:Fg,normal_vertex:kg,normalmap_pars_fragment:zg,clearcoat_normal_fragment_begin:Bg,clearcoat_normal_fragment_maps:Vg,clearcoat_pars_fragment:Hg,iridescence_pars_fragment:Gg,opaque_fragment:Wg,packing:qg,premultiplied_alpha_fragment:Xg,project_vertex:Yg,dithering_fragment:jg,dithering_pars_fragment:Zg,roughnessmap_fragment:$g,roughnessmap_pars_fragment:Jg,shadowmap_pars_fragment:Kg,shadowmap_pars_vertex:Qg,shadowmap_vertex:e_,shadowmask_pars_fragment:t_,skinbase_vertex:i_,skinning_pars_vertex:n_,skinning_vertex:r_,skinnormal_vertex:s_,specularmap_fragment:a_,specularmap_pars_fragment:o_,tonemapping_fragment:l_,tonemapping_pars_fragment:c_,transmission_fragment:u_,transmission_pars_fragment:h_,uv_pars_fragment:f_,uv_pars_vertex:d_,uv_vertex:p_,worldpos_vertex:m_,background_vert:g_,background_frag:__,backgroundCube_vert:x_,backgroundCube_frag:v_,cube_vert:y_,cube_frag:S_,depth_vert:M_,depth_frag:b_,distanceRGBA_vert:w_,distanceRGBA_frag:E_,equirect_vert:T_,equirect_frag:A_,linedashed_vert:C_,linedashed_frag:L_,meshbasic_vert:P_,meshbasic_frag:R_,meshlambert_vert:D_,meshlambert_frag:I_,meshmatcap_vert:N_,meshmatcap_frag:O_,meshnormal_vert:U_,meshnormal_frag:F_,meshphong_vert:k_,meshphong_frag:z_,meshphysical_vert:B_,meshphysical_frag:V_,meshtoon_vert:H_,meshtoon_frag:G_,points_vert:W_,points_frag:q_,shadow_vert:X_,shadow_frag:Y_,sprite_vert:j_,sprite_frag:Z_},ce={common:{diffuse:{value:new Ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new We}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new We}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new We}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new We},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new We},normalScale:{value:new De(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new We},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new We}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new We}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new We}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ze(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0},uvTransform:{value:new We}},sprite:{diffuse:{value:new Ze(16777215)},opacity:{value:1},center:{value:new De(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0}}},ci={basic:{uniforms:Rt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:ze.meshbasic_vert,fragmentShader:ze.meshbasic_frag},lambert:{uniforms:Rt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Ze(0)}}]),vertexShader:ze.meshlambert_vert,fragmentShader:ze.meshlambert_frag},phong:{uniforms:Rt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Ze(0)},specular:{value:new Ze(1118481)},shininess:{value:30}}]),vertexShader:ze.meshphong_vert,fragmentShader:ze.meshphong_frag},standard:{uniforms:Rt([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new Ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag},toon:{uniforms:Rt([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new Ze(0)}}]),vertexShader:ze.meshtoon_vert,fragmentShader:ze.meshtoon_frag},matcap:{uniforms:Rt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:ze.meshmatcap_vert,fragmentShader:ze.meshmatcap_frag},points:{uniforms:Rt([ce.points,ce.fog]),vertexShader:ze.points_vert,fragmentShader:ze.points_frag},dashed:{uniforms:Rt([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ze.linedashed_vert,fragmentShader:ze.linedashed_frag},depth:{uniforms:Rt([ce.common,ce.displacementmap]),vertexShader:ze.depth_vert,fragmentShader:ze.depth_frag},normal:{uniforms:Rt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:ze.meshnormal_vert,fragmentShader:ze.meshnormal_frag},sprite:{uniforms:Rt([ce.sprite,ce.fog]),vertexShader:ze.sprite_vert,fragmentShader:ze.sprite_frag},background:{uniforms:{uvTransform:{value:new We},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ze.background_vert,fragmentShader:ze.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ze.backgroundCube_vert,fragmentShader:ze.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ze.cube_vert,fragmentShader:ze.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ze.equirect_vert,fragmentShader:ze.equirect_frag},distanceRGBA:{uniforms:Rt([ce.common,ce.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ze.distanceRGBA_vert,fragmentShader:ze.distanceRGBA_frag},shadow:{uniforms:Rt([ce.lights,ce.fog,{color:{value:new Ze(0)},opacity:{value:1}}]),vertexShader:ze.shadow_vert,fragmentShader:ze.shadow_frag}};ci.physical={uniforms:Rt([ci.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new We},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new We},clearcoatNormalScale:{value:new De(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new We},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new We},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new We},sheen:{value:0},sheenColor:{value:new Ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new We},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new We},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new We},transmissionSamplerSize:{value:new De},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new We},attenuationDistance:{value:0},attenuationColor:{value:new Ze(0)},specularColor:{value:new Ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new We},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new We},anisotropyVector:{value:new De},anisotropyMap:{value:null},anisotropyMapTransform:{value:new We}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag};const ts={r:0,b:0,g:0};function $_(n,e,t,i,r,s,a){const o=new Ze(0);let l=s===!0?0:1,c,u,h=null,d=0,m=null;function g(p,f){let w=!1,x=f.isScene===!0?f.background:null;x&&x.isTexture&&(x=(f.backgroundBlurriness>0?t:e).get(x)),x===null?_(o,l):x&&x.isColor&&(_(x,1),w=!0);const A=n.xr.getEnvironmentBlendMode();A==="additive"?i.buffers.color.setClear(0,0,0,1,a):A==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(n.autoClear||w)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),x&&(x.isCubeTexture||x.mapping===Ns)?(u===void 0&&(u=new Mi(new wr(1,1,1),new on({name:"BackgroundCubeMaterial",uniforms:Wn(ci.backgroundCube.uniforms),vertexShader:ci.backgroundCube.vertexShader,fragmentShader:ci.backgroundCube.fragmentShader,side:Ut,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(D,C,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,u.material.toneMapped=et.getTransfer(x.colorSpace)!==rt,(h!==x||d!==x.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,h=x,d=x.version,m=n.toneMapping),u.layers.enableAll(),p.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new Mi(new bo(2,2),new on({name:"BackgroundMaterial",uniforms:Wn(ci.background.uniforms),vertexShader:ci.background.vertexShader,fragmentShader:ci.background.fragmentShader,side:Hi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,c.material.toneMapped=et.getTransfer(x.colorSpace)!==rt,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(h!==x||d!==x.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,h=x,d=x.version,m=n.toneMapping),c.layers.enableAll(),p.unshift(c,c.geometry,c.material,0,0,null))}function _(p,f){p.getRGB(ts,Yu(n)),i.buffers.color.setClear(ts.r,ts.g,ts.b,f,a)}return{getClearColor:function(){return o},setClearColor:function(p,f=1){o.set(p),l=f,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(p){l=p,_(o,l)},render:g}}function J_(n,e,t,i){const r=n.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||s!==null,o={},l=p(null);let c=l,u=!1;function h(P,N,V,Y,X){let W=!1;if(a){const K=_(Y,V,N);c!==K&&(c=K,m(c.object)),W=f(P,Y,V,X),W&&w(P,Y,V,X)}else{const K=N.wireframe===!0;(c.geometry!==Y.id||c.program!==V.id||c.wireframe!==K)&&(c.geometry=Y.id,c.program=V.id,c.wireframe=K,W=!0)}X!==null&&t.update(X,34963),(W||u)&&(u=!1,H(P,N,V,Y),X!==null&&n.bindBuffer(34963,t.get(X).buffer))}function d(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(P){return i.isWebGL2?n.bindVertexArray(P):s.bindVertexArrayOES(P)}function g(P){return i.isWebGL2?n.deleteVertexArray(P):s.deleteVertexArrayOES(P)}function _(P,N,V){const Y=V.wireframe===!0;let X=o[P.id];X===void 0&&(X={},o[P.id]=X);let W=X[N.id];W===void 0&&(W={},X[N.id]=W);let K=W[Y];return K===void 0&&(K=p(d()),W[Y]=K),K}function p(P){const N=[],V=[],Y=[];for(let X=0;X=0){const Z=X[de];let fe=W[de];if(fe===void 0&&(de==="instanceMatrix"&&P.instanceMatrix&&(fe=P.instanceMatrix),de==="instanceColor"&&P.instanceColor&&(fe=P.instanceColor)),Z===void 0||Z.attribute!==fe||fe&&Z.data!==fe.data)return!0;K++}return c.attributesNum!==K||c.index!==Y}function w(P,N,V,Y){const X={},W=N.attributes;let K=0;const ie=V.getAttributes();for(const de in ie)if(ie[de].location>=0){let Z=W[de];Z===void 0&&(de==="instanceMatrix"&&P.instanceMatrix&&(Z=P.instanceMatrix),de==="instanceColor"&&P.instanceColor&&(Z=P.instanceColor));const fe={};fe.attribute=Z,Z&&Z.data&&(fe.data=Z.data),X[de]=fe,K++}c.attributes=X,c.attributesNum=K,c.index=Y}function x(){const P=c.newAttributes;for(let N=0,V=P.length;N=0){let B=X[ie];if(B===void 0&&(ie==="instanceMatrix"&&P.instanceMatrix&&(B=P.instanceMatrix),ie==="instanceColor"&&P.instanceColor&&(B=P.instanceColor)),B!==void 0){const Z=B.normalized,fe=B.itemSize,ye=t.get(B);if(ye===void 0)continue;const xe=ye.buffer,Pe=ye.type,Ie=ye.bytesPerElement,Ee=i.isWebGL2===!0&&(Pe===5124||Pe===5125||B.gpuType===Ru);if(B.isInterleavedBufferAttribute){const qe=B.data,te=qe.stride,_t=B.offset;if(qe.isInstancedInterleavedBuffer){for(let be=0;be0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(34930),d=n.getParameter(35660),m=n.getParameter(3379),g=n.getParameter(34076),_=n.getParameter(34921),p=n.getParameter(36347),f=n.getParameter(36348),w=n.getParameter(36349),x=d>0,A=a||e.has("OES_texture_float"),D=x&&A,C=a?n.getParameter(36183):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:m,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:w,vertexTextures:x,floatFragmentTextures:A,floatVertexTextures:D,maxSamples:C}}function e0(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Ni,o=new We,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const m=h.length!==0||d||i!==0||r;return r=d,i=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,m){const g=h.clippingPlanes,_=h.clipIntersection,p=h.clipShadows,f=n.get(h);if(!r||g===null||g.length===0||s&&!p)s?u(null):c();else{const w=s?0:i,x=w*4;let A=f.clippingState||null;l.value=A,A=u(g,d,x,m);for(let D=0;D!==x;++D)A[D]=t[D];f.clippingState=A,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=w}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,m,g){const _=h!==null?h.length:0;let p=null;if(_!==0){if(p=l.value,g!==!0||p===null){const f=m+_*4,w=d.matrixWorldInverse;o.getNormalMatrix(w),(p===null||p.length -#include -}`,fragmentShader:`uniform sampler2D tEquirect;varying vec3 vWorldDirection; -#include -void main(){vec3 direction=normalize(vWorldDirection);vec2 sampleUV=equirectUv(direction);gl_FragColor=texture2D(tEquirect,sampleUV);}`},r=new wr(5,5,5),s=new on({name:"CubemapFromEquirect",uniforms:Wn(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ut,blending:zi});s.uniforms.tEquirect.value=t;const a=new Mi(r,s),o=t.minFilter;return t.minFilter===mr&&(t.minFilter=qt),new i0(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}function r0(n){let e=new WeakMap;function t(a,o){return o===Ya?a.mapping=Vn:o===ja&&(a.mapping=Hn),a}function i(a){if(a&&a.isTexture){const o=a.mapping;if(o===Ya||o===ja)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new n0(l.height/2);return c.fromEquirectangularTexture(n,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class s0 extends qu{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const In=4,rc=[.125,.215,.35,.446,.526,.582],Qi=20,ba=new s0,sc=new Ze;let wa=null,Ea=0,Ta=0;const Ji=(1+Math.sqrt(5))/2,Ln=1/Ji,ac=[new R(1,1,1),new R(-1,1,1),new R(1,1,-1),new R(-1,1,-1),new R(0,Ji,Ln),new R(0,Ji,-Ln),new R(Ln,0,Ji),new R(-Ln,0,Ji),new R(Ji,Ln,0),new R(-Ji,Ln,0)];class oc{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){wa=this._renderer.getRenderTarget(),Ea=this._renderer.getActiveCubeFace(),Ta=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=uc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=cc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?x:0,x,x),u.setRenderTarget(r),_&&u.render(g,o),u.render(e,o)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=p}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Vn||e.mapping===Hn;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=uc()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=cc());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Mi(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;is(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,ba)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;rQi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${Qi}`);const f=[];let w=0;for(let T=0;Tx-In?r-x+In:0),C=4*(this._cubeSize-A);is(t,D,C,3*A,2*A),l.setRenderTarget(t),l.render(h,ba)}}function a0(n){const e=[],t=[],i=[];let r=n;const s=n-In+1+rc.length;for(let a=0;an-In?l=rc[a-n+In-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],m=6,g=6,_=3,p=2,f=1,w=new Float32Array(_*g*m),x=new Float32Array(p*g*m),A=new Float32Array(f*g*m);for(let C=0;C2?0:-1,y=[T,H,0,T+2/3,H,0,T+2/3,H+1,0,T,H,0,T+2/3,H+1,0,T,H+1,0];w.set(y,_*g*C),x.set(d,p*g*C);const b=[C,C,C,C,C,C];A.set(b,f*g*C)}const D=new Jt;D.setAttribute("position",new hi(w,_)),D.setAttribute("uv",new hi(x,p)),D.setAttribute("faceIndex",new hi(A,f)),e.push(D),r>In&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function lc(n,e,t){const i=new ln(n,e,t);return i.texture.mapping=Ns,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function is(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function o0(n,e,t){const i=new Float32Array(Qi),r=new R(0,1,0);return new on({name:"SphericalGaussianBlur",defines:{n:Qi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:wo(),fragmentShader:`precision mediump float;precision mediump int;varying vec3 vOutputDirection;uniform sampler2D envMap;uniform int samples;uniform float weights[n];uniform bool latitudinal;uniform float dTheta;uniform float mipInt;uniform vec3 poleAxis; -#define ENVMAP_TYPE_CUBE_UV -#include -vec3 getSample(float theta,vec3 axis){float cosTheta=cos(theta);vec3 sampleDirection=vOutputDirection*cosTheta+cross(axis,vOutputDirection)*sin(theta)+axis*dot(axis,vOutputDirection)*(1.0-cosTheta);return bilinearCubeUV(envMap,sampleDirection,mipInt);}void main(){vec3 axis=latitudinal?poleAxis:cross(poleAxis,vOutputDirection);if(all(equal(axis,vec3(0.0)))){axis=vec3(vOutputDirection.z,0.0,-vOutputDirection.x);}axis=normalize(axis);gl_FragColor=vec4(0.0,0.0,0.0,1.0);gl_FragColor.rgb+=weights[0]*getSample(0.0,axis);for(int i=1;i=samples){break;}float theta=dTheta*float(i);gl_FragColor.rgb+=weights[i]*getSample(-1.0*theta,axis);gl_FragColor.rgb+=weights[i]*getSample(theta,axis);}}`,blending:zi,depthTest:!1,depthWrite:!1})}function cc(){return new on({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:wo(),fragmentShader:`precision mediump float;precision mediump int;varying vec3 vOutputDirection;uniform sampler2D envMap; -#include -void main(){vec3 outputDirection=normalize(vOutputDirection);vec2 uv=equirectUv(outputDirection);gl_FragColor=vec4(texture2D(envMap,uv).rgb,1.0);}`,blending:zi,depthTest:!1,depthWrite:!1})}function uc(){return new on({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:wo(),fragmentShader:"precision mediump float;precision mediump int;uniform float flipEnvMap;varying vec3 vOutputDirection;uniform samplerCube envMap;void main(){gl_FragColor=textureCube(envMap,vec3(flipEnvMap*vOutputDirection.x,vOutputDirection.yz));}",blending:zi,depthTest:!1,depthWrite:!1})}function wo(){return"precision mediump float;precision mediump int;attribute float faceIndex;varying vec3 vOutputDirection;vec3 getDirection(vec2 uv,float face){uv=2.0*uv-1.0;vec3 direction=vec3(uv,1.0);if(face==0.0){direction=direction.zyx;}else if(face==1.0){direction=direction.xzy;direction.xz*=-1.0;}else if(face==2.0){direction.x*=-1.0;}else if(face==3.0){direction=direction.zyx;direction.xz*=-1.0;}else if(face==4.0){direction=direction.xzy;direction.xy*=-1.0;}else if(face==5.0){direction.z*=-1.0;}return direction;}void main(){vOutputDirection=getDirection(uv,faceIndex);gl_Position=vec4(position,1.0);}"}function l0(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ya||l===ja,u=l===Vn||l===Hn;if(c||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let h=e.get(o);return t===null&&(t=new oc(n)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),e.set(o,h),h.texture}else{if(e.has(o))return e.get(o).texture;{const h=o.image;if(c&&h&&h.height>0||u&&h&&r(h)){t===null&&(t=new oc(n));const d=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,d),o.addEventListener("dispose",s),d.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(b=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const F=new Float32Array(y*b*4*g),G=new Qu(F,y,b,g);G.type=ki,G.needsUpdate=!0;const re=H*4;for(let N=0;N0)return n;const r=e*t;let s=hc[r];if(s===void 0&&(s=new Float32Array(r),hc[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function mt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${o}: ${t[a]}`)}return i.join(` -`)}function hx(n){const e=et.getPrimaries(et.workingColorSpace),t=et.getPrimaries(n);let i;switch(e===t?i="":e===bs&&t===Ms?i="LinearDisplayP3ToLinearSRGB":e===Ms&&t===bs&&(i="LinearSRGBToLinearDisplayP3"),n){case wi:case Os:return[i,"LinearTransferOETF"];case St:case xo:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function xc(n,e,t){const i=n.getShaderParameter(e,35713),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` - -`+r+` - -`+ux(n.getShaderSource(e),a)}else return r}function fx(n,e){const t=hx(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function dx(n,e){let t;switch(e){case gp:t="Linear";break;case _p:t="Reinhard";break;case xp:t="OptimizedCineon";break;case vp:t="ACESFilmic";break;case Sp:t="AgX";break;case yp:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function px(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Nn).join(` -`)}function mx(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":""].filter(Nn).join(` -`)}function gx(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` -`)}function _x(n,e){const t={},i=n.getProgramParameter(e,35721);for(let r=0;r/gm;function Qa(n){return n.replace(xx,yx)}const vx=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function yx(n,e){let t=ze[e];if(t===void 0){const i=vx.get(e);if(i!==void 0)t=ze[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Qa(t)}const Sx=/#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 Sc(n){return n.replace(Sx,Mx)}function Mx(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(f+=` -`),w=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Nn).join(` -`),w.length>0&&(w+=` -`)):(f=[Mc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Nn).join(` -`),w=[m,Mc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Bi?"#define TONE_MAPPING":"",t.toneMapping!==Bi?ze.tonemapping_pars_fragment:"",t.toneMapping!==Bi?dx("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ze.colorspace_pars_fragment,fx("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Nn).join(` -`)),a=Qa(a),a=vc(a,t),a=yc(a,t),o=Qa(o),o=vc(o,t),o=yc(o,t),a=Sc(a),o=Sc(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(x=`#version 300 es -`,f=[g,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+f,w=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===Dl?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Dl?"":"#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(` -`)+` -`+w);const A=x+f+a,D=x+w+o,C=_c(r,35633,A),T=_c(r,35632,D);r.attachShader(p,C),r.attachShader(p,T),t.index0AttributeName!==void 0?r.bindAttribLocation(p,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(p,0,"position"),r.linkProgram(p);function H(G){if(n.debug.checkShaderErrors){const re=r.getProgramInfoLog(p).trim(),P=r.getShaderInfoLog(C).trim(),N=r.getShaderInfoLog(T).trim();let V=!0,Y=!0;if(r.getProgramParameter(p,35714)===!1)if(V=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,p,C,T);else{const X=xc(r,C,"vertex"),W=xc(r,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(p,35715)+` - -Program Info Log: `+re+` -`+X+` -`+W)}else re!==""?console.warn("THREE.WebGLProgram: Program Info Log:",re):(P===""||N==="")&&(Y=!1);Y&&(G.diagnostics={runnable:V,programLog:re,vertexShader:{log:P,prefix:f},fragmentShader:{log:N,prefix:w}})}r.deleteShader(C),r.deleteShader(T),y=new ms(r,p),b=_x(r,p)}let y;this.getUniforms=function(){return y===void 0&&H(this),y};let b;this.getAttributes=function(){return b===void 0&&H(this),b};let F=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return F===!1&&(F=r.getProgramParameter(p,lx)),F},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(p),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=cx++,this.cacheKey=e,this.usedTimes=1,this.program=p,this.vertexShader=C,this.fragmentShader=T,this}let Lx=0;class Px{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new Rx(e),t.set(e,i)),i}}class Rx{constructor(e){this.id=Lx++,this.code=e,this.usedTimes=0}}function Dx(n,e,t,i,r,s,a){const o=new yo,l=new Px,c=[],u=r.isWebGL2,h=r.logarithmicDepthBuffer,d=r.vertexTextures;let m=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(y){return y===0?"uv":`uv${y}`}function p(y,b,F,G,re){const P=G.fog,N=re.geometry,V=y.isMeshStandardMaterial?G.environment:null,Y=(y.isMeshStandardMaterial?t:e).get(y.envMap||V),X=Y&&Y.mapping===Ns?Y.image.height:null,W=g[y.type];y.precision!==null&&(m=r.getMaxPrecision(y.precision),m!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",m,"instead."));const K=N.morphAttributes.position||N.morphAttributes.normal||N.morphAttributes.color,ie=K!==void 0?K.length:0;let de=0;N.morphAttributes.position!==void 0&&(de=1),N.morphAttributes.normal!==void 0&&(de=2),N.morphAttributes.color!==void 0&&(de=3);let B,Z,fe,ye;if(W){const Ct=ci[W];B=Ct.vertexShader,Z=Ct.fragmentShader}else B=y.vertexShader,Z=y.fragmentShader,l.update(y),fe=l.getVertexShaderID(y),ye=l.getFragmentShaderID(y);const xe=n.getRenderTarget(),Pe=re.isInstancedMesh===!0,Ie=re.isBatchedMesh===!0,Ee=!!y.map,qe=!!y.matcap,te=!!Y,_t=!!y.aoMap,be=!!y.lightMap,Ce=!!y.bumpMap,ge=!!y.normalMap,nt=!!y.displacementMap,Ne=!!y.emissiveMap,M=!!y.metalnessMap,v=!!y.roughnessMap,O=y.anisotropy>0,ee=y.clearcoat>0,J=y.iridescence>0,Q=y.sheen>0,_e=y.transmission>0,he=O&&!!y.anisotropyMap,me=ee&&!!y.clearcoatMap,Te=ee&&!!y.clearcoatNormalMap,Ue=ee&&!!y.clearcoatRoughnessMap,$=J&&!!y.iridescenceMap,Xe=J&&!!y.iridescenceThicknessMap,E=Q&&!!y.sheenColorMap,j=Q&&!!y.sheenRoughnessMap,le=!!y.specularMap,ne=!!y.specularColorMap,ve=!!y.specularIntensityMap,He=_e&&!!y.transmissionMap,Ye=_e&&!!y.thicknessMap,Be=!!y.gradientMap,oe=!!y.alphaMap,L=y.alphaTest>0,se=!!y.alphaHash,ae=!!y.extensions,we=!!N.attributes.uv1,Se=!!N.attributes.uv2,Je=!!N.attributes.uv3;let Ke=Bi;return y.toneMapped&&(xe===null||xe.isXRRenderTarget===!0)&&(Ke=n.toneMapping),{isWebGL2:u,shaderID:W,shaderType:y.type,shaderName:y.name,vertexShader:B,fragmentShader:Z,defines:y.defines,customVertexShaderID:fe,customFragmentShaderID:ye,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:m,batching:Ie,instancing:Pe,instancingColor:Pe&&re.instanceColor!==null,supportsVertexTextures:d,outputColorSpace:xe===null?n.outputColorSpace:xe.isXRRenderTarget===!0?xe.texture.colorSpace:wi,map:Ee,matcap:qe,envMap:te,envMapMode:te&&Y.mapping,envMapCubeUVHeight:X,aoMap:_t,lightMap:be,bumpMap:Ce,normalMap:ge,displacementMap:d&&nt,emissiveMap:Ne,normalMapObjectSpace:ge&&y.normalMapType===Ip,normalMapTangentSpace:ge&&y.normalMapType===zu,metalnessMap:M,roughnessMap:v,anisotropy:O,anisotropyMap:he,clearcoat:ee,clearcoatMap:me,clearcoatNormalMap:Te,clearcoatRoughnessMap:Ue,iridescence:J,iridescenceMap:$,iridescenceThicknessMap:Xe,sheen:Q,sheenColorMap:E,sheenRoughnessMap:j,specularMap:le,specularColorMap:ne,specularIntensityMap:ve,transmission:_e,transmissionMap:He,thicknessMap:Ye,gradientMap:Be,opaque:y.transparent===!1&&y.blending===Un,alphaMap:oe,alphaTest:L,alphaHash:se,combine:y.combine,mapUv:Ee&&_(y.map.channel),aoMapUv:_t&&_(y.aoMap.channel),lightMapUv:be&&_(y.lightMap.channel),bumpMapUv:Ce&&_(y.bumpMap.channel),normalMapUv:ge&&_(y.normalMap.channel),displacementMapUv:nt&&_(y.displacementMap.channel),emissiveMapUv:Ne&&_(y.emissiveMap.channel),metalnessMapUv:M&&_(y.metalnessMap.channel),roughnessMapUv:v&&_(y.roughnessMap.channel),anisotropyMapUv:he&&_(y.anisotropyMap.channel),clearcoatMapUv:me&&_(y.clearcoatMap.channel),clearcoatNormalMapUv:Te&&_(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ue&&_(y.clearcoatRoughnessMap.channel),iridescenceMapUv:$&&_(y.iridescenceMap.channel),iridescenceThicknessMapUv:Xe&&_(y.iridescenceThicknessMap.channel),sheenColorMapUv:E&&_(y.sheenColorMap.channel),sheenRoughnessMapUv:j&&_(y.sheenRoughnessMap.channel),specularMapUv:le&&_(y.specularMap.channel),specularColorMapUv:ne&&_(y.specularColorMap.channel),specularIntensityMapUv:ve&&_(y.specularIntensityMap.channel),transmissionMapUv:He&&_(y.transmissionMap.channel),thicknessMapUv:Ye&&_(y.thicknessMap.channel),alphaMapUv:oe&&_(y.alphaMap.channel),vertexTangents:!!N.attributes.tangent&&(ge||O),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!N.attributes.color&&N.attributes.color.itemSize===4,vertexUv1s:we,vertexUv2s:Se,vertexUv3s:Je,pointsUvs:re.isPoints===!0&&!!N.attributes.uv&&(Ee||oe),fog:!!P,useFog:y.fog===!0,fogExp2:P&&P.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:re.isSkinnedMesh===!0,morphTargets:N.morphAttributes.position!==void 0,morphNormals:N.morphAttributes.normal!==void 0,morphColors:N.morphAttributes.color!==void 0,morphTargetsCount:ie,morphTextureStride:de,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:y.dithering,shadowMapEnabled:n.shadowMap.enabled&&F.length>0,shadowMapType:n.shadowMap.type,toneMapping:Ke,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Ee&&y.map.isVideoTexture===!0&&et.getTransfer(y.map.colorSpace)===rt,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===yi,flipSided:y.side===Ut,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionDerivatives:ae&&y.extensions.derivatives===!0,extensionFragDepth:ae&&y.extensions.fragDepth===!0,extensionDrawBuffers:ae&&y.extensions.drawBuffers===!0,extensionShaderTextureLOD:ae&&y.extensions.shaderTextureLOD===!0,extensionClipCullDistance:ae&&y.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()}}function f(y){const b=[];if(y.shaderID?b.push(y.shaderID):(b.push(y.customVertexShaderID),b.push(y.customFragmentShaderID)),y.defines!==void 0)for(const F in y.defines)b.push(F),b.push(y.defines[F]);return y.isRawShaderMaterial===!1&&(w(b,y),x(b,y),b.push(n.outputColorSpace)),b.push(y.customProgramCacheKey),b.join()}function w(y,b){y.push(b.precision),y.push(b.outputColorSpace),y.push(b.envMapMode),y.push(b.envMapCubeUVHeight),y.push(b.mapUv),y.push(b.alphaMapUv),y.push(b.lightMapUv),y.push(b.aoMapUv),y.push(b.bumpMapUv),y.push(b.normalMapUv),y.push(b.displacementMapUv),y.push(b.emissiveMapUv),y.push(b.metalnessMapUv),y.push(b.roughnessMapUv),y.push(b.anisotropyMapUv),y.push(b.clearcoatMapUv),y.push(b.clearcoatNormalMapUv),y.push(b.clearcoatRoughnessMapUv),y.push(b.iridescenceMapUv),y.push(b.iridescenceThicknessMapUv),y.push(b.sheenColorMapUv),y.push(b.sheenRoughnessMapUv),y.push(b.specularMapUv),y.push(b.specularColorMapUv),y.push(b.specularIntensityMapUv),y.push(b.transmissionMapUv),y.push(b.thicknessMapUv),y.push(b.combine),y.push(b.fogExp2),y.push(b.sizeAttenuation),y.push(b.morphTargetsCount),y.push(b.morphAttributeCount),y.push(b.numDirLights),y.push(b.numPointLights),y.push(b.numSpotLights),y.push(b.numSpotLightMaps),y.push(b.numHemiLights),y.push(b.numRectAreaLights),y.push(b.numDirLightShadows),y.push(b.numPointLightShadows),y.push(b.numSpotLightShadows),y.push(b.numSpotLightShadowsWithMaps),y.push(b.numLightProbes),y.push(b.shadowMapType),y.push(b.toneMapping),y.push(b.numClippingPlanes),y.push(b.numClipIntersection),y.push(b.depthPacking)}function x(y,b){o.disableAll(),b.isWebGL2&&o.enable(0),b.supportsVertexTextures&&o.enable(1),b.instancing&&o.enable(2),b.instancingColor&&o.enable(3),b.matcap&&o.enable(4),b.envMap&&o.enable(5),b.normalMapObjectSpace&&o.enable(6),b.normalMapTangentSpace&&o.enable(7),b.clearcoat&&o.enable(8),b.iridescence&&o.enable(9),b.alphaTest&&o.enable(10),b.vertexColors&&o.enable(11),b.vertexAlphas&&o.enable(12),b.vertexUv1s&&o.enable(13),b.vertexUv2s&&o.enable(14),b.vertexUv3s&&o.enable(15),b.vertexTangents&&o.enable(16),b.anisotropy&&o.enable(17),b.alphaHash&&o.enable(18),b.batching&&o.enable(19),y.push(o.mask),o.disableAll(),b.fog&&o.enable(0),b.useFog&&o.enable(1),b.flatShading&&o.enable(2),b.logarithmicDepthBuffer&&o.enable(3),b.skinning&&o.enable(4),b.morphTargets&&o.enable(5),b.morphNormals&&o.enable(6),b.morphColors&&o.enable(7),b.premultipliedAlpha&&o.enable(8),b.shadowMapEnabled&&o.enable(9),b.useLegacyLights&&o.enable(10),b.doubleSided&&o.enable(11),b.flipSided&&o.enable(12),b.useDepthPacking&&o.enable(13),b.dithering&&o.enable(14),b.transmission&&o.enable(15),b.sheen&&o.enable(16),b.opaque&&o.enable(17),b.pointsUvs&&o.enable(18),b.decodeVideoTexture&&o.enable(19),y.push(o.mask)}function A(y){const b=g[y.type];let F;if(b){const G=ci[b];F=um.clone(G.uniforms)}else F=y.uniforms;return F}function D(y,b){let F;for(let G=0,re=c.length;G0?i.push(f):m.transparent===!0?r.push(f):t.push(f)}function l(h,d,m,g,_,p){const f=a(h,d,m,g,_,p);m.transmission>0?i.unshift(f):m.transparent===!0?r.unshift(f):t.unshift(f)}function c(h,d){t.length>1&&t.sort(h||Nx),i.length>1&&i.sort(d||bc),r.length>1&&r.sort(d||bc)}function u(){for(let h=e,d=n.length;h=s.length?(a=new wc,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function Ux(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new Ze};break;case"SpotLight":t={position:new R,direction:new R,color:new Ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new Ze,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new Ze,groundColor:new Ze};break;case"RectAreaLight":t={color:new Ze,position:new R,halfWidth:new R,halfHeight:new R};break}return n[e.id]=t,t}}}function Fx(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let kx=0;function zx(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Bx(n,e){const t=new Ux,i=Fx(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)r.probe.push(new R);const s=new R,a=new ct,o=new ct;function l(u,h){let d=0,m=0,g=0;for(let G=0;G<9;G++)r.probe[G].set(0,0,0);let _=0,p=0,f=0,w=0,x=0,A=0,D=0,C=0,T=0,H=0,y=0;u.sort(zx);const b=h===!0?Math.PI:1;for(let G=0,re=u.length;G0&&(e.isWebGL2?n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ce.LTC_FLOAT_1,r.rectAreaLTC2=ce.LTC_FLOAT_2):(r.rectAreaLTC1=ce.LTC_HALF_1,r.rectAreaLTC2=ce.LTC_HALF_2):n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ce.LTC_FLOAT_1,r.rectAreaLTC2=ce.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=ce.LTC_HALF_1,r.rectAreaLTC2=ce.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=d,r.ambient[1]=m,r.ambient[2]=g;const F=r.hash;(F.directionalLength!==_||F.pointLength!==p||F.spotLength!==f||F.rectAreaLength!==w||F.hemiLength!==x||F.numDirectionalShadows!==A||F.numPointShadows!==D||F.numSpotShadows!==C||F.numSpotMaps!==T||F.numLightProbes!==y)&&(r.directional.length=_,r.spot.length=f,r.rectArea.length=w,r.point.length=p,r.hemi.length=x,r.directionalShadow.length=A,r.directionalShadowMap.length=A,r.pointShadow.length=D,r.pointShadowMap.length=D,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=A,r.pointShadowMatrix.length=D,r.spotLightMatrix.length=C+T-H,r.spotLightMap.length=T,r.numSpotLightShadowsWithMaps=H,r.numLightProbes=y,F.directionalLength=_,F.pointLength=p,F.spotLength=f,F.rectAreaLength=w,F.hemiLength=x,F.numDirectionalShadows=A,F.numPointShadows=D,F.numSpotShadows=C,F.numSpotMaps=T,F.numLightProbes=y,r.version=kx++)}function c(u,h){let d=0,m=0,g=0,_=0,p=0;const f=h.matrixWorldInverse;for(let w=0,x=u.length;w=o.length?(l=new Ec(n,e),o.push(l)):l=o[a],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class Hx extends un{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Rp,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Gx extends un{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Wx="void main(){gl_Position=vec4(position,1.0);}",qx=`uniform sampler2D shadow_pass;uniform vec2 resolution;uniform float radius; -#include -void main(){const float samples=float(VSM_SAMPLES);float mean=0.0;float squared_mean=0.0;float uvStride=samples<=1.0?0.0:2.0/(samples-1.0);float uvStart=samples<=1.0?0.0:-1.0;for(float i=0.0;iu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/W.x),r.x=s.x*W.x,X.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/W.y),r.y=s.y*W.y,X.mapSize.y=s.y)),X.map===null||re===!0||P===!0){const ie=this.type!==vi?{minFilter:Dt,magFilter:Dt}:{};X.map!==null&&X.map.dispose(),X.map=new ln(r.x,r.y,ie),X.map.texture.name=Y.name+".shadowMap",X.camera.updateProjectionMatrix()}n.setRenderTarget(X.map),n.clear();const K=X.getViewportCount();for(let ie=0;ie0||T.map&&T.alphaTest>0){const G=b.uuid,re=T.uuid;let P=c[G];P===void 0&&(P={},c[G]=P);let N=P[re];N===void 0&&(N=b.clone(),P[re]=N,T.addEventListener("dispose",D)),b=N}if(b.visible=T.visible,b.wireframe=T.wireframe,y===vi?b.side=T.shadowSide!==null?T.shadowSide:T.side:b.side=T.shadowSide!==null?T.shadowSide:h[T.side],b.alphaMap=T.alphaMap,b.alphaTest=T.alphaTest,b.map=T.map,b.clipShadows=T.clipShadows,b.clippingPlanes=T.clippingPlanes,b.clipIntersection=T.clipIntersection,b.displacementMap=T.displacementMap,b.displacementScale=T.displacementScale,b.displacementBias=T.displacementBias,b.wireframeLinewidth=T.wireframeLinewidth,b.linewidth=T.linewidth,H.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const G=n.properties.get(b);G.light=H}return b}function A(C,T,H,y,b){if(C.visible===!1)return;if(C.layers.test(T.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&b===vi)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,C.matrixWorld);const re=e.update(C),P=C.material;if(Array.isArray(P)){const N=re.groups;for(let V=0,Y=N.length;V=1):K.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),X=W>=2);let ie=null,de={};const B=n.getParameter(3088),Z=n.getParameter(2978),fe=new st().fromArray(B),ye=new st().fromArray(Z);function xe(L,se,ae,we){const Se=new Uint8Array(4),Je=n.createTexture();n.bindTexture(L,Je),n.texParameteri(L,10241,9728),n.texParameteri(L,10240,9728);for(let Ke=0;Ke"u"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new WeakMap;let h;const d=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(M,v){return m?new OffscreenCanvas(M,v):_r("canvas")}function _(M,v,O,ee){let J=1;if((M.width>ee||M.height>ee)&&(J=ee/Math.max(M.width,M.height)),J<1||v===!0)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap){const Q=v?vs:Math.floor,_e=Q(J*M.width),he=Q(J*M.height);h===void 0&&(h=g(_e,he));const me=O?g(_e,he):h;return me.width=_e,me.height=he,me.getContext("2d").drawImage(M,0,0,_e,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+M.width+"x"+M.height+") to ("+_e+"x"+he+")."),me}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+M.width+"x"+M.height+")."),M;return M}function p(M){return Wa(M.width)&&Wa(M.height)}function f(M){return o?!1:M.wrapS!==ri||M.wrapT!==ri||M.minFilter!==Dt&&M.minFilter!==qt}function w(M,v){return M.generateMipmaps&&v&&M.minFilter!==Dt&&M.minFilter!==qt}function x(M){n.generateMipmap(M)}function A(M,v,O,ee,J=!1){if(o===!1)return v;if(M!==null){if(n[M]!==void 0)return n[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let Q=v;if(v===6403&&(O===5126&&(Q=33326),O===5131&&(Q=33325),O===5121&&(Q=33321)),v===36244&&(O===5121&&(Q=33330),O===5123&&(Q=33332),O===5125&&(Q=33334),O===5120&&(Q=33329),O===5122&&(Q=33331),O===5124&&(Q=33333)),v===33319&&(O===5126&&(Q=33328),O===5131&&(Q=33327),O===5121&&(Q=33323)),v===6408){const _e=J?Ss:et.getTransfer(ee);O===5126&&(Q=34836),O===5131&&(Q=34842),O===5121&&(Q=_e===rt?35907:32856),O===32819&&(Q=32854),O===32820&&(Q=32855)}return(Q===33325||Q===33326||Q===33327||Q===33328||Q===34842||Q===34836)&&e.get("EXT_color_buffer_float"),Q}function D(M,v,O){return w(M,O)===!0||M.isFramebufferTexture&&M.minFilter!==Dt&&M.minFilter!==qt?Math.log2(Math.max(v.width,v.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?v.mipmaps.length:1}function C(M){return M===Dt||M===rl||M===Js?9728:9729}function T(M){const v=M.target;v.removeEventListener("dispose",T),y(v),v.isVideoTexture&&u.delete(v)}function H(M){const v=M.target;v.removeEventListener("dispose",H),F(v)}function y(M){const v=i.get(M);if(v.__webglInit===void 0)return;const O=M.source,ee=d.get(O);if(ee){const J=ee[v.__cacheKey];J.usedTimes--,J.usedTimes===0&&b(M),Object.keys(ee).length===0&&d.delete(O)}i.remove(M)}function b(M){const v=i.get(M);n.deleteTexture(v.__webglTexture);const O=M.source,ee=d.get(O);delete ee[v.__cacheKey],a.memory.textures--}function F(M){const v=M.texture,O=i.get(M),ee=i.get(v);if(ee.__webglTexture!==void 0&&(n.deleteTexture(ee.__webglTexture),a.memory.textures--),M.depthTexture&&M.depthTexture.dispose(),M.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(O.__webglFramebuffer[J]))for(let Q=0;Q=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+r.maxTextures),G+=1,M}function N(M){const v=[];return v.push(M.wrapS),v.push(M.wrapT),v.push(M.wrapR||0),v.push(M.magFilter),v.push(M.minFilter),v.push(M.anisotropy),v.push(M.internalFormat),v.push(M.format),v.push(M.type),v.push(M.generateMipmaps),v.push(M.premultiplyAlpha),v.push(M.flipY),v.push(M.unpackAlignment),v.push(M.colorSpace),v.join()}function V(M,v){const O=i.get(M);if(M.isVideoTexture&&nt(M),M.isRenderTargetTexture===!1&&M.version>0&&O.__version!==M.version){const ee=M.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{fe(O,M,v);return}}t.bindTexture(3553,O.__webglTexture,33984+v)}function Y(M,v){const O=i.get(M);if(M.version>0&&O.__version!==M.version){fe(O,M,v);return}t.bindTexture(35866,O.__webglTexture,33984+v)}function X(M,v){const O=i.get(M);if(M.version>0&&O.__version!==M.version){fe(O,M,v);return}t.bindTexture(32879,O.__webglTexture,33984+v)}function W(M,v){const O=i.get(M);if(M.version>0&&O.__version!==M.version){ye(O,M,v);return}t.bindTexture(34067,O.__webglTexture,33984+v)}const K={[Za]:10497,[ri]:33071,[$a]:33648},ie={[Dt]:9728,[rl]:9984,[Js]:9986,[qt]:9729,[Mp]:9985,[mr]:9987},de={[Np]:512,[Bp]:519,[Op]:513,[Bu]:515,[Up]:514,[zp]:518,[Fp]:516,[kp]:517};function B(M,v,O){if(O?(n.texParameteri(M,10242,K[v.wrapS]),n.texParameteri(M,10243,K[v.wrapT]),(M===32879||M===35866)&&n.texParameteri(M,32882,K[v.wrapR]),n.texParameteri(M,10240,ie[v.magFilter]),n.texParameteri(M,10241,ie[v.minFilter])):(n.texParameteri(M,10242,33071),n.texParameteri(M,10243,33071),(M===32879||M===35866)&&n.texParameteri(M,32882,33071),(v.wrapS!==ri||v.wrapT!==ri)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(M,10240,C(v.magFilter)),n.texParameteri(M,10241,C(v.minFilter)),v.minFilter!==Dt&&v.minFilter!==qt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),v.compareFunction&&(n.texParameteri(M,34892,34894),n.texParameteri(M,34893,de[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ee=e.get("EXT_texture_filter_anisotropic");if(v.magFilter===Dt||v.minFilter!==Js&&v.minFilter!==mr||v.type===ki&&e.has("OES_texture_float_linear")===!1||o===!1&&v.type===gr&&e.has("OES_texture_half_float_linear")===!1)return;(v.anisotropy>1||i.get(v).__currentAnisotropy)&&(n.texParameterf(M,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy)}}function Z(M,v){let O=!1;M.__webglInit===void 0&&(M.__webglInit=!0,v.addEventListener("dispose",T));const ee=v.source;let J=d.get(ee);J===void 0&&(J={},d.set(ee,J));const Q=N(v);if(Q!==M.__cacheKey){J[Q]===void 0&&(J[Q]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,O=!0),J[Q].usedTimes++;const _e=J[M.__cacheKey];_e!==void 0&&(J[M.__cacheKey].usedTimes--,_e.usedTimes===0&&b(v)),M.__cacheKey=Q,M.__webglTexture=J[Q].texture}return O}function fe(M,v,O){let ee=3553;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(ee=35866),v.isData3DTexture&&(ee=32879);const J=Z(M,v),Q=v.source;t.bindTexture(ee,M.__webglTexture,33984+O);const _e=i.get(Q);if(Q.version!==_e.__version||J===!0){t.activeTexture(33984+O);const he=et.getPrimaries(et.workingColorSpace),me=v.colorSpace===Yt?null:et.getPrimaries(v.colorSpace),Te=v.colorSpace===Yt||he===me?0:37444;n.pixelStorei(37440,v.flipY),n.pixelStorei(37441,v.premultiplyAlpha),n.pixelStorei(3317,v.unpackAlignment),n.pixelStorei(37443,Te);const Ue=f(v)&&p(v.image)===!1;let $=_(v.image,Ue,!1,r.maxTextureSize);$=Ne(v,$);const Xe=p($)||o,E=s.convert(v.format,v.colorSpace);let j=s.convert(v.type),le=A(v.internalFormat,E,j,v.colorSpace,v.isVideoTexture);B(ee,v,Xe);let ne;const ve=v.mipmaps,He=o&&v.isVideoTexture!==!0&&le!==Fu,Ye=_e.__version===void 0||J===!0,Be=D(v,$,Xe);if(v.isDepthTexture)le=6402,o?v.type===ki?le=36012:v.type===Fi?le=33190:v.type===tn?le=35056:le=33189:v.type===ki&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),v.format===nn&&le===6402&&v.type!==_o&&v.type!==Fi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),v.type=Fi,j=s.convert(v.type)),v.format===Gn&&le===6402&&(le=34041,v.type!==tn&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),v.type=tn,j=s.convert(v.type))),Ye&&(He?t.texStorage2D(3553,1,le,$.width,$.height):t.texImage2D(3553,0,le,$.width,$.height,0,E,j,null));else if(v.isDataTexture)if(ve.length>0&&Xe){He&&Ye&&t.texStorage2D(3553,Be,le,ve[0].width,ve[0].height);for(let oe=0,L=ve.length;oe>=1,L>>=1}}else if(ve.length>0&&Xe){He&&Ye&&t.texStorage2D(3553,Be,le,ve[0].width,ve[0].height);for(let oe=0,L=ve.length;oe0&&Ye++,t.texStorage2D(34067,Ye,ne,$[0].width,$[0].height));for(let oe=0;oe<6;oe++)if(Ue){ve?t.texSubImage2D(34069+oe,0,0,0,$[oe].width,$[oe].height,j,le,$[oe].data):t.texImage2D(34069+oe,0,ne,$[oe].width,$[oe].height,0,j,le,$[oe].data);for(let L=0;L>Q),$=Math.max(1,v.height>>Q);J===32879||J===35866?t.texImage3D(J,Q,me,Ue,$,v.depth,0,_e,he,null):t.texImage2D(J,Q,me,Ue,$,0,_e,he,null)}t.bindFramebuffer(36160,M),ge(v)?l.framebufferTexture2DMultisampleEXT(36160,ee,J,i.get(O).__webglTexture,0,Ce(v)):(J===3553||J>=34069&&J<=34074)&&n.framebufferTexture2D(36160,ee,J,i.get(O).__webglTexture,Q),t.bindFramebuffer(36160,null)}function Pe(M,v,O){if(n.bindRenderbuffer(36161,M),v.depthBuffer&&!v.stencilBuffer){let ee=o===!0?33190:33189;if(O||ge(v)){const J=v.depthTexture;J&&J.isDepthTexture&&(J.type===ki?ee=36012:J.type===Fi&&(ee=33190));const Q=Ce(v);ge(v)?l.renderbufferStorageMultisampleEXT(36161,Q,ee,v.width,v.height):n.renderbufferStorageMultisample(36161,Q,ee,v.width,v.height)}else n.renderbufferStorage(36161,ee,v.width,v.height);n.framebufferRenderbuffer(36160,36096,36161,M)}else if(v.depthBuffer&&v.stencilBuffer){const ee=Ce(v);O&&ge(v)===!1?n.renderbufferStorageMultisample(36161,ee,35056,v.width,v.height):ge(v)?l.renderbufferStorageMultisampleEXT(36161,ee,35056,v.width,v.height):n.renderbufferStorage(36161,34041,v.width,v.height),n.framebufferRenderbuffer(36160,33306,36161,M)}else{const ee=v.isWebGLMultipleRenderTargets===!0?v.texture:[v.texture];for(let J=0;J0){O.__webglFramebuffer[he]=[];for(let me=0;me0){O.__webglFramebuffer=[];for(let he=0;he0&&ge(M)===!1){const he=Q?v:[v];O.__webglMultisampledFramebuffer=n.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,O.__webglMultisampledFramebuffer);for(let me=0;me0)for(let me=0;me0)for(let me=0;me0&&ge(M)===!1){const v=M.isWebGLMultipleRenderTargets?M.texture:[M.texture],O=M.width,ee=M.height;let J=16384;const Q=[],_e=M.stencilBuffer?33306:36096,he=i.get(M),me=M.isWebGLMultipleRenderTargets===!0;if(me)for(let Te=0;Te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function nt(M){const v=a.render.frame;u.get(M)!==v&&(u.set(M,v),M.update())}function Ne(M,v){const O=M.colorSpace,ee=M.format,J=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||M.format===Ja||O!==wi&&O!==Yt&&(et.getTransfer(O)===rt?o===!1?e.has("EXT_sRGB")===!0&&ee===si?(M.format=Ja,M.minFilter=qt,M.generateMipmaps=!1):v=Gu.sRGBToLinear(v):(ee!==si||J!==Vi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",O)),v}this.allocateTextureUnit=P,this.resetTextureUnits=re,this.setTexture2D=V,this.setTexture2DArray=Y,this.setTexture3D=X,this.setTextureCube=W,this.rebindTextures=qe,this.setupRenderTarget=te,this.updateRenderTargetMipmap=_t,this.updateMultisampleRenderTarget=be,this.setupDepthRenderbuffer=Ee,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=ge}function Zx(n,e,t){const i=t.isWebGL2;function r(s,a=Yt){let o;const l=et.getTransfer(a);if(s===Vi)return 5121;if(s===Du)return 32819;if(s===Iu)return 32820;if(s===bp)return 5120;if(s===wp)return 5122;if(s===_o)return 5123;if(s===Ru)return 5124;if(s===Fi)return 5125;if(s===ki)return 5126;if(s===gr)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===Ep)return 6406;if(s===si)return 6408;if(s===Tp)return 6409;if(s===Ap)return 6410;if(s===nn)return 6402;if(s===Gn)return 34041;if(s===Ja)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===Cp)return 6403;if(s===Nu)return 36244;if(s===Lp)return 33319;if(s===Ou)return 33320;if(s===Uu)return 36249;if(s===Ks||s===Qs||s===ea||s===ta)if(l===rt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===Ks)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Qs)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ea)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===ta)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Ks)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Qs)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ea)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===ta)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===sl||s===al||s===ol||s===ll)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===sl)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===al)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===ol)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===ll)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Fu)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===cl||s===ul)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===cl)return l===rt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===ul)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===hl||s===fl||s===dl||s===pl||s===ml||s===gl||s===_l||s===xl||s===vl||s===yl||s===Sl||s===Ml||s===bl||s===wl)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===hl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===fl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===dl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===pl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ml)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===gl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===_l)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===xl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===vl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===yl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Sl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Ml)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===bl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===wl)return l===rt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===ia||s===El||s===Tl)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===ia)return l===rt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===El)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===Tl)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===Pp||s===Al||s===Cl||s===Ll)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===ia)return o.COMPRESSED_RED_RGTC1_EXT;if(s===Al)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Cl)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Ll)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===tn?i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class $x extends Xt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}const Jx={type:"move"};class Ca{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Jr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Jr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Jr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const p=t.getJointPose(_,i),f=this._getHandJoint(c,_);p!==null&&(f.matrix.fromArray(p.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=p.radius),f.visible=p!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),m=.02,g=.005;c.inputState.pinching&&d>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Jx)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Jr;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class Kx extends cn{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,d=null,m=null,g=null;const _=t.getContextAttributes();let p=null,f=null;const w=[],x=[],A=new De;let D=null;const C=new Xt;C.layers.enable(1),C.viewport=new st;const T=new Xt;T.layers.enable(2),T.viewport=new st;const H=[C,T],y=new $x;y.layers.enable(1),y.layers.enable(2);let b=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(B){let Z=w[B];return Z===void 0&&(Z=new Ca,w[B]=Z),Z.getTargetRaySpace()},this.getControllerGrip=function(B){let Z=w[B];return Z===void 0&&(Z=new Ca,w[B]=Z),Z.getGripSpace()},this.getHand=function(B){let Z=w[B];return Z===void 0&&(Z=new Ca,w[B]=Z),Z.getHandSpace()};function G(B){const Z=x.indexOf(B.inputSource);if(Z===-1)return;const fe=w[Z];fe!==void 0&&(fe.update(B.inputSource,B.frame,c||a),fe.dispatchEvent({type:B.type,data:B.inputSource}))}function re(){r.removeEventListener("select",G),r.removeEventListener("selectstart",G),r.removeEventListener("selectend",G),r.removeEventListener("squeeze",G),r.removeEventListener("squeezestart",G),r.removeEventListener("squeezeend",G),r.removeEventListener("end",re),r.removeEventListener("inputsourceschange",P);for(let B=0;B=0&&(x[ye]=null,w[ye].disconnect(fe))}for(let Z=0;Z=x.length){x.push(fe),ye=Pe;break}else if(x[Pe]===null){x[Pe]=fe,ye=Pe;break}if(ye===-1)break}const xe=w[ye];xe&&xe.connect(fe)}}const N=new R,V=new R;function Y(B,Z,fe){N.setFromMatrixPosition(Z.matrixWorld),V.setFromMatrixPosition(fe.matrixWorld);const ye=N.distanceTo(V),xe=Z.projectionMatrix.elements,Pe=fe.projectionMatrix.elements,Ie=xe[14]/(xe[10]-1),Ee=xe[14]/(xe[10]+1),qe=(xe[9]+1)/xe[5],te=(xe[9]-1)/xe[5],_t=(xe[8]-1)/xe[0],be=(Pe[8]+1)/Pe[0],Ce=Ie*_t,ge=Ie*be,nt=ye/(-_t+be),Ne=nt*-_t;Z.matrixWorld.decompose(B.position,B.quaternion,B.scale),B.translateX(Ne),B.translateZ(nt),B.matrixWorld.compose(B.position,B.quaternion,B.scale),B.matrixWorldInverse.copy(B.matrixWorld).invert();const M=Ie+nt,v=Ee+nt,O=Ce-Ne,ee=ge+(ye-Ne),J=qe*Ee/v*M,Q=te*Ee/v*M;B.projectionMatrix.makePerspective(O,ee,J,Q,M,v),B.projectionMatrixInverse.copy(B.projectionMatrix).invert()}function X(B,Z){Z===null?B.matrixWorld.copy(B.matrix):B.matrixWorld.multiplyMatrices(Z.matrixWorld,B.matrix),B.matrixWorldInverse.copy(B.matrixWorld).invert()}this.updateCamera=function(B){if(r===null)return;y.near=T.near=C.near=B.near,y.far=T.far=C.far=B.far,(b!==y.near||F!==y.far)&&(r.updateRenderState({depthNear:y.near,depthFar:y.far}),b=y.near,F=y.far);const Z=B.parent,fe=y.cameras;X(y,Z);for(let ye=0;ye0&&(p.alphaTest.value=f.alphaTest);const w=e.get(f).envMap;if(w&&(p.envMap.value=w,p.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=f.reflectivity,p.ior.value=f.ior,p.refractionRatio.value=f.refractionRatio),f.lightMap){p.lightMap.value=f.lightMap;const x=n._useLegacyLights===!0?Math.PI:1;p.lightMapIntensity.value=f.lightMapIntensity*x,t(f.lightMap,p.lightMapTransform)}f.aoMap&&(p.aoMap.value=f.aoMap,p.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,p.aoMapTransform))}function a(p,f){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,f.map&&(p.map.value=f.map,t(f.map,p.mapTransform))}function o(p,f){p.dashSize.value=f.dashSize,p.totalSize.value=f.dashSize+f.gapSize,p.scale.value=f.scale}function l(p,f,w,x){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,p.size.value=f.size*w,p.scale.value=x*.5,f.map&&(p.map.value=f.map,t(f.map,p.uvTransform)),f.alphaMap&&(p.alphaMap.value=f.alphaMap,t(f.alphaMap,p.alphaMapTransform)),f.alphaTest>0&&(p.alphaTest.value=f.alphaTest)}function c(p,f){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,p.rotation.value=f.rotation,f.map&&(p.map.value=f.map,t(f.map,p.mapTransform)),f.alphaMap&&(p.alphaMap.value=f.alphaMap,t(f.alphaMap,p.alphaMapTransform)),f.alphaTest>0&&(p.alphaTest.value=f.alphaTest)}function u(p,f){p.specular.value.copy(f.specular),p.shininess.value=Math.max(f.shininess,1e-4)}function h(p,f){f.gradientMap&&(p.gradientMap.value=f.gradientMap)}function d(p,f){p.metalness.value=f.metalness,f.metalnessMap&&(p.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,p.metalnessMapTransform)),p.roughness.value=f.roughness,f.roughnessMap&&(p.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,p.roughnessMapTransform)),e.get(f).envMap&&(p.envMapIntensity.value=f.envMapIntensity)}function m(p,f,w){p.ior.value=f.ior,f.sheen>0&&(p.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),p.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(p.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,p.sheenColorMapTransform)),f.sheenRoughnessMap&&(p.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,p.sheenRoughnessMapTransform))),f.clearcoat>0&&(p.clearcoat.value=f.clearcoat,p.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(p.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,p.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(p.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ut&&p.clearcoatNormalScale.value.negate())),f.iridescence>0&&(p.iridescence.value=f.iridescence,p.iridescenceIOR.value=f.iridescenceIOR,p.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(p.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,p.iridescenceMapTransform)),f.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),f.transmission>0&&(p.transmission.value=f.transmission,p.transmissionSamplerMap.value=w.texture,p.transmissionSamplerSize.value.set(w.width,w.height),f.transmissionMap&&(p.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,p.transmissionMapTransform)),p.thickness.value=f.thickness,f.thicknessMap&&(p.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=f.attenuationDistance,p.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(p.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(p.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=f.specularIntensity,p.specularColor.value.copy(f.specularColor),f.specularColorMap&&(p.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,p.specularColorMapTransform)),f.specularIntensityMap&&(p.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,p.specularIntensityMapTransform))}function g(p,f){f.matcap&&(p.matcap.value=f.matcap)}function _(p,f){const w=e.get(f).light;p.referencePosition.value.setFromMatrixPosition(w.matrixWorld),p.nearDistance.value=w.shadow.camera.near,p.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function ev(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(35375):0;function l(w,x){const A=x.program;i.uniformBlockBinding(w,A)}function c(w,x){let A=r[w.id];A===void 0&&(g(w),A=u(w),r[w.id]=A,w.addEventListener("dispose",p));const D=x.program;i.updateUBOMapping(w,D);const C=e.render.frame;s[w.id]!==C&&(d(w),s[w.id]=C)}function u(w){const x=h();w.__bindingPointIndex=x;const A=n.createBuffer(),D=w.__size,C=w.usage;return n.bindBuffer(35345,A),n.bufferData(35345,D,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,x,A),A}function h(){for(let w=0;w0&&(A+=D-C),w.__size=A,w.__cache={},this}function _(w){const x={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(x.boundary=4,x.storage=4):w.isVector2?(x.boundary=8,x.storage=8):w.isVector3||w.isColor?(x.boundary=16,x.storage=12):w.isVector4?(x.boundary=16,x.storage=16):w.isMatrix3?(x.boundary=48,x.storage=48):w.isMatrix4?(x.boundary=64,x.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),x}function p(w){const x=w.target;x.removeEventListener("dispose",p);const A=a.indexOf(x.__bindingPointIndex);a.splice(A,1),n.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function f(){for(const w in r)n.deleteBuffer(r[w]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class sS{constructor(e={}){const{canvas:t=Wp(),context:i=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;i!==null?d=i.getContextAttributes().alpha:d=a;const m=new Uint32Array(4),g=new Int32Array(4);let _=null,p=null;const f=[],w=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=St,this._useLegacyLights=!1,this.toneMapping=Bi,this.toneMappingExposure=1;const x=this;let A=!1,D=0,C=0,T=null,H=-1,y=null;const b=new st,F=new st;let G=null;const re=new Ze(0);let P=0,N=t.width,V=t.height,Y=1,X=null,W=null;const K=new st(0,0,N,V),ie=new st(0,0,N,V);let de=!1;const B=new So;let Z=!1,fe=!1,ye=null;const xe=new ct,Pe=new De,Ie=new R,Ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function qe(){return T===null?Y:1}let te=i;function _t(S,I){for(let k=0;k{function pe(){if(z.forEach(function(Me){Ne.get(Me).currentProgram.isReady()&&z.delete(Me)}),z.size===0){U(S);return}setTimeout(pe,10)}be.get("KHR_parallel_shader_compile")!==null?pe():setTimeout(pe,10)})};let Ke=null;function xt(S){Ke&&Ke(S)}function Ct(){Lt.stop()}function it(){Lt.start()}const Lt=new Ju;Lt.setAnimationLoop(xt),typeof self<"u"&&Lt.setContext(self),this.setAnimationLoop=function(S){Ke=S,Be.setAnimationLoop(S),S===null?Lt.stop():Lt.start()},Be.addEventListener("sessionstart",Ct),Be.addEventListener("sessionend",it),this.render=function(S,I){if(I!==void 0&&I.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;S.matrixWorldAutoUpdate===!0&&S.updateMatrixWorld(),I.parent===null&&I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),Be.enabled===!0&&Be.isPresenting===!0&&(Be.cameraAutoUpdate===!0&&Be.updateCamera(I),I=Be.getCamera()),S.isScene===!0&&S.onBeforeRender(x,S,I,T),p=Te.get(S,w.length),p.init(),w.push(p),xe.multiplyMatrices(I.projectionMatrix,I.matrixWorldInverse),B.setFromProjectionMatrix(xe),fe=this.localClippingEnabled,Z=Ue.init(this.clippingPlanes,fe),_=me.get(S,f.length),_.init(),f.push(_),li(S,I,0,x.sortObjects),_.finish(),x.sortObjects===!0&&_.sort(X,W),this.info.render.frame++,Z===!0&&Ue.beginShadows();const k=p.state.shadowsArray;if($.render(k,S,I),Z===!0&&Ue.endShadows(),this.info.autoReset===!0&&this.info.reset(),Xe.render(_,S),p.setupLights(x._useLegacyLights),I.isArrayCamera){const z=I.cameras;for(let U=0,pe=z.length;U0?p=w[w.length-1]:p=null,f.pop(),f.length>0?_=f[f.length-1]:_=null};function li(S,I,k,z){if(S.visible===!1)return;if(S.layers.test(I.layers)){if(S.isGroup)k=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(I);else if(S.isLight)p.pushLight(S),S.castShadow&&p.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||B.intersectsSprite(S)){z&&Ie.setFromMatrixPosition(S.matrixWorld).applyMatrix4(xe);const Me=Q.update(S),Ae=S.material;Ae.visible&&_.push(S,Me,Ae,k,Ie.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||B.intersectsObject(S))){const Me=Q.update(S),Ae=S.material;if(z&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),Ie.copy(S.boundingSphere.center)):(Me.boundingSphere===null&&Me.computeBoundingSphere(),Ie.copy(Me.boundingSphere.center)),Ie.applyMatrix4(S.matrixWorld).applyMatrix4(xe)),Array.isArray(Ae)){const Le=Me.groups;for(let Ve=0,Oe=Le.length;Ve0&&af(U,pe,I,k),z&&ge.viewport(b.copy(z)),U.length>0&&Lr(U,I,k),pe.length>0&&Lr(pe,I,k),Me.length>0&&Lr(Me,I,k),ge.buffers.depth.setTest(!0),ge.buffers.depth.setMask(!0),ge.buffers.color.setMask(!0),ge.setPolygonOffset(!1)}function af(S,I,k,z){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;const pe=Ce.isWebGL2;ye===null&&(ye=new ln(1,1,{generateMipmaps:!0,type:be.has("EXT_color_buffer_half_float")?gr:Vi,minFilter:mr,samples:pe?4:0})),x.getDrawingBufferSize(Pe),pe?ye.setSize(Pe.x,Pe.y):ye.setSize(vs(Pe.x),vs(Pe.y));const Me=x.getRenderTarget();x.setRenderTarget(ye),x.getClearColor(re),P=x.getClearAlpha(),P<1&&x.setClearColor(16777215,.5),x.clear();const Ae=x.toneMapping;x.toneMapping=Bi,Lr(S,k,z),M.updateMultisampleRenderTarget(ye),M.updateRenderTargetMipmap(ye);let Le=!1;for(let Ve=0,Oe=I.length;Ve0),Fe=!!k.morphAttributes.position,ut=!!k.morphAttributes.normal,kt=!!k.morphAttributes.color;let vt=Bi;z.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(vt=x.toneMapping);const di=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,at=di!==void 0?di.length:0,Ge=Ne.get(z),Gs=p.state.lights;if(Z===!0&&(fe===!0||S!==y)){const Ht=S===y&&z.id===H;Ue.setState(z,S,Ht)}let ot=!1;z.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==Gs.state.version||Ge.outputColorSpace!==Ae||U.isBatchedMesh&&Ge.batching===!1||!U.isBatchedMesh&&Ge.batching===!0||U.isInstancedMesh&&Ge.instancing===!1||!U.isInstancedMesh&&Ge.instancing===!0||U.isSkinnedMesh&&Ge.skinning===!1||!U.isSkinnedMesh&&Ge.skinning===!0||U.isInstancedMesh&&Ge.instancingColor===!0&&U.instanceColor===null||U.isInstancedMesh&&Ge.instancingColor===!1&&U.instanceColor!==null||Ge.envMap!==Le||z.fog===!0&&Ge.fog!==pe||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==Ue.numPlanes||Ge.numIntersection!==Ue.numIntersection)||Ge.vertexAlphas!==Ve||Ge.vertexTangents!==Oe||Ge.morphTargets!==Fe||Ge.morphNormals!==ut||Ge.morphColors!==kt||Ge.toneMapping!==vt||Ce.isWebGL2===!0&&Ge.morphTargetsCount!==at)&&(ot=!0):(ot=!0,Ge.__version=z.version);let Gi=Ge.currentProgram;ot===!0&&(Gi=Pr(z,I,U));let ko=!1,Qn=!1,Ws=!1;const bt=Gi.getUniforms(),Wi=Ge.uniforms;if(ge.useProgram(Gi.program)&&(ko=!0,Qn=!0,Ws=!0),z.id!==H&&(H=z.id,Qn=!0),ko||y!==S){bt.setValue(te,"projectionMatrix",S.projectionMatrix),bt.setValue(te,"viewMatrix",S.matrixWorldInverse);const Ht=bt.map.cameraPosition;Ht!==void 0&&Ht.setValue(te,Ie.setFromMatrixPosition(S.matrixWorld)),Ce.logarithmicDepthBuffer&&bt.setValue(te,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&bt.setValue(te,"isOrthographic",S.isOrthographicCamera===!0),y!==S&&(y=S,Qn=!0,Ws=!0)}if(U.isSkinnedMesh){bt.setOptional(te,U,"bindMatrix"),bt.setOptional(te,U,"bindMatrixInverse");const Ht=U.skeleton;Ht&&(Ce.floatVertexTextures?(Ht.boneTexture===null&&Ht.computeBoneTexture(),bt.setValue(te,"boneTexture",Ht.boneTexture,M)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}U.isBatchedMesh&&(bt.setOptional(te,U,"batchingTexture"),bt.setValue(te,"batchingTexture",U._matricesTexture,M));const qs=k.morphAttributes;if((qs.position!==void 0||qs.normal!==void 0||qs.color!==void 0&&Ce.isWebGL2===!0)&&E.update(U,k,Gi),(Qn||Ge.receiveShadow!==U.receiveShadow)&&(Ge.receiveShadow=U.receiveShadow,bt.setValue(te,"receiveShadow",U.receiveShadow)),z.isMeshGouraudMaterial&&z.envMap!==null&&(Wi.envMap.value=Le,Wi.flipEnvMap.value=Le.isCubeTexture&&Le.isRenderTargetTexture===!1?-1:1),Qn&&(bt.setValue(te,"toneMappingExposure",x.toneMappingExposure),Ge.needsLights&&lf(Wi,Ws),pe&&z.fog===!0&&he.refreshFogUniforms(Wi,pe),he.refreshMaterialUniforms(Wi,z,Y,V,ye),ms.upload(te,Uo(Ge),Wi,M)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(ms.upload(te,Uo(Ge),Wi,M),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&bt.setValue(te,"center",U.center),bt.setValue(te,"modelViewMatrix",U.modelViewMatrix),bt.setValue(te,"normalMatrix",U.normalMatrix),bt.setValue(te,"modelMatrix",U.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const Ht=z.uniformsGroups;for(let Xs=0,uf=Ht.length;Xs0&&M.useMultisampledRTT(S)===!1?U=Ne.get(S).__webglMultisampledFramebuffer:Array.isArray(Oe)?U=Oe[k]:U=Oe,b.copy(S.viewport),F.copy(S.scissor),G=S.scissorTest}else b.copy(K).multiplyScalar(Y).floor(),F.copy(ie).multiplyScalar(Y).floor(),G=de;if(ge.bindFramebuffer(36160,U)&&Ce.drawBuffers&&z&&ge.drawBuffers(S,U),ge.viewport(b),ge.scissor(F),ge.setScissorTest(G),pe){const Le=Ne.get(S.texture);te.framebufferTexture2D(36160,36064,34069+I,Le.__webglTexture,k)}else if(Me){const Le=Ne.get(S.texture),Ve=I||0;te.framebufferTextureLayer(36160,36064,Le.__webglTexture,k||0,Ve)}H=-1},this.readRenderTargetPixels=function(S,I,k,z,U,pe,Me){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ae=Ne.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Me!==void 0&&(Ae=Ae[Me]),Ae){ge.bindFramebuffer(36160,Ae);try{const Le=S.texture,Ve=Le.format,Oe=Le.type;if(Ve!==si&&ne.convert(Ve)!==te.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Fe=Oe===gr&&(be.has("EXT_color_buffer_half_float")||Ce.isWebGL2&&be.has("EXT_color_buffer_float"));if(Oe!==Vi&&ne.convert(Oe)!==te.getParameter(35738)&&!(Oe===ki&&(Ce.isWebGL2||be.has("OES_texture_float")||be.has("WEBGL_color_buffer_float")))&&!Fe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=S.width-z&&k>=0&&k<=S.height-U&&te.readPixels(I,k,z,U,ne.convert(Ve),ne.convert(Oe),pe)}finally{const Le=T!==null?Ne.get(T).__webglFramebuffer:null;ge.bindFramebuffer(36160,Le)}}},this.copyFramebufferToTexture=function(S,I,k=0){const z=Math.pow(2,-k),U=Math.floor(I.image.width*z),pe=Math.floor(I.image.height*z);M.setTexture2D(I,0),te.copyTexSubImage2D(3553,k,0,0,S.x,S.y,U,pe),ge.unbindTexture()},this.copyTextureToTexture=function(S,I,k,z=0){const U=I.image.width,pe=I.image.height,Me=ne.convert(k.format),Ae=ne.convert(k.type);M.setTexture2D(k,0),te.pixelStorei(37440,k.flipY),te.pixelStorei(37441,k.premultiplyAlpha),te.pixelStorei(3317,k.unpackAlignment),I.isDataTexture?te.texSubImage2D(3553,z,S.x,S.y,U,pe,Me,Ae,I.image.data):I.isCompressedTexture?te.compressedTexSubImage2D(3553,z,S.x,S.y,I.mipmaps[0].width,I.mipmaps[0].height,Me,I.mipmaps[0].data):te.texSubImage2D(3553,z,S.x,S.y,Me,Ae,I.image),z===0&&k.generateMipmaps&&te.generateMipmap(3553),ge.unbindTexture()},this.copyTextureToTexture3D=function(S,I,k,z,U=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const pe=S.max.x-S.min.x+1,Me=S.max.y-S.min.y+1,Ae=S.max.z-S.min.z+1,Le=ne.convert(z.format),Ve=ne.convert(z.type);let Oe;if(z.isData3DTexture)M.setTexture3D(z,0),Oe=32879;else if(z.isDataArrayTexture||z.isCompressedArrayTexture)M.setTexture2DArray(z,0),Oe=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}te.pixelStorei(37440,z.flipY),te.pixelStorei(37441,z.premultiplyAlpha),te.pixelStorei(3317,z.unpackAlignment);const Fe=te.getParameter(3314),ut=te.getParameter(32878),kt=te.getParameter(3316),vt=te.getParameter(3315),di=te.getParameter(32877),at=k.isCompressedTexture?k.mipmaps[U]:k.image;te.pixelStorei(3314,at.width),te.pixelStorei(32878,at.height),te.pixelStorei(3316,S.min.x),te.pixelStorei(3315,S.min.y),te.pixelStorei(32877,S.min.z),k.isDataTexture||k.isData3DTexture?te.texSubImage3D(Oe,U,I.x,I.y,I.z,pe,Me,Ae,Le,Ve,at.data):k.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),te.compressedTexSubImage3D(Oe,U,I.x,I.y,I.z,pe,Me,Ae,Le,at.data)):te.texSubImage3D(Oe,U,I.x,I.y,I.z,pe,Me,Ae,Le,Ve,at),te.pixelStorei(3314,Fe),te.pixelStorei(32878,ut),te.pixelStorei(3316,kt),te.pixelStorei(3315,vt),te.pixelStorei(32877,di),U===0&&z.generateMipmaps&&te.generateMipmap(Oe),ge.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?M.setTextureCube(S,0):S.isData3DTexture?M.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?M.setTexture2DArray(S,0):M.setTexture2D(S,0),ge.unbindTexture()},this.resetState=function(){D=0,C=0,T=null,ge.reset(),ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Si}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===xo?"display-p3":"srgb",t.unpackColorSpace=et.workingColorSpace===Os?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===St?rn:ku}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===rn?St:wi}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class aS extends Mt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Eo extends Jt{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],d=[],m=[];let g=0;const _=[],p=i/2;let f=0;w(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new Nt(h,3)),this.setAttribute("normal",new Nt(d,3)),this.setAttribute("uv",new Nt(m,2));function w(){const A=new R,D=new R;let C=0;const T=(t-e)/i;for(let H=0;H<=s;H++){const y=[],b=H/s,F=b*(t-e)+e;for(let G=0;G<=r;G++){const re=G/r,P=re*l+o,N=Math.sin(P),V=Math.cos(P);D.x=F*N,D.y=-b*i+p,D.z=F*V,h.push(D.x,D.y,D.z),A.set(N,T,V).normalize(),d.push(A.x,A.y,A.z),m.push(re,1-b),y.push(g++)}_.push(y)}for(let H=0;H.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Cc.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Cc,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:mo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=mo);const Lc={type:"change"},Pa={type:"start"},Pc={type:"end"},rs=new br,Rc=new Ni,tv=Math.cos(70*Vd.DEG2RAD);class cS extends cn{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new R,this.cursor=new R,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:fn.ROTATE,MIDDLE:fn.DOLLY,RIGHT:fn.PAN},this.touches={ONE:dn.ROTATE,TWO:dn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(E){E.addEventListener("keydown",Q),this._domElementKeyEvents=E},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Q),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(Lc),i.update(),s=r.NONE},this.update=function(){const E=new R,j=new an().setFromUnitVectors(e.up,new R(0,1,0)),le=j.clone().invert(),ne=new R,ve=new an,He=new R,Ye=2*Math.PI;return function(oe=null){const L=i.object.position;E.copy(L).sub(i.target),E.applyQuaternion(j),o.setFromVector3(E),i.autoRotate&&s===r.NONE&&F(y(oe)),i.enableDamping?(o.theta+=l.theta*i.dampingFactor,o.phi+=l.phi*i.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let se=i.minAzimuthAngle,ae=i.maxAzimuthAngle;isFinite(se)&&isFinite(ae)&&(se<-Math.PI?se+=Ye:se>Math.PI&&(se-=Ye),ae<-Math.PI?ae+=Ye:ae>Math.PI&&(ae-=Ye),se<=ae?o.theta=Math.max(se,Math.min(ae,o.theta)):o.theta=o.theta>(se+ae)/2?Math.max(se,o.theta):Math.min(ae,o.theta)),o.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,o.phi)),o.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),i.target.sub(i.cursor),i.target.clampLength(i.minTargetRadius,i.maxTargetRadius),i.target.add(i.cursor),i.zoomToCursor&&C||i.object.isOrthographicCamera?o.radius=W(o.radius):o.radius=W(o.radius*c),E.setFromSpherical(o),E.applyQuaternion(le),L.copy(i.target).add(E),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),u.set(0,0,0));let we=!1;if(i.zoomToCursor&&C){let Se=null;if(i.object.isPerspectiveCamera){const Je=E.length();Se=W(Je*c);const Ke=Je-Se;i.object.position.addScaledVector(A,Ke),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const Je=new R(D.x,D.y,0);Je.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),we=!0;const Ke=new R(D.x,D.y,0);Ke.unproject(i.object),i.object.position.sub(Ke).add(Je),i.object.updateMatrixWorld(),Se=E.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Se!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Se).add(i.object.position):(rs.origin.copy(i.object.position),rs.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(rs.direction))a||8*(1-ve.dot(i.object.quaternion))>a||He.distanceToSquared(i.target)>0?(i.dispatchEvent(Lc),ne.copy(i.object.position),ve.copy(i.object.quaternion),He.copy(i.target),!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",me),i.domElement.removeEventListener("pointerdown",Ne),i.domElement.removeEventListener("pointercancel",v),i.domElement.removeEventListener("wheel",J),i.domElement.removeEventListener("pointermove",M),i.domElement.removeEventListener("pointerup",v),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",Q),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const a=1e-6,o=new Ac,l=new Ac;let c=1;const u=new R,h=new De,d=new De,m=new De,g=new De,_=new De,p=new De,f=new De,w=new De,x=new De,A=new R,D=new De;let C=!1;const T=[],H={};function y(E){return E!==null?2*Math.PI/60*i.autoRotateSpeed*E:2*Math.PI/60/60*i.autoRotateSpeed}function b(E){const j=Math.abs(E)/(100*(window.devicePixelRatio|0));return Math.pow(.95,i.zoomSpeed*j)}function F(E){l.theta-=E}function G(E){l.phi-=E}const re=function(){const E=new R;return function(le,ne){E.setFromMatrixColumn(ne,0),E.multiplyScalar(-le),u.add(E)}}(),P=function(){const E=new R;return function(le,ne){i.screenSpacePanning===!0?E.setFromMatrixColumn(ne,1):(E.setFromMatrixColumn(ne,0),E.crossVectors(i.object.up,E)),E.multiplyScalar(le),u.add(E)}}(),N=function(){const E=new R;return function(le,ne){const ve=i.domElement;if(i.object.isPerspectiveCamera){const He=i.object.position;E.copy(He).sub(i.target);let Ye=E.length();Ye*=Math.tan(i.object.fov/2*Math.PI/180),re(2*le*Ye/ve.clientHeight,i.object.matrix),P(2*ne*Ye/ve.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(re(le*(i.object.right-i.object.left)/i.object.zoom/ve.clientWidth,i.object.matrix),P(ne*(i.object.top-i.object.bottom)/i.object.zoom/ve.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function V(E){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=E:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Y(E){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=E:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function X(E,j){if(!i.zoomToCursor)return;C=!0;const le=i.domElement.getBoundingClientRect(),ne=E-le.left,ve=j-le.top,He=le.width,Ye=le.height;D.x=ne/He*2-1,D.y=-(ve/Ye)*2+1,A.set(D.x,D.y,1).unproject(i.object).sub(i.object.position).normalize()}function W(E){return Math.max(i.minDistance,Math.min(i.maxDistance,E))}function K(E){h.set(E.clientX,E.clientY)}function ie(E){X(E.clientX,E.clientX),f.set(E.clientX,E.clientY)}function de(E){g.set(E.clientX,E.clientY)}function B(E){d.set(E.clientX,E.clientY),m.subVectors(d,h).multiplyScalar(i.rotateSpeed);const j=i.domElement;F(2*Math.PI*m.x/j.clientHeight),G(2*Math.PI*m.y/j.clientHeight),h.copy(d),i.update()}function Z(E){w.set(E.clientX,E.clientY),x.subVectors(w,f),x.y>0?V(b(x.y)):x.y<0&&Y(b(x.y)),f.copy(w),i.update()}function fe(E){_.set(E.clientX,E.clientY),p.subVectors(_,g).multiplyScalar(i.panSpeed),N(p.x,p.y),g.copy(_),i.update()}function ye(E){X(E.clientX,E.clientY),E.deltaY<0?Y(b(E.deltaY)):E.deltaY>0&&V(b(E.deltaY)),i.update()}function xe(E){let j=!1;switch(E.code){case i.keys.UP:E.ctrlKey||E.metaKey||E.shiftKey?G(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):N(0,i.keyPanSpeed),j=!0;break;case i.keys.BOTTOM:E.ctrlKey||E.metaKey||E.shiftKey?G(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):N(0,-i.keyPanSpeed),j=!0;break;case i.keys.LEFT:E.ctrlKey||E.metaKey||E.shiftKey?F(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):N(i.keyPanSpeed,0),j=!0;break;case i.keys.RIGHT:E.ctrlKey||E.metaKey||E.shiftKey?F(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):N(-i.keyPanSpeed,0),j=!0;break}j&&(E.preventDefault(),i.update())}function Pe(E){if(T.length===1)h.set(E.pageX,E.pageY);else{const j=Xe(E),le=.5*(E.pageX+j.x),ne=.5*(E.pageY+j.y);h.set(le,ne)}}function Ie(E){if(T.length===1)g.set(E.pageX,E.pageY);else{const j=Xe(E),le=.5*(E.pageX+j.x),ne=.5*(E.pageY+j.y);g.set(le,ne)}}function Ee(E){const j=Xe(E),le=E.pageX-j.x,ne=E.pageY-j.y,ve=Math.sqrt(le*le+ne*ne);f.set(0,ve)}function qe(E){i.enableZoom&&Ee(E),i.enablePan&&Ie(E)}function te(E){i.enableZoom&&Ee(E),i.enableRotate&&Pe(E)}function _t(E){if(T.length==1)d.set(E.pageX,E.pageY);else{const le=Xe(E),ne=.5*(E.pageX+le.x),ve=.5*(E.pageY+le.y);d.set(ne,ve)}m.subVectors(d,h).multiplyScalar(i.rotateSpeed);const j=i.domElement;F(2*Math.PI*m.x/j.clientHeight),G(2*Math.PI*m.y/j.clientHeight),h.copy(d)}function be(E){if(T.length===1)_.set(E.pageX,E.pageY);else{const j=Xe(E),le=.5*(E.pageX+j.x),ne=.5*(E.pageY+j.y);_.set(le,ne)}p.subVectors(_,g).multiplyScalar(i.panSpeed),N(p.x,p.y),g.copy(_)}function Ce(E){const j=Xe(E),le=E.pageX-j.x,ne=E.pageY-j.y,ve=Math.sqrt(le*le+ne*ne);w.set(0,ve),x.set(0,Math.pow(w.y/f.y,i.zoomSpeed)),V(x.y),f.copy(w);const He=(E.pageX+j.x)*.5,Ye=(E.pageY+j.y)*.5;X(He,Ye)}function ge(E){i.enableZoom&&Ce(E),i.enablePan&&be(E)}function nt(E){i.enableZoom&&Ce(E),i.enableRotate&&_t(E)}function Ne(E){i.enabled!==!1&&(T.length===0&&(i.domElement.setPointerCapture(E.pointerId),i.domElement.addEventListener("pointermove",M),i.domElement.addEventListener("pointerup",v)),Te(E),E.pointerType==="touch"?_e(E):O(E))}function M(E){i.enabled!==!1&&(E.pointerType==="touch"?he(E):ee(E))}function v(E){Ue(E),T.length===0&&(i.domElement.releasePointerCapture(E.pointerId),i.domElement.removeEventListener("pointermove",M),i.domElement.removeEventListener("pointerup",v)),i.dispatchEvent(Pc),s=r.NONE}function O(E){let j;switch(E.button){case 0:j=i.mouseButtons.LEFT;break;case 1:j=i.mouseButtons.MIDDLE;break;case 2:j=i.mouseButtons.RIGHT;break;default:j=-1}switch(j){case fn.DOLLY:if(i.enableZoom===!1)return;ie(E),s=r.DOLLY;break;case fn.ROTATE:if(E.ctrlKey||E.metaKey||E.shiftKey){if(i.enablePan===!1)return;de(E),s=r.PAN}else{if(i.enableRotate===!1)return;K(E),s=r.ROTATE}break;case fn.PAN:if(E.ctrlKey||E.metaKey||E.shiftKey){if(i.enableRotate===!1)return;K(E),s=r.ROTATE}else{if(i.enablePan===!1)return;de(E),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&i.dispatchEvent(Pa)}function ee(E){switch(s){case r.ROTATE:if(i.enableRotate===!1)return;B(E);break;case r.DOLLY:if(i.enableZoom===!1)return;Z(E);break;case r.PAN:if(i.enablePan===!1)return;fe(E);break}}function J(E){i.enabled===!1||i.enableZoom===!1||s!==r.NONE||(E.preventDefault(),i.dispatchEvent(Pa),ye(E),i.dispatchEvent(Pc))}function Q(E){i.enabled===!1||i.enablePan===!1||xe(E)}function _e(E){switch($(E),T.length){case 1:switch(i.touches.ONE){case dn.ROTATE:if(i.enableRotate===!1)return;Pe(E),s=r.TOUCH_ROTATE;break;case dn.PAN:if(i.enablePan===!1)return;Ie(E),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(i.touches.TWO){case dn.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;qe(E),s=r.TOUCH_DOLLY_PAN;break;case dn.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;te(E),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&i.dispatchEvent(Pa)}function he(E){switch($(E),s){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;_t(E),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;be(E),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;ge(E),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;nt(E),i.update();break;default:s=r.NONE}}function me(E){i.enabled!==!1&&E.preventDefault()}function Te(E){T.push(E.pointerId)}function Ue(E){delete H[E.pointerId];for(let j=0;j=0?g:1e3+g,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Dc={};function hv(n,e={}){const t=JSON.stringify([n,e]);let i=Dc[t];return i||(i=new Intl.ListFormat(n,e),Dc[t]=i),i}let to={};function io(n,e={}){const t=JSON.stringify([n,e]);let i=to[t];return i||(i=new Intl.DateTimeFormat(n,e),to[t]=i),i}let no={};function fv(n,e={}){const t=JSON.stringify([n,e]);let i=no[t];return i||(i=new Intl.NumberFormat(n,e),no[t]=i),i}let ro={};function dv(n,e={}){const{base:t,...i}=e,r=JSON.stringify([n,i]);let s=ro[r];return s||(s=new Intl.RelativeTimeFormat(n,e),ro[r]=s),s}let lr=null;function pv(){return lr||(lr=new Intl.DateTimeFormat().resolvedOptions().locale,lr)}let Ic={};function mv(n){let e=Ic[n];if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Ic[n]=e}return e}function gv(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let i,r;try{i=io(n).resolvedOptions(),r=n}catch{const l=n.substring(0,t);i=io(l).resolvedOptions(),r=l}const{numberingSystem:s,calendar:a}=i;return[r,s,a]}}function _v(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function xv(n){const e=[];for(let t=1;t<=12;t++){const i=ke.utc(2009,t,1);e.push(n(i))}return e}function vv(n){const e=[];for(let t=1;t<=7;t++){const i=ke.utc(2016,11,13+t);e.push(n(i))}return e}function as(n,e,t,i){const r=n.listingMode();return r==="error"?null:r==="en"?t(e):i(e)}function yv(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}class Sv{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:r,floor:s,...a}=i;if(!t||Object.keys(a).length>0){const o={useGrouping:!1,...i};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=fv(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Lo(e,3);return dt(t,this.padTo)}}}class Mv{constructor(e,t,i){this.opts=i,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const a=-1*(e.offset/60),o=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&Ei.create(o).valid?(r=o,this.dt=e):(r="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||r,this.dtf=io(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const i=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:i}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class bv{constructor(e,t,i){this.opts={style:"long",...i},!t&&Dh()&&(this.rtf=dv(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):Gv(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const wv={firstDay:1,minimalDays:4,weekend:[6,7]};class tt{static fromOpts(e){return tt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,i,r,s=!1){const a=e||ht.defaultLocale,o=a||(s?"en-US":pv()),l=t||ht.defaultNumberingSystem,c=i||ht.defaultOutputCalendar,u=so(r)||ht.defaultWeekSettings;return new tt(o,l,c,u,a)}static resetCache(){lr=null,to={},no={},ro={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i,weekSettings:r}={}){return tt.create(e,t,i,r)}constructor(e,t,i,r,s){const[a,o,l]=gv(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=i||l||null,this.weekSettings=r,this.intl=_v(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=yv(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:tt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,so(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return as(this,e,Fh,()=>{const i=t?{month:e,day:"numeric"}:{month:e},r=t?"format":"standalone";return this.monthsCache[r][e]||(this.monthsCache[r][e]=xv(s=>this.extract(s,i,"month"))),this.monthsCache[r][e]})}weekdays(e,t=!1){return as(this,e,Bh,()=>{const i=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=vv(s=>this.extract(s,i,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return as(this,void 0,()=>Vh,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ke.utc(2016,11,13,9),ke.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return as(this,e,Hh,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[ke.utc(-40,1,1),ke.utc(2017,1,1)].map(i=>this.extract(i,t,"era"))),this.eraCache[e]})}extract(e,t,i){const r=this.dtFormatter(e,t),s=r.formatToParts(),a=s.find(o=>o.type.toLowerCase()===i);return a?a.value:null}numberFormatter(e={}){return new Sv(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Mv(e,this.intl,t)}relFormatter(e={}){return new bv(this.intl,this.isEnglish(),e)}listFormatter(e={}){return hv(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ih()?mv(this.locale):wv}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let Da=null;class It extends Er{static get utcInstance(){return Da===null&&(Da=new It(0)),Da}static instance(e){return e===0?It.utcInstance:new It(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new It(Vs(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${fr(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${fr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return fr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class Ev extends Er{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Ui(n,e){if(Re(n)||n===null)return e;if(n instanceof Er)return n;if(Cv(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?ks.instance:t==="utc"||t==="gmt"?It.utcInstance:It.parseSpecifier(t)||Ei.create(n)}else return sn(n)?It.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new Ev(n)}let Nc=()=>Date.now(),Oc="system",Uc=null,Fc=null,kc=null,zc=60,Bc,Vc=null;class ht{static get now(){return Nc}static set now(e){Nc=e}static set defaultZone(e){Oc=e}static get defaultZone(){return Ui(Oc,ks.instance)}static get defaultLocale(){return Uc}static set defaultLocale(e){Uc=e}static get defaultNumberingSystem(){return Fc}static set defaultNumberingSystem(e){Fc=e}static get defaultOutputCalendar(){return kc}static set defaultOutputCalendar(e){kc=e}static get defaultWeekSettings(){return Vc}static set defaultWeekSettings(e){Vc=so(e)}static get twoDigitCutoffYear(){return zc}static set twoDigitCutoffYear(e){zc=e%100}static get throwOnInvalid(){return Bc}static set throwOnInvalid(e){Bc=e}static resetCaches(){tt.resetCache(),Ei.resetCache()}}class ai{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Th=[0,31,59,90,120,151,181,212,243,273,304,334],Ah=[0,31,60,91,121,152,182,213,244,274,305,335];function jt(n,e){return new ai("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function To(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const r=i.getUTCDay();return r===0?7:r}function Ch(n,e,t){return t+(Tr(n)?Ah:Th)[e-1]}function Lh(n,e){const t=Tr(n)?Ah:Th,i=t.findIndex(s=>sxr(i,e,t)?(c=i+1,l=1):c=i,{weekYear:c,weekNumber:l,weekday:o,...Hs(n)}}function Hc(n,e=4,t=1){const{weekYear:i,weekNumber:r,weekday:s}=n,a=Ao(To(i,1,e),t),o=kn(i);let l=r*7+s-a-7+e,c;l<1?(c=i-1,l+=kn(c)):l>o?(c=i+1,l-=kn(i)):c=i;const{month:u,day:h}=Lh(c,l);return{year:c,month:u,day:h,...Hs(n)}}function Ia(n){const{year:e,month:t,day:i}=n,r=Ch(e,t,i);return{year:e,ordinal:r,...Hs(n)}}function Gc(n){const{year:e,ordinal:t}=n,{month:i,day:r}=Lh(e,t);return{year:e,month:i,day:r,...Hs(n)}}function Wc(n,e){if(!Re(n.localWeekday)||!Re(n.localWeekNumber)||!Re(n.localWeekYear)){if(!Re(n.weekday)||!Re(n.weekNumber)||!Re(n.weekYear))throw new On("Cannot mix locale-based week fields with ISO-based week fields");return Re(n.localWeekday)||(n.weekday=n.localWeekday),Re(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),Re(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function Tv(n,e=4,t=1){const i=zs(n.weekYear),r=Zt(n.weekNumber,1,xr(n.weekYear,e,t)),s=Zt(n.weekday,1,7);return i?r?s?!1:jt("weekday",n.weekday):jt("week",n.weekNumber):jt("weekYear",n.weekYear)}function Av(n){const e=zs(n.year),t=Zt(n.ordinal,1,kn(n.year));return e?t?!1:jt("ordinal",n.ordinal):jt("year",n.year)}function Ph(n){const e=zs(n.year),t=Zt(n.month,1,12),i=Zt(n.day,1,As(n.year,n.month));return e?t?i?!1:jt("day",n.day):jt("month",n.month):jt("year",n.year)}function Rh(n){const{hour:e,minute:t,second:i,millisecond:r}=n,s=Zt(e,0,23)||e===24&&t===0&&i===0&&r===0,a=Zt(t,0,59),o=Zt(i,0,59),l=Zt(r,0,999);return s?a?o?l?!1:jt("millisecond",r):jt("second",i):jt("minute",t):jt("hour",e)}function Re(n){return typeof n>"u"}function sn(n){return typeof n=="number"}function zs(n){return typeof n=="number"&&n%1===0}function Cv(n){return typeof n=="string"}function Lv(n){return Object.prototype.toString.call(n)==="[object Date]"}function Dh(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Ih(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Pv(n){return Array.isArray(n)?n:[n]}function qc(n,e,t){if(n.length!==0)return n.reduce((i,r)=>{const s=[e(r),r];return i&&t(i[0],s[0])===i[0]?i:s},null)[1]}function Rv(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function qn(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function so(n){if(n==null)return null;if(typeof n!="object")throw new Ot("Week settings must be an object");if(!Zt(n.firstDay,1,7)||!Zt(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!Zt(e,1,7)))throw new Ot("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function Zt(n,e,t){return zs(n)&&n>=e&&n<=t}function Dv(n,e){return n-e*Math.floor(n/e)}function dt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function Oi(n){if(!(Re(n)||n===null||n===""))return parseInt(n,10)}function Zi(n){if(!(Re(n)||n===null||n===""))return parseFloat(n)}function Co(n){if(!(Re(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Lo(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function Tr(n){return n%4===0&&(n%100!==0||n%400===0)}function kn(n){return Tr(n)?366:365}function As(n,e){const t=Dv(e-1,12)+1,i=n+(e-t)/12;return t===2?Tr(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Bs(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Xc(n,e,t){return-Ao(To(n,1,e),t)+e-1}function xr(n,e=4,t=1){const i=Xc(n,e,t),r=Xc(n+1,e,t);return(kn(n)-i+r)/7}function ao(n){return n>99?n:n>ht.twoDigitCutoffYear?1900+n:2e3+n}function Nh(n,e,t,i=null){const r=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(s.timeZone=i);const a={timeZoneName:e,...s},o=new Intl.DateTimeFormat(t,a).formatToParts(r).find(l=>l.type.toLowerCase()==="timezonename");return o?o.value:null}function Vs(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,r=t<0||Object.is(t,-0)?-i:i;return t*60+r}function Oh(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new Ot(`Invalid unit value ${n}`);return e}function Cs(n,e){const t={};for(const i in n)if(qn(n,i)){const r=n[i];if(r==null)continue;t[e(i)]=Oh(r)}return t}function fr(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),r=n>=0?"+":"-";switch(e){case"short":return`${r}${dt(t,2)}:${dt(i,2)}`;case"narrow":return`${r}${t}${i>0?`:${i}`:""}`;case"techie":return`${r}${dt(t,2)}${dt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Hs(n){return Rv(n,["hour","minute","second","millisecond"])}const Iv=["January","February","March","April","May","June","July","August","September","October","November","December"],Uh=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Nv=["J","F","M","A","M","J","J","A","S","O","N","D"];function Fh(n){switch(n){case"narrow":return[...Nv];case"short":return[...Uh];case"long":return[...Iv];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const kh=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],zh=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ov=["M","T","W","T","F","S","S"];function Bh(n){switch(n){case"narrow":return[...Ov];case"short":return[...zh];case"long":return[...kh];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Vh=["AM","PM"],Uv=["Before Christ","Anno Domini"],Fv=["BC","AD"],kv=["B","A"];function Hh(n){switch(n){case"narrow":return[...kv];case"short":return[...Fv];case"long":return[...Uv];default:return null}}function zv(n){return Vh[n.hour<12?0:1]}function Bv(n,e){return Bh(e)[n.weekday-1]}function Vv(n,e){return Fh(e)[n.month-1]}function Hv(n,e){return Hh(e)[n.year<0?0:1]}function Gv(n,e,t="always",i=!1){const r={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){const h=n==="days";switch(e){case 1:return h?"tomorrow":`next ${r[n][0]}`;case-1:return h?"yesterday":`last ${r[n][0]}`;case 0:return h?"today":`this ${r[n][0]}`}}const a=Object.is(e,-0)||e<0,o=Math.abs(e),l=o===1,c=r[n],u=i?l?c[1]:c[2]||c[1]:l?r[n][0]:n;return a?`${o} ${u} ago`:`in ${o} ${u}`}function Yc(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const Wv={D:Es,DD:oh,DDD:lh,DDDD:ch,t:uh,tt:hh,ttt:fh,tttt:dh,T:ph,TT:mh,TTT:gh,TTTT:_h,f:xh,ff:yh,fff:Mh,ffff:wh,F:vh,FF:Sh,FFF:bh,FFFF:Eh};class At{static create(e,t={}){return new At(e,t)}static parseFormat(e){let t=null,i="",r=!1;const s=[];for(let a=0;a0&&s.push({literal:r||/^\s+$/.test(i),val:i}),t=null,i="",r=!r):r||o===t?i+=o:(i.length>0&&s.push({literal:/^\s+$/.test(i),val:i}),i=o,t=o)}return i.length>0&&s.push({literal:r||/^\s+$/.test(i),val:i}),s}static macroTokenToFormatOpts(e){return Wv[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return dt(e,t);const i={...this.opts};return t>0&&(i.padTo=t),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const i=this.loc.listingMode()==="en",r=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(m,g)=>this.loc.extract(e,m,g),a=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",o=()=>i?zv(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(m,g)=>i?Vv(e,m):s(g?{month:m}:{month:m,day:"numeric"},"month"),c=(m,g)=>i?Bv(e,m):s(g?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{const g=At.macroTokenToFormatOpts(m);return g?this.formatWithSystemDefault(e,g):m},h=m=>i?Hv(e,m):s({era:m},"era"),d=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return r?s({day:"numeric"},"day"):this.num(e.day);case"dd":return r?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return r?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return r?s({month:"numeric"},"month"):this.num(e.month);case"MM":return r?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return r?s({year:"numeric"},"year"):this.num(e.year);case"yy":return r?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(m)}};return Yc(At.parseFormat(t),d)}formatDurationFromString(e,t){const i=l=>{switch(l[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},r=l=>c=>{const u=i(c);return u?this.num(l.get(u),c.length):c},s=At.parseFormat(t),a=s.reduce((l,{literal:c,val:u})=>c?l:l.concat(u),[]),o=e.shiftTo(...a.map(i).filter(l=>l));return Yc(s,r(o))}}const Gh=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Zn(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function $n(...n){return e=>n.reduce(([t,i,r],s)=>{const[a,o,l]=s(e,r);return[{...t,...a},o||i,l]},[{},null,1]).slice(0,2)}function Jn(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const r=t.exec(n);if(r)return i(r)}return[null,null]}function Wh(...n){return(e,t)=>{const i={};let r;for(r=0;rm!==void 0&&(g||m&&u)?-m:m;return[{years:d(Zi(t)),months:d(Zi(i)),weeks:d(Zi(r)),days:d(Zi(s)),hours:d(Zi(a)),minutes:d(Zi(o)),seconds:d(Zi(l),l==="-0"),milliseconds:d(Co(c),h)}]}const ny={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Do(n,e,t,i,r,s,a){const o={year:e.length===2?ao(Oi(e)):Oi(e),month:Uh.indexOf(t)+1,day:Oi(i),hour:Oi(r),minute:Oi(s)};return a&&(o.second=Oi(a)),n&&(o.weekday=n.length>3?kh.indexOf(n)+1:zh.indexOf(n)+1),o}const ry=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function sy(n){const[,e,t,i,r,s,a,o,l,c,u,h]=n,d=Do(e,r,i,t,s,a,o);let m;return l?m=ny[l]:c?m=0:m=Vs(u,h),[d,new It(m)]}function ay(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const oy=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,ly=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,cy=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function jc(n){const[,e,t,i,r,s,a,o]=n;return[Do(e,r,i,t,s,a,o),It.utcInstance]}function uy(n){const[,e,t,i,r,s,a,o]=n;return[Do(e,o,t,i,r,s,a),It.utcInstance]}const hy=Zn(Xv,Ro),fy=Zn(Yv,Ro),dy=Zn(jv,Ro),py=Zn(Xh),jh=$n(Qv,Kn,Ar,Cr),my=$n(Zv,Kn,Ar,Cr),gy=$n($v,Kn,Ar,Cr),_y=$n(Kn,Ar,Cr);function xy(n){return Jn(n,[hy,jh],[fy,my],[dy,gy],[py,_y])}function vy(n){return Jn(ay(n),[ry,sy])}function yy(n){return Jn(n,[oy,jc],[ly,jc],[cy,uy])}function Sy(n){return Jn(n,[ty,iy])}const My=$n(Kn);function by(n){return Jn(n,[ey,My])}const wy=Zn(Jv,Kv),Ey=Zn(Yh),Ty=$n(Kn,Ar,Cr);function Ay(n){return Jn(n,[wy,jh],[Ey,Ty])}const Zc="Invalid Duration",Zh={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Cy={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Zh},Wt=146097/400,Pn=146097/4800,Ly={years:{quarters:4,months:12,weeks:Wt/7,days:Wt,hours:Wt*24,minutes:Wt*24*60,seconds:Wt*24*60*60,milliseconds:Wt*24*60*60*1e3},quarters:{months:3,weeks:Wt/28,days:Wt/4,hours:Wt*24/4,minutes:Wt*24*60/4,seconds:Wt*24*60*60/4,milliseconds:Wt*24*60*60*1e3/4},months:{weeks:Pn/7,days:Pn,hours:Pn*24,minutes:Pn*24*60,seconds:Pn*24*60*60,milliseconds:Pn*24*60*60*1e3},...Zh},en=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Py=en.slice(0).reverse();function Ii(n,e,t=!1){const i={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new $e(i)}function $h(n,e){let t=e.milliseconds??0;for(const i of Py.slice(1))e[i]&&(t+=e[i]*n[i].milliseconds);return t}function $c(n,e){const t=$h(n,e)<0?-1:1;en.reduceRight((i,r)=>{if(Re(e[r]))return i;if(i){const s=e[i]*t,a=n[r][i],o=Math.floor(s/a);e[r]+=o*t,e[i]-=o*a*t}return r},null),en.reduce((i,r)=>{if(Re(e[r]))return i;if(i){const s=e[i]%1;e[i]-=s,e[r]+=s*n[i][r]}return r},null)}function Ry(n){const e={};for(const[t,i]of Object.entries(n))i!==0&&(e[t]=i);return e}class $e{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let i=t?Ly:Cy;e.matrix&&(i=e.matrix),this.values=e.values,this.loc=e.loc||tt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(e,t){return $e.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new Ot(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new $e({values:Cs(e,$e.normalizeUnit),loc:tt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(sn(e))return $e.fromMillis(e);if($e.isDuration(e))return e;if(typeof e=="object")return $e.fromObject(e);throw new Ot(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=Sy(e);return i?$e.fromObject(i,t):$e.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=by(e);return i?$e.fromObject(i,t):$e.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Ot("need to specify a reason the Duration is invalid");const i=e instanceof ai?e:new ai(e,t);if(ht.throwOnInvalid)throw new rv(i);return new $e({invalid:i})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new ah(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const i={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?At.create(this.loc,i).formatDurationFromString(this,e):Zc}toHuman(e={}){if(!this.isValid)return Zc;const t=en.map(i=>{const r=this.values[i];return Re(r)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(r)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Lo(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},ke.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?$h(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=$e.fromDurationLike(e),i={};for(const r of en)(qn(t.values,r)||qn(this.values,r))&&(i[r]=t.get(r)+this.get(r));return Ii(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=$e.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const i of Object.keys(this.values))t[i]=Oh(e(this.values[i],i));return Ii(this,{values:t},!0)}get(e){return this[$e.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Cs(e,$e.normalizeUnit)};return Ii(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i,matrix:r}={}){const a={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:i};return Ii(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return $c(this.matrix,e),Ii(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Ry(this.normalize().shiftToAll().toObject());return Ii(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>$e.normalizeUnit(a));const t={},i={},r=this.toObject();let s;for(const a of en)if(e.indexOf(a)>=0){s=a;let o=0;for(const c in i)o+=this.matrix[c][a]*i[c],i[c]=0;sn(r[a])&&(o+=r[a]);const l=Math.trunc(o);t[a]=l,i[a]=(o*1e3-l*1e3)/1e3}else sn(r[a])&&(i[a]=r[a]);for(const a in i)i[a]!==0&&(t[s]+=a===s?i[a]:i[a]/this.matrix[s][a]);return $c(this.matrix,t),Ii(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Ii(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(i,r){return i===void 0||i===0?r===void 0||r===0:i===r}for(const i of en)if(!t(this.values[i],e.values[i]))return!1;return!0}}const Rn="Invalid Interval";function Dy(n,e){return!n||!n.isValid?lt.invalid("missing or invalid start"):!e||!e.isValid?lt.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?lt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(or).filter(a=>this.contains(a)).sort((a,o)=>a.toMillis()-o.toMillis()),i=[];let{s:r}=this,s=0;for(;r+this.e?this.e:a;i.push(lt.fromDateTimes(r,o)),r=o,s+=1}return i}splitBy(e){const t=$e.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,r=1,s;const a=[];for(;il*r));s=+o>+this.e?this.e:o,a.push(lt.fromDateTimes(i,s)),i=s,r+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,i=this.e=i?null:lt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return lt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((r,s)=>r.s-s.s).reduce(([r,s],a)=>s?s.overlaps(a)||s.abutsStart(a)?[r,s.union(a)]:[r.concat([s]),a]:[r,a],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const r=[],s=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),a=Array.prototype.concat(...s),o=a.sort((l,c)=>l.time-c.time);for(const l of o)i+=l.type==="s"?1:-1,i===1?t=l.time:(t&&+t!=+l.time&&r.push(lt.fromDateTimes(t,l.time)),t=null);return lt.merge(r)}difference(...e){return lt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Rn}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Es,t={}){return this.isValid?At.create(this.s.loc.clone(t),e).formatInterval(this):Rn}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Rn}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Rn}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Rn}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Rn}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):$e.invalid(this.invalidReason)}mapEndpoints(e){return lt.fromDateTimes(e(this.s),e(this.e))}}class os{static hasDST(e=ht.defaultZone){const t=ke.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Ei.isValidZone(e)}static normalizeZone(e){return Ui(e,ht.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||tt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||tt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||tt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null,outputCalendar:s="gregory"}={}){return(r||tt.create(t,i,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null,outputCalendar:s="gregory"}={}){return(r||tt.create(t,i,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null}={}){return(r||tt.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null}={}){return(r||tt.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return tt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return tt.create(t,null,"gregory").eras(e)}static features(){return{relative:Dh(),localeWeek:Ih()}}}function Jc(n,e){const t=r=>r.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor($e.fromMillis(i).as("days"))}function Iy(n,e,t){const i=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{const u=Jc(l,c);return(u-u%7)/7}],["days",Jc]],r={},s=n;let a,o;for(const[l,c]of i)t.indexOf(l)>=0&&(a=l,r[l]=c(n,e),o=s.plus(r),o>e?(r[l]--,n=s.plus(r),n>e&&(o=n,r[l]--,n=s.plus(r))):n=o);return[n,r,o,a]}function Ny(n,e,t,i){let[r,s,a,o]=Iy(n,e,t);const l=e-r,c=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);c.length===0&&(a0?$e.fromMillis(l,i).shiftTo(...c).plus(u):u}const Io={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Kc={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Oy=Io.hanidec.replace(/[\[|\]]/g,"").split("");function Uy(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=s&&i<=a&&(e+=i-s)}}return parseInt(e,10)}else return e}function ti({numberingSystem:n},e=""){return new RegExp(`${Io[n||"latn"]}${e}`)}const Fy="missing Intl.DateTimeFormat.formatToParts support";function Qe(n,e=t=>t){return{regex:n,deser:([t])=>e(Uy(t))}}const ky=" ",Jh=`[ ${ky}]`,Kh=new RegExp(Jh,"g");function zy(n){return n.replace(/\./g,"\\.?").replace(Kh,Jh)}function Qc(n){return n.replace(/\./g,"").replace(Kh," ").toLowerCase()}function ii(n,e){return n===null?null:{regex:RegExp(n.map(zy).join("|")),deser:([t])=>n.findIndex(i=>Qc(t)===Qc(i))+e}}function eu(n,e){return{regex:n,deser:([,t,i])=>Vs(t,i),groups:e}}function ls(n){return{regex:n,deser:([e])=>e}}function By(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Vy(n,e){const t=ti(e),i=ti(e,"{2}"),r=ti(e,"{3}"),s=ti(e,"{4}"),a=ti(e,"{6}"),o=ti(e,"{1,2}"),l=ti(e,"{1,3}"),c=ti(e,"{1,6}"),u=ti(e,"{1,9}"),h=ti(e,"{2,4}"),d=ti(e,"{4,6}"),m=p=>({regex:RegExp(By(p.val)),deser:([f])=>f,literal:!0}),_=(p=>{if(n.literal)return m(p);switch(p.val){case"G":return ii(e.eras("short"),0);case"GG":return ii(e.eras("long"),0);case"y":return Qe(c);case"yy":return Qe(h,ao);case"yyyy":return Qe(s);case"yyyyy":return Qe(d);case"yyyyyy":return Qe(a);case"M":return Qe(o);case"MM":return Qe(i);case"MMM":return ii(e.months("short",!0),1);case"MMMM":return ii(e.months("long",!0),1);case"L":return Qe(o);case"LL":return Qe(i);case"LLL":return ii(e.months("short",!1),1);case"LLLL":return ii(e.months("long",!1),1);case"d":return Qe(o);case"dd":return Qe(i);case"o":return Qe(l);case"ooo":return Qe(r);case"HH":return Qe(i);case"H":return Qe(o);case"hh":return Qe(i);case"h":return Qe(o);case"mm":return Qe(i);case"m":return Qe(o);case"q":return Qe(o);case"qq":return Qe(i);case"s":return Qe(o);case"ss":return Qe(i);case"S":return Qe(l);case"SSS":return Qe(r);case"u":return ls(u);case"uu":return ls(o);case"uuu":return Qe(t);case"a":return ii(e.meridiems(),0);case"kkkk":return Qe(s);case"kk":return Qe(h,ao);case"W":return Qe(o);case"WW":return Qe(i);case"E":case"c":return Qe(t);case"EEE":return ii(e.weekdays("short",!1),1);case"EEEE":return ii(e.weekdays("long",!1),1);case"ccc":return ii(e.weekdays("short",!0),1);case"cccc":return ii(e.weekdays("long",!0),1);case"Z":case"ZZ":return eu(new RegExp(`([+-]${o.source})(?::(${i.source}))?`),2);case"ZZZ":return eu(new RegExp(`([+-]${o.source})(${i.source})?`),2);case"z":return ls(/[a-z_+-/]{1,256}?/i);case" ":return ls(/[^\S\n\r]/);default:return m(p)}})(n)||{invalidReason:Fy};return _.token=n,_}const Hy={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Gy(n,e,t){const{type:i,value:r}=n;if(i==="literal"){const l=/^\s+$/.test(r);return{literal:!l,val:l?" ":r}}const s=e[i];let a=i;i==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=t.hour12?"hour12":"hour24");let o=Hy[a];if(typeof o=="object"&&(o=o[s]),o)return{literal:!1,val:o}}function Wy(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function qy(n,e,t){const i=n.match(e);if(i){const r={};let s=1;for(const a in t)if(qn(t,a)){const o=t[a],l=o.groups?o.groups+1:1;!o.literal&&o.token&&(r[o.token.val[0]]=o.deser(i.slice(s,s+l))),s+=l}return[i,r]}else return[i,{}]}function Xy(n){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,i;return Re(n.z)||(t=Ei.create(n.z)),Re(n.Z)||(t||(t=new It(n.Z)),i=n.Z),Re(n.q)||(n.M=(n.q-1)*3+1),Re(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),Re(n.u)||(n.S=Co(n.u)),[Object.keys(n).reduce((s,a)=>{const o=e(a);return o&&(s[o]=n[a]),s},{}),t,i]}let Na=null;function Yy(){return Na||(Na=ke.fromMillis(1555555555555)),Na}function jy(n,e){if(n.literal)return n;const t=At.macroTokenToFormatOpts(n.val),i=tf(t,e);return i==null||i.includes(void 0)?n:i}function Qh(n,e){return Array.prototype.concat(...n.map(t=>jy(t,e)))}function ef(n,e,t){const i=Qh(At.parseFormat(t),n),r=i.map(a=>Vy(a,n)),s=r.find(a=>a.invalidReason);if(s)return{input:e,tokens:i,invalidReason:s.invalidReason};{const[a,o]=Wy(r),l=RegExp(a,"i"),[c,u]=qy(e,l,o),[h,d,m]=u?Xy(u):[null,null,void 0];if(qn(u,"a")&&qn(u,"H"))throw new On("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:l,rawMatches:c,matches:u,result:h,zone:d,specificOffset:m}}}function Zy(n,e,t){const{result:i,zone:r,specificOffset:s,invalidReason:a}=ef(n,e,t);return[i,r,s,a]}function tf(n,e){if(!n)return null;const i=At.create(e,n).dtFormatter(Yy()),r=i.formatToParts(),s=i.resolvedOptions();return r.map(a=>Gy(a,n,s))}const Oa="Invalid DateTime",tu=864e13;function cs(n){return new ai("unsupported zone",`the zone "${n.name}" is not supported`)}function Ua(n){return n.weekData===null&&(n.weekData=Ts(n.c)),n.weekData}function Fa(n){return n.localWeekData===null&&(n.localWeekData=Ts(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function $i(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new ke({...t,...e,old:t})}function nf(n,e,t){let i=n-e*60*1e3;const r=t.offset(i);if(e===r)return[i,e];i-=(r-e)*60*1e3;const s=t.offset(i);return r===s?[i,r]:[n-Math.min(r,s)*60*1e3,Math.max(r,s)]}function us(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function _s(n,e,t){return nf(Bs(n),e,t)}function iu(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),r=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:i,month:r,day:Math.min(n.c.day,As(i,r))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=$e.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Bs(s);let[l,c]=nf(o,t,n.zone);return a!==0&&(l+=a,c=n.zone.offset(l)),{ts:l,o:c}}function ar(n,e,t,i,r,s){const{setZone:a,zone:o}=t;if(n&&Object.keys(n).length!==0||e){const l=e||o,c=ke.fromObject(n,{...t,zone:l,specificOffset:s});return a?c:c.setZone(o)}else return ke.invalid(new ai("unparsable",`the input "${r}" can't be parsed as ${i}`))}function hs(n,e,t=!0){return n.isValid?At.create(tt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function ka(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=dt(n.c.year,t?6:4),e?(i+="-",i+=dt(n.c.month),i+="-",i+=dt(n.c.day)):(i+=dt(n.c.month),i+=dt(n.c.day)),i}function nu(n,e,t,i,r,s){let a=dt(n.c.hour);return e?(a+=":",a+=dt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(a+=":")):a+=dt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(a+=dt(n.c.second),(n.c.millisecond!==0||!i)&&(a+=".",a+=dt(n.c.millisecond,3))),r&&(n.isOffsetFixed&&n.offset===0&&!s?a+="Z":n.o<0?(a+="-",a+=dt(Math.trunc(-n.o/60)),a+=":",a+=dt(Math.trunc(-n.o%60))):(a+="+",a+=dt(Math.trunc(n.o/60)),a+=":",a+=dt(Math.trunc(n.o%60)))),s&&(a+="["+n.zone.ianaName+"]"),a}const rf={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},$y={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Jy={ordinal:1,hour:0,minute:0,second:0,millisecond:0},sf=["year","month","day","hour","minute","second","millisecond"],Ky=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Qy=["year","ordinal","hour","minute","second","millisecond"];function eS(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new ah(n);return e}function ru(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return eS(n)}}function su(n,e){const t=Ui(e.zone,ht.defaultZone),i=tt.fromObject(e),r=ht.now();let s,a;if(Re(n.year))s=r;else{for(const c of sf)Re(n[c])&&(n[c]=rf[c]);const o=Ph(n)||Rh(n);if(o)return ke.invalid(o);const l=t.offset(r);[s,a]=_s(n,l,t)}return new ke({ts:s,zone:t,loc:i,o:a})}function au(n,e,t){const i=Re(t.round)?!0:t.round,r=(a,o)=>(a=Lo(a,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(a,o)),s=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return r(s(t.unit),t.unit);for(const a of t.units){const o=s(a);if(Math.abs(o)>=1)return r(o,a)}return r(n>e?-0:0,t.units[t.units.length-1])}function ou(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}class ke{constructor(e){const t=e.zone||ht.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new ai("invalid input"):null)||(t.isValid?null:cs(t));this.ts=Re(e.ts)?ht.now():e.ts;let r=null,s=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,s]=[e.old.c,e.old.o];else{const o=t.offset(this.ts);r=us(this.ts,o),i=Number.isNaN(r.year)?new ai("invalid input"):null,r=i?null:r,s=i?null:o}this._zone=t,this.loc=e.loc||tt.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=r,this.o=s,this.isLuxonDateTime=!0}static now(){return new ke({})}static local(){const[e,t]=ou(arguments),[i,r,s,a,o,l,c]=t;return su({year:i,month:r,day:s,hour:a,minute:o,second:l,millisecond:c},e)}static utc(){const[e,t]=ou(arguments),[i,r,s,a,o,l,c]=t;return e.zone=It.utcInstance,su({year:i,month:r,day:s,hour:a,minute:o,second:l,millisecond:c},e)}static fromJSDate(e,t={}){const i=Lv(e)?e.valueOf():NaN;if(Number.isNaN(i))return ke.invalid("invalid input");const r=Ui(t.zone,ht.defaultZone);return r.isValid?new ke({ts:i,zone:r,loc:tt.fromObject(t)}):ke.invalid(cs(r))}static fromMillis(e,t={}){if(sn(e))return e<-tu||e>tu?ke.invalid("Timestamp out of range"):new ke({ts:e,zone:Ui(t.zone,ht.defaultZone),loc:tt.fromObject(t)});throw new Ot(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(sn(e))return new ke({ts:e*1e3,zone:Ui(t.zone,ht.defaultZone),loc:tt.fromObject(t)});throw new Ot("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Ui(t.zone,ht.defaultZone);if(!i.isValid)return ke.invalid(cs(i));const r=tt.fromObject(t),s=Cs(e,ru),{minDaysInFirstWeek:a,startOfWeek:o}=Wc(s,r),l=ht.now(),c=Re(t.specificOffset)?i.offset(l):t.specificOffset,u=!Re(s.ordinal),h=!Re(s.year),d=!Re(s.month)||!Re(s.day),m=h||d,g=s.weekYear||s.weekNumber;if((m||u)&&g)throw new On("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new On("Can't mix ordinal dates with month/day");const _=g||s.weekday&&!m;let p,f,w=us(l,c);_?(p=Ky,f=$y,w=Ts(w,a,o)):u?(p=Qy,f=Jy,w=Ia(w)):(p=sf,f=rf);let x=!1;for(const b of p){const F=s[b];Re(F)?x?s[b]=f[b]:s[b]=w[b]:x=!0}const A=_?Tv(s,a,o):u?Av(s):Ph(s),D=A||Rh(s);if(D)return ke.invalid(D);const C=_?Hc(s,a,o):u?Gc(s):s,[T,H]=_s(C,c,i),y=new ke({ts:T,zone:i,o:H,loc:r});return s.weekday&&m&&e.weekday!==y.weekday?ke.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${y.toISO()}`):y}static fromISO(e,t={}){const[i,r]=xy(e);return ar(i,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,r]=vy(e);return ar(i,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,r]=yy(e);return ar(i,r,t,"HTTP",t)}static fromFormat(e,t,i={}){if(Re(e)||Re(t))throw new Ot("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:s=null}=i,a=tt.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0}),[o,l,c,u]=Zy(a,e,t);return u?ke.invalid(u):ar(o,l,i,`format ${t}`,e,c)}static fromString(e,t,i={}){return ke.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,r]=Ay(e);return ar(i,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Ot("need to specify a reason the DateTime is invalid");const i=e instanceof ai?e:new ai(e,t);if(ht.throwOnInvalid)throw new iv(i);return new ke({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const i=tf(e,tt.fromObject(t));return i?i.map(r=>r?r.val:null).join(""):null}static expandFormat(e,t={}){return Qh(At.parseFormat(e),tt.fromObject(t)).map(r=>r.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ua(this).weekYear:NaN}get weekNumber(){return this.isValid?Ua(this).weekNumber:NaN}get weekday(){return this.isValid?Ua(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Fa(this).weekday:NaN}get localWeekNumber(){return this.isValid?Fa(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Fa(this).weekYear:NaN}get ordinal(){return this.isValid?Ia(this.c).ordinal:NaN}get monthShort(){return this.isValid?os.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?os.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?os.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?os.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,i=Bs(this.c),r=this.zone.offset(i-e),s=this.zone.offset(i+e),a=this.zone.offset(i-r*t),o=this.zone.offset(i-s*t);if(a===o)return[this];const l=i-a*t,c=i-o*t,u=us(l,a),h=us(c,o);return u.hour===h.hour&&u.minute===h.minute&&u.second===h.second&&u.millisecond===h.millisecond?[$i(this,{ts:l}),$i(this,{ts:c})]:[this]}get isInLeapYear(){return Tr(this.year)}get daysInMonth(){return As(this.year,this.month)}get daysInYear(){return this.isValid?kn(this.year):NaN}get weeksInWeekYear(){return this.isValid?xr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?xr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:r}=At.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(It.instance(e),t)}toLocal(){return this.setZone(ht.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Ui(e,ht.defaultZone),e.equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||i){const s=e.offset(this.ts),a=this.toObject();[r]=_s(a,s,e)}return $i(this,{ts:r,zone:e})}else return ke.invalid(cs(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return $i(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Cs(e,ru),{minDaysInFirstWeek:i,startOfWeek:r}=Wc(t,this.loc),s=!Re(t.weekYear)||!Re(t.weekNumber)||!Re(t.weekday),a=!Re(t.ordinal),o=!Re(t.year),l=!Re(t.month)||!Re(t.day),c=o||l,u=t.weekYear||t.weekNumber;if((c||a)&&u)throw new On("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&a)throw new On("Can't mix ordinal dates with month/day");let h;s?h=Hc({...Ts(this.c,i,r),...t},i,r):Re(t.ordinal)?(h={...this.toObject(),...t},Re(t.day)&&(h.day=Math.min(As(h.year,h.month),h.day))):h=Gc({...Ia(this.c),...t});const[d,m]=_s(h,this.o,this.zone);return $i(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;const t=$e.fromDurationLike(e);return $i(this,iu(this,t))}minus(e){if(!this.isValid)return this;const t=$e.fromDurationLike(e).negate();return $i(this,iu(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const i={},r=$e.normalizeUnit(e);switch(r){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(r==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:a}=this;athis.valueOf(),o=a?this:e,l=a?e:this,c=Ny(o,l,s,r);return a?c.negate():c}diffNow(e="milliseconds",t={}){return this.diff(ke.now(),e,t)}until(e){return this.isValid?lt.fromDateTimes(this,e):this}hasSame(e,t,i){if(!this.isValid)return!1;const r=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,i)<=r&&r<=s.endOf(t,i)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||ke.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(ke.isDateTime))throw new Ot("max requires all arguments be DateTimes");return qc(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:r=null,numberingSystem:s=null}=i,a=tt.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0});return ef(a,e,t)}static fromStringExplain(e,t,i={}){return ke.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return Es}static get DATE_MED(){return oh}static get DATE_MED_WITH_WEEKDAY(){return sv}static get DATE_FULL(){return lh}static get DATE_HUGE(){return ch}static get TIME_SIMPLE(){return uh}static get TIME_WITH_SECONDS(){return hh}static get TIME_WITH_SHORT_OFFSET(){return fh}static get TIME_WITH_LONG_OFFSET(){return dh}static get TIME_24_SIMPLE(){return ph}static get TIME_24_WITH_SECONDS(){return mh}static get TIME_24_WITH_SHORT_OFFSET(){return gh}static get TIME_24_WITH_LONG_OFFSET(){return _h}static get DATETIME_SHORT(){return xh}static get DATETIME_SHORT_WITH_SECONDS(){return vh}static get DATETIME_MED(){return yh}static get DATETIME_MED_WITH_SECONDS(){return Sh}static get DATETIME_MED_WITH_WEEKDAY(){return av}static get DATETIME_FULL(){return Mh}static get DATETIME_FULL_WITH_SECONDS(){return bh}static get DATETIME_HUGE(){return wh}static get DATETIME_HUGE_WITH_SECONDS(){return Eh}}function or(n){if(ke.isDateTime(n))return n;if(n&&n.valueOf&&sn(n.valueOf()))return ke.fromJSDate(n);if(n&&typeof n=="object")return ke.fromObject(n);throw new Ot(`Unknown datetime argument: ${n}, of type ${typeof n}`)}export{Qo as A,Ut as B,Ze as C,ke as D,Nt as F,Jr as G,Xu as L,nS as M,Xa as O,iS as P,oS as R,$u as S,tS as T,um as U,R as V,sS as W,Mi as a,on as b,Jt as c,qd as d,qa as e,rS as f,mm as g,aS as h,pt as i,lS as j,Xt as k,cS as l,De as m}; diff --git a/assets/vendor-tzzAqV-x.js b/assets/vendor-tzzAqV-x.js new file mode 100644 index 0000000..64f1fe4 --- /dev/null +++ b/assets/vendor-tzzAqV-x.js @@ -0,0 +1,2020 @@ +function tu(n,e){return function(){return n.apply(e,arguments)}}const{toString:tf}=Object.prototype,{getPrototypeOf:to}=Object,Es=(n=>e=>{const t=tf.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ci=n=>(n=n.toLowerCase(),e=>Es(e)===n),Ts=n=>e=>typeof e===n,{isArray:Gn}=Array,hr=Ts("undefined");function nf(n){return n!==null&&!hr(n)&&n.constructor!==null&&!hr(n.constructor)&&Yt(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const iu=ci("ArrayBuffer");function rf(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&iu(n.buffer),e}const sf=Ts("string"),Yt=Ts("function"),nu=Ts("number"),As=n=>n!==null&&typeof n=="object",af=n=>n===!0||n===!1,cs=n=>{if(Es(n)!=="object")return!1;const e=to(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},of=ci("Date"),lf=ci("File"),cf=ci("Blob"),uf=ci("FileList"),hf=n=>As(n)&&Yt(n.pipe),ff=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Yt(n.append)&&((e=Es(n))==="formdata"||e==="object"&&Yt(n.toString)&&n.toString()==="[object FormData]"))},df=ci("URLSearchParams"),pf=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function _r(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),Gn(n))for(i=0,r=n.length;i0;)if(r=t[i],e===r.toLowerCase())return r;return null}const su=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,au=n=>!hr(n)&&n!==su;function Oa(){const{caseless:n}=au(this)&&this||{},e={},t=(i,r)=>{const s=n&&ru(e,r)||r;cs(e[s])&&cs(i)?e[s]=Oa(e[s],i):cs(i)?e[s]=Oa({},i):Gn(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i(_r(e,(r,s)=>{t&&Yt(r)?n[s]=tu(r,t):n[s]=r},{allOwnKeys:i}),n),gf=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),_f=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},xf=(n,e,t,i)=>{let r,s,a;const o={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)a=r[s],(!i||i(a,n,e))&&!o[a]&&(e[a]=n[a],o[a]=!0);n=t!==!1&&to(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},vf=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},yf=n=>{if(!n)return null;if(Gn(n))return n;let e=n.length;if(!nu(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},Sf=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&to(Uint8Array)),Mf=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},bf=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},wf=ci("HTMLFormElement"),Ef=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),Oo=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Tf=ci("RegExp"),ou=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};_r(t,(r,s)=>{let a;(a=e(r,s,n))!==!1&&(i[s]=a||r)}),Object.defineProperties(n,i)},Af=n=>{ou(n,(e,t)=>{if(Yt(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if(Yt(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Cf=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return Gn(n)?i(n):i(String(n).split(e)),t},Lf=()=>{},Pf=(n,e)=>(n=+n,Number.isFinite(n)?n:e),Gs="abcdefghijklmnopqrstuvwxyz",No="0123456789",lu={DIGIT:No,ALPHA:Gs,ALPHA_DIGIT:Gs+Gs.toUpperCase()+No},Rf=(n=16,e=lu.ALPHA_DIGIT)=>{let t="";const{length:i}=e;for(;n--;)t+=e[Math.random()*i|0];return t};function Df(n){return!!(n&&Yt(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const If=n=>{const e=new Array(10),t=(i,r)=>{if(As(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=Gn(i)?[]:{};return _r(i,(a,o)=>{const l=t(a,r+1);!hr(l)&&(s[o]=l)}),e[r]=void 0,s}}return i};return t(n,0)},Of=ci("AsyncFunction"),Nf=n=>n&&(As(n)||Yt(n))&&Yt(n.then)&&Yt(n.catch),H={isArray:Gn,isArrayBuffer:iu,isBuffer:nf,isFormData:ff,isArrayBufferView:rf,isString:sf,isNumber:nu,isBoolean:af,isObject:As,isPlainObject:cs,isUndefined:hr,isDate:of,isFile:lf,isBlob:cf,isRegExp:Tf,isFunction:Yt,isStream:hf,isURLSearchParams:df,isTypedArray:Sf,isFileList:uf,forEach:_r,merge:Oa,extend:mf,trim:pf,stripBOM:gf,inherits:_f,toFlatObject:xf,kindOf:Es,kindOfTest:ci,endsWith:vf,toArray:yf,forEachEntry:Mf,matchAll:bf,isHTMLForm:wf,hasOwnProperty:Oo,hasOwnProp:Oo,reduceDescriptors:ou,freezeMethods:Af,toObjectSet:Cf,toCamelCase:Ef,noop:Lf,toFiniteNumber:Pf,findKey:ru,global:su,isContextDefined:au,ALPHABET:lu,generateString:Rf,isSpecCompliantForm:Df,toJSONObject:If,isAsyncFn:Of,isThenable:Nf};function We(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r)}H.inherits(We,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:H.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const cu=We.prototype,uu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{uu[n]={value:n}});Object.defineProperties(We,uu);Object.defineProperty(cu,"isAxiosError",{value:!0});We.from=(n,e,t,i,r,s)=>{const a=Object.create(cu);return H.toFlatObject(n,a,function(l){return l!==Error.prototype},o=>o!=="isAxiosError"),We.call(a,n.message,e,t,i,r),a.cause=n,a.name=n.name,s&&Object.assign(a,s),a};const Uf=null;function Na(n){return H.isPlainObject(n)||H.isArray(n)}function hu(n){return H.endsWith(n,"[]")?n.slice(0,-2):n}function Uo(n,e,t){return n?n.concat(e).map(function(r,s){return r=hu(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function Ff(n){return H.isArray(n)&&!n.some(Na)}const kf=H.toFlatObject(H,{},null,function(e){return/^is[A-Z]/.test(e)});function Cs(n,e,t){if(!H.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=H.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,p){return!H.isUndefined(p[_])});const i=t.metaTokens,r=t.visitor||u,s=t.dots,a=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&H.isSpecCompliantForm(e);if(!H.isFunction(r))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(H.isDate(g))return g.toISOString();if(!l&&H.isBlob(g))throw new We("Blob is not supported. Use a Buffer instead.");return H.isArrayBuffer(g)||H.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function u(g,_,p){let f=g;if(g&&!p&&typeof g=="object"){if(H.endsWith(_,"{}"))_=i?_:_.slice(0,-2),g=JSON.stringify(g);else if(H.isArray(g)&&Ff(g)||(H.isFileList(g)||H.endsWith(_,"[]"))&&(f=H.toArray(g)))return _=hu(_),f.forEach(function(x,C){!(H.isUndefined(x)||x===null)&&e.append(a===!0?Uo([_],C,s):a===null?_:_+"[]",c(x))}),!1}return Na(g)?!0:(e.append(Uo(p,_,s),c(g)),!1)}const h=[],d=Object.assign(kf,{defaultVisitor:u,convertValue:c,isVisitable:Na});function m(g,_){if(!H.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+_.join("."));h.push(g),H.forEach(g,function(f,b){(!(H.isUndefined(f)||f===null)&&r.call(e,f,H.isString(b)?b.trim():b,_,d))===!0&&m(f,_?_.concat(b):[b])}),h.pop()}}if(!H.isObject(n))throw new TypeError("data must be an object");return m(n),e}function Fo(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function io(n,e){this._pairs=[],n&&Cs(n,this,e)}const fu=io.prototype;fu.append=function(e,t){this._pairs.push([e,t])};fu.toString=function(e){const t=e?function(i){return e.call(this,i,Fo)}:Fo;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function zf(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function du(n,e,t){if(!e)return n;const i=t&&t.encode||zf,r=t&&t.serialize;let s;if(r?s=r(e,t):s=H.isURLSearchParams(e)?e.toString():new io(e,t).toString(i),s){const a=n.indexOf("#");a!==-1&&(n=n.slice(0,a)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class ko{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){H.forEach(this.handlers,function(i){i!==null&&e(i)})}}const pu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Bf=typeof URLSearchParams<"u"?URLSearchParams:io,Vf=typeof FormData<"u"?FormData:null,Hf=typeof Blob<"u"?Blob:null,Gf={isBrowser:!0,classes:{URLSearchParams:Bf,FormData:Vf,Blob:Hf},protocols:["http","https","file","blob","url","data"]},mu=typeof window<"u"&&typeof document<"u",Wf=(n=>mu&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),qf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jf=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:mu,hasStandardBrowserEnv:Wf,hasStandardBrowserWebWorkerEnv:qf},Symbol.toStringTag,{value:"Module"})),oi={...jf,...Gf};function Xf(n,e){return Cs(n,new oi.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return oi.isNode&&H.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Yf(n){return H.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Zf(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i=t.length;return a=!a&&H.isArray(r)?r.length:a,l?(H.hasOwnProp(r,a)?r[a]=[r[a],i]:r[a]=i,!o):((!r[a]||!H.isObject(r[a]))&&(r[a]=[]),e(t,i,r[a],s)&&H.isArray(r[a])&&(r[a]=Zf(r[a])),!o)}if(H.isFormData(n)&&H.isFunction(n.entries)){const t={};return H.forEachEntry(n,(i,r)=>{e(Yf(i),r,t,0)}),t}return null}function $f(n,e,t){if(H.isString(n))try{return(e||JSON.parse)(n),H.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(n)}const no={transitional:pu,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=H.isObject(e);if(s&&H.isHTMLForm(e)&&(e=new FormData(e)),H.isFormData(e))return r&&r?JSON.stringify(gu(e)):e;if(H.isArrayBuffer(e)||H.isBuffer(e)||H.isStream(e)||H.isFile(e)||H.isBlob(e))return e;if(H.isArrayBufferView(e))return e.buffer;if(H.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Xf(e,this.formSerializer).toString();if((o=H.isFileList(e))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Cs(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),$f(e)):e}],transformResponse:[function(e){const t=this.transitional||no.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(e&&H.isString(e)&&(i&&!this.responseType||r)){const a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?We.from(o,We.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oi.classes.FormData,Blob:oi.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};H.forEach(["delete","get","head","post","put","patch"],n=>{no.headers[n]={}});const ro=no,Jf=H.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Kf=n=>{const e={};let t,i,r;return n&&n.split(` +`).forEach(function(a){r=a.indexOf(":"),t=a.substring(0,r).trim().toLowerCase(),i=a.substring(r+1).trim(),!(!t||e[t]&&Jf[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},zo=Symbol("internals");function Jn(n){return n&&String(n).trim().toLowerCase()}function us(n){return n===!1||n==null?n:H.isArray(n)?n.map(us):String(n)}function Qf(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const ed=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Ws(n,e,t,i,r){if(H.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!H.isString(e)){if(H.isString(i))return e.indexOf(i)!==-1;if(H.isRegExp(i))return i.test(e)}}function td(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function id(n,e){const t=H.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(n,i+t,{value:function(r,s,a){return this[i].call(this,e,r,s,a)},configurable:!0})})}class Ls{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(o,l,c){const u=Jn(l);if(!u)throw new Error("header name must be a non-empty string");const h=H.findKey(r,u);(!h||r[h]===void 0||c===!0||c===void 0&&r[h]!==!1)&&(r[h||l]=us(o))}const a=(o,l)=>H.forEach(o,(c,u)=>s(c,u,l));return H.isPlainObject(e)||e instanceof this.constructor?a(e,t):H.isString(e)&&(e=e.trim())&&!ed(e)?a(Kf(e),t):e!=null&&s(t,e,i),this}get(e,t){if(e=Jn(e),e){const i=H.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return Qf(r);if(H.isFunction(t))return t.call(this,r,i);if(H.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Jn(e),e){const i=H.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||Ws(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function s(a){if(a=Jn(a),a){const o=H.findKey(i,a);o&&(!t||Ws(i,i[o],o,t))&&(delete i[o],r=!0)}}return H.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];(!e||Ws(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return H.forEach(this,(r,s)=>{const a=H.findKey(i,s);if(a){t[a]=us(r),delete t[s];return}const o=e?td(s):String(s).trim();o!==s&&delete t[s],t[o]=us(r),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return H.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&H.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[zo]=this[zo]={accessors:{}}).accessors,r=this.prototype;function s(a){const o=Jn(a);i[o]||(id(r,a),i[o]=!0)}return H.isArray(e)?e.forEach(s):s(e),this}}Ls.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);H.reduceDescriptors(Ls.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(i){this[t]=i}}});H.freezeMethods(Ls);const Si=Ls;function qs(n,e){const t=this||ro,i=e||t,r=Si.from(i.headers);let s=i.data;return H.forEach(n,function(o){s=o.call(t,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function _u(n){return!!(n&&n.__CANCEL__)}function xr(n,e,t){We.call(this,n??"canceled",We.ERR_CANCELED,e,t),this.name="CanceledError"}H.inherits(xr,We,{__CANCEL__:!0});function nd(n,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?n(t):e(new We("Request failed with status code "+t.status,[We.ERR_BAD_REQUEST,We.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const rd=oi.hasStandardBrowserEnv?{write(n,e,t,i,r,s){const a=[n+"="+encodeURIComponent(e)];H.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),H.isString(i)&&a.push("path="+i),H.isString(r)&&a.push("domain="+r),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function sd(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function ad(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function xu(n,e){return n&&!sd(e)?ad(n,e):e}const od=oi.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function r(s){let a=s;return e&&(t.setAttribute("href",a),a=t.href),t.setAttribute("href",a),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return i=r(window.location.href),function(a){const o=H.isString(a)?r(a):a;return o.protocol===i.protocol&&o.host===i.host}}():function(){return function(){return!0}}();function ld(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function cd(n,e){n=n||10;const t=new Array(n),i=new Array(n);let r=0,s=0,a;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=i[s];a||(a=c),t[r]=l,i[r]=c;let h=s,d=0;for(;h!==r;)d+=t[h++],h=h%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),c-a{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-t,l=i(o),c=s<=a;t=s;const u={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&c?(a-s)/l:void 0,event:r};u[e?"download":"upload"]=!0,n(u)}}const ud=typeof XMLHttpRequest<"u",hd=ud&&function(n){return new Promise(function(t,i){let r=n.data;const s=Si.from(n.headers).normalize();let{responseType:a,withXSRFToken:o}=n,l;function c(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let u;if(H.isFormData(r)){if(oi.hasStandardBrowserEnv||oi.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((u=s.getContentType())!==!1){const[_,...p]=u?u.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([_||"multipart/form-data",...p].join("; "))}}let h=new XMLHttpRequest;if(n.auth){const _=n.auth.username||"",p=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(_+":"+p))}const d=xu(n.baseURL,n.url);h.open(n.method.toUpperCase(),du(d,n.params,n.paramsSerializer),!0),h.timeout=n.timeout;function m(){if(!h)return;const _=Si.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),f={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:_,config:n,request:h};nd(function(x){t(x),c()},function(x){i(x),c()},f),h=null}if("onloadend"in h?h.onloadend=m:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(m)},h.onabort=function(){h&&(i(new We("Request aborted",We.ECONNABORTED,n,h)),h=null)},h.onerror=function(){i(new We("Network Error",We.ERR_NETWORK,n,h)),h=null},h.ontimeout=function(){let p=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const f=n.transitional||pu;n.timeoutErrorMessage&&(p=n.timeoutErrorMessage),i(new We(p,f.clarifyTimeoutError?We.ETIMEDOUT:We.ECONNABORTED,n,h)),h=null},oi.hasStandardBrowserEnv&&(o&&H.isFunction(o)&&(o=o(n)),o||o!==!1&&od(d))){const _=n.xsrfHeaderName&&n.xsrfCookieName&&rd.read(n.xsrfCookieName);_&&s.set(n.xsrfHeaderName,_)}r===void 0&&s.setContentType(null),"setRequestHeader"in h&&H.forEach(s.toJSON(),function(p,f){h.setRequestHeader(f,p)}),H.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),a&&a!=="json"&&(h.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&h.addEventListener("progress",Bo(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",Bo(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=_=>{h&&(i(!_||_.type?new xr(null,n,h):_),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const g=ld(d);if(g&&oi.protocols.indexOf(g)===-1){i(new We("Unsupported protocol "+g+":",We.ERR_BAD_REQUEST,n));return}h.send(r||null)})},Ua={http:Uf,xhr:hd};H.forEach(Ua,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const Vo=n=>`- ${n}`,fd=n=>H.isFunction(n)||n===null||n===!1,vu={getAdapter:n=>{n=H.isArray(n)?n:[n];const{length:e}=n;let t,i;const r={};for(let s=0;s`adapter ${o} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since : +`+s.map(Vo).join(` +`):" "+Vo(s[0]):"as no adapter specified";throw new We("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i},adapters:Ua};function js(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new xr(null,n)}function Ho(n){return js(n),n.headers=Si.from(n.headers),n.data=qs.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),vu.getAdapter(n.adapter||ro.adapter)(n).then(function(i){return js(n),i.data=qs.call(n,n.transformResponse,i),i.headers=Si.from(i.headers),i},function(i){return _u(i)||(js(n),i&&i.response&&(i.response.data=qs.call(n,n.transformResponse,i.response),i.response.headers=Si.from(i.response.headers))),Promise.reject(i)})}const Go=n=>n instanceof Si?n.toJSON():n;function Fn(n,e){e=e||{};const t={};function i(c,u,h){return H.isPlainObject(c)&&H.isPlainObject(u)?H.merge.call({caseless:h},c,u):H.isPlainObject(u)?H.merge({},u):H.isArray(u)?u.slice():u}function r(c,u,h){if(H.isUndefined(u)){if(!H.isUndefined(c))return i(void 0,c,h)}else return i(c,u,h)}function s(c,u){if(!H.isUndefined(u))return i(void 0,u)}function a(c,u){if(H.isUndefined(u)){if(!H.isUndefined(c))return i(void 0,c)}else return i(void 0,u)}function o(c,u,h){if(h in e)return i(c,u);if(h in n)return i(void 0,c)}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,u)=>r(Go(c),Go(u),!0)};return H.forEach(Object.keys(Object.assign({},n,e)),function(u){const h=l[u]||r,d=h(n[u],e[u],u);H.isUndefined(d)&&h!==o||(t[u]=d)}),t}const yu="1.6.4",so={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{so[n]=function(i){return typeof i===n||"a"+(e<1?"n ":" ")+n}});const Wo={};so.transitional=function(e,t,i){function r(s,a){return"[Axios v"+yu+"] Transitional option '"+s+"'"+a+(i?". "+i:"")}return(s,a,o)=>{if(e===!1)throw new We(r(a," has been removed"+(t?" in "+t:"")),We.ERR_DEPRECATED);return t&&!Wo[a]&&(Wo[a]=!0,console.warn(r(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,a,o):!0}};function dd(n,e,t){if(typeof n!="object")throw new We("options must be an object",We.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let r=i.length;for(;r-- >0;){const s=i[r],a=e[s];if(a){const o=n[s],l=o===void 0||a(o,s,n);if(l!==!0)throw new We("option "+s+" must be "+l,We.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new We("Unknown option "+s,We.ERR_BAD_OPTION)}}const Fa={assertOptions:dd,validators:so},wi=Fa.validators;class ms{constructor(e){this.defaults=e,this.interceptors={request:new ko,response:new ko}}request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Fn(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;i!==void 0&&Fa.assertOptions(i,{silentJSONParsing:wi.transitional(wi.boolean),forcedJSONParsing:wi.transitional(wi.boolean),clarifyTimeoutError:wi.transitional(wi.boolean)},!1),r!=null&&(H.isFunction(r)?t.paramsSerializer={serialize:r}:Fa.assertOptions(r,{encode:wi.function,serialize:wi.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=s&&H.merge(s.common,s[t.method]);s&&H.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),t.headers=Si.concat(a,s);const o=[];let l=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(t)===!1||(l=l&&_.synchronous,o.unshift(_.fulfilled,_.rejected))});const c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let u,h=0,d;if(!l){const g=[Ho.bind(this),void 0];for(g.unshift.apply(g,o),g.push.apply(g,c),d=g.length,u=Promise.resolve(t);h{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const a=new Promise(o=>{i.subscribe(o),s=o}).then(r);return a.cancel=function(){i.unsubscribe(s)},a},e(function(s,a,o){i.reason||(i.reason=new xr(s,a,o),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new ao(function(r){e=r}),cancel:e}}}const pd=ao;function md(n){return function(t){return n.apply(null,t)}}function gd(n){return H.isObject(n)&&n.isAxiosError===!0}const ka={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ka).forEach(([n,e])=>{ka[e]=n});const _d=ka;function Su(n){const e=new hs(n),t=tu(hs.prototype.request,e);return H.extend(t,hs.prototype,e,{allOwnKeys:!0}),H.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Su(Fn(n,r))},t}const pt=Su(ro);pt.Axios=hs;pt.CanceledError=xr;pt.CancelToken=pd;pt.isCancel=_u;pt.VERSION=yu;pt.toFormData=Cs;pt.AxiosError=We;pt.Cancel=pt.CanceledError;pt.all=function(e){return Promise.all(e)};pt.spread=md;pt.isAxiosError=gd;pt.mergeConfig=Fn;pt.AxiosHeaders=Si;pt.formToJSON=n=>gu(H.isHTMLForm(n)?new FormData(n):n);pt.getAdapter=vu.getAdapter;pt.HttpStatusCode=_d;pt.default=pt;const Mt=["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 qo=1234567;const or=Math.PI/180,fr=180/Math.PI;function Wn(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Mt[n&255]+Mt[n>>8&255]+Mt[n>>16&255]+Mt[n>>24&255]+"-"+Mt[e&255]+Mt[e>>8&255]+"-"+Mt[e>>16&15|64]+Mt[e>>24&255]+"-"+Mt[t&63|128]+Mt[t>>8&255]+"-"+Mt[t>>16&255]+Mt[t>>24&255]+Mt[i&255]+Mt[i>>8&255]+Mt[i>>16&255]+Mt[i>>24&255]).toLowerCase()}function wt(n,e,t){return Math.max(e,Math.min(t,n))}function oo(n,e){return(n%e+e)%e}function xd(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function vd(n,e,t){return n!==e?(t-n)/(e-n):0}function lr(n,e,t){return(1-t)*n+t*e}function yd(n,e,t,i){return lr(n,e,1-Math.exp(-t*i))}function Sd(n,e=1){return e-Math.abs(oo(n,e*2)-e)}function Md(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function bd(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function wd(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ed(n,e){return n+Math.random()*(e-n)}function Td(n){return n*(.5-Math.random())}function Ad(n){n!==void 0&&(qo=n);let e=qo+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Cd(n){return n*or}function Ld(n){return n*fr}function za(n){return(n&n-1)===0&&n!==0}function Pd(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function gs(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Rd(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),u=a((e+i)/2),h=s((e-i)/2),d=a((e-i)/2),m=s((i-e)/2),g=a((i-e)/2);switch(r){case"XYX":n.set(o*u,l*h,l*d,o*c);break;case"YZY":n.set(l*d,o*u,l*h,o*c);break;case"ZXZ":n.set(l*h,l*d,o*u,o*c);break;case"XZX":n.set(o*u,l*g,l*m,o*c);break;case"YXY":n.set(l*m,o*u,l*g,o*c);break;case"ZYZ":n.set(l*g,l*m,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ln(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Ct(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Dd={DEG2RAD:or,RAD2DEG:fr,generateUUID:Wn,clamp:wt,euclideanModulo:oo,mapLinear:xd,inverseLerp:vd,lerp:lr,damp:yd,pingpong:Sd,smoothstep:Md,smootherstep:bd,randInt:wd,randFloat:Ed,randFloatSpread:Td,seededRandom:Ad,degToRad:Cd,radToDeg:Ld,isPowerOfTwo:za,ceilPowerOfTwo:Pd,floorPowerOfTwo:gs,setQuaternionFromProperEuler:Rd,normalize:Ct,denormalize:Ln},lo="157",cn={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},un={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Id=0,jo=1,Od=2,Mu=1,Nd=2,_i=3,Bi=0,Ot=1,xi=2,Fi=0,In=1,Xo=2,Yo=3,Zo=4,Ud=5,Pn=100,Fd=101,kd=102,$o=103,Jo=104,zd=200,Bd=201,Vd=202,Hd=203,bu=204,wu=205,Gd=206,Wd=207,qd=208,jd=209,Xd=210,Yd=0,Zd=1,$d=2,Ba=3,Jd=4,Kd=5,Qd=6,ep=7,co=0,tp=1,ip=2,ki=0,np=1,rp=2,sp=3,ap=4,op=5,Eu=300,kn=301,zn=302,Va=303,Ha=304,Ps=306,Ga=1e3,ti=1001,Wa=1002,Pt=1003,Ko=1004,Xs=1005,Gt=1006,lp=1007,dr=1008,zi=1009,cp=1010,up=1011,uo=1012,Tu=1013,Ni=1014,Ui=1015,pr=1016,Au=1017,Cu=1018,Ki=1020,hp=1021,ii=1023,fp=1024,dp=1025,Qi=1026,Bn=1027,pp=1028,Lu=1029,mp=1030,Pu=1031,Ru=1033,Ys=33776,Zs=33777,$s=33778,Js=33779,Qo=35840,el=35841,tl=35842,il=35843,gp=36196,nl=37492,rl=37496,sl=37808,al=37809,ol=37810,ll=37811,cl=37812,ul=37813,hl=37814,fl=37815,dl=37816,pl=37817,ml=37818,gl=37819,_l=37820,xl=37821,Ks=36492,vl=36494,yl=36495,_p=36283,Sl=36284,Ml=36285,bl=36286,Du=3e3,en=3001,xp=3200,vp=3201,Iu=0,yp=1,qt="",yt="srgb",Mi="srgb-linear",ho="display-p3",Rs="display-p3-linear",_s="linear",et="srgb",xs="rec709",vs="p3",Qs=7680,Sp=519,Mp=512,bp=513,wp=514,Ep=515,Tp=516,Ap=517,Cp=518,Lp=519,wl=35044,El="300 es",qa=1035,vi=2e3,ys=2001;class Ve{constructor(e,t,i,r,s,a,o,l,c){Ve.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],m=i[5],g=i[8],_=r[0],p=r[3],f=r[6],b=r[1],x=r[4],C=r[7],E=r[2],P=r[5],T=r[8];return s[0]=a*_+o*b+l*E,s[3]=a*p+o*x+l*P,s[6]=a*f+o*C+l*T,s[1]=c*_+u*b+h*E,s[4]=c*p+u*x+h*P,s[7]=c*f+u*C+h*T,s[2]=d*_+m*b+g*E,s[5]=d*p+m*x+g*P,s[8]=d*f+m*C+g*T,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,d=o*l-u*s,m=c*s-a*l,g=t*h+i*d+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(r*c-u*i)*_,e[2]=(o*i-r*a)*_,e[3]=d*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=m*_,e[7]=(i*l-c*t)*_,e[8]=(a*t-i*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ea.makeScale(e,t)),this}rotate(e){return this.premultiply(ea.makeRotation(-e)),this}translate(e,t){return this.premultiply(ea.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ea=new Ve,Tl=new Ve().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Al=new Ve().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Lr={[Mi]:{transfer:_s,primaries:xs,toReference:n=>n,fromReference:n=>n},[yt]:{transfer:et,primaries:xs,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Rs]:{transfer:_s,primaries:vs,toReference:n=>n.applyMatrix3(Al),fromReference:n=>n.applyMatrix3(Tl)},[ho]:{transfer:et,primaries:vs,toReference:n=>n.convertSRGBToLinear().applyMatrix3(Al),fromReference:n=>n.applyMatrix3(Tl).convertLinearToSRGB()}},Pp=new Set([Mi,Rs]),$e={enabled:!0,_workingColorSpace:Mi,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Pp.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Lr[e].toReference,r=Lr[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Lr[n].primaries},getTransfer:function(n){return n===qt?_s:Lr[n].transfer}};function On(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ta(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const Ou={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ei={h:0,s:0,l:0},Pr={h:0,s:0,l:0};function ia(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ze{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=yt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$e.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=$e.workingColorSpace){return this.r=e,this.g=t,this.b=i,$e.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=$e.workingColorSpace){if(e=oo(e,1),t=wt(t,0,1),i=wt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=ia(a,s,e+1/3),this.g=ia(a,s,e),this.b=ia(a,s,e-1/3)}return $e.toWorkingColorSpace(this,r),this}setStyle(e,t=yt){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=yt){const i=Ou[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=On(e.r),this.g=On(e.g),this.b=On(e.b),this}copyLinearToSRGB(e){return this.r=ta(e.r),this.g=ta(e.g),this.b=ta(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yt){return $e.fromWorkingColorSpace(bt.copy(this),e),Math.round(wt(bt.r*255,0,255))*65536+Math.round(wt(bt.g*255,0,255))*256+Math.round(wt(bt.b*255,0,255))}getHexString(e=yt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$e.workingColorSpace){$e.fromWorkingColorSpace(bt.copy(this),t);const i=bt.r,r=bt.g,s=bt.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case i:l=(r-s)/h+(r=0;--e)if(n[e]>=65535)return!0;return!1}function mr(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Ip(){const n=mr("canvas");return n.style.display="block",n}const Ll={};function cr(n){n in Ll||(Ll[n]=!0,console.warn(n))}class Op extends fo{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Cl.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o=mr("img");function l(){u(),Cl.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class an{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{hn===void 0&&(hn=mr("canvas")),hn.width=e.width,hn.height=e.height;const i=hn.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=hn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=mr("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Eu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ga:e.x=e.x-Math.floor(e.x);break;case ti:e.x=e.x<0?0:1;break;case Wa:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ga:e.y=e.y-Math.floor(e.y);break;case ti:e.y=e.y<0?0:1;break;case Wa:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return cr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===yt?en:Du}set encoding(e){cr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===en?yt:qt}}Nt.DEFAULT_IMAGE=null;Nt.DEFAULT_MAPPING=Eu;Nt.DEFAULT_ANISOTROPY=1;class Vy extends fo{constructor(e){super(e)}load(e,t,i,r){const s=new Nt,a=new Op(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class nn{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const d=s[a+0],m=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=d,e[t+1]=m,e[t+2]=g,e[t+3]=_;return}if(h!==_||l!==d||c!==m||u!==g){let p=1-o;const f=l*d+c*m+u*g+h*_,b=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const E=Math.sqrt(x),P=Math.atan2(E,f*b);p=Math.sin(p*P)/E,o=Math.sin(o*P)/E}const C=o*b;if(l=l*p+d*C,c=c*p+m*C,u=u*p+g*C,h=h*p+_*C,p===1-o){const E=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=E,c*=E,u*=E,h*=E}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[a],d=s[a+1],m=s[a+2],g=s[a+3];return e[t]=o*g+u*h+l*m-c*d,e[t+1]=l*g+u*d+c*h-o*m,e[t+2]=c*g+u*m+o*d-l*h,e[t+3]=u*g-o*h-l*d-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(r/2),h=o(s/2),d=l(i/2),m=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=d*u*h+c*m*g,this._y=c*m*h-d*u*g,this._z=c*u*g+d*m*h,this._w=c*u*h-d*m*g;break;case"YXZ":this._x=d*u*h+c*m*g,this._y=c*m*h-d*u*g,this._z=c*u*g-d*m*h,this._w=c*u*h+d*m*g;break;case"ZXY":this._x=d*u*h-c*m*g,this._y=c*m*h+d*u*g,this._z=c*u*g+d*m*h,this._w=c*u*h-d*m*g;break;case"ZYX":this._x=d*u*h-c*m*g,this._y=c*m*h+d*u*g,this._z=c*u*g-d*m*h,this._w=c*u*h+d*m*g;break;case"YZX":this._x=d*u*h+c*m*g,this._y=c*m*h+d*u*g,this._z=c*u*g-d*m*h,this._w=c*u*h-d*m*g;break;case"XZY":this._x=d*u*h-c*m*g,this._y=c*m*h-d*u*g,this._z=c*u*g+d*m*h,this._w=c*u*h+d*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+o+h;if(d>0){const m=.5/Math.sqrt(d+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(a-r)*m}else if(i>o&&i>h){const m=2*Math.sqrt(1+i-o-h);this._w=(u-l)/m,this._x=.25*m,this._y=(r+a)/m,this._z=(s+c)/m}else if(o>h){const m=2*Math.sqrt(1+o-i-h);this._w=(s-c)/m,this._x=(r+a)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+h-i-o);this._w=(a-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(wt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-r*o,this._w=a*u-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const m=1-t;return this._w=m*a+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=i*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(e=0,t=0,i=0){R.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Pl.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Pl.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*r-o*i,u=l*i+o*t-s*r,h=l*r+s*i-a*t,d=-s*t-a*i-o*r;return this.x=c*l+d*-s+u*-o-h*-a,this.y=u*l+d*-a+h*-s-c*-o,this.z=h*l+d*-o+c*-a-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ra.copy(this).projectOnVector(e),this.sub(ra)}reflect(e){return this.sub(ra.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(wt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ra=new R,Pl=new nn;class rt{constructor(e,t,i,r,s,a,o,l,c,u,h,d,m,g,_,p){rt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c,u,h,d,m,g,_,p)}set(e,t,i,r,s,a,o,l,c,u,h,d,m,g,_,p){const f=this.elements;return f[0]=e,f[4]=t,f[8]=i,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=u,f[10]=h,f[14]=d,f[3]=m,f[7]=g,f[11]=_,f[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new rt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/fn.setFromMatrixColumn(e,0).length(),s=1/fn.setFromMatrixColumn(e,1).length(),a=1/fn.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=a*u,m=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=m+g*c,t[5]=d-_*c,t[9]=-o*l,t[2]=_-d*c,t[6]=g+m*c,t[10]=a*l}else if(e.order==="YXZ"){const d=l*u,m=l*h,g=c*u,_=c*h;t[0]=d+_*o,t[4]=g*o-m,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=_+d*o,t[10]=a*l}else if(e.order==="ZXY"){const d=l*u,m=l*h,g=c*u,_=c*h;t[0]=d-_*o,t[4]=-a*h,t[8]=g+m*o,t[1]=m+g*o,t[5]=a*u,t[9]=_-d*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const d=a*u,m=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=g*c-m,t[8]=d*c+_,t[1]=l*h,t[5]=_*c+d,t[9]=m*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const d=a*l,m=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-d*h,t[8]=g*h+m,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=m*h+g,t[10]=d-_*h}else if(e.order==="XZY"){const d=a*l,m=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+_,t[5]=a*u,t[9]=m*h-g,t[2]=g*h-m,t[6]=o*u,t[10]=_*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Fp,e,kp)}lookAt(e,t,i){const r=this.elements;return Ft.subVectors(e,t),Ft.lengthSq()===0&&(Ft.z=1),Ft.normalize(),Ti.crossVectors(i,Ft),Ti.lengthSq()===0&&(Math.abs(i.z)===1?Ft.x+=1e-4:Ft.z+=1e-4,Ft.normalize(),Ti.crossVectors(i,Ft)),Ti.normalize(),Rr.crossVectors(Ft,Ti),r[0]=Ti.x,r[4]=Rr.x,r[8]=Ft.x,r[1]=Ti.y,r[5]=Rr.y,r[9]=Ft.y,r[2]=Ti.z,r[6]=Rr.z,r[10]=Ft.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],m=i[13],g=i[2],_=i[6],p=i[10],f=i[14],b=i[3],x=i[7],C=i[11],E=i[15],P=r[0],T=r[4],F=r[8],y=r[12],w=r[1],z=r[5],j=r[9],J=r[13],D=r[2],k=r[6],Y=r[10],G=r[14],ie=r[3],q=r[7],K=r[11],I=r[15];return s[0]=a*P+o*w+l*D+c*ie,s[4]=a*T+o*z+l*k+c*q,s[8]=a*F+o*j+l*Y+c*K,s[12]=a*y+o*J+l*G+c*I,s[1]=u*P+h*w+d*D+m*ie,s[5]=u*T+h*z+d*k+m*q,s[9]=u*F+h*j+d*Y+m*K,s[13]=u*y+h*J+d*G+m*I,s[2]=g*P+_*w+p*D+f*ie,s[6]=g*T+_*z+p*k+f*q,s[10]=g*F+_*j+p*Y+f*K,s[14]=g*y+_*J+p*G+f*I,s[3]=b*P+x*w+C*D+E*ie,s[7]=b*T+x*z+C*k+E*q,s[11]=b*F+x*j+C*Y+E*K,s[15]=b*y+x*J+C*G+E*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],m=e[14],g=e[3],_=e[7],p=e[11],f=e[15];return g*(+s*l*h-r*c*h-s*o*d+i*c*d+r*o*m-i*l*m)+_*(+t*l*m-t*c*d+s*a*d-r*a*m+r*c*u-s*l*u)+p*(+t*c*h-t*o*m-s*a*h+i*a*m+s*o*u-i*c*u)+f*(-r*o*u-t*l*h+t*o*d+r*a*h-i*a*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],m=e[11],g=e[12],_=e[13],p=e[14],f=e[15],b=h*p*c-_*d*c+_*l*m-o*p*m-h*l*f+o*d*f,x=g*d*c-u*p*c-g*l*m+a*p*m+u*l*f-a*d*f,C=u*_*c-g*h*c+g*o*m-a*_*m-u*o*f+a*h*f,E=g*h*l-u*_*l-g*o*d+a*_*d+u*o*p-a*h*p,P=t*b+i*x+r*C+s*E;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/P;return e[0]=b*T,e[1]=(_*d*s-h*p*s-_*r*m+i*p*m+h*r*f-i*d*f)*T,e[2]=(o*p*s-_*l*s+_*r*c-i*p*c-o*r*f+i*l*f)*T,e[3]=(h*l*s-o*d*s-h*r*c+i*d*c+o*r*m-i*l*m)*T,e[4]=x*T,e[5]=(u*p*s-g*d*s+g*r*m-t*p*m-u*r*f+t*d*f)*T,e[6]=(g*l*s-a*p*s-g*r*c+t*p*c+a*r*f-t*l*f)*T,e[7]=(a*d*s-u*l*s+u*r*c-t*d*c-a*r*m+t*l*m)*T,e[8]=C*T,e[9]=(g*h*s-u*_*s-g*i*m+t*_*m+u*i*f-t*h*f)*T,e[10]=(a*_*s-g*o*s+g*i*c-t*_*c-a*i*f+t*o*f)*T,e[11]=(u*o*s-a*h*s-u*i*c+t*h*c+a*i*m-t*o*m)*T,e[12]=E*T,e[13]=(u*_*r-g*h*r+g*i*d-t*_*d-u*i*p+t*h*p)*T,e[14]=(g*o*r-a*_*r-g*i*l+t*_*l+a*i*p-t*o*p)*T,e[15]=(a*h*r-u*o*r+u*i*l-t*h*l-a*i*d+t*o*d)*T,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+i,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,d=s*c,m=s*u,g=s*h,_=a*u,p=a*h,f=o*h,b=l*c,x=l*u,C=l*h,E=i.x,P=i.y,T=i.z;return r[0]=(1-(_+f))*E,r[1]=(m+C)*E,r[2]=(g-x)*E,r[3]=0,r[4]=(m-C)*P,r[5]=(1-(d+f))*P,r[6]=(p+b)*P,r[7]=0,r[8]=(g+x)*T,r[9]=(p-b)*T,r[10]=(1-(d+_))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=fn.set(r[0],r[1],r[2]).length();const a=fn.set(r[4],r[5],r[6]).length(),o=fn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],$t.copy(this);const c=1/s,u=1/a,h=1/o;return $t.elements[0]*=c,$t.elements[1]*=c,$t.elements[2]*=c,$t.elements[4]*=u,$t.elements[5]*=u,$t.elements[6]*=u,$t.elements[8]*=h,$t.elements[9]*=h,$t.elements[10]*=h,t.setFromRotationMatrix($t),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a,o=vi){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),d=(i+r)/(i-r);let m,g;if(o===vi)m=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===ys)m=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=vi){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(a-s),d=(t+e)*c,m=(i+r)*u;let g,_;if(o===vi)g=(a+s)*h,_=-2*h;else if(o===ys)g=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const fn=new R,$t=new rt,Fp=new R(0,0,0),kp=new R(1,1,1),Ti=new R,Rr=new R,Ft=new R,Rl=new rt,Dl=new nn;class Ds{constructor(e=0,t=0,i=0,r=Ds.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(wt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-wt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(wt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-wt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(wt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-wt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Rl.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Rl,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Dl.setFromEuler(this),this.setFromQuaternion(Dl,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ds.DEFAULT_ORDER="XYZ";class po{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(a))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kn,e,Bp),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kn,Vp,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let o=0;o0){r.animations=[];for(let o=0;o0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),m.length>0&&(i.animations=m),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;iC&&x>E?x<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(x),r=P/i,s=T/i):C>E?C<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),i=P/r,s=F/r):E<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(E),i=T/s,r=F/s),this.set(i,r,s,t),this}let b=Math.sqrt((p-g)*(p-g)+(h-_)*(h-_)+(d-u)*(d-u));return Math.abs(b)<.001&&(b=1),this.x=(p-g)/b,this.y=(h-_)/b,this.z=(d-u)/b,this.w=Math.acos((c+m+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class vr{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,di),di.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Qn),Ir.subVectors(this.max,Qn),mn.subVectors(e.a,Qn),gn.subVectors(e.b,Qn),_n.subVectors(e.c,Qn),Ai.subVectors(gn,mn),Ci.subVectors(_n,gn),Gi.subVectors(mn,_n);let t=[0,-Ai.z,Ai.y,0,-Ci.z,Ci.y,0,-Gi.z,Gi.y,Ai.z,0,-Ai.x,Ci.z,0,-Ci.x,Gi.z,0,-Gi.x,-Ai.y,Ai.x,0,-Ci.y,Ci.x,0,-Gi.y,Gi.x,0];return!sa(t,mn,gn,_n,Ir)||(t=[1,0,0,0,1,0,0,0,1],!sa(t,mn,gn,_n,Ir))?!1:(Or.crossVectors(Ai,Ci),t=[Or.x,Or.y,Or.z],sa(t,mn,gn,_n,Ir))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,di).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(di).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(fi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fi),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fi=[new R,new R,new R,new R,new R,new R,new R,new R],di=new R,pn=new vr,mn=new R,gn=new R,_n=new R,Ai=new R,Ci=new R,Gi=new R,Qn=new R,Ir=new R,Or=new R,Wi=new R;function sa(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Wi.fromArray(n,s);const o=r.x*Math.abs(Wi.x)+r.y*Math.abs(Wi.y)+r.z*Math.abs(Wi.z),l=e.dot(Wi),c=t.dot(Wi),u=i.dot(Wi);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const qp=new vr,er=new R,aa=new R;class yr{constructor(e=new R,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):qp.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;er.subVectors(e,this.center);const t=er.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(er,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(aa.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(er.copy(e.center).add(aa)),this.expandByPoint(er.copy(e.center).sub(aa))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const oa=new R,jp=new R,Xp=new Ve;class Di{constructor(e=new R(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=oa.subVectors(i,t).cross(jp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(oa),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Xp.getNormalMatrix(e),r=this.coplanarPoint(oa).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const qi=new yr,Nr=new R;class mo{constructor(e=new Di,t=new Di,i=new Di,r=new Di,s=new Di,a=new Di){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=vi){const i=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],h=r[6],d=r[7],m=r[8],g=r[9],_=r[10],p=r[11],f=r[12],b=r[13],x=r[14],C=r[15];if(i[0].setComponents(l-s,d-c,p-m,C-f).normalize(),i[1].setComponents(l+s,d+c,p+m,C+f).normalize(),i[2].setComponents(l+a,d+u,p+g,C+b).normalize(),i[3].setComponents(l-a,d-u,p-g,C-b).normalize(),i[4].setComponents(l-o,d-h,p-_,C-x).normalize(),t===vi)i[5].setComponents(l+o,d+h,p+_,C+x).normalize();else if(t===ys)i[5].setComponents(o,h,_,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),qi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),qi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(qi)}intersectsSprite(e){return qi.center.set(0,0,0),qi.radius=.7071067811865476,qi.applyMatrix4(e.matrixWorld),this.intersectsSphere(qi)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,Nr.y=r.normal.y>0?e.max.y:e.min.y,Nr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Nr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const la=new rt,Fl=new R,kl=new R;class Yp{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.map=null,this.mapPass=null,this.matrix=new rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new mo,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new tt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Fl.setFromMatrixPosition(e.matrixWorld),t.position.copy(Fl),kl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(kl),t.updateMatrixWorld(),la.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(la),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(la)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class ku extends St{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt,this.coordinateSystem=vi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Wt extends ku{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=fr*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(or*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return fr*2*Math.atan(Math.tan(or*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(or*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const zl=new rt,tr=new R,ca=new R;class Zp extends Yp{constructor(){super(new Wt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Oe(4,2),this._viewportCount=6,this._viewports=[new tt(2,1,1,1),new tt(0,1,1,1),new tt(3,1,1,1),new tt(1,1,1,1),new tt(3,0,1,1),new tt(1,0,1,1)],this._cubeDirections=[new R(1,0,0),new R(-1,0,0),new R(0,0,1),new R(0,0,-1),new R(0,1,0),new R(0,-1,0)],this._cubeUps=[new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,0,1),new R(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),tr.setFromMatrixPosition(e.matrixWorld),i.position.copy(tr),ca.copy(i.position),ca.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(ca),i.updateMatrixWorld(),r.makeTranslation(-tr.x,-tr.y,-tr.z),zl.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zl)}}class Hy extends Wp{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new Zp}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}let $p=0;class on extends an{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:$p++}),this.uuid=Wn(),this.name="",this.type="Material",this.blending=In,this.side=Bi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=bu,this.blendDst=wu,this.blendEquation=Pn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Ba,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Sp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Qs,this.stencilZFail=Qs,this.stencilZPass=Qs,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==In&&(i.blending=this.blending),this.side!==Bi&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Gy extends on{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ze(16777215),this.specular=new Ze(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iu,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=co,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class zu extends on{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ze(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}class Jp extends on{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ze(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}function Vn(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function Lt(n){const e={};for(let t=0;t0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}const pi=new R,ua=new R,Ur=new R,Li=new R,ha=new R,Fr=new R,fa=new R;class Sr{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,pi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=pi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(pi.copy(this.origin).addScaledVector(this.direction,t),pi.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){ua.copy(e).add(t).multiplyScalar(.5),Ur.copy(t).sub(e).normalize(),Li.copy(this.origin).sub(ua);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ur),o=Li.dot(this.direction),l=-Li.dot(Ur),c=Li.lengthSq(),u=Math.abs(1-a*a);let h,d,m,g;if(u>0)if(h=a*l-o,d=a*o-l,g=s*u,h>=0)if(d>=-g)if(d<=g){const _=1/u;h*=_,d*=_,m=h*(h+a*d+2*o)+d*(a*h+d+2*l)+c}else d=s,h=Math.max(0,-(a*d+o)),m=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(a*d+o)),m=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-a*s+o)),d=h>0?-s:Math.min(Math.max(-s,-l),s),m=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-s,-l),s),m=d*(d+2*l)+c):(h=Math.max(0,-(a*s+o)),d=h>0?s:Math.min(Math.max(-s,-l),s),m=-h*h+d*(d+2*l)+c);else d=a>0?-s:s,h=Math.max(0,-(a*d+o)),m=-h*h+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ua).addScaledVector(Ur,d),m}intersectSphere(e,t){pi.subVectors(e.center,this.origin);const i=pi.dot(this.direction),r=pi.dot(pi)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a=0?(o=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||o>r)||((o>i||i!==i)&&(i=o),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,pi)!==null}intersectTriangle(e,t,i,r,s){ha.subVectors(t,e),Fr.subVectors(i,e),fa.crossVectors(ha,Fr);let a=this.direction.dot(fa),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Li.subVectors(this.origin,e);const l=o*this.direction.dot(Fr.crossVectors(Li,Fr));if(l<0)return null;const c=o*this.direction.dot(ha.cross(Li));if(c<0||l+c>a)return null;const u=-o*Li.dot(fa);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}const Jt=new R,mi=new R,da=new R,gi=new R,xn=new R,vn=new R,Bl=new R,pa=new R,ma=new R,ga=new R;let kr=!1;class ei{constructor(e=new R,t=new R,i=new R){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Jt.subVectors(e,t),r.cross(Jt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Jt.subVectors(r,t),mi.subVectors(i,t),da.subVectors(e,t);const a=Jt.dot(Jt),o=Jt.dot(mi),l=Jt.dot(da),c=mi.dot(mi),u=mi.dot(da),h=a*c-o*o;if(h===0)return s.set(-2,-1,-1);const d=1/h,m=(c*l-o*u)*d,g=(a*u-o*l)*d;return s.set(1-m-g,g,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,gi),gi.x>=0&&gi.y>=0&&gi.x+gi.y<=1}static getUV(e,t,i,r,s,a,o,l){return kr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),kr=!0),this.getInterpolation(e,t,i,r,s,a,o,l)}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,gi),l.setScalar(0),l.addScaledVector(s,gi.x),l.addScaledVector(a,gi.y),l.addScaledVector(o,gi.z),l}static isFrontFacing(e,t,i,r){return Jt.subVectors(i,t),mi.subVectors(e,t),Jt.cross(mi).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Jt.subVectors(this.c,this.b),mi.subVectors(this.a,this.b),Jt.cross(mi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return kr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),kr=!0),ei.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;xn.subVectors(r,i),vn.subVectors(s,i),pa.subVectors(e,i);const l=xn.dot(pa),c=vn.dot(pa);if(l<=0&&c<=0)return t.copy(i);ma.subVectors(e,r);const u=xn.dot(ma),h=vn.dot(ma);if(u>=0&&h<=u)return t.copy(r);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(xn,a);ga.subVectors(e,s);const m=xn.dot(ga),g=vn.dot(ga);if(g>=0&&m<=g)return t.copy(s);const _=m*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(i).addScaledVector(vn,o);const p=u*g-m*h;if(p<=0&&h-u>=0&&m-g>=0)return Bl.subVectors(s,r),o=(h-u)/(h-u+(m-g)),t.copy(r).addScaledVector(Bl,o);const f=1/(p+_+d);return a=_*f,o=d*f,t.copy(i).addScaledVector(xn,a).addScaledVector(vn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class go extends on{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=co,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ut=new R,zr=new Oe;class li{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=wl,this.updateRange={offset:0,count:-1},this.gpuType=Ui,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,m=h.length;d0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(e.far-e.near)**2))&&(Vl.copy(s).invert(),ji.copy(e.ray).applyMatrix4(Vl),!(i.boundingBox!==null&&ji.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ji)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,m=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=d.length;g<_;g++){const p=d[g],f=a[p.materialIndex],b=Math.max(p.start,m.start),x=Math.min(o.count,Math.min(p.start+p.count,m.start+m.count));for(let C=b,E=x;Ct.far?null:{distance:c,point:jr.clone(),object:n}}function Xr(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Sn),n.getVertexPosition(l,Mn),n.getVertexPosition(c,bn);const u=nm(n,e,t,i,Sn,Mn,bn,qr);if(u){r&&(Hr.fromBufferAttribute(r,o),Gr.fromBufferAttribute(r,l),Wr.fromBufferAttribute(r,c),u.uv=ei.getInterpolation(qr,Sn,Mn,bn,Hr,Gr,Wr,new Oe)),s&&(Hr.fromBufferAttribute(s,o),Gr.fromBufferAttribute(s,l),Wr.fromBufferAttribute(s,c),u.uv1=ei.getInterpolation(qr,Sn,Mn,bn,Hr,Gr,Wr,new Oe),u.uv2=u.uv1),a&&(Gl.fromBufferAttribute(a,o),Wl.fromBufferAttribute(a,l),ql.fromBufferAttribute(a,c),u.normal=ei.getInterpolation(qr,Sn,Mn,bn,Gl,Wl,ql,new R),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new R,materialIndex:0};ei.getNormal(Sn,Mn,bn,h.normal),u.face=h}return u}class Yr extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}const jl=new R,Xl=new R,Yl=new rt,va=new Sr,Zr=new yr;class rm extends St{constructor(e=new Zt,t=new zu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;rl)continue;d.applyMatrix4(this.matrixWorld);const F=e.ray.origin.distanceTo(d);Fe.far||t.push({distance:F,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,a.start),b=Math.min(p.count,a.start+a.count);for(let x=f,C=b-1;xl)continue;d.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(d);Pe.far||t.push({distance:P,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class Gu extends Zt{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(a+o,Math.PI);let c=0;const u=[],h=new R,d=new R,m=[],g=[],_=[],p=[];for(let f=0;f<=i;f++){const b=[],x=f/i;let C=0;f===0&&a===0?C=.5/t:f===i&&l===Math.PI&&(C=-.5/t);for(let E=0;E<=t;E++){const P=E/t;h.x=-e*Math.cos(r+P*s)*Math.sin(a+x*o),h.y=e*Math.cos(a+x*o),h.z=e*Math.sin(r+P*s)*Math.sin(a+x*o),g.push(h.x,h.y,h.z),d.copy(h).normalize(),_.push(d.x,d.y,d.z),p.push(P+C,1-x),b.push(c++)}u.push(b)}for(let f=0;f0)&&m.push(x,C,P),(f!==i-1||l0?1:-1,u.push(q.x,q.y,q.z),h.push(W/T),h.push(1-K/F),G+=1}}for(let K=0;K0 +vec4 plane; +#pragma unroll_loop_start +for(int i=0;iplane.w)discard;} +#pragma unroll_loop_end +#if UNION_CLIPPING_PLANESplane.w)&&clipped;} +#pragma unroll_loop_end +if(clipped)discard; +#endif +#endif`,ym=`#if NUM_CLIPPING_PLANES>0 +varying vec3 vClipPosition;uniform vec4 clippingPlanes[NUM_CLIPPING_PLANES]; +#endif`,Sm=`#if NUM_CLIPPING_PLANES>0 +varying vec3 vClipPosition; +#endif`,Mm=`#if NUM_CLIPPING_PLANES>0 +vClipPosition=-mvPosition.xyz; +#endif`,bm=`#if defined(USE_COLOR_ALPHA) +diffuseColor*=vColor; +#elif defined(USE_COLOR) +diffuseColor.rgb*=vColor; +#endif`,wm=`#if defined(USE_COLOR_ALPHA) +varying vec4 vColor; +#elif defined(USE_COLOR) +varying vec3 vColor; +#endif`,Em=`#if defined(USE_COLOR_ALPHA) +varying vec4 vColor; +#elif defined(USE_COLOR)||defined(USE_INSTANCING_COLOR) +varying vec3 vColor; +#endif`,Tm=`#if defined(USE_COLOR_ALPHA) +vColor=vec4(1.0); +#elif defined(USE_COLOR)||defined(USE_INSTANCING_COLOR) +vColor=vec3(1.0); +#endif +#ifdef USE_COLOR +vColor*=color; +#endif +#ifdef USE_INSTANCING_COLOR +vColor.xyz*=instanceColor.xyz; +#endif`,Am=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate(a)clamp(a,0.0,1.0) +#endif +#define whiteComplement(a)(1.0-saturate(a)) +float pow2(const in float x){return x*x;}vec3 pow2(const in vec3 x){return x*x;}float pow3(const in float x){return x*x*x;}float pow4(const in float x){float x2=x*x;return x2*x2;}float max3(const in vec3 v){return max(max(v.x,v.y),v.z);}float average(const in vec3 v){return dot(v,vec3(0.3333333));}highp float rand(const in vec2 uv){const highp float a=12.9898,b=78.233,c=43758.5453;highp float dt=dot(uv.xy,vec2(a,b)),sn=mod(dt,PI);return fract(sin(sn)*c);} +#ifdef HIGH_PRECISION +float precisionSafeLength(vec3 v){return length(v);} +#else +float precisionSafeLength(vec3 v){float maxComponent=max3(abs(v));return length(v/maxComponent)*maxComponent;} +#endif +struct IncidentLight{vec3 color;vec3 direction;bool visible;};struct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection(in vec3 dir,in mat4 matrix){return normalize((matrix*vec4(dir,0.0)).xyz);}vec3 inverseTransformDirection(in vec3 dir,in mat4 matrix){return normalize((vec4(dir,0.0)*matrix).xyz);}mat3 transposeMat3(const in mat3 m){mat3 tmp;tmp[0]=vec3(m[0].x,m[1].x,m[2].x);tmp[1]=vec3(m[0].y,m[1].y,m[2].y);tmp[2]=vec3(m[0].z,m[1].z,m[2].z);return tmp;}float luminance(const in vec3 rgb){const vec3 weights=vec3(0.2126729,0.7151522,0.0721750);return dot(weights,rgb);}bool isPerspectiveMatrix(mat4 m){return m[2][3]==-1.0;}vec2 equirectUv(in vec3 dir){float u=atan(dir.z,dir.x)*RECIPROCAL_PI2+0.5;float v=asin(clamp(dir.y,-1.0,1.0))*RECIPROCAL_PI+0.5;return vec2(u,v);}vec3 BRDF_Lambert(const in vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}vec3 F_Schlick(const in vec3 f0,const in float f90,const in float dotVH){float fresnel=exp2((-5.55473*dotVH-6.98316)*dotVH);return f0*(1.0-fresnel)+(f90*fresnel);}float F_Schlick(const in float f0,const in float f90,const in float dotVH){float fresnel=exp2((-5.55473*dotVH-6.98316)*dotVH);return f0*(1.0-fresnel)+(f90*fresnel);}`,Cm=`#ifdef ENVMAP_TYPE_CUBE_UV +#define cubeUV_minMipLevel 4.0 +#define cubeUV_minTileSize 16.0 +float getFace(vec3 direction){vec3 absDirection=abs(direction);float face=-1.0;if(absDirection.x>absDirection.z){if(absDirection.x>absDirection.y)face=direction.x>0.0?0.0:3.0;else face=direction.y>0.0?1.0:4.0;}else{if(absDirection.z>absDirection.y)face=direction.z>0.0?2.0:5.0;else face=direction.y>0.0?1.0:4.0;}return face;}vec2 getUV(vec3 direction,float face){vec2 uv;if(face==0.0){uv=vec2(direction.z,direction.y)/abs(direction.x);}else if(face==1.0){uv=vec2(-direction.x,-direction.z)/abs(direction.y);}else if(face==2.0){uv=vec2(-direction.x,direction.y)/abs(direction.z);}else if(face==3.0){uv=vec2(-direction.z,direction.y)/abs(direction.x);}else if(face==4.0){uv=vec2(-direction.x,direction.z)/abs(direction.y);}else{uv=vec2(direction.x,direction.y)/abs(direction.z);}return 0.5*(uv+1.0);}vec3 bilinearCubeUV(sampler2D envMap,vec3 direction,float mipInt){float face=getFace(direction);float filterInt=max(cubeUV_minMipLevel-mipInt,0.0);mipInt=max(mipInt,cubeUV_minMipLevel);float faceSize=exp2(mipInt);highp vec2 uv=getUV(direction,face)*(faceSize-2.0)+1.0;if(face>2.0){uv.y+=faceSize;face-=3.0;}uv.x+=face*faceSize;uv.x+=filterInt*3.0*cubeUV_minTileSize;uv.y+=4.0*(exp2(CUBEUV_MAX_MIP)-faceSize);uv.x*=CUBEUV_TEXEL_WIDTH;uv.y*=CUBEUV_TEXEL_HEIGHT; +#ifdef texture2DGradEXT +return texture2DGradEXT(envMap,uv,vec2(0.0),vec2(0.0)).rgb; +#else +return texture2D(envMap,uv).rgb; +#endif +} +#define cubeUV_r0 1.0 +#define cubeUV_v0 0.339 +#define cubeUV_m0-2.0 +#define cubeUV_r1 0.8 +#define cubeUV_v1 0.276 +#define cubeUV_m1-1.0 +#define cubeUV_r4 0.4 +#define cubeUV_v4 0.046 +#define cubeUV_m4 2.0 +#define cubeUV_r5 0.305 +#define cubeUV_v5 0.016 +#define cubeUV_m5 3.0 +#define cubeUV_r6 0.21 +#define cubeUV_v6 0.0038 +#define cubeUV_m6 4.0 +float roughnessToMip(float roughness){float mip=0.0;if(roughness>=cubeUV_r1){mip=(cubeUV_r0-roughness)*(cubeUV_m1-cubeUV_m0)/(cubeUV_r0-cubeUV_r1)+cubeUV_m0;}else if(roughness>=cubeUV_r4){mip=(cubeUV_r1-roughness)*(cubeUV_m4-cubeUV_m1)/(cubeUV_r1-cubeUV_r4)+cubeUV_m1;}else if(roughness>=cubeUV_r5){mip=(cubeUV_r4-roughness)*(cubeUV_m5-cubeUV_m4)/(cubeUV_r4-cubeUV_r5)+cubeUV_m4;}else if(roughness>=cubeUV_r6){mip=(cubeUV_r5-roughness)*(cubeUV_m6-cubeUV_m5)/(cubeUV_r5-cubeUV_r6)+cubeUV_m5;}else{mip=-2.0*log2(1.16*roughness);}return mip;}vec4 textureCubeUV(sampler2D envMap,vec3 sampleDir,float roughness){float mip=clamp(roughnessToMip(roughness),cubeUV_m0,CUBEUV_MAX_MIP);float mipF=fract(mip);float mipInt=floor(mip);vec3 color0=bilinearCubeUV(envMap,sampleDir,mipInt);if(mipF==0.0){return vec4(color0,1.0);}else{vec3 color1=bilinearCubeUV(envMap,sampleDir,mipInt+1.0);return vec4(mix(color0,color1,mipF),1.0);}} +#endif`,Lm=`vec3 transformedNormal=objectNormal; +#ifdef USE_INSTANCING +mat3 m=mat3(instanceMatrix);transformedNormal/=vec3(dot(m[0],m[0]),dot(m[1],m[1]),dot(m[2],m[2]));transformedNormal=m*transformedNormal; +#endif +transformedNormal=normalMatrix*transformedNormal; +#ifdef FLIP_SIDED +transformedNormal=-transformedNormal; +#endif +#ifdef USE_TANGENT +vec3 transformedTangent=(modelViewMatrix*vec4(objectTangent,0.0)).xyz; +#ifdef FLIP_SIDED +transformedTangent=-transformedTangent; +#endif +#endif`,Pm=`#ifdef USE_DISPLACEMENTMAP +uniform sampler2D displacementMap;uniform float displacementScale;uniform float displacementBias; +#endif`,Rm=`#ifdef USE_DISPLACEMENTMAP +transformed+=normalize(objectNormal)*(texture2D(displacementMap,vDisplacementMapUv).x*displacementScale+displacementBias); +#endif`,Dm=`#ifdef USE_EMISSIVEMAP +vec4 emissiveColor=texture2D(emissiveMap,vEmissiveMapUv);totalEmissiveRadiance*=emissiveColor.rgb; +#endif`,Im=`#ifdef USE_EMISSIVEMAP +uniform sampler2D emissiveMap; +#endif`,Om="gl_FragColor=linearToOutputTexel(gl_FragColor);",Nm="const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3=mat3(vec3(0.8224621,0.177538,0.0),vec3(0.0331941,0.9668058,0.0),vec3(0.0170827,0.0723974,0.9105199));const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB=mat3(vec3(1.2249401,-0.2249404,0.0),vec3(-0.0420569,1.0420571,0.0),vec3(-0.0196376,-0.0786361,1.0982735));vec4 LinearSRGBToLinearDisplayP3(in vec4 value){return vec4(value.rgb*LINEAR_SRGB_TO_LINEAR_DISPLAY_P3,value.a);}vec4 LinearDisplayP3ToLinearSRGB(in vec4 value){return vec4(value.rgb*LINEAR_DISPLAY_P3_TO_LINEAR_SRGB,value.a);}vec4 LinearTransferOETF(in vec4 value){return value;}vec4 sRGBTransferOETF(in vec4 value){return vec4(mix(pow(value.rgb,vec3(0.41666))*1.055-vec3(0.055),value.rgb*12.92,vec3(lessThanEqual(value.rgb,vec3(0.0031308)))),value.a);}vec4 LinearToLinear(in vec4 value){return value;}vec4 LinearTosRGB(in vec4 value){return sRGBTransferOETF(value);}",Um=`#ifdef USE_ENVMAP +#ifdef ENV_WORLDPOS +vec3 cameraToFrag;if(isOrthographic){cameraToFrag=normalize(vec3(-viewMatrix[0][2],-viewMatrix[1][2],-viewMatrix[2][2]));}else{cameraToFrag=normalize(vWorldPosition-cameraPosition);}vec3 worldNormal=inverseTransformDirection(normal,viewMatrix); +#ifdef ENVMAP_MODE_REFLECTION +vec3 reflectVec=reflect(cameraToFrag,worldNormal); +#else +vec3 reflectVec=refract(cameraToFrag,worldNormal,refractionRatio); +#endif +#else +vec3 reflectVec=vReflect; +#endif +#ifdef ENVMAP_TYPE_CUBE +vec4 envColor=textureCube(envMap,vec3(flipEnvMap*reflectVec.x,reflectVec.yz)); +#else +vec4 envColor=vec4(0.0); +#endif +#ifdef ENVMAP_BLENDING_MULTIPLY +outgoingLight=mix(outgoingLight,outgoingLight*envColor.xyz,specularStrength*reflectivity); +#elif defined(ENVMAP_BLENDING_MIX) +outgoingLight=mix(outgoingLight,envColor.xyz,specularStrength*reflectivity); +#elif defined(ENVMAP_BLENDING_ADD) +outgoingLight+=envColor.xyz*specularStrength*reflectivity; +#endif +#endif`,Fm=`#ifdef USE_ENVMAP +uniform float envMapIntensity;uniform float flipEnvMap; +#ifdef ENVMAP_TYPE_CUBE +uniform samplerCube envMap; +#else +uniform sampler2D envMap; +#endif +#endif`,km=`#ifdef USE_ENVMAP +uniform float reflectivity; +#if defined(USE_BUMPMAP)||defined(USE_NORMALMAP)||defined(PHONG)||defined(LAMBERT) +#define ENV_WORLDPOS +#endif +#ifdef ENV_WORLDPOS +varying vec3 vWorldPosition;uniform float refractionRatio; +#else +varying vec3 vReflect; +#endif +#endif`,zm=`#ifdef USE_ENVMAP +#if defined(USE_BUMPMAP)||defined(USE_NORMALMAP)||defined(PHONG)||defined(LAMBERT) +#define ENV_WORLDPOS +#endif +#ifdef ENV_WORLDPOS +varying vec3 vWorldPosition; +#else +varying vec3 vReflect;uniform float refractionRatio; +#endif +#endif`,Bm=`#ifdef USE_ENVMAP +#ifdef ENV_WORLDPOS +vWorldPosition=worldPosition.xyz; +#else +vec3 cameraToVertex;if(isOrthographic){cameraToVertex=normalize(vec3(-viewMatrix[0][2],-viewMatrix[1][2],-viewMatrix[2][2]));}else{cameraToVertex=normalize(worldPosition.xyz-cameraPosition);}vec3 worldNormal=inverseTransformDirection(transformedNormal,viewMatrix); +#ifdef ENVMAP_MODE_REFLECTION +vReflect=reflect(cameraToVertex,worldNormal); +#else +vReflect=refract(cameraToVertex,worldNormal,refractionRatio); +#endif +#endif +#endif`,Vm=`#ifdef USE_FOG +vFogDepth=-mvPosition.z; +#endif`,Hm=`#ifdef USE_FOG +varying float vFogDepth; +#endif`,Gm=`#ifdef USE_FOG +#ifdef FOG_EXP2 +float fogFactor=1.0-exp(-fogDensity*fogDensity*vFogDepth*vFogDepth); +#else +float fogFactor=smoothstep(fogNear,fogFar,vFogDepth); +#endif +gl_FragColor.rgb=mix(gl_FragColor.rgb,fogColor,fogFactor); +#endif`,Wm=`#ifdef USE_FOG +uniform vec3 fogColor;varying float vFogDepth; +#ifdef FOG_EXP2 +uniform float fogDensity; +#else +uniform float fogNear;uniform float fogFar; +#endif +#endif`,qm=`#ifdef USE_GRADIENTMAP +uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance(vec3 normal,vec3 lightDirection){float dotNL=dot(normal,lightDirection);vec2 coord=vec2(dotNL*0.5+0.5,0.0); +#ifdef USE_GRADIENTMAP +return vec3(texture2D(gradientMap,coord).r); +#else +vec2 fw=fwidth(coord)*0.5;return mix(vec3(0.7),vec3(1.0),smoothstep(0.7-fw.x,0.7+fw.x,coord.x)); +#endif +}`,jm=`#ifdef USE_LIGHTMAP +vec4 lightMapTexel=texture2D(lightMap,vLightMapUv);vec3 lightMapIrradiance=lightMapTexel.rgb*lightMapIntensity;reflectedLight.indirectDiffuse+=lightMapIrradiance; +#endif`,Xm=`#ifdef USE_LIGHTMAP +uniform sampler2D lightMap;uniform float lightMapIntensity; +#endif`,Ym="LambertMaterial material;material.diffuseColor=diffuseColor.rgb;material.specularStrength=specularStrength;",Zm=`varying vec3 vViewPosition;struct LambertMaterial{vec3 diffuseColor;float specularStrength;};void 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){float dotNL=saturate(dot(geometryNormal,directLight.direction));vec3 irradiance=dotNL*directLight.color;reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,$m=`uniform bool receiveShadow;uniform vec3 ambientLightColor; +#if defined(USE_LIGHT_PROBES) +uniform vec3 lightProbe[9]; +#endif +vec3 shGetIrradianceAt(in vec3 normal,in vec3 shCoefficients[9]){float x=normal.x,y=normal.y,z=normal.z;vec3 result=shCoefficients[0]*0.886227;result+=shCoefficients[1]*2.0*0.511664*y;result+=shCoefficients[2]*2.0*0.511664*z;result+=shCoefficients[3]*2.0*0.511664*x;result+=shCoefficients[4]*2.0*0.429043*x*y;result+=shCoefficients[5]*2.0*0.429043*y*z;result+=shCoefficients[6]*(0.743125*z*z-0.247708);result+=shCoefficients[7]*2.0*0.429043*x*z;result+=shCoefficients[8]*0.429043*(x*x-y*y);return result;}vec3 getLightProbeIrradiance(const in vec3 lightProbe[9],const in vec3 normal){vec3 worldNormal=inverseTransformDirection(normal,viewMatrix);vec3 irradiance=shGetIrradianceAt(worldNormal,lightProbe);return irradiance;}vec3 getAmbientLightIrradiance(const in vec3 ambientLightColor){vec3 irradiance=ambientLightColor;return irradiance;}float getDistanceAttenuation(const in float lightDistance,const in float cutoffDistance,const in float decayExponent){ +#if defined(LEGACY_LIGHTS) +if(cutoffDistance>0.0&&decayExponent>0.0){return pow(saturate(-lightDistance/cutoffDistance+1.0),decayExponent);}return 1.0; +#else +float distanceFalloff=1.0/max(pow(lightDistance,decayExponent),0.01);if(cutoffDistance>0.0){distanceFalloff*=pow2(saturate(1.0-pow4(lightDistance/cutoffDistance)));}return distanceFalloff; +#endif +}float getSpotAttenuation(const in float coneCosine,const in float penumbraCosine,const in float angleCosine){return smoothstep(coneCosine,penumbraCosine,angleCosine);} +#if NUM_DIR_LIGHTS>0 +struct DirectionalLight{vec3 direction;vec3 color;};uniform DirectionalLight directionalLights[NUM_DIR_LIGHTS];void getDirectionalLightInfo(const in DirectionalLight directionalLight,out IncidentLight light){light.color=directionalLight.color;light.direction=directionalLight.direction;light.visible=true;} +#endif +#if NUM_POINT_LIGHTS>0 +struct PointLight{vec3 position;vec3 color;float distance;float decay;};uniform PointLight pointLights[NUM_POINT_LIGHTS];void getPointLightInfo(const in PointLight pointLight,const in vec3 geometryPosition,out IncidentLight light){vec3 lVector=pointLight.position-geometryPosition;light.direction=normalize(lVector);float lightDistance=length(lVector);light.color=pointLight.color;light.color*=getDistanceAttenuation(lightDistance,pointLight.distance,pointLight.decay);light.visible=(light.color!=vec3(0.0));} +#endif +#if NUM_SPOT_LIGHTS>0 +struct SpotLight{vec3 position;vec3 direction;vec3 color;float distance;float decay;float coneCos;float penumbraCos;};uniform SpotLight spotLights[NUM_SPOT_LIGHTS];void getSpotLightInfo(const in SpotLight spotLight,const in vec3 geometryPosition,out IncidentLight light){vec3 lVector=spotLight.position-geometryPosition;light.direction=normalize(lVector);float angleCos=dot(light.direction,spotLight.direction);float spotAttenuation=getSpotAttenuation(spotLight.coneCos,spotLight.penumbraCos,angleCos);if(spotAttenuation>0.0){float lightDistance=length(lVector);light.color=spotLight.color*spotAttenuation;light.color*=getDistanceAttenuation(lightDistance,spotLight.distance,spotLight.decay);light.visible=(light.color!=vec3(0.0));}else{light.color=vec3(0.0);light.visible=false;}} +#endif +#if NUM_RECT_AREA_LIGHTS>0 +struct RectAreaLight{vec3 color;vec3 position;vec3 halfWidth;vec3 halfHeight;};uniform sampler2D ltc_1;uniform sampler2D ltc_2;uniform RectAreaLight rectAreaLights[NUM_RECT_AREA_LIGHTS]; +#endif +#if NUM_HEMI_LIGHTS>0 +struct HemisphereLight{vec3 direction;vec3 skyColor;vec3 groundColor;};uniform HemisphereLight hemisphereLights[NUM_HEMI_LIGHTS];vec3 getHemisphereLightIrradiance(const in HemisphereLight hemiLight,const in vec3 normal){float dotNL=dot(normal,hemiLight.direction);float hemiDiffuseWeight=0.5*dotNL+0.5;vec3 irradiance=mix(hemiLight.groundColor,hemiLight.skyColor,hemiDiffuseWeight);return irradiance;} +#endif`,Jm=`#ifdef USE_ENVMAP +vec3 getIBLIrradiance(const in vec3 normal){ +#ifdef ENVMAP_TYPE_CUBE_UV +vec3 worldNormal=inverseTransformDirection(normal,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,worldNormal,1.0);return PI*envMapColor.rgb*envMapIntensity; +#else +return vec3(0.0); +#endif +}vec3 getIBLRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness){ +#ifdef ENVMAP_TYPE_CUBE_UV +vec3 reflectVec=reflect(-viewDir,normal);reflectVec=normalize(mix(reflectVec,normal,roughness*roughness));reflectVec=inverseTransformDirection(reflectVec,viewMatrix);vec4 envMapColor=textureCubeUV(envMap,reflectVec,roughness);return envMapColor.rgb*envMapIntensity; +#else +return vec3(0.0); +#endif +} +#ifdef USE_ANISOTROPY +vec3 getIBLAnisotropyRadiance(const in vec3 viewDir,const in vec3 normal,const in float roughness,const in vec3 bitangent,const in float anisotropy){ +#ifdef ENVMAP_TYPE_CUBE_UV +vec3 bentNormal=cross(bitangent,viewDir);bentNormal=normalize(cross(bentNormal,bitangent));bentNormal=normalize(mix(bentNormal,normal,pow2(pow2(1.0-anisotropy*(1.0-roughness)))));return getIBLRadiance(viewDir,bentNormal,roughness); +#else +return vec3(0.0); +#endif +} +#endif +#endif`,Km="ToonMaterial material;material.diffuseColor=diffuseColor.rgb;",Qm=`varying vec3 vViewPosition;struct ToonMaterial{vec3 diffuseColor;};void 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){vec3 irradiance=getGradientIrradiance(geometryNormal,directLight.direction)*directLight.color;reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,eg="BlinnPhongMaterial material;material.diffuseColor=diffuseColor.rgb;material.specularColor=specular;material.specularShininess=shininess;material.specularStrength=specularStrength;",tg=`varying vec3 vViewPosition;struct BlinnPhongMaterial{vec3 diffuseColor;vec3 specularColor;float specularShininess;float specularStrength;};void 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){float dotNL=saturate(dot(geometryNormal,directLight.direction));vec3 irradiance=dotNL*directLight.color;reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);reflectedLight.directSpecular+=irradiance*BRDF_BlinnPhong(directLight.direction,geometryViewDir,geometryNormal,material.specularColor,material.specularShininess)*material.specularStrength;}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ig=`PhysicalMaterial material;material.diffuseColor=diffuseColor.rgb*(1.0-metalnessFactor);vec3 dxy=max(abs(dFdx(nonPerturbedNormal)),abs(dFdy(nonPerturbedNormal)));float geometryRoughness=max(max(dxy.x,dxy.y),dxy.z);material.roughness=max(roughnessFactor,0.0525);material.roughness+=geometryRoughness;material.roughness=min(material.roughness,1.0); +#ifdef IOR +material.ior=ior; +#ifdef USE_SPECULAR +float specularIntensityFactor=specularIntensity;vec3 specularColorFactor=specularColor; +#ifdef USE_SPECULAR_COLORMAP +specularColorFactor*=texture2D(specularColorMap,vSpecularColorMapUv).rgb; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP +specularIntensityFactor*=texture2D(specularIntensityMap,vSpecularIntensityMapUv).a; +#endif +material.specularF90=mix(specularIntensityFactor,1.0,metalnessFactor); +#else +float specularIntensityFactor=1.0;vec3 specularColorFactor=vec3(1.0);material.specularF90=1.0; +#endif +material.specularColor=mix(min(pow2((material.ior-1.0)/(material.ior+1.0))*specularColorFactor,vec3(1.0))*specularIntensityFactor,diffuseColor.rgb,metalnessFactor); +#else +material.specularColor=mix(vec3(0.04),diffuseColor.rgb,metalnessFactor);material.specularF90=1.0; +#endif +#ifdef USE_CLEARCOAT +material.clearcoat=clearcoat;material.clearcoatRoughness=clearcoatRoughness;material.clearcoatF0=vec3(0.04);material.clearcoatF90=1.0; +#ifdef USE_CLEARCOATMAP +material.clearcoat*=texture2D(clearcoatMap,vClearcoatMapUv).x; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP +material.clearcoatRoughness*=texture2D(clearcoatRoughnessMap,vClearcoatRoughnessMapUv).y; +#endif +material.clearcoat=saturate(material.clearcoat);material.clearcoatRoughness=max(material.clearcoatRoughness,0.0525);material.clearcoatRoughness+=geometryRoughness;material.clearcoatRoughness=min(material.clearcoatRoughness,1.0); +#endif +#ifdef USE_IRIDESCENCE +material.iridescence=iridescence;material.iridescenceIOR=iridescenceIOR; +#ifdef USE_IRIDESCENCEMAP +material.iridescence*=texture2D(iridescenceMap,vIridescenceMapUv).r; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP +material.iridescenceThickness=(iridescenceThicknessMaximum-iridescenceThicknessMinimum)*texture2D(iridescenceThicknessMap,vIridescenceThicknessMapUv).g+iridescenceThicknessMinimum; +#else +material.iridescenceThickness=iridescenceThicknessMaximum; +#endif +#endif +#ifdef USE_SHEEN +material.sheenColor=sheenColor; +#ifdef USE_SHEEN_COLORMAP +material.sheenColor*=texture2D(sheenColorMap,vSheenColorMapUv).rgb; +#endif +material.sheenRoughness=clamp(sheenRoughness,0.07,1.0); +#ifdef USE_SHEEN_ROUGHNESSMAP +material.sheenRoughness*=texture2D(sheenRoughnessMap,vSheenRoughnessMapUv).a; +#endif +#endif +#ifdef USE_ANISOTROPY +#ifdef USE_ANISOTROPYMAP +mat2 anisotropyMat=mat2(anisotropyVector.x,anisotropyVector.y,-anisotropyVector.y,anisotropyVector.x);vec3 anisotropyPolar=texture2D(anisotropyMap,vAnisotropyMapUv).rgb;vec2 anisotropyV=anisotropyMat*normalize(2.0*anisotropyPolar.rg-vec2(1.0))*anisotropyPolar.b; +#else +vec2 anisotropyV=anisotropyVector; +#endif +material.anisotropy=length(anisotropyV);anisotropyV/=material.anisotropy;material.anisotropy=saturate(material.anisotropy);material.alphaT=mix(pow2(material.roughness),1.0,pow2(material.anisotropy));material.anisotropyT=tbn[0]*anisotropyV.x-tbn[1]*anisotropyV.y;material.anisotropyB=tbn[1]*anisotropyV.x+tbn[0]*anisotropyV.y; +#endif`,ng=`struct PhysicalMaterial{vec3 diffuseColor;float roughness;vec3 specularColor;float specularF90; +#ifdef USE_CLEARCOAT +float clearcoat;float clearcoatRoughness;vec3 clearcoatF0;float clearcoatF90; +#endif +#ifdef USE_IRIDESCENCE +float iridescence;float iridescenceIOR;float iridescenceThickness;vec3 iridescenceFresnel;vec3 iridescenceF0; +#endif +#ifdef USE_SHEEN +vec3 sheenColor;float sheenRoughness; +#endif +#ifdef IOR +float ior; +#endif +#ifdef USE_TRANSMISSION +float transmission;float transmissionAlpha;float thickness;float attenuationDistance;vec3 attenuationColor; +#endif +#ifdef USE_ANISOTROPY +float anisotropy;float alphaT;vec3 anisotropyT;vec3 anisotropyB; +#endif +};vec3 clearcoatSpecular=vec3(0.0);vec3 sheenSpecular=vec3(0.0);vec3 Schlick_to_F0(const in vec3 f,const in float f90,const in float dotVH){float x=clamp(1.0-dotVH,0.0,1.0);float x2=x*x;float x5=clamp(x*x2*x2,0.0,0.9999);return(f-vec3(f90)*x5)/(1.0-x5);}float V_GGX_SmithCorrelated(const in float alpha,const in float dotNL,const in float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}float D_GGX(const in float alpha,const in float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);} +#ifdef USE_ANISOTROPY +float 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){float gv=dotNL*length(vec3(alphaT*dotTV,alphaB*dotBV,dotNV));float gl=dotNV*length(vec3(alphaT*dotTL,alphaB*dotBL,dotNL));float v=0.5/(gv+gl);return saturate(v);}float D_GGX_Anisotropic(const in float alphaT,const in float alphaB,const in float dotNH,const in float dotTH,const in float dotBH){float a2=alphaT*alphaB;highp vec3 v=vec3(alphaB*dotTH,alphaT*dotBH,a2*dotNH);highp float v2=dot(v,v);float w2=a2/v2;return RECIPROCAL_PI*a2*pow2(w2);} +#endif +#ifdef USE_CLEARCOAT +vec3 BRDF_GGX_Clearcoat(const in vec3 lightDir,const in vec3 viewDir,const in vec3 normal,const in PhysicalMaterial material){vec3 f0=material.clearcoatF0;float f90=material.clearcoatF90;float roughness=material.clearcoatRoughness;float alpha=pow2(roughness);vec3 halfDir=normalize(lightDir+viewDir);float dotNL=saturate(dot(normal,lightDir));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotVH=saturate(dot(viewDir,halfDir));vec3 F=F_Schlick(f0,f90,dotVH);float V=V_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH);return F*(V*D);} +#endif +vec3 BRDF_GGX(const in vec3 lightDir,const in vec3 viewDir,const in vec3 normal,const in PhysicalMaterial material){vec3 f0=material.specularColor;float f90=material.specularF90;float roughness=material.roughness;float alpha=pow2(roughness);vec3 halfDir=normalize(lightDir+viewDir);float dotNL=saturate(dot(normal,lightDir));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotVH=saturate(dot(viewDir,halfDir));vec3 F=F_Schlick(f0,f90,dotVH); +#ifdef USE_IRIDESCENCE +F=mix(F,material.iridescenceFresnel,material.iridescence); +#endif +#ifdef USE_ANISOTROPY +float dotTL=dot(material.anisotropyT,lightDir);float dotTV=dot(material.anisotropyT,viewDir);float dotTH=dot(material.anisotropyT,halfDir);float dotBL=dot(material.anisotropyB,lightDir);float dotBV=dot(material.anisotropyB,viewDir);float dotBH=dot(material.anisotropyB,halfDir);float V=V_GGX_SmithCorrelated_Anisotropic(material.alphaT,alpha,dotTV,dotBV,dotTL,dotBL,dotNV,dotNL);float D=D_GGX_Anisotropic(material.alphaT,alpha,dotNH,dotTH,dotBH); +#else +float V=V_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH); +#endif +return F*(V*D);}vec2 LTC_Uv(const in vec3 N,const in vec3 V,const in float roughness){const float LUT_SIZE=64.0;const float LUT_SCALE=(LUT_SIZE-1.0)/LUT_SIZE;const float LUT_BIAS=0.5/LUT_SIZE;float dotNV=saturate(dot(N,V));vec2 uv=vec2(roughness,sqrt(1.0-dotNV));uv=uv*LUT_SCALE+LUT_BIAS;return uv;}float LTC_ClippedSphereFormFactor(const in vec3 f){float l=length(f);return max((l*l+f.z)/(l+1.0),0.0);}vec3 LTC_EdgeVectorFormFactor(const in vec3 v1,const in vec3 v2){float x=dot(v1,v2);float y=abs(x);float a=0.8543985+(0.4965155+0.0145206*y)*y;float b=3.4175940+(4.1616724+y)*y;float v=a/b;float theta_sintheta=(x>0.0)?v:0.5*inversesqrt(max(1.0-x*x,1e-7))-v;return cross(v1,v2)*theta_sintheta;}vec3 LTC_Evaluate(const in vec3 N,const in vec3 V,const in vec3 P,const in mat3 mInv,const in vec3 rectCoords[4]){vec3 v1=rectCoords[1]-rectCoords[0];vec3 v2=rectCoords[3]-rectCoords[0];vec3 lightNormal=cross(v1,v2);if(dot(lightNormal,P-rectCoords[0])<0.0)return vec3(0.0);vec3 T1,T2;T1=normalize(V-N*dot(V,N));T2=-cross(N,T1);mat3 mat=mInv*transposeMat3(mat3(T1,T2,N));vec3 coords[4];coords[0]=mat*(rectCoords[0]-P);coords[1]=mat*(rectCoords[1]-P);coords[2]=mat*(rectCoords[2]-P);coords[3]=mat*(rectCoords[3]-P);coords[0]=normalize(coords[0]);coords[1]=normalize(coords[1]);coords[2]=normalize(coords[2]);coords[3]=normalize(coords[3]);vec3 vectorFormFactor=vec3(0.0);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[0],coords[1]);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[1],coords[2]);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[2],coords[3]);vectorFormFactor+=LTC_EdgeVectorFormFactor(coords[3],coords[0]);float result=LTC_ClippedSphereFormFactor(vectorFormFactor);return vec3(result);} +#if defined(USE_SHEEN) +float D_Charlie(float roughness,float dotNH){float alpha=pow2(roughness);float invAlpha=1.0/alpha;float cos2h=dotNH*dotNH;float sin2h=max(1.0-cos2h,0.0078125);return(2.0+invAlpha)*pow(sin2h,invAlpha*0.5)/(2.0*PI);}float V_Neubelt(float dotNV,float dotNL){return saturate(1.0/(4.0*(dotNL+dotNV-dotNL*dotNV)));}vec3 BRDF_Sheen(const in vec3 lightDir,const in vec3 viewDir,const in vec3 normal,vec3 sheenColor,const in float sheenRoughness){vec3 halfDir=normalize(lightDir+viewDir);float dotNL=saturate(dot(normal,lightDir));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float D=D_Charlie(sheenRoughness,dotNH);float V=V_Neubelt(dotNV,dotNL);return sheenColor*(D*V);} +#endif +float IBLSheenBRDF(const in vec3 normal,const in vec3 viewDir,const in float roughness){float dotNV=saturate(dot(normal,viewDir));float r2=roughness*roughness;float a=roughness<0.25?-339.2*r2+161.4*roughness-25.9:-8.48*r2+14.3*roughness-9.95;float b=roughness<0.25?44.0*r2-23.7*roughness+3.26:1.97*r2-3.27*roughness+0.72;float DG=exp(a*dotNV+b)+(roughness<0.25?0.0:0.1*(roughness-0.25));return saturate(DG*RECIPROCAL_PI);}vec2 DFGApprox(const in vec3 normal,const in vec3 viewDir,const in float roughness){float dotNV=saturate(dot(normal,viewDir));const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 fab=vec2(-1.04,1.04)*a004+r.zw;return fab;}vec3 EnvironmentBRDF(const in vec3 normal,const in vec3 viewDir,const in vec3 specularColor,const in float specularF90,const in float roughness){vec2 fab=DFGApprox(normal,viewDir,roughness);return specularColor*fab.x+specularF90*fab.y;} +#ifdef USE_IRIDESCENCE +void 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){ +#else +void 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){ +#endif +vec2 fab=DFGApprox(normal,viewDir,roughness); +#ifdef USE_IRIDESCENCE +vec3 Fr=mix(specularColor,iridescenceF0,iridescence); +#else +vec3 Fr=specularColor; +#endif +vec3 FssEss=Fr*fab.x+specularF90*fab.y;float Ess=fab.x+fab.y;float Ems=1.0-Ess;vec3 Favg=Fr+(1.0-Fr)*0.047619;vec3 Fms=FssEss*Favg/(1.0-Ems*Favg);singleScatter+=FssEss;multiScatter+=Fms*Ems;} +#if NUM_RECT_AREA_LIGHTS>0 +void 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){vec3 normal=geometryNormal;vec3 viewDir=geometryViewDir;vec3 position=geometryPosition;vec3 lightPos=rectAreaLight.position;vec3 halfWidth=rectAreaLight.halfWidth;vec3 halfHeight=rectAreaLight.halfHeight;vec3 lightColor=rectAreaLight.color;float roughness=material.roughness;vec3 rectCoords[4];rectCoords[0]=lightPos+halfWidth-halfHeight;rectCoords[1]=lightPos-halfWidth-halfHeight;rectCoords[2]=lightPos-halfWidth+halfHeight;rectCoords[3]=lightPos+halfWidth+halfHeight;vec2 uv=LTC_Uv(normal,viewDir,roughness);vec4 t1=texture2D(ltc_1,uv);vec4 t2=texture2D(ltc_2,uv);mat3 mInv=mat3(vec3(t1.x,0,t1.y),vec3(0,1,0),vec3(t1.z,0,t1.w));vec3 fresnel=(material.specularColor*t2.x+(vec3(1.0)-material.specularColor)*t2.y);reflectedLight.directSpecular+=lightColor*fresnel*LTC_Evaluate(normal,viewDir,position,mInv,rectCoords);reflectedLight.directDiffuse+=lightColor*material.diffuseColor*LTC_Evaluate(normal,viewDir,position,mat3(1.0),rectCoords);} +#endif +void 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){float dotNL=saturate(dot(geometryNormal,directLight.direction));vec3 irradiance=dotNL*directLight.color; +#ifdef USE_CLEARCOAT +float dotNLcc=saturate(dot(geometryClearcoatNormal,directLight.direction));vec3 ccIrradiance=dotNLcc*directLight.color;clearcoatSpecular+=ccIrradiance*BRDF_GGX_Clearcoat(directLight.direction,geometryViewDir,geometryClearcoatNormal,material); +#endif +#ifdef USE_SHEEN +sheenSpecular+=irradiance*BRDF_Sheen(directLight.direction,geometryViewDir,geometryNormal,material.sheenColor,material.sheenRoughness); +#endif +reflectedLight.directSpecular+=irradiance*BRDF_GGX(directLight.direction,geometryViewDir,geometryNormal,material);reflectedLight.directDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){reflectedLight.indirectDiffuse+=irradiance*BRDF_Lambert(material.diffuseColor);}void 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){ +#ifdef USE_CLEARCOAT +clearcoatSpecular+=clearcoatRadiance*EnvironmentBRDF(geometryClearcoatNormal,geometryViewDir,material.clearcoatF0,material.clearcoatF90,material.clearcoatRoughness); +#endif +#ifdef USE_SHEEN +sheenSpecular+=irradiance*material.sheenColor*IBLSheenBRDF(geometryNormal,geometryViewDir,material.sheenRoughness); +#endif +vec3 singleScattering=vec3(0.0);vec3 multiScattering=vec3(0.0);vec3 cosineWeightedIrradiance=irradiance*RECIPROCAL_PI; +#ifdef USE_IRIDESCENCE +computeMultiscatteringIridescence(geometryNormal,geometryViewDir,material.specularColor,material.specularF90,material.iridescence,material.iridescenceFresnel,material.roughness,singleScattering,multiScattering); +#else +computeMultiscattering(geometryNormal,geometryViewDir,material.specularColor,material.specularF90,material.roughness,singleScattering,multiScattering); +#endif +vec3 totalScattering=singleScattering+multiScattering;vec3 diffuse=material.diffuseColor*(1.0-max(max(totalScattering.r,totalScattering.g),totalScattering.b));reflectedLight.indirectSpecular+=radiance*singleScattering;reflectedLight.indirectSpecular+=multiScattering*cosineWeightedIrradiance;reflectedLight.indirectDiffuse+=diffuse*cosineWeightedIrradiance;} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion(const in float dotNV,const in float ambientOcclusion,const in float roughness){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}`,rg=`vec3 geometryPosition=-vViewPosition;vec3 geometryNormal=normal;vec3 geometryViewDir=(isOrthographic)?vec3(0,0,1):normalize(vViewPosition);vec3 geometryClearcoatNormal; +#ifdef USE_CLEARCOAT +geometryClearcoatNormal=clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE +float dotNVi=saturate(dot(normal,geometryViewDir));if(material.iridescenceThickness==0.0){material.iridescence=0.0;}else{material.iridescence=saturate(material.iridescence);}if(material.iridescence>0.0){material.iridescenceFresnel=evalIridescence(1.0,material.iridescenceIOR,dotNVi,material.iridescenceThickness,material.specularColor);material.iridescenceF0=Schlick_to_F0(material.iridescenceFresnel,1.0,dotNVi);} +#endif +IncidentLight directLight; +#if (NUM_POINT_LIGHTS>0)&&defined(RE_Direct) +PointLight pointLight; +#if defined(USE_SHADOWMAP)&&NUM_POINT_LIGHT_SHADOWS>0 +PointLightShadow pointLightShadow; +#endif +#pragma unroll_loop_start +for(int i=0;i0)&&defined(RE_Direct) +SpotLight spotLight;vec4 spotColor;vec3 spotLightCoord;bool inSpotLightMap; +#if defined(USE_SHADOWMAP)&&NUM_SPOT_LIGHT_SHADOWS>0 +SpotLightShadow spotLightShadow; +#endif +#pragma unroll_loop_start +for(int i=0;i0)&&defined(RE_Direct) +DirectionalLight directionalLight; +#if defined(USE_SHADOWMAP)&&NUM_DIR_LIGHT_SHADOWS>0 +DirectionalLightShadow directionalLightShadow; +#endif +#pragma unroll_loop_start +for(int i=0;i0)&&defined(RE_Direct_RectArea) +RectAreaLight rectAreaLight; +#pragma unroll_loop_start +for(int i=0;i0) +#pragma unroll_loop_start +for(int i=0;i0 +varying vec4 vSpotLightCoord[NUM_SPOT_LIGHT_COORDS]; +#endif +#if NUM_SPOT_LIGHT_MAPS>0 +uniform sampler2D spotLightMap[NUM_SPOT_LIGHT_MAPS]; +#endif +#ifdef USE_SHADOWMAP +#if NUM_DIR_LIGHT_SHADOWS>0 +uniform sampler2D directionalShadowMap[NUM_DIR_LIGHT_SHADOWS];varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHT_SHADOWS];struct DirectionalLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform DirectionalLightShadow directionalLightShadows[NUM_DIR_LIGHT_SHADOWS]; +#endif +#if NUM_SPOT_LIGHT_SHADOWS>0 +uniform sampler2D spotShadowMap[NUM_SPOT_LIGHT_SHADOWS];struct SpotLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform SpotLightShadow spotLightShadows[NUM_SPOT_LIGHT_SHADOWS]; +#endif +#if NUM_POINT_LIGHT_SHADOWS>0 +uniform sampler2D pointShadowMap[NUM_POINT_LIGHT_SHADOWS];varying vec4 vPointShadowCoord[NUM_POINT_LIGHT_SHADOWS];struct PointLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;float shadowCameraNear;float shadowCameraFar;};uniform PointLightShadow pointLightShadows[NUM_POINT_LIGHT_SHADOWS]; +#endif +float texture2DCompare(sampler2D depths,vec2 uv,float compare){return step(compare,unpackRGBAToDepth(texture2D(depths,uv)));}vec2 texture2DDistribution(sampler2D shadow,vec2 uv){return unpackRGBATo2Half(texture2D(shadow,uv));}float VSMShadow(sampler2D shadow,vec2 uv,float compare){float occlusion=1.0;vec2 distribution=texture2DDistribution(shadow,uv);float hard_shadow=step(compare,distribution.x);if(hard_shadow!=1.0){float distance=compare-distribution.x;float variance=max(0.00000,distribution.y*distribution.y);float softness_probability=variance/(variance+distance*distance);softness_probability=clamp((softness_probability-0.3)/(0.95-0.3),0.0,1.0);occlusion=clamp(max(hard_shadow,softness_probability),0.0,1.0);}return occlusion;}float getShadow(sampler2D shadowMap,vec2 shadowMapSize,float shadowBias,float shadowRadius,vec4 shadowCoord){float shadow=1.0;shadowCoord.xyz/=shadowCoord.w;shadowCoord.z+=shadowBias;bool inFrustum=shadowCoord.x>=0.0&&shadowCoord.x<=1.0&&shadowCoord.y>=0.0&&shadowCoord.y<=1.0;bool frustumTest=inFrustum&&shadowCoord.z<=1.0;if(frustumTest){ +#if defined(SHADOWMAP_TYPE_PCF) +vec2 texelSize=vec2(1.0)/shadowMapSize;float dx0=-texelSize.x*shadowRadius;float dy0=-texelSize.y*shadowRadius;float dx1=+texelSize.x*shadowRadius;float dy1=+texelSize.y*shadowRadius;float dx2=dx0/2.0;float dy2=dy0/2.0;float dx3=dx1/2.0;float dy3=dy1/2.0;shadow=(texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx0,dy0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx1,dy0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx2,dy2),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy2),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx3,dy2),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx0,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx2,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy,shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx3,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx1,0.0),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx2,dy3),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy3),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx3,dy3),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx0,dy1),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(0.0,dy1),shadowCoord.z)+texture2DCompare(shadowMap,shadowCoord.xy+vec2(dx1,dy1),shadowCoord.z))*(1.0/17.0); +#elif defined(SHADOWMAP_TYPE_PCF_SOFT) +vec2 texelSize=vec2(1.0)/shadowMapSize;float dx=texelSize.x;float dy=texelSize.y;vec2 uv=shadowCoord.xy;vec2 f=fract(uv*shadowMapSize+0.5);uv-=f*texelSize;shadow=(texture2DCompare(shadowMap,uv,shadowCoord.z)+texture2DCompare(shadowMap,uv+vec2(dx,0.0),shadowCoord.z)+texture2DCompare(shadowMap,uv+vec2(0.0,dy),shadowCoord.z)+texture2DCompare(shadowMap,uv+texelSize,shadowCoord.z)+mix(texture2DCompare(shadowMap,uv+vec2(-dx,0.0),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,0.0),shadowCoord.z),f.x)+mix(texture2DCompare(shadowMap,uv+vec2(-dx,dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,dy),shadowCoord.z),f.x)+mix(texture2DCompare(shadowMap,uv+vec2(0.0,-dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(0.0,2.0*dy),shadowCoord.z),f.y)+mix(texture2DCompare(shadowMap,uv+vec2(dx,-dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(dx,2.0*dy),shadowCoord.z),f.y)+mix(mix(texture2DCompare(shadowMap,uv+vec2(-dx,-dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,-dy),shadowCoord.z),f.x),mix(texture2DCompare(shadowMap,uv+vec2(-dx,2.0*dy),shadowCoord.z),texture2DCompare(shadowMap,uv+vec2(2.0*dx,2.0*dy),shadowCoord.z),f.x),f.y))*(1.0/9.0); +#elif defined(SHADOWMAP_TYPE_VSM) +shadow=VSMShadow(shadowMap,shadowCoord.xy,shadowCoord.z); +#else +shadow=texture2DCompare(shadowMap,shadowCoord.xy,shadowCoord.z); +#endif +}return shadow;}vec2 cubeToUV(vec3 v,float texelSizeY){vec3 absV=abs(v);float scaleToCube=1.0/max(absV.x,max(absV.y,absV.z));absV*=scaleToCube;v*=scaleToCube*(1.0-2.0*texelSizeY);vec2 planar=v.xy;float almostATexel=1.5*texelSizeY;float almostOne=1.0-almostATexel;if(absV.z>=almostOne){if(v.z>0.0)planar.x=4.0-v.x;}else if(absV.x>=almostOne){float signX=sign(v.x);planar.x=v.z*signX+2.0*signX;}else if(absV.y>=almostOne){float signY=sign(v.y);planar.x=v.x+2.0*signY+2.0;planar.y=v.z*signY-2.0;}return vec2(0.125,0.25)*planar+vec2(0.375,0.75);}float getPointShadow(sampler2D shadowMap,vec2 shadowMapSize,float shadowBias,float shadowRadius,vec4 shadowCoord,float shadowCameraNear,float shadowCameraFar){vec2 texelSize=vec2(1.0)/(shadowMapSize*vec2(4.0,2.0));vec3 lightToPosition=shadowCoord.xyz;float dp=(length(lightToPosition)-shadowCameraNear)/(shadowCameraFar-shadowCameraNear);dp+=shadowBias;vec3 bd3D=normalize(lightToPosition); +#if defined(SHADOWMAP_TYPE_PCF)||defined(SHADOWMAP_TYPE_PCF_SOFT)||defined(SHADOWMAP_TYPE_VSM) +vec2 offset=vec2(-1,1)*shadowRadius*texelSize.y;return(texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xyy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yyy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xyx,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yyx,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xxy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yxy,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.xxx,texelSize.y),dp)+texture2DCompare(shadowMap,cubeToUV(bd3D+offset.yxx,texelSize.y),dp))*(1.0/9.0); +#else +return texture2DCompare(shadowMap,cubeToUV(bd3D,texelSize.y),dp); +#endif +} +#endif`,Bg=`#if NUM_SPOT_LIGHT_COORDS>0 +uniform mat4 spotLightMatrix[NUM_SPOT_LIGHT_COORDS];varying vec4 vSpotLightCoord[NUM_SPOT_LIGHT_COORDS]; +#endif +#ifdef USE_SHADOWMAP +#if NUM_DIR_LIGHT_SHADOWS>0 +uniform mat4 directionalShadowMatrix[NUM_DIR_LIGHT_SHADOWS];varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHT_SHADOWS];struct DirectionalLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform DirectionalLightShadow directionalLightShadows[NUM_DIR_LIGHT_SHADOWS]; +#endif +#if NUM_SPOT_LIGHT_SHADOWS>0 +struct SpotLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;};uniform SpotLightShadow spotLightShadows[NUM_SPOT_LIGHT_SHADOWS]; +#endif +#if NUM_POINT_LIGHT_SHADOWS>0 +uniform mat4 pointShadowMatrix[NUM_POINT_LIGHT_SHADOWS];varying vec4 vPointShadowCoord[NUM_POINT_LIGHT_SHADOWS];struct PointLightShadow{float shadowBias;float shadowNormalBias;float shadowRadius;vec2 shadowMapSize;float shadowCameraNear;float shadowCameraFar;};uniform PointLightShadow pointLightShadows[NUM_POINT_LIGHT_SHADOWS]; +#endif +#endif`,Vg=`#if (defined(USE_SHADOWMAP)&&(NUM_DIR_LIGHT_SHADOWS>0||NUM_POINT_LIGHT_SHADOWS>0))||(NUM_SPOT_LIGHT_COORDS>0) +vec3 shadowWorldNormal=inverseTransformDirection(transformedNormal,viewMatrix);vec4 shadowWorldPosition; +#endif +#if defined(USE_SHADOWMAP) +#if NUM_DIR_LIGHT_SHADOWS>0 +#pragma unroll_loop_start +for(int i=0;i0 +#pragma unroll_loop_start +for(int i=0;i0 +#pragma unroll_loop_start +for(int i=0;i0 +DirectionalLightShadow directionalLight; +#pragma unroll_loop_start +for(int i=0;i0 +SpotLightShadow spotLight; +#pragma unroll_loop_start +for(int i=0;i0 +PointLightShadow pointLight; +#pragma unroll_loop_start +for(int i=0;i0 +vec4 worldPosition=vec4(transformed,1.0); +#ifdef USE_INSTANCING +worldPosition=instanceMatrix*worldPosition; +#endif +worldPosition=modelMatrix*worldPosition; +#endif`,n_="varying vec2 vUv;uniform mat3 uvTransform;void main(){vUv=(uvTransform*vec3(uv,1)).xy;gl_Position=vec4(position.xy,1.0,1.0);}",r_=`uniform sampler2D t2D;uniform float backgroundIntensity;varying vec2 vUv;void main(){vec4 texColor=texture2D(t2D,vUv); +#ifdef DECODE_VIDEO_TEXTURE +texColor=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); +#endif +texColor.rgb*=backgroundIntensity;gl_FragColor=texColor; +#include +#include +}`,s_=`varying vec3 vWorldDirection; +#include +void main(){vWorldDirection=transformDirection(position,modelMatrix); +#include +#include +gl_Position.z=gl_Position.w;}`,a_=`#ifdef ENVMAP_TYPE_CUBE +uniform samplerCube envMap; +#elif defined(ENVMAP_TYPE_CUBE_UV) +uniform sampler2D envMap; +#endif +uniform float flipEnvMap;uniform float backgroundBlurriness;uniform float backgroundIntensity;varying vec3 vWorldDirection; +#include +void main(){ +#ifdef ENVMAP_TYPE_CUBE +vec4 texColor=textureCube(envMap,vec3(flipEnvMap*vWorldDirection.x,vWorldDirection.yz)); +#elif defined(ENVMAP_TYPE_CUBE_UV) +vec4 texColor=textureCubeUV(envMap,vWorldDirection,backgroundBlurriness); +#else +vec4 texColor=vec4(0.0,0.0,0.0,1.0); +#endif +texColor.rgb*=backgroundIntensity;gl_FragColor=texColor; +#include +#include +}`,o_=`varying vec3 vWorldDirection; +#include +void main(){vWorldDirection=transformDirection(position,modelMatrix); +#include +#include +gl_Position.z=gl_Position.w;}`,l_=`uniform samplerCube tCube;uniform float tFlip;uniform float opacity;varying vec3 vWorldDirection;void main(){vec4 texColor=textureCube(tCube,vec3(tFlip*vWorldDirection.x,vWorldDirection.yz));gl_FragColor=texColor;gl_FragColor.a*=opacity; +#include +#include +}`,c_=`#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW;void main(){ +#include +#include +#ifdef USE_DISPLACEMENTMAP +#include +#include +#include +#endif +#include +#include +#include +#include +#include +#include +#include +vHighPrecisionZW=gl_Position.zw;}`,u_=`#if DEPTH_PACKING==3200 +uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW;void main(){ +#include +vec4 diffuseColor=vec4(1.0); +#if DEPTH_PACKING==3200 +diffuseColor.a=opacity; +#endif +#include +#include +#include +#include +#include +float fragCoordZ=0.5*vHighPrecisionZW[0]/vHighPrecisionZW[1]+0.5; +#if DEPTH_PACKING==3200 +gl_FragColor=vec4(vec3(1.0-fragCoordZ),opacity); +#elif DEPTH_PACKING==3201 +gl_FragColor=packDepthToRGBA(fragCoordZ); +#endif +}`,h_=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#ifdef USE_DISPLACEMENTMAP +#include +#include +#include +#endif +#include +#include +#include +#include +#include +#include +#include +vWorldPosition=worldPosition.xyz;}`,f_=`#define DISTANCE +uniform vec3 referencePosition;uniform float nearDistance;uniform float farDistance;varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec4 diffuseColor=vec4(1.0); +#include +#include +#include +#include +float dist=length(vWorldPosition-referencePosition);dist=(dist-nearDistance)/(farDistance-nearDistance);dist=saturate(dist);gl_FragColor=packDepthToRGBA(dist);}`,d_=`varying vec3 vWorldDirection; +#include +void main(){vWorldDirection=transformDirection(position,modelMatrix); +#include +#include +}`,p_=`uniform sampler2D tEquirect;varying vec3 vWorldDirection; +#include +void main(){vec3 direction=normalize(vWorldDirection);vec2 sampleUV=equirectUv(direction);gl_FragColor=texture2D(tEquirect,sampleUV); +#include +#include +}`,m_=`uniform float scale;attribute float lineDistance;varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main(){vLineDistance=scale*lineDistance; +#include +#include +#include +#include +#include +#include +#include +#include +#include +}`,g_=`uniform vec3 diffuse;uniform float opacity;uniform float dashSize;uniform float totalSize;varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +if(mod(vLineDistance,totalSize)>dashSize){discard;}vec3 outgoingLight=vec3(0.0);vec4 diffuseColor=vec4(diffuse,opacity); +#include +#include +#include +outgoingLight=diffuseColor.rgb; +#include +#include +#include +#include +#include +}`,__=`#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#if defined(USE_ENVMAP)||defined(USE_SKINNING) +#include +#include +#include +#include +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +}`,x_=`uniform vec3 diffuse;uniform float opacity; +#ifndef FLAT_SHADED +varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec4 diffuseColor=vec4(diffuse,opacity); +#include +#include +#include +#include +#include +#include +#include +ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0)); +#ifdef USE_LIGHTMAP +vec4 lightMapTexel=texture2D(lightMap,vLightMapUv);reflectedLight.indirectDiffuse+=lightMapTexel.rgb*lightMapIntensity*RECIPROCAL_PI; +#else +reflectedLight.indirectDiffuse+=vec3(1.0); +#endif +#include +reflectedLight.indirectDiffuse*=diffuseColor.rgb;vec3 outgoingLight=reflectedLight.indirectDiffuse; +#include +#include +#include +#include +#include +#include +#include +}`,v_=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vViewPosition=-mvPosition.xyz; +#include +#include +#include +#include +}`,y_=`#define LAMBERT +uniform vec3 diffuse;uniform vec3 emissive;uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vec3 outgoingLight=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+totalEmissiveRadiance; +#include +#include +#include +#include +#include +#include +#include +}`,S_=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vViewPosition=-mvPosition.xyz;}`,M_=`#define MATCAP +uniform vec3 diffuse;uniform float opacity;uniform sampler2D matcap;varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec4 diffuseColor=vec4(diffuse,opacity); +#include +#include +#include +#include +#include +#include +#include +#include +vec3 viewDir=normalize(vViewPosition);vec3 x=normalize(vec3(viewDir.z,0.0,-viewDir.x));vec3 y=cross(viewDir,x);vec2 uv=vec2(dot(x,normal),dot(y,normal))*0.495+0.5; +#ifdef USE_MATCAP +vec4 matcapColor=texture2D(matcap,uv); +#else +vec4 matcapColor=vec4(vec3(mix(0.2,0.8,uv.y)),1.0); +#endif +vec3 outgoingLight=diffuseColor.rgb*matcapColor.rgb; +#include +#include +#include +#include +#include +#include +}`,b_=`#define NORMAL +#if defined(FLAT_SHADED)||defined(USE_BUMPMAP)||defined(USE_NORMALMAP_TANGENTSPACE) +varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(FLAT_SHADED)||defined(USE_BUMPMAP)||defined(USE_NORMALMAP_TANGENTSPACE) +vViewPosition=-mvPosition.xyz; +#endif +}`,w_=`#define NORMAL +uniform float opacity; +#if defined(FLAT_SHADED)||defined(USE_BUMPMAP)||defined(USE_NORMALMAP_TANGENTSPACE) +varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +gl_FragColor=vec4(packNormalToRGB(normal),opacity); +#ifdef OPAQUE +gl_FragColor.a=1.0; +#endif +}`,E_=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vViewPosition=-mvPosition.xyz; +#include +#include +#include +#include +}`,T_=`#define PHONG +uniform vec3 diffuse;uniform vec3 emissive;uniform vec3 specular;uniform float shininess;uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vec3 outgoingLight=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+reflectedLight.directSpecular+reflectedLight.indirectSpecular+totalEmissiveRadiance; +#include +#include +#include +#include +#include +#include +#include +}`,A_=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION +varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vViewPosition=-mvPosition.xyz; +#include +#include +#include +#ifdef USE_TRANSMISSION +vWorldPosition=worldPosition.xyz; +#endif +}`,C_=`#define STANDARD +#ifdef PHYSICAL +#define IOR +#define USE_SPECULAR +#endif +uniform vec3 diffuse;uniform vec3 emissive;uniform float roughness;uniform float metalness;uniform float opacity; +#ifdef IOR +uniform float ior; +#endif +#ifdef USE_SPECULAR +uniform float specularIntensity;uniform vec3 specularColor; +#ifdef USE_SPECULAR_COLORMAP +uniform sampler2D specularColorMap; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP +uniform sampler2D specularIntensityMap; +#endif +#endif +#ifdef USE_CLEARCOAT +uniform float clearcoat;uniform float clearcoatRoughness; +#endif +#ifdef USE_IRIDESCENCE +uniform float iridescence;uniform float iridescenceIOR;uniform float iridescenceThicknessMinimum;uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN +uniform vec3 sheenColor;uniform float sheenRoughness; +#ifdef USE_SHEEN_COLORMAP +uniform sampler2D sheenColorMap; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP +uniform sampler2D sheenRoughnessMap; +#endif +#endif +#ifdef USE_ANISOTROPY +uniform vec2 anisotropyVector; +#ifdef USE_ANISOTROPYMAP +uniform sampler2D anisotropyMap; +#endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vec3 totalDiffuse=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse;vec3 totalSpecular=reflectedLight.directSpecular+reflectedLight.indirectSpecular; +#include +vec3 outgoingLight=totalDiffuse+totalSpecular+totalEmissiveRadiance; +#ifdef USE_SHEEN +float sheenEnergyComp=1.0-0.157*max3(material.sheenColor);outgoingLight=outgoingLight*sheenEnergyComp+sheenSpecular; +#endif +#ifdef USE_CLEARCOAT +float dotNVcc=saturate(dot(geometryClearcoatNormal,geometryViewDir));vec3 Fcc=F_Schlick(material.clearcoatF0,material.clearcoatF90,dotNVcc);outgoingLight=outgoingLight*(1.0-material.clearcoat*Fcc)+clearcoatSpecular*material.clearcoat; +#endif +#include +#include +#include +#include +#include +#include +}`,L_=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vViewPosition=-mvPosition.xyz; +#include +#include +#include +}`,P_=`#define TOON +uniform vec3 diffuse;uniform vec3 emissive;uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec4 diffuseColor=vec4(diffuse,opacity);ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));vec3 totalEmissiveRadiance=emissive; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vec3 outgoingLight=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+totalEmissiveRadiance; +#include +#include +#include +#include +#include +#include +}`,R_=`uniform float size;uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV +varying vec2 vUv;uniform mat3 uvTransform; +#endif +void main(){ +#ifdef USE_POINTS_UV +vUv=(uvTransform*vec3(uv,1)).xy; +#endif +#include +#include +#include +#include +#include +gl_PointSize=size; +#ifdef USE_SIZEATTENUATION +bool isPerspective=isPerspectiveMatrix(projectionMatrix);if(isPerspective)gl_PointSize*=(scale/-mvPosition.z); +#endif +#include +#include +#include +#include +}`,D_=`uniform vec3 diffuse;uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec3 outgoingLight=vec3(0.0);vec4 diffuseColor=vec4(diffuse,opacity); +#include +#include +#include +#include +#include +outgoingLight=diffuseColor.rgb; +#include +#include +#include +#include +#include +}`,I_=`#include +#include +#include +#include +#include +#include +void main(){ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +}`,O_=`uniform vec3 color;uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +gl_FragColor=vec4(color,opacity*(1.0-getShadowMask())); +#include +#include +#include +}`,N_=`uniform float rotation;uniform vec2 center; +#include +#include +#include +#include +#include +void main(){ +#include +vec4 mvPosition=modelViewMatrix*vec4(0.0,0.0,0.0,1.0);vec2 scale;scale.x=length(vec3(modelMatrix[0].x,modelMatrix[0].y,modelMatrix[0].z));scale.y=length(vec3(modelMatrix[1].x,modelMatrix[1].y,modelMatrix[1].z)); +#ifndef USE_SIZEATTENUATION +bool isPerspective=isPerspectiveMatrix(projectionMatrix);if(isPerspective)scale*=-mvPosition.z; +#endif +vec2 alignedPosition=(position.xy-(center-vec2(0.5)))*scale;vec2 rotatedPosition;rotatedPosition.x=cos(rotation)*alignedPosition.x-sin(rotation)*alignedPosition.y;rotatedPosition.y=sin(rotation)*alignedPosition.x+cos(rotation)*alignedPosition.y;mvPosition.xy+=rotatedPosition;gl_Position=projectionMatrix*mvPosition; +#include +#include +#include +}`,U_=`uniform vec3 diffuse;uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main(){ +#include +vec3 outgoingLight=vec3(0.0);vec4 diffuseColor=vec4(diffuse,opacity); +#include +#include +#include +#include +#include +outgoingLight=diffuseColor.rgb; +#include +#include +#include +#include +}`,ze={alphahash_fragment:am,alphahash_pars_fragment:om,alphamap_fragment:lm,alphamap_pars_fragment:cm,alphatest_fragment:um,alphatest_pars_fragment:hm,aomap_fragment:fm,aomap_pars_fragment:dm,begin_vertex:pm,beginnormal_vertex:mm,bsdfs:gm,iridescence_fragment:_m,bumpmap_pars_fragment:xm,clipping_planes_fragment:vm,clipping_planes_pars_fragment:ym,clipping_planes_pars_vertex:Sm,clipping_planes_vertex:Mm,color_fragment:bm,color_pars_fragment:wm,color_pars_vertex:Em,color_vertex:Tm,common:Am,cube_uv_reflection_fragment:Cm,defaultnormal_vertex:Lm,displacementmap_pars_vertex:Pm,displacementmap_vertex:Rm,emissivemap_fragment:Dm,emissivemap_pars_fragment:Im,colorspace_fragment:Om,colorspace_pars_fragment:Nm,envmap_fragment:Um,envmap_common_pars_fragment:Fm,envmap_pars_fragment:km,envmap_pars_vertex:zm,envmap_physical_pars_fragment:Jm,envmap_vertex:Bm,fog_vertex:Vm,fog_pars_vertex:Hm,fog_fragment:Gm,fog_pars_fragment:Wm,gradientmap_pars_fragment:qm,lightmap_fragment:jm,lightmap_pars_fragment:Xm,lights_lambert_fragment:Ym,lights_lambert_pars_fragment:Zm,lights_pars_begin:$m,lights_toon_fragment:Km,lights_toon_pars_fragment:Qm,lights_phong_fragment:eg,lights_phong_pars_fragment:tg,lights_physical_fragment:ig,lights_physical_pars_fragment:ng,lights_fragment_begin:rg,lights_fragment_maps:sg,lights_fragment_end:ag,logdepthbuf_fragment:og,logdepthbuf_pars_fragment:lg,logdepthbuf_pars_vertex:cg,logdepthbuf_vertex:ug,map_fragment:hg,map_pars_fragment:fg,map_particle_fragment:dg,map_particle_pars_fragment:pg,metalnessmap_fragment:mg,metalnessmap_pars_fragment:gg,morphcolor_vertex:_g,morphnormal_vertex:xg,morphtarget_pars_vertex:vg,morphtarget_vertex:yg,normal_fragment_begin:Sg,normal_fragment_maps:Mg,normal_pars_fragment:bg,normal_pars_vertex:wg,normal_vertex:Eg,normalmap_pars_fragment:Tg,clearcoat_normal_fragment_begin:Ag,clearcoat_normal_fragment_maps:Cg,clearcoat_pars_fragment:Lg,iridescence_pars_fragment:Pg,opaque_fragment:Rg,packing:Dg,premultiplied_alpha_fragment:Ig,project_vertex:Og,dithering_fragment:Ng,dithering_pars_fragment:Ug,roughnessmap_fragment:Fg,roughnessmap_pars_fragment:kg,shadowmap_pars_fragment:zg,shadowmap_pars_vertex:Bg,shadowmap_vertex:Vg,shadowmask_pars_fragment:Hg,skinbase_vertex:Gg,skinning_pars_vertex:Wg,skinning_vertex:qg,skinnormal_vertex:jg,specularmap_fragment:Xg,specularmap_pars_fragment:Yg,tonemapping_fragment:Zg,tonemapping_pars_fragment:$g,transmission_fragment:Jg,transmission_pars_fragment:Kg,uv_pars_fragment:Qg,uv_pars_vertex:e_,uv_vertex:t_,worldpos_vertex:i_,background_vert:n_,background_frag:r_,backgroundCube_vert:s_,backgroundCube_frag:a_,cube_vert:o_,cube_frag:l_,depth_vert:c_,depth_frag:u_,distanceRGBA_vert:h_,distanceRGBA_frag:f_,equirect_vert:d_,equirect_frag:p_,linedashed_vert:m_,linedashed_frag:g_,meshbasic_vert:__,meshbasic_frag:x_,meshlambert_vert:v_,meshlambert_frag:y_,meshmatcap_vert:S_,meshmatcap_frag:M_,meshnormal_vert:b_,meshnormal_frag:w_,meshphong_vert:E_,meshphong_frag:T_,meshphysical_vert:A_,meshphysical_frag:C_,meshtoon_vert:L_,meshtoon_frag:P_,points_vert:R_,points_frag:D_,shadow_vert:I_,shadow_frag:O_,sprite_vert:N_,sprite_frag:U_},le={common:{diffuse:{value:new Ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ve},alphaMap:{value:null},alphaMapTransform:{value:new Ve},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ve}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ve}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ve}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ve},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ve},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ve},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ve}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ve}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ve}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ze(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ve},alphaTest:{value:0},uvTransform:{value:new Ve}},sprite:{diffuse:{value:new Ze(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ve},alphaMap:{value:null},alphaMapTransform:{value:new Ve},alphaTest:{value:0}}},ai={basic:{uniforms:Lt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:ze.meshbasic_vert,fragmentShader:ze.meshbasic_frag},lambert:{uniforms:Lt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new Ze(0)}}]),vertexShader:ze.meshlambert_vert,fragmentShader:ze.meshlambert_frag},phong:{uniforms:Lt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new Ze(0)},specular:{value:new Ze(1118481)},shininess:{value:30}}]),vertexShader:ze.meshphong_vert,fragmentShader:ze.meshphong_frag},standard:{uniforms:Lt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new Ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag},toon:{uniforms:Lt([le.common,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new Ze(0)}}]),vertexShader:ze.meshtoon_vert,fragmentShader:ze.meshtoon_frag},matcap:{uniforms:Lt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:ze.meshmatcap_vert,fragmentShader:ze.meshmatcap_frag},points:{uniforms:Lt([le.points,le.fog]),vertexShader:ze.points_vert,fragmentShader:ze.points_frag},dashed:{uniforms:Lt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ze.linedashed_vert,fragmentShader:ze.linedashed_frag},depth:{uniforms:Lt([le.common,le.displacementmap]),vertexShader:ze.depth_vert,fragmentShader:ze.depth_frag},normal:{uniforms:Lt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:ze.meshnormal_vert,fragmentShader:ze.meshnormal_frag},sprite:{uniforms:Lt([le.sprite,le.fog]),vertexShader:ze.sprite_vert,fragmentShader:ze.sprite_frag},background:{uniforms:{uvTransform:{value:new Ve},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ze.background_vert,fragmentShader:ze.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ze.backgroundCube_vert,fragmentShader:ze.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ze.cube_vert,fragmentShader:ze.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ze.equirect_vert,fragmentShader:ze.equirect_frag},distanceRGBA:{uniforms:Lt([le.common,le.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ze.distanceRGBA_vert,fragmentShader:ze.distanceRGBA_frag},shadow:{uniforms:Lt([le.lights,le.fog,{color:{value:new Ze(0)},opacity:{value:1}}]),vertexShader:ze.shadow_vert,fragmentShader:ze.shadow_frag}};ai.physical={uniforms:Lt([ai.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ve},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ve},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ve},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ve},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ve},sheen:{value:0},sheenColor:{value:new Ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ve},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ve},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ve},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ve},attenuationDistance:{value:0},attenuationColor:{value:new Ze(0)},specularColor:{value:new Ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ve},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ve},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ve}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag};const Kr={r:0,b:0,g:0};function F_(n,e,t,i,r,s,a){const o=new Ze(0);let l=s===!0?0:1,c,u,h=null,d=0,m=null;function g(p,f){let b=!1,x=f.isScene===!0?f.background:null;x&&x.isTexture&&(x=(f.backgroundBlurriness>0?t:e).get(x)),x===null?_(o,l):x&&x.isColor&&(_(x,1),b=!0);const C=n.xr.getEnvironmentBlendMode();C==="additive"?i.buffers.color.setClear(0,0,0,1,a):C==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,a),(n.autoClear||b)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),x&&(x.isCubeTexture||x.mapping===Ps)?(u===void 0&&(u=new yi(new Mr(1,1,1),new rn({name:"BackgroundCubeMaterial",uniforms:Vn(ai.backgroundCube.uniforms),vertexShader:ai.backgroundCube.vertexShader,fragmentShader:ai.backgroundCube.fragmentShader,side:Ot,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(E,P,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,u.material.toneMapped=$e.getTransfer(x.colorSpace)!==et,(h!==x||d!==x.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,h=x,d=x.version,m=n.toneMapping),u.layers.enableAll(),p.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new yi(new _o(2,2),new rn({name:"BackgroundMaterial",uniforms:Vn(ai.background.uniforms),vertexShader:ai.background.vertexShader,fragmentShader:ai.background.fragmentShader,side:Bi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,c.material.toneMapped=$e.getTransfer(x.colorSpace)!==et,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(h!==x||d!==x.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,h=x,d=x.version,m=n.toneMapping),c.layers.enableAll(),p.unshift(c,c.geometry,c.material,0,0,null))}function _(p,f){p.getRGB(Kr,Bu(n)),i.buffers.color.setClear(Kr.r,Kr.g,Kr.b,f,a)}return{getClearColor:function(){return o},setClearColor:function(p,f=1){o.set(p),l=f,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(p){l=p,_(o,l)},render:g}}function k_(n,e,t,i){const r=n.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||s!==null,o={},l=p(null);let c=l,u=!1;function h(D,k,Y,G,ie){let q=!1;if(a){const K=_(G,Y,k);c!==K&&(c=K,m(c.object)),q=f(D,G,Y,ie),q&&b(D,G,Y,ie)}else{const K=k.wireframe===!0;(c.geometry!==G.id||c.program!==Y.id||c.wireframe!==K)&&(c.geometry=G.id,c.program=Y.id,c.wireframe=K,q=!0)}ie!==null&&t.update(ie,34963),(q||u)&&(u=!1,F(D,k,Y,G),ie!==null&&n.bindBuffer(34963,t.get(ie).buffer))}function d(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(D){return i.isWebGL2?n.bindVertexArray(D):s.bindVertexArrayOES(D)}function g(D){return i.isWebGL2?n.deleteVertexArray(D):s.deleteVertexArrayOES(D)}function _(D,k,Y){const G=Y.wireframe===!0;let ie=o[D.id];ie===void 0&&(ie={},o[D.id]=ie);let q=ie[k.id];q===void 0&&(q={},ie[k.id]=q);let K=q[G];return K===void 0&&(K=p(d()),q[G]=K),K}function p(D){const k=[],Y=[],G=[];for(let ie=0;ie=0){const de=ie[W];let pe=q[W];if(pe===void 0&&(W==="instanceMatrix"&&D.instanceMatrix&&(pe=D.instanceMatrix),W==="instanceColor"&&D.instanceColor&&(pe=D.instanceColor)),de===void 0||de.attribute!==pe||pe&&de.data!==pe.data)return!0;K++}return c.attributesNum!==K||c.index!==G}function b(D,k,Y,G){const ie={},q=k.attributes;let K=0;const I=Y.getAttributes();for(const W in I)if(I[W].location>=0){let de=q[W];de===void 0&&(W==="instanceMatrix"&&D.instanceMatrix&&(de=D.instanceMatrix),W==="instanceColor"&&D.instanceColor&&(de=D.instanceColor));const pe={};pe.attribute=de,de&&de.data&&(pe.data=de.data),ie[W]=pe,K++}c.attributes=ie,c.attributesNum=K,c.index=G}function x(){const D=c.newAttributes;for(let k=0,Y=D.length;k=0){let he=ie[I];if(he===void 0&&(I==="instanceMatrix"&&D.instanceMatrix&&(he=D.instanceMatrix),I==="instanceColor"&&D.instanceColor&&(he=D.instanceColor)),he!==void 0){const de=he.normalized,pe=he.itemSize,we=t.get(he);if(we===void 0)continue;const Re=we.buffer,Se=we.type,qe=we.bytesPerElement,vt=i.isWebGL2===!0&&(Se===5124||Se===5125||he.gpuType===Tu);if(he.isInterleavedBufferAttribute){const Fe=he.data,$=Fe.stride,ft=he.offset;if(Fe.isInstancedInterleavedBuffer){for(let Me=0;Me0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(34930),d=n.getParameter(35660),m=n.getParameter(3379),g=n.getParameter(34076),_=n.getParameter(34921),p=n.getParameter(36347),f=n.getParameter(36348),b=n.getParameter(36349),x=d>0,C=a||e.has("OES_texture_float"),E=x&&C,P=a?n.getParameter(36183):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:m,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:b,vertexTextures:x,floatFragmentTextures:C,floatVertexTextures:E,maxSamples:P}}function V_(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Di,o=new Ve,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const m=h.length!==0||d||i!==0||r;return r=d,i=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,m){const g=h.clippingPlanes,_=h.clipIntersection,p=h.clipShadows,f=n.get(h);if(!r||g===null||g.length===0||s&&!p)s?u(null):c();else{const b=s?0:i,x=b*4;let C=f.clippingState||null;l.value=C,C=u(g,d,x,m);for(let E=0;E!==x;++E)C[E]=t[E];f.clippingState=C,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,m,g){const _=h!==null?h.length:0;let p=null;if(_!==0){if(p=l.value,g!==!0||p===null){const f=m+_*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(p===null||p.length +#include +}`,fragmentShader:`uniform sampler2D tEquirect;varying vec3 vWorldDirection; +#include +void main(){vec3 direction=normalize(vWorldDirection);vec2 sampleUV=equirectUv(direction);gl_FragColor=texture2D(tEquirect,sampleUV);}`},r=new Mr(5,5,5),s=new rn({name:"CubemapFromEquirect",uniforms:Vn(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ot,blending:Fi});s.uniforms.tEquirect.value=t;const a=new yi(r,s),o=t.minFilter;return t.minFilter===dr&&(t.minFilter=Gt),new G_(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}function q_(n){let e=new WeakMap;function t(a,o){return o===Va?a.mapping=kn:o===Ha&&(a.mapping=zn),a}function i(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){const o=a.mapping;if(o===Va||o===Ha)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new W_(l.height/2);return c.fromEquirectangularTexture(n,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class j_ extends ku{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Rn=4,Jl=[.125,.215,.35,.446,.526,.582],$i=20,ya=new j_,Kl=new Ze;let Sa=null;const Zi=(1+Math.sqrt(5))/2,Tn=1/Zi,Ql=[new R(1,1,1),new R(-1,1,1),new R(1,1,-1),new R(-1,1,-1),new R(0,Zi,Tn),new R(0,Zi,-Tn),new R(Tn,0,Zi),new R(-Tn,0,Zi),new R(Zi,Tn,0),new R(-Zi,Tn,0)];class ec{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){Sa=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=nc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ic(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?x:0,x,x),u.setRenderTarget(r),_&&u.render(g,o),u.render(e,o)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=p}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===kn||e.mapping===zn;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=nc()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ic());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new yi(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Qr(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,ya)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r$i&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${$i}`);const f=[];let b=0;for(let T=0;T<$i;++T){const F=T/_,y=Math.exp(-F*F/2);f.push(y),T===0?b+=y:Tx-Rn?r-x+Rn:0),P=4*(this._cubeSize-C);Qr(t,E,P,3*C,2*C),l.setRenderTarget(t),l.render(h,ya)}}function X_(n){const e=[],t=[],i=[];let r=n;const s=n-Rn+1+Jl.length;for(let a=0;an-Rn?l=Jl[a-n+Rn-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],m=6,g=6,_=3,p=2,f=1,b=new Float32Array(_*g*m),x=new Float32Array(p*g*m),C=new Float32Array(f*g*m);for(let P=0;P2?0:-1,y=[T,F,0,T+2/3,F,0,T+2/3,F+1,0,T,F,0,T+2/3,F+1,0,T,F+1,0];b.set(y,_*g*P),x.set(d,p*g*P);const w=[P,P,P,P,P,P];C.set(w,f*g*P)}const E=new Zt;E.setAttribute("position",new li(b,_)),E.setAttribute("uv",new li(x,p)),E.setAttribute("faceIndex",new li(C,f)),e.push(E),r>Rn&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function tc(n,e,t){const i=new sn(n,e,t);return i.texture.mapping=Ps,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Qr(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function Y_(n,e,t){const i=new Float32Array($i),r=new R(0,1,0);return new rn({name:"SphericalGaussianBlur",defines:{n:$i,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:xo(),fragmentShader:`precision mediump float;precision mediump int;varying vec3 vOutputDirection;uniform sampler2D envMap;uniform int samples;uniform float weights[n];uniform bool latitudinal;uniform float dTheta;uniform float mipInt;uniform vec3 poleAxis; +#define ENVMAP_TYPE_CUBE_UV +#include +vec3 getSample(float theta,vec3 axis){float cosTheta=cos(theta);vec3 sampleDirection=vOutputDirection*cosTheta+cross(axis,vOutputDirection)*sin(theta)+axis*dot(axis,vOutputDirection)*(1.0-cosTheta);return bilinearCubeUV(envMap,sampleDirection,mipInt);}void main(){vec3 axis=latitudinal?poleAxis:cross(poleAxis,vOutputDirection);if(all(equal(axis,vec3(0.0)))){axis=vec3(vOutputDirection.z,0.0,-vOutputDirection.x);}axis=normalize(axis);gl_FragColor=vec4(0.0,0.0,0.0,1.0);gl_FragColor.rgb+=weights[0]*getSample(0.0,axis);for(int i=1;i=samples){break;}float theta=dTheta*float(i);gl_FragColor.rgb+=weights[i]*getSample(-1.0*theta,axis);gl_FragColor.rgb+=weights[i]*getSample(theta,axis);}}`,blending:Fi,depthTest:!1,depthWrite:!1})}function ic(){return new rn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:xo(),fragmentShader:`precision mediump float;precision mediump int;varying vec3 vOutputDirection;uniform sampler2D envMap; +#include +void main(){vec3 outputDirection=normalize(vOutputDirection);vec2 uv=equirectUv(outputDirection);gl_FragColor=vec4(texture2D(envMap,uv).rgb,1.0);}`,blending:Fi,depthTest:!1,depthWrite:!1})}function nc(){return new rn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:xo(),fragmentShader:"precision mediump float;precision mediump int;uniform float flipEnvMap;varying vec3 vOutputDirection;uniform samplerCube envMap;void main(){gl_FragColor=textureCube(envMap,vec3(flipEnvMap*vOutputDirection.x,vOutputDirection.yz));}",blending:Fi,depthTest:!1,depthWrite:!1})}function xo(){return"precision mediump float;precision mediump int;attribute float faceIndex;varying vec3 vOutputDirection;vec3 getDirection(vec2 uv,float face){uv=2.0*uv-1.0;vec3 direction=vec3(uv,1.0);if(face==0.0){direction=direction.zyx;}else if(face==1.0){direction=direction.xzy;direction.xz*=-1.0;}else if(face==2.0){direction.x*=-1.0;}else if(face==3.0){direction=direction.zyx;direction.xz*=-1.0;}else if(face==4.0){direction=direction.xzy;direction.xy*=-1.0;}else if(face==5.0){direction.z*=-1.0;}return direction;}void main(){vOutputDirection=getDirection(uv,faceIndex);gl_Position=vec4(position,1.0);}"}function Z_(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===Va||l===Ha,u=l===kn||l===zn;if(c||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let h=e.get(o);return t===null&&(t=new ec(n)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),e.set(o,h),h.texture}else{if(e.has(o))return e.get(o).texture;{const h=o.image;if(c&&h&&h.height>0||u&&h&&r(h)){t===null&&(t=new ec(n));const d=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,d),o.addEventListener("dispose",s),d.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(w=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const z=new Float32Array(y*w*4*g),j=new ju(z,y,w,g);j.type=Ui,j.needsUpdate=!0;const J=F*4;for(let k=0;k0)return n;const r=e*t;let s=rc[r];if(s===void 0&&(s=new Float32Array(r),rc[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function mt(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${o}: ${t[a]}`)}return i.join(` +`)}function J0(n){const e=$e.getPrimaries($e.workingColorSpace),t=$e.getPrimaries(n);let i;switch(e===t?i="":e===vs&&t===xs?i="LinearDisplayP3ToLinearSRGB":e===xs&&t===vs&&(i="LinearSRGBToLinearDisplayP3"),n){case Mi:case Rs:return[i,"LinearTransferOETF"];case yt:case ho:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function hc(n,e,t){const i=n.getShaderParameter(e,35713),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+$0(n.getShaderSource(e),a)}else return r}function K0(n,e){const t=J0(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Q0(n,e){let t;switch(e){case np:t="Linear";break;case rp:t="Reinhard";break;case sp:t="OptimizedCineon";break;case ap:t="ACESFilmic";break;case op:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function ex(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(sr).join(` +`)}function tx(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function ix(n,e){const t={},i=n.getProgramParameter(e,35721);for(let r=0;r/gm;function Xa(n){return n.replace(nx,sx)}const rx=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function sx(n,e){let t=ze[e];if(t===void 0){const i=rx.get(e);if(i!==void 0)t=ze[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Xa(t)}const ax=/#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 pc(n){return n.replace(ax,ox)}function ox(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(p+=` +`),f=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(sr).join(` +`),f.length>0&&(f+=` +`)):(p=[mc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(sr).join(` +`),f=[m,mc(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ki?"#define TONE_MAPPING":"",t.toneMapping!==ki?ze.tonemapping_pars_fragment:"",t.toneMapping!==ki?Q0("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ze.colorspace_pars_fragment,K0("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(sr).join(` +`)),a=Xa(a),a=fc(a,t),a=dc(a,t),o=Xa(o),o=fc(o,t),o=dc(o,t),a=pc(a),o=pc(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(b=`#version 300 es +`,p=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+p,f=["#define varying in",t.glslVersion===El?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===El?"":"#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(` +`)+` +`+f);const x=b+p+a,C=b+f+o,E=uc(r,35633,x),P=uc(r,35632,C);if(r.attachShader(_,E),r.attachShader(_,P),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_),n.debug.checkShaderErrors){const y=r.getProgramInfoLog(_).trim(),w=r.getShaderInfoLog(E).trim(),z=r.getShaderInfoLog(P).trim();let j=!0,J=!0;if(r.getProgramParameter(_,35714)===!1)if(j=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,_,E,P);else{const D=hc(r,E,"vertex"),k=hc(r,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,35715)+` + +Program Info Log: `+y+` +`+D+` +`+k)}else y!==""?console.warn("THREE.WebGLProgram: Program Info Log:",y):(w===""||z==="")&&(J=!1);J&&(this.diagnostics={runnable:j,programLog:y,vertexShader:{log:w,prefix:p},fragmentShader:{log:z,prefix:f}})}r.deleteShader(E),r.deleteShader(P);let T;this.getUniforms=function(){return T===void 0&&(T=new fs(r,_)),T};let F;return this.getAttributes=function(){return F===void 0&&(F=ix(r,_)),F},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Z0++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=E,this.fragmentShader=P,this}let px=0;class mx{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new gx(e),t.set(e,i)),i}}class gx{constructor(e){this.id=px++,this.code=e,this.usedTimes=0}}function _x(n,e,t,i,r,s,a){const o=new po,l=new mx,c=[],u=r.isWebGL2,h=r.logarithmicDepthBuffer,d=r.vertexTextures;let m=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(y){return y===0?"uv":`uv${y}`}function p(y,w,z,j,J){const D=j.fog,k=J.geometry,Y=y.isMeshStandardMaterial?j.environment:null,G=(y.isMeshStandardMaterial?t:e).get(y.envMap||Y),ie=G&&G.mapping===Ps?G.image.height:null,q=g[y.type];y.precision!==null&&(m=r.getMaxPrecision(y.precision),m!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",m,"instead."));const K=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,I=K!==void 0?K.length:0;let W=0;k.morphAttributes.position!==void 0&&(W=1),k.morphAttributes.normal!==void 0&&(W=2),k.morphAttributes.color!==void 0&&(W=3);let he,de,pe,we;if(q){const Qe=ai[q];he=Qe.vertexShader,de=Qe.fragmentShader}else he=y.vertexShader,de=y.fragmentShader,l.update(y),pe=l.getVertexShaderID(y),we=l.getFragmentShaderID(y);const Re=n.getRenderTarget(),Se=J.isInstancedMesh===!0,qe=!!y.map,vt=!!y.matcap,Fe=!!G,$=!!y.aoMap,ft=!!y.lightMap,Me=!!y.bumpMap,Ie=!!y.normalMap,Ce=!!y.displacementMap,Ke=!!y.emissiveMap,Be=!!y.metalnessMap,Ne=!!y.roughnessMap,je=y.anisotropy>0,dt=y.clearcoat>0,_t=y.iridescence>0,M=y.sheen>0,v=y.transmission>0,U=je&&!!y.anisotropyMap,ee=dt&&!!y.clearcoatMap,Q=dt&&!!y.clearcoatNormalMap,te=dt&&!!y.clearcoatRoughnessMap,xe=_t&&!!y.iridescenceMap,se=_t&&!!y.iridescenceThicknessMap,fe=M&&!!y.sheenColorMap,L=M&&!!y.sheenRoughnessMap,ne=!!y.specularMap,X=!!y.specularColorMap,Ee=!!y.specularIntensityMap,ve=v&&!!y.transmissionMap,ye=v&&!!y.thicknessMap,_e=!!y.gradientMap,A=!!y.alphaMap,ae=y.alphaTest>0,re=!!y.alphaHash,ce=!!y.extensions,oe=!!k.attributes.uv1,Z=!!k.attributes.uv2,ge=!!k.attributes.uv3;let Te=ki;return y.toneMapped&&(Re===null||Re.isXRRenderTarget===!0)&&(Te=n.toneMapping),{isWebGL2:u,shaderID:q,shaderType:y.type,shaderName:y.name,vertexShader:he,fragmentShader:de,defines:y.defines,customVertexShaderID:pe,customFragmentShaderID:we,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:m,instancing:Se,instancingColor:Se&&J.instanceColor!==null,supportsVertexTextures:d,outputColorSpace:Re===null?n.outputColorSpace:Re.isXRRenderTarget===!0?Re.texture.colorSpace:Mi,map:qe,matcap:vt,envMap:Fe,envMapMode:Fe&&G.mapping,envMapCubeUVHeight:ie,aoMap:$,lightMap:ft,bumpMap:Me,normalMap:Ie,displacementMap:d&&Ce,emissiveMap:Ke,normalMapObjectSpace:Ie&&y.normalMapType===yp,normalMapTangentSpace:Ie&&y.normalMapType===Iu,metalnessMap:Be,roughnessMap:Ne,anisotropy:je,anisotropyMap:U,clearcoat:dt,clearcoatMap:ee,clearcoatNormalMap:Q,clearcoatRoughnessMap:te,iridescence:_t,iridescenceMap:xe,iridescenceThicknessMap:se,sheen:M,sheenColorMap:fe,sheenRoughnessMap:L,specularMap:ne,specularColorMap:X,specularIntensityMap:Ee,transmission:v,transmissionMap:ve,thicknessMap:ye,gradientMap:_e,opaque:y.transparent===!1&&y.blending===In,alphaMap:A,alphaTest:ae,alphaHash:re,combine:y.combine,mapUv:qe&&_(y.map.channel),aoMapUv:$&&_(y.aoMap.channel),lightMapUv:ft&&_(y.lightMap.channel),bumpMapUv:Me&&_(y.bumpMap.channel),normalMapUv:Ie&&_(y.normalMap.channel),displacementMapUv:Ce&&_(y.displacementMap.channel),emissiveMapUv:Ke&&_(y.emissiveMap.channel),metalnessMapUv:Be&&_(y.metalnessMap.channel),roughnessMapUv:Ne&&_(y.roughnessMap.channel),anisotropyMapUv:U&&_(y.anisotropyMap.channel),clearcoatMapUv:ee&&_(y.clearcoatMap.channel),clearcoatNormalMapUv:Q&&_(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&_(y.clearcoatRoughnessMap.channel),iridescenceMapUv:xe&&_(y.iridescenceMap.channel),iridescenceThicknessMapUv:se&&_(y.iridescenceThicknessMap.channel),sheenColorMapUv:fe&&_(y.sheenColorMap.channel),sheenRoughnessMapUv:L&&_(y.sheenRoughnessMap.channel),specularMapUv:ne&&_(y.specularMap.channel),specularColorMapUv:X&&_(y.specularColorMap.channel),specularIntensityMapUv:Ee&&_(y.specularIntensityMap.channel),transmissionMapUv:ve&&_(y.transmissionMap.channel),thicknessMapUv:ye&&_(y.thicknessMap.channel),alphaMapUv:A&&_(y.alphaMap.channel),vertexTangents:!!k.attributes.tangent&&(Ie||je),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,vertexUv1s:oe,vertexUv2s:Z,vertexUv3s:ge,pointsUvs:J.isPoints===!0&&!!k.attributes.uv&&(qe||A),fog:!!D,useFog:y.fog===!0,fogExp2:D&&D.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:J.isSkinnedMesh===!0,morphTargets:k.morphAttributes.position!==void 0,morphNormals:k.morphAttributes.normal!==void 0,morphColors:k.morphAttributes.color!==void 0,morphTargetsCount:I,morphTextureStride:W,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:y.dithering,shadowMapEnabled:n.shadowMap.enabled&&z.length>0,shadowMapType:n.shadowMap.type,toneMapping:Te,useLegacyLights:n._useLegacyLights,decodeVideoTexture:qe&&y.map.isVideoTexture===!0&&$e.getTransfer(y.map.colorSpace)===et,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===xi,flipSided:y.side===Ot,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionDerivatives:ce&&y.extensions.derivatives===!0,extensionFragDepth:ce&&y.extensions.fragDepth===!0,extensionDrawBuffers:ce&&y.extensions.drawBuffers===!0,extensionShaderTextureLOD:ce&&y.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:y.customProgramCacheKey()}}function f(y){const w=[];if(y.shaderID?w.push(y.shaderID):(w.push(y.customVertexShaderID),w.push(y.customFragmentShaderID)),y.defines!==void 0)for(const z in y.defines)w.push(z),w.push(y.defines[z]);return y.isRawShaderMaterial===!1&&(b(w,y),x(w,y),w.push(n.outputColorSpace)),w.push(y.customProgramCacheKey),w.join()}function b(y,w){y.push(w.precision),y.push(w.outputColorSpace),y.push(w.envMapMode),y.push(w.envMapCubeUVHeight),y.push(w.mapUv),y.push(w.alphaMapUv),y.push(w.lightMapUv),y.push(w.aoMapUv),y.push(w.bumpMapUv),y.push(w.normalMapUv),y.push(w.displacementMapUv),y.push(w.emissiveMapUv),y.push(w.metalnessMapUv),y.push(w.roughnessMapUv),y.push(w.anisotropyMapUv),y.push(w.clearcoatMapUv),y.push(w.clearcoatNormalMapUv),y.push(w.clearcoatRoughnessMapUv),y.push(w.iridescenceMapUv),y.push(w.iridescenceThicknessMapUv),y.push(w.sheenColorMapUv),y.push(w.sheenRoughnessMapUv),y.push(w.specularMapUv),y.push(w.specularColorMapUv),y.push(w.specularIntensityMapUv),y.push(w.transmissionMapUv),y.push(w.thicknessMapUv),y.push(w.combine),y.push(w.fogExp2),y.push(w.sizeAttenuation),y.push(w.morphTargetsCount),y.push(w.morphAttributeCount),y.push(w.numDirLights),y.push(w.numPointLights),y.push(w.numSpotLights),y.push(w.numSpotLightMaps),y.push(w.numHemiLights),y.push(w.numRectAreaLights),y.push(w.numDirLightShadows),y.push(w.numPointLightShadows),y.push(w.numSpotLightShadows),y.push(w.numSpotLightShadowsWithMaps),y.push(w.numLightProbes),y.push(w.shadowMapType),y.push(w.toneMapping),y.push(w.numClippingPlanes),y.push(w.numClipIntersection),y.push(w.depthPacking)}function x(y,w){o.disableAll(),w.isWebGL2&&o.enable(0),w.supportsVertexTextures&&o.enable(1),w.instancing&&o.enable(2),w.instancingColor&&o.enable(3),w.matcap&&o.enable(4),w.envMap&&o.enable(5),w.normalMapObjectSpace&&o.enable(6),w.normalMapTangentSpace&&o.enable(7),w.clearcoat&&o.enable(8),w.iridescence&&o.enable(9),w.alphaTest&&o.enable(10),w.vertexColors&&o.enable(11),w.vertexAlphas&&o.enable(12),w.vertexUv1s&&o.enable(13),w.vertexUv2s&&o.enable(14),w.vertexUv3s&&o.enable(15),w.vertexTangents&&o.enable(16),w.anisotropy&&o.enable(17),y.push(o.mask),o.disableAll(),w.fog&&o.enable(0),w.useFog&&o.enable(1),w.flatShading&&o.enable(2),w.logarithmicDepthBuffer&&o.enable(3),w.skinning&&o.enable(4),w.morphTargets&&o.enable(5),w.morphNormals&&o.enable(6),w.morphColors&&o.enable(7),w.premultipliedAlpha&&o.enable(8),w.shadowMapEnabled&&o.enable(9),w.useLegacyLights&&o.enable(10),w.doubleSided&&o.enable(11),w.flipSided&&o.enable(12),w.useDepthPacking&&o.enable(13),w.dithering&&o.enable(14),w.transmission&&o.enable(15),w.sheen&&o.enable(16),w.opaque&&o.enable(17),w.pointsUvs&&o.enable(18),w.decodeVideoTexture&&o.enable(19),y.push(o.mask)}function C(y){const w=g[y.type];let z;if(w){const j=ai[w];z=Qp.clone(j.uniforms)}else z=y.uniforms;return z}function E(y,w){let z;for(let j=0,J=c.length;j0?i.push(f):m.transparent===!0?r.push(f):t.push(f)}function l(h,d,m,g,_,p){const f=a(h,d,m,g,_,p);m.transmission>0?i.unshift(f):m.transparent===!0?r.unshift(f):t.unshift(f)}function c(h,d){t.length>1&&t.sort(h||vx),i.length>1&&i.sort(d||gc),r.length>1&&r.sort(d||gc)}function u(){for(let h=e,d=n.length;h=s.length?(a=new _c,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function Sx(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new Ze};break;case"SpotLight":t={position:new R,direction:new R,color:new Ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new Ze,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new Ze,groundColor:new Ze};break;case"RectAreaLight":t={color:new Ze,position:new R,halfWidth:new R,halfHeight:new R};break}return n[e.id]=t,t}}}function Mx(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let bx=0;function wx(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Ex(n,e){const t=new Sx,i=Mx(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)r.probe.push(new R);const s=new R,a=new rt,o=new rt;function l(u,h){let d=0,m=0,g=0;for(let j=0;j<9;j++)r.probe[j].set(0,0,0);let _=0,p=0,f=0,b=0,x=0,C=0,E=0,P=0,T=0,F=0,y=0;u.sort(wx);const w=h===!0?Math.PI:1;for(let j=0,J=u.length;j0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=le.LTC_FLOAT_1,r.rectAreaLTC2=le.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=le.LTC_HALF_1,r.rectAreaLTC2=le.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=d,r.ambient[1]=m,r.ambient[2]=g;const z=r.hash;(z.directionalLength!==_||z.pointLength!==p||z.spotLength!==f||z.rectAreaLength!==b||z.hemiLength!==x||z.numDirectionalShadows!==C||z.numPointShadows!==E||z.numSpotShadows!==P||z.numSpotMaps!==T||z.numLightProbes!==y)&&(r.directional.length=_,r.spot.length=f,r.rectArea.length=b,r.point.length=p,r.hemi.length=x,r.directionalShadow.length=C,r.directionalShadowMap.length=C,r.pointShadow.length=E,r.pointShadowMap.length=E,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=C,r.pointShadowMatrix.length=E,r.spotLightMatrix.length=P+T-F,r.spotLightMap.length=T,r.numSpotLightShadowsWithMaps=F,r.numLightProbes=y,z.directionalLength=_,z.pointLength=p,z.spotLength=f,z.rectAreaLength=b,z.hemiLength=x,z.numDirectionalShadows=C,z.numPointShadows=E,z.numSpotShadows=P,z.numSpotMaps=T,z.numLightProbes=y,r.version=bx++)}function c(u,h){let d=0,m=0,g=0,_=0,p=0;const f=h.matrixWorldInverse;for(let b=0,x=u.length;b=o.length?(l=new xc(n,e),o.push(l)):l=o[a],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class Ax extends on{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xp,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Cx extends on{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Lx="void main(){gl_Position=vec4(position,1.0);}",Px=`uniform sampler2D shadow_pass;uniform vec2 resolution;uniform float radius; +#include +void main(){const float samples=float(VSM_SAMPLES);float mean=0.0;float squared_mean=0.0;float uvStride=samples<=1.0?0.0:2.0/(samples-1.0);float uvStart=samples<=1.0?0.0:-1.0;for(float i=0.0;iu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ie.x),r.x=s.x*ie.x,G.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ie.y),r.y=s.y*ie.y,G.mapSize.y=s.y)),G.map===null||j===!0||J===!0){const K=this.type!==_i?{minFilter:Pt,magFilter:Pt}:{};G.map!==null&&G.map.dispose(),G.map=new sn(r.x,r.y,K),G.map.texture.name=Y.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();const q=G.getViewportCount();for(let K=0;K0||P.map&&P.alphaTest>0){const z=y.uuid,j=P.uuid;let J=c[z];J===void 0&&(J={},c[z]=J);let D=J[j];D===void 0&&(D=y.clone(),J[j]=D),y=D}if(y.visible=P.visible,y.wireframe=P.wireframe,F===_i?y.side=P.shadowSide!==null?P.shadowSide:P.side:y.side=P.shadowSide!==null?P.shadowSide:h[P.side],y.alphaMap=P.alphaMap,y.alphaTest=P.alphaTest,y.map=P.map,y.clipShadows=P.clipShadows,y.clippingPlanes=P.clippingPlanes,y.clipIntersection=P.clipIntersection,y.displacementMap=P.displacementMap,y.displacementScale=P.displacementScale,y.displacementBias=P.displacementBias,y.wireframeLinewidth=P.wireframeLinewidth,y.linewidth=P.linewidth,T.isPointLight===!0&&y.isMeshDistanceMaterial===!0){const z=n.properties.get(y);z.light=T}return y}function C(E,P,T,F,y){if(E.visible===!1)return;if(E.layers.test(P.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&y===_i)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,E.matrixWorld);const j=e.update(E),J=E.material;if(Array.isArray(J)){const D=j.groups;for(let k=0,Y=D.length;k=1):ie.indexOf("OpenGL ES")!==-1&&(G=parseFloat(/^OpenGL ES (\d)/.exec(ie)[1]),Y=G>=2);let q=null,K={};const I=n.getParameter(3088),W=n.getParameter(2978),he=new tt().fromArray(I),de=new tt().fromArray(W);function pe(A,ae,re,ce){const oe=new Uint8Array(4),Z=n.createTexture();n.bindTexture(A,Z),n.texParameteri(A,10241,9728),n.texParameteri(A,10240,9728);for(let ge=0;ge"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let _;const p=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(M,v){return f?new OffscreenCanvas(M,v):mr("canvas")}function x(M,v,U,ee){let Q=1;if((M.width>ee||M.height>ee)&&(Q=ee/Math.max(M.width,M.height)),Q<1||v===!0)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap){const te=v?gs:Math.floor,xe=te(Q*M.width),se=te(Q*M.height);_===void 0&&(_=b(xe,se));const fe=U?b(xe,se):_;return fe.width=xe,fe.height=se,fe.getContext("2d").drawImage(M,0,0,xe,se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+M.width+"x"+M.height+") to ("+xe+"x"+se+")."),fe}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+M.width+"x"+M.height+")."),M;return M}function C(M){return za(M.width)&&za(M.height)}function E(M){return o?!1:M.wrapS!==ti||M.wrapT!==ti||M.minFilter!==Pt&&M.minFilter!==Gt}function P(M,v){return M.generateMipmaps&&v&&M.minFilter!==Pt&&M.minFilter!==Gt}function T(M){n.generateMipmap(M)}function F(M,v,U,ee,Q=!1){if(o===!1)return v;if(M!==null){if(n[M]!==void 0)return n[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let te=v;if(v===6403&&(U===5126&&(te=33326),U===5131&&(te=33325),U===5121&&(te=33321)),v===36244&&(U===5121&&(te=33330),U===5123&&(te=33332),U===5125&&(te=33334),U===5120&&(te=33329),U===5122&&(te=33331),U===5124&&(te=33333)),v===33319&&(U===5126&&(te=33328),U===5131&&(te=33327),U===5121&&(te=33323)),v===6408){const xe=Q?_s:$e.getTransfer(ee);U===5126&&(te=34836),U===5131&&(te=34842),U===5121&&(te=xe===et?35907:32856),U===32819&&(te=32854),U===32820&&(te=32855)}return(te===33325||te===33326||te===33327||te===33328||te===34842||te===34836)&&e.get("EXT_color_buffer_float"),te}function y(M,v,U){return P(M,U)===!0||M.isFramebufferTexture&&M.minFilter!==Pt&&M.minFilter!==Gt?Math.log2(Math.max(v.width,v.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?v.mipmaps.length:1}function w(M){return M===Pt||M===Ko||M===Xs?9728:9729}function z(M){const v=M.target;v.removeEventListener("dispose",z),J(v),v.isVideoTexture&&g.delete(v)}function j(M){const v=M.target;v.removeEventListener("dispose",j),k(v)}function J(M){const v=i.get(M);if(v.__webglInit===void 0)return;const U=M.source,ee=p.get(U);if(ee){const Q=ee[v.__cacheKey];Q.usedTimes--,Q.usedTimes===0&&D(M),Object.keys(ee).length===0&&p.delete(U)}i.remove(M)}function D(M){const v=i.get(M);n.deleteTexture(v.__webglTexture);const U=M.source,ee=p.get(U);delete ee[v.__cacheKey],a.memory.textures--}function k(M){const v=M.texture,U=i.get(M),ee=i.get(v);if(ee.__webglTexture!==void 0&&(n.deleteTexture(ee.__webglTexture),a.memory.textures--),M.depthTexture&&M.depthTexture.dispose(),M.isWebGLCubeRenderTarget)for(let Q=0;Q<6;Q++){if(Array.isArray(U.__webglFramebuffer[Q]))for(let te=0;te=l&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+l),Y+=1,M}function q(M){const v=[];return v.push(M.wrapS),v.push(M.wrapT),v.push(M.wrapR||0),v.push(M.magFilter),v.push(M.minFilter),v.push(M.anisotropy),v.push(M.internalFormat),v.push(M.format),v.push(M.type),v.push(M.generateMipmaps),v.push(M.premultiplyAlpha),v.push(M.flipY),v.push(M.unpackAlignment),v.push(M.colorSpace),v.join()}function K(M,v){const U=i.get(M);if(M.isVideoTexture&&dt(M),M.isRenderTargetTexture===!1&&M.version>0&&U.__version!==M.version){const ee=M.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{qe(U,M,v);return}}t.bindTexture(3553,U.__webglTexture,33984+v)}function I(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){qe(U,M,v);return}t.bindTexture(35866,U.__webglTexture,33984+v)}function W(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){qe(U,M,v);return}t.bindTexture(32879,U.__webglTexture,33984+v)}function he(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){vt(U,M,v);return}t.bindTexture(34067,U.__webglTexture,33984+v)}const de={[Ga]:10497,[ti]:33071,[Wa]:33648},pe={[Pt]:9728,[Ko]:9984,[Xs]:9986,[Gt]:9729,[lp]:9985,[dr]:9987},we={[Mp]:512,[Lp]:519,[bp]:513,[Ep]:515,[wp]:514,[Cp]:518,[Tp]:516,[Ap]:517};function Re(M,v,U){if(U?(n.texParameteri(M,10242,de[v.wrapS]),n.texParameteri(M,10243,de[v.wrapT]),(M===32879||M===35866)&&n.texParameteri(M,32882,de[v.wrapR]),n.texParameteri(M,10240,pe[v.magFilter]),n.texParameteri(M,10241,pe[v.minFilter])):(n.texParameteri(M,10242,33071),n.texParameteri(M,10243,33071),(M===32879||M===35866)&&n.texParameteri(M,32882,33071),(v.wrapS!==ti||v.wrapT!==ti)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(M,10240,w(v.magFilter)),n.texParameteri(M,10241,w(v.minFilter)),v.minFilter!==Pt&&v.minFilter!==Gt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),v.compareFunction&&(n.texParameteri(M,34892,34894),n.texParameteri(M,34893,we[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ee=e.get("EXT_texture_filter_anisotropic");if(v.magFilter===Pt||v.minFilter!==Xs&&v.minFilter!==dr||v.type===Ui&&e.has("OES_texture_float_linear")===!1||o===!1&&v.type===pr&&e.has("OES_texture_half_float_linear")===!1)return;(v.anisotropy>1||i.get(v).__currentAnisotropy)&&(n.texParameterf(M,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy)}}function Se(M,v){let U=!1;M.__webglInit===void 0&&(M.__webglInit=!0,v.addEventListener("dispose",z));const ee=v.source;let Q=p.get(ee);Q===void 0&&(Q={},p.set(ee,Q));const te=q(v);if(te!==M.__cacheKey){Q[te]===void 0&&(Q[te]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,U=!0),Q[te].usedTimes++;const xe=Q[M.__cacheKey];xe!==void 0&&(Q[M.__cacheKey].usedTimes--,xe.usedTimes===0&&D(v)),M.__cacheKey=te,M.__webglTexture=Q[te].texture}return U}function qe(M,v,U){let ee=3553;(v.isDataArrayTexture||v.isCompressedArrayTexture)&&(ee=35866),v.isData3DTexture&&(ee=32879);const Q=Se(M,v),te=v.source;t.bindTexture(ee,M.__webglTexture,33984+U);const xe=i.get(te);if(te.version!==xe.__version||Q===!0){t.activeTexture(33984+U);const se=$e.getPrimaries($e.workingColorSpace),fe=v.colorSpace===qt?null:$e.getPrimaries(v.colorSpace),L=v.colorSpace===qt||se===fe?0:37444;n.pixelStorei(37440,v.flipY),n.pixelStorei(37441,v.premultiplyAlpha),n.pixelStorei(3317,v.unpackAlignment),n.pixelStorei(37443,L);const ne=E(v)&&C(v.image)===!1;let X=x(v.image,ne,!1,u);X=_t(v,X);const Ee=C(X)||o,ve=s.convert(v.format,v.colorSpace);let ye=s.convert(v.type),_e=F(v.internalFormat,ve,ye,v.colorSpace,v.isVideoTexture);Re(ee,v,Ee);let A;const ae=v.mipmaps,re=o&&v.isVideoTexture!==!0,ce=xe.__version===void 0||Q===!0,oe=y(v,X,Ee);if(v.isDepthTexture)_e=6402,o?v.type===Ui?_e=36012:v.type===Ni?_e=33190:v.type===Ki?_e=35056:_e=33189:v.type===Ui&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),v.format===Qi&&_e===6402&&v.type!==uo&&v.type!==Ni&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),v.type=Ni,ye=s.convert(v.type)),v.format===Bn&&_e===6402&&(_e=34041,v.type!==Ki&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),v.type=Ki,ye=s.convert(v.type))),ce&&(re?t.texStorage2D(3553,1,_e,X.width,X.height):t.texImage2D(3553,0,_e,X.width,X.height,0,ve,ye,null));else if(v.isDataTexture)if(ae.length>0&&Ee){re&&ce&&t.texStorage2D(3553,oe,_e,ae[0].width,ae[0].height);for(let Z=0,ge=ae.length;Z>=1,ge>>=1}}else if(ae.length>0&&Ee){re&&ce&&t.texStorage2D(3553,oe,_e,ae[0].width,ae[0].height);for(let Z=0,ge=ae.length;Z0&&ce++,t.texStorage2D(34067,ce,A,X[0].width,X[0].height));for(let Z=0;Z<6;Z++)if(ne){ae?t.texSubImage2D(34069+Z,0,0,0,X[Z].width,X[Z].height,ye,_e,X[Z].data):t.texImage2D(34069+Z,0,A,X[Z].width,X[Z].height,0,ye,_e,X[Z].data);for(let ge=0;ge>te),X=Math.max(1,v.height>>te);Q===32879||Q===35866?t.texImage3D(Q,te,fe,ne,X,v.depth,0,xe,se,null):t.texImage2D(Q,te,fe,ne,X,0,xe,se,null)}t.bindFramebuffer(36160,M),je(v)?d.framebufferTexture2DMultisampleEXT(36160,ee,Q,i.get(U).__webglTexture,0,Ne(v)):(Q===3553||Q>=34069&&Q<=34074)&&n.framebufferTexture2D(36160,ee,Q,i.get(U).__webglTexture,te),t.bindFramebuffer(36160,null)}function $(M,v,U){if(n.bindRenderbuffer(36161,M),v.depthBuffer&&!v.stencilBuffer){let ee=o===!0?33190:33189;if(U||je(v)){const Q=v.depthTexture;Q&&Q.isDepthTexture&&(Q.type===Ui?ee=36012:Q.type===Ni&&(ee=33190));const te=Ne(v);je(v)?d.renderbufferStorageMultisampleEXT(36161,te,ee,v.width,v.height):n.renderbufferStorageMultisample(36161,te,ee,v.width,v.height)}else n.renderbufferStorage(36161,ee,v.width,v.height);n.framebufferRenderbuffer(36160,36096,36161,M)}else if(v.depthBuffer&&v.stencilBuffer){const ee=Ne(v);U&&je(v)===!1?n.renderbufferStorageMultisample(36161,ee,35056,v.width,v.height):je(v)?d.renderbufferStorageMultisampleEXT(36161,ee,35056,v.width,v.height):n.renderbufferStorage(36161,34041,v.width,v.height),n.framebufferRenderbuffer(36160,33306,36161,M)}else{const ee=v.isWebGLMultipleRenderTargets===!0?v.texture:[v.texture];for(let Q=0;Q0){U.__webglFramebuffer[se]=[];for(let fe=0;fe0){U.__webglFramebuffer=[];for(let se=0;se0&&je(M)===!1){const se=te?v:[v];U.__webglMultisampledFramebuffer=n.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,U.__webglMultisampledFramebuffer);for(let fe=0;fe0)for(let fe=0;fe0)for(let fe=0;fe0&&je(M)===!1){const v=M.isWebGLMultipleRenderTargets?M.texture:[M.texture],U=M.width,ee=M.height;let Q=16384;const te=[],xe=M.stencilBuffer?33306:36096,se=i.get(M),fe=M.isWebGLMultipleRenderTargets===!0;if(fe)for(let L=0;L0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&v.__useRenderToTexture!==!1}function dt(M){const v=a.render.frame;g.get(M)!==v&&(g.set(M,v),M.update())}function _t(M,v){const U=M.colorSpace,ee=M.format,Q=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||M.format===qa||U!==Mi&&U!==qt&&($e.getTransfer(U)===et?o===!1?e.has("EXT_sRGB")===!0&&ee===ii?(M.format=qa,M.minFilter=Gt,M.generateMipmaps=!1):v=Uu.sRGBToLinear(v):(ee!==ii||Q!==zi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",U)),v}this.allocateTextureUnit=ie,this.resetTextureUnits=G,this.setTexture2D=K,this.setTexture2DArray=I,this.setTexture3D=W,this.setTextureCube=he,this.rebindTextures=Ie,this.setupRenderTarget=Ce,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=Be,this.setupDepthRenderbuffer=Me,this.setupFrameBufferTexture=Fe,this.useMultisampledRTT=je}function Ox(n,e,t){const i=t.isWebGL2;function r(s,a=qt){let o;const l=$e.getTransfer(a);if(s===zi)return 5121;if(s===Au)return 32819;if(s===Cu)return 32820;if(s===cp)return 5120;if(s===up)return 5122;if(s===uo)return 5123;if(s===Tu)return 5124;if(s===Ni)return 5125;if(s===Ui)return 5126;if(s===pr)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===hp)return 6406;if(s===ii)return 6408;if(s===fp)return 6409;if(s===dp)return 6410;if(s===Qi)return 6402;if(s===Bn)return 34041;if(s===qa)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===pp)return 6403;if(s===Lu)return 36244;if(s===mp)return 33319;if(s===Pu)return 33320;if(s===Ru)return 36249;if(s===Ys||s===Zs||s===$s||s===Js)if(l===et)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===Ys)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Zs)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===$s)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Js)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Ys)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Zs)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===$s)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Js)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Qo||s===el||s===tl||s===il)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Qo)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===el)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===tl)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===il)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===gp)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===nl||s===rl)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===nl)return l===et?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===rl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===sl||s===al||s===ol||s===ll||s===cl||s===ul||s===hl||s===fl||s===dl||s===pl||s===ml||s===gl||s===_l||s===xl)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===sl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===al)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===ol)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===ll)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===cl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===ul)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===hl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===fl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===dl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===pl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===ml)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===gl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===_l)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===xl)return l===et?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Ks||s===vl||s===yl)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===Ks)return l===et?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===vl)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===yl)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===_p||s===Sl||s===Ml||s===bl)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===Ks)return o.COMPRESSED_RED_RGTC1_EXT;if(s===Sl)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Ml)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===bl)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ki?i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class Nx extends Wt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}const Ux={type:"move"};class ba{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Yr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Yr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Yr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const p=t.getJointPose(_,i),f=this._getHandJoint(c,_);p!==null&&(f.matrix.fromArray(p.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=p.radius),f.visible=p!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),m=.02,g=.005;c.inputState.pinching&&d>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ux)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Yr;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class Fx extends Nt{constructor(e,t,i,r,s,a,o,l,c,u){if(u=u!==void 0?u:Qi,u!==Qi&&u!==Bn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Qi&&(i=Ni),i===void 0&&u===Bn&&(i=Ki),super(null,r,s,a,o,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Pt,this.minFilter=l!==void 0?l:Pt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class kx extends an{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,d=null,m=null,g=null;const _=t.getContextAttributes();let p=null,f=null;const b=[],x=[],C=new Wt;C.layers.enable(1),C.viewport=new tt;const E=new Wt;E.layers.enable(2),E.viewport=new tt;const P=[C,E],T=new Nx;T.layers.enable(1),T.layers.enable(2);let F=null,y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(I){let W=b[I];return W===void 0&&(W=new ba,b[I]=W),W.getTargetRaySpace()},this.getControllerGrip=function(I){let W=b[I];return W===void 0&&(W=new ba,b[I]=W),W.getGripSpace()},this.getHand=function(I){let W=b[I];return W===void 0&&(W=new ba,b[I]=W),W.getHandSpace()};function w(I){const W=x.indexOf(I.inputSource);if(W===-1)return;const he=b[W];he!==void 0&&(he.update(I.inputSource,I.frame,c||a),he.dispatchEvent({type:I.type,data:I.inputSource}))}function z(){r.removeEventListener("select",w),r.removeEventListener("selectstart",w),r.removeEventListener("selectend",w),r.removeEventListener("squeeze",w),r.removeEventListener("squeezestart",w),r.removeEventListener("squeezeend",w),r.removeEventListener("end",z),r.removeEventListener("inputsourceschange",j);for(let I=0;I=0&&(x[de]=null,b[de].disconnect(he))}for(let W=0;W=x.length){x.push(he),de=we;break}else if(x[we]===null){x[we]=he,de=we;break}if(de===-1)break}const pe=b[de];pe&&pe.connect(he)}}const J=new R,D=new R;function k(I,W,he){J.setFromMatrixPosition(W.matrixWorld),D.setFromMatrixPosition(he.matrixWorld);const de=J.distanceTo(D),pe=W.projectionMatrix.elements,we=he.projectionMatrix.elements,Re=pe[14]/(pe[10]-1),Se=pe[14]/(pe[10]+1),qe=(pe[9]+1)/pe[5],vt=(pe[9]-1)/pe[5],Fe=(pe[8]-1)/pe[0],$=(we[8]+1)/we[0],ft=Re*Fe,Me=Re*$,Ie=de/(-Fe+$),Ce=Ie*-Fe;W.matrixWorld.decompose(I.position,I.quaternion,I.scale),I.translateX(Ce),I.translateZ(Ie),I.matrixWorld.compose(I.position,I.quaternion,I.scale),I.matrixWorldInverse.copy(I.matrixWorld).invert();const Ke=Re+Ie,Be=Se+Ie,Ne=ft-Ce,je=Me+(de-Ce),dt=qe*Se/Be*Ke,_t=vt*Se/Be*Ke;I.projectionMatrix.makePerspective(Ne,je,dt,_t,Ke,Be),I.projectionMatrixInverse.copy(I.projectionMatrix).invert()}function Y(I,W){W===null?I.matrixWorld.copy(I.matrix):I.matrixWorld.multiplyMatrices(W.matrixWorld,I.matrix),I.matrixWorldInverse.copy(I.matrixWorld).invert()}this.updateCamera=function(I){if(r===null)return;T.near=E.near=C.near=I.near,T.far=E.far=C.far=I.far,(F!==T.near||y!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),F=T.near,y=T.far);const W=I.parent,he=T.cameras;Y(T,W);for(let de=0;de0&&(p.alphaTest.value=f.alphaTest);const b=e.get(f).envMap;if(b&&(p.envMap.value=b,p.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=f.reflectivity,p.ior.value=f.ior,p.refractionRatio.value=f.refractionRatio),f.lightMap){p.lightMap.value=f.lightMap;const x=n._useLegacyLights===!0?Math.PI:1;p.lightMapIntensity.value=f.lightMapIntensity*x,t(f.lightMap,p.lightMapTransform)}f.aoMap&&(p.aoMap.value=f.aoMap,p.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,p.aoMapTransform))}function a(p,f){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,f.map&&(p.map.value=f.map,t(f.map,p.mapTransform))}function o(p,f){p.dashSize.value=f.dashSize,p.totalSize.value=f.dashSize+f.gapSize,p.scale.value=f.scale}function l(p,f,b,x){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,p.size.value=f.size*b,p.scale.value=x*.5,f.map&&(p.map.value=f.map,t(f.map,p.uvTransform)),f.alphaMap&&(p.alphaMap.value=f.alphaMap,t(f.alphaMap,p.alphaMapTransform)),f.alphaTest>0&&(p.alphaTest.value=f.alphaTest)}function c(p,f){p.diffuse.value.copy(f.color),p.opacity.value=f.opacity,p.rotation.value=f.rotation,f.map&&(p.map.value=f.map,t(f.map,p.mapTransform)),f.alphaMap&&(p.alphaMap.value=f.alphaMap,t(f.alphaMap,p.alphaMapTransform)),f.alphaTest>0&&(p.alphaTest.value=f.alphaTest)}function u(p,f){p.specular.value.copy(f.specular),p.shininess.value=Math.max(f.shininess,1e-4)}function h(p,f){f.gradientMap&&(p.gradientMap.value=f.gradientMap)}function d(p,f){p.metalness.value=f.metalness,f.metalnessMap&&(p.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,p.metalnessMapTransform)),p.roughness.value=f.roughness,f.roughnessMap&&(p.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,p.roughnessMapTransform)),e.get(f).envMap&&(p.envMapIntensity.value=f.envMapIntensity)}function m(p,f,b){p.ior.value=f.ior,f.sheen>0&&(p.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),p.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(p.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,p.sheenColorMapTransform)),f.sheenRoughnessMap&&(p.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,p.sheenRoughnessMapTransform))),f.clearcoat>0&&(p.clearcoat.value=f.clearcoat,p.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(p.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,p.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(p.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ot&&p.clearcoatNormalScale.value.negate())),f.iridescence>0&&(p.iridescence.value=f.iridescence,p.iridescenceIOR.value=f.iridescenceIOR,p.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(p.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,p.iridescenceMapTransform)),f.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),f.transmission>0&&(p.transmission.value=f.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(p.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,p.transmissionMapTransform)),p.thickness.value=f.thickness,f.thicknessMap&&(p.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=f.attenuationDistance,p.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(p.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(p.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=f.specularIntensity,p.specularColor.value.copy(f.specularColor),f.specularColorMap&&(p.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,p.specularColorMapTransform)),f.specularIntensityMap&&(p.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,p.specularIntensityMapTransform))}function g(p,f){f.matcap&&(p.matcap.value=f.matcap)}function _(p,f){const b=e.get(f).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Bx(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(35375):0;function l(b,x){const C=x.program;i.uniformBlockBinding(b,C)}function c(b,x){let C=r[b.id];C===void 0&&(g(b),C=u(b),r[b.id]=C,b.addEventListener("dispose",p));const E=x.program;i.updateUBOMapping(b,E);const P=e.render.frame;s[b.id]!==P&&(d(b),s[b.id]=P)}function u(b){const x=h();b.__bindingPointIndex=x;const C=n.createBuffer(),E=b.__size,P=b.usage;return n.bindBuffer(35345,C),n.bufferData(35345,E,P),n.bindBuffer(35345,null),n.bindBufferBase(35345,x,C),C}function h(){for(let b=0;b0){P=C%E;const j=E-P;P!==0&&j-w.boundary<0&&(C+=E-P,y.__offset=C)}C+=w.storage}return P=C%E,P>0&&(C+=E-P),b.__size=C,b.__cache={},this}function _(b){const x={boundary:0,storage:0};return typeof b=="number"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function p(b){const x=b.target;x.removeEventListener("dispose",p);const C=a.indexOf(x.__bindingPointIndex);a.splice(C,1),n.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function f(){for(const b in r)n.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class qy{constructor(e={}){const{canvas:t=Ip(),context:i=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;i!==null?d=i.getContextAttributes().alpha:d=a;const m=new Uint32Array(4),g=new Int32Array(4);let _=null,p=null;const f=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=yt,this._useLegacyLights=!1,this.toneMapping=ki,this.toneMappingExposure=1;const x=this;let C=!1,E=0,P=0,T=null,F=-1,y=null;const w=new tt,z=new tt;let j=null;const J=new Ze(0);let D=0,k=t.width,Y=t.height,G=1,ie=null,q=null;const K=new tt(0,0,k,Y),I=new tt(0,0,k,Y);let W=!1;const he=new mo;let de=!1,pe=!1,we=null;const Re=new rt,Se=new Oe,qe=new R,vt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Fe(){return T===null?G:1}let $=i;function ft(S,O){for(let B=0;B0?p=b[b.length-1]:p=null,f.pop(),f.length>0?_=f[f.length-1]:_=null};function Co(S,O,B,N){if(S.visible===!1)return;if(S.layers.test(O.layers)){if(S.isGroup)B=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(O);else if(S.isLight)p.pushLight(S),S.castShadow&&p.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||he.intersectsSprite(S)){N&&qe.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Re);const be=v.update(S),Le=S.material;Le.visible&&_.push(S,be,Le,B,qe.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(!S.frustumCulled||he.intersectsObject(S))){const be=v.update(S),Le=S.material;if(N&&(S.boundingSphere!==void 0?(S.boundingSphere===null&&S.computeBoundingSphere(),qe.copy(S.boundingSphere.center)):(be.boundingSphere===null&&be.computeBoundingSphere(),qe.copy(be.boundingSphere.center)),qe.applyMatrix4(S.matrixWorld).applyMatrix4(Re)),Array.isArray(Le)){const Pe=be.groups;for(let He=0,Ae=Pe.length;He0&&$h(V,me,O,B),N&&Ce.viewport(w.copy(N)),V.length>0&&Ar(V,O,B),me.length>0&&Ar(me,O,B),be.length>0&&Ar(be,O,B),Ce.buffers.depth.setTest(!0),Ce.buffers.depth.setMask(!0),Ce.buffers.color.setMask(!0),Ce.setPolygonOffset(!1)}function $h(S,O,B,N){const V=Ie.isWebGL2;we===null&&(we=new sn(1,1,{generateMipmaps:!0,type:Me.has("EXT_color_buffer_half_float")?pr:zi,minFilter:dr,samples:V?4:0})),x.getDrawingBufferSize(Se),V?we.setSize(Se.x,Se.y):we.setSize(gs(Se.x),gs(Se.y));const me=x.getRenderTarget();x.setRenderTarget(we),x.getClearColor(J),D=x.getClearAlpha(),D<1&&x.setClearColor(16777215,.5),x.clear();const be=x.toneMapping;x.toneMapping=ki,Ar(S,B,N),Ne.updateMultisampleRenderTarget(we),Ne.updateRenderTargetMipmap(we);let Le=!1;for(let Pe=0,He=O.length;Pe0),ke=!!B.morphAttributes.position,it=!!B.morphAttributes.normal,st=!!B.morphAttributes.color;let Bt=ki;N.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(Bt=x.toneMapping);const ui=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,lt=ui!==void 0?ui.length:0,Ge=Be.get(N),zs=p.state.lights;if(de===!0&&(pe===!0||S!==y)){const Ut=S===y&&N.id===F;xe.setState(N,S,Ut)}let ct=!1;N.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==zs.state.version||Ge.outputColorSpace!==Le||V.isInstancedMesh&&Ge.instancing===!1||!V.isInstancedMesh&&Ge.instancing===!0||V.isSkinnedMesh&&Ge.skinning===!1||!V.isSkinnedMesh&&Ge.skinning===!0||V.isInstancedMesh&&Ge.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&Ge.instancingColor===!1&&V.instanceColor!==null||Ge.envMap!==Pe||N.fog===!0&&Ge.fog!==me||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==xe.numPlanes||Ge.numIntersection!==xe.numIntersection)||Ge.vertexAlphas!==He||Ge.vertexTangents!==Ae||Ge.morphTargets!==ke||Ge.morphNormals!==it||Ge.morphColors!==st||Ge.toneMapping!==Bt||Ie.isWebGL2===!0&&Ge.morphTargetsCount!==lt)&&(ct=!0):(ct=!0,Ge.__version=N.version);let Vi=Ge.currentProgram;ct===!0&&(Vi=Cr(N,O,V));let Do=!1,$n=!1,Bs=!1;const At=Vi.getUniforms(),Hi=Ge.uniforms;if(Ce.useProgram(Vi.program)&&(Do=!0,$n=!0,Bs=!0),N.id!==F&&(F=N.id,$n=!0),Do||y!==S){At.setValue($,"projectionMatrix",S.projectionMatrix),At.setValue($,"viewMatrix",S.matrixWorldInverse);const Ut=At.map.cameraPosition;Ut!==void 0&&Ut.setValue($,qe.setFromMatrixPosition(S.matrixWorld)),Ie.logarithmicDepthBuffer&&At.setValue($,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),(N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshLambertMaterial||N.isMeshBasicMaterial||N.isMeshStandardMaterial||N.isShaderMaterial)&&At.setValue($,"isOrthographic",S.isOrthographicCamera===!0),y!==S&&(y=S,$n=!0,Bs=!0)}if(V.isSkinnedMesh){At.setOptional($,V,"bindMatrix"),At.setOptional($,V,"bindMatrixInverse");const Ut=V.skeleton;Ut&&(Ie.floatVertexTextures?(Ut.boneTexture===null&&Ut.computeBoneTexture(),At.setValue($,"boneTexture",Ut.boneTexture,Ne),At.setValue($,"boneTextureSize",Ut.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Vs=B.morphAttributes;if((Vs.position!==void 0||Vs.normal!==void 0||Vs.color!==void 0&&Ie.isWebGL2===!0)&&L.update(V,B,Vi),($n||Ge.receiveShadow!==V.receiveShadow)&&(Ge.receiveShadow=V.receiveShadow,At.setValue($,"receiveShadow",V.receiveShadow)),N.isMeshGouraudMaterial&&N.envMap!==null&&(Hi.envMap.value=Pe,Hi.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),$n&&(At.setValue($,"toneMappingExposure",x.toneMappingExposure),Ge.needsLights&&Kh(Hi,Bs),me&&N.fog===!0&&ee.refreshFogUniforms(Hi,me),ee.refreshMaterialUniforms(Hi,N,G,Y,we),fs.upload($,Ge.uniformsList,Hi,Ne)),N.isShaderMaterial&&N.uniformsNeedUpdate===!0&&(fs.upload($,Ge.uniformsList,Hi,Ne),N.uniformsNeedUpdate=!1),N.isSpriteMaterial&&At.setValue($,"center",V.center),At.setValue($,"modelViewMatrix",V.modelViewMatrix),At.setValue($,"normalMatrix",V.normalMatrix),At.setValue($,"modelMatrix",V.matrixWorld),N.isShaderMaterial||N.isRawShaderMaterial){const Ut=N.uniformsGroups;for(let Hs=0,ef=Ut.length;Hs0&&Ne.useMultisampledRTT(S)===!1?V=Be.get(S).__webglMultisampledFramebuffer:Array.isArray(Ae)?V=Ae[B]:V=Ae,w.copy(S.viewport),z.copy(S.scissor),j=S.scissorTest}else w.copy(K).multiplyScalar(G).floor(),z.copy(I).multiplyScalar(G).floor(),j=W;if(Ce.bindFramebuffer(36160,V)&&Ie.drawBuffers&&N&&Ce.drawBuffers(S,V),Ce.viewport(w),Ce.scissor(z),Ce.setScissorTest(j),me){const Pe=Be.get(S.texture);$.framebufferTexture2D(36160,36064,34069+O,Pe.__webglTexture,B)}else if(be){const Pe=Be.get(S.texture),He=O||0;$.framebufferTextureLayer(36160,36064,Pe.__webglTexture,B||0,He)}F=-1},this.readRenderTargetPixels=function(S,O,B,N,V,me,be){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Le=Be.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&be!==void 0&&(Le=Le[be]),Le){Ce.bindFramebuffer(36160,Le);try{const Pe=S.texture,He=Pe.format,Ae=Pe.type;if(He!==ii&&Ee.convert(He)!==$.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ke=Ae===pr&&(Me.has("EXT_color_buffer_half_float")||Ie.isWebGL2&&Me.has("EXT_color_buffer_float"));if(Ae!==zi&&Ee.convert(Ae)!==$.getParameter(35738)&&!(Ae===Ui&&(Ie.isWebGL2||Me.has("OES_texture_float")||Me.has("WEBGL_color_buffer_float")))&&!ke){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=S.width-N&&B>=0&&B<=S.height-V&&$.readPixels(O,B,N,V,Ee.convert(He),Ee.convert(Ae),me)}finally{const Pe=T!==null?Be.get(T).__webglFramebuffer:null;Ce.bindFramebuffer(36160,Pe)}}},this.copyFramebufferToTexture=function(S,O,B=0){const N=Math.pow(2,-B),V=Math.floor(O.image.width*N),me=Math.floor(O.image.height*N);Ne.setTexture2D(O,0),$.copyTexSubImage2D(3553,B,0,0,S.x,S.y,V,me),Ce.unbindTexture()},this.copyTextureToTexture=function(S,O,B,N=0){const V=O.image.width,me=O.image.height,be=Ee.convert(B.format),Le=Ee.convert(B.type);Ne.setTexture2D(B,0),$.pixelStorei(37440,B.flipY),$.pixelStorei(37441,B.premultiplyAlpha),$.pixelStorei(3317,B.unpackAlignment),O.isDataTexture?$.texSubImage2D(3553,N,S.x,S.y,V,me,be,Le,O.image.data):O.isCompressedTexture?$.compressedTexSubImage2D(3553,N,S.x,S.y,O.mipmaps[0].width,O.mipmaps[0].height,be,O.mipmaps[0].data):$.texSubImage2D(3553,N,S.x,S.y,be,Le,O.image),N===0&&B.generateMipmaps&&$.generateMipmap(3553),Ce.unbindTexture()},this.copyTextureToTexture3D=function(S,O,B,N,V=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const me=S.max.x-S.min.x+1,be=S.max.y-S.min.y+1,Le=S.max.z-S.min.z+1,Pe=Ee.convert(N.format),He=Ee.convert(N.type);let Ae;if(N.isData3DTexture)Ne.setTexture3D(N,0),Ae=32879;else if(N.isDataArrayTexture)Ne.setTexture2DArray(N,0),Ae=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}$.pixelStorei(37440,N.flipY),$.pixelStorei(37441,N.premultiplyAlpha),$.pixelStorei(3317,N.unpackAlignment);const ke=$.getParameter(3314),it=$.getParameter(32878),st=$.getParameter(3316),Bt=$.getParameter(3315),ui=$.getParameter(32877),lt=B.isCompressedTexture?B.mipmaps[0]:B.image;$.pixelStorei(3314,lt.width),$.pixelStorei(32878,lt.height),$.pixelStorei(3316,S.min.x),$.pixelStorei(3315,S.min.y),$.pixelStorei(32877,S.min.z),B.isDataTexture||B.isData3DTexture?$.texSubImage3D(Ae,V,O.x,O.y,O.z,me,be,Le,Pe,He,lt.data):B.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),$.compressedTexSubImage3D(Ae,V,O.x,O.y,O.z,me,be,Le,Pe,lt.data)):$.texSubImage3D(Ae,V,O.x,O.y,O.z,me,be,Le,Pe,He,lt),$.pixelStorei(3314,ke),$.pixelStorei(32878,it),$.pixelStorei(3316,st),$.pixelStorei(3315,Bt),$.pixelStorei(32877,ui),V===0&&N.generateMipmaps&&$.generateMipmap(Ae),Ce.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?Ne.setTextureCube(S,0):S.isData3DTexture?Ne.setTexture3D(S,0):S.isDataArrayTexture||S.isCompressedArrayTexture?Ne.setTexture2DArray(S,0):Ne.setTexture2D(S,0),Ce.unbindTexture()},this.resetState=function(){E=0,P=0,T=null,Ce.reset(),ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===ho?"display-p3":"srgb",t.unpackColorSpace=$e.workingColorSpace===Rs?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===yt?en:Du}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===en?yt:Mi}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class jy extends St{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class vo extends Zt{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],d=[],m=[];let g=0;const _=[],p=i/2;let f=0;b(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new Dt(h,3)),this.setAttribute("normal",new Dt(d,3)),this.setAttribute("uv",new Dt(m,2));function b(){const C=new R,E=new R;let P=0;const T=(t-e)/i;for(let F=0;F<=s;F++){const y=[],w=F/s,z=w*(t-e)+e;for(let j=0;j<=r;j++){const J=j/r,D=J*l+o,k=Math.sin(D),Y=Math.cos(D);E.x=z*k,E.y=-w*i+p,E.z=z*Y,h.push(E.x,E.y,E.z),C.set(k,T,Y).normalize(),d.push(C.x,C.y,C.z),m.push(J,1-w),y.push(g++)}_.push(y)}for(let F=0;F.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Sc.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Sc,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:lo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=lo);const Mc={type:"change"},Ea={type:"start"},bc={type:"end"},ts=new Sr,wc=new Di,Vx=Math.cos(70*Dd.DEG2RAD);class Zy extends an{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new R,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:cn.ROTATE,MIDDLE:cn.DOLLY,RIGHT:cn.PAN},this.touches={ONE:un.ROTATE,TWO:un.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(L){L.addEventListener("keydown",v),this._domElementKeyEvents=L},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",v),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(Mc),i.update(),s=r.NONE},this.update=function(){const L=new R,ne=new nn().setFromUnitVectors(e.up,new R(0,1,0)),X=ne.clone().invert(),Ee=new R,ve=new nn,ye=new R,_e=2*Math.PI;return function(ae=null){const re=i.object.position;L.copy(re).sub(i.target),L.applyQuaternion(ne),o.setFromVector3(L),i.autoRotate&&s===r.NONE&&z(y(ae)),i.enableDamping?(o.theta+=l.theta*i.dampingFactor,o.phi+=l.phi*i.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let ce=i.minAzimuthAngle,oe=i.maxAzimuthAngle;isFinite(ce)&&isFinite(oe)&&(ce<-Math.PI?ce+=_e:ce>Math.PI&&(ce-=_e),oe<-Math.PI?oe+=_e:oe>Math.PI&&(oe-=_e),ce<=oe?o.theta=Math.max(ce,Math.min(oe,o.theta)):o.theta=o.theta>(ce+oe)/2?Math.max(ce,o.theta):Math.min(oe,o.theta)),o.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,o.phi)),o.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),i.zoomToCursor&&P||i.object.isOrthographicCamera?o.radius=q(o.radius):o.radius=q(o.radius*c),L.setFromSpherical(o),L.applyQuaternion(X),re.copy(i.target).add(L),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),u.set(0,0,0));let Z=!1;if(i.zoomToCursor&&P){let ge=null;if(i.object.isPerspectiveCamera){const Te=L.length();ge=q(Te*c);const ot=Te-ge;i.object.position.addScaledVector(C,ot),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const Te=new R(E.x,E.y,0);Te.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),Z=!0;const ot=new R(E.x,E.y,0);ot.unproject(i.object),i.object.position.sub(ot).add(Te),i.object.updateMatrixWorld(),ge=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;ge!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(ge).add(i.object.position):(ts.origin.copy(i.object.position),ts.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(ts.direction))a||8*(1-ve.dot(i.object.quaternion))>a||ye.distanceToSquared(i.target)>0?(i.dispatchEvent(Mc),Ee.copy(i.object.position),ve.copy(i.object.quaternion),ye.copy(i.target),Z=!1,!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",Q),i.domElement.removeEventListener("pointerdown",Be),i.domElement.removeEventListener("pointercancel",je),i.domElement.removeEventListener("wheel",M),i.domElement.removeEventListener("pointermove",Ne),i.domElement.removeEventListener("pointerup",je),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",v),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const a=1e-6,o=new yc,l=new yc;let c=1;const u=new R,h=new Oe,d=new Oe,m=new Oe,g=new Oe,_=new Oe,p=new Oe,f=new Oe,b=new Oe,x=new Oe,C=new R,E=new Oe;let P=!1;const T=[],F={};function y(L){return L!==null?2*Math.PI/60*i.autoRotateSpeed*L:2*Math.PI/60/60*i.autoRotateSpeed}function w(){return Math.pow(.95,i.zoomSpeed)}function z(L){l.theta-=L}function j(L){l.phi-=L}const J=function(){const L=new R;return function(X,Ee){L.setFromMatrixColumn(Ee,0),L.multiplyScalar(-X),u.add(L)}}(),D=function(){const L=new R;return function(X,Ee){i.screenSpacePanning===!0?L.setFromMatrixColumn(Ee,1):(L.setFromMatrixColumn(Ee,0),L.crossVectors(i.object.up,L)),L.multiplyScalar(X),u.add(L)}}(),k=function(){const L=new R;return function(X,Ee){const ve=i.domElement;if(i.object.isPerspectiveCamera){const ye=i.object.position;L.copy(ye).sub(i.target);let _e=L.length();_e*=Math.tan(i.object.fov/2*Math.PI/180),J(2*X*_e/ve.clientHeight,i.object.matrix),D(2*Ee*_e/ve.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(J(X*(i.object.right-i.object.left)/i.object.zoom/ve.clientWidth,i.object.matrix),D(Ee*(i.object.top-i.object.bottom)/i.object.zoom/ve.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function Y(L){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=L:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function G(L){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=L:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function ie(L){if(!i.zoomToCursor)return;P=!0;const ne=i.domElement.getBoundingClientRect(),X=L.clientX-ne.left,Ee=L.clientY-ne.top,ve=ne.width,ye=ne.height;E.x=X/ve*2-1,E.y=-(Ee/ye)*2+1,C.set(E.x,E.y,1).unproject(i.object).sub(i.object.position).normalize()}function q(L){return Math.max(i.minDistance,Math.min(i.maxDistance,L))}function K(L){h.set(L.clientX,L.clientY)}function I(L){ie(L),f.set(L.clientX,L.clientY)}function W(L){g.set(L.clientX,L.clientY)}function he(L){d.set(L.clientX,L.clientY),m.subVectors(d,h).multiplyScalar(i.rotateSpeed);const ne=i.domElement;z(2*Math.PI*m.x/ne.clientHeight),j(2*Math.PI*m.y/ne.clientHeight),h.copy(d),i.update()}function de(L){b.set(L.clientX,L.clientY),x.subVectors(b,f),x.y>0?Y(w()):x.y<0&&G(w()),f.copy(b),i.update()}function pe(L){_.set(L.clientX,L.clientY),p.subVectors(_,g).multiplyScalar(i.panSpeed),k(p.x,p.y),g.copy(_),i.update()}function we(L){ie(L),L.deltaY<0?G(w()):L.deltaY>0&&Y(w()),i.update()}function Re(L){let ne=!1;switch(L.code){case i.keys.UP:L.ctrlKey||L.metaKey||L.shiftKey?j(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):k(0,i.keyPanSpeed),ne=!0;break;case i.keys.BOTTOM:L.ctrlKey||L.metaKey||L.shiftKey?j(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):k(0,-i.keyPanSpeed),ne=!0;break;case i.keys.LEFT:L.ctrlKey||L.metaKey||L.shiftKey?z(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):k(i.keyPanSpeed,0),ne=!0;break;case i.keys.RIGHT:L.ctrlKey||L.metaKey||L.shiftKey?z(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):k(-i.keyPanSpeed,0),ne=!0;break}ne&&(L.preventDefault(),i.update())}function Se(){if(T.length===1)h.set(T[0].pageX,T[0].pageY);else{const L=.5*(T[0].pageX+T[1].pageX),ne=.5*(T[0].pageY+T[1].pageY);h.set(L,ne)}}function qe(){if(T.length===1)g.set(T[0].pageX,T[0].pageY);else{const L=.5*(T[0].pageX+T[1].pageX),ne=.5*(T[0].pageY+T[1].pageY);g.set(L,ne)}}function vt(){const L=T[0].pageX-T[1].pageX,ne=T[0].pageY-T[1].pageY,X=Math.sqrt(L*L+ne*ne);f.set(0,X)}function Fe(){i.enableZoom&&vt(),i.enablePan&&qe()}function $(){i.enableZoom&&vt(),i.enableRotate&&Se()}function ft(L){if(T.length==1)d.set(L.pageX,L.pageY);else{const X=fe(L),Ee=.5*(L.pageX+X.x),ve=.5*(L.pageY+X.y);d.set(Ee,ve)}m.subVectors(d,h).multiplyScalar(i.rotateSpeed);const ne=i.domElement;z(2*Math.PI*m.x/ne.clientHeight),j(2*Math.PI*m.y/ne.clientHeight),h.copy(d)}function Me(L){if(T.length===1)_.set(L.pageX,L.pageY);else{const ne=fe(L),X=.5*(L.pageX+ne.x),Ee=.5*(L.pageY+ne.y);_.set(X,Ee)}p.subVectors(_,g).multiplyScalar(i.panSpeed),k(p.x,p.y),g.copy(_)}function Ie(L){const ne=fe(L),X=L.pageX-ne.x,Ee=L.pageY-ne.y,ve=Math.sqrt(X*X+Ee*Ee);b.set(0,ve),x.set(0,Math.pow(b.y/f.y,i.zoomSpeed)),Y(x.y),f.copy(b)}function Ce(L){i.enableZoom&&Ie(L),i.enablePan&&Me(L)}function Ke(L){i.enableZoom&&Ie(L),i.enableRotate&&ft(L)}function Be(L){i.enabled!==!1&&(T.length===0&&(i.domElement.setPointerCapture(L.pointerId),i.domElement.addEventListener("pointermove",Ne),i.domElement.addEventListener("pointerup",je)),te(L),L.pointerType==="touch"?U(L):dt(L))}function Ne(L){i.enabled!==!1&&(L.pointerType==="touch"?ee(L):_t(L))}function je(L){xe(L),T.length===0&&(i.domElement.releasePointerCapture(L.pointerId),i.domElement.removeEventListener("pointermove",Ne),i.domElement.removeEventListener("pointerup",je)),i.dispatchEvent(bc),s=r.NONE}function dt(L){let ne;switch(L.button){case 0:ne=i.mouseButtons.LEFT;break;case 1:ne=i.mouseButtons.MIDDLE;break;case 2:ne=i.mouseButtons.RIGHT;break;default:ne=-1}switch(ne){case cn.DOLLY:if(i.enableZoom===!1)return;I(L),s=r.DOLLY;break;case cn.ROTATE:if(L.ctrlKey||L.metaKey||L.shiftKey){if(i.enablePan===!1)return;W(L),s=r.PAN}else{if(i.enableRotate===!1)return;K(L),s=r.ROTATE}break;case cn.PAN:if(L.ctrlKey||L.metaKey||L.shiftKey){if(i.enableRotate===!1)return;K(L),s=r.ROTATE}else{if(i.enablePan===!1)return;W(L),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&i.dispatchEvent(Ea)}function _t(L){switch(s){case r.ROTATE:if(i.enableRotate===!1)return;he(L);break;case r.DOLLY:if(i.enableZoom===!1)return;de(L);break;case r.PAN:if(i.enablePan===!1)return;pe(L);break}}function M(L){i.enabled===!1||i.enableZoom===!1||s!==r.NONE||(L.preventDefault(),i.dispatchEvent(Ea),we(L),i.dispatchEvent(bc))}function v(L){i.enabled===!1||i.enablePan===!1||Re(L)}function U(L){switch(se(L),T.length){case 1:switch(i.touches.ONE){case un.ROTATE:if(i.enableRotate===!1)return;Se(),s=r.TOUCH_ROTATE;break;case un.PAN:if(i.enablePan===!1)return;qe(),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(i.touches.TWO){case un.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Fe(),s=r.TOUCH_DOLLY_PAN;break;case un.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;$(),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&i.dispatchEvent(Ea)}function ee(L){switch(se(L),s){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;ft(L),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;Me(L),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ce(L),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ke(L),i.update();break;default:s=r.NONE}}function Q(L){i.enabled!==!1&&L.preventDefault()}function te(L){T.push(L)}function xe(L){delete F[L.pointerId];for(let ne=0;ne=0?g:1e3+g,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Ec={};function Jx(n,e={}){const t=JSON.stringify([n,e]);let i=Ec[t];return i||(i=new Intl.ListFormat(n,e),Ec[t]=i),i}let Za={};function $a(n,e={}){const t=JSON.stringify([n,e]);let i=Za[t];return i||(i=new Intl.DateTimeFormat(n,e),Za[t]=i),i}let Ja={};function Kx(n,e={}){const t=JSON.stringify([n,e]);let i=Ja[t];return i||(i=new Intl.NumberFormat(n,e),Ja[t]=i),i}let Ka={};function Qx(n,e={}){const{base:t,...i}=e,r=JSON.stringify([n,i]);let s=Ka[r];return s||(s=new Intl.RelativeTimeFormat(n,e),Ka[r]=s),s}let ar=null;function ev(){return ar||(ar=new Intl.DateTimeFormat().resolvedOptions().locale,ar)}let Tc={};function tv(n){let e=Tc[n];if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,Tc[n]=e}return e}function iv(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let i,r;try{i=$a(n).resolvedOptions(),r=n}catch{const l=n.substring(0,t);i=$a(l).resolvedOptions(),r=l}const{numberingSystem:s,calendar:a}=i;return[r,s,a]}}function nv(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function rv(n){const e=[];for(let t=1;t<=12;t++){const i=Ue.utc(2009,t,1);e.push(n(i))}return e}function sv(n){const e=[];for(let t=1;t<=7;t++){const i=Ue.utc(2016,11,13+t);e.push(n(i))}return e}function ns(n,e,t,i){const r=n.listingMode();return r==="error"?null:r==="en"?t(e):i(e)}function av(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}class ov{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:r,floor:s,...a}=i;if(!t||Object.keys(a).length>0){const o={useGrouping:!1,...i};i.padTo>0&&(o.minimumIntegerDigits=i.padTo),this.inf=Kx(e,o)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):bo(e,3);return ht(t,this.padTo)}}}class lv{constructor(e,t,i){this.opts=i,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const a=-1*(e.offset/60),o=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&bi.create(o).valid?(r=o,this.dt=e):(r="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||r,this.dtf=$a(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const i=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:i}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class cv{constructor(e,t,i){this.opts={style:"long",...i},!t&&bh()&&(this.rtf=Qx(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):Lv(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const uv={firstDay:1,minimalDays:4,weekend:[6,7]};class Je{static fromOpts(e){return Je.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,i,r,s=!1){const a=e||at.defaultLocale,o=a||(s?"en-US":ev()),l=t||at.defaultNumberingSystem,c=i||at.defaultOutputCalendar,u=Qa(r)||at.defaultWeekSettings;return new Je(o,l,c,u,a)}static resetCache(){ar=null,Za={},Ja={},Ka={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i,weekSettings:r}={}){return Je.create(e,t,i,r)}constructor(e,t,i,r,s){const[a,o,l]=iv(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=i||l||null,this.weekSettings=r,this.intl=nv(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=av(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Je.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Qa(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return ns(this,e,Ch,()=>{const i=t?{month:e,day:"numeric"}:{month:e},r=t?"format":"standalone";return this.monthsCache[r][e]||(this.monthsCache[r][e]=rv(s=>this.extract(s,i,"month"))),this.monthsCache[r][e]})}weekdays(e,t=!1){return ns(this,e,Rh,()=>{const i=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=sv(s=>this.extract(s,i,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return ns(this,void 0,()=>Dh,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ue.utc(2016,11,13,9),Ue.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ns(this,e,Ih,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ue.utc(-40,1,1),Ue.utc(2017,1,1)].map(i=>this.extract(i,t,"era"))),this.eraCache[e]})}extract(e,t,i){const r=this.dtFormatter(e,t),s=r.formatToParts(),a=s.find(o=>o.type.toLowerCase()===i);return a?a.value:null}numberFormatter(e={}){return new ov(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new lv(e,this.intl,t)}relFormatter(e={}){return new cv(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Jx(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:wh()?tv(this.locale):uv}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let Aa=null;class Rt extends br{static get utcInstance(){return Aa===null&&(Aa=new Rt(0)),Aa}static instance(e){return e===0?Rt.utcInstance:new Rt(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Rt(Fs(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ur(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ur(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return ur(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class hv extends br{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Oi(n,e){if(De(n)||n===null)return e;if(n instanceof br)return n;if(pv(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?Os.instance:t==="utc"||t==="gmt"?Rt.utcInstance:Rt.parseSpecifier(t)||bi.create(n)}else return tn(n)?Rt.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new hv(n)}let Ac=()=>Date.now(),Cc="system",Lc=null,Pc=null,Rc=null,Dc=60,Ic,Oc=null;class at{static get now(){return Ac}static set now(e){Ac=e}static set defaultZone(e){Cc=e}static get defaultZone(){return Oi(Cc,Os.instance)}static get defaultLocale(){return Lc}static set defaultLocale(e){Lc=e}static get defaultNumberingSystem(){return Pc}static set defaultNumberingSystem(e){Pc=e}static get defaultOutputCalendar(){return Rc}static set defaultOutputCalendar(e){Rc=e}static get defaultWeekSettings(){return Oc}static set defaultWeekSettings(e){Oc=Qa(e)}static get twoDigitCutoffYear(){return Dc}static set twoDigitCutoffYear(e){Dc=e%100}static get throwOnInvalid(){return Ic}static set throwOnInvalid(e){Ic=e}static resetCaches(){Je.resetCache(),bi.resetCache()}}class ni{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const _h=[0,31,59,90,120,151,181,212,243,273,304,334],xh=[0,31,60,91,121,152,182,213,244,274,305,335];function jt(n,e){return new ni("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function yo(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const r=i.getUTCDay();return r===0?7:r}function vh(n,e,t){return t+(wr(n)?xh:_h)[e-1]}function yh(n,e){const t=wr(n)?xh:_h,i=t.findIndex(s=>sgr(i,e,t)?(c=i+1,l=1):c=i,{weekYear:c,weekNumber:l,weekday:o,...ks(n)}}function Nc(n,e=4,t=1){const{weekYear:i,weekNumber:r,weekday:s}=n,a=So(yo(i,1,e),t),o=Nn(i);let l=r*7+s-a-7+e,c;l<1?(c=i-1,l+=Nn(c)):l>o?(c=i+1,l-=Nn(i)):c=i;const{month:u,day:h}=yh(c,l);return{year:c,month:u,day:h,...ks(n)}}function Ca(n){const{year:e,month:t,day:i}=n,r=vh(e,t,i);return{year:e,ordinal:r,...ks(n)}}function Uc(n){const{year:e,ordinal:t}=n,{month:i,day:r}=yh(e,t);return{year:e,month:i,day:r,...ks(n)}}function Fc(n,e){if(!De(n.localWeekday)||!De(n.localWeekNumber)||!De(n.localWeekYear)){if(!De(n.weekday)||!De(n.weekNumber)||!De(n.weekYear))throw new Dn("Cannot mix locale-based week fields with ISO-based week fields");return De(n.localWeekday)||(n.weekday=n.localWeekday),De(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),De(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function fv(n,e=4,t=1){const i=Ns(n.weekYear),r=Xt(n.weekNumber,1,gr(n.weekYear,e,t)),s=Xt(n.weekday,1,7);return i?r?s?!1:jt("weekday",n.weekday):jt("week",n.weekNumber):jt("weekYear",n.weekYear)}function dv(n){const e=Ns(n.year),t=Xt(n.ordinal,1,Nn(n.year));return e?t?!1:jt("ordinal",n.ordinal):jt("year",n.year)}function Sh(n){const e=Ns(n.year),t=Xt(n.month,1,12),i=Xt(n.day,1,bs(n.year,n.month));return e?t?i?!1:jt("day",n.day):jt("month",n.month):jt("year",n.year)}function Mh(n){const{hour:e,minute:t,second:i,millisecond:r}=n,s=Xt(e,0,23)||e===24&&t===0&&i===0&&r===0,a=Xt(t,0,59),o=Xt(i,0,59),l=Xt(r,0,999);return s?a?o?l?!1:jt("millisecond",r):jt("second",i):jt("minute",t):jt("hour",e)}function De(n){return typeof n>"u"}function tn(n){return typeof n=="number"}function Ns(n){return typeof n=="number"&&n%1===0}function pv(n){return typeof n=="string"}function mv(n){return Object.prototype.toString.call(n)==="[object Date]"}function bh(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function wh(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function gv(n){return Array.isArray(n)?n:[n]}function kc(n,e,t){if(n.length!==0)return n.reduce((i,r)=>{const s=[e(r),r];return i&&t(i[0],s[0])===i[0]?i:s},null)[1]}function _v(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Hn(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Qa(n){if(n==null)return null;if(typeof n!="object")throw new It("Week settings must be an object");if(!Xt(n.firstDay,1,7)||!Xt(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!Xt(e,1,7)))throw new It("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function Xt(n,e,t){return Ns(n)&&n>=e&&n<=t}function xv(n,e){return n-e*Math.floor(n/e)}function ht(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function Ii(n){if(!(De(n)||n===null||n===""))return parseInt(n,10)}function Xi(n){if(!(De(n)||n===null||n===""))return parseFloat(n)}function Mo(n){if(!(De(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function bo(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function wr(n){return n%4===0&&(n%100!==0||n%400===0)}function Nn(n){return wr(n)?366:365}function bs(n,e){const t=xv(e-1,12)+1,i=n+(e-t)/12;return t===2?wr(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Us(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function zc(n,e,t){return-So(yo(n,1,e),t)+e-1}function gr(n,e=4,t=1){const i=zc(n,e,t),r=zc(n+1,e,t);return(Nn(n)-i+r)/7}function eo(n){return n>99?n:n>at.twoDigitCutoffYear?1900+n:2e3+n}function Eh(n,e,t,i=null){const r=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(s.timeZone=i);const a={timeZoneName:e,...s},o=new Intl.DateTimeFormat(t,a).formatToParts(r).find(l=>l.type.toLowerCase()==="timezonename");return o?o.value:null}function Fs(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,r=t<0||Object.is(t,-0)?-i:i;return t*60+r}function Th(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new It(`Invalid unit value ${n}`);return e}function ws(n,e){const t={};for(const i in n)if(Hn(n,i)){const r=n[i];if(r==null)continue;t[e(i)]=Th(r)}return t}function ur(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),r=n>=0?"+":"-";switch(e){case"short":return`${r}${ht(t,2)}:${ht(i,2)}`;case"narrow":return`${r}${t}${i>0?`:${i}`:""}`;case"techie":return`${r}${ht(t,2)}${ht(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function ks(n){return _v(n,["hour","minute","second","millisecond"])}const vv=["January","February","March","April","May","June","July","August","September","October","November","December"],Ah=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yv=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ch(n){switch(n){case"narrow":return[...yv];case"short":return[...Ah];case"long":return[...vv];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Lh=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ph=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Sv=["M","T","W","T","F","S","S"];function Rh(n){switch(n){case"narrow":return[...Sv];case"short":return[...Ph];case"long":return[...Lh];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Dh=["AM","PM"],Mv=["Before Christ","Anno Domini"],bv=["BC","AD"],wv=["B","A"];function Ih(n){switch(n){case"narrow":return[...wv];case"short":return[...bv];case"long":return[...Mv];default:return null}}function Ev(n){return Dh[n.hour<12?0:1]}function Tv(n,e){return Rh(e)[n.weekday-1]}function Av(n,e){return Ch(e)[n.month-1]}function Cv(n,e){return Ih(e)[n.year<0?0:1]}function Lv(n,e,t="always",i=!1){const r={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){const h=n==="days";switch(e){case 1:return h?"tomorrow":`next ${r[n][0]}`;case-1:return h?"yesterday":`last ${r[n][0]}`;case 0:return h?"today":`this ${r[n][0]}`}}const a=Object.is(e,-0)||e<0,o=Math.abs(e),l=o===1,c=r[n],u=i?l?c[1]:c[2]||c[1]:l?r[n][0]:n;return a?`${o} ${u} ago`:`in ${o} ${u}`}function Bc(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const Pv={D:Ss,DD:Ku,DDD:Qu,DDDD:eh,t:th,tt:ih,ttt:nh,tttt:rh,T:sh,TT:ah,TTT:oh,TTTT:lh,f:ch,ff:hh,fff:dh,ffff:mh,F:uh,FF:fh,FFF:ph,FFFF:gh};class Et{static create(e,t={}){return new Et(e,t)}static parseFormat(e){let t=null,i="",r=!1;const s=[];for(let a=0;a0&&s.push({literal:r||/^\s+$/.test(i),val:i}),t=null,i="",r=!r):r||o===t?i+=o:(i.length>0&&s.push({literal:/^\s+$/.test(i),val:i}),i=o,t=o)}return i.length>0&&s.push({literal:r||/^\s+$/.test(i),val:i}),s}static macroTokenToFormatOpts(e){return Pv[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return ht(e,t);const i={...this.opts};return t>0&&(i.padTo=t),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const i=this.loc.listingMode()==="en",r=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(m,g)=>this.loc.extract(e,m,g),a=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",o=()=>i?Ev(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(m,g)=>i?Av(e,m):s(g?{month:m}:{month:m,day:"numeric"},"month"),c=(m,g)=>i?Tv(e,m):s(g?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{const g=Et.macroTokenToFormatOpts(m);return g?this.formatWithSystemDefault(e,g):m},h=m=>i?Cv(e,m):s({era:m},"era"),d=m=>{switch(m){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return o();case"d":return r?s({day:"numeric"},"day"):this.num(e.day);case"dd":return r?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return r?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return r?s({month:"numeric"},"month"):this.num(e.month);case"MM":return r?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return r?s({year:"numeric"},"year"):this.num(e.year);case"yy":return r?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return u(m)}};return Bc(Et.parseFormat(t),d)}formatDurationFromString(e,t){const i=l=>{switch(l[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},r=l=>c=>{const u=i(c);return u?this.num(l.get(u),c.length):c},s=Et.parseFormat(t),a=s.reduce((l,{literal:c,val:u})=>c?l:l.concat(u),[]),o=e.shiftTo(...a.map(i).filter(l=>l));return Bc(s,r(o))}}const Oh=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function jn(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Xn(...n){return e=>n.reduce(([t,i,r],s)=>{const[a,o,l]=s(e,r);return[{...t,...a},o||i,l]},[{},null,1]).slice(0,2)}function Yn(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const r=t.exec(n);if(r)return i(r)}return[null,null]}function Nh(...n){return(e,t)=>{const i={};let r;for(r=0;rm!==void 0&&(g||m&&u)?-m:m;return[{years:d(Xi(t)),months:d(Xi(i)),weeks:d(Xi(r)),days:d(Xi(s)),hours:d(Xi(a)),minutes:d(Xi(o)),seconds:d(Xi(l),l==="-0"),milliseconds:d(Mo(c),h)}]}const Gv={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function To(n,e,t,i,r,s,a){const o={year:e.length===2?eo(Ii(e)):Ii(e),month:Ah.indexOf(t)+1,day:Ii(i),hour:Ii(r),minute:Ii(s)};return a&&(o.second=Ii(a)),n&&(o.weekday=n.length>3?Lh.indexOf(n)+1:Ph.indexOf(n)+1),o}const Wv=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function qv(n){const[,e,t,i,r,s,a,o,l,c,u,h]=n,d=To(e,r,i,t,s,a,o);let m;return l?m=Gv[l]:c?m=0:m=Fs(u,h),[d,new Rt(m)]}function jv(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const Xv=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Yv=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Zv=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Vc(n){const[,e,t,i,r,s,a,o]=n;return[To(e,r,i,t,s,a,o),Rt.utcInstance]}function $v(n){const[,e,t,i,r,s,a,o]=n;return[To(e,o,t,i,r,s,a),Rt.utcInstance]}const Jv=jn(Dv,Eo),Kv=jn(Iv,Eo),Qv=jn(Ov,Eo),ey=jn(Fh),zh=Xn(zv,Zn,Er,Tr),ty=Xn(Nv,Zn,Er,Tr),iy=Xn(Uv,Zn,Er,Tr),ny=Xn(Zn,Er,Tr);function ry(n){return Yn(n,[Jv,zh],[Kv,ty],[Qv,iy],[ey,ny])}function sy(n){return Yn(jv(n),[Wv,qv])}function ay(n){return Yn(n,[Xv,Vc],[Yv,Vc],[Zv,$v])}function oy(n){return Yn(n,[Vv,Hv])}const ly=Xn(Zn);function cy(n){return Yn(n,[Bv,ly])}const uy=jn(Fv,kv),hy=jn(kh),fy=Xn(Zn,Er,Tr);function dy(n){return Yn(n,[uy,zh],[hy,fy])}const Hc="Invalid Duration",Bh={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},py={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Bh},Ht=146097/400,An=146097/4800,my={years:{quarters:4,months:12,weeks:Ht/7,days:Ht,hours:Ht*24,minutes:Ht*24*60,seconds:Ht*24*60*60,milliseconds:Ht*24*60*60*1e3},quarters:{months:3,weeks:Ht/28,days:Ht/4,hours:Ht*24/4,minutes:Ht*24*60/4,seconds:Ht*24*60*60/4,milliseconds:Ht*24*60*60*1e3/4},months:{weeks:An/7,days:An,hours:An*24,minutes:An*24*60,seconds:An*24*60*60,milliseconds:An*24*60*60*1e3},...Bh},Ji=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],gy=Ji.slice(0).reverse();function Ri(n,e,t=!1){const i={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new Xe(i)}function Vh(n,e){let t=e.milliseconds??0;for(const i of gy.slice(1))e[i]&&(t+=e[i]*n[i].milliseconds);return t}function Gc(n,e){const t=Vh(n,e)<0?-1:1;Ji.reduceRight((i,r)=>{if(De(e[r]))return i;if(i){const s=e[i]*t,a=n[r][i],o=Math.floor(s/a);e[r]+=o*t,e[i]-=o*a*t}return r},null),Ji.reduce((i,r)=>{if(De(e[r]))return i;if(i){const s=e[i]%1;e[i]-=s,e[r]+=s*n[i][r]}return r},null)}function _y(n){const e={};for(const[t,i]of Object.entries(n))i!==0&&(e[t]=i);return e}class Xe{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let i=t?my:py;e.matrix&&(i=e.matrix),this.values=e.values,this.loc=e.loc||Je.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(e,t){return Xe.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new It(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new Xe({values:ws(e,Xe.normalizeUnit),loc:Je.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(tn(e))return Xe.fromMillis(e);if(Xe.isDuration(e))return e;if(typeof e=="object")return Xe.fromObject(e);throw new It(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=oy(e);return i?Xe.fromObject(i,t):Xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=cy(e);return i?Xe.fromObject(i,t):Xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new It("need to specify a reason the Duration is invalid");const i=e instanceof ni?e:new ni(e,t);if(at.throwOnInvalid)throw new Wx(i);return new Xe({invalid:i})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Ju(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const i={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Et.create(this.loc,i).formatDurationFromString(this,e):Hc}toHuman(e={}){if(!this.isValid)return Hc;const t=Ji.map(i=>{const r=this.values[i];return De(r)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(r)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=bo(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},Ue.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Vh(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=Xe.fromDurationLike(e),i={};for(const r of Ji)(Hn(t.values,r)||Hn(this.values,r))&&(i[r]=t.get(r)+this.get(r));return Ri(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=Xe.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const i of Object.keys(this.values))t[i]=Th(e(this.values[i],i));return Ri(this,{values:t},!0)}get(e){return this[Xe.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...ws(e,Xe.normalizeUnit)};return Ri(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i,matrix:r}={}){const a={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:i};return Ri(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Gc(this.matrix,e),Ri(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=_y(this.normalize().shiftToAll().toObject());return Ri(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>Xe.normalizeUnit(a));const t={},i={},r=this.toObject();let s;for(const a of Ji)if(e.indexOf(a)>=0){s=a;let o=0;for(const c in i)o+=this.matrix[c][a]*i[c],i[c]=0;tn(r[a])&&(o+=r[a]);const l=Math.trunc(o);t[a]=l,i[a]=(o*1e3-l*1e3)/1e3}else tn(r[a])&&(i[a]=r[a]);for(const a in i)i[a]!==0&&(t[s]+=a===s?i[a]:i[a]/this.matrix[s][a]);return Gc(this.matrix,t),Ri(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Ri(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(i,r){return i===void 0||i===0?r===void 0||r===0:i===r}for(const i of Ji)if(!t(this.values[i],e.values[i]))return!1;return!0}}const Cn="Invalid Interval";function xy(n,e){return!n||!n.isValid?nt.invalid("missing or invalid start"):!e||!e.isValid?nt.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?nt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(rr).filter(a=>this.contains(a)).sort((a,o)=>a.toMillis()-o.toMillis()),i=[];let{s:r}=this,s=0;for(;r+this.e?this.e:a;i.push(nt.fromDateTimes(r,o)),r=o,s+=1}return i}splitBy(e){const t=Xe.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,r=1,s;const a=[];for(;il*r));s=+o>+this.e?this.e:o,a.push(nt.fromDateTimes(i,s)),i=s,r+=1}return a}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,i=this.e=i?null:nt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return nt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((r,s)=>r.s-s.s).reduce(([r,s],a)=>s?s.overlaps(a)||s.abutsStart(a)?[r,s.union(a)]:[r.concat([s]),a]:[r,a],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const r=[],s=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),a=Array.prototype.concat(...s),o=a.sort((l,c)=>l.time-c.time);for(const l of o)i+=l.type==="s"?1:-1,i===1?t=l.time:(t&&+t!=+l.time&&r.push(nt.fromDateTimes(t,l.time)),t=null);return nt.merge(r)}difference(...e){return nt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:Cn}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Ss,t={}){return this.isValid?Et.create(this.s.loc.clone(t),e).formatInterval(this):Cn}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Cn}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Cn}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Cn}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Cn}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):Xe.invalid(this.invalidReason)}mapEndpoints(e){return nt.fromDateTimes(e(this.s),e(this.e))}}class rs{static hasDST(e=at.defaultZone){const t=Ue.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return bi.isValidZone(e)}static normalizeZone(e){return Oi(e,at.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Je.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Je.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Je.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null,outputCalendar:s="gregory"}={}){return(r||Je.create(t,i,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null,outputCalendar:s="gregory"}={}){return(r||Je.create(t,i,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null}={}){return(r||Je.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:r=null}={}){return(r||Je.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Je.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Je.create(t,null,"gregory").eras(e)}static features(){return{relative:bh(),localeWeek:wh()}}}function Wc(n,e){const t=r=>r.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(Xe.fromMillis(i).as("days"))}function vy(n,e,t){const i=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{const u=Wc(l,c);return(u-u%7)/7}],["days",Wc]],r={},s=n;let a,o;for(const[l,c]of i)t.indexOf(l)>=0&&(a=l,r[l]=c(n,e),o=s.plus(r),o>e?(r[l]--,n=s.plus(r),n>e&&(o=n,r[l]--,n=s.plus(r))):n=o);return[n,r,o,a]}function yy(n,e,t,i){let[r,s,a,o]=vy(n,e,t);const l=e-r,c=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);c.length===0&&(a0?Xe.fromMillis(l,i).shiftTo(...c).plus(u):u}const Ao={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},qc={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Sy=Ao.hanidec.replace(/[\[|\]]/g,"").split("");function My(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=s&&i<=a&&(e+=i-s)}}return parseInt(e,10)}else return e}function Kt({numberingSystem:n},e=""){return new RegExp(`${Ao[n||"latn"]}${e}`)}const by="missing Intl.DateTimeFormat.formatToParts support";function Ye(n,e=t=>t){return{regex:n,deser:([t])=>e(My(t))}}const wy=" ",Hh=`[ ${wy}]`,Gh=new RegExp(Hh,"g");function Ey(n){return n.replace(/\./g,"\\.?").replace(Gh,Hh)}function jc(n){return n.replace(/\./g,"").replace(Gh," ").toLowerCase()}function Qt(n,e){return n===null?null:{regex:RegExp(n.map(Ey).join("|")),deser:([t])=>n.findIndex(i=>jc(t)===jc(i))+e}}function Xc(n,e){return{regex:n,deser:([,t,i])=>Fs(t,i),groups:e}}function ss(n){return{regex:n,deser:([e])=>e}}function Ty(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ay(n,e){const t=Kt(e),i=Kt(e,"{2}"),r=Kt(e,"{3}"),s=Kt(e,"{4}"),a=Kt(e,"{6}"),o=Kt(e,"{1,2}"),l=Kt(e,"{1,3}"),c=Kt(e,"{1,6}"),u=Kt(e,"{1,9}"),h=Kt(e,"{2,4}"),d=Kt(e,"{4,6}"),m=p=>({regex:RegExp(Ty(p.val)),deser:([f])=>f,literal:!0}),_=(p=>{if(n.literal)return m(p);switch(p.val){case"G":return Qt(e.eras("short"),0);case"GG":return Qt(e.eras("long"),0);case"y":return Ye(c);case"yy":return Ye(h,eo);case"yyyy":return Ye(s);case"yyyyy":return Ye(d);case"yyyyyy":return Ye(a);case"M":return Ye(o);case"MM":return Ye(i);case"MMM":return Qt(e.months("short",!0),1);case"MMMM":return Qt(e.months("long",!0),1);case"L":return Ye(o);case"LL":return Ye(i);case"LLL":return Qt(e.months("short",!1),1);case"LLLL":return Qt(e.months("long",!1),1);case"d":return Ye(o);case"dd":return Ye(i);case"o":return Ye(l);case"ooo":return Ye(r);case"HH":return Ye(i);case"H":return Ye(o);case"hh":return Ye(i);case"h":return Ye(o);case"mm":return Ye(i);case"m":return Ye(o);case"q":return Ye(o);case"qq":return Ye(i);case"s":return Ye(o);case"ss":return Ye(i);case"S":return Ye(l);case"SSS":return Ye(r);case"u":return ss(u);case"uu":return ss(o);case"uuu":return Ye(t);case"a":return Qt(e.meridiems(),0);case"kkkk":return Ye(s);case"kk":return Ye(h,eo);case"W":return Ye(o);case"WW":return Ye(i);case"E":case"c":return Ye(t);case"EEE":return Qt(e.weekdays("short",!1),1);case"EEEE":return Qt(e.weekdays("long",!1),1);case"ccc":return Qt(e.weekdays("short",!0),1);case"cccc":return Qt(e.weekdays("long",!0),1);case"Z":case"ZZ":return Xc(new RegExp(`([+-]${o.source})(?::(${i.source}))?`),2);case"ZZZ":return Xc(new RegExp(`([+-]${o.source})(${i.source})?`),2);case"z":return ss(/[a-z_+-/]{1,256}?/i);case" ":return ss(/[^\S\n\r]/);default:return m(p)}})(n)||{invalidReason:by};return _.token=n,_}const Cy={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Ly(n,e,t){const{type:i,value:r}=n;if(i==="literal"){const l=/^\s+$/.test(r);return{literal:!l,val:l?" ":r}}const s=e[i];let a=i;i==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=t.hour12?"hour12":"hour24");let o=Cy[a];if(typeof o=="object"&&(o=o[s]),o)return{literal:!1,val:o}}function Py(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function Ry(n,e,t){const i=n.match(e);if(i){const r={};let s=1;for(const a in t)if(Hn(t,a)){const o=t[a],l=o.groups?o.groups+1:1;!o.literal&&o.token&&(r[o.token.val[0]]=o.deser(i.slice(s,s+l))),s+=l}return[i,r]}else return[i,{}]}function Dy(n){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,i;return De(n.z)||(t=bi.create(n.z)),De(n.Z)||(t||(t=new Rt(n.Z)),i=n.Z),De(n.q)||(n.M=(n.q-1)*3+1),De(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),De(n.u)||(n.S=Mo(n.u)),[Object.keys(n).reduce((s,a)=>{const o=e(a);return o&&(s[o]=n[a]),s},{}),t,i]}let La=null;function Iy(){return La||(La=Ue.fromMillis(1555555555555)),La}function Oy(n,e){if(n.literal)return n;const t=Et.macroTokenToFormatOpts(n.val),i=jh(t,e);return i==null||i.includes(void 0)?n:i}function Wh(n,e){return Array.prototype.concat(...n.map(t=>Oy(t,e)))}function qh(n,e,t){const i=Wh(Et.parseFormat(t),n),r=i.map(a=>Ay(a,n)),s=r.find(a=>a.invalidReason);if(s)return{input:e,tokens:i,invalidReason:s.invalidReason};{const[a,o]=Py(r),l=RegExp(a,"i"),[c,u]=Ry(e,l,o),[h,d,m]=u?Dy(u):[null,null,void 0];if(Hn(u,"a")&&Hn(u,"H"))throw new Dn("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:l,rawMatches:c,matches:u,result:h,zone:d,specificOffset:m}}}function Ny(n,e,t){const{result:i,zone:r,specificOffset:s,invalidReason:a}=qh(n,e,t);return[i,r,s,a]}function jh(n,e){if(!n)return null;const i=Et.create(e,n).dtFormatter(Iy()),r=i.formatToParts(),s=i.resolvedOptions();return r.map(a=>Ly(a,n,s))}const Pa="Invalid DateTime",Yc=864e13;function as(n){return new ni("unsupported zone",`the zone "${n.name}" is not supported`)}function Ra(n){return n.weekData===null&&(n.weekData=Ms(n.c)),n.weekData}function Da(n){return n.localWeekData===null&&(n.localWeekData=Ms(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function Yi(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new Ue({...t,...e,old:t})}function Xh(n,e,t){let i=n-e*60*1e3;const r=t.offset(i);if(e===r)return[i,e];i-=(r-e)*60*1e3;const s=t.offset(i);return r===s?[i,r]:[n-Math.min(r,s)*60*1e3,Math.max(r,s)]}function os(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function ps(n,e,t){return Xh(Us(n),e,t)}function Zc(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),r=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:i,month:r,day:Math.min(n.c.day,bs(i,r))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=Xe.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),o=Us(s);let[l,c]=Xh(o,t,n.zone);return a!==0&&(l+=a,c=n.zone.offset(l)),{ts:l,o:c}}function nr(n,e,t,i,r,s){const{setZone:a,zone:o}=t;if(n&&Object.keys(n).length!==0||e){const l=e||o,c=Ue.fromObject(n,{...t,zone:l,specificOffset:s});return a?c:c.setZone(o)}else return Ue.invalid(new ni("unparsable",`the input "${r}" can't be parsed as ${i}`))}function ls(n,e,t=!0){return n.isValid?Et.create(Je.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function Ia(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=ht(n.c.year,t?6:4),e?(i+="-",i+=ht(n.c.month),i+="-",i+=ht(n.c.day)):(i+=ht(n.c.month),i+=ht(n.c.day)),i}function $c(n,e,t,i,r,s){let a=ht(n.c.hour);return e?(a+=":",a+=ht(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(a+=":")):a+=ht(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(a+=ht(n.c.second),(n.c.millisecond!==0||!i)&&(a+=".",a+=ht(n.c.millisecond,3))),r&&(n.isOffsetFixed&&n.offset===0&&!s?a+="Z":n.o<0?(a+="-",a+=ht(Math.trunc(-n.o/60)),a+=":",a+=ht(Math.trunc(-n.o%60))):(a+="+",a+=ht(Math.trunc(n.o/60)),a+=":",a+=ht(Math.trunc(n.o%60)))),s&&(a+="["+n.zone.ianaName+"]"),a}const Yh={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Uy={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Fy={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Zh=["year","month","day","hour","minute","second","millisecond"],ky=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],zy=["year","ordinal","hour","minute","second","millisecond"];function By(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Ju(n);return e}function Jc(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return By(n)}}function Kc(n,e){const t=Oi(e.zone,at.defaultZone),i=Je.fromObject(e),r=at.now();let s,a;if(De(n.year))s=r;else{for(const c of Zh)De(n[c])&&(n[c]=Yh[c]);const o=Sh(n)||Mh(n);if(o)return Ue.invalid(o);const l=t.offset(r);[s,a]=ps(n,l,t)}return new Ue({ts:s,zone:t,loc:i,o:a})}function Qc(n,e,t){const i=De(t.round)?!0:t.round,r=(a,o)=>(a=bo(a,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(a,o)),s=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return r(s(t.unit),t.unit);for(const a of t.units){const o=s(a);if(Math.abs(o)>=1)return r(o,a)}return r(n>e?-0:0,t.units[t.units.length-1])}function eu(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}class Ue{constructor(e){const t=e.zone||at.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new ni("invalid input"):null)||(t.isValid?null:as(t));this.ts=De(e.ts)?at.now():e.ts;let r=null,s=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,s]=[e.old.c,e.old.o];else{const o=t.offset(this.ts);r=os(this.ts,o),i=Number.isNaN(r.year)?new ni("invalid input"):null,r=i?null:r,s=i?null:o}this._zone=t,this.loc=e.loc||Je.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=r,this.o=s,this.isLuxonDateTime=!0}static now(){return new Ue({})}static local(){const[e,t]=eu(arguments),[i,r,s,a,o,l,c]=t;return Kc({year:i,month:r,day:s,hour:a,minute:o,second:l,millisecond:c},e)}static utc(){const[e,t]=eu(arguments),[i,r,s,a,o,l,c]=t;return e.zone=Rt.utcInstance,Kc({year:i,month:r,day:s,hour:a,minute:o,second:l,millisecond:c},e)}static fromJSDate(e,t={}){const i=mv(e)?e.valueOf():NaN;if(Number.isNaN(i))return Ue.invalid("invalid input");const r=Oi(t.zone,at.defaultZone);return r.isValid?new Ue({ts:i,zone:r,loc:Je.fromObject(t)}):Ue.invalid(as(r))}static fromMillis(e,t={}){if(tn(e))return e<-Yc||e>Yc?Ue.invalid("Timestamp out of range"):new Ue({ts:e,zone:Oi(t.zone,at.defaultZone),loc:Je.fromObject(t)});throw new It(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(tn(e))return new Ue({ts:e*1e3,zone:Oi(t.zone,at.defaultZone),loc:Je.fromObject(t)});throw new It("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Oi(t.zone,at.defaultZone);if(!i.isValid)return Ue.invalid(as(i));const r=Je.fromObject(t),s=ws(e,Jc),{minDaysInFirstWeek:a,startOfWeek:o}=Fc(s,r),l=at.now(),c=De(t.specificOffset)?i.offset(l):t.specificOffset,u=!De(s.ordinal),h=!De(s.year),d=!De(s.month)||!De(s.day),m=h||d,g=s.weekYear||s.weekNumber;if((m||u)&&g)throw new Dn("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new Dn("Can't mix ordinal dates with month/day");const _=g||s.weekday&&!m;let p,f,b=os(l,c);_?(p=ky,f=Uy,b=Ms(b,a,o)):u?(p=zy,f=Fy,b=Ca(b)):(p=Zh,f=Yh);let x=!1;for(const w of p){const z=s[w];De(z)?x?s[w]=f[w]:s[w]=b[w]:x=!0}const C=_?fv(s,a,o):u?dv(s):Sh(s),E=C||Mh(s);if(E)return Ue.invalid(E);const P=_?Nc(s,a,o):u?Uc(s):s,[T,F]=ps(P,c,i),y=new Ue({ts:T,zone:i,o:F,loc:r});return s.weekday&&m&&e.weekday!==y.weekday?Ue.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${y.toISO()}`):y}static fromISO(e,t={}){const[i,r]=ry(e);return nr(i,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,r]=sy(e);return nr(i,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,r]=ay(e);return nr(i,r,t,"HTTP",t)}static fromFormat(e,t,i={}){if(De(e)||De(t))throw new It("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:s=null}=i,a=Je.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0}),[o,l,c,u]=Ny(a,e,t);return u?Ue.invalid(u):nr(o,l,i,`format ${t}`,e,c)}static fromString(e,t,i={}){return Ue.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,r]=dy(e);return nr(i,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new It("need to specify a reason the DateTime is invalid");const i=e instanceof ni?e:new ni(e,t);if(at.throwOnInvalid)throw new Hx(i);return new Ue({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const i=jh(e,Je.fromObject(t));return i?i.map(r=>r?r.val:null).join(""):null}static expandFormat(e,t={}){return Wh(Et.parseFormat(e),Je.fromObject(t)).map(r=>r.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Ra(this).weekYear:NaN}get weekNumber(){return this.isValid?Ra(this).weekNumber:NaN}get weekday(){return this.isValid?Ra(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Da(this).weekday:NaN}get localWeekNumber(){return this.isValid?Da(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Da(this).weekYear:NaN}get ordinal(){return this.isValid?Ca(this.c).ordinal:NaN}get monthShort(){return this.isValid?rs.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?rs.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?rs.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?rs.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,i=Us(this.c),r=this.zone.offset(i-e),s=this.zone.offset(i+e),a=this.zone.offset(i-r*t),o=this.zone.offset(i-s*t);if(a===o)return[this];const l=i-a*t,c=i-o*t,u=os(l,a),h=os(c,o);return u.hour===h.hour&&u.minute===h.minute&&u.second===h.second&&u.millisecond===h.millisecond?[Yi(this,{ts:l}),Yi(this,{ts:c})]:[this]}get isInLeapYear(){return wr(this.year)}get daysInMonth(){return bs(this.year,this.month)}get daysInYear(){return this.isValid?Nn(this.year):NaN}get weeksInWeekYear(){return this.isValid?gr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?gr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:r}=Et.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(Rt.instance(e),t)}toLocal(){return this.setZone(at.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Oi(e,at.defaultZone),e.equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||i){const s=e.offset(this.ts),a=this.toObject();[r]=ps(a,s,e)}return Yi(this,{ts:r,zone:e})}else return Ue.invalid(as(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return Yi(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=ws(e,Jc),{minDaysInFirstWeek:i,startOfWeek:r}=Fc(t,this.loc),s=!De(t.weekYear)||!De(t.weekNumber)||!De(t.weekday),a=!De(t.ordinal),o=!De(t.year),l=!De(t.month)||!De(t.day),c=o||l,u=t.weekYear||t.weekNumber;if((c||a)&&u)throw new Dn("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&a)throw new Dn("Can't mix ordinal dates with month/day");let h;s?h=Nc({...Ms(this.c,i,r),...t},i,r):De(t.ordinal)?(h={...this.toObject(),...t},De(t.day)&&(h.day=Math.min(bs(h.year,h.month),h.day))):h=Uc({...Ca(this.c),...t});const[d,m]=ps(h,this.o,this.zone);return Yi(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;const t=Xe.fromDurationLike(e);return Yi(this,Zc(this,t))}minus(e){if(!this.isValid)return this;const t=Xe.fromDurationLike(e).negate();return Yi(this,Zc(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const i={},r=Xe.normalizeUnit(e);switch(r){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(r==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:a}=this;athis.valueOf(),o=a?this:e,l=a?e:this,c=yy(o,l,s,r);return a?c.negate():c}diffNow(e="milliseconds",t={}){return this.diff(Ue.now(),e,t)}until(e){return this.isValid?nt.fromDateTimes(this,e):this}hasSame(e,t,i){if(!this.isValid)return!1;const r=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,i)<=r&&r<=s.endOf(t,i)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||Ue.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(Ue.isDateTime))throw new It("max requires all arguments be DateTimes");return kc(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:r=null,numberingSystem:s=null}=i,a=Je.fromOpts({locale:r,numberingSystem:s,defaultToEN:!0});return qh(a,e,t)}static fromStringExplain(e,t,i={}){return Ue.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return Ss}static get DATE_MED(){return Ku}static get DATE_MED_WITH_WEEKDAY(){return qx}static get DATE_FULL(){return Qu}static get DATE_HUGE(){return eh}static get TIME_SIMPLE(){return th}static get TIME_WITH_SECONDS(){return ih}static get TIME_WITH_SHORT_OFFSET(){return nh}static get TIME_WITH_LONG_OFFSET(){return rh}static get TIME_24_SIMPLE(){return sh}static get TIME_24_WITH_SECONDS(){return ah}static get TIME_24_WITH_SHORT_OFFSET(){return oh}static get TIME_24_WITH_LONG_OFFSET(){return lh}static get DATETIME_SHORT(){return ch}static get DATETIME_SHORT_WITH_SECONDS(){return uh}static get DATETIME_MED(){return hh}static get DATETIME_MED_WITH_SECONDS(){return fh}static get DATETIME_MED_WITH_WEEKDAY(){return jx}static get DATETIME_FULL(){return dh}static get DATETIME_FULL_WITH_SECONDS(){return ph}static get DATETIME_HUGE(){return mh}static get DATETIME_HUGE_WITH_SECONDS(){return gh}}function rr(n){if(Ue.isDateTime(n))return n;if(n&&n.valueOf&&tn(n.valueOf()))return Ue.fromJSDate(n);if(n&&typeof n=="object")return Ue.fromObject(n);throw new It(`Unknown datetime argument: ${n}, of type ${typeof n}`)}export{Xo as A,Ot as B,Ze as C,Ue as D,Dt as F,Yr as G,zu as L,Gy as M,wu as O,Hy as P,Xy as R,Gu as S,Vy as T,Qp as U,R as V,qy as W,yi as a,rn as b,Zt as c,Ud as d,bu as e,Wy as f,rm as g,jy as h,pt as i,Yy as j,Wt as k,Zy as l,Oe as m}; diff --git a/index.html b/index.html index d8db6bf..7167be4 100644 --- a/index.html +++ b/index.html @@ -27,8 +27,8 @@ Stuff in Space - - + +