@navaramap/three 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2243,7 +2243,7 @@ void main() {
2243
2243
 
2244
2244
  gl_PointSize = pointSize;
2245
2245
  }
2246
- `,tC=Object.defineProperty,nC=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&tC(t,n,i),i},rC={...Xb,pointSize:1,intensity:1,background:!0,ground:!0},iC=class extends Zb{constructor(e){let{pointSize:t,intensity:n,background:i,ground:a,...o}={...rC,...e};super({name:`StarsMaterial`,glslVersion:r.GLSL3,vertexShader:eC,fragmentShader:$y($S,{bruneton:{common:Db,definitions:Ob,runtime:kb}}),...o,uniforms:{projectionMatrix:new r.Uniform(new r.Matrix4),modelViewMatrix:new r.Uniform(new r.Matrix4),viewMatrix:new r.Uniform(new r.Matrix4),matrixWorld:new r.Uniform(new r.Matrix4),cameraFar:new r.Uniform(0),pointSize:new r.Uniform(0),magnitudeRange:new r.Uniform(new r.Vector2(-2,8)),intensity:new r.Uniform(n),...o.uniforms},defines:{PERSPECTIVE_CAMERA:`1`},depthWrite:!0,depthTest:!0}),this.pointSize=t,this.background=i,this.ground=a}onBeforeRender(e,t,n,r,i,a){super.onBeforeRender(e,t,n,r,i,a);let o=this.uniforms;o.projectionMatrix.value.copy(n.projectionMatrix),o.modelViewMatrix.value.copy(n.modelViewMatrix),o.viewMatrix.value.copy(n.matrixWorldInverse),o.matrixWorld.value.copy(i.matrixWorld),o.cameraFar.value=n.far,o.pointSize.value=this.pointSize*e.getPixelRatio();let s=n.isPerspectiveCamera===!0;this.defines.PERSPECTIVE_CAMERA!=null!==s&&(s?this.defines.PERSPECTIVE_CAMERA=`1`:delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}get magnitudeRange(){return this.uniforms.magnitudeRange.value}get intensity(){return this.uniforms.intensity.value}set intensity(e){this.uniforms.intensity.value=e}};nC([Ky(`BACKGROUND`)],iC.prototype,`background`),nC([Ky(`GROUND`)],iC.prototype,`ground`),Sg.WGS84;var aC=class extends M{raw;_core;_status;constructor(e){super(),this.raw=e instanceof r.PerspectiveCamera?e:new r.PerspectiveCamera}set core(e){this._core=e}updateStatus(){if(this._status=this._core?.getCameraStatus(),this._status)for(let e of this._status.status)switch(e){case t.CameraStatusType.MoveStart:this.emit(`movestart`);break;case t.CameraStatusType.Moving:this.emit(`move`);break;case t.CameraStatusType.MoveEnd:case t.CameraStatusType.LookAt:case t.CameraStatusType.Rotate:this.emit(`moveend`)}}get positionECEF(){let e=this._core?.getCameraPositionECEF();return z(e),{x:e[0],y:e[1],z:e[2]}}get positionGeographic(){let e=this._core?.getCameraPositionLLE();return z(e),{lng:e[0],lat:e[1],height:e[2]}}get orientation(){let e=this._core?.getCameraOrientation();return z(e),{heading:e.heading,pitch:e.pitch,roll:e.roll}}get zoom(){return this._core?.getZoomLevel()}get fov(){let e=this._core?.getCameraFOV();return e===void 0?void 0:al(e)}set fov(e){e<1||e>180||this._core?.setFrustum(e,void 0,void 0)}set near(e){e<=0||this._core?.setFrustum(void 0,e,void 0)}get near(){return this.raw.near}set far(e){e<=this.raw.near||this._core?.setFrustum(void 0,void 0,e)}get far(){return this.raw.far}set options(e){let n=new t.CameraControlUpdateEvent;e.autoAdjustNearFar!==void 0&&(n.autoAdjustNearFar=e.autoAdjustNearFar),e.minimumZoomDistance!==void 0&&(n.minimumZoomDistance=e.minimumZoomDistance),e.maximumZoomDistance!==void 0&&(n.maximumZoomDistance=e.maximumZoomDistance),e.spinSpeed!==void 0&&(n.spinSpeed=e.spinSpeed),e.zoomSpeed!==void 0&&(n.zoomSpeed=e.zoomSpeed),e.spinDuration!==void 0&&(n.spinDuration=e.spinDuration),e.zoomDuration!==void 0&&(n.zoomDuration=e.zoomDuration),e.translateDuration!==void 0&&(n.translateDuration=e.translateDuration),e.enableSpin!==void 0&&(n.enableSpin=e.enableSpin),e.enableZoom!==void 0&&(n.enableZoom=e.enableZoom),e.enableTilt!==void 0&&(n.enableTilt=e.enableTilt),this._core?.setCameraControl(n)}},oC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/transmittance.exr`).href:new URL(`assets/atmosphere/transmittance.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),sC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/scattering.exr`).href:new URL(`assets/atmosphere/scattering.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),cC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/irradiance.exr`).href:new URL(`assets/atmosphere/irradiance.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),lC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/higher_order_scattering.exr`).href:new URL(`assets/atmosphere/higher_order_scattering.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),uC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/single_mie_scattering.exr`).href:new URL(`assets/atmosphere/single_mie_scattering.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),dC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/stars.bin`).href:new URL(`assets/atmosphere/stars.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),fC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/local_weather.png`).href:new URL(`assets/cloud/local_weather.png`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),pC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/shape.bin`).href:new URL(`assets/cloud/shape.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),mC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/shape_detail.bin`).href:new URL(`assets/cloud/shape_detail.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),hC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/turbulence.png`).href:new URL(`assets/cloud/turbulence.png`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),gC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/noise/stbn.bin`).href:new URL(`assets/noise/stbn.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),_C=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/water/waternormals.jpg`).href:new URL(`assets/water/waternormals.jpg`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),vC={"transmittance.exr":oC,"scattering.exr":sC,"irradiance.exr":cC,"higher_order_scattering.exr":lC,"single_mie_scattering.exr":uC},yC=()=>t.ElevationDecoder.japanGSI(),bC=()=>t.ElevationDecoder.mapbox(),xC=()=>t.ElevationDecoder.terrarium(),SC=173.1446326846693,CC=149597870.69098932,wC=.017453292519943295,TC=.26179938779914946,EC=57.29577951308232,DC=3.819718634205488,OC=365.24217,kC=new Date(`2000-01-01T12:00:00Z`),AC=2*Math.PI,jC=180/Math.PI*3600,MC=484813681109536e-20,NC=648e3,PC=2*NC,FC=7292115e-11,IC=NC/Math.PI;-.17-5*Math.log10(IC);var LC=86400;LC*1e3;var RC=.9972695717592592;695700/CC;var zC=.996647180302104,BC=zC*zC,VC=6378.1366,HC=VC/CC;VC*zC,1738.1/CC,1736/CC;var UC=81.30056,WC=.0002959122082855911,GC=8887692390113509e-25,KC=2.825345909524226e-7,qC=8.459715185680659e-8,JC=1.292024916781969e-8,YC=1.524358900784276e-8;GC/UC;function XC(e){if(e!==!0&&e!==!1)throw console.trace(),`Value is not boolean: ${e}`;return e}function Y(e){if(!Number.isFinite(e))throw console.trace(),`Value is not a finite number: ${e}`;return e}function ZC(e){return e-Math.floor(e)}var X;(function(e){e.Sun=`Sun`,e.Moon=`Moon`,e.Mercury=`Mercury`,e.Venus=`Venus`,e.Earth=`Earth`,e.Mars=`Mars`,e.Jupiter=`Jupiter`,e.Saturn=`Saturn`,e.Uranus=`Uranus`,e.Neptune=`Neptune`,e.Pluto=`Pluto`,e.SSB=`SSB`,e.EMB=`EMB`,e.Star1=`Star1`,e.Star2=`Star2`,e.Star3=`Star3`,e.Star4=`Star4`,e.Star5=`Star5`,e.Star6=`Star6`,e.Star7=`Star7`,e.Star8=`Star8`})(X||={});var QC=[X.Star1,X.Star2,X.Star3,X.Star4,X.Star5,X.Star6,X.Star7,X.Star8],$C=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function ew(e){let t=QC.indexOf(e);return t>=0?$C[t]:null}function tw(e){let t=ew(e);return t&&t.dist>0?t:null}var nw;(function(e){e[e.From2000=0]=`From2000`,e[e.Into2000=1]=`Into2000`})(nw||={});var rw={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[8.5831e-7,1.27079125277,161000.6857376741],[5.7056e-7,2.01374292245,83996.84731811189],[5.5736e-7,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function iw(e){var t,n,r,i,a,o,s;let c=2e3+(e-14)/OC;return c<-500?(t=(c-1820)/100,-20+32*t*t):c<500?(t=c/100,n=t*t,r=t*n,i=n*n,a=n*r,o=r*r,10583.6-1014.41*t+33.78311*n-5.952053*r-.1798452*i+.022174192*a+.0090316521*o):c<1600?(t=(c-1e3)/100,n=t*t,r=t*n,i=n*n,a=n*r,o=r*r,1574.2-556.01*t+71.23472*n+.319781*r-.8503463*i-.005050998*a+.0083572073*o):c<1700?(t=c-1600,n=t*t,r=t*n,120-.9808*t-.01532*n+r/7129):c<1800?(t=c-1700,n=t*t,r=t*n,i=n*n,8.83+.1603*t-.0059285*n+13336e-8*r-i/1174e3):c<1860?(t=c-1800,n=t*t,r=t*n,i=n*n,a=n*r,o=r*r,s=r*i,13.72-.332447*t+.0068612*n+.0041116*r-37436e-8*i+121272e-10*a-1.699e-7*o+875e-12*s):c<1900?(t=c-1860,n=t*t,r=t*n,i=n*n,a=n*r,7.62+.5737*t-.251754*n+.01680668*r-.0004473624*i+a/233174):c<1920?(t=c-1900,n=t*t,r=t*n,i=n*n,-2.79+1.494119*t-.0598939*n+.0061966*r-197e-6*i):c<1941?(t=c-1920,n=t*t,r=t*n,21.2+.84493*t-.0761*n+.0020936*r):c<1961?(t=c-1950,n=t*t,r=t*n,29.07+.407*t-n/233+r/2547):c<1986?(t=c-1975,n=t*t,r=t*n,45.45+1.067*t-n/260-r/718):c<2005?(t=c-2e3,n=t*t,r=t*n,i=n*n,a=n*r,63.86+.3345*t-.060374*n+.0017275*r+651814e-9*i+2373599e-11*a):c<2050?(t=c-2e3,62.92+.32217*t+.005589*t*t):c<2150?(t=(c-1820)/100,-20+32*t*t-.5628*(2150-c)):(t=(c-1820)/100,-20+32*t*t)}var aw=iw;function ow(e){return e+aw(e)/86400}var sw=class e{constructor(t){if(t instanceof e){this.date=t.date,this.ut=t.ut,this.tt=t.tt;return}let n=864e5;if(t instanceof Date&&Number.isFinite(t.getTime())){this.date=t,this.ut=(t.getTime()-kC.getTime())/n,this.tt=ow(this.ut);return}if(Number.isFinite(t)){this.date=new Date(kC.getTime()+t*n),this.ut=t,this.tt=ow(this.ut);return}throw`Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date.`}static FromTerrestrialTime(t){let n=new e(t);for(;;){let e=t-n.tt;if(Math.abs(e)<1e-12)return n;n=n.AddDays(e)}}toString(){return this.date.toISOString()}AddDays(t){return new e(this.ut+t)}};function cw(e,t,n){return new sw(e.ut+n*(t.ut-e.ut))}function lw(e){return e instanceof sw?e:new sw(e)}function uw(e){function t(e){return e%PC*MC}let n=e.tt/36525,r=t(1287104.79305+n*129596581.0481),i=t(335779.526232+n*1739527262.8478),a=t(1072260.70369+n*1602961601.209),o=t(450160.398036-n*6962890.5431),s=Math.sin(o),c=Math.cos(o),l=(-172064161-174666*n)*s+33386*c,u=(92052331+9086*n)*c+15377*s,d=2*(i-a+o);return s=Math.sin(d),c=Math.cos(d),l+=(-13170906-1675*n)*s-13696*c,u+=(5730336-3015*n)*c-4587*s,d=2*(i+o),s=Math.sin(d),c=Math.cos(d),l+=(-2276413-234*n)*s+2796*c,u+=(978459-485*n)*c+1374*s,d=2*o,s=Math.sin(d),c=Math.cos(d),l+=(2074554+207*n)*s-698*c,u+=(-897492+470*n)*c-291*s,s=Math.sin(r),c=Math.cos(r),l+=(1475877-3633*n)*s+11817*c,u+=(73871-184*n)*c-1924*s,{dpsi:-135e-6+l*1e-7,deps:388e-6+u*1e-7}}function dw(e){var t=e.tt/36525;return(((((-4.34e-8*t-576e-9)*t+.0020034)*t-1831e-7)*t-46.836769)*t+84381.406)/3600}var fw;function pw(e){if(!fw||Math.abs(fw.tt-e.tt)>1e-6){let t=uw(e),n=dw(e),r=n+t.deps/3600;fw={tt:e.tt,dpsi:t.dpsi,deps:t.deps,ee:t.dpsi*Math.cos(n*wC)/15,mobl:n,tobl:r}}return fw}function mw(e,t){let n=e*wC,r=Math.cos(n),i=Math.sin(n);return[t[0],t[1]*r-t[2]*i,t[1]*i+t[2]*r]}function hw(e,t){return mw(dw(e),t)}var gw=0;function _w(e){++gw;let t=e.tt/36525;function n(e,t){let n=[],r;for(r=0;r<=t-e;++r)n.push(0);return{min:e,array:n}}function r(e,t,r,i){let a=[];for(let o=0;o<=t-e;++o)a.push(n(r,i));return{min:e,array:a}}function i(e,t,n){let r=e.array[t-e.min];return r.array[n-r.min]}function a(e,t,n,r){let i=e.array[t-e.min];i.array[n-i.min]=r}let o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,ee=r(-6,6,1,4),k=r(-6,6,1,4);function te(e,t){return i(ee,e,t)}function A(e,t){return i(k,e,t)}function j(e,t,n){return a(ee,e,t,n)}function ne(e,t,n){return a(k,e,t,n)}function M(e,t,n,r,i){i(e*n-t*r,t*n+e*r)}function N(e){return Math.sin(AC*e)}f=t*t,m=0,O=0,g=0,_=3422.7;var re=N(.19833+.05611*t),ie=N(.27869+.04508*t),ae=N(.16827-.36903*t),oe=N(.34734-5.37261*t),se=N(.10498-5.37899*t),ce=N(.42681-.41855*t),le=N(.14943-5.37511*t);for(C=.84*re+.31*ie+14.27*ae+7.26*oe+.28*se+.24*ce,w=2.94*re+.31*ie+14.27*ae+9.34*oe+1.12*se+.83*ce,T=-6.4*re-1.89*ce,E=.21*re+.31*ie+14.27*ae-88.7*oe-15.3*se+.24*ce-1.86*le,D=C-T,p=-3332e-9*N(.59734-5.37261*t)-539e-9*N(.35498-5.37899*t)-64e-9*N(.39943-5.37511*t),v=AC*ZC(.60643382+1336.85522467*t-313e-8*f)+C/jC,y=AC*ZC(.37489701+1325.55240982*t+2565e-8*f)+w/jC,b=AC*ZC(.99312619+99.99735956*t-44e-8*f)+T/jC,x=AC*ZC(.25909118+1342.2278298*t-892e-8*f)+E/jC,S=AC*ZC(.82736186+1236.85308708*t-397e-8*f)+D/jC,u=1;u<=4;++u){switch(u){case 1:c=y,s=4,l=1.000002208;break;case 2:c=b,s=3,l=.997504612-.002495388*t;break;case 3:c=x,s=4,l=1.000002708+139.978*p;break;case 4:c=S,s=6,l=1;break;default:throw`Internal error: I = ${u}`}for(j(0,u,1),j(1,u,Math.cos(c)*l),ne(0,u,0),ne(1,u,Math.sin(c)*l),d=2;d<=s;++d)M(te(d-1,u),A(d-1,u),te(1,u),A(1,u),(e,t)=>(j(d,u,e),ne(d,u,t)));for(d=1;d<=s;++d)j(-d,u,te(d,u)),ne(-d,u,-A(d,u))}function ue(e,t,n,r){for(var i={x:1,y:0},a=[0,e,t,n,r],o=1;o<=4;++o)a[o]!==0&&M(i.x,i.y,te(a[o],o),A(a[o],o),(e,t)=>(i.x=e,i.y=t));return i}function P(e,t,n,r,i,a,o,s){var c=ue(i,a,o,s);m+=e*c.y,O+=t*c.y,g+=n*c.x,_+=r*c.x}P(13.902,14.06,-.001,.2607,0,0,0,4),P(.403,-4.01,.394,.0023,0,0,0,3),P(2369.912,2373.36,.601,28.2333,0,0,0,2),P(-125.154,-112.79,-.725,-.9781,0,0,0,1),P(1.979,6.98,-.445,.0433,1,0,0,4),P(191.953,192.72,.029,3.0861,1,0,0,2),P(-8.466,-13.51,.455,-.1093,1,0,0,1),P(22639.5,22609.07,.079,186.5398,1,0,0,0),P(18.609,3.59,-.094,.0118,1,0,0,-1),P(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),P(3.215,5.44,.192,-.0386,1,0,0,-3),P(-38.428,-38.64,.001,.6008,1,0,0,-4),P(-.393,-1.43,-.092,.0086,1,0,0,-6),P(-.289,-1.59,.123,-.0053,0,1,0,4),P(-24.42,-25.1,.04,-.3,0,1,0,2),P(18.023,17.93,.007,.1494,0,1,0,1),P(-668.146,-126.98,-1.302,-.3997,0,1,0,0),P(.56,.32,-.001,-.0037,0,1,0,-1),P(-165.145,-165.06,.054,1.9178,0,1,0,-2),P(-1.877,-6.46,-.416,.0339,0,1,0,-4),P(.213,1.02,-.074,.0054,2,0,0,4),P(14.387,14.78,-.017,.2833,2,0,0,2),P(-.586,-1.2,.054,-.01,2,0,0,1),P(769.016,767.96,.107,10.1657,2,0,0,0),P(1.75,2.01,-.018,.0155,2,0,0,-1),P(-211.656,-152.53,5.679,-.3039,2,0,0,-2),P(1.225,.91,-.03,-.0088,2,0,0,-3),P(-30.773,-34.07,-.308,.3722,2,0,0,-4),P(-.57,-1.4,-.074,.0109,2,0,0,-6),P(-2.921,-11.75,.787,-.0484,1,1,0,2),P(1.267,1.52,-.022,.0164,1,1,0,1),P(-109.673,-115.18,.461,-.949,1,1,0,0),P(-205.962,-182.36,2.056,1.4437,1,1,0,-2),P(.233,.36,.012,-.0025,1,1,0,-3),P(-4.391,-9.66,-.471,.0673,1,1,0,-4),P(.283,1.53,-.111,.006,1,-1,0,4),P(14.577,31.7,-1.54,.2302,1,-1,0,2),P(147.687,138.76,.679,1.1528,1,-1,0,0),P(-1.089,.55,.021,0,1,-1,0,-1),P(28.475,23.59,-.443,-.2257,1,-1,0,-2),P(-.276,-.38,-.006,-.0036,1,-1,0,-3),P(.636,2.27,.146,-.0102,1,-1,0,-4),P(-.189,-1.68,.131,-.0028,0,2,0,2),P(-7.486,-.66,-.037,-.0086,0,2,0,0),P(-8.096,-16.35,-.74,.0918,0,2,0,-2),P(-5.741,-.04,0,-9e-4,0,0,2,2),P(.255,0,0,0,0,0,2,1),P(-411.608,-.2,0,-.0124,0,0,2,0),P(.584,.84,0,.0071,0,0,2,-1),P(-55.173,-52.14,0,-.1052,0,0,2,-2),P(.254,.25,0,-.0017,0,0,2,-3),P(.025,-1.67,0,.0031,0,0,2,-4),P(1.06,2.96,-.166,.0243,3,0,0,2),P(36.124,50.64,-1.3,.6215,3,0,0,0),P(-13.193,-16.4,.258,-.1187,3,0,0,-2),P(-1.187,-.74,.042,.0074,3,0,0,-4),P(-.293,-.31,-.002,.0046,3,0,0,-6),P(-.29,-1.45,.116,-.0051,2,1,0,2),P(-7.649,-10.56,.259,-.1038,2,1,0,0),P(-8.627,-7.59,.078,-.0192,2,1,0,-2),P(-2.74,-2.54,.022,.0324,2,1,0,-4),P(1.181,3.32,-.212,.0213,2,-1,0,2),P(9.703,11.67,-.151,.1268,2,-1,0,0),P(-.352,-.37,.001,-.0028,2,-1,0,-1),P(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),P(.36,.2,-.012,-.0043,2,-1,0,-4),P(-1.167,-1.25,.008,-.0106,1,2,0,0),P(-7.412,-6.12,.117,.0484,1,2,0,-2),P(-.311,-.65,-.032,.0044,1,2,0,-4),P(.757,1.82,-.105,.0112,1,-2,0,2),P(2.58,2.32,.027,.0196,1,-2,0,0),P(2.533,2.4,-.014,-.0212,1,-2,0,-2),P(-.344,-.57,-.025,.0036,0,3,0,-2),P(-.992,-.02,0,0,1,0,2,2),P(-45.099,-.02,0,-.001,1,0,2,0),P(-.179,-9.52,0,-.0833,1,0,2,-2),P(-.301,-.33,0,.0014,1,0,2,-4),P(-6.382,-3.37,0,-.0481,1,0,-2,2),P(39.528,85.13,0,-.7136,1,0,-2,0),P(9.366,.71,0,-.0112,1,0,-2,-2),P(.202,.02,0,0,1,0,-2,-4),P(.415,.1,0,.0013,0,1,2,0),P(-2.152,-2.26,0,-.0066,0,1,2,-2),P(-1.44,-1.3,0,.0014,0,1,-2,2),P(.384,-.04,0,0,0,1,-2,-2),P(1.938,3.6,-.145,.0401,4,0,0,0),P(-.952,-1.58,.052,-.013,4,0,0,-2),P(-.551,-.94,.032,-.0097,3,1,0,0),P(-.482,-.57,.005,-.0045,3,1,0,-2),P(.681,.96,-.026,.0115,3,-1,0,0),P(-.297,-.27,.002,-9e-4,2,2,0,-2),P(.254,.21,-.003,0,2,-2,0,-2),P(-.25,-.22,.004,.0014,1,3,0,-2),P(-3.996,0,0,4e-4,2,0,2,0),P(.557,-.75,0,-.009,2,0,2,-2),P(-.459,-.38,0,-.0053,2,0,-2,2),P(-1.298,.74,0,4e-4,2,0,-2,0),P(.538,1.14,0,-.0141,2,0,-2,-2),P(.263,.02,0,0,1,1,2,0),P(.426,.07,0,-6e-4,1,1,-2,-2),P(-.304,.03,0,3e-4,1,-1,2,0),P(-.372,-.19,0,-.0027,1,-1,-2,2),P(.418,0,0,0,0,0,4,0),P(-.33,-.04,0,0,3,0,2,0);function F(e,t,n,r,i){return e*ue(t,n,r,i).y}h=0,h+=F(-526.069,0,0,1,-2),h+=F(-3.352,0,0,1,-4),h+=F(44.297,1,0,1,-2),h+=F(-6,1,0,1,-4),h+=F(20.599,-1,0,1,0),h+=F(-30.598,-1,0,1,-2),h+=F(-24.649,-2,0,1,0),h+=F(-2,-2,0,1,-2),h+=F(-22.571,0,1,1,-2),h+=F(10.985,0,-1,1,-2),m+=.82*N(.7736-62.5512*t)+.31*N(.0466-125.1025*t)+.35*N(.5785-25.1042*t)+.66*N(.4591+1335.8075*t)+.64*N(.313-91.568*t)+1.14*N(.148+1331.2898*t)+.21*N(.5918+1056.5859*t)+.44*N(.5784+1322.8595*t)+.24*N(.2275-5.7374*t)+.28*N(.2965+2.6929*t)+.33*N(.3132+6.3368*t),o=x+O/jC;let de=(1.000002708+139.978*p)*(18518.511+1.189+g)*Math.sin(o)-6.24*Math.sin(3*o)+h;return{geo_eclip_lon:AC*ZC((v+m/jC)/AC),geo_eclip_lat:Math.PI/648e3*de,distance_au:jC*HC/(.999953253*_)}}function vw(e,t){return[e.rot[0][0]*t[0]+e.rot[1][0]*t[1]+e.rot[2][0]*t[2],e.rot[0][1]*t[0]+e.rot[1][1]*t[1]+e.rot[2][1]*t[2],e.rot[0][2]*t[0]+e.rot[1][2]*t[1]+e.rot[2][2]*t[2]]}function yw(e,t,n){return vw(bw(t,n),e)}function bw(e,t){let n=e.tt/36525,r=84381.406,i=((((-9.51e-8*n+132851e-9)*n-.00114045)*n-1.0790069)*n+5038.481507)*n,a=((((3.337e-7*n-467e-9)*n-.00772503)*n+.0512623)*n-.025754)*n+r,o=((((-56e-9*n+170663e-9)*n-.00121197)*n-2.3814292)*n+10.556403)*n;r*=MC,i*=MC,a*=MC,o*=MC;let s=Math.sin(r),c=Math.cos(r),l=Math.sin(-i),u=Math.cos(-i),d=Math.sin(-a),f=Math.cos(-a),p=Math.sin(o),m=Math.cos(o),h=m*u-l*p*f,g=m*l*c+p*f*u*c-s*p*d,_=m*l*s+p*f*u*s+c*p*d,v=-p*u-l*m*f,y=-p*l*c+m*f*u*c-s*m*d,b=-p*l*s+m*f*u*s+c*m*d,x=l*d,S=-d*u*c-s*f,C=-d*u*s+f*c;if(t===nw.Into2000)return new Pw([[h,g,_],[v,y,b],[x,S,C]]);if(t===nw.From2000)return new Pw([[h,v,x],[g,y,S],[_,b,C]]);throw`Invalid precess direction`}function xw(e){let t=360*((.779057273264+.00273781191135448*e.ut+e.ut%1)%1);return t<0&&(t+=360),t}var Sw;function Cw(e){if(!Sw||Sw.tt!==e.tt){let t=e.tt/36525,n=15*pw(e).ee,r=xw(e),i=((n+.014506+((((-3.68e-8*t-29956e-9)*t-44e-8)*t+1.3915817)*t+4612.156534)*t)/3600+r)%360/15;i<0&&(i+=24),Sw={tt:e.tt,st:i}}return Sw.st}function ww(e){return Cw(lw(e))}function Tw(e,t){let n=e.latitude*wC,r=Math.sin(n),i=Math.cos(n),a=1/Math.hypot(i,zC*r),o=BC*a,s=e.height/1e3,c=VC*a+s,l=VC*o+s,u=(15*t+e.longitude)*wC,d=Math.sin(u),f=Math.cos(u);return{pos:[c*i*f/CC,c*i*d/CC,l*r/CC],vel:[-7292115e-11*c*i*d*86400/CC,FC*c*i*f*86400/CC,0]}}function Ew(e,t,n){return vw(Dw(t,n),e)}function Dw(e,t){let n=pw(e),r=n.mobl*wC,i=n.tobl*wC,a=n.dpsi*MC,o=Math.cos(r),s=Math.sin(r),c=Math.cos(i),l=Math.sin(i),u=Math.cos(a),d=Math.sin(a),f=u,p=-d*o,m=-d*s,h=d*c,g=u*o*c+s*l,_=u*s*c-o*l,v=d*l,y=u*o*l-s*c,b=u*s*l+o*c;if(t===nw.From2000)return new Pw([[f,h,v],[p,g,y],[m,_,b]]);if(t===nw.Into2000)return new Pw([[f,p,m],[h,g,_],[v,y,b]]);throw`Invalid precess direction`}function Ow(e,t,n){return n===nw.Into2000?yw(Ew(e,t,n),t,n):Ew(yw(e,t,n),t,n)}function kw(e,t){let n=Tw(t,Cw(e)).pos;return Ow(n,e,nw.Into2000)}var Aw=class{constructor(e,t,n,r){this.x=e,this.y=t,this.z=n,this.t=r}Length(){return Math.hypot(this.x,this.y,this.z)}},jw=class{constructor(e,t,n,r,i,a,o){this.x=e,this.y=t,this.z=n,this.vx=r,this.vy=i,this.vz=a,this.t=o}},Mw=class{constructor(e,t,n){this.lat=Y(e),this.lon=Y(t),this.dist=Y(n)}},Nw=class{constructor(e,t,n,r){this.ra=Y(e),this.dec=Y(t),this.dist=Y(n),this.vec=r}},Pw=class{constructor(e){this.rot=e}},Fw=class{constructor(e,t,n,r){this.azimuth=Y(e),this.altitude=Y(t),this.ra=Y(n),this.dec=Y(r)}};function Iw(e,t){return new Aw(e[0],e[1],e[2],t)}function Lw(e,t){let n=Iw(e,t),r=n.x*n.x+n.y*n.y,i=Math.sqrt(r+n.z*n.z);if(r===0){if(n.z===0)throw`Indeterminate sky coordinates`;return new Nw(0,n.z<0?-90:90,i,n)}let a=DC*Math.atan2(n.y,n.x);a<0&&(a+=24);let o=EC*Math.atan2(e[2],Math.sqrt(r));return new Nw(a,o,i,n)}function Rw(e,t){let n=e*wC,r=Math.cos(n),i=Math.sin(n);return[r*t[0]+i*t[1],r*t[1]-i*t[0],t[2]]}function zw(e,t,n,r,i){let a=lw(e);Bw(t),Y(n),Y(r);let o=Math.sin(t.latitude*wC),s=Math.cos(t.latitude*wC),c=Math.sin(t.longitude*wC),l=Math.cos(t.longitude*wC),u=Math.sin(r*wC),d=Math.cos(r*wC),f=Math.sin(n*TC),p=Math.cos(n*TC),m=[s*l,s*c,o],h=[-o*l,-o*c,s],g=[c,-l,0],_=-15*Cw(a),v=Rw(_,m),y=Rw(_,h),b=Rw(_,g),x=[d*p,d*f,u],S=x[0]*v[0]+x[1]*v[1]+x[2]*v[2],C=x[0]*y[0]+x[1]*y[1]+x[2]*y[2],w=x[0]*b[0]+x[1]*b[1]+x[2]*b[2],T=Math.hypot(C,w),E;T>0?(E=-57.29577951308232*Math.atan2(w,C),E<0&&(E+=360)):E=0;let D=EC*Math.atan2(T,S),O=n,ee=r;if(i){let e=D,t=UT(i,90-D);if(D-=t,t>0&&D>3e-4){let t=Math.sin(D*wC),n=Math.cos(D*wC),r=Math.sin(e*wC),i=Math.cos(e*wC),a=[];for(let e=0;e<3;++e)a.push((x[e]-i*v[e])/r*t+v[e]*n);T=Math.hypot(a[0],a[1]),T>0?(O=DC*Math.atan2(a[1],a[0]),O<0&&(O+=24)):O=0,ee=EC*Math.atan2(a[2],T)}}return new Fw(E,90-D,O,ee)}function Bw(e){if(!(e instanceof Vw))throw`Not an instance of the Observer class: ${e}`;if(Y(e.latitude),Y(e.longitude),Y(e.height),e.latitude<-90||e.latitude>90)throw`Latitude ${e.latitude} is out of range. Must be -90..+90.`;return e}var Vw=class{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,Bw(this)}};function Hw(e,t,n,r,i){Bw(n),XC(r),XC(i);let a=lw(t),o=kw(a,n),s=OT(e,a,i),c=[s.x-o[0],s.y-o[1],s.z-o[2]];return Lw(r?Ow(c,a,nw.From2000):c,a)}function Uw(e){let t=lw(e),n=_w(t),r=n.distance_au*Math.cos(n.geo_eclip_lat),i=yw(hw(t,[r*Math.cos(n.geo_eclip_lon),r*Math.sin(n.geo_eclip_lon),n.distance_au*Math.sin(n.geo_eclip_lat)]),t,nw.Into2000);return new Aw(i[0],i[1],i[2],t)}function Ww(e){let t=lw(e),n=1e-5,r=t.AddDays(-1e-5),i=t.AddDays(1e-5),a=Uw(r),o=Uw(i);return new jw((a.x+o.x)/2,(a.y+o.y)/2,(a.z+o.z)/2,(o.x-a.x)/(2*n),(o.y-a.y)/(2*n),(o.z-a.z)/(2*n),t)}function Gw(e){let t=lw(e),n=Ww(t),r=82.30056;return new jw(n.x/r,n.y/r,n.z/r,n.vx/r,n.vy/r,n.vz/r,t)}function Kw(e,t,n){let r=1,i=0;for(let a of e){let e=0;for(let[n,r,i]of a)e+=n*Math.cos(r+t*i);let o=r*e;n&&(o%=AC),i+=o,r*=t}return i}function qw(e,t){let n=1,r=0,i=0,a=0;for(let o of e){let e=0,s=0;for(let[n,r,i]of o){let o=r+t*i;e+=n*i*Math.sin(o),a>0&&(s+=n*Math.cos(o))}i+=a*r*s-n*e,r=n,n*=t,++a}return i}var Jw=365250,Yw=0,Xw=1,Zw=2;function Qw(e){return new sT(e[0]+4.4036e-7*e[1]-1.90919e-7*e[2],-4.79966e-7*e[0]+.917482137087*e[1]-.397776982902*e[2],.397776982902*e[1]+.917482137087*e[2])}function $w(e,t,n){let r=n*Math.cos(t),i=Math.cos(e),a=Math.sin(e);return[r*i,r*a,n*Math.sin(t)]}function eT(e,t){let n=t.tt/Jw;return Qw($w(Kw(e[Yw],n,!0),Kw(e[Xw],n,!1),Kw(e[Zw],n,!1))).ToAstroVector(t)}function tT(e,t){let n=t/Jw,r=Kw(e[Yw],n,!0),i=Kw(e[Xw],n,!1),a=Kw(e[Zw],n,!1),o=qw(e[Yw],n),s=qw(e[Xw],n),c=qw(e[Zw],n),l=Math.cos(r),u=Math.sin(r),d=Math.cos(i),f=Math.sin(i),p=+(c*d*l)-a*f*l*s-a*d*u*o,m=+(c*d*u)-a*f*u*s+a*d*l*o,h=+(c*f)+a*d*s,g=$w(r,i,a),_=[p/Jw,m/Jw,h/Jw];return new cT(t,Qw(g),Qw(_))}function nT(e,t,n,r){let i=r/(r+WC),a=eT(rw[n],t);e.x+=i*a.x,e.y+=i*a.y,e.z+=i*a.z}function rT(e){let t=new Aw(0,0,0,e);return nT(t,e,X.Jupiter,KC),nT(t,e,X.Saturn,qC),nT(t,e,X.Uranus,JC),nT(t,e,X.Neptune,YC),t}var iT=29200,aT=146,oT=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]],sT=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new e(this.x,this.y,this.z)}ToAstroVector(e){return new Aw(this.x,this.y,this.z,e)}static zero(){return new e(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(t){return new e(this.x+t.x,this.y+t.y,this.z+t.z)}sub(t){return new e(this.x-t.x,this.y-t.y,this.z-t.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(t){return new e(t*this.x,t*this.y,t*this.z)}div(t){return new e(this.x/t,this.y/t,this.z/t)}mean(t){return new e((this.x+t.x)/2,(this.y+t.y)/2,(this.z+t.z)/2)}neg(){return new e(-this.x,-this.y,-this.z)}},cT=class e{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new e(this.tt,this.r,this.v)}sub(t){return new e(this.tt,this.r.sub(t.r),this.v.sub(t.v))}};function lT(e){let[t,[n,r,i],[a,o,s]]=e;return new cT(t,new sT(n,r,i),new sT(a,o,s))}function uT(e,t,n,r){let i=r/(r+WC),a=tT(rw[n],t);return e.r.incr(a.r.mul(i)),e.v.incr(a.v.mul(i)),a}function dT(e,t,n){let r=n.sub(e),i=r.quadrature();return r.mul(t/(i*Math.sqrt(i)))}var fT=class{constructor(e){let t=new cT(e,new sT(0,0,0),new sT(0,0,0));this.Jupiter=uT(t,e,X.Jupiter,KC),this.Saturn=uT(t,e,X.Saturn,qC),this.Uranus=uT(t,e,X.Uranus,JC),this.Neptune=uT(t,e,X.Neptune,YC),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new cT(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=dT(e,WC,this.Sun.r);return t.incr(dT(e,KC,this.Jupiter.r)),t.incr(dT(e,qC,this.Saturn.r)),t.incr(dT(e,JC,this.Uranus.r)),t.incr(dT(e,YC,this.Neptune.r)),t}},pT=class e{constructor(e,t,n,r){this.tt=e,this.r=t,this.v=n,this.a=r}clone(){return new e(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}},mT=class{constructor(e,t){this.bary=e,this.grav=t}};function hT(e,t,n,r){return new sT(t.x+e*(n.x+e*r.x/2),t.y+e*(n.y+e*r.y/2),t.z+e*(n.z+e*r.z/2))}function gT(e,t,n){return new sT(t.x+e*n.x,t.y+e*n.y,t.z+e*n.z)}function _T(e,t){let n=e-t.tt,r=new fT(e),i=hT(n,t.r,t.v,t.a),a=r.Acceleration(i).mean(t.a),o=hT(n,t.r,t.v,a);return new mT(r,new pT(e,o,t.v.add(a.mul(n)),r.Acceleration(o)))}var vT=[];function yT(e,t){let n=Math.floor(e);return n<0?0:n>=t?t-1:n}function bT(e){let t=lT(e),n=new fT(t.tt),r=t.r.add(n.Sun.r),i=t.v.add(n.Sun.v),a=n.Acceleration(r);return new mT(n,new pT(t.tt,r,i,a))}function xT(e,t){let n=oT[0][0];if(t<n||t>oT[50][0])return null;let r=yT((t-n)/iT,50);if(!e[r]){let t=e[r]=[];t[0]=bT(oT[r]).grav,t[200]=bT(oT[r+1]).grav;let n,a=t[0].tt;for(n=1;n<200;++n)t[n]=_T(a+=aT,t[n-1]).grav;a=t[200].tt;var i=[];for(i[200]=t[200],n=199;n>0;--n)i[n]=_T(a-=aT,i[n+1]).grav;for(n=199;n>0;--n){let e=n/200;t[n].r=t[n].r.mul(1-e).add(i[n].r.mul(e)),t[n].v=t[n].v.mul(1-e).add(i[n].v.mul(e)),t[n].a=t[n].a.mul(1-e).add(i[n].a.mul(e))}}return e[r]}function ST(e,t,n){let r=bT(e),i=Math.ceil((t-r.grav.tt)/n);for(let e=0;e<i;++e)r=_T(e+1===i?t:r.grav.tt+n,r.grav);return r}function CT(e,t){let n,r,i,a=xT(vT,e.tt);if(a){let t=yT((e.tt-a[0].tt)/aT,200),i=a[t],o=a[t+1],s=i.a.mean(o.a),c=hT(e.tt-i.tt,i.r,i.v,s),l=gT(e.tt-i.tt,i.v,s),u=hT(e.tt-o.tt,o.r,o.v,s),d=gT(e.tt-o.tt,o.v,s),f=(e.tt-i.tt)/aT;n=c.mul(1-f).add(u.mul(f)),r=l.mul(1-f).add(d.mul(f))}else{let t;t=e.tt<oT[0][0]?ST(oT[0],e.tt,-146):ST(oT[50],e.tt,146),n=t.grav.r,r=t.grav.v,i=t.bary}return t&&(i||=new fT(e.tt),n=n.sub(i.Sun.r),r=r.sub(i.Sun.v)),new jw(n.x,n.y,n.z,r.x,r.y,r.z,e)}new Pw([[.999432765338654,-.0336771074697641,0],[.0303959428906285,.902057912352809,.430543388542295],[-.0144994559663353,-.430299169409101,.902569881273754]]);function wT(e,t){var n=lw(t);if(e in rw)return eT(rw[e],n);if(e===X.Pluto){let e=CT(n,!0);return new Aw(e.x,e.y,e.z,n)}if(e===X.Sun)return new Aw(0,0,0,n);if(e===X.Moon){var r=eT(rw.Earth,n),i=Uw(n);return new Aw(r.x+i.x,r.y+i.y,r.z+i.z,n)}if(e===X.EMB){let e=eT(rw.Earth,n),t=Uw(n),r=82.30056;return new Aw(e.x+t.x/r,e.y+t.y/r,e.z+t.z/r,n)}if(e===X.SSB)return rT(n);let a=tw(e);if(a)return HT(new Mw(a.dec,15*a.ra,a.dist),n);throw`HelioVector: Unknown body "${e}"`}function TT(e,t){let n=t,r=0;for(let i=0;i<10;++i){let i=e(n),a=i.Length()/SC;if(a>1)throw`Object is too distant for light-travel solver.`;let o=t.AddDays(-a);if(r=Math.abs(o.tt-n.tt),r<1e-9)return i;n=o}throw`Light-travel time solver did not converge: dt = ${r}`}var ET=class{constructor(e,t,n,r){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=r}Position(e){this.aberration&&(this.observerPos=wT(this.observerBody,e));let t=wT(this.targetBody,e);return new Aw(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}};function DT(e,t,n,r){XC(r);let i=lw(e);if(tw(n)){let e=wT(n,i);if(r){let n=AT(t,i),r=new Aw(e.x-n.x,e.y-n.y,e.z-n.z,i),a=SC/r.Length();return new Aw(r.x+n.vx/a,r.y+n.vy/a,r.z+n.vz/a,i)}let a=wT(t,i);return new Aw(e.x-a.x,e.y-a.y,e.z-a.z,i)}let a;a=r?new Aw(0,0,0,i):wT(t,i);let o=new ET(t,n,r,a);return TT(e=>o.Position(e),i)}function OT(e,t,n){XC(n);let r=lw(t);switch(e){case X.Earth:return new Aw(0,0,0,r);case X.Moon:return Uw(r);default:let t=DT(r,X.Earth,e,n);return t.t=r,t}}function kT(e,t){return new jw(e.r.x,e.r.y,e.r.z,e.v.x,e.v.y,e.v.z,t)}function AT(e,t){let n=lw(t);switch(e){case X.Sun:return new jw(0,0,0,0,0,0,n);case X.SSB:let t=new fT(n.tt);return new jw(-t.Sun.r.x,-t.Sun.r.y,-t.Sun.r.z,-t.Sun.v.x,-t.Sun.v.y,-t.Sun.v.z,n);case X.Mercury:case X.Venus:case X.Earth:case X.Mars:case X.Jupiter:case X.Saturn:case X.Uranus:case X.Neptune:return kT(tT(rw[e],n.tt),n);case X.Pluto:return CT(n,!0);case X.Moon:case X.EMB:let r=tT(rw.Earth,n.tt),i=e==X.Moon?Ww(n):Gw(n);return new jw(i.x+r.r.x,i.y+r.r.y,i.z+r.r.z,i.vx+r.v.x,i.vy+r.v.y,i.vz+r.v.z,n);default:if(tw(e)){let t=wT(e,n);return new jw(t.x,t.y,t.z,0,0,0,n)}throw`HelioState: Unsupported body "${e}"`}}function jT(e,t,n,r,i){let a=(i+n)/2-r,o=(i-n)/2,s=r,c;if(a==0){if(o==0||(c=-s/o,c<-1||c>1))return null}else{let e=o*o-4*a*s;if(e<=0)return null;let t=Math.sqrt(e),n=(-o+t)/(2*a),r=(-o-t)/(2*a);if(-1<=n&&n<=1){if(-1<=r&&r<=1)return null;c=n}else if(-1<=r&&r<=1)c=r;else return null}return{t:e+c*t,df_dt:(2*a*c+o)/t}}function MT(e,t,n,r){let i=Y(r&&r.dt_tolerance_seconds||1),a=Math.abs(i/LC),o=r&&r.init_f1||e(t),s=r&&r.init_f2||e(n),c=NaN,l=0,u=r&&r.iter_limit||20,d=!0;for(;;){if(++l>u)throw`Excessive iteration in Search()`;let r=cw(t,n,.5),i=r.ut-t.ut;if(Math.abs(i)<a)return r;d?c=e(r):d=!0;let f=jT(r.ut,n.ut-r.ut,o,c,s);if(f){let r=lw(f.t),l=e(r);if(f.df_dt!==0){if(Math.abs(l/f.df_dt)<a)return r;let u=1.2*Math.abs(l/f.df_dt);if(u<i/10){let i=r.AddDays(-u),a=r.AddDays(+u);if((i.ut-t.ut)*(i.ut-n.ut)<0&&(a.ut-t.ut)*(a.ut-n.ut)<0){let r=e(i),u=e(a);if(r<0&&u>=0){o=r,s=u,t=i,n=a,c=l,d=!1;continue}}}}}if(o<0&&c>=0){n=r,s=c;continue}if(c<0&&s>=0){t=r,o=c;continue}return null}}function NT(e,t,n,r,i,a){if(!Number.isFinite(a)||a<-90||a>90)throw`Invalid altitude angle: ${a}`;return LT(e,t,n,r,i,0,a)}var PT=class{constructor(e,t,n,r){this.tx=e,this.ty=t,this.ax=n,this.ay=r}};function FT(e,t,n,r,i,a,o){if(a<0&&o>=0)return new PT(r,i,a,o);if(a>=0&&o<0)return null;if(e>17)throw`Excessive recursion in rise/set ascent search.`;let s=i.ut-r.ut;if(s*LC<1||Math.min(Math.abs(a),Math.abs(o))>s/2*n)return null;let c=new sw((r.ut+i.ut)/2),l=t(c);return FT(1+e,t,n,r,c,a,l)||FT(1+e,t,n,c,i,l,o)}function IT(e,t){if(t<-90||t>90)throw`Invalid geographic latitude: ${t}`;let n,r;switch(e){case X.Moon:n=4.5,r=8.2;break;case X.Sun:n=.8,r=.5;break;case X.Mercury:n=-1.6,r=1;break;case X.Venus:n=-.8,r=.6;break;case X.Mars:n=-.5,r=.4;break;case X.Jupiter:case X.Saturn:case X.Uranus:case X.Neptune:case X.Pluto:n=-.2,r=.2;break;case X.Star1:case X.Star2:case X.Star3:case X.Star4:case X.Star5:case X.Star6:case X.Star7:case X.Star8:n=-.008,r=.008;break;default:throw`Body not allowed for altitude search: ${e}`}let i=wC*t;return Math.abs((360/RC-n)*Math.cos(i))+Math.abs(r*Math.sin(i))}function LT(e,t,n,r,i,a,o){if(Bw(t),Y(i),Y(a),Y(o),o<-90||o>90)throw`Invalid target altitude angle: ${o}`;let s=IT(e,t.latitude);function c(r){let i=Hw(e,r,t,!0,!0);return n*(zw(r,t,i.ra,i.dec).altitude+EC*Math.asin(a/i.dist)-o)}let l=lw(r),u=l,d=l,f=c(u),p=f;for(;;){i<0?(u=d.AddDays(-.42),f=c(u)):(d=u.AddDays(.42),p=c(d));let e=FT(0,c,s,u,d,f,p);if(e){let t=MT(c,e.tx,e.ty,{dt_tolerance_seconds:.1,init_f1:e.ax,init_f2:e.ay});if(t){if(i<0){if(t.ut<l.ut+i)return null}else if(t.ut>l.ut+i)return null;return t}throw`Rise/set search failed after finding ascent: t1=${u}, t2=${d}, a1=${f}, a2=${p}`}if(i<0){if(u.ut<l.ut+i)return null;d=u,p=f}else{if(d.ut>l.ut+i)return null;u=d,f=p}}}var RT=class{constructor(e,t){this.time=e,this.hor=t}};function zT(e,t,n,r,i=1){Bw(t);let a=lw(r),o=0;if(e===X.Earth)throw`Cannot search for hour angle of the Earth.`;if(Y(n),n<0||n>=24)throw`Invalid hour angle ${n}`;if(Y(i),i===0)throw`Direction must be positive or negative.`;for(;;){++o;let r=Cw(a),s=Hw(e,a,t,!0,!0),c=(n+s.ra-t.longitude/15-r)%24;if(o===1?i>0?c<0&&(c+=24):c>0&&(c-=24):c<-12?c+=24:c>12&&(c-=24),Math.abs(c)*3600<.1){let e=zw(a,t,s.ra,s.dec,`normal`);return new RT(a,e)}let l=c/24*RC;a=a.AddDays(l)}}function BT(e,t,n){let r=lw(t),i=ww(r),a=Hw(e,r,n,!0,!0),o=(n.longitude/15+i-a.ra)%24;return o<0&&(o+=24),o}var VT;(function(e){e[e.Pericenter=0]=`Pericenter`,e[e.Apocenter=1]=`Apocenter`})(VT||={});function HT(e,t){t=lw(t);let n=e.lat*wC,r=e.lon*wC,i=e.dist*Math.cos(n);return new Aw(i*Math.cos(r),i*Math.sin(r),e.dist*Math.sin(n),t)}function UT(e,t){let n;if(Y(t),t<-90||t>90)return 0;if(e===`normal`||e===`jplhor`){let r=t;r<-1&&(r=-1),n=1.02/Math.tan((r+10.3/(r+5.11))*wC)/60,e===`normal`&&t<-1&&(n*=(t+90)/89)}else if(!e)n=0;else throw`Invalid refraction option: ${e}`;return n}var WT;(function(e){e.Penumbral=`penumbral`,e.Partial=`partial`,e.Annular=`annular`,e.Total=`total`})(WT||={});var GT;(function(e){e[e.Invalid=0]=`Invalid`,e[e.Ascending=1]=`Ascending`,e[e.Descending=-1]=`Descending`})(GT||={});function KT(e,t,n){let r=new sw(e),i=new Vw(t,n,0),a=Hw(X.Sun,r,i,!0,!0);return zw(r,i,a.ra,a.dec,`normal`).altitude}function qT(e,t){return(BT(X.Sun,new sw(e),new Vw(0,t,0))+12)%24}function JT(e,t,n){let r=((n-12)%24+24)%24,i=new sw(new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())));return zT(X.Sun,new Vw(0,t,0),r,i,1).time.date}function YT(e,t,n,r=0){let i=new sw(e),a=BT(X.Sun,i,new Vw(0,t,0)),o=new sw(new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())));return zT(X.Sun,new Vw(r,n,0),a,o,1).time.date}function XT(e,t,n,r,i){let a=KT(e,t,n),o=BT(X.Sun,new sw(e),new Vw(0,n,0))>12,s=new Vw(r,i,0),c=new sw(new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))),l=zT(X.Sun,s,0,c,1).time,u=zT(X.Sun,s,12,new sw(new Date(l.date.getTime()-468e5)),1).time,d=o?u:l;return NT(X.Sun,s,o?1:-1,d,.6,a)?.date??l.date}var ZT={transmittance:`transmittanceTexture`,scattering:`scatteringTexture`,irradiance:`irradianceTexture`,higherOrderScattering:`higherOrderScatteringTexture`},QT={transmittance:`transmittance.exr`,scattering:`scattering.exr`,irradiance:`irradiance.exr`,higherOrderScattering:`higher_order_scattering.exr`},$T=Object.keys(ZT),eE={atmosphereAssetsUrl:void 0,stbnUrl:gC,date:new Date},tE=class extends M{renderer;sunDirection=new r.Vector3;moonDirection=new r.Vector3;rotationMatrix=new r.Matrix4;textures={};overlay=new ie(null);shadow=new ie(null);shadowLength=new ie(null);enableShadows=new ie(!0);needsUpdate=!1;options;_camera;texturePromises=new Map;constructor(e,t={},n){super(),this.renderer=e,this.options={...eE,...t},this._camera=n,this.onUpdate()}onUpdate=()=>{this.needsUpdate=!0,this.emit(`needsUpdate`)};async initTextures(){await Promise.all($T.map(e=>this.loadTexture(e)))}loadTexture(e){let t=this.texturePromises.get(e);if(t==null){let n=this.options.atmosphereAssetsUrl,i=QT[e],a=n==null?vC[i]:`${n.replace(/\/+$/,``)}/${i}`;t=this.fetchTexture(e,a).then(t=>{let n=o_(this.renderer)?r.FloatType:r.HalfFloatType;t.type=n,n===r.FloatType&&(t.image,t.image.data!=null&&(t.image.data=new Float32Array(new By(t.image.data.buffer)))),t.minFilter=r.LinearFilter,t.magFilter=r.LinearFilter,Object.assign(this.textures,{[ZT[e]]:t}),this.emit(`textureLoaded`)}).catch(t=>{throw this.texturePromises.delete(e),t}),this.texturePromises.set(e,t)}return t}fetchTexture(e,t){switch(e){case`transmittance`:return new Xy({width:256,height:64}).loadAsync(t);case`irradiance`:return new Xy({width:64,height:16}).loadAsync(t);case`scattering`:case`higherOrderScattering`:return new Yy({width:256,height:128,depth:32}).loadAsync(t)}}_dispose(){for(let e of Object.values(this.textures))e?.dispose();this.textures={},this.texturePromises.clear(),this.emit(`disposed`)}onTexturesReady(e,t){let n=t==null?$T:$T.filter(e=>t[e]);for(let e of n)this.loadTexture(e).catch(e=>{console.error(`Failed to load atmosphere textures:`,e)});let r=()=>n.every(e=>this.textures[ZT[e]]!=null),i=()=>{e(this.textures)};if(r())i();else{let e=()=>{r()&&(this.off(`textureLoaded`,e),i())};this.on(`textureLoaded`,e)}}getSunDirection(){return this.sunDirection.clone()}getMoonDirection(){return this.moonDirection.clone()}getRotationMatrix(){return this.rotationMatrix.clone()}_update(){this.needsUpdate&&(GS(this.date,this.sunDirection),KS(this.date,this.moonDirection),US(this.date,this.rotationMatrix),this.emit(`sunChanged`,this.sunDirection.clone())),this.needsUpdate=!1}isAtNight(e){return new r.Vector3(e.x,e.y,e.z).clone().normalize().dot(this.sunDirection)<0}getSunElevation(e){return KT(this.date,e.lat,e.lng)}getSolarTime(e){return qT(this.date,e.lng)}setSolarTime(e,t){this.date=JT(this.date,e.lng,t)}get date(){return this.options.date??eE.date}set date(e){this.options.date=e,this.onUpdate()}setDateAt(e,t){this.date=YT(this.date,e.lng,t.lng,t.lat)}setElevationAt(e,t){this.date=XT(this.date,e.lat,e.lng,t.lat,t.lng)}setDateFromCameraAt(e){let{lng:t}=this._camera?.positionGeographic??{lng:0};this.setDateAt({lng:t},e)}setElevationFromCameraAt(e){let{lng:t,lat:n}=this._camera?.positionGeographic??{lng:0,lat:0};this.setElevationAt({lat:n,lng:t},e)}},nE=class e{#e=new r.Color;setRGB(e,t,n){return this.#e.setRGB(e,t,n,r.SRGBColorSpace),this}setRGBLinear(e,t,n){return this.#e.setRGB(e,t,n,r.NoColorSpace),this}setHex(e){return this.#e.setHex(e,r.SRGBColorSpace),this}setStyle(e){return this.#e.setStyle(e,r.SRGBColorSpace),this}copy(e){return e.#e=this.#e.clone(),e}clone(){return this.copy(new e)}toArray(){return this.#e.toArray()}srgb(){let t=new e;return t.#e=new r.Color().copyLinearToSRGB(this.#e),t}toHex(){return this.#e.getHex()}get raw(){return this.#e}},rE=2,iE=e=>{let t=Math.max(navigator.hardwareConcurrency,1);return Ah(e?Math.min(t,rE):t)},aE=class{view;ctx;registry=new Map;constructor(e,t){this.view=e,this.ctx=t}register(e,t){this.registry.set(e,t)}unregister(e){return this.registry.delete(e)}has(e){return this.registry.has(e)}getRegisteredTypes(){return Array.from(this.registry.keys())}size(){return this.registry.size}clear(){this.registry.clear()}findTypeFromConfig(e){for(let t of Object.keys(e))if(this.registry.has(t))return t;return null}getConstructor(e){return this.registry.get(e)}},oE={enabled:!1},sE=class extends M{rawPass;rawEffect;options;constructor(e,t,n){super(),this.rawPass=e,this.rawEffect=t,this.options={...n??{}},this.enabled=this.options.enabled??oE.enabled,this.onMounted()}get raw(){return this.rawPass}get enabled(){return this.options.enabled??oE.enabled}set enabled(e){this.options.enabled=e,this.rawPass.enabled=e,this.emit(`needsUpdate`)}get visible(){return this.enabled}set visible(e){this.enabled=e}onMounted(){}dispose(){this.rawPass.dispose()}},cE=class extends sE{constructor(e,t,n){let r=new dg(e,t);super(r,t,n)}},lE=class extends dg{customDepthTexture=null;customDepthPacking;setDepthTexture(){this.customDepthTexture&&super.setDepthTexture(this.customDepthTexture,this.customDepthPacking)}setCustomDepthTexture(e,t){this.customDepthTexture=e,this.customDepthPacking=t}getCustomDepthTexture(){return this.customDepthTexture}},uE=class extends $h{get visible(){return this.enabled}set visible(e){this.enabled=e}},dE=class extends Rh{get visible(){return this.enabled}set visible(e){this.enabled=e}},fE=class extends M{id;view;ctx;_instance;_visible;constructor(e,n,r={}){super(),this.id=r.id||(0,t.generateId)(),this._visible=r.visible??!0,this.view=e,this.ctx=n}onUpdateConfig(e){e.visible!==void 0&&(this._visible=e.visible,this._instance&&(this._instance.visible=e.visible)),this.requestUpdate()}requestUpdate(){this.emit(`needsUpdate`)}onDestroy(){this._instance=void 0}get visible(){return!!this._visible}set visible(e){this._visible=e,this.onUpdateConfig({visible:e})}},pE=class extends fE{static key;static insertAfter;static insertBefore;static allowDuplication;static requiredBuffers;instanceId;constructor(e,t,n={}){super(e,t,n),this.instanceId=this.getConstructor().allowDuplication?`${this.getKey()}_${Math.random().toString(36).slice(2,9)}`:this.getKey()}get raw(){if(this._instance){if(this._instance instanceof Nh||this._instance instanceof sE)return this._instance;if(`raw`in this._instance)return this._instance.raw}}getConstructor(){return this.constructor}getKey(){return this.getConstructor().key}getInsertAfter(){return this.getConstructor().insertAfter}getInsertBefore(){return this.getConstructor().insertBefore}onCreate(){this._instance=this.createPass(),this._instance&&(this._instance.visible=this.visible),this.raw&&this.insertPass()}insertPass(){if(!this.raw)return;let e=this.instanceId,t=this.getInsertAfter()||[],n=this.getInsertBefore()||[],r=this.raw,i=r instanceof sE?r.rawPass:r instanceof Nh?r:void 0;z(i);for(let n of t)if(this.ctx.getPass(n)){this.ctx.insertPassAfter(n,e,i);return}for(let t of n)if(this.ctx.getPass(t)){this.ctx.insertPassBefore(t,e,i);return}this.ctx.addPass(e,i)}onUpdateConfig(e){super.onUpdateConfig(e)}onDestroy(){this.ctx.removePass(this.instanceId),this._instance=void 0}find(e){for(let t of this.ctx._getEffects()){let n=t.ref;if(n.getKey()===e)return n}}},mE=class extends aE{create(e,t){let n=this.getConstructor(e);if(!n)throw Error(`Unknown effect type: ${e}`);return new n(this.view,this.ctx,t)}findEffectType(e){return this.findTypeFromConfig(e)}getRequiredBuffers(e){return this.getConstructor(e)?.requiredBuffers??[]}},hE=class extends aE{create(e,t){let n=this.getConstructor(e);if(!n)throw Error(`Unknown light type: ${e}`);return new n(this.view,this.ctx,t)}findLightType(e){return this.findTypeFromConfig(e)}},gE=class extends aE{create(e,t){let n=this.getConstructor(e);if(!n)throw Error(`Unknown mesh type: ${e}`);return new n(this.view,this.ctx,t)}findMeshType(e){return this.findTypeFromConfig(e)}},_E=class{mesh;light;effect;constructor(e,t){this.mesh=new gE(e,t),this.light=new hE(e,t),this.effect=new mE(e,t)}getStats(){return{mesh:{registeredCount:this.mesh.size(),types:this.mesh.getRegisteredTypes()},light:{registeredCount:this.light.size(),types:this.light.getRegisteredTypes()},effect:{registeredCount:this.effect.size(),types:this.effect.getRegisteredTypes()}}}clearAll(){this.mesh.clear(),this.light.clear(),this.effect.clear()}},vE=(e,t)=>Object.keys(e).filter(e=>!t.includes(e)),yE=class extends Error{constructor(e,t){super(`Unknown ${e} type specified in configuration: ${vE(t,[`type`]).join(`, `)}`)}},bE=class extends Error{constructor(e,t){super(`\`${e}\` cannot be combined with \`${t}\`: both define the object's placement. Set only one of them — use \`geodetic\` for geographic placement, or \`matrix\` / \`matrixWorld\` to supply a frame yourself.`)}},xE=r.ShaderLib,SE=typeof global==`object`&&global&&global.Object===Object&&global,CE=typeof self==`object`&&self&&self.Object===Object&&self,wE=SE||CE||Function(`return this`)(),TE=wE.Symbol,EE=Object.prototype,DE=EE.hasOwnProperty,OE=EE.toString,kE=TE?TE.toStringTag:void 0;function AE(e){var t=DE.call(e,kE),n=e[kE];try{e[kE]=void 0;var r=!0}catch{}var i=OE.call(e);return r&&(t?e[kE]=n:delete e[kE]),i}var jE=Object.prototype.toString;function ME(e){return jE.call(e)}var NE=`[object Null]`,PE=`[object Undefined]`,FE=TE?TE.toStringTag:void 0;function IE(e){return e==null?e===void 0?PE:NE:FE&&FE in Object(e)?AE(e):ME(e)}function LE(e){return typeof e==`object`&&!!e}var RE=`[object Symbol]`;function zE(e){return typeof e==`symbol`||LE(e)&&IE(e)==RE}function BE(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var VE=Array.isArray,HE=1/0,UE=TE?TE.prototype:void 0,WE=UE?UE.toString:void 0;function GE(e){if(typeof e==`string`)return e;if(VE(e))return BE(e,GE)+``;if(zE(e))return WE?WE.call(e):``;var t=e+``;return t==`0`&&1/e==-HE?`-0`:t}function KE(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function qE(e){return e}var JE=`[object AsyncFunction]`,YE=`[object Function]`,XE=`[object GeneratorFunction]`,ZE=`[object Proxy]`;function QE(e){if(!KE(e))return!1;var t=IE(e);return t==YE||t==XE||t==JE||t==ZE}var $E=wE[`__core-js_shared__`],eD=function(){var e=/[^.]+$/.exec($E&&$E.keys&&$E.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function tD(e){return!!eD&&eD in e}var nD=Function.prototype.toString;function rD(e){if(e!=null){try{return nD.call(e)}catch{}try{return e+``}catch{}}return``}var iD=/[\\^$.*+?()[\]{}|]/g,aD=/^\[object .+?Constructor\]$/,oD=Function.prototype,sD=Object.prototype,cD=oD.toString,lD=sD.hasOwnProperty,uD=RegExp(`^`+cD.call(lD).replace(iD,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function dD(e){return!KE(e)||tD(e)?!1:(QE(e)?uD:aD).test(rD(e))}function fD(e,t){return e?.[t]}function pD(e,t){var n=fD(e,t);return dD(n)?n:void 0}function mD(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var hD=800,gD=16,_D=Date.now;function vD(e){var t=0,n=0;return function(){var r=_D(),i=gD-(r-n);if(n=r,i>0){if(++t>=hD)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function yD(e){return function(){return e}}var bD=function(){try{var e=pD(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),xD=vD(bD?function(e,t){return bD(e,`toString`,{configurable:!0,enumerable:!1,value:yD(t),writable:!0})}:qE),SD=9007199254740991,CD=/^(?:0|[1-9]\d*)$/;function wD(e,t){var n=typeof e;return t??=SD,!!t&&(n==`number`||n!=`symbol`&&CD.test(e))&&e>-1&&e%1==0&&e<t}function TD(e,t,n){t==`__proto__`&&bD?bD(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ED(e,t){return e===t||e!==e&&t!==t}var DD=Object.prototype.hasOwnProperty;function OD(e,t,n){var r=e[t];(!(DD.call(e,t)&&ED(r,n))||n===void 0&&!(t in e))&&TD(e,t,n)}var kD=Math.max;function AD(e,t,n){return t=kD(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=kD(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),mD(e,this,s)}}function jD(e,t){return xD(AD(e,t,qE),e+``)}var MD=9007199254740991;function ND(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=MD}function PD(e){return e!=null&&ND(e.length)&&!QE(e)}function FD(e,t,n){if(!KE(n))return!1;var r=typeof t;return(r==`number`?PD(n)&&wD(t,n.length):r==`string`&&t in n)?ED(n[t],e):!1}var ID=Object.prototype;function LD(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||ID)}function RD(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var zD=`[object Arguments]`;function BD(e){return LE(e)&&IE(e)==zD}var VD=Object.prototype,HD=VD.hasOwnProperty,UD=VD.propertyIsEnumerable,WD=BD(function(){return arguments}())?BD:function(e){return LE(e)&&HD.call(e,`callee`)&&!UD.call(e,`callee`)};function GD(){return!1}var KD=typeof e==`object`&&e&&!e.nodeType&&e,qD=KD&&typeof module==`object`&&module&&!module.nodeType&&module,JD=qD&&qD.exports===KD?wE.Buffer:void 0,YD=(JD?JD.isBuffer:void 0)||GD,XD=`[object Arguments]`,ZD=`[object Array]`,QD=`[object Boolean]`,$D=`[object Date]`,eO=`[object Error]`,tO=`[object Function]`,nO=`[object Map]`,rO=`[object Number]`,iO=`[object Object]`,aO=`[object RegExp]`,oO=`[object Set]`,sO=`[object String]`,cO=`[object WeakMap]`,lO=`[object ArrayBuffer]`,uO=`[object DataView]`,dO=`[object Float32Array]`,fO=`[object Float64Array]`,pO=`[object Int8Array]`,mO=`[object Int16Array]`,hO=`[object Int32Array]`,gO=`[object Uint8Array]`,_O=`[object Uint8ClampedArray]`,vO=`[object Uint16Array]`,yO=`[object Uint32Array]`,Z={};Z[dO]=Z[fO]=Z[pO]=Z[mO]=Z[hO]=Z[gO]=Z[_O]=Z[vO]=Z[yO]=!0,Z[XD]=Z[ZD]=Z[lO]=Z[QD]=Z[uO]=Z[$D]=Z[eO]=Z[tO]=Z[nO]=Z[rO]=Z[iO]=Z[aO]=Z[oO]=Z[sO]=Z[cO]=!1;function bO(e){return LE(e)&&ND(e.length)&&!!Z[IE(e)]}function xO(e){return function(t){return e(t)}}var SO=typeof e==`object`&&e&&!e.nodeType&&e,CO=SO&&typeof module==`object`&&module&&!module.nodeType&&module,wO=CO&&CO.exports===SO&&SE.process,TO=function(){try{return CO&&CO.require&&CO.require(`util`).types||wO&&wO.binding&&wO.binding(`util`)}catch{}}(),EO=TO&&TO.isTypedArray,DO=EO?xO(EO):bO,OO=Object.prototype.hasOwnProperty;function kO(e,t){var n=VE(e),r=!n&&WD(e),i=!n&&!r&&YD(e),a=!n&&!r&&!i&&DO(e),o=n||r||i||a,s=o?RD(e.length,String):[],c=s.length;for(var l in e)(t||OO.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||wD(l,c)))&&s.push(l);return s}function AO(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var jO=Object.prototype.hasOwnProperty;function MO(e){if(!KE(e))return AO(e);var t=LD(e),n=[];for(var r in e)r==`constructor`&&(t||!jO.call(e,r))||n.push(r);return n}function NO(e){return PD(e)?kO(e,!0):MO(e)}var PO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FO=/^\w*$/;function IO(e,t){if(VE(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||zE(e)?!0:FO.test(e)||!PO.test(e)||t!=null&&e in Object(t)}var LO=pD(Object,`create`);function RO(){this.__data__=LO?LO(null):{},this.size=0}function zO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var BO=`__lodash_hash_undefined__`,VO=Object.prototype.hasOwnProperty;function HO(e){var t=this.__data__;if(LO){var n=t[e];return n===BO?void 0:n}return VO.call(t,e)?t[e]:void 0}var UO=Object.prototype.hasOwnProperty;function WO(e){var t=this.__data__;return LO?t[e]!==void 0:UO.call(t,e)}var GO=`__lodash_hash_undefined__`;function KO(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=LO&&t===void 0?GO:t,this}function qO(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}qO.prototype.clear=RO,qO.prototype.delete=zO,qO.prototype.get=HO,qO.prototype.has=WO,qO.prototype.set=KO;function JO(){this.__data__=[],this.size=0}function YO(e,t){for(var n=e.length;n--;)if(ED(e[n][0],t))return n;return-1}var XO=Array.prototype.splice;function ZO(e){var t=this.__data__,n=YO(t,e);return n<0?!1:(n==t.length-1?t.pop():XO.call(t,n,1),--this.size,!0)}function QO(e){var t=this.__data__,n=YO(t,e);return n<0?void 0:t[n][1]}function $O(e){return YO(this.__data__,e)>-1}function ek(e,t){var n=this.__data__,r=YO(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function tk(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}tk.prototype.clear=JO,tk.prototype.delete=ZO,tk.prototype.get=QO,tk.prototype.has=$O,tk.prototype.set=ek;var nk=pD(wE,`Map`);function rk(){this.size=0,this.__data__={hash:new qO,map:new(nk||tk),string:new qO}}function ik(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function ak(e,t){var n=e.__data__;return ik(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function ok(e){var t=ak(this,e).delete(e);return this.size-=+!!t,t}function sk(e){return ak(this,e).get(e)}function ck(e){return ak(this,e).has(e)}function lk(e,t){var n=ak(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function uk(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}uk.prototype.clear=rk,uk.prototype.delete=ok,uk.prototype.get=sk,uk.prototype.has=ck,uk.prototype.set=lk;var dk=`Expected a function`;function fk(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(dk);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(fk.Cache||uk),n}fk.Cache=uk;var pk=500;function mk(e){var t=fk(e,function(e){return n.size===pk&&n.clear(),e}),n=t.cache;return t}var hk=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gk=/\\(\\)?/g,_k=mk(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(hk,function(e,n,r,i){t.push(r?i.replace(gk,`$1`):n||e)}),t});function vk(e){return e==null?``:GE(e)}function yk(e,t){return VE(e)?e:IO(e,t)?[e]:_k(vk(e))}var bk=1/0;function xk(e){if(typeof e==`string`||zE(e))return e;var t=e+``;return t==`0`&&1/e==-bk?`-0`:t}function Sk(e,t){t=yk(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[xk(t[n++])];return n&&n==r?e:void 0}function Ck(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var wk=TE?TE.isConcatSpreadable:void 0;function Tk(e){return VE(e)||WD(e)||!!(wk&&e&&e[wk])}function Ek(e,t,n,r,i){var a=-1,o=e.length;for(n||=Tk,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?Ek(s,t-1,n,r,i):Ck(i,s):r||(i[i.length]=s)}return i}function Dk(e){return e!=null&&e.length?Ek(e,1):[]}function Ok(e){return xD(AD(e,void 0,Dk),e+``)}function kk(e,t){return e!=null&&t in Object(e)}function Ak(e,t,n){t=yk(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=xk(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&ND(i)&&wD(o,i)&&(VE(e)||WD(e)))}function jk(e,t){return e!=null&&Ak(e,t,kk)}var Mk=Object.prototype,Nk=Mk.hasOwnProperty,Pk=jD(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&FD(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=NO(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||ED(u,Mk[l])&&!Nk.call(e,l))&&(e[l]=a[l])}return e});function Fk(e,t,n,r){if(!KE(e))return e;t=yk(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=xk(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=KE(u)?u:wD(t[i+1])?[]:{})}OD(s,c,l),s=s[c]}return e}function Ik(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Sk(e,o);n(s,o)&&Fk(a,yk(o,e),s)}return a}function Lk(e,t){return Ik(e,t,function(t,n){return jk(e,n)})}var Rk=Ok(function(e,t){return e==null?{}:Lk(e,t)}),zk=[`lambert`],Bk=(e,t)=>{t.color!==void 0&&e.color.set(t.color),t.opacity!==void 0&&(e.opacity=t.opacity),t.transparent!==void 0&&(e.transparent=t.transparent),t.wireframe!==void 0&&(e.wireframe=t.wireframe),t.emissiveColor!==void 0&&e.emissive.set(t.emissiveColor),t.emissiveIntensity!==void 0&&(e.emissiveIntensity=t.emissiveIntensity),t.reflectivity!==void 0&&(e.reflectivity=t.reflectivity)},Vk={uMinMaxHeight:{value:void 0},uAddExtrudedHeight:{value:0},uAddHeight:{value:0},uClampToGround:{value:!1},nvr_uPickable:{value:0},uEffectIdsMask:{value:0},uEmissiveIntensity:{value:0},uIsTexturized:{value:!1},reflectivity:{value:0},roughness:{value:0}},Hk=e=>{let t=structuredClone(Vk);return e&&(t.modelViewMatrixRTE={value:new r.Matrix4},t.u_cameraPositionHigh={value:new r.Vector3},t.u_cameraPositionLow={value:new r.Vector3}),{update:e=>{t.uMinMaxHeight.value=e.minMaxHeight,t.uAddExtrudedHeight.value=e.addExtrudedHeight,t.uAddHeight.value=e.addHeight,t.uClampToGround.value=e.clampToGround,t.nvr_uPickable.value=+!!e.pickable,t.uEffectIdsMask.value=e.effectIdsMask,t.uEmissiveIntensity.value=e.emissiveIntensity,t.uIsTexturized.value=e.isTexturized,t.reflectivity.value=e.reflectivity,t.roughness.value=e.roughness},updateUniforms:(e,n)=>{e.nvr_uPickable=t.nvr_uPickable,e.uEffectIdsMask=t.uEffectIdsMask,e.uEmissiveIntensity=t.uEmissiveIntensity,e.reflectivity=t.reflectivity,e.roughness=t.roughness,n.useRTE&&t.modelViewMatrixRTE&&t.u_cameraPositionHigh&&t.u_cameraPositionLow&&(e.u_cameraPositionHigh=t.u_cameraPositionHigh,e.u_cameraPositionLow=t.u_cameraPositionLow,e.modelViewMatrixRTE=t.modelViewMatrixRTE,e.u_rteOne=qc),t.uMinMaxHeight.value&&(e.uMinMaxHeight=t.uMinMaxHeight),e.uAddExtrudedHeight=t.uAddExtrudedHeight,e.uAddHeight=t.uAddHeight,e.uClampToGround=t.uClampToGround,t.batchDataTexture&&(e.batchDataTexture=t.batchDataTexture),e.uIsTexturized=t.uIsTexturized},setBatchDataTexture:e=>{t.batchDataTexture=e},updateRteUniforms:(e,n,r,i)=>{i.useRTE&&(t.modelViewMatrixRTE&&t.modelViewMatrixRTE.value.copy(e),t.u_cameraPositionHigh&&t.u_cameraPositionHigh.value.copy(n),t.u_cameraPositionLow&&t.u_cameraPositionLow.value.copy(r))}}},Uk=`#ifdef USE_BATCH_TEXTURE
2246
+ `,tC=Object.defineProperty,nC=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&tC(t,n,i),i},rC={...Xb,pointSize:1,intensity:1,background:!0,ground:!0},iC=class extends Zb{constructor(e){let{pointSize:t,intensity:n,background:i,ground:a,...o}={...rC,...e};super({name:`StarsMaterial`,glslVersion:r.GLSL3,vertexShader:eC,fragmentShader:$y($S,{bruneton:{common:Db,definitions:Ob,runtime:kb}}),...o,uniforms:{projectionMatrix:new r.Uniform(new r.Matrix4),modelViewMatrix:new r.Uniform(new r.Matrix4),viewMatrix:new r.Uniform(new r.Matrix4),matrixWorld:new r.Uniform(new r.Matrix4),cameraFar:new r.Uniform(0),pointSize:new r.Uniform(0),magnitudeRange:new r.Uniform(new r.Vector2(-2,8)),intensity:new r.Uniform(n),...o.uniforms},defines:{PERSPECTIVE_CAMERA:`1`},depthWrite:!0,depthTest:!0}),this.pointSize=t,this.background=i,this.ground=a}onBeforeRender(e,t,n,r,i,a){super.onBeforeRender(e,t,n,r,i,a);let o=this.uniforms;o.projectionMatrix.value.copy(n.projectionMatrix),o.modelViewMatrix.value.copy(n.modelViewMatrix),o.viewMatrix.value.copy(n.matrixWorldInverse),o.matrixWorld.value.copy(i.matrixWorld),o.cameraFar.value=n.far,o.pointSize.value=this.pointSize*e.getPixelRatio();let s=n.isPerspectiveCamera===!0;this.defines.PERSPECTIVE_CAMERA!=null!==s&&(s?this.defines.PERSPECTIVE_CAMERA=`1`:delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}get magnitudeRange(){return this.uniforms.magnitudeRange.value}get intensity(){return this.uniforms.intensity.value}set intensity(e){this.uniforms.intensity.value=e}};nC([Ky(`BACKGROUND`)],iC.prototype,`background`),nC([Ky(`GROUND`)],iC.prototype,`ground`),Sg.WGS84;var aC=class extends M{raw;_core;_status;constructor(e){super(),this.raw=e instanceof r.PerspectiveCamera?e:new r.PerspectiveCamera}set core(e){this._core=e}updateStatus(){if(this._status=this._core?.getCameraStatus(),this._status)for(let e of this._status.status)switch(e){case t.CameraStatusType.MoveStart:this.emit(`movestart`);break;case t.CameraStatusType.Moving:this.emit(`move`);break;case t.CameraStatusType.MoveEnd:case t.CameraStatusType.LookAt:case t.CameraStatusType.Rotate:this.emit(`moveend`)}}get positionECEF(){let e=this._core?.getCameraPositionECEF();return z(e),{x:e[0],y:e[1],z:e[2]}}get positionGeographic(){let e=this._core?.getCameraPositionLLE();return z(e),{lng:e[0],lat:e[1],height:e[2]}}get orientation(){let e=this._core?.getCameraOrientation();return z(e),{heading:e.heading,pitch:e.pitch,roll:e.roll}}get zoom(){return this._core?.getZoomLevel()}get fov(){let e=this._core?.getCameraFOV();return e===void 0?void 0:al(e)}set fov(e){e<1||e>180||this._core?.setFrustum(e,void 0,void 0)}set near(e){e<=0||this._core?.setFrustum(void 0,e,void 0)}get near(){return this.raw.near}set far(e){e<=this.raw.near||this._core?.setFrustum(void 0,void 0,e)}get far(){return this.raw.far}set options(e){let n=new t.CameraControlUpdateEvent;e.autoAdjustNearFar!==void 0&&(n.autoAdjustNearFar=e.autoAdjustNearFar),e.minimumZoomDistance!==void 0&&(n.minimumZoomDistance=e.minimumZoomDistance),e.maximumZoomDistance!==void 0&&(n.maximumZoomDistance=e.maximumZoomDistance),e.spinSpeed!==void 0&&(n.spinSpeed=e.spinSpeed),e.zoomSpeed!==void 0&&(n.zoomSpeed=e.zoomSpeed),e.spinDuration!==void 0&&(n.spinDuration=e.spinDuration),e.zoomDuration!==void 0&&(n.zoomDuration=e.zoomDuration),e.translateDuration!==void 0&&(n.translateDuration=e.translateDuration),e.enableSpin!==void 0&&(n.enableSpin=e.enableSpin),e.enableZoom!==void 0&&(n.enableZoom=e.enableZoom),e.enableTilt!==void 0&&(n.enableTilt=e.enableTilt),this._core?.setCameraControl(n)}},oC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/transmittance.exr`).href:new URL(`assets/atmosphere/transmittance.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),sC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/scattering.exr`).href:new URL(`assets/atmosphere/scattering.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),cC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/irradiance.exr`).href:new URL(`assets/atmosphere/irradiance.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),lC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/higher_order_scattering.exr`).href:new URL(`assets/atmosphere/higher_order_scattering.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),uC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/single_mie_scattering.exr`).href:new URL(`assets/atmosphere/single_mie_scattering.exr`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),dC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/atmosphere/stars.bin`).href:new URL(`assets/atmosphere/stars.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),fC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/local_weather.png`).href:new URL(`assets/cloud/local_weather.png`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),pC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/shape.bin`).href:new URL(`assets/cloud/shape.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),mC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/shape_detail.bin`).href:new URL(`assets/cloud/shape_detail.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),hC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/cloud/turbulence.png`).href:new URL(`assets/cloud/turbulence.png`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),gC=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/noise/stbn.bin`).href:new URL(`assets/noise/stbn.bin`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),_C=new URL(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/water/waternormals.jpg`).href:new URL(`assets/water/waternormals.jpg`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),``+{}.url).toString(),vC={"transmittance.exr":oC,"scattering.exr":sC,"irradiance.exr":cC,"higher_order_scattering.exr":lC,"single_mie_scattering.exr":uC},yC=()=>t.ElevationDecoder.japanGSI(),bC=()=>t.ElevationDecoder.mapbox(),xC=()=>t.ElevationDecoder.terrarium(),SC=173.1446326846693,CC=149597870.69098932,wC=.017453292519943295,TC=.26179938779914946,EC=57.29577951308232,DC=3.819718634205488,OC=365.24217,kC=new Date(`2000-01-01T12:00:00Z`),AC=2*Math.PI,jC=180/Math.PI*3600,MC=484813681109536e-20,NC=648e3,PC=2*NC,FC=7292115e-11,IC=NC/Math.PI;-.17-5*Math.log10(IC);var LC=86400;LC*1e3;var RC=.9972695717592592;695700/CC;var zC=.996647180302104,BC=zC*zC,VC=6378.1366,HC=VC/CC;VC*zC,1738.1/CC,1736/CC;var UC=81.30056,WC=.0002959122082855911,GC=8887692390113509e-25,KC=2.825345909524226e-7,qC=8.459715185680659e-8,JC=1.292024916781969e-8,YC=1.524358900784276e-8;GC/UC;function XC(e){if(e!==!0&&e!==!1)throw console.trace(),`Value is not boolean: ${e}`;return e}function Y(e){if(!Number.isFinite(e))throw console.trace(),`Value is not a finite number: ${e}`;return e}function ZC(e){return e-Math.floor(e)}var X;(function(e){e.Sun=`Sun`,e.Moon=`Moon`,e.Mercury=`Mercury`,e.Venus=`Venus`,e.Earth=`Earth`,e.Mars=`Mars`,e.Jupiter=`Jupiter`,e.Saturn=`Saturn`,e.Uranus=`Uranus`,e.Neptune=`Neptune`,e.Pluto=`Pluto`,e.SSB=`SSB`,e.EMB=`EMB`,e.Star1=`Star1`,e.Star2=`Star2`,e.Star3=`Star3`,e.Star4=`Star4`,e.Star5=`Star5`,e.Star6=`Star6`,e.Star7=`Star7`,e.Star8=`Star8`})(X||={});var QC=[X.Star1,X.Star2,X.Star3,X.Star4,X.Star5,X.Star6,X.Star7,X.Star8],$C=[{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0},{ra:0,dec:0,dist:0}];function ew(e){let t=QC.indexOf(e);return t>=0?$C[t]:null}function tw(e){let t=ew(e);return t&&t.dist>0?t:null}var nw;(function(e){e[e.From2000=0]=`From2000`,e[e.Into2000=1]=`Into2000`})(nw||={});var rw={Mercury:[[[[4.40250710144,0,0],[.40989414977,1.48302034195,26087.9031415742],[.050462942,4.47785489551,52175.8062831484],[.00855346844,1.16520322459,78263.70942472259],[.00165590362,4.11969163423,104351.61256629678],[.00034561897,.77930768443,130439.51570787099],[7583476e-11,3.71348404924,156527.41884944518]],[[26087.90313685529,0,0],[.01131199811,6.21874197797,26087.9031415742],[.00292242298,3.04449355541,52175.8062831484],[.00075775081,6.08568821653,78263.70942472259],[.00019676525,2.80965111777,104351.61256629678]]],[[[.11737528961,1.98357498767,26087.9031415742],[.02388076996,5.03738959686,52175.8062831484],[.01222839532,3.14159265359,0],[.0054325181,1.79644363964,78263.70942472259],[.0012977877,4.83232503958,104351.61256629678],[.00031866927,1.58088495658,130439.51570787099],[7963301e-11,4.60972126127,156527.41884944518]],[[.00274646065,3.95008450011,26087.9031415742],[.00099737713,3.14159265359,0]]],[[[.39528271651,0,0],[.07834131818,6.19233722598,26087.9031415742],[.00795525558,2.95989690104,52175.8062831484],[.00121281764,6.01064153797,78263.70942472259],[.00021921969,2.77820093972,104351.61256629678],[4354065e-11,5.82894543774,130439.51570787099]],[[.0021734774,4.65617158665,26087.9031415742],[.00044141826,1.42385544001,52175.8062831484]]]],Venus:[[[[3.17614666774,0,0],[.01353968419,5.59313319619,10213.285546211],[.00089891645,5.30650047764,20426.571092422],[5477194e-11,4.41630661466,7860.4193924392],[3455741e-11,2.6996444782,11790.6290886588],[2372061e-11,2.99377542079,3930.2096962196],[1317168e-11,5.18668228402,26.2983197998],[1664146e-11,4.25018630147,1577.3435424478],[1438387e-11,4.15745084182,9683.5945811164],[1200521e-11,6.15357116043,30639.856638633]],[[10213.28554621638,0,0],[.00095617813,2.4640651111,10213.285546211],[7787201e-11,.6247848222,20426.571092422]]],[[[.05923638472,.26702775812,10213.285546211],[.00040107978,1.14737178112,20426.571092422],[.00032814918,3.14159265359,0]],[[.00287821243,1.88964962838,10213.285546211]]],[[[.72334820891,0,0],[.00489824182,4.02151831717,10213.285546211],[1658058e-11,4.90206728031,20426.571092422],[1378043e-11,1.12846591367,11790.6290886588],[1632096e-11,2.84548795207,7860.4193924392],[498395e-11,2.58682193892,9683.5945811164],[221985e-11,2.01346696541,19367.1891622328],[237454e-11,2.55136053886,15720.8387848784]],[[.00034551041,.89198706276,10213.285546211]]]],Earth:[[[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438]],[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828]],[[8721859e-11,1.07253635559,6283.0758499914]]],[[],[[.00227777722,3.4137662053,6283.0758499914],[3805678e-11,3.37063423795,12566.1516999828]]],[[[1.00013988784,0,0],[.01670699632,3.09846350258,6283.0758499914],[.00013956024,3.05524609456,12566.1516999828],[308372e-10,5.19846674381,77713.7714681205],[1628463e-11,1.17387558054,5753.3848848968],[1575572e-11,2.84685214877,7860.4193924392],[924799e-11,5.45292236722,11506.7697697936],[542439e-11,4.56409151453,3930.2096962196],[47211e-10,3.66100022149,5884.9268465832],[8.5831e-7,1.27079125277,161000.6857376741],[5.7056e-7,2.01374292245,83996.84731811189],[5.5736e-7,5.2415979917,71430.69561812909],[174844e-11,3.01193636733,18849.2275499742],[243181e-11,4.2734953079,11790.6290886588]],[[.00103018607,1.10748968172,6283.0758499914],[1721238e-11,1.06442300386,12566.1516999828]],[[4359385e-11,5.78455133808,6283.0758499914]]]],Mars:[[[[6.20347711581,0,0],[.18656368093,5.0503710027,3340.6124266998],[.01108216816,5.40099836344,6681.2248533996],[.00091798406,5.75478744667,10021.8372800994],[.00027744987,5.97049513147,3.523118349],[.00010610235,2.93958560338,2281.2304965106],[.00012315897,.84956094002,2810.9214616052],[8926784e-11,4.15697846427,.0172536522],[8715691e-11,6.11005153139,13362.4497067992],[6797556e-11,.36462229657,398.1490034082],[7774872e-11,3.33968761376,5621.8429232104],[3575078e-11,1.6618650571,2544.3144198834],[4161108e-11,.22814971327,2942.4634232916],[3075252e-11,.85696614132,191.4482661116],[2628117e-11,.64806124465,3337.0893083508],[2937546e-11,6.07893711402,.0673103028],[2389414e-11,5.03896442664,796.2980068164],[2579844e-11,.02996736156,3344.1355450488],[1528141e-11,1.14979301996,6151.533888305],[1798806e-11,.65634057445,529.6909650946],[1264357e-11,3.62275122593,5092.1519581158],[1286228e-11,3.06796065034,2146.1654164752],[1546404e-11,2.91579701718,1751.539531416],[1024902e-11,3.69334099279,8962.4553499102],[891566e-11,.18293837498,16703.062133499],[858759e-11,2.4009381194,2914.0142358238],[832715e-11,2.46418619474,3340.5951730476],[83272e-10,4.49495782139,3340.629680352],[712902e-11,3.66335473479,1059.3819301892],[748723e-11,3.82248614017,155.4203994342],[723861e-11,.67497311481,3738.761430108],[635548e-11,2.92182225127,8432.7643848156],[655162e-11,.48864064125,3127.3133312618],[550474e-11,3.81001042328,.9803210682],[55275e-10,4.47479317037,1748.016413067],[425966e-11,.55364317304,6283.0758499914],[415131e-11,.49662285038,213.299095438],[472167e-11,3.62547124025,1194.4470102246],[306551e-11,.38052848348,6684.7479717486],[312141e-11,.99853944405,6677.7017350506],[293198e-11,4.22131299634,20.7753954924],[302375e-11,4.48618007156,3532.0606928114],[274027e-11,.54222167059,3340.545116397],[281079e-11,5.88163521788,1349.8674096588],[231183e-11,1.28242156993,3870.3033917944],[283602e-11,5.7688543494,3149.1641605882],[236117e-11,5.75503217933,3333.498879699],[274033e-11,.13372524985,3340.6797370026],[299395e-11,2.78323740866,6254.6266625236]],[[3340.61242700512,0,0],[.01457554523,3.60433733236,3340.6124266998],[.00168414711,3.92318567804,6681.2248533996],[.00020622975,4.26108844583,10021.8372800994],[3452392e-11,4.7321039319,3.523118349],[2586332e-11,4.60670058555,13362.4497067992],[841535e-11,4.45864030426,2281.2304965106]],[[.00058152577,2.04961712429,3340.6124266998],[.00013459579,2.45738706163,6681.2248533996]]],[[[.03197134986,3.76832042431,3340.6124266998],[.00298033234,4.10616996305,6681.2248533996],[.00289104742,0,0],[.00031365539,4.4465105309,10021.8372800994],[34841e-9,4.7881254926,13362.4497067992]],[[.00217310991,6.04472194776,3340.6124266998],[.00020976948,3.14159265359,0],[.00012834709,1.60810667915,6681.2248533996]]],[[[1.53033488271,0,0],[.1418495316,3.47971283528,3340.6124266998],[.00660776362,3.81783443019,6681.2248533996],[.00046179117,4.15595316782,10021.8372800994],[8109733e-11,5.55958416318,2810.9214616052],[7485318e-11,1.77239078402,5621.8429232104],[5523191e-11,1.3643630377,2281.2304965106],[382516e-10,4.49407183687,13362.4497067992],[2306537e-11,.09081579001,2544.3144198834],[1999396e-11,5.36059617709,3337.0893083508],[2484394e-11,4.9254563992,2942.4634232916],[1960195e-11,4.74249437639,3344.1355450488],[1167119e-11,2.11260868341,5092.1519581158],[1102816e-11,5.00908403998,398.1490034082],[899066e-11,4.40791133207,529.6909650946],[992252e-11,5.83861961952,6151.533888305],[807354e-11,2.10217065501,1059.3819301892],[797915e-11,3.44839203899,796.2980068164],[740975e-11,1.49906336885,2146.1654164752]],[[.01107433345,2.03250524857,3340.6124266998],[.00103175887,2.37071847807,6681.2248533996],[128772e-9,0,0],[.0001081588,2.70888095665,10021.8372800994]],[[.00044242249,.47930604954,3340.6124266998],[8138042e-11,.86998389204,6681.2248533996]]]],Jupiter:[[[[.59954691494,0,0],[.09695898719,5.06191793158,529.6909650946],[.00573610142,1.44406205629,7.1135470008],[.00306389205,5.41734730184,1059.3819301892],[.00097178296,4.14264726552,632.7837393132],[.00072903078,3.64042916389,522.5774180938],[.00064263975,3.41145165351,103.0927742186],[.00039806064,2.29376740788,419.4846438752],[.00038857767,1.27231755835,316.3918696566],[.00027964629,1.7845459182,536.8045120954],[.0001358973,5.7748104079,1589.0728952838],[8246349e-11,3.5822792584,206.1855484372],[8768704e-11,3.63000308199,949.1756089698],[7368042e-11,5.0810119427,735.8765135318],[626315e-10,.02497628807,213.299095438],[6114062e-11,4.51319998626,1162.4747044078],[4905396e-11,1.32084470588,110.2063212194],[5305285e-11,1.30671216791,14.2270940016],[5305441e-11,4.18625634012,1052.2683831884],[4647248e-11,4.69958103684,3.9321532631],[3045023e-11,4.31676431084,426.598190876],[2609999e-11,1.56667394063,846.0828347512],[2028191e-11,1.06376530715,3.1813937377],[1764763e-11,2.14148655117,1066.49547719],[1722972e-11,3.88036268267,1265.5674786264],[1920945e-11,.97168196472,639.897286314],[1633223e-11,3.58201833555,515.463871093],[1431999e-11,4.29685556046,625.6701923124],[973272e-11,4.09764549134,95.9792272178]],[[529.69096508814,0,0],[.00489503243,4.2208293947,529.6909650946],[.00228917222,6.02646855621,7.1135470008],[.00030099479,4.54540782858,1059.3819301892],[.0002072092,5.45943156902,522.5774180938],[.00012103653,.16994816098,536.8045120954],[6067987e-11,4.42422292017,103.0927742186],[5433968e-11,3.98480737746,419.4846438752],[4237744e-11,5.89008707199,14.2270940016]],[[.00047233601,4.32148536482,7.1135470008],[.00030649436,2.929777887,529.6909650946],[.00014837605,3.14159265359,0]]],[[[.02268615702,3.55852606721,529.6909650946],[.00109971634,3.90809347197,1059.3819301892],[.00110090358,0,0],[8101428e-11,3.60509572885,522.5774180938],[6043996e-11,4.25883108339,1589.0728952838],[6437782e-11,.30627119215,536.8045120954]],[[.00078203446,1.52377859742,529.6909650946]]],[[[5.20887429326,0,0],[.25209327119,3.49108639871,529.6909650946],[.00610599976,3.84115365948,1059.3819301892],[.00282029458,2.57419881293,632.7837393132],[.00187647346,2.07590383214,522.5774180938],[.00086792905,.71001145545,419.4846438752],[.00072062974,.21465724607,536.8045120954],[.00065517248,5.9799588479,316.3918696566],[.00029134542,1.67759379655,103.0927742186],[.00030135335,2.16132003734,949.1756089698],[.00023453271,3.54023522184,735.8765135318],[.00022283743,4.19362594399,1589.0728952838],[.00023947298,.2745803748,7.1135470008],[.00013032614,2.96042965363,1162.4747044078],[970336e-10,1.90669633585,206.1855484372],[.00012749023,2.71550286592,1052.2683831884],[7057931e-11,2.18184839926,1265.5674786264],[6137703e-11,6.26418240033,846.0828347512],[2616976e-11,2.00994012876,1581.959348283]],[[.0127180152,2.64937512894,529.6909650946],[.00061661816,3.00076460387,1059.3819301892],[.00053443713,3.89717383175,522.5774180938],[.00031185171,4.88276958012,536.8045120954],[.00041390269,0,0]]]],Saturn:[[[[.87401354025,0,0],[.11107659762,3.96205090159,213.299095438],[.01414150957,4.58581516874,7.1135470008],[.00398379389,.52112032699,206.1855484372],[.00350769243,3.30329907896,426.598190876],[.00206816305,.24658372002,103.0927742186],[792713e-9,3.84007056878,220.4126424388],[.00023990355,4.66976924553,110.2063212194],[.00016573588,.43719228296,419.4846438752],[.00014906995,5.76903183869,316.3918696566],[.0001582029,.93809155235,632.7837393132],[.00014609559,1.56518472,3.9321532631],[.00013160301,4.44891291899,14.2270940016],[.00015053543,2.71669915667,639.897286314],[.00013005299,5.98119023644,11.0457002639],[.00010725067,3.12939523827,202.2533951741],[5863206e-11,.23656938524,529.6909650946],[5227757e-11,4.20783365759,3.1813937377],[6126317e-11,1.76328667907,277.0349937414],[5019687e-11,3.17787728405,433.7117378768],[459255e-10,.61977744975,199.0720014364],[4005867e-11,2.24479718502,63.7358983034],[2953796e-11,.98280366998,95.9792272178],[387367e-10,3.22283226966,138.5174968707],[2461186e-11,2.03163875071,735.8765135318],[3269484e-11,.77492638211,949.1756089698],[1758145e-11,3.2658010994,522.5774180938],[1640172e-11,5.5050445305,846.0828347512],[1391327e-11,4.02333150505,323.5054166574],[1580648e-11,4.37265307169,309.2783226558],[1123498e-11,2.83726798446,415.5524906121],[1017275e-11,3.71700135395,227.5261894396],[848642e-11,3.1915017083,209.3669421749]],[[213.2990952169,0,0],[.01297370862,1.82834923978,213.299095438],[.00564345393,2.88499717272,7.1135470008],[.00093734369,1.06311793502,426.598190876],[.00107674962,2.27769131009,206.1855484372],[.00040244455,2.04108104671,220.4126424388],[.00019941774,1.2795439047,103.0927742186],[.00010511678,2.7488034213,14.2270940016],[6416106e-11,.38238295041,639.897286314],[4848994e-11,2.43037610229,419.4846438752],[4056892e-11,2.92133209468,110.2063212194],[3768635e-11,3.6496533078,3.9321532631]],[[.0011644133,1.17988132879,7.1135470008],[.00091841837,.0732519584,213.299095438],[.00036661728,0,0],[.00015274496,4.06493179167,206.1855484372]]],[[[.04330678039,3.60284428399,213.299095438],[.00240348302,2.85238489373,426.598190876],[.00084745939,0,0],[.00030863357,3.48441504555,220.4126424388],[.00034116062,.57297307557,206.1855484372],[.0001473407,2.11846596715,639.897286314],[9916667e-11,5.79003188904,419.4846438752],[6993564e-11,4.7360468972,7.1135470008],[4807588e-11,5.43305312061,316.3918696566]],[[.00198927992,4.93901017903,213.299095438],[.00036947916,3.14159265359,0],[.00017966989,.5197943111,426.598190876]]],[[[9.55758135486,0,0],[.52921382865,2.39226219573,213.299095438],[.01873679867,5.2354960466,206.1855484372],[.01464663929,1.64763042902,426.598190876],[.00821891141,5.93520042303,316.3918696566],[.00547506923,5.0153261898,103.0927742186],[.0037168465,2.27114821115,220.4126424388],[.00361778765,3.13904301847,7.1135470008],[.00140617506,5.70406606781,632.7837393132],[.00108974848,3.29313390175,110.2063212194],[.00069006962,5.94099540992,419.4846438752],[.00061053367,.94037691801,639.897286314],[.00048913294,1.55733638681,202.2533951741],[.00034143772,.19519102597,277.0349937414],[.00032401773,5.47084567016,949.1756089698],[.00020936596,.46349251129,735.8765135318],[9796004e-11,5.20477537945,1265.5674786264],[.00011993338,5.98050967385,846.0828347512],[208393e-9,1.52102476129,433.7117378768],[.00015298404,3.0594381494,529.6909650946],[6465823e-11,.17732249942,1052.2683831884],[.00011380257,1.7310542704,522.5774180938],[3419618e-11,4.94550542171,1581.959348283]],[[.0618298134,.2584351148,213.299095438],[.00506577242,.71114625261,206.1855484372],[.00341394029,5.79635741658,426.598190876],[.00188491195,.47215589652,220.4126424388],[.00186261486,3.14159265359,0],[.00143891146,1.40744822888,7.1135470008]],[[.00436902572,4.78671677509,213.299095438]]]],Uranus:[[[[5.48129294297,0,0],[.09260408234,.89106421507,74.7815985673],[.01504247898,3.6271926092,1.4844727083],[.00365981674,1.89962179044,73.297125859],[.00272328168,3.35823706307,149.5631971346],[.00070328461,5.39254450063,63.7358983034],[.00068892678,6.09292483287,76.2660712756],[.00061998615,2.26952066061,2.9689454166],[.00061950719,2.85098872691,11.0457002639],[.0002646877,3.14152083966,71.8126531507],[.00025710476,6.11379840493,454.9093665273],[.0002107885,4.36059339067,148.0787244263],[.00017818647,1.74436930289,36.6485629295],[.00014613507,4.73732166022,3.9321532631],[.00011162509,5.8268179635,224.3447957019],[.0001099791,.48865004018,138.5174968707],[9527478e-11,2.95516862826,35.1640902212],[7545601e-11,5.236265824,109.9456887885],[4220241e-11,3.23328220918,70.8494453042],[40519e-9,2.277550173,151.0476698429],[3354596e-11,1.0654900738,4.4534181249],[2926718e-11,4.62903718891,9.5612275556],[349034e-10,5.48306144511,146.594251718],[3144069e-11,4.75199570434,77.7505439839],[2922333e-11,5.35235361027,85.8272988312],[2272788e-11,4.36600400036,70.3281804424],[2051219e-11,1.51773566586,.1118745846],[2148602e-11,.60745949945,38.1330356378],[1991643e-11,4.92437588682,277.0349937414],[1376226e-11,2.04283539351,65.2203710117],[1666902e-11,3.62744066769,380.12776796],[1284107e-11,3.11347961505,202.2533951741],[1150429e-11,.93343589092,3.1813937377],[1533221e-11,2.58594681212,52.6901980395],[1281604e-11,.54271272721,222.8603229936],[1372139e-11,4.19641530878,111.4301614968],[1221029e-11,.1990065003,108.4612160802],[946181e-11,1.19253165736,127.4717966068],[1150989e-11,4.17898916639,33.6796175129]],[[74.7815986091,0,0],[.00154332863,5.24158770553,74.7815985673],[.00024456474,1.71260334156,1.4844727083],[9258442e-11,.4282973235,11.0457002639],[8265977e-11,1.50218091379,63.7358983034],[915016e-10,1.41213765216,149.5631971346]]],[[[.01346277648,2.61877810547,74.7815985673],[623414e-9,5.08111189648,149.5631971346],[.00061601196,3.14159265359,0],[9963722e-11,1.61603805646,76.2660712756],[992616e-10,.57630380333,73.297125859]],[[.00034101978,.01321929936,74.7815985673]]],[[[19.21264847206,0,0],[.88784984413,5.60377527014,74.7815985673],[.03440836062,.32836099706,73.297125859],[.0205565386,1.7829515933,149.5631971346],[.0064932241,4.52247285911,76.2660712756],[.00602247865,3.86003823674,63.7358983034],[.00496404167,1.40139935333,454.9093665273],[.00338525369,1.58002770318,138.5174968707],[.00243509114,1.57086606044,71.8126531507],[.00190522303,1.99809394714,1.4844727083],[.00161858838,2.79137786799,148.0787244263],[.00143706183,1.38368544947,11.0457002639],[.00093192405,.17437220467,36.6485629295],[.00071424548,4.24509236074,224.3447957019],[.00089806014,3.66105364565,109.9456887885],[.00039009723,1.66971401684,70.8494453042],[.00046677296,1.39976401694,35.1640902212],[.00039025624,3.36234773834,277.0349937414],[.00036755274,3.88649278513,146.594251718],[.00030348723,.70100838798,151.0476698429],[.00029156413,3.180563367,77.7505439839],[.00022637073,.72518687029,529.6909650946],[.00011959076,1.7504339214,984.6003316219],[.00025620756,5.25656086672,380.12776796]],[[.01479896629,3.67205697578,74.7815985673]]]],Neptune:[[[[5.31188633046,0,0],[.0179847553,2.9010127389,38.1330356378],[.01019727652,.48580922867,1.4844727083],[.00124531845,4.83008090676,36.6485629295],[.00042064466,5.41054993053,2.9689454166],[.00037714584,6.09221808686,35.1640902212],[.00033784738,1.24488874087,76.2660712756],[.00016482741,7727998e-11,491.5579294568],[9198584e-11,4.93747051954,39.6175083461],[899425e-10,.27462171806,175.1660598002]],[[38.13303563957,0,0],[.00016604172,4.86323329249,1.4844727083],[.00015744045,2.27887427527,38.1330356378]]],[[[.03088622933,1.44104372644,38.1330356378],[.00027780087,5.91271884599,76.2660712756],[.00027623609,0,0],[.00015355489,2.52123799551,36.6485629295],[.00015448133,3.50877079215,39.6175083461]]],[[[30.07013205828,0,0],[.27062259632,1.32999459377,38.1330356378],[.01691764014,3.25186135653,36.6485629295],[.00807830553,5.18592878704,1.4844727083],[.0053776051,4.52113935896,35.1640902212],[.00495725141,1.5710564165,491.5579294568],[.00274571975,1.84552258866,175.1660598002],[.0001201232,1.92059384991,1021.2488945514],[.00121801746,5.79754470298,76.2660712756],[.00100896068,.3770272493,73.297125859],[.00135134092,3.37220609835,39.6175083461],[7571796e-11,1.07149207335,388.4651552382]]]]};function iw(e){var t,n,r,i,a,o,s;let c=2e3+(e-14)/OC;return c<-500?(t=(c-1820)/100,-20+32*t*t):c<500?(t=c/100,n=t*t,r=t*n,i=n*n,a=n*r,o=r*r,10583.6-1014.41*t+33.78311*n-5.952053*r-.1798452*i+.022174192*a+.0090316521*o):c<1600?(t=(c-1e3)/100,n=t*t,r=t*n,i=n*n,a=n*r,o=r*r,1574.2-556.01*t+71.23472*n+.319781*r-.8503463*i-.005050998*a+.0083572073*o):c<1700?(t=c-1600,n=t*t,r=t*n,120-.9808*t-.01532*n+r/7129):c<1800?(t=c-1700,n=t*t,r=t*n,i=n*n,8.83+.1603*t-.0059285*n+13336e-8*r-i/1174e3):c<1860?(t=c-1800,n=t*t,r=t*n,i=n*n,a=n*r,o=r*r,s=r*i,13.72-.332447*t+.0068612*n+.0041116*r-37436e-8*i+121272e-10*a-1.699e-7*o+875e-12*s):c<1900?(t=c-1860,n=t*t,r=t*n,i=n*n,a=n*r,7.62+.5737*t-.251754*n+.01680668*r-.0004473624*i+a/233174):c<1920?(t=c-1900,n=t*t,r=t*n,i=n*n,-2.79+1.494119*t-.0598939*n+.0061966*r-197e-6*i):c<1941?(t=c-1920,n=t*t,r=t*n,21.2+.84493*t-.0761*n+.0020936*r):c<1961?(t=c-1950,n=t*t,r=t*n,29.07+.407*t-n/233+r/2547):c<1986?(t=c-1975,n=t*t,r=t*n,45.45+1.067*t-n/260-r/718):c<2005?(t=c-2e3,n=t*t,r=t*n,i=n*n,a=n*r,63.86+.3345*t-.060374*n+.0017275*r+651814e-9*i+2373599e-11*a):c<2050?(t=c-2e3,62.92+.32217*t+.005589*t*t):c<2150?(t=(c-1820)/100,-20+32*t*t-.5628*(2150-c)):(t=(c-1820)/100,-20+32*t*t)}var aw=iw;function ow(e){return e+aw(e)/86400}var sw=class e{constructor(t){if(t instanceof e){this.date=t.date,this.ut=t.ut,this.tt=t.tt;return}let n=864e5;if(t instanceof Date&&Number.isFinite(t.getTime())){this.date=t,this.ut=(t.getTime()-kC.getTime())/n,this.tt=ow(this.ut);return}if(Number.isFinite(t)){this.date=new Date(kC.getTime()+t*n),this.ut=t,this.tt=ow(this.ut);return}throw`Argument must be a Date object, an AstroTime object, or a numeric UTC Julian date.`}static FromTerrestrialTime(t){let n=new e(t);for(;;){let e=t-n.tt;if(Math.abs(e)<1e-12)return n;n=n.AddDays(e)}}toString(){return this.date.toISOString()}AddDays(t){return new e(this.ut+t)}};function cw(e,t,n){return new sw(e.ut+n*(t.ut-e.ut))}function lw(e){return e instanceof sw?e:new sw(e)}function uw(e){function t(e){return e%PC*MC}let n=e.tt/36525,r=t(1287104.79305+n*129596581.0481),i=t(335779.526232+n*1739527262.8478),a=t(1072260.70369+n*1602961601.209),o=t(450160.398036-n*6962890.5431),s=Math.sin(o),c=Math.cos(o),l=(-172064161-174666*n)*s+33386*c,u=(92052331+9086*n)*c+15377*s,d=2*(i-a+o);return s=Math.sin(d),c=Math.cos(d),l+=(-13170906-1675*n)*s-13696*c,u+=(5730336-3015*n)*c-4587*s,d=2*(i+o),s=Math.sin(d),c=Math.cos(d),l+=(-2276413-234*n)*s+2796*c,u+=(978459-485*n)*c+1374*s,d=2*o,s=Math.sin(d),c=Math.cos(d),l+=(2074554+207*n)*s-698*c,u+=(-897492+470*n)*c-291*s,s=Math.sin(r),c=Math.cos(r),l+=(1475877-3633*n)*s+11817*c,u+=(73871-184*n)*c-1924*s,{dpsi:-135e-6+l*1e-7,deps:388e-6+u*1e-7}}function dw(e){var t=e.tt/36525;return(((((-4.34e-8*t-576e-9)*t+.0020034)*t-1831e-7)*t-46.836769)*t+84381.406)/3600}var fw;function pw(e){if(!fw||Math.abs(fw.tt-e.tt)>1e-6){let t=uw(e),n=dw(e),r=n+t.deps/3600;fw={tt:e.tt,dpsi:t.dpsi,deps:t.deps,ee:t.dpsi*Math.cos(n*wC)/15,mobl:n,tobl:r}}return fw}function mw(e,t){let n=e*wC,r=Math.cos(n),i=Math.sin(n);return[t[0],t[1]*r-t[2]*i,t[1]*i+t[2]*r]}function hw(e,t){return mw(dw(e),t)}var gw=0;function _w(e){++gw;let t=e.tt/36525;function n(e,t){let n=[],r;for(r=0;r<=t-e;++r)n.push(0);return{min:e,array:n}}function r(e,t,r,i){let a=[];for(let o=0;o<=t-e;++o)a.push(n(r,i));return{min:e,array:a}}function i(e,t,n){let r=e.array[t-e.min];return r.array[n-r.min]}function a(e,t,n,r){let i=e.array[t-e.min];i.array[n-i.min]=r}let o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,ee=r(-6,6,1,4),k=r(-6,6,1,4);function te(e,t){return i(ee,e,t)}function A(e,t){return i(k,e,t)}function j(e,t,n){return a(ee,e,t,n)}function ne(e,t,n){return a(k,e,t,n)}function M(e,t,n,r,i){i(e*n-t*r,t*n+e*r)}function N(e){return Math.sin(AC*e)}f=t*t,m=0,O=0,g=0,_=3422.7;var re=N(.19833+.05611*t),ie=N(.27869+.04508*t),ae=N(.16827-.36903*t),oe=N(.34734-5.37261*t),se=N(.10498-5.37899*t),ce=N(.42681-.41855*t),le=N(.14943-5.37511*t);for(C=.84*re+.31*ie+14.27*ae+7.26*oe+.28*se+.24*ce,w=2.94*re+.31*ie+14.27*ae+9.34*oe+1.12*se+.83*ce,T=-6.4*re-1.89*ce,E=.21*re+.31*ie+14.27*ae-88.7*oe-15.3*se+.24*ce-1.86*le,D=C-T,p=-3332e-9*N(.59734-5.37261*t)-539e-9*N(.35498-5.37899*t)-64e-9*N(.39943-5.37511*t),v=AC*ZC(.60643382+1336.85522467*t-313e-8*f)+C/jC,y=AC*ZC(.37489701+1325.55240982*t+2565e-8*f)+w/jC,b=AC*ZC(.99312619+99.99735956*t-44e-8*f)+T/jC,x=AC*ZC(.25909118+1342.2278298*t-892e-8*f)+E/jC,S=AC*ZC(.82736186+1236.85308708*t-397e-8*f)+D/jC,u=1;u<=4;++u){switch(u){case 1:c=y,s=4,l=1.000002208;break;case 2:c=b,s=3,l=.997504612-.002495388*t;break;case 3:c=x,s=4,l=1.000002708+139.978*p;break;case 4:c=S,s=6,l=1;break;default:throw`Internal error: I = ${u}`}for(j(0,u,1),j(1,u,Math.cos(c)*l),ne(0,u,0),ne(1,u,Math.sin(c)*l),d=2;d<=s;++d)M(te(d-1,u),A(d-1,u),te(1,u),A(1,u),(e,t)=>(j(d,u,e),ne(d,u,t)));for(d=1;d<=s;++d)j(-d,u,te(d,u)),ne(-d,u,-A(d,u))}function ue(e,t,n,r){for(var i={x:1,y:0},a=[0,e,t,n,r],o=1;o<=4;++o)a[o]!==0&&M(i.x,i.y,te(a[o],o),A(a[o],o),(e,t)=>(i.x=e,i.y=t));return i}function P(e,t,n,r,i,a,o,s){var c=ue(i,a,o,s);m+=e*c.y,O+=t*c.y,g+=n*c.x,_+=r*c.x}P(13.902,14.06,-.001,.2607,0,0,0,4),P(.403,-4.01,.394,.0023,0,0,0,3),P(2369.912,2373.36,.601,28.2333,0,0,0,2),P(-125.154,-112.79,-.725,-.9781,0,0,0,1),P(1.979,6.98,-.445,.0433,1,0,0,4),P(191.953,192.72,.029,3.0861,1,0,0,2),P(-8.466,-13.51,.455,-.1093,1,0,0,1),P(22639.5,22609.07,.079,186.5398,1,0,0,0),P(18.609,3.59,-.094,.0118,1,0,0,-1),P(-4586.465,-4578.13,-.077,34.3117,1,0,0,-2),P(3.215,5.44,.192,-.0386,1,0,0,-3),P(-38.428,-38.64,.001,.6008,1,0,0,-4),P(-.393,-1.43,-.092,.0086,1,0,0,-6),P(-.289,-1.59,.123,-.0053,0,1,0,4),P(-24.42,-25.1,.04,-.3,0,1,0,2),P(18.023,17.93,.007,.1494,0,1,0,1),P(-668.146,-126.98,-1.302,-.3997,0,1,0,0),P(.56,.32,-.001,-.0037,0,1,0,-1),P(-165.145,-165.06,.054,1.9178,0,1,0,-2),P(-1.877,-6.46,-.416,.0339,0,1,0,-4),P(.213,1.02,-.074,.0054,2,0,0,4),P(14.387,14.78,-.017,.2833,2,0,0,2),P(-.586,-1.2,.054,-.01,2,0,0,1),P(769.016,767.96,.107,10.1657,2,0,0,0),P(1.75,2.01,-.018,.0155,2,0,0,-1),P(-211.656,-152.53,5.679,-.3039,2,0,0,-2),P(1.225,.91,-.03,-.0088,2,0,0,-3),P(-30.773,-34.07,-.308,.3722,2,0,0,-4),P(-.57,-1.4,-.074,.0109,2,0,0,-6),P(-2.921,-11.75,.787,-.0484,1,1,0,2),P(1.267,1.52,-.022,.0164,1,1,0,1),P(-109.673,-115.18,.461,-.949,1,1,0,0),P(-205.962,-182.36,2.056,1.4437,1,1,0,-2),P(.233,.36,.012,-.0025,1,1,0,-3),P(-4.391,-9.66,-.471,.0673,1,1,0,-4),P(.283,1.53,-.111,.006,1,-1,0,4),P(14.577,31.7,-1.54,.2302,1,-1,0,2),P(147.687,138.76,.679,1.1528,1,-1,0,0),P(-1.089,.55,.021,0,1,-1,0,-1),P(28.475,23.59,-.443,-.2257,1,-1,0,-2),P(-.276,-.38,-.006,-.0036,1,-1,0,-3),P(.636,2.27,.146,-.0102,1,-1,0,-4),P(-.189,-1.68,.131,-.0028,0,2,0,2),P(-7.486,-.66,-.037,-.0086,0,2,0,0),P(-8.096,-16.35,-.74,.0918,0,2,0,-2),P(-5.741,-.04,0,-9e-4,0,0,2,2),P(.255,0,0,0,0,0,2,1),P(-411.608,-.2,0,-.0124,0,0,2,0),P(.584,.84,0,.0071,0,0,2,-1),P(-55.173,-52.14,0,-.1052,0,0,2,-2),P(.254,.25,0,-.0017,0,0,2,-3),P(.025,-1.67,0,.0031,0,0,2,-4),P(1.06,2.96,-.166,.0243,3,0,0,2),P(36.124,50.64,-1.3,.6215,3,0,0,0),P(-13.193,-16.4,.258,-.1187,3,0,0,-2),P(-1.187,-.74,.042,.0074,3,0,0,-4),P(-.293,-.31,-.002,.0046,3,0,0,-6),P(-.29,-1.45,.116,-.0051,2,1,0,2),P(-7.649,-10.56,.259,-.1038,2,1,0,0),P(-8.627,-7.59,.078,-.0192,2,1,0,-2),P(-2.74,-2.54,.022,.0324,2,1,0,-4),P(1.181,3.32,-.212,.0213,2,-1,0,2),P(9.703,11.67,-.151,.1268,2,-1,0,0),P(-.352,-.37,.001,-.0028,2,-1,0,-1),P(-2.494,-1.17,-.003,-.0017,2,-1,0,-2),P(.36,.2,-.012,-.0043,2,-1,0,-4),P(-1.167,-1.25,.008,-.0106,1,2,0,0),P(-7.412,-6.12,.117,.0484,1,2,0,-2),P(-.311,-.65,-.032,.0044,1,2,0,-4),P(.757,1.82,-.105,.0112,1,-2,0,2),P(2.58,2.32,.027,.0196,1,-2,0,0),P(2.533,2.4,-.014,-.0212,1,-2,0,-2),P(-.344,-.57,-.025,.0036,0,3,0,-2),P(-.992,-.02,0,0,1,0,2,2),P(-45.099,-.02,0,-.001,1,0,2,0),P(-.179,-9.52,0,-.0833,1,0,2,-2),P(-.301,-.33,0,.0014,1,0,2,-4),P(-6.382,-3.37,0,-.0481,1,0,-2,2),P(39.528,85.13,0,-.7136,1,0,-2,0),P(9.366,.71,0,-.0112,1,0,-2,-2),P(.202,.02,0,0,1,0,-2,-4),P(.415,.1,0,.0013,0,1,2,0),P(-2.152,-2.26,0,-.0066,0,1,2,-2),P(-1.44,-1.3,0,.0014,0,1,-2,2),P(.384,-.04,0,0,0,1,-2,-2),P(1.938,3.6,-.145,.0401,4,0,0,0),P(-.952,-1.58,.052,-.013,4,0,0,-2),P(-.551,-.94,.032,-.0097,3,1,0,0),P(-.482,-.57,.005,-.0045,3,1,0,-2),P(.681,.96,-.026,.0115,3,-1,0,0),P(-.297,-.27,.002,-9e-4,2,2,0,-2),P(.254,.21,-.003,0,2,-2,0,-2),P(-.25,-.22,.004,.0014,1,3,0,-2),P(-3.996,0,0,4e-4,2,0,2,0),P(.557,-.75,0,-.009,2,0,2,-2),P(-.459,-.38,0,-.0053,2,0,-2,2),P(-1.298,.74,0,4e-4,2,0,-2,0),P(.538,1.14,0,-.0141,2,0,-2,-2),P(.263,.02,0,0,1,1,2,0),P(.426,.07,0,-6e-4,1,1,-2,-2),P(-.304,.03,0,3e-4,1,-1,2,0),P(-.372,-.19,0,-.0027,1,-1,-2,2),P(.418,0,0,0,0,0,4,0),P(-.33,-.04,0,0,3,0,2,0);function F(e,t,n,r,i){return e*ue(t,n,r,i).y}h=0,h+=F(-526.069,0,0,1,-2),h+=F(-3.352,0,0,1,-4),h+=F(44.297,1,0,1,-2),h+=F(-6,1,0,1,-4),h+=F(20.599,-1,0,1,0),h+=F(-30.598,-1,0,1,-2),h+=F(-24.649,-2,0,1,0),h+=F(-2,-2,0,1,-2),h+=F(-22.571,0,1,1,-2),h+=F(10.985,0,-1,1,-2),m+=.82*N(.7736-62.5512*t)+.31*N(.0466-125.1025*t)+.35*N(.5785-25.1042*t)+.66*N(.4591+1335.8075*t)+.64*N(.313-91.568*t)+1.14*N(.148+1331.2898*t)+.21*N(.5918+1056.5859*t)+.44*N(.5784+1322.8595*t)+.24*N(.2275-5.7374*t)+.28*N(.2965+2.6929*t)+.33*N(.3132+6.3368*t),o=x+O/jC;let de=(1.000002708+139.978*p)*(18518.511+1.189+g)*Math.sin(o)-6.24*Math.sin(3*o)+h;return{geo_eclip_lon:AC*ZC((v+m/jC)/AC),geo_eclip_lat:Math.PI/648e3*de,distance_au:jC*HC/(.999953253*_)}}function vw(e,t){return[e.rot[0][0]*t[0]+e.rot[1][0]*t[1]+e.rot[2][0]*t[2],e.rot[0][1]*t[0]+e.rot[1][1]*t[1]+e.rot[2][1]*t[2],e.rot[0][2]*t[0]+e.rot[1][2]*t[1]+e.rot[2][2]*t[2]]}function yw(e,t,n){return vw(bw(t,n),e)}function bw(e,t){let n=e.tt/36525,r=84381.406,i=((((-9.51e-8*n+132851e-9)*n-.00114045)*n-1.0790069)*n+5038.481507)*n,a=((((3.337e-7*n-467e-9)*n-.00772503)*n+.0512623)*n-.025754)*n+r,o=((((-56e-9*n+170663e-9)*n-.00121197)*n-2.3814292)*n+10.556403)*n;r*=MC,i*=MC,a*=MC,o*=MC;let s=Math.sin(r),c=Math.cos(r),l=Math.sin(-i),u=Math.cos(-i),d=Math.sin(-a),f=Math.cos(-a),p=Math.sin(o),m=Math.cos(o),h=m*u-l*p*f,g=m*l*c+p*f*u*c-s*p*d,_=m*l*s+p*f*u*s+c*p*d,v=-p*u-l*m*f,y=-p*l*c+m*f*u*c-s*m*d,b=-p*l*s+m*f*u*s+c*m*d,x=l*d,S=-d*u*c-s*f,C=-d*u*s+f*c;if(t===nw.Into2000)return new Pw([[h,g,_],[v,y,b],[x,S,C]]);if(t===nw.From2000)return new Pw([[h,v,x],[g,y,S],[_,b,C]]);throw`Invalid precess direction`}function xw(e){let t=360*((.779057273264+.00273781191135448*e.ut+e.ut%1)%1);return t<0&&(t+=360),t}var Sw;function Cw(e){if(!Sw||Sw.tt!==e.tt){let t=e.tt/36525,n=15*pw(e).ee,r=xw(e),i=((n+.014506+((((-3.68e-8*t-29956e-9)*t-44e-8)*t+1.3915817)*t+4612.156534)*t)/3600+r)%360/15;i<0&&(i+=24),Sw={tt:e.tt,st:i}}return Sw.st}function ww(e){return Cw(lw(e))}function Tw(e,t){let n=e.latitude*wC,r=Math.sin(n),i=Math.cos(n),a=1/Math.hypot(i,zC*r),o=BC*a,s=e.height/1e3,c=VC*a+s,l=VC*o+s,u=(15*t+e.longitude)*wC,d=Math.sin(u),f=Math.cos(u);return{pos:[c*i*f/CC,c*i*d/CC,l*r/CC],vel:[-7292115e-11*c*i*d*86400/CC,FC*c*i*f*86400/CC,0]}}function Ew(e,t,n){return vw(Dw(t,n),e)}function Dw(e,t){let n=pw(e),r=n.mobl*wC,i=n.tobl*wC,a=n.dpsi*MC,o=Math.cos(r),s=Math.sin(r),c=Math.cos(i),l=Math.sin(i),u=Math.cos(a),d=Math.sin(a),f=u,p=-d*o,m=-d*s,h=d*c,g=u*o*c+s*l,_=u*s*c-o*l,v=d*l,y=u*o*l-s*c,b=u*s*l+o*c;if(t===nw.From2000)return new Pw([[f,h,v],[p,g,y],[m,_,b]]);if(t===nw.Into2000)return new Pw([[f,p,m],[h,g,_],[v,y,b]]);throw`Invalid precess direction`}function Ow(e,t,n){return n===nw.Into2000?yw(Ew(e,t,n),t,n):Ew(yw(e,t,n),t,n)}function kw(e,t){let n=Tw(t,Cw(e)).pos;return Ow(n,e,nw.Into2000)}var Aw=class{constructor(e,t,n,r){this.x=e,this.y=t,this.z=n,this.t=r}Length(){return Math.hypot(this.x,this.y,this.z)}},jw=class{constructor(e,t,n,r,i,a,o){this.x=e,this.y=t,this.z=n,this.vx=r,this.vy=i,this.vz=a,this.t=o}},Mw=class{constructor(e,t,n){this.lat=Y(e),this.lon=Y(t),this.dist=Y(n)}},Nw=class{constructor(e,t,n,r){this.ra=Y(e),this.dec=Y(t),this.dist=Y(n),this.vec=r}},Pw=class{constructor(e){this.rot=e}},Fw=class{constructor(e,t,n,r){this.azimuth=Y(e),this.altitude=Y(t),this.ra=Y(n),this.dec=Y(r)}};function Iw(e,t){return new Aw(e[0],e[1],e[2],t)}function Lw(e,t){let n=Iw(e,t),r=n.x*n.x+n.y*n.y,i=Math.sqrt(r+n.z*n.z);if(r===0){if(n.z===0)throw`Indeterminate sky coordinates`;return new Nw(0,n.z<0?-90:90,i,n)}let a=DC*Math.atan2(n.y,n.x);a<0&&(a+=24);let o=EC*Math.atan2(e[2],Math.sqrt(r));return new Nw(a,o,i,n)}function Rw(e,t){let n=e*wC,r=Math.cos(n),i=Math.sin(n);return[r*t[0]+i*t[1],r*t[1]-i*t[0],t[2]]}function zw(e,t,n,r,i){let a=lw(e);Bw(t),Y(n),Y(r);let o=Math.sin(t.latitude*wC),s=Math.cos(t.latitude*wC),c=Math.sin(t.longitude*wC),l=Math.cos(t.longitude*wC),u=Math.sin(r*wC),d=Math.cos(r*wC),f=Math.sin(n*TC),p=Math.cos(n*TC),m=[s*l,s*c,o],h=[-o*l,-o*c,s],g=[c,-l,0],_=-15*Cw(a),v=Rw(_,m),y=Rw(_,h),b=Rw(_,g),x=[d*p,d*f,u],S=x[0]*v[0]+x[1]*v[1]+x[2]*v[2],C=x[0]*y[0]+x[1]*y[1]+x[2]*y[2],w=x[0]*b[0]+x[1]*b[1]+x[2]*b[2],T=Math.hypot(C,w),E;T>0?(E=-57.29577951308232*Math.atan2(w,C),E<0&&(E+=360)):E=0;let D=EC*Math.atan2(T,S),O=n,ee=r;if(i){let e=D,t=UT(i,90-D);if(D-=t,t>0&&D>3e-4){let t=Math.sin(D*wC),n=Math.cos(D*wC),r=Math.sin(e*wC),i=Math.cos(e*wC),a=[];for(let e=0;e<3;++e)a.push((x[e]-i*v[e])/r*t+v[e]*n);T=Math.hypot(a[0],a[1]),T>0?(O=DC*Math.atan2(a[1],a[0]),O<0&&(O+=24)):O=0,ee=EC*Math.atan2(a[2],T)}}return new Fw(E,90-D,O,ee)}function Bw(e){if(!(e instanceof Vw))throw`Not an instance of the Observer class: ${e}`;if(Y(e.latitude),Y(e.longitude),Y(e.height),e.latitude<-90||e.latitude>90)throw`Latitude ${e.latitude} is out of range. Must be -90..+90.`;return e}var Vw=class{constructor(e,t,n){this.latitude=e,this.longitude=t,this.height=n,Bw(this)}};function Hw(e,t,n,r,i){Bw(n),XC(r),XC(i);let a=lw(t),o=kw(a,n),s=OT(e,a,i),c=[s.x-o[0],s.y-o[1],s.z-o[2]];return Lw(r?Ow(c,a,nw.From2000):c,a)}function Uw(e){let t=lw(e),n=_w(t),r=n.distance_au*Math.cos(n.geo_eclip_lat),i=yw(hw(t,[r*Math.cos(n.geo_eclip_lon),r*Math.sin(n.geo_eclip_lon),n.distance_au*Math.sin(n.geo_eclip_lat)]),t,nw.Into2000);return new Aw(i[0],i[1],i[2],t)}function Ww(e){let t=lw(e),n=1e-5,r=t.AddDays(-1e-5),i=t.AddDays(1e-5),a=Uw(r),o=Uw(i);return new jw((a.x+o.x)/2,(a.y+o.y)/2,(a.z+o.z)/2,(o.x-a.x)/(2*n),(o.y-a.y)/(2*n),(o.z-a.z)/(2*n),t)}function Gw(e){let t=lw(e),n=Ww(t),r=82.30056;return new jw(n.x/r,n.y/r,n.z/r,n.vx/r,n.vy/r,n.vz/r,t)}function Kw(e,t,n){let r=1,i=0;for(let a of e){let e=0;for(let[n,r,i]of a)e+=n*Math.cos(r+t*i);let o=r*e;n&&(o%=AC),i+=o,r*=t}return i}function qw(e,t){let n=1,r=0,i=0,a=0;for(let o of e){let e=0,s=0;for(let[n,r,i]of o){let o=r+t*i;e+=n*i*Math.sin(o),a>0&&(s+=n*Math.cos(o))}i+=a*r*s-n*e,r=n,n*=t,++a}return i}var Jw=365250,Yw=0,Xw=1,Zw=2;function Qw(e){return new sT(e[0]+4.4036e-7*e[1]-1.90919e-7*e[2],-4.79966e-7*e[0]+.917482137087*e[1]-.397776982902*e[2],.397776982902*e[1]+.917482137087*e[2])}function $w(e,t,n){let r=n*Math.cos(t),i=Math.cos(e),a=Math.sin(e);return[r*i,r*a,n*Math.sin(t)]}function eT(e,t){let n=t.tt/Jw;return Qw($w(Kw(e[Yw],n,!0),Kw(e[Xw],n,!1),Kw(e[Zw],n,!1))).ToAstroVector(t)}function tT(e,t){let n=t/Jw,r=Kw(e[Yw],n,!0),i=Kw(e[Xw],n,!1),a=Kw(e[Zw],n,!1),o=qw(e[Yw],n),s=qw(e[Xw],n),c=qw(e[Zw],n),l=Math.cos(r),u=Math.sin(r),d=Math.cos(i),f=Math.sin(i),p=+(c*d*l)-a*f*l*s-a*d*u*o,m=+(c*d*u)-a*f*u*s+a*d*l*o,h=+(c*f)+a*d*s,g=$w(r,i,a),_=[p/Jw,m/Jw,h/Jw];return new cT(t,Qw(g),Qw(_))}function nT(e,t,n,r){let i=r/(r+WC),a=eT(rw[n],t);e.x+=i*a.x,e.y+=i*a.y,e.z+=i*a.z}function rT(e){let t=new Aw(0,0,0,e);return nT(t,e,X.Jupiter,KC),nT(t,e,X.Saturn,qC),nT(t,e,X.Uranus,JC),nT(t,e,X.Neptune,YC),t}var iT=29200,aT=146,oT=[[-73e4,[-26.118207232108,-14.376168177825,3.384402515299],[.0016339372163656,-.0027861699588508,-.0013585880229445]],[-700800,[41.974905202127,-.448502952929,-12.770351505989],[.00073458569351457,.0022785014891658,.00048619778602049]],[-671600,[14.706930780744,44.269110540027,9.353698474772],[-.00210001479998,.00022295915939915,.00070143443551414]],[-642400,[-29.441003929957,-6.43016153057,6.858481011305],[.00084495803960544,-.0030783914758711,-.0012106305981192]],[-613200,[39.444396946234,-6.557989760571,-13.913760296463],[.0011480029005873,.0022400006880665,.00035168075922288]],[-584e3,[20.2303809507,43.266966657189,7.382966091923],[-.0019754081700585,.00053457141292226,.00075929169129793]],[-554800,[-30.65832536462,2.093818874552,9.880531138071],[61010603013347e-18,-.0031326500935382,-.00099346125151067]],[-525600,[35.737703251673,-12.587706024764,-14.677847247563],[.0015802939375649,.0021347678412429,.00019074436384343]],[-496400,[25.466295188546,41.367478338417,5.216476873382],[-.0018054401046468,.0008328308359951,.00080260156912107]],[-467200,[-29.847174904071,10.636426313081,12.297904180106],[-.00063257063052907,-.0029969577578221,-.00074476074151596]],[-438e3,[30.774692107687,-18.236637015304,-14.945535879896],[.0020113162005465,.0019353827024189,-20937793168297e-19]],[-408800,[30.243153324028,38.656267888503,2.938501750218],[-.0016052508674468,.0011183495337525,.00083333973416824]],[-379600,[-27.288984772533,18.643162147874,14.023633623329],[-.0011856388898191,-.0027170609282181,-.00049015526126399]],[-350400,[24.519605196774,-23.245756064727,-14.626862367368],[.0024322321483154,.0016062008146048,-.00023369181613312]],[-321200,[34.505274805875,35.125338586954,.557361475637],[-.0013824391637782,.0013833397561817,.00084823598806262]],[-292e3,[-23.275363915119,25.818514298769,15.055381588598],[-.0016062295460975,-.0023395961498533,-.00024377362639479]],[-262800,[17.050384798092,-27.180376290126,-13.608963321694],[.0028175521080578,.0011358749093955,-.00049548725258825]],[-233600,[38.093671910285,30.880588383337,-1.843688067413],[-.0011317697153459,.0016128814698472,.00084177586176055]],[-204400,[-18.197852930878,31.932869934309,15.438294826279],[-.0019117272501813,-.0019146495909842,-19657304369835e-18]],[-175200,[8.528924039997,-29.618422200048,-11.805400994258],[.0031034370787005,.0005139363329243,-.00077293066202546]],[-146e3,[40.94685725864,25.904973592021,-4.256336240499],[-.00083652705194051,.0018129497136404,.0008156422827306]],[-116800,[-12.326958895325,36.881883446292,15.217158258711],[-.0021166103705038,-.001481442003599,.00017401209844705]],[-87600,[-.633258375909,-30.018759794709,-9.17193287495],[.0032016994581737,-.00025279858672148,-.0010411088271861]],[-58400,[42.936048423883,20.344685584452,-6.588027007912],[-.00050525450073192,.0019910074335507,.00077440196540269]],[-29200,[-5.975910552974,40.61180995846,14.470131723673],[-.0022184202156107,-.0010562361130164,.00033652250216211]],[0,[-9.875369580774,-27.978926224737,-5.753711824704],[.0030287533248818,-.0011276087003636,-.0012651326732361]],[29200,[43.958831986165,14.214147973292,-8.808306227163],[-.00014717608981871,.0021404187242141,.00071486567806614]],[58400,[.67813676352,43.094461639362,13.243238780721],[-.0022358226110718,-.00063233636090933,.00047664798895648]],[87600,[-18.282602096834,-23.30503958666,-1.766620508028],[.0025567245263557,-.0019902940754171,-.0013943491701082]],[116800,[43.873338744526,7.700705617215,-10.814273666425],[.00023174803055677,.0022402163127924,.00062988756452032]],[146e3,[7.392949027906,44.382678951534,11.629500214854],[-.002193281545383,-.00021751799585364,.00059556516201114]],[175200,[-24.981690229261,-16.204012851426,2.466457544298],[.001819398914958,-.0026765419531201,-.0013848283502247]],[204400,[42.530187039511,.845935508021,-12.554907527683],[.00065059779150669,.0022725657282262,.00051133743202822]],[233600,[13.999526486822,44.462363044894,9.669418486465],[-.0021079296569252,.00017533423831993,.00069128485798076]],[262800,[-29.184024803031,-7.371243995762,6.493275957928],[.00093581363109681,-.0030610357109184,-.0012364201089345]],[292e3,[39.831980671753,-6.078405766765,-13.909815358656],[.0011117769689167,.0022362097830152,.00036230548231153]],[321200,[20.294955108476,43.417190420251,7.450091985932],[-.0019742157451535,.00053102050468554,.00075938408813008]],[350400,[-30.66999230216,2.318743558955,9.973480913858],[45605107450676e-18,-.0031308219926928,-.00099066533301924]],[379600,[35.626122155983,-12.897647509224,-14.777586508444],[.0016015684949743,.0021171931182284,.00018002516202204]],[408800,[26.133186148561,41.232139187599,5.00640132622],[-.0017857704419579,.00086046232702817,.00080614690298954]],[438e3,[-29.57674022923,11.863535943587,12.631323039872],[-.00072292830060955,-.0029587820140709,-.000708242964503]],[467200,[29.910805787391,-19.159019294,-15.013363865194],[.0020871080437997,.0018848372554514,-38528655083926e-18]],[496400,[31.375957451819,38.050372720763,2.433138343754],[-.0015546055556611,.0011699815465629,.00083565439266001]],[525600,[-26.360071336928,20.662505904952,14.414696258958],[-.0013142373118349,-.0026236647854842,-.00042542017598193]],[554800,[22.599441488648,-24.508879898306,-14.484045731468],[.0025454108304806,.0014917058755191,-.00030243665086079]],[584e3,[35.877864013014,33.894226366071,-.224524636277],[-.0012941245730845,.0014560427668319,.00084762160640137]],[613200,[-21.538149762417,28.204068269761,15.321973799534],[-.001731211740901,-.0021939631314577,-.0001631691327518]],[642400,[13.971521374415,-28.339941764789,-13.083792871886],[.0029334630526035,.00091860931752944,-.00059939422488627]],[671600,[39.526942044143,28.93989736011,-2.872799527539],[-.0010068481658095,.001702113288809,.00083578230511981]],[700800,[-15.576200701394,34.399412961275,15.466033737854],[-.0020098814612884,-.0017191109825989,70414782780416e-18]],[73e4,[4.24325283709,-30.118201690825,-10.707441231349],[.0031725847067411,.0001609846120227,-.00090672150593868]]],sT=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}clone(){return new e(this.x,this.y,this.z)}ToAstroVector(e){return new Aw(this.x,this.y,this.z,e)}static zero(){return new e(0,0,0)}quadrature(){return this.x*this.x+this.y*this.y+this.z*this.z}add(t){return new e(this.x+t.x,this.y+t.y,this.z+t.z)}sub(t){return new e(this.x-t.x,this.y-t.y,this.z-t.z)}incr(e){this.x+=e.x,this.y+=e.y,this.z+=e.z}decr(e){this.x-=e.x,this.y-=e.y,this.z-=e.z}mul(t){return new e(t*this.x,t*this.y,t*this.z)}div(t){return new e(this.x/t,this.y/t,this.z/t)}mean(t){return new e((this.x+t.x)/2,(this.y+t.y)/2,(this.z+t.z)/2)}neg(){return new e(-this.x,-this.y,-this.z)}},cT=class e{constructor(e,t,n){this.tt=e,this.r=t,this.v=n}clone(){return new e(this.tt,this.r,this.v)}sub(t){return new e(this.tt,this.r.sub(t.r),this.v.sub(t.v))}};function lT(e){let[t,[n,r,i],[a,o,s]]=e;return new cT(t,new sT(n,r,i),new sT(a,o,s))}function uT(e,t,n,r){let i=r/(r+WC),a=tT(rw[n],t);return e.r.incr(a.r.mul(i)),e.v.incr(a.v.mul(i)),a}function dT(e,t,n){let r=n.sub(e),i=r.quadrature();return r.mul(t/(i*Math.sqrt(i)))}var fT=class{constructor(e){let t=new cT(e,new sT(0,0,0),new sT(0,0,0));this.Jupiter=uT(t,e,X.Jupiter,KC),this.Saturn=uT(t,e,X.Saturn,qC),this.Uranus=uT(t,e,X.Uranus,JC),this.Neptune=uT(t,e,X.Neptune,YC),this.Jupiter.r.decr(t.r),this.Jupiter.v.decr(t.v),this.Saturn.r.decr(t.r),this.Saturn.v.decr(t.v),this.Uranus.r.decr(t.r),this.Uranus.v.decr(t.v),this.Neptune.r.decr(t.r),this.Neptune.v.decr(t.v),this.Sun=new cT(e,t.r.mul(-1),t.v.mul(-1))}Acceleration(e){let t=dT(e,WC,this.Sun.r);return t.incr(dT(e,KC,this.Jupiter.r)),t.incr(dT(e,qC,this.Saturn.r)),t.incr(dT(e,JC,this.Uranus.r)),t.incr(dT(e,YC,this.Neptune.r)),t}},pT=class e{constructor(e,t,n,r){this.tt=e,this.r=t,this.v=n,this.a=r}clone(){return new e(this.tt,this.r.clone(),this.v.clone(),this.a.clone())}},mT=class{constructor(e,t){this.bary=e,this.grav=t}};function hT(e,t,n,r){return new sT(t.x+e*(n.x+e*r.x/2),t.y+e*(n.y+e*r.y/2),t.z+e*(n.z+e*r.z/2))}function gT(e,t,n){return new sT(t.x+e*n.x,t.y+e*n.y,t.z+e*n.z)}function _T(e,t){let n=e-t.tt,r=new fT(e),i=hT(n,t.r,t.v,t.a),a=r.Acceleration(i).mean(t.a),o=hT(n,t.r,t.v,a);return new mT(r,new pT(e,o,t.v.add(a.mul(n)),r.Acceleration(o)))}var vT=[];function yT(e,t){let n=Math.floor(e);return n<0?0:n>=t?t-1:n}function bT(e){let t=lT(e),n=new fT(t.tt),r=t.r.add(n.Sun.r),i=t.v.add(n.Sun.v),a=n.Acceleration(r);return new mT(n,new pT(t.tt,r,i,a))}function xT(e,t){let n=oT[0][0];if(t<n||t>oT[50][0])return null;let r=yT((t-n)/iT,50);if(!e[r]){let t=e[r]=[];t[0]=bT(oT[r]).grav,t[200]=bT(oT[r+1]).grav;let n,a=t[0].tt;for(n=1;n<200;++n)t[n]=_T(a+=aT,t[n-1]).grav;a=t[200].tt;var i=[];for(i[200]=t[200],n=199;n>0;--n)i[n]=_T(a-=aT,i[n+1]).grav;for(n=199;n>0;--n){let e=n/200;t[n].r=t[n].r.mul(1-e).add(i[n].r.mul(e)),t[n].v=t[n].v.mul(1-e).add(i[n].v.mul(e)),t[n].a=t[n].a.mul(1-e).add(i[n].a.mul(e))}}return e[r]}function ST(e,t,n){let r=bT(e),i=Math.ceil((t-r.grav.tt)/n);for(let e=0;e<i;++e)r=_T(e+1===i?t:r.grav.tt+n,r.grav);return r}function CT(e,t){let n,r,i,a=xT(vT,e.tt);if(a){let t=yT((e.tt-a[0].tt)/aT,200),i=a[t],o=a[t+1],s=i.a.mean(o.a),c=hT(e.tt-i.tt,i.r,i.v,s),l=gT(e.tt-i.tt,i.v,s),u=hT(e.tt-o.tt,o.r,o.v,s),d=gT(e.tt-o.tt,o.v,s),f=(e.tt-i.tt)/aT;n=c.mul(1-f).add(u.mul(f)),r=l.mul(1-f).add(d.mul(f))}else{let t;t=e.tt<oT[0][0]?ST(oT[0],e.tt,-146):ST(oT[50],e.tt,146),n=t.grav.r,r=t.grav.v,i=t.bary}return t&&(i||=new fT(e.tt),n=n.sub(i.Sun.r),r=r.sub(i.Sun.v)),new jw(n.x,n.y,n.z,r.x,r.y,r.z,e)}new Pw([[.999432765338654,-.0336771074697641,0],[.0303959428906285,.902057912352809,.430543388542295],[-.0144994559663353,-.430299169409101,.902569881273754]]);function wT(e,t){var n=lw(t);if(e in rw)return eT(rw[e],n);if(e===X.Pluto){let e=CT(n,!0);return new Aw(e.x,e.y,e.z,n)}if(e===X.Sun)return new Aw(0,0,0,n);if(e===X.Moon){var r=eT(rw.Earth,n),i=Uw(n);return new Aw(r.x+i.x,r.y+i.y,r.z+i.z,n)}if(e===X.EMB){let e=eT(rw.Earth,n),t=Uw(n),r=82.30056;return new Aw(e.x+t.x/r,e.y+t.y/r,e.z+t.z/r,n)}if(e===X.SSB)return rT(n);let a=tw(e);if(a)return HT(new Mw(a.dec,15*a.ra,a.dist),n);throw`HelioVector: Unknown body "${e}"`}function TT(e,t){let n=t,r=0;for(let i=0;i<10;++i){let i=e(n),a=i.Length()/SC;if(a>1)throw`Object is too distant for light-travel solver.`;let o=t.AddDays(-a);if(r=Math.abs(o.tt-n.tt),r<1e-9)return i;n=o}throw`Light-travel time solver did not converge: dt = ${r}`}var ET=class{constructor(e,t,n,r){this.observerBody=e,this.targetBody=t,this.aberration=n,this.observerPos=r}Position(e){this.aberration&&(this.observerPos=wT(this.observerBody,e));let t=wT(this.targetBody,e);return new Aw(t.x-this.observerPos.x,t.y-this.observerPos.y,t.z-this.observerPos.z,e)}};function DT(e,t,n,r){XC(r);let i=lw(e);if(tw(n)){let e=wT(n,i);if(r){let n=AT(t,i),r=new Aw(e.x-n.x,e.y-n.y,e.z-n.z,i),a=SC/r.Length();return new Aw(r.x+n.vx/a,r.y+n.vy/a,r.z+n.vz/a,i)}let a=wT(t,i);return new Aw(e.x-a.x,e.y-a.y,e.z-a.z,i)}let a;a=r?new Aw(0,0,0,i):wT(t,i);let o=new ET(t,n,r,a);return TT(e=>o.Position(e),i)}function OT(e,t,n){XC(n);let r=lw(t);switch(e){case X.Earth:return new Aw(0,0,0,r);case X.Moon:return Uw(r);default:let t=DT(r,X.Earth,e,n);return t.t=r,t}}function kT(e,t){return new jw(e.r.x,e.r.y,e.r.z,e.v.x,e.v.y,e.v.z,t)}function AT(e,t){let n=lw(t);switch(e){case X.Sun:return new jw(0,0,0,0,0,0,n);case X.SSB:let t=new fT(n.tt);return new jw(-t.Sun.r.x,-t.Sun.r.y,-t.Sun.r.z,-t.Sun.v.x,-t.Sun.v.y,-t.Sun.v.z,n);case X.Mercury:case X.Venus:case X.Earth:case X.Mars:case X.Jupiter:case X.Saturn:case X.Uranus:case X.Neptune:return kT(tT(rw[e],n.tt),n);case X.Pluto:return CT(n,!0);case X.Moon:case X.EMB:let r=tT(rw.Earth,n.tt),i=e==X.Moon?Ww(n):Gw(n);return new jw(i.x+r.r.x,i.y+r.r.y,i.z+r.r.z,i.vx+r.v.x,i.vy+r.v.y,i.vz+r.v.z,n);default:if(tw(e)){let t=wT(e,n);return new jw(t.x,t.y,t.z,0,0,0,n)}throw`HelioState: Unsupported body "${e}"`}}function jT(e,t,n,r,i){let a=(i+n)/2-r,o=(i-n)/2,s=r,c;if(a==0){if(o==0||(c=-s/o,c<-1||c>1))return null}else{let e=o*o-4*a*s;if(e<=0)return null;let t=Math.sqrt(e),n=(-o+t)/(2*a),r=(-o-t)/(2*a);if(-1<=n&&n<=1){if(-1<=r&&r<=1)return null;c=n}else if(-1<=r&&r<=1)c=r;else return null}return{t:e+c*t,df_dt:(2*a*c+o)/t}}function MT(e,t,n,r){let i=Y(r&&r.dt_tolerance_seconds||1),a=Math.abs(i/LC),o=r&&r.init_f1||e(t),s=r&&r.init_f2||e(n),c=NaN,l=0,u=r&&r.iter_limit||20,d=!0;for(;;){if(++l>u)throw`Excessive iteration in Search()`;let r=cw(t,n,.5),i=r.ut-t.ut;if(Math.abs(i)<a)return r;d?c=e(r):d=!0;let f=jT(r.ut,n.ut-r.ut,o,c,s);if(f){let r=lw(f.t),l=e(r);if(f.df_dt!==0){if(Math.abs(l/f.df_dt)<a)return r;let u=1.2*Math.abs(l/f.df_dt);if(u<i/10){let i=r.AddDays(-u),a=r.AddDays(+u);if((i.ut-t.ut)*(i.ut-n.ut)<0&&(a.ut-t.ut)*(a.ut-n.ut)<0){let r=e(i),u=e(a);if(r<0&&u>=0){o=r,s=u,t=i,n=a,c=l,d=!1;continue}}}}}if(o<0&&c>=0){n=r,s=c;continue}if(c<0&&s>=0){t=r,o=c;continue}return null}}function NT(e,t,n,r,i,a){if(!Number.isFinite(a)||a<-90||a>90)throw`Invalid altitude angle: ${a}`;return LT(e,t,n,r,i,0,a)}var PT=class{constructor(e,t,n,r){this.tx=e,this.ty=t,this.ax=n,this.ay=r}};function FT(e,t,n,r,i,a,o){if(a<0&&o>=0)return new PT(r,i,a,o);if(a>=0&&o<0)return null;if(e>17)throw`Excessive recursion in rise/set ascent search.`;let s=i.ut-r.ut;if(s*LC<1||Math.min(Math.abs(a),Math.abs(o))>s/2*n)return null;let c=new sw((r.ut+i.ut)/2),l=t(c);return FT(1+e,t,n,r,c,a,l)||FT(1+e,t,n,c,i,l,o)}function IT(e,t){if(t<-90||t>90)throw`Invalid geographic latitude: ${t}`;let n,r;switch(e){case X.Moon:n=4.5,r=8.2;break;case X.Sun:n=.8,r=.5;break;case X.Mercury:n=-1.6,r=1;break;case X.Venus:n=-.8,r=.6;break;case X.Mars:n=-.5,r=.4;break;case X.Jupiter:case X.Saturn:case X.Uranus:case X.Neptune:case X.Pluto:n=-.2,r=.2;break;case X.Star1:case X.Star2:case X.Star3:case X.Star4:case X.Star5:case X.Star6:case X.Star7:case X.Star8:n=-.008,r=.008;break;default:throw`Body not allowed for altitude search: ${e}`}let i=wC*t;return Math.abs((360/RC-n)*Math.cos(i))+Math.abs(r*Math.sin(i))}function LT(e,t,n,r,i,a,o){if(Bw(t),Y(i),Y(a),Y(o),o<-90||o>90)throw`Invalid target altitude angle: ${o}`;let s=IT(e,t.latitude);function c(r){let i=Hw(e,r,t,!0,!0);return n*(zw(r,t,i.ra,i.dec).altitude+EC*Math.asin(a/i.dist)-o)}let l=lw(r),u=l,d=l,f=c(u),p=f;for(;;){i<0?(u=d.AddDays(-.42),f=c(u)):(d=u.AddDays(.42),p=c(d));let e=FT(0,c,s,u,d,f,p);if(e){let t=MT(c,e.tx,e.ty,{dt_tolerance_seconds:.1,init_f1:e.ax,init_f2:e.ay});if(t){if(i<0){if(t.ut<l.ut+i)return null}else if(t.ut>l.ut+i)return null;return t}throw`Rise/set search failed after finding ascent: t1=${u}, t2=${d}, a1=${f}, a2=${p}`}if(i<0){if(u.ut<l.ut+i)return null;d=u,p=f}else{if(d.ut>l.ut+i)return null;u=d,f=p}}}var RT=class{constructor(e,t){this.time=e,this.hor=t}};function zT(e,t,n,r,i=1){Bw(t);let a=lw(r),o=0;if(e===X.Earth)throw`Cannot search for hour angle of the Earth.`;if(Y(n),n<0||n>=24)throw`Invalid hour angle ${n}`;if(Y(i),i===0)throw`Direction must be positive or negative.`;for(;;){++o;let r=Cw(a),s=Hw(e,a,t,!0,!0),c=(n+s.ra-t.longitude/15-r)%24;if(o===1?i>0?c<0&&(c+=24):c>0&&(c-=24):c<-12?c+=24:c>12&&(c-=24),Math.abs(c)*3600<.1){let e=zw(a,t,s.ra,s.dec,`normal`);return new RT(a,e)}let l=c/24*RC;a=a.AddDays(l)}}function BT(e,t,n){let r=lw(t),i=ww(r),a=Hw(e,r,n,!0,!0),o=(n.longitude/15+i-a.ra)%24;return o<0&&(o+=24),o}var VT;(function(e){e[e.Pericenter=0]=`Pericenter`,e[e.Apocenter=1]=`Apocenter`})(VT||={});function HT(e,t){t=lw(t);let n=e.lat*wC,r=e.lon*wC,i=e.dist*Math.cos(n);return new Aw(i*Math.cos(r),i*Math.sin(r),e.dist*Math.sin(n),t)}function UT(e,t){let n;if(Y(t),t<-90||t>90)return 0;if(e===`normal`||e===`jplhor`){let r=t;r<-1&&(r=-1),n=1.02/Math.tan((r+10.3/(r+5.11))*wC)/60,e===`normal`&&t<-1&&(n*=(t+90)/89)}else if(!e)n=0;else throw`Invalid refraction option: ${e}`;return n}var WT;(function(e){e.Penumbral=`penumbral`,e.Partial=`partial`,e.Annular=`annular`,e.Total=`total`})(WT||={});var GT;(function(e){e[e.Invalid=0]=`Invalid`,e[e.Ascending=1]=`Ascending`,e[e.Descending=-1]=`Descending`})(GT||={});function KT(e,t,n){let r=new sw(e),i=new Vw(t,n,0),a=Hw(X.Sun,r,i,!0,!0);return zw(r,i,a.ra,a.dec,`normal`).altitude}function qT(e,t){return(BT(X.Sun,new sw(e),new Vw(0,t,0))+12)%24}function JT(e,t,n){let r=((n-12)%24+24)%24,i=new sw(new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())));return zT(X.Sun,new Vw(0,t,0),r,i,1).time.date}function YT(e,t,n,r=0){let i=new sw(e),a=BT(X.Sun,i,new Vw(0,t,0)),o=new sw(new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())));return zT(X.Sun,new Vw(r,n,0),a,o,1).time.date}function XT(e,t,n,r,i){let a=KT(e,t,n),o=BT(X.Sun,new sw(e),new Vw(0,n,0))>12,s=new Vw(r,i,0),c=new sw(new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))),l=zT(X.Sun,s,0,c,1).time,u=zT(X.Sun,s,12,new sw(new Date(l.date.getTime()-468e5)),1).time,d=o?u:l;return NT(X.Sun,s,o?1:-1,d,.6,a)?.date??l.date}var ZT={transmittance:`transmittanceTexture`,scattering:`scatteringTexture`,irradiance:`irradianceTexture`,higherOrderScattering:`higherOrderScatteringTexture`},QT={transmittance:`transmittance.exr`,scattering:`scattering.exr`,irradiance:`irradiance.exr`,higherOrderScattering:`higher_order_scattering.exr`},$T=Object.keys(ZT),eE={atmosphereAssetsUrl:void 0,stbnUrl:gC,date:new Date},tE=class extends M{renderer;sunDirection=new r.Vector3;moonDirection=new r.Vector3;rotationMatrix=new r.Matrix4;textures={};overlay=new ie(null);shadow=new ie(null);shadowLength=new ie(null);enableShadows=new ie(!0);needsUpdate=!1;options;_camera;texturePromises=new Map;constructor(e,t={},n){super(),this.renderer=e,this.options={...eE,...t},this._camera=n,this.onUpdate()}onUpdate=()=>{this.needsUpdate=!0,this.emit(`needsUpdate`)};async initTextures(){await Promise.all($T.map(e=>this.loadTexture(e)))}loadTexture(e){let t=this.texturePromises.get(e);if(t==null){let n=this.options.atmosphereAssetsUrl,i=QT[e],a=n==null?vC[i]:`${n.replace(/\/+$/,``)}/${i}`;t=this.fetchTexture(e,a).then(t=>{let n=o_(this.renderer)?r.FloatType:r.HalfFloatType;t.type=n,n===r.FloatType&&(t.image,t.image.data!=null&&(t.image.data=new Float32Array(new By(t.image.data.buffer)))),t.minFilter=r.LinearFilter,t.magFilter=r.LinearFilter,Object.assign(this.textures,{[ZT[e]]:t}),this.emit(`textureLoaded`)}).catch(t=>{throw this.texturePromises.delete(e),t}),this.texturePromises.set(e,t)}return t}fetchTexture(e,t){switch(e){case`transmittance`:return new Xy({width:256,height:64}).loadAsync(t);case`irradiance`:return new Xy({width:64,height:16}).loadAsync(t);case`scattering`:case`higherOrderScattering`:return new Yy({width:256,height:128,depth:32}).loadAsync(t)}}_dispose(){for(let e of Object.values(this.textures))e?.dispose();this.textures={},this.texturePromises.clear(),this.emit(`disposed`)}onTexturesReady(e,t){let n=t==null?$T:$T.filter(e=>t[e]);for(let e of n)this.loadTexture(e).catch(e=>{console.error(`Failed to load atmosphere textures:`,e)});let r=()=>n.every(e=>this.textures[ZT[e]]!=null),i=()=>{e(this.textures)};if(r())i();else{let e=()=>{r()&&(this.off(`textureLoaded`,e),i())};this.on(`textureLoaded`,e)}}getSunDirection(){return this.sunDirection.clone()}getMoonDirection(){return this.moonDirection.clone()}getRotationMatrix(){return this.rotationMatrix.clone()}_update(){this.needsUpdate&&(GS(this.date,this.sunDirection),KS(this.date,this.moonDirection),US(this.date,this.rotationMatrix),this.emit(`sunChanged`,this.sunDirection.clone())),this.needsUpdate=!1}isAtNight(e){return new r.Vector3(e.x,e.y,e.z).clone().normalize().dot(this.sunDirection)<0}getSunElevation(e){return KT(this.date,e.lat,e.lng)}getSolarTime(e){return qT(this.date,e.lng)}setSolarTime(e,t){this.date=JT(this.date,e.lng,t)}get date(){return this.options.date??eE.date}set date(e){this.options.date=e,this.onUpdate()}setDateAt(e,t){this.date=YT(this.date,e.lng,t.lng,t.lat)}setElevationAt(e,t){this.date=XT(this.date,e.lat,e.lng,t.lat,t.lng)}setDateFromCameraAt(e){let{lng:t}=this._camera?.positionGeographic??{lng:0};this.setDateAt({lng:t},e)}setElevationFromCameraAt(e){let{lng:t,lat:n}=this._camera?.positionGeographic??{lng:0,lat:0};this.setElevationAt({lat:n,lng:t},e)}},nE=class e{#e=new r.Color;setRGB(e,t,n){return this.#e.setRGB(e,t,n,r.SRGBColorSpace),this}setRGBLinear(e,t,n){return this.#e.setRGB(e,t,n,r.NoColorSpace),this}setHex(e){return this.#e.setHex(e,r.SRGBColorSpace),this}setStyle(e){return this.#e.setStyle(e,r.SRGBColorSpace),this}copy(e){return e.#e=this.#e.clone(),e}clone(){return this.copy(new e)}toArray(){return this.#e.toArray()}srgb(){let t=new e;return t.#e=new r.Color().copyLinearToSRGB(this.#e),t}toHex(){return this.#e.getHex()}get raw(){return this.#e}},rE=2,iE=e=>{let t=Math.max(navigator.hardwareConcurrency,1);return Ah(e?Math.min(t,rE):t)},aE=class{view;ctx;registry=new Map;constructor(e,t){this.view=e,this.ctx=t}register(e,t){this.registry.set(e,t)}unregister(e){return this.registry.delete(e)}has(e){return this.registry.has(e)}getRegisteredTypes(){return Array.from(this.registry.keys())}size(){return this.registry.size}clear(){this.registry.clear()}findTypeFromConfig(e){for(let t of Object.keys(e))if(this.registry.has(t))return t;return null}getConstructor(e){return this.registry.get(e)}},oE={enabled:!1},sE=class extends M{rawPass;rawEffect;options;constructor(e,t,n){super(),this.rawPass=e,this.rawEffect=t,this.options={...n??{}},this.enabled=this.options.enabled??oE.enabled,this.onMounted()}get raw(){return this.rawPass}get enabled(){return this.options.enabled??oE.enabled}set enabled(e){this.options.enabled=e,this.rawPass.enabled=e,this.emit(`needsUpdate`)}get visible(){return this.enabled}set visible(e){this.enabled=e}onMounted(){}dispose(){this.rawPass.dispose()}},cE=class extends sE{constructor(e,t,n){let r=new dg(e,t);super(r,t,n)}},lE=class extends dg{customDepthTexture=null;customDepthPacking;setDepthTexture(){this.customDepthTexture&&super.setDepthTexture(this.customDepthTexture,this.customDepthPacking)}setCustomDepthTexture(e,t){this.customDepthTexture=e,this.customDepthPacking=t}getCustomDepthTexture(){return this.customDepthTexture}},uE=class extends $h{get visible(){return this.enabled}set visible(e){this.enabled=e}},dE=class extends Rh{get visible(){return this.enabled}set visible(e){this.enabled=e}},fE=class extends M{id;view;ctx;_instance;_visible;_destroyed=!1;constructor(e,n,r={}){super(),this.id=r.id||(0,t.generateId)(),this._visible=r.visible??!0,this.view=e,this.ctx=n}onUpdateConfig(e){e.visible!==void 0&&(this._visible=e.visible,this._instance&&(this._instance.visible=e.visible)),this.requestUpdate()}requestUpdate(){this.emit(`needsUpdate`)}onDestroy(){this._destroyed=!0,this._instance=void 0}get destroyed(){return this._destroyed}get visible(){return!!this._visible}set visible(e){this._visible=e,this.onUpdateConfig({visible:e})}},pE=class extends fE{static key;static insertAfter;static insertBefore;static allowDuplication;static requiredBuffers;instanceId;constructor(e,t,n={}){super(e,t,n),this.instanceId=this.getConstructor().allowDuplication?`${this.getKey()}_${Math.random().toString(36).slice(2,9)}`:this.getKey()}get raw(){if(this._instance){if(this._instance instanceof Nh||this._instance instanceof sE)return this._instance;if(`raw`in this._instance)return this._instance.raw}}getConstructor(){return this.constructor}getKey(){return this.getConstructor().key}getInsertAfter(){return this.getConstructor().insertAfter}getInsertBefore(){return this.getConstructor().insertBefore}onCreate(){this._instance=this.createPass(),this._instance&&(this._instance.visible=this.visible),this.raw&&this.insertPass()}insertPass(){if(!this.raw)return;let e=this.instanceId,t=this.getInsertAfter()||[],n=this.getInsertBefore()||[],r=this.raw,i=r instanceof sE?r.rawPass:r instanceof Nh?r:void 0;z(i);for(let n of t)if(this.ctx.getPass(n)){this.ctx.insertPassAfter(n,e,i);return}for(let t of n)if(this.ctx.getPass(t)){this.ctx.insertPassBefore(t,e,i);return}this.ctx.addPass(e,i)}onUpdateConfig(e){super.onUpdateConfig(e)}onDestroy(){this.ctx.removePass(this.instanceId),this._instance=void 0}find(e){for(let t of this.ctx._getEffects()){let n=t.ref;if(n.getKey()===e)return n}}},mE=class extends aE{create(e,t){let n=this.getConstructor(e);if(!n)throw Error(`Unknown effect type: ${e}`);return new n(this.view,this.ctx,t)}findEffectType(e){return this.findTypeFromConfig(e)}getRequiredBuffers(e){return this.getConstructor(e)?.requiredBuffers??[]}},hE=class extends aE{create(e,t){let n=this.getConstructor(e);if(!n)throw Error(`Unknown light type: ${e}`);return new n(this.view,this.ctx,t)}findLightType(e){return this.findTypeFromConfig(e)}},gE=class extends aE{create(e,t){let n=this.getConstructor(e);if(!n)throw Error(`Unknown mesh type: ${e}`);return new n(this.view,this.ctx,t)}findMeshType(e){return this.findTypeFromConfig(e)}},_E=class{mesh;light;effect;constructor(e,t){this.mesh=new gE(e,t),this.light=new hE(e,t),this.effect=new mE(e,t)}getStats(){return{mesh:{registeredCount:this.mesh.size(),types:this.mesh.getRegisteredTypes()},light:{registeredCount:this.light.size(),types:this.light.getRegisteredTypes()},effect:{registeredCount:this.effect.size(),types:this.effect.getRegisteredTypes()}}}clearAll(){this.mesh.clear(),this.light.clear(),this.effect.clear()}},vE=(e,t)=>Object.keys(e).filter(e=>!t.includes(e)),yE=class extends Error{constructor(e,t){super(`Unknown ${e} type specified in configuration: ${vE(t,[`type`]).join(`, `)}`)}},bE=class extends Error{constructor(e,t){super(`\`${e}\` cannot be combined with \`${t}\`: both define the object's placement. Set only one of them — use \`geodetic\` for geographic placement, or \`matrix\` / \`matrixWorld\` to supply a frame yourself.`)}},xE=r.ShaderLib,SE=typeof global==`object`&&global&&global.Object===Object&&global,CE=typeof self==`object`&&self&&self.Object===Object&&self,wE=SE||CE||Function(`return this`)(),TE=wE.Symbol,EE=Object.prototype,DE=EE.hasOwnProperty,OE=EE.toString,kE=TE?TE.toStringTag:void 0;function AE(e){var t=DE.call(e,kE),n=e[kE];try{e[kE]=void 0;var r=!0}catch{}var i=OE.call(e);return r&&(t?e[kE]=n:delete e[kE]),i}var jE=Object.prototype.toString;function ME(e){return jE.call(e)}var NE=`[object Null]`,PE=`[object Undefined]`,FE=TE?TE.toStringTag:void 0;function IE(e){return e==null?e===void 0?PE:NE:FE&&FE in Object(e)?AE(e):ME(e)}function LE(e){return typeof e==`object`&&!!e}var RE=`[object Symbol]`;function zE(e){return typeof e==`symbol`||LE(e)&&IE(e)==RE}function BE(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var VE=Array.isArray,HE=1/0,UE=TE?TE.prototype:void 0,WE=UE?UE.toString:void 0;function GE(e){if(typeof e==`string`)return e;if(VE(e))return BE(e,GE)+``;if(zE(e))return WE?WE.call(e):``;var t=e+``;return t==`0`&&1/e==-HE?`-0`:t}function KE(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function qE(e){return e}var JE=`[object AsyncFunction]`,YE=`[object Function]`,XE=`[object GeneratorFunction]`,ZE=`[object Proxy]`;function QE(e){if(!KE(e))return!1;var t=IE(e);return t==YE||t==XE||t==JE||t==ZE}var $E=wE[`__core-js_shared__`],eD=function(){var e=/[^.]+$/.exec($E&&$E.keys&&$E.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function tD(e){return!!eD&&eD in e}var nD=Function.prototype.toString;function rD(e){if(e!=null){try{return nD.call(e)}catch{}try{return e+``}catch{}}return``}var iD=/[\\^$.*+?()[\]{}|]/g,aD=/^\[object .+?Constructor\]$/,oD=Function.prototype,sD=Object.prototype,cD=oD.toString,lD=sD.hasOwnProperty,uD=RegExp(`^`+cD.call(lD).replace(iD,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function dD(e){return!KE(e)||tD(e)?!1:(QE(e)?uD:aD).test(rD(e))}function fD(e,t){return e?.[t]}function pD(e,t){var n=fD(e,t);return dD(n)?n:void 0}function mD(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var hD=800,gD=16,_D=Date.now;function vD(e){var t=0,n=0;return function(){var r=_D(),i=gD-(r-n);if(n=r,i>0){if(++t>=hD)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function yD(e){return function(){return e}}var bD=function(){try{var e=pD(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),xD=vD(bD?function(e,t){return bD(e,`toString`,{configurable:!0,enumerable:!1,value:yD(t),writable:!0})}:qE),SD=9007199254740991,CD=/^(?:0|[1-9]\d*)$/;function wD(e,t){var n=typeof e;return t??=SD,!!t&&(n==`number`||n!=`symbol`&&CD.test(e))&&e>-1&&e%1==0&&e<t}function TD(e,t,n){t==`__proto__`&&bD?bD(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ED(e,t){return e===t||e!==e&&t!==t}var DD=Object.prototype.hasOwnProperty;function OD(e,t,n){var r=e[t];(!(DD.call(e,t)&&ED(r,n))||n===void 0&&!(t in e))&&TD(e,t,n)}var kD=Math.max;function AD(e,t,n){return t=kD(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=kD(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),mD(e,this,s)}}function jD(e,t){return xD(AD(e,t,qE),e+``)}var MD=9007199254740991;function ND(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=MD}function PD(e){return e!=null&&ND(e.length)&&!QE(e)}function FD(e,t,n){if(!KE(n))return!1;var r=typeof t;return(r==`number`?PD(n)&&wD(t,n.length):r==`string`&&t in n)?ED(n[t],e):!1}var ID=Object.prototype;function LD(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||ID)}function RD(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var zD=`[object Arguments]`;function BD(e){return LE(e)&&IE(e)==zD}var VD=Object.prototype,HD=VD.hasOwnProperty,UD=VD.propertyIsEnumerable,WD=BD(function(){return arguments}())?BD:function(e){return LE(e)&&HD.call(e,`callee`)&&!UD.call(e,`callee`)};function GD(){return!1}var KD=typeof e==`object`&&e&&!e.nodeType&&e,qD=KD&&typeof module==`object`&&module&&!module.nodeType&&module,JD=qD&&qD.exports===KD?wE.Buffer:void 0,YD=(JD?JD.isBuffer:void 0)||GD,XD=`[object Arguments]`,ZD=`[object Array]`,QD=`[object Boolean]`,$D=`[object Date]`,eO=`[object Error]`,tO=`[object Function]`,nO=`[object Map]`,rO=`[object Number]`,iO=`[object Object]`,aO=`[object RegExp]`,oO=`[object Set]`,sO=`[object String]`,cO=`[object WeakMap]`,lO=`[object ArrayBuffer]`,uO=`[object DataView]`,dO=`[object Float32Array]`,fO=`[object Float64Array]`,pO=`[object Int8Array]`,mO=`[object Int16Array]`,hO=`[object Int32Array]`,gO=`[object Uint8Array]`,_O=`[object Uint8ClampedArray]`,vO=`[object Uint16Array]`,yO=`[object Uint32Array]`,Z={};Z[dO]=Z[fO]=Z[pO]=Z[mO]=Z[hO]=Z[gO]=Z[_O]=Z[vO]=Z[yO]=!0,Z[XD]=Z[ZD]=Z[lO]=Z[QD]=Z[uO]=Z[$D]=Z[eO]=Z[tO]=Z[nO]=Z[rO]=Z[iO]=Z[aO]=Z[oO]=Z[sO]=Z[cO]=!1;function bO(e){return LE(e)&&ND(e.length)&&!!Z[IE(e)]}function xO(e){return function(t){return e(t)}}var SO=typeof e==`object`&&e&&!e.nodeType&&e,CO=SO&&typeof module==`object`&&module&&!module.nodeType&&module,wO=CO&&CO.exports===SO&&SE.process,TO=function(){try{return CO&&CO.require&&CO.require(`util`).types||wO&&wO.binding&&wO.binding(`util`)}catch{}}(),EO=TO&&TO.isTypedArray,DO=EO?xO(EO):bO,OO=Object.prototype.hasOwnProperty;function kO(e,t){var n=VE(e),r=!n&&WD(e),i=!n&&!r&&YD(e),a=!n&&!r&&!i&&DO(e),o=n||r||i||a,s=o?RD(e.length,String):[],c=s.length;for(var l in e)(t||OO.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||wD(l,c)))&&s.push(l);return s}function AO(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var jO=Object.prototype.hasOwnProperty;function MO(e){if(!KE(e))return AO(e);var t=LD(e),n=[];for(var r in e)r==`constructor`&&(t||!jO.call(e,r))||n.push(r);return n}function NO(e){return PD(e)?kO(e,!0):MO(e)}var PO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FO=/^\w*$/;function IO(e,t){if(VE(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||zE(e)?!0:FO.test(e)||!PO.test(e)||t!=null&&e in Object(t)}var LO=pD(Object,`create`);function RO(){this.__data__=LO?LO(null):{},this.size=0}function zO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var BO=`__lodash_hash_undefined__`,VO=Object.prototype.hasOwnProperty;function HO(e){var t=this.__data__;if(LO){var n=t[e];return n===BO?void 0:n}return VO.call(t,e)?t[e]:void 0}var UO=Object.prototype.hasOwnProperty;function WO(e){var t=this.__data__;return LO?t[e]!==void 0:UO.call(t,e)}var GO=`__lodash_hash_undefined__`;function KO(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=LO&&t===void 0?GO:t,this}function qO(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}qO.prototype.clear=RO,qO.prototype.delete=zO,qO.prototype.get=HO,qO.prototype.has=WO,qO.prototype.set=KO;function JO(){this.__data__=[],this.size=0}function YO(e,t){for(var n=e.length;n--;)if(ED(e[n][0],t))return n;return-1}var XO=Array.prototype.splice;function ZO(e){var t=this.__data__,n=YO(t,e);return n<0?!1:(n==t.length-1?t.pop():XO.call(t,n,1),--this.size,!0)}function QO(e){var t=this.__data__,n=YO(t,e);return n<0?void 0:t[n][1]}function $O(e){return YO(this.__data__,e)>-1}function ek(e,t){var n=this.__data__,r=YO(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function tk(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}tk.prototype.clear=JO,tk.prototype.delete=ZO,tk.prototype.get=QO,tk.prototype.has=$O,tk.prototype.set=ek;var nk=pD(wE,`Map`);function rk(){this.size=0,this.__data__={hash:new qO,map:new(nk||tk),string:new qO}}function ik(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function ak(e,t){var n=e.__data__;return ik(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function ok(e){var t=ak(this,e).delete(e);return this.size-=+!!t,t}function sk(e){return ak(this,e).get(e)}function ck(e){return ak(this,e).has(e)}function lk(e,t){var n=ak(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function uk(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}uk.prototype.clear=rk,uk.prototype.delete=ok,uk.prototype.get=sk,uk.prototype.has=ck,uk.prototype.set=lk;var dk=`Expected a function`;function fk(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(dk);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(fk.Cache||uk),n}fk.Cache=uk;var pk=500;function mk(e){var t=fk(e,function(e){return n.size===pk&&n.clear(),e}),n=t.cache;return t}var hk=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gk=/\\(\\)?/g,_k=mk(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(hk,function(e,n,r,i){t.push(r?i.replace(gk,`$1`):n||e)}),t});function vk(e){return e==null?``:GE(e)}function yk(e,t){return VE(e)?e:IO(e,t)?[e]:_k(vk(e))}var bk=1/0;function xk(e){if(typeof e==`string`||zE(e))return e;var t=e+``;return t==`0`&&1/e==-bk?`-0`:t}function Sk(e,t){t=yk(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[xk(t[n++])];return n&&n==r?e:void 0}function Ck(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var wk=TE?TE.isConcatSpreadable:void 0;function Tk(e){return VE(e)||WD(e)||!!(wk&&e&&e[wk])}function Ek(e,t,n,r,i){var a=-1,o=e.length;for(n||=Tk,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?Ek(s,t-1,n,r,i):Ck(i,s):r||(i[i.length]=s)}return i}function Dk(e){return e!=null&&e.length?Ek(e,1):[]}function Ok(e){return xD(AD(e,void 0,Dk),e+``)}function kk(e,t){return e!=null&&t in Object(e)}function Ak(e,t,n){t=yk(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=xk(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&ND(i)&&wD(o,i)&&(VE(e)||WD(e)))}function jk(e,t){return e!=null&&Ak(e,t,kk)}var Mk=Object.prototype,Nk=Mk.hasOwnProperty,Pk=jD(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&FD(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=NO(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||ED(u,Mk[l])&&!Nk.call(e,l))&&(e[l]=a[l])}return e});function Fk(e,t,n,r){if(!KE(e))return e;t=yk(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=xk(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=KE(u)?u:wD(t[i+1])?[]:{})}OD(s,c,l),s=s[c]}return e}function Ik(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Sk(e,o);n(s,o)&&Fk(a,yk(o,e),s)}return a}function Lk(e,t){return Ik(e,t,function(t,n){return jk(e,n)})}var Rk=Ok(function(e,t){return e==null?{}:Lk(e,t)}),zk=[`lambert`],Bk=(e,t)=>{t.color!==void 0&&e.color.set(t.color),t.opacity!==void 0&&(e.opacity=t.opacity),t.transparent!==void 0&&(e.transparent=t.transparent),t.wireframe!==void 0&&(e.wireframe=t.wireframe),t.emissiveColor!==void 0&&e.emissive.set(t.emissiveColor),t.emissiveIntensity!==void 0&&(e.emissiveIntensity=t.emissiveIntensity),t.reflectivity!==void 0&&(e.reflectivity=t.reflectivity)},Vk={uMinMaxHeight:{value:void 0},uAddExtrudedHeight:{value:0},uAddHeight:{value:0},uClampToGround:{value:!1},nvr_uPickable:{value:0},uEffectIdsMask:{value:0},uEmissiveIntensity:{value:0},uIsTexturized:{value:!1},reflectivity:{value:0},roughness:{value:0}},Hk=e=>{let t=structuredClone(Vk);return e&&(t.modelViewMatrixRTE={value:new r.Matrix4},t.u_cameraPositionHigh={value:new r.Vector3},t.u_cameraPositionLow={value:new r.Vector3}),{update:e=>{t.uMinMaxHeight.value=e.minMaxHeight,t.uAddExtrudedHeight.value=e.addExtrudedHeight,t.uAddHeight.value=e.addHeight,t.uClampToGround.value=e.clampToGround,t.nvr_uPickable.value=+!!e.pickable,t.uEffectIdsMask.value=e.effectIdsMask,t.uEmissiveIntensity.value=e.emissiveIntensity,t.uIsTexturized.value=e.isTexturized,t.reflectivity.value=e.reflectivity,t.roughness.value=e.roughness},updateUniforms:(e,n)=>{e.nvr_uPickable=t.nvr_uPickable,e.uEffectIdsMask=t.uEffectIdsMask,e.uEmissiveIntensity=t.uEmissiveIntensity,e.reflectivity=t.reflectivity,e.roughness=t.roughness,n.useRTE&&t.modelViewMatrixRTE&&t.u_cameraPositionHigh&&t.u_cameraPositionLow&&(e.u_cameraPositionHigh=t.u_cameraPositionHigh,e.u_cameraPositionLow=t.u_cameraPositionLow,e.modelViewMatrixRTE=t.modelViewMatrixRTE,e.u_rteOne=qc),t.uMinMaxHeight.value&&(e.uMinMaxHeight=t.uMinMaxHeight),e.uAddExtrudedHeight=t.uAddExtrudedHeight,e.uAddHeight=t.uAddHeight,e.uClampToGround=t.uClampToGround,t.batchDataTexture&&(e.batchDataTexture=t.batchDataTexture),e.uIsTexturized=t.uIsTexturized},setBatchDataTexture:e=>{t.batchDataTexture=e},updateRteUniforms:(e,n,r,i)=>{i.useRTE&&(t.modelViewMatrixRTE&&t.modelViewMatrixRTE.value.copy(e),t.u_cameraPositionHigh&&t.u_cameraPositionHigh.value.copy(n),t.u_cameraPositionLow&&t.u_cameraPositionLow.value.copy(r))}}},Uk=`#ifdef USE_BATCH_TEXTURE
2247
2247
  uniform sampler2D batchDataTexture;
2248
2248
  in float _batchid;
2249
2249
 
@@ -2555,7 +2555,7 @@ in float attrBatchId;
2555
2555
  in vec4 scaleNormalAndCap;
2556
2556
 
2557
2557
  uniform vec2 uMinMaxHeight;
2558
- out float nvr_vBatchId;
2558
+ flat out float nvr_vBatchId;
2559
2559
 
2560
2560
  ${a?Qk:``}
2561
2561
  ${oA}
@@ -2611,7 +2611,7 @@ uniform float nvr_uPickable;
2611
2611
  uniform bool uIsTexturized;
2612
2612
  ${KA.fragment.UNIFORM_END}
2613
2613
 
2614
- in float nvr_vBatchId;
2614
+ flat in float nvr_vBatchId;
2615
2615
 
2616
2616
  ${aA}
2617
2617
 
@@ -2841,7 +2841,7 @@ void main() {
2841
2841
  uniform vec3 color;
2842
2842
  uniform float nvr_uPickable;
2843
2843
 
2844
- in float nvr_vBatchId;
2844
+ flat in float nvr_vBatchId;
2845
2845
 
2846
2846
  #ifdef USE_BATCH_COLOR_SHOW
2847
2847
  in float nvr_vShow;
@@ -2954,7 +2954,7 @@ uniform float uAddHeight;
2954
2954
 
2955
2955
  uniform vec3 minMaxHeightAndWidth;
2956
2956
 
2957
- out float nvr_vBatchId;
2957
+ flat out float nvr_vBatchId;
2958
2958
 
2959
2959
  void main() {
2960
2960
  #include <begin_vertex>
@@ -3044,7 +3044,7 @@ void main() {
3044
3044
  uniform vec3 color;
3045
3045
  uniform float nvr_uPickable;
3046
3046
 
3047
- in float nvr_vBatchId;
3047
+ flat in float nvr_vBatchId;
3048
3048
  in vec3 vNormal;
3049
3049
 
3050
3050
  #ifdef USE_BATCH_COLOR_SHOW
@@ -3433,7 +3433,7 @@ flat out float v_endPlaneOffsetEc;
3433
3433
  out vec4 v_endEcAndStartEcX;
3434
3434
  out vec4 v_texcoordNormalizationAndStartEcYZ;
3435
3435
  out vec3 vViewPosition;
3436
- out float nvr_vBatchId;
3436
+ flat out float nvr_vBatchId;
3437
3437
  out vec3 vNormal;
3438
3438
 
3439
3439
  void main() {
@@ -3757,7 +3757,7 @@ float nvr_shadowMask = 1.0;
3757
3757
 
3758
3758
  varying vec2 vUv;
3759
3759
  varying vec3 vColor;
3760
- varying float vBatchID;
3760
+ flat varying float vBatchID;
3761
3761
  varying float vFragDepth;
3762
3762
  varying float vOpacity;
3763
3763
 
@@ -3897,7 +3897,7 @@ uniform float uScreenHeightPx;
3897
3897
 
3898
3898
  varying vec2 vUv;
3899
3899
  varying vec3 vColor;
3900
- varying float vBatchID;
3900
+ flat varying float vBatchID;
3901
3901
  varying float vFragDepth;
3902
3902
  varying float vOpacity;
3903
3903
 
@@ -5390,11 +5390,11 @@ vPosition = (modelMatrix * vec4(transformed, 1.0)).xyz;
5390
5390
  #endif
5391
5391
  }
5392
5392
  `).source}
5393
- `,e[$N]=!0,e)}function dP(e,t){if(e instanceof MN||e.type===`LineMaterial`){uP(e);return}lP(e,t?.normal)}function fP(e,t,n){if(e){if(n)throw new bE(`geodetic`,`matrixWorld`);if(t)throw new bE(`geodetic`,`matrix`)}if(t&&n)throw new bE(`matrixWorld`,`matrix`)}function pP(e,t){let n={...e,...t};if(n.lng===void 0||n.lat===void 0)throw Error("`geodetic` update requires `lng` and `lat` when the object has no geodetic placement yet.");return n}var mP=class extends fE{position;scale;rotation;matrix;matrixWorld;geodetic;terrainHeight;terrainUnsubscribe;lit;prevPassKey;constructor(e,t,n){let r=n??{};super(e,t,r),this.position=r.position,this.scale=r.scale,this.rotation=r.rotation,this.matrix=r.matrix,this.matrixWorld=r.matrixWorld,this.geodetic=r.geodetic,fP(this.geodetic,this.matrix,this.matrixWorld),this.lit=r.lit}resolveGeodeticFrame(e){return pl({lng:e.lng,lat:e.lat,height:(e.height??0)+(this.terrainHeight??0),heading:e.heading,pitch:e.pitch,roll:e.roll,scale:e.scale})}subscribeTerrainHeight(){this.unsubscribeTerrainHeight();let e=this.geodetic;if(!e||e.heightReference!==`terrain`){this.terrainHeight=void 0;return}let t={lat:e.lat,lng:e.lng};this.terrainHeight=this.view.sampleTerrainHeight(t)??0,this.terrainUnsubscribe=this.view.observeTerrainHeightAt(t,e=>{this.terrainHeight!==e&&(this.terrainHeight=e,this.raw&&(this.reapplyGeodeticFrame(),this.requestUpdate()))})}reapplyGeodeticFrame(){this.applyTransform()}unsubscribeTerrainHeight(){this.terrainUnsubscribe?.(),this.terrainUnsubscribe=void 0}applyLit(){let e=this.raw;e&&e.traverse(e=>{let t=e.material;if(t){if(Array.isArray(t))for(let e of t)iP(e,this.lit);else iP(t,this.lit)}})}getPassKey(){return`opaque`}get raw(){if(this._instance){if(this._instance instanceof r.Object3D)return this._instance;if(`raw`in this._instance)return this._instance.raw}}onCreate(){this._instance=this.createMesh(),z(this.raw),this.subscribeTerrainHeight(),this.applyTransform(),this.applyLit(),this._instance.visible=this.visible,this.onPassKeyChange()}composeLocalTransform(){let e=new r.Matrix4;return this.position&&e.multiply(new r.Matrix4().makeTranslation(this.position.x,this.position.y,this.position.z)),this.rotation&&e.multiply(new r.Matrix4().makeRotationFromEuler(new r.Euler(this.rotation.x,this.rotation.y,this.rotation.z))),this.scale&&e.scale(new r.Vector3(this.scale.x,this.scale.y,this.scale.z)),e}applyTransform(){z(this.raw);let e=this.position!=null||this.rotation!=null||this.scale!=null,t=this.geodetic?this.resolveGeodeticFrame(this.geodetic):this.matrixWorld;if(t){this.raw.matrixAutoUpdate=!1,this.raw.matrixWorldAutoUpdate=!1,e?this.raw.matrixWorld.multiplyMatrices(t,this.composeLocalTransform()):this.raw.matrixWorld.copy(t),this.raw.updateMatrixWorld();return}if(this.matrix){this.raw.matrixAutoUpdate=!1,e?this.raw.matrix.multiplyMatrices(this.matrix,this.composeLocalTransform()):this.raw.matrix.copy(this.matrix);return}this.position&&this.raw.position.copy(this.position),this.scale&&this.raw.scale.copy(this.scale),this.rotation&&this.raw.rotation.set(this.rotation.x,this.rotation.y,this.rotation.z)}removeFromScene(e){let t=this.ctx.scenes;t[e]&&this.raw&&t[e].remove(this.raw)}addToScene(e){if(!this.raw)return;let t=this.ctx.scenes;t[e]&&t[e].add(this.raw)}onUpdateConfig(e){let t=e.geodetic===void 0?this.geodetic:pP(this.geodetic,e.geodetic);fP(t,e.matrix===void 0?this.matrix:e.matrix,e.matrixWorld===void 0?this.matrixWorld:e.matrixWorld),super.onUpdateConfig(e),z(this.raw);let n=e.matrix!==void 0||e.matrixWorld!==void 0||e.geodetic!==void 0||e.position!==void 0||e.scale!==void 0||e.rotation!==void 0;if(e.geodetic!==void 0){let e=this.geodetic;this.geodetic=t,(t?.lng!==e?.lng||t?.lat!==e?.lat||t?.heightReference!==e?.heightReference)&&this.subscribeTerrainHeight()}e.matrix!==void 0&&(this.matrix=e.matrix),e.matrixWorld!==void 0&&(this.matrixWorld=e.matrixWorld),e.position!==void 0&&(this.position=e.position),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation),`lit`in e&&(this.lit=e.lit,this.applyLit()),n&&(this.geodetic||this.matrixWorld||this.matrix?this.applyTransform():(e.position!==void 0&&this.raw.position.copy(e.position),e.scale!==void 0&&this.raw.scale.copy(e.scale),e.rotation!==void 0&&this.raw.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z))),this.onPassKeyChange()}onPassKeyChange(){let e=this.getPassKey();this.prevPassKey!==e&&(this.prevPassKey&&this.removeFromScene(this.prevPassKey),this.prevPassKey=e,this.addToScene(e),this.ctx.emit(`meshPassKeyChanged`))}onDestroy(){this.unsubscribeTerrainHeight(),this.raw&&this.raw.parent&&this.raw.parent.remove(this.raw),super.onDestroy()}},hP=class extends mP{_effectIds=[];_onSlotsChanged=()=>{this.updateEffectIdsMask(),this.onPassKeyChange()};_onGBufferChanged=()=>{this.onPassKeyChange()};constructor(e,t,n){let r=n??{};super(e,t,r),this._effectIds=r.effectIds??[]}getPassKey(){return this.ctx.selectiveEffectRegistry.slotCount>0||Object.values(this.view.buffers).some(Boolean)?`mrt`:super.getPassKey()}onCreate(){super.onCreate(),this.updateEffectIdsMask(),this.ctx.on(`effectSlotsChanged`,this._onSlotsChanged),this.ctx.on(`gbufferChanged`,this._onGBufferChanged)}onUpdateConfig(e){let t=!1;if(e.effectIds!==void 0){let n=e.effectIds??[];cA(this._effectIds,n)||(this._effectIds=[...n],t=!0)}super.onUpdateConfig(e),t&&this.updateEffectIdsMask()}updateEffectIdsMask(){let e=this.ctx.selectiveEffectRegistry;if(!e)return;let t=this._effectIds.length>0?e.computeMask(this._effectIds):0,n=this.raw;n instanceof r.Mesh&&!Array.isArray(n.material)&&n.material?.userData?.uEffectIdsMask&&(n.material.userData.uEffectIdsMask.value=t)}onDestroy(){this._effectIds=[],this.ctx.off(`effectSlotsChanged`,this._onSlotsChanged),this.ctx.off(`gbufferChanged`,this._onGBufferChanged),super.onDestroy()}},gP=64,_P=2,vP=new r.Vector3,yP=new r.Quaternion,bP=new r.Vector3,xP=new r.Euler,SP=new r.Matrix4,CP=new r.Color(16777215),wP=new r.Matrix4,TP=new r.Color,EP=class extends hP{configs=[];capacity=0;composeInstanceMatrix(e){if(e.matrix)return e.matrix;let t=e.position;vP.set(t?.x??0,t?.y??0,t?.z??0);let n=e.rotation;return n?(xP.set(n.x,n.y,n.z),yP.setFromEuler(xP)):yP.identity(),this.getInstanceScale(e,bP),SP.compose(vP,yP,bP),SP}getInstanceScale(e,t){let n=e.scale;t.set(n?.x??1,n?.y??1,n?.z??1)}createMesh(){let e=this.getChildConfigs();this.capacity=Math.max(e.length,gP);let t=new r.InstancedMesh(this.createGeometry(),this.createMaterial(),this.capacity);t.count=e.length;for(let n=0;n<e.length;n++){t.setMatrixAt(n,this.composeInstanceMatrix(e[n]));let r=this.getInstanceColor(e[n])??CP;t.setColorAt(n,r)}return t.instanceMatrix.needsUpdate=!0,t.instanceColor&&(t.instanceColor.needsUpdate=!0),this.configs=[...e],t}add(e){(this.raw?.count??0)>=this.capacity&&this.grow();let t=this.raw;z(t,`Descriptor must be created before adding instances`);let n=t.count;t.setMatrixAt(n,this.composeInstanceMatrix(e));let r=this.getInstanceColor(e)??CP;return t.setColorAt(n,r),t.count++,t.instanceMatrix.needsUpdate=!0,t.instanceColor&&(t.instanceColor.needsUpdate=!0),this.configs.push(e),this.onInstanceAdded(n),this.requestUpdate(),n}removeAt(e){let t=this.raw;if(z(t,`Descriptor must be created before removing instances`),e<0||e>=t.count)throw Error(`Index ${e} out of bounds [0, ${t.count})`);let n=t.count-1;e!==n&&(t.getMatrixAt(n,wP),t.setMatrixAt(e,wP),t.instanceColor&&(t.getColorAt(n,TP),t.setColorAt(e,TP)),this.configs[e]=this.configs[n]),t.count--,this.configs.pop(),this.onInstanceRemoved(e,e===n),t.instanceMatrix.needsUpdate=!0,t.instanceColor&&(t.instanceColor.needsUpdate=!0),this.requestUpdate()}updateAt(e,t){let n=this.raw;if(z(n,`Descriptor must be created before updating instances`),e<0||e>=n.count)throw Error(`Index ${e} out of bounds [0, ${n.count})`);let r={...this.configs[e],...t};n.setMatrixAt(e,this.composeInstanceMatrix(r));let i=this.getInstanceColor(r)??CP;n.setColorAt(e,i),n.instanceMatrix.needsUpdate=!0,n.instanceColor&&(n.instanceColor.needsUpdate=!0),this.configs[e]=r,this.requestUpdate()}clear(){let e=this.raw;e&&(e.count=0,e.instanceMatrix.needsUpdate=!0,e.instanceColor&&(e.instanceColor.needsUpdate=!0),this.requestUpdate()),this.configs=[],this.onInstancesCleared()}replaceAll(e){let t=this.raw;for(z(t,`Layer must be created before replacing instances`);e.length>this.capacity;)this.grow();let n=this.raw;z(n,`Descriptor must be created before replacing instances`),n.count=e.length;for(let t=0;t<e.length;t++){n.setMatrixAt(t,this.composeInstanceMatrix(e[t]));let r=this.getInstanceColor(e[t])??CP;n.setColorAt(t,r)}n.instanceMatrix.needsUpdate=!0,n.instanceColor&&(n.instanceColor.needsUpdate=!0),this.configs=[...e],this.onInstancesReplaced(e.length),this.requestUpdate()}get count(){return this.configs.length}onInstanceAdded(e){}onInstanceRemoved(e,t){}onInstancesCleared(){}onInstancesReplaced(e){}onInstanceMeshReplaced(e){}grow(){let e=this.raw;z(e,`Descriptor must be created before growing`);let t=Math.max(this.capacity*_P,gP),n=e.count,i=new r.InstancedMesh(e.geometry,e.material,t);i.count=n;let a=new r.Matrix4;for(let t=0;t<n;t++)e.getMatrixAt(t,a),i.setMatrixAt(t,a);if(i.instanceMatrix.needsUpdate=!0,e.instanceColor){let t=new r.Color;for(let r=0;r<n;r++)e.getColorAt(r,t),i.setColorAt(r,t);i.instanceColor&&(i.instanceColor.needsUpdate=!0)}i.position.copy(e.position),i.rotation.copy(e.rotation),i.scale.copy(e.scale),i.matrix.copy(e.matrix),i.matrixWorld.copy(e.matrixWorld),i.matrixAutoUpdate=e.matrixAutoUpdate,i.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,i.visible=e.visible,i.castShadow=e.castShadow,i.receiveShadow=e.receiveShadow;let o=e.parent;o&&(o.remove(e),o.add(i)),e.dispose(),this._instance=i,this.capacity=t,this.onInstanceMeshReplaced(i)}onDestroy(){let e=this.raw;if(e){if(e.geometry.dispose(),Array.isArray(e.material))for(let t of e.material)t.dispose();else e.material.dispose();e.dispose()}this.configs=[],super.onDestroy()}},DP=class extends fE{position;constructor(e,t,n={}){super(e,t,n),this.position=n.position}get raw(){if(this._instance){if(this._instance instanceof r.Light)return this._instance;if(`raw`in this._instance)return this._instance.raw}}onCreate(){this._instance=this.createLight(),this._instance&&(this._instance.visible=this.visible),this.position&&this.raw?.position.copy(this.position),this.raw&&this.ctx.scenes.light.add(this.raw)}onUpdateConfig(e){super.onUpdateConfig(e),e.position&&this.raw?.position.copy(e.position)}onDestroy(){this.raw&&this.raw.parent&&this.raw.parent.remove(this.raw),this._instance=void 0}},OP=class extends M{desc;constructor(e){super(),this.desc=e}update(e){this.desc.onUpdateConfig(e)}get ref(){return this.desc}delete(){this._deleted||(this._deleted=!0,this.desc.onDestroy(),this.emit(`deleted`))}_deleted=!1;get id(){return this.desc.id}get visible(){return this.desc.visible}set visible(e){this.desc.visible=e}},kP=class extends OP{},AP=class extends OP{},jP=class extends OP{},MP=11,NP=class{onSlotsChanged;idToSlot=new Map;freedSlots=[];nextSlot=0;constructor(e){this.onSlotsChanged=e}registerSlot(e){let t=this.idToSlot.get(e);if(t!==void 0)return t;let n,r=this.freedSlots.pop();if(r!==void 0)n=r;else{if(this.nextSlot>=MP)return console.warn(`SelectiveEffectRegistry: max ${MP} slots reached, ignoring effectId "${e}"`),-1;n=this.nextSlot++}return this.idToSlot.set(e,n),this.onSlotsChanged?.(),n}unregisterSlot(e){let t=this.idToSlot.get(e);t!==void 0&&(this.idToSlot.delete(e),this.freedSlots.push(t),this.onSlotsChanged?.())}get slotCount(){return this.idToSlot.size}getSlot(e){return this.idToSlot.get(e)}computeMask(e){let t=0;for(let n of e){let e=this.idToSlot.get(n);e!==void 0&&e>=0&&(t|=1<<e)}return t}clear(){this.idToSlot.clear(),this.freedSlots=[],this.nextSlot=0}},PP=class extends M{_scenes;layersManager;renderPassOrchestrator;_concurrencyManager;_core;_meshes;_selectiveEffectRegistry;_renderPass;_registries;constructor(e,t,n,r,i,a){super(),this._scenes=e,this.layersManager=t,this.renderPassOrchestrator=n,this._concurrencyManager=r,this._core=i,this._meshes=a,this._selectiveEffectRegistry=new NP(()=>this.emit(`effectSlotsChanged`))}get scenes(){return this._scenes}get concurrencyManager(){return this._concurrencyManager}get selectiveEffectRegistry(){return this._selectiveEffectRegistry}getPass(e){return this.renderPassOrchestrator.getPass(e)}addPass(e,t){this.renderPassOrchestrator.addPass(e,t)}insertPassBefore(e,t,n){this.renderPassOrchestrator.insertPassBefore(e,t,n)}insertPassAfter(e,t,n){this.renderPassOrchestrator.insertPassAfter(e,t,n)}removePass(e){this.renderPassOrchestrator.removePass(e)}getRenderer(){return this.renderPassOrchestrator.effectComposer.getRenderer()}getInputBuffer(){return this.renderPassOrchestrator.effectComposer.inputBuffer}_setRenderPass(e){this._renderPass=e}_setRegistries(e){this._registries=e}_setGBufferOptions(e){this._renderPass?.setBuffers(e),this.emit(`gbufferChanged`)}_setLit(e){this._renderPass?.setLit(e)}getGlobeDepthTexture(){return z(this._renderPass,`CustomRenderPass isn't initialized yet.`),this._renderPass.globeDepthCopyPass.texture}getGlobeNormalTexture(){return z(this._renderPass,`CustomRenderPass isn't initialized yet.`),this._renderPass.globeNormalCopyPass.texture}getRenderTarget(){return z(this._renderPass,`CustomRenderPass isn't initialized yet.`),this._renderPass.gbufferRenderTarget}getNormalTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.normal;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}getEffectIdsTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.effectIds;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}getEmissiveTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.emissive;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}getShadowTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.shadow;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}_getEffects(){return this.layersManager.getEffectDescs()}_getLights(){return this.layersManager.getLightDescs()}_getMeshes(){return this.layersManager.getMeshDescs()}findEffect(e){for(let t of this._getEffects())if(t.ref.getKey()===e)return t.ref}findLight(e){let t=this._registries?.light.getConstructor(e);if(t){for(let e of this._getLights())if(e.ref instanceof t)return e.ref}}findMesh(e){let t=this._registries?.mesh.getConstructor(e);if(t){for(let e of this._getMeshes())if(e.ref instanceof t)return e.ref}}applyShadowMaterial(e){this.emit(`shadowApplied`,e)}removeShadowMaterial(e){this.emit(`shadowRemoved`,e)}genGlobalBatchId(){return this._core?.genGlobalBatchId()}registerPickableMesh(e,t){this._meshes?.set(e,t)}unregisterPickableMesh(e){this._meshes?.delete(e)}},FP=Symbol(`SELECTIVE_EFFECT_SETUP`);function IP(e){if(e[FP])return;e[FP]=!0,e.userData.uEffectIdsMask={value:0},e.userData.uEmissiveIntensity={get value(){return e.emissiveIntensity}},e.defines=e.defines??{},e.defines.USE_SELECTIVE_EFFECT=1;let t=e.customProgramCacheKey;e.customProgramCacheKey=()=>`${t?t.call(e):``}_SelectiveEffect`;let n=e.onBeforeCompile;e.onBeforeCompile=(t,r)=>{n?.call(e,t,r),t.uniforms.uEffectIdsMask=e.userData.uEffectIdsMask,t.uniforms.uEmissiveIntensity=e.userData.uEmissiveIntensity},e.needsUpdate=!0}var LP=class e{_kernel;static MIN_INTERVAL_MS=150;static PADDING_PX=2;static MAX_FADE_STEP_MS=50;static HYSTERESIS_PX=6;static HANDOFF_TOLERANCE_M=2e3;_participants=new Set;_dirty=!0;_prevCamera=new Float64Array(34).fill(NaN);_lastRunAt=-1/0;_lastStepAt=NaN;_shownByContent=new Map;_candidates=[];_input=new Float64Array;_viewMatrix=new r.Matrix4;_view16=new Float64Array(16);_proj16=new Float64Array(16);constructor(e){this._kernel=e}remainingThrottleMs(t){return Math.max(0,e.MIN_INTERVAL_MS-(t-this._lastRunAt))}register(e){this._participants.add(e),this._dirty=!0}unregister(e){this._participants.delete(e)&&(this._dirty=!0)}markDirty(){this._dirty=!0}wasRecentlyShown(t,n,r,i){let a=this._shownByContent.get(t);if(!a)return!1;let o=e.HANDOFF_TOLERANCE_M,s=o*o;for(let e=0;e<a.length;e+=3){let t=a[e]-n,o=a[e+1]-r,c=a[e+2]-i;if(t*t+o*o+c*c<=s)return!0}return!1}update(t,n,r,i){if(this._participants.size===0)return`idle`;let a=!1,o=!1;(this._dirty||this._snapshotChanged(t,n,r))&&(i-this._lastRunAt>=e.MIN_INTERVAL_MS?(this._run(t,n,r),this._takeSnapshot(t,n,r),this._dirty=!1,this._lastRunAt=i,a=!0):o=!0);let s=Number.isFinite(this._lastStepAt)?Math.min(i-this._lastStepAt,e.MAX_FADE_STEP_MS):0;this._lastStepAt=i;let c=!1;for(let e of this._participants)c=e.stepDeclutterFade(s)||c;return c?`animating`:o?`throttled`:a?`ran`:`idle`}_run(t,n,r){for(let e of this._participants)e.prepareDeferredLabels?.(t);let i=this._candidates;i.length=0;for(let e of this._participants)e.collectDeclutterCandidates(i);let a=i.length;if(a===0)return;this._input.length<a*11&&(this._input=new Float64Array(a*11));let o=this._input;for(let e=0;e<a;e++){let t=i[e],n=e*11;o[n]=t.anchorX,o[n+1]=t.anchorY,o[n+2]=t.anchorZ,o[n+3]=t.addHeight,o[n+4]=t.minX,o[n+5]=t.maxX,o[n+6]=t.minY,o[n+7]=t.maxY,o[n+8]=+!!t.sizeInMeters,o[n+9]=t.priority,o[n+10]=+!!t.isShown}let s=this._viewMatrix.copy(t.matrixWorld).invert(),c=t.matrixWorld.elements;this._view16.set(s.elements),this._proj16.set(t.projectionMatrix.elements);let l=this._kernel.place(o.subarray(0,a*11),this._view16,this._proj16,c[12],c[13],c[14],t.near,n,r,t.fov*Math.PI/180,e.PADDING_PX,e.HYSTERESIS_PX);this._shownByContent.clear();for(let e=0;e<a;e++){let t=i[e],n=l[e]!==0;if(t.owner.applyDeclutter(t.handle,n),!n&&t.contentKey){let e=this._shownByContent.get(t.contentKey);e||(e=[],this._shownByContent.set(t.contentKey,e)),e.push(t.anchorX,t.anchorY,t.anchorZ)}}i.length=0}dispose(){this._participants.clear(),this._candidates.length=0,this._shownByContent.clear()}_snapshotChanged(e,t,n){let r=this._prevCamera,i=e.matrixWorld.elements,a=e.projectionMatrix.elements;for(let e=0;e<16;e++)if(r[e]!==i[e]||r[16+e]!==a[e])return!0;return r[32]!==t||r[33]!==n}_takeSnapshot(e,t,n){let r=this._prevCamera;r.set(e.matrixWorld.elements,0),r.set(e.projectionMatrix.elements,16),r[32]=t,r[33]=n}},RP={place:n.declutterPlace},zP,BP=[`android`,`webos`,`iphone`,`ipad`,`ipod`,`blackberry`,`windows phone`,`opera mini`,`mobile`];function VP(){if(zP!==void 0)return zP;if(typeof navigator>`u`)return zP=!1,!1;let e=navigator.userAgent.toLowerCase(),t=BP.some(t=>e.includes(t)),n=`ontouchstart`in window||navigator.maxTouchPoints>0,r=window.innerWidth<=768;return zP=t||n&&r,zP}var HP=1,UP=2,WP=1048576,GP=64*WP,KP=256*WP,qP=64*WP,JP=128*WP,YP=64*WP,XP=50,ZP=16,QP=8,$P=2048*WP,eF=512*WP-qP,tF=256*WP-qP;function nF(e){let t=e?.isMobile??VP(),n=e?.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory);return t?n===void 0||n>=4?eF:tF:n===void 0?$P:Math.min(n*1024*WP/4,$P)}var rF=512,iF=512,aF=3,oF=256,sF=133,cF=100;function lF(e){return e?iF:rF}function uF(e){let t=lF(e?.isMobile??VP());return{atlasTileBytes:t*t*4*aF,rasterTileBytes:Math.round(oF*oF*4*sF/cF)}}function dF(e){let t=e.isMobile??VP(),n=e.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory),r=Math.max(1,e.poolSize),i=t?qP:KP,a=i;if(n!==void 0){let e=n*1024*WP/(t?8:4);a=Math.min(Math.max(Math.floor(e/r/WP)*WP,GP),i)}let o=t?YP:JP;n!==void 0&&n<4&&(o/=2);let s=XP;t&&(s=n!==void 0&&n>=4?ZP:QP);let c=fF({isMobile:t,deviceMemoryGB:n});return{cacheBytes:nF({isMobile:t,deviceMemoryGB:n}),maxWorkerHeapBytes:a,fontBudgetBytes:o,maxPendingRequests:s,sseMultiplierMin:c.min,sseMultiplierMax:c.max}}function fF(e){let t=e?.isMobile??VP(),n=e?.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory);return t?n!==void 0&&n>=4?{min:4,max:32}:{min:8,max:64}:{min:1,max:16}}var pF={enabled:!0,density:2e-4,sseFactor:2},mF={enabled:!0,density:25e-5,sseFactor:3},hF={enabled:!0,density:.01,sseFactor:6},gF={enabled:!0,density:.1,sseFactor:12};function _F(e){let t=e?.isMobile??VP(),n=e?.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory);return t?n!==void 0&&n>=4?hF:gF:n!==void 0&&n<4?mF:pF}var vF={enabled:!0,density:2e-4,sseFactor:24,heightFalloff:.25,minHeight:0,maxHeight:8e3};function yF(){return vF}function bF(e){if(typeof e?.override==`number`)return e.override;if(typeof window>`u`)return 1;let t=window.devicePixelRatio??1;if(VP()){let n=e?.mobileOptimization?HP:UP;return Math.min(t,n)}return t}function xF(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function SF(){return new DOMException(`The operation was aborted.`,`AbortError`)}var CF=class extends r.Loader{loadAsyncWithAbort(e,t,n){let r=this;return new Promise(function(i,a){r.load(e,i,n,a,t)})}load(e,t,n,r,i,a=5e3){this.path!==void 0&&(e=this.path+e);let o=this,s=!1,c=window.setTimeout(()=>{u(Error(`TimeoutError`)),i?.abort()},a);function l(n){s||(s=!0,window.clearTimeout(c),t(n),o.manager.itemEnd(e))}function u(t,n){s||(s=!0,window.clearTimeout(c),r&&r(t,n),o.manager.itemError(e),o.manager.itemEnd(e))}o.manager.itemStart(e),fetch(e,{signal:i?.signal}).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return t.blob()}).then(t=>{if(!s){if(i?.signal.aborted){u(SF(),!0);return}if(typeof createImageBitmap==`function`){createImageBitmap(t,{imageOrientation:`flipY`,premultiplyAlpha:`none`,colorSpaceConversion:`none`}).then(e=>{if(s||i?.signal.aborted){e.close(),s||u(SF(),!0);return}l(e)}).catch(e=>u(e)),i?.signal.addEventListener(`abort`,()=>u(SF(),!0),{once:!0});return}this.loadViaImageElement(e,t,l,u,i)}}).catch(e=>{u(e,!e.name||e.name===`AbortError`)})}loadViaImageElement(e,t,n,r,i){if(i?.signal.aborted){r(SF(),!0);return}let a=window.URL.createObjectURL(t),o=xF(`img`);function s(){window.URL.revokeObjectURL(a),o.removeEventListener(`load`,c,!1),o.removeEventListener(`error`,l,!1),i?.signal.removeEventListener(`abort`,u,!1)}function c(){s(),n(this)}function l(e){s(),r(e)}function u(){o.src=``,o.remove(),s(),r(SF(),!0)}o.addEventListener(`load`,c,!1),o.addEventListener(`error`,l,!1),i?.signal.addEventListener(`abort`,u,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),o.src=a}};function wF(e){let t=e.image;e.dispose(),typeof ImageBitmap<`u`&&t instanceof ImageBitmap&&t.close()}var TF=class extends r.Loader{loadAsyncWithAbort(e,t,n){let r=this;return new Promise(function(i,a){r.load(e,i,n,a,t)})}load(e,t,n,i,a){let o=new r.Texture,s=new CF(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(e){o.image=e,typeof ImageBitmap<`u`&&e instanceof ImageBitmap&&(o.flipY=!1),o.needsUpdate=!0,t!==void 0&&t(o)},n,i,a),o}};function EF(e,t,n){return kh(e,t,n)}function DF(e){return EF(`getImageDataFromBlob`,[e])}var OF=class{eventManager;scenes;camera;meshes;abortControllers;buf;texFragment;tileHandler;workerTaskHandler;meshHandler;featureHandler;loadedTexs;workerPoolPromises;uniforms;texturizedSceneByTileCoordinates;tileTextureCompositor;tileMapByHandle;textureOptions;renderFlag;viewEvents;layersManager;viewContext;flightHandler;layerHandler;fontManager;textureFragmentIndex;tileMeshToFragmentIds;hillshadeContext;declutter;updatedAt=0;constructor(e){this.eventManager=e.eventManager,this.scenes=e.scenes,this.camera=e.camera,this.meshes=e.meshes,this.abortControllers=e.abortControllers,this.buf=e.buf,this.texFragment=e.texFragment,this.tileHandler=e.tileHandler,this.workerTaskHandler=e.workerTaskHandler,this.meshHandler=e.meshHandler,this.featureHandler=e.featureHandler,this.loadedTexs=e.loadedTexs,this.workerPoolPromises=e.workerPoolPromises,this.uniforms=e.uniforms,this.texturizedSceneByTileCoordinates=e.texturizedSceneByTileCoordinates,this.tileTextureCompositor=e.tileTextureCompositor,this.tileMapByHandle=e.tileMapByHandle,this.textureOptions=e.textureOptions,this.renderFlag=e.renderFlag,this.viewEvents=e.viewEvents,this.layersManager=e.layersManager,this.viewContext=e.viewContext,this.flightHandler=e.flightHandler,this.layerHandler=e.layerHandler,this.fontManager=e.fontManager,this.textureFragmentIndex=e.textureFragmentIndex,this.tileMeshToFragmentIds=e.tileMeshToFragmentIds,this.hillshadeContext=e.hillshadeContext,this.declutter=e.declutter}},kF={Billboard:`billboard`,Text:`text`,Point:`point`,Polyline:`polyline`,Polygon:`polygon`,Model:`model`},AF=Object.values(kF),jF=[`standard`,`physical`],MF=(e,t)=>{t.color!==void 0&&e.color.set(t.color),t.metalness!==void 0&&(e.metalness=t.metalness),t.roughness!==void 0&&(e.roughness=t.roughness),t.emissiveColor!==void 0&&e.emissive.set(t.emissiveColor),t.emissiveIntensity!==void 0&&(e.emissiveIntensity=t.emissiveIntensity),t.transparent!==void 0&&(e.transparent=t.transparent),t.opacity!==void 0&&(e.opacity=t.opacity),t.depthWrite!==void 0&&(e.depthWrite=t.depthWrite)},NF={nvr_uPickable:{value:0},uEffectIdsMask:{value:0},uEmissiveIntensity:{value:0}},PF=()=>{let e=structuredClone(NF);return{update:t=>{e.nvr_uPickable.value=+!!t.pickable,e.uEffectIdsMask.value=t.effectIdsMask,e.uEmissiveIntensity.value=t.emissiveIntensity},updateUniforms:t=>{t.nvr_uPickable=e.nvr_uPickable,t.uEffectIdsMask=e.uEffectIdsMask,t.uEmissiveIntensity=e.uEmissiveIntensity,e.batchDataTexture&&(t.batchDataTexture=e.batchDataTexture)},setBatchDataTexture:t=>{e.batchDataTexture=t}}},FF={vertex:{},fragment:{UNIFORM_START:`// NVR_MODEL_BASE_UNIFORM_START`,UNIFORM_END:`// NVR_MODEL_BASE_UNIFORM_END`,NORMAL_START:`// NVR_MODEL_BASE_NORMAL_START`,NORMAL_END:`// NVR_MODEL_BASE_NORMAL_END`,OUTGOING_LIGHT_START:`// NVR_MODEL_BASE_OUTGOING_LIGHT_START`,OUTGOING_LIGHT_END:`// NVR_MODEL_BASE_OUTGOING_LIGHT_END`,FINAL_NORMAL_START:`// NVR_MODEL_BASE_FINAL_NORMAL_START`,FINAL_NORMAL_END:`// NVR_MODEL_BASE_FINAL_NORMAL_END`}};function IF(e){return GA(e)}var LF=(e,t,n,r)=>{e.defines??={},e.defines.USE_SELECTIVE_EFFECT=1,r.userData.defines&&Object.assign(e.defines,r.userData.defines),n.updateUniforms(e.uniforms,t),e.vertexShader=Q(e.vertexShader).replace(`void main() {`,`
5393
+ `,e[$N]=!0,e)}function dP(e,t){if(e instanceof MN||e.type===`LineMaterial`){uP(e);return}lP(e,t?.normal)}function fP(e,t,n){if(e){if(n)throw new bE(`geodetic`,`matrixWorld`);if(t)throw new bE(`geodetic`,`matrix`)}if(t&&n)throw new bE(`matrixWorld`,`matrix`)}function pP(e,t){let n={...e,...t};if(n.lng===void 0||n.lat===void 0)throw Error("`geodetic` update requires `lng` and `lat` when the object has no geodetic placement yet.");return n}var mP=class extends fE{position;scale;rotation;matrix;matrixWorld;geodetic;terrainHeight;terrainUnsubscribe;lit;prevPassKey;constructor(e,t,n){let r=n??{};super(e,t,r),this.position=r.position,this.scale=r.scale,this.rotation=r.rotation,this.matrix=r.matrix,this.matrixWorld=r.matrixWorld,this.geodetic=r.geodetic,fP(this.geodetic,this.matrix,this.matrixWorld),this.lit=r.lit}resolveGeodeticFrame(e){return pl({lng:e.lng,lat:e.lat,height:(e.height??0)+(this.terrainHeight??0),heading:e.heading,pitch:e.pitch,roll:e.roll,scale:e.scale})}subscribeTerrainHeight(){this.unsubscribeTerrainHeight();let e=this.geodetic;if(!e||e.heightReference!==`terrain`){this.terrainHeight=void 0;return}let t={lat:e.lat,lng:e.lng};this.terrainHeight=this.view.sampleTerrainHeight(t)??0,this.terrainUnsubscribe=this.view.observeTerrainHeightAt(t,e=>{this.terrainHeight!==e&&(this.terrainHeight=e,this.raw&&(this.reapplyGeodeticFrame(),this.requestUpdate()))})}reapplyGeodeticFrame(){this.applyTransform()}unsubscribeTerrainHeight(){this.terrainUnsubscribe?.(),this.terrainUnsubscribe=void 0}applyLit(){let e=this.raw;e&&e.traverse(e=>{let t=e.material;if(t){if(Array.isArray(t))for(let e of t)iP(e,this.lit);else iP(t,this.lit)}})}getPassKey(){return`opaque`}get raw(){if(this._instance){if(this._instance instanceof r.Object3D)return this._instance;if(`raw`in this._instance)return this._instance.raw}}onCreate(){this._instance=this.createMesh(),z(this.raw),this.subscribeTerrainHeight(),this.applyTransform(),this.applyLit(),this._instance.visible=this.visible,this.onPassKeyChange()}composeLocalTransform(){let e=new r.Matrix4;return this.position&&e.multiply(new r.Matrix4().makeTranslation(this.position.x,this.position.y,this.position.z)),this.rotation&&e.multiply(new r.Matrix4().makeRotationFromEuler(new r.Euler(this.rotation.x,this.rotation.y,this.rotation.z))),this.scale&&e.scale(new r.Vector3(this.scale.x,this.scale.y,this.scale.z)),e}applyTransform(){z(this.raw);let e=this.position!=null||this.rotation!=null||this.scale!=null,t=this.geodetic?this.resolveGeodeticFrame(this.geodetic):this.matrixWorld;if(t){this.raw.matrixAutoUpdate=!1,this.raw.matrixWorldAutoUpdate=!1,e?this.raw.matrixWorld.multiplyMatrices(t,this.composeLocalTransform()):this.raw.matrixWorld.copy(t),this.raw.updateMatrixWorld();return}if(this.matrix){this.raw.matrixAutoUpdate=!1,e?this.raw.matrix.multiplyMatrices(this.matrix,this.composeLocalTransform()):this.raw.matrix.copy(this.matrix);return}this.position&&this.raw.position.copy(this.position),this.scale&&this.raw.scale.copy(this.scale),this.rotation&&this.raw.rotation.set(this.rotation.x,this.rotation.y,this.rotation.z)}removeFromScene(e){let t=this.ctx.scenes;t[e]&&this.raw&&t[e].remove(this.raw)}addToScene(e){if(!this.raw)return;let t=this.ctx.scenes;t[e]&&t[e].add(this.raw)}onUpdateConfig(e){let t=e.geodetic===void 0?this.geodetic:pP(this.geodetic,e.geodetic);fP(t,e.matrix===void 0?this.matrix:e.matrix,e.matrixWorld===void 0?this.matrixWorld:e.matrixWorld),super.onUpdateConfig(e);let n=e.matrix!==void 0||e.matrixWorld!==void 0||e.geodetic!==void 0||e.position!==void 0||e.scale!==void 0||e.rotation!==void 0;if(e.geodetic!==void 0){let e=this.geodetic;this.geodetic=t,(t?.lng!==e?.lng||t?.lat!==e?.lat||t?.heightReference!==e?.heightReference)&&this.subscribeTerrainHeight()}e.matrix!==void 0&&(this.matrix=e.matrix),e.matrixWorld!==void 0&&(this.matrixWorld=e.matrixWorld),e.position!==void 0&&(this.position=e.position),e.scale!==void 0&&(this.scale=e.scale),e.rotation!==void 0&&(this.rotation=e.rotation),`lit`in e&&(this.lit=e.lit,this.applyLit()),this.raw&&(n&&(this.geodetic||this.matrixWorld||this.matrix?this.applyTransform():(e.position!==void 0&&this.raw.position.copy(e.position),e.scale!==void 0&&this.raw.scale.copy(e.scale),e.rotation!==void 0&&this.raw.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z))),this.onPassKeyChange())}onPassKeyChange(){let e=this.getPassKey();this.prevPassKey!==e&&(this.prevPassKey&&this.removeFromScene(this.prevPassKey),this.prevPassKey=e,this.addToScene(e),this.ctx.emit(`meshPassKeyChanged`))}onDestroy(){this.unsubscribeTerrainHeight(),this.raw&&this.raw.parent&&this.raw.parent.remove(this.raw),super.onDestroy()}},hP=class extends mP{_effectIds=[];_onSlotsChanged=()=>{this.updateEffectIdsMask(),this.onPassKeyChange()};_onGBufferChanged=()=>{this.onPassKeyChange()};constructor(e,t,n){let r=n??{};super(e,t,r),this._effectIds=r.effectIds??[]}getPassKey(){return this.ctx.selectiveEffectRegistry.slotCount>0||Object.values(this.view.buffers).some(Boolean)?`mrt`:super.getPassKey()}onCreate(){super.onCreate(),this.updateEffectIdsMask(),this.ctx.on(`effectSlotsChanged`,this._onSlotsChanged),this.ctx.on(`gbufferChanged`,this._onGBufferChanged)}onUpdateConfig(e){let t=!1;if(e.effectIds!==void 0){let n=e.effectIds??[];cA(this._effectIds,n)||(this._effectIds=[...n],t=!0)}super.onUpdateConfig(e),t&&this.updateEffectIdsMask()}updateEffectIdsMask(){let e=this.ctx.selectiveEffectRegistry;if(!e)return;let t=this._effectIds.length>0?e.computeMask(this._effectIds):0,n=this.raw;n instanceof r.Mesh&&!Array.isArray(n.material)&&n.material?.userData?.uEffectIdsMask&&(n.material.userData.uEffectIdsMask.value=t)}onDestroy(){this._effectIds=[],this.ctx.off(`effectSlotsChanged`,this._onSlotsChanged),this.ctx.off(`gbufferChanged`,this._onGBufferChanged),super.onDestroy()}},gP=64,_P=2,vP=new r.Vector3,yP=new r.Quaternion,bP=new r.Vector3,xP=new r.Euler,SP=new r.Matrix4,CP=new r.Color(16777215),wP=new r.Matrix4,TP=new r.Color,EP=class extends hP{configs=[];capacity=0;composeInstanceMatrix(e){if(e.matrix)return e.matrix;let t=e.position;vP.set(t?.x??0,t?.y??0,t?.z??0);let n=e.rotation;return n?(xP.set(n.x,n.y,n.z),yP.setFromEuler(xP)):yP.identity(),this.getInstanceScale(e,bP),SP.compose(vP,yP,bP),SP}getInstanceScale(e,t){let n=e.scale;t.set(n?.x??1,n?.y??1,n?.z??1)}createMesh(){let e=this.getChildConfigs();this.capacity=Math.max(e.length,gP);let t=new r.InstancedMesh(this.createGeometry(),this.createMaterial(),this.capacity);t.count=e.length;for(let n=0;n<e.length;n++){t.setMatrixAt(n,this.composeInstanceMatrix(e[n]));let r=this.getInstanceColor(e[n])??CP;t.setColorAt(n,r)}return t.instanceMatrix.needsUpdate=!0,t.instanceColor&&(t.instanceColor.needsUpdate=!0),this.configs=[...e],t}add(e){(this.raw?.count??0)>=this.capacity&&this.grow();let t=this.raw;z(t,`Descriptor must be created before adding instances`);let n=t.count;t.setMatrixAt(n,this.composeInstanceMatrix(e));let r=this.getInstanceColor(e)??CP;return t.setColorAt(n,r),t.count++,t.instanceMatrix.needsUpdate=!0,t.instanceColor&&(t.instanceColor.needsUpdate=!0),this.configs.push(e),this.onInstanceAdded(n),this.requestUpdate(),n}removeAt(e){let t=this.raw;if(z(t,`Descriptor must be created before removing instances`),e<0||e>=t.count)throw Error(`Index ${e} out of bounds [0, ${t.count})`);let n=t.count-1;e!==n&&(t.getMatrixAt(n,wP),t.setMatrixAt(e,wP),t.instanceColor&&(t.getColorAt(n,TP),t.setColorAt(e,TP)),this.configs[e]=this.configs[n]),t.count--,this.configs.pop(),this.onInstanceRemoved(e,e===n),t.instanceMatrix.needsUpdate=!0,t.instanceColor&&(t.instanceColor.needsUpdate=!0),this.requestUpdate()}updateAt(e,t){let n=this.raw;if(z(n,`Descriptor must be created before updating instances`),e<0||e>=n.count)throw Error(`Index ${e} out of bounds [0, ${n.count})`);let r={...this.configs[e],...t};n.setMatrixAt(e,this.composeInstanceMatrix(r));let i=this.getInstanceColor(r)??CP;n.setColorAt(e,i),n.instanceMatrix.needsUpdate=!0,n.instanceColor&&(n.instanceColor.needsUpdate=!0),this.configs[e]=r,this.requestUpdate()}clear(){let e=this.raw;e&&(e.count=0,e.instanceMatrix.needsUpdate=!0,e.instanceColor&&(e.instanceColor.needsUpdate=!0),this.requestUpdate()),this.configs=[],this.onInstancesCleared()}replaceAll(e){let t=this.raw;for(z(t,`Layer must be created before replacing instances`);e.length>this.capacity;)this.grow();let n=this.raw;z(n,`Descriptor must be created before replacing instances`),n.count=e.length;for(let t=0;t<e.length;t++){n.setMatrixAt(t,this.composeInstanceMatrix(e[t]));let r=this.getInstanceColor(e[t])??CP;n.setColorAt(t,r)}n.instanceMatrix.needsUpdate=!0,n.instanceColor&&(n.instanceColor.needsUpdate=!0),this.configs=[...e],this.onInstancesReplaced(e.length),this.requestUpdate()}get count(){return this.configs.length}onInstanceAdded(e){}onInstanceRemoved(e,t){}onInstancesCleared(){}onInstancesReplaced(e){}onInstanceMeshReplaced(e){}grow(){let e=this.raw;z(e,`Descriptor must be created before growing`);let t=Math.max(this.capacity*_P,gP),n=e.count,i=new r.InstancedMesh(e.geometry,e.material,t);i.count=n;let a=new r.Matrix4;for(let t=0;t<n;t++)e.getMatrixAt(t,a),i.setMatrixAt(t,a);if(i.instanceMatrix.needsUpdate=!0,e.instanceColor){let t=new r.Color;for(let r=0;r<n;r++)e.getColorAt(r,t),i.setColorAt(r,t);i.instanceColor&&(i.instanceColor.needsUpdate=!0)}i.position.copy(e.position),i.rotation.copy(e.rotation),i.scale.copy(e.scale),i.matrix.copy(e.matrix),i.matrixWorld.copy(e.matrixWorld),i.matrixAutoUpdate=e.matrixAutoUpdate,i.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,i.visible=e.visible,i.castShadow=e.castShadow,i.receiveShadow=e.receiveShadow;let o=e.parent;o&&(o.remove(e),o.add(i)),e.dispose(),this._instance=i,this.capacity=t,this.onInstanceMeshReplaced(i)}onDestroy(){let e=this.raw;if(e){if(e.geometry.dispose(),Array.isArray(e.material))for(let t of e.material)t.dispose();else e.material.dispose();e.dispose()}this.configs=[],super.onDestroy()}},DP=class extends fE{position;constructor(e,t,n={}){super(e,t,n),this.position=n.position}get raw(){if(this._instance){if(this._instance instanceof r.Light)return this._instance;if(`raw`in this._instance)return this._instance.raw}}onCreate(){this._instance=this.createLight(),this._instance&&(this._instance.visible=this.visible),this.position&&this.raw?.position.copy(this.position),this.raw&&this.ctx.scenes.light.add(this.raw)}onUpdateConfig(e){super.onUpdateConfig(e),e.position&&this.raw?.position.copy(e.position)}onDestroy(){this.raw&&this.raw.parent&&this.raw.parent.remove(this.raw),this._instance=void 0}},OP=class extends M{desc;constructor(e){super(),this.desc=e}update(e){this.desc.onUpdateConfig(e)}get ref(){return this.desc}delete(){this._deleted||(this._deleted=!0,this.desc.onDestroy(),this.emit(`deleted`))}_deleted=!1;get id(){return this.desc.id}get visible(){return this.desc.visible}set visible(e){this.desc.visible=e}},kP=class extends OP{},AP=class extends OP{},jP=class extends OP{},MP=11,NP=class{onSlotsChanged;idToSlot=new Map;freedSlots=[];nextSlot=0;constructor(e){this.onSlotsChanged=e}registerSlot(e){let t=this.idToSlot.get(e);if(t!==void 0)return t;let n,r=this.freedSlots.pop();if(r!==void 0)n=r;else{if(this.nextSlot>=MP)return console.warn(`SelectiveEffectRegistry: max ${MP} slots reached, ignoring effectId "${e}"`),-1;n=this.nextSlot++}return this.idToSlot.set(e,n),this.onSlotsChanged?.(),n}unregisterSlot(e){let t=this.idToSlot.get(e);t!==void 0&&(this.idToSlot.delete(e),this.freedSlots.push(t),this.onSlotsChanged?.())}get slotCount(){return this.idToSlot.size}getSlot(e){return this.idToSlot.get(e)}computeMask(e){let t=0;for(let n of e){let e=this.idToSlot.get(n);e!==void 0&&e>=0&&(t|=1<<e)}return t}clear(){this.idToSlot.clear(),this.freedSlots=[],this.nextSlot=0}},PP=class extends M{_scenes;layersManager;renderPassOrchestrator;_concurrencyManager;_core;_meshes;_selectiveEffectRegistry;_renderPass;_registries;constructor(e,t,n,r,i,a){super(),this._scenes=e,this.layersManager=t,this.renderPassOrchestrator=n,this._concurrencyManager=r,this._core=i,this._meshes=a,this._selectiveEffectRegistry=new NP(()=>this.emit(`effectSlotsChanged`))}get scenes(){return this._scenes}get concurrencyManager(){return this._concurrencyManager}get selectiveEffectRegistry(){return this._selectiveEffectRegistry}getPass(e){return this.renderPassOrchestrator.getPass(e)}addPass(e,t){this.renderPassOrchestrator.addPass(e,t)}insertPassBefore(e,t,n){this.renderPassOrchestrator.insertPassBefore(e,t,n)}insertPassAfter(e,t,n){this.renderPassOrchestrator.insertPassAfter(e,t,n)}removePass(e){this.renderPassOrchestrator.removePass(e)}getRenderer(){return this.renderPassOrchestrator.effectComposer.getRenderer()}getInputBuffer(){return this.renderPassOrchestrator.effectComposer.inputBuffer}_setRenderPass(e){this._renderPass=e}_setRegistries(e){this._registries=e}_setGBufferOptions(e){this._renderPass?.setBuffers(e),this.emit(`gbufferChanged`)}_setLit(e){this._renderPass?.setLit(e)}getGlobeDepthTexture(){return z(this._renderPass,`CustomRenderPass isn't initialized yet.`),this._renderPass.globeDepthCopyPass.texture}getGlobeNormalTexture(){return z(this._renderPass,`CustomRenderPass isn't initialized yet.`),this._renderPass.globeNormalCopyPass.texture}getRenderTarget(){return z(this._renderPass,`CustomRenderPass isn't initialized yet.`),this._renderPass.gbufferRenderTarget}getNormalTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.normal;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}getEffectIdsTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.effectIds;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}getEmissiveTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.emissive;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}getShadowTexture(){z(this._renderPass,`CustomRenderPass isn't initialized yet.`);let e=this._renderPass.textureIndex.shadow;return e===void 0?void 0:this._renderPass.gbufferRenderTarget.textures[e]}_getEffects(){return this.layersManager.getEffectDescs()}_getLights(){return this.layersManager.getLightDescs()}_getMeshes(){return this.layersManager.getMeshDescs()}findEffect(e){for(let t of this._getEffects())if(t.ref.getKey()===e)return t.ref}findLight(e){let t=this._registries?.light.getConstructor(e);if(t){for(let e of this._getLights())if(e.ref instanceof t)return e.ref}}findMesh(e){let t=this._registries?.mesh.getConstructor(e);if(t){for(let e of this._getMeshes())if(e.ref instanceof t)return e.ref}}applyShadowMaterial(e){this.emit(`shadowApplied`,e)}removeShadowMaterial(e){this.emit(`shadowRemoved`,e)}genGlobalBatchId(){return this._core?.genGlobalBatchId()}registerPickableMesh(e,t){this._meshes?.set(e,t)}unregisterPickableMesh(e){this._meshes?.delete(e)}},FP=Symbol(`SELECTIVE_EFFECT_SETUP`);function IP(e){if(e[FP])return;e[FP]=!0,e.userData.uEffectIdsMask={value:0},e.userData.uEmissiveIntensity={get value(){return e.emissiveIntensity}},e.defines=e.defines??{},e.defines.USE_SELECTIVE_EFFECT=1;let t=e.customProgramCacheKey;e.customProgramCacheKey=()=>`${t?t.call(e):``}_SelectiveEffect`;let n=e.onBeforeCompile;e.onBeforeCompile=(t,r)=>{n?.call(e,t,r),t.uniforms.uEffectIdsMask=e.userData.uEffectIdsMask,t.uniforms.uEmissiveIntensity=e.userData.uEmissiveIntensity},e.needsUpdate=!0}var LP=class e{_kernel;static MIN_INTERVAL_MS=150;static PADDING_PX=2;static MAX_FADE_STEP_MS=50;static HYSTERESIS_PX=6;static HANDOFF_TOLERANCE_M=2e3;_participants=new Set;_dirty=!0;_prevCamera=new Float64Array(34).fill(NaN);_lastRunAt=-1/0;_lastStepAt=NaN;_shownByContent=new Map;_candidates=[];_input=new Float64Array;_viewMatrix=new r.Matrix4;_view16=new Float64Array(16);_proj16=new Float64Array(16);constructor(e){this._kernel=e}remainingThrottleMs(t){return Math.max(0,e.MIN_INTERVAL_MS-(t-this._lastRunAt))}register(e){this._participants.add(e),this._dirty=!0}unregister(e){this._participants.delete(e)&&(this._dirty=!0)}markDirty(){this._dirty=!0}wasRecentlyShown(t,n,r,i){let a=this._shownByContent.get(t);if(!a)return!1;let o=e.HANDOFF_TOLERANCE_M,s=o*o;for(let e=0;e<a.length;e+=3){let t=a[e]-n,o=a[e+1]-r,c=a[e+2]-i;if(t*t+o*o+c*c<=s)return!0}return!1}update(t,n,r,i){if(this._participants.size===0)return`idle`;let a=!1,o=!1;(this._dirty||this._snapshotChanged(t,n,r))&&(i-this._lastRunAt>=e.MIN_INTERVAL_MS?(this._run(t,n,r),this._takeSnapshot(t,n,r),this._dirty=!1,this._lastRunAt=i,a=!0):o=!0);let s=Number.isFinite(this._lastStepAt)?Math.min(i-this._lastStepAt,e.MAX_FADE_STEP_MS):0;this._lastStepAt=i;let c=!1;for(let e of this._participants)c=e.stepDeclutterFade(s)||c;return c?`animating`:o?`throttled`:a?`ran`:`idle`}_run(t,n,r){for(let e of this._participants)e.prepareDeferredLabels?.(t);let i=this._candidates;i.length=0;for(let e of this._participants)e.collectDeclutterCandidates(i);let a=i.length;if(a===0)return;this._input.length<a*11&&(this._input=new Float64Array(a*11));let o=this._input;for(let e=0;e<a;e++){let t=i[e],n=e*11;o[n]=t.anchorX,o[n+1]=t.anchorY,o[n+2]=t.anchorZ,o[n+3]=t.addHeight,o[n+4]=t.minX,o[n+5]=t.maxX,o[n+6]=t.minY,o[n+7]=t.maxY,o[n+8]=+!!t.sizeInMeters,o[n+9]=t.priority,o[n+10]=+!!t.isShown}let s=this._viewMatrix.copy(t.matrixWorld).invert(),c=t.matrixWorld.elements;this._view16.set(s.elements),this._proj16.set(t.projectionMatrix.elements);let l=this._kernel.place(o.subarray(0,a*11),this._view16,this._proj16,c[12],c[13],c[14],t.near,n,r,t.fov*Math.PI/180,e.PADDING_PX,e.HYSTERESIS_PX);this._shownByContent.clear();for(let e=0;e<a;e++){let t=i[e],n=l[e]!==0;if(t.owner.applyDeclutter(t.handle,n),!n&&t.contentKey){let e=this._shownByContent.get(t.contentKey);e||(e=[],this._shownByContent.set(t.contentKey,e)),e.push(t.anchorX,t.anchorY,t.anchorZ)}}i.length=0}dispose(){this._participants.clear(),this._candidates.length=0,this._shownByContent.clear()}_snapshotChanged(e,t,n){let r=this._prevCamera,i=e.matrixWorld.elements,a=e.projectionMatrix.elements;for(let e=0;e<16;e++)if(r[e]!==i[e]||r[16+e]!==a[e])return!0;return r[32]!==t||r[33]!==n}_takeSnapshot(e,t,n){let r=this._prevCamera;r.set(e.matrixWorld.elements,0),r.set(e.projectionMatrix.elements,16),r[32]=t,r[33]=n}},RP={place:n.declutterPlace},zP,BP=[`android`,`webos`,`iphone`,`ipad`,`ipod`,`blackberry`,`windows phone`,`opera mini`,`mobile`];function VP(){if(zP!==void 0)return zP;if(typeof navigator>`u`)return zP=!1,!1;let e=navigator.userAgent.toLowerCase(),t=BP.some(t=>e.includes(t)),n=`ontouchstart`in window||navigator.maxTouchPoints>0,r=window.innerWidth<=768;return zP=t||n&&r,zP}var HP=1,UP=2,WP=1048576,GP=64*WP,KP=256*WP,qP=64*WP,JP=128*WP,YP=64*WP,XP=50,ZP=16,QP=8,$P=2048*WP,eF=512*WP-qP,tF=256*WP-qP;function nF(e){let t=e?.isMobile??VP(),n=e?.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory);return t?n===void 0||n>=4?eF:tF:n===void 0?$P:Math.min(n*1024*WP/4,$P)}var rF=512,iF=512,aF=3,oF=256,sF=133,cF=100;function lF(e){return e?iF:rF}function uF(e){let t=lF(e?.isMobile??VP());return{atlasTileBytes:t*t*4*aF,rasterTileBytes:Math.round(oF*oF*4*sF/cF)}}function dF(e){let t=e.isMobile??VP(),n=e.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory),r=Math.max(1,e.poolSize),i=t?qP:KP,a=i;if(n!==void 0){let e=n*1024*WP/(t?8:4);a=Math.min(Math.max(Math.floor(e/r/WP)*WP,GP),i)}let o=t?YP:JP;n!==void 0&&n<4&&(o/=2);let s=XP;t&&(s=n!==void 0&&n>=4?ZP:QP);let c=fF({isMobile:t,deviceMemoryGB:n});return{cacheBytes:nF({isMobile:t,deviceMemoryGB:n}),maxWorkerHeapBytes:a,fontBudgetBytes:o,maxPendingRequests:s,sseMultiplierMin:c.min,sseMultiplierMax:c.max}}function fF(e){let t=e?.isMobile??VP(),n=e?.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory);return t?n!==void 0&&n>=4?{min:4,max:32}:{min:8,max:64}:{min:1,max:16}}var pF={enabled:!0,density:2e-4,sseFactor:2},mF={enabled:!0,density:25e-5,sseFactor:3},hF={enabled:!0,density:.01,sseFactor:6},gF={enabled:!0,density:.1,sseFactor:12};function _F(e){let t=e?.isMobile??VP(),n=e?.deviceMemoryGB??(typeof navigator>`u`?void 0:navigator.deviceMemory);return t?n!==void 0&&n>=4?hF:gF:n!==void 0&&n<4?mF:pF}var vF={enabled:!0,density:2e-4,sseFactor:24,heightFalloff:.25,minHeight:0,maxHeight:8e3};function yF(){return vF}function bF(e){if(typeof e?.override==`number`)return e.override;if(typeof window>`u`)return 1;let t=window.devicePixelRatio??1;if(VP()){let n=e?.mobileOptimization?HP:UP;return Math.min(t,n)}return t}function xF(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function SF(){return new DOMException(`The operation was aborted.`,`AbortError`)}var CF=class extends r.Loader{loadAsyncWithAbort(e,t,n){let r=this;return new Promise(function(i,a){r.load(e,i,n,a,t)})}load(e,t,n,r,i,a=5e3){this.path!==void 0&&(e=this.path+e);let o=this,s=!1,c=window.setTimeout(()=>{u(Error(`TimeoutError`)),i?.abort()},a);function l(n){s||(s=!0,window.clearTimeout(c),t(n),o.manager.itemEnd(e))}function u(t,n){s||(s=!0,window.clearTimeout(c),r&&r(t,n),o.manager.itemError(e),o.manager.itemEnd(e))}o.manager.itemStart(e),fetch(e,{signal:i?.signal}).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status} while loading ${e}`);return t.blob()}).then(t=>{if(!s){if(i?.signal.aborted){u(SF(),!0);return}if(typeof createImageBitmap==`function`){createImageBitmap(t,{imageOrientation:`flipY`,premultiplyAlpha:`none`,colorSpaceConversion:`none`}).then(e=>{if(s||i?.signal.aborted){e.close(),s||u(SF(),!0);return}l(e)}).catch(e=>u(e)),i?.signal.addEventListener(`abort`,()=>u(SF(),!0),{once:!0});return}this.loadViaImageElement(e,t,l,u,i)}}).catch(e=>{u(e,!e.name||e.name===`AbortError`)})}loadViaImageElement(e,t,n,r,i){if(i?.signal.aborted){r(SF(),!0);return}let a=window.URL.createObjectURL(t),o=xF(`img`);function s(){window.URL.revokeObjectURL(a),o.removeEventListener(`load`,c,!1),o.removeEventListener(`error`,l,!1),i?.signal.removeEventListener(`abort`,u,!1)}function c(){s(),n(this)}function l(e){s(),r(e)}function u(){o.src=``,o.remove(),s(),r(SF(),!0)}o.addEventListener(`load`,c,!1),o.addEventListener(`error`,l,!1),i?.signal.addEventListener(`abort`,u,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),o.src=a}};function wF(e){let t=e.image;e.dispose(),typeof ImageBitmap<`u`&&t instanceof ImageBitmap&&t.close()}var TF=class extends r.Loader{loadAsyncWithAbort(e,t,n){let r=this;return new Promise(function(i,a){r.load(e,i,n,a,t)})}load(e,t,n,i,a){let o=new r.Texture,s=new CF(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(e){o.image=e,typeof ImageBitmap<`u`&&e instanceof ImageBitmap&&(o.flipY=!1),o.needsUpdate=!0,t!==void 0&&t(o)},n,i,a),o}};function EF(e,t,n){return kh(e,t,n)}function DF(e){return EF(`getImageDataFromBlob`,[e])}var OF=class{eventManager;scenes;camera;meshes;abortControllers;buf;texFragment;tileHandler;workerTaskHandler;meshHandler;featureHandler;loadedTexs;workerPoolPromises;uniforms;texturizedSceneByTileCoordinates;tileTextureCompositor;tileMapByHandle;textureOptions;renderFlag;viewEvents;layersManager;viewContext;flightHandler;layerHandler;fontManager;textureFragmentIndex;tileMeshToFragmentIds;hillshadeContext;declutter;updatedAt=0;constructor(e){this.eventManager=e.eventManager,this.scenes=e.scenes,this.camera=e.camera,this.meshes=e.meshes,this.abortControllers=e.abortControllers,this.buf=e.buf,this.texFragment=e.texFragment,this.tileHandler=e.tileHandler,this.workerTaskHandler=e.workerTaskHandler,this.meshHandler=e.meshHandler,this.featureHandler=e.featureHandler,this.loadedTexs=e.loadedTexs,this.workerPoolPromises=e.workerPoolPromises,this.uniforms=e.uniforms,this.texturizedSceneByTileCoordinates=e.texturizedSceneByTileCoordinates,this.tileTextureCompositor=e.tileTextureCompositor,this.tileMapByHandle=e.tileMapByHandle,this.textureOptions=e.textureOptions,this.renderFlag=e.renderFlag,this.viewEvents=e.viewEvents,this.layersManager=e.layersManager,this.viewContext=e.viewContext,this.flightHandler=e.flightHandler,this.layerHandler=e.layerHandler,this.fontManager=e.fontManager,this.textureFragmentIndex=e.textureFragmentIndex,this.tileMeshToFragmentIds=e.tileMeshToFragmentIds,this.hillshadeContext=e.hillshadeContext,this.declutter=e.declutter}},kF={Billboard:`billboard`,Text:`text`,Point:`point`,Polyline:`polyline`,Polygon:`polygon`,Model:`model`},AF=Object.values(kF),jF=[`standard`,`physical`],MF=(e,t)=>{t.color!==void 0&&e.color.set(t.color),t.metalness!==void 0&&(e.metalness=t.metalness),t.roughness!==void 0&&(e.roughness=t.roughness),t.emissiveColor!==void 0&&e.emissive.set(t.emissiveColor),t.emissiveIntensity!==void 0&&(e.emissiveIntensity=t.emissiveIntensity),t.transparent!==void 0&&(e.transparent=t.transparent),t.opacity!==void 0&&(e.opacity=t.opacity),t.depthWrite!==void 0&&(e.depthWrite=t.depthWrite)},NF={nvr_uPickable:{value:0},uEffectIdsMask:{value:0},uEmissiveIntensity:{value:0}},PF=()=>{let e=structuredClone(NF);return{update:t=>{e.nvr_uPickable.value=+!!t.pickable,e.uEffectIdsMask.value=t.effectIdsMask,e.uEmissiveIntensity.value=t.emissiveIntensity},updateUniforms:t=>{t.nvr_uPickable=e.nvr_uPickable,t.uEffectIdsMask=e.uEffectIdsMask,t.uEmissiveIntensity=e.uEmissiveIntensity,e.batchDataTexture&&(t.batchDataTexture=e.batchDataTexture)},setBatchDataTexture:t=>{e.batchDataTexture=t}}},FF={vertex:{},fragment:{UNIFORM_START:`// NVR_MODEL_BASE_UNIFORM_START`,UNIFORM_END:`// NVR_MODEL_BASE_UNIFORM_END`,NORMAL_START:`// NVR_MODEL_BASE_NORMAL_START`,NORMAL_END:`// NVR_MODEL_BASE_NORMAL_END`,OUTGOING_LIGHT_START:`// NVR_MODEL_BASE_OUTGOING_LIGHT_START`,OUTGOING_LIGHT_END:`// NVR_MODEL_BASE_OUTGOING_LIGHT_END`,FINAL_NORMAL_START:`// NVR_MODEL_BASE_FINAL_NORMAL_START`,FINAL_NORMAL_END:`// NVR_MODEL_BASE_FINAL_NORMAL_END`}};function IF(e){return GA(e)}var LF=(e,t,n,r)=>{e.defines??={},e.defines.USE_SELECTIVE_EFFECT=1,r.userData.defines&&Object.assign(e.defines,r.userData.defines),n.updateUniforms(e.uniforms,t),e.vertexShader=Q(e.vertexShader).replace(`void main() {`,`
5394
5394
  #include <packing>
5395
5395
 
5396
5396
  in float batchId;
5397
- out float nvr_vBatchId;
5397
+ flat out float nvr_vBatchId;
5398
5398
  out vec3 vPosition;
5399
5399
 
5400
5400
  ${oA}
@@ -5420,7 +5420,7 @@ uniform float nvr_uPickable;
5420
5420
  // uEffectIdsMask is declared by overrideMaterialsForMRT (#ifdef USE_SELECTIVE_EFFECT block)
5421
5421
  ${FF.fragment.UNIFORM_END}
5422
5422
 
5423
- in float nvr_vBatchId;
5423
+ flat in float nvr_vBatchId;
5424
5424
 
5425
5425
  ${aA}
5426
5426
 
@@ -6407,7 +6407,7 @@ void main() {
6407
6407
  gl_FragDepth = texture2D(depth, vUv).r;
6408
6408
  #endif
6409
6409
  }
6410
- `,UB=class extends Nh{_renderTarget;_material;_autoResize;constructor(e,t=!0){super(`RenderTargetCopyPass`),this.needsSwap=!1,this._material=new r.ShaderMaterial({uniforms:{color:{value:null},depth:{value:null}},vertexShader:FB,fragmentShader:HB,blending:r.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1}),this._autoResize=t,this._renderTarget=e,this.fullscreenMaterial=this._material,this.setTexture(e.texture)}get texture(){return this._renderTarget.texture}get autoResize(){return this._autoResize}set autoResize(e){this._autoResize=e}setTexture(e){this._material.uniforms.color.value=e}setRenderTarget(e){this._renderTarget=e,this.setTexture(e.texture)}setDepthTexture(e){this._material.uniforms.depth.value=e;let t=e!==null;`COPY_DEPTH`in this._material.defines!==t&&(t?this._material.defines.COPY_DEPTH=``:delete this._material.defines.COPY_DEPTH,this._material.depthWrite=t,this._material.depthTest=t,this._material.depthFunc=r.AlwaysDepth,this._material.needsUpdate=!0)}render(e,t,n){e.setRenderTarget(t),e.render(this.scene,this.camera)}dispose(){this._renderTarget.dispose(),this._material.dispose()}},WB=new r.Color,GB=class extends uE{_camera;_scenes;gbufferRenderTarget;copyPass;globeDepthCopyPass;globeNormalCopyPass;allDepthCopyPass;disableShadow;globe;combinedScene=new r.Scene;drapedTempScene=new r.Scene;shadowScene=new r.Scene;dummyShadowRenderTarget=new r.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1});debugNormalCopyPass;gbufferScenes;forwardScenes;stampScenes;allowTransparent;buffers;sceneLit;inputBufferTemplate;textureIndex;gbufferDefines;gbufferDefinesStamped=new WeakSet;litStamped=new WeakSet;stampDirty=!0;globeNormalActive=!1;globeNormalUniform;width=1;height=1;lastProgramCount=-1;lastSceneChildCounts=[-1,-1,-1,-1,-1];constructor(e,t,n,i,a){super(),this.needsDepthTexture=!0,this.clearPass.setClearFlags(!0,!0,!0),this._scenes=e,this._camera=t,this.globe=i,this.gbufferScenes=[e.globe,e.mrt,e.draped],this.forwardScenes=[e.opaque,e.transparent],this.stampScenes=[...this.gbufferScenes,...this.forwardScenes],this.buffers=a?.buffers??CA(),this.sceneLit=a?.lit??!0,this.textureIndex=TA(this.buffers),this.gbufferDefines=FA(this.buffers),this.inputBufferTemplate=n,this.gbufferRenderTarget=n.clone(),HA(this.gbufferRenderTarget,this.buffers);let o=new r.DepthTexture(this.gbufferRenderTarget.width,this.gbufferRenderTarget.height,r.UnsignedInt248Type);o.format=r.DepthStencilFormat,this.gbufferRenderTarget.depthTexture=o,this.copyPass=new UB(this.gbufferRenderTarget),this.copyPass.setDepthTexture(o),this.globeDepthCopyPass=new sg({depthPacking:r.RGBADepthPacking}),this.allDepthCopyPass=new zB,this.disableShadow=!!a?.disableShadow,this.allowTransparent=a?.allowTransparent??!0,this.globeNormalCopyPass=new VB,this.globeNormalUniform={value:this.globeNormalCopyPass.texture},a?.debugNormal&&(this.debugNormalCopyPass=new VB,this.debugNormalCopyPass.unpackNormal=!0),this.bindNormalTexture()}bindNormalTexture(){let e=this.textureIndex.normal;if(e===void 0)return;let t=this.gbufferRenderTarget.textures[e];this.globeNormalCopyPass.setNormalTexture(t),this.debugNormalCopyPass?.setNormalTexture(t)}_renderWithLight(e,t){if(this.disableShadow){e.render(t,this._camera);return}t.add(this._scenes.light),e.render(t,this._camera),t.remove(this._scenes.light)}setBuffers(e){let t=SA.every(t=>e[t]===this.buffers[t]);if(this.buffers=e,t)return;this.textureIndex=TA(e),this.gbufferDefines=FA(e),this.gbufferDefinesStamped=new WeakSet,this.stampDirty=!0;let n=this.gbufferRenderTarget,r=this.inputBufferTemplate.clone();r.setSize(n.width,n.height),r.texture=n.texture,UA(r,e),r.depthTexture=n.depthTexture,n.depthTexture=null,this.gbufferRenderTarget=r,n.dispose(),this.copyPass.setRenderTarget(r),this.bindNormalTexture()}setLit(e){this.sceneLit!==e&&(this.sceneLit=e,this.litStamped=new WeakSet,this.stampDirty=!0)}shouldStampGBufferDefines(e){let t=this.stampDirty;this.stampDirty=!1;let n=e.info.programs?.length??0;n!==this.lastProgramCount&&(this.lastProgramCount=n,t=!0);for(let e=0;e<this.stampScenes.length;e++){let n=this.stampScenes[e].children.length;n!==this.lastSceneChildCounts[e]&&(this.lastSceneChildCounts[e]=n,t=!0)}return t}stampGBufferDefines(){for(let e of this.gbufferScenes)e.traverse(e=>{this.forEachMaterial(e,e=>this.stampGBufferDefine(e))});for(let e of this.forwardScenes)e.traverse(e=>{this.forEachMaterial(e,e=>this.stampLitDefine(e))});this._scenes.draped.traverse(e=>{this.forEachMaterial(e,e=>nz(e,this.globeNormalUniform))})}forEachMaterial(e,t){let n=e.material;if(n){if(Array.isArray(n))for(let e of n)t(e);else t(n)}}stampGBufferDefine(e){e.defines??={};let t=!1,n=e.transparent?1:!1;if((e.defines.NVR_BLENDED??!1)!==n&&(e.defines[rP]=n,t=!0),!this.gbufferDefinesStamped.has(e)){this.gbufferDefinesStamped.add(e);for(let n of PA){let r=this.gbufferDefines[n]??!1;(e.defines[n]??!1)!==r&&(e.defines[n]=r,t=!0)}}t&&(e.needsUpdate=!0),this.stampLitDefine(e)}stampLitDefine(e){if(this.litStamped.has(e))return;this.litStamped.add(e),e.defines??={};let t=!this.sceneLit&&1;(e.defines.NVR_UNLIT_SCENE??!1)!==t&&(e.defines[nP]=t,e.needsUpdate=!0)}render(e,t,n){this.shouldStampGBufferDefines(e)&&this.stampGBufferDefines();let i=this._scenes.draped.children.length!==0,a=this.gbufferRenderTarget;this.clearPass.enabled&&this.clearPass.render(e,t,null),e.shadowMap.enabled&&!this.disableShadow&&(e.setRenderTarget(this.dummyShadowRenderTarget),this.shadowScene.add(this._scenes.globe),this.shadowScene.add(this._scenes.mrt),this.shadowScene.add(this._scenes.opaque),e.shadowMap.needsUpdate=!0,this._renderWithLight(e,this.shadowScene),this.shadowScene.clear());let o=!this.globe.hideUnderground||!this.allowTransparent&&this.globe.transparent;e.setRenderTarget(a),e.setClearColor(e.getClearColor(WB),e.getClearAlpha()),e.clear(),this._renderWithLight(e,this._scenes.globe);let s=(i||this.buffers.globeNormal)&&this.textureIndex.normal!==void 0;this.setGlobeNormalActive(s),s&&this.globeNormalCopyPass.render(e,null,null),this.globeDepthCopyPass.setDepthTexture(a.depthTexture),this.globeDepthCopyPass.render(e,null,null),o&&(this.allDepthCopyPass.setDepthTexture(this.globeDepthCopyPass.texture,r.RGBADepthPacking),this.allDepthCopyPass.copyDepth(!1),this.allDepthCopyPass.render(e,null,null)),e.setRenderTarget(a),o&&e.clearDepth();let c=!o&&this.allowTransparent&&this.globe.transparent&&this.globe.hideUnderground;c&&e.clearColor(),i&&this._renderDrapedMesh(e),c&&e.clearDepth(),c?(this.combinedScene.clear(),this.combinedScene.add(this._scenes.globe),this.combinedScene.add(this._scenes.mrt),this._renderWithLight(e,this.combinedScene)):this._renderWithLight(e,this._scenes.mrt),this.debugNormalCopyPass?.render(e,null,null);let l=this.renderToScreen?null:t;this.debugNormalCopyPass&&this.copyPass.setTexture(this.debugNormalCopyPass.texture),this.copyPass.render(e,l,null),this._renderWithLight(e,this._scenes.opaque),this.allDepthCopyPass.setDepthTexture(l?.depthTexture??null),this.allDepthCopyPass.copyDepth(o),this.allDepthCopyPass.render(e,null,null)}setDepthTexture(){}setSize(e,t){this.width=e,this.height=t,this.gbufferRenderTarget.setSize(e,t),this.globeDepthCopyPass.setSize(e,t),this.allDepthCopyPass.setSize(e,t),this.globeNormalActive&&this.globeNormalCopyPass.setSize(e,t),this.debugNormalCopyPass?.setSize(e,t)}setGlobeNormalActive(e){this.globeNormalActive!==e&&(this.globeNormalActive=e,this.globeNormalCopyPass.setSize(e?this.width:1,e?this.height:1))}_renderDrapedMesh(e){let t=this._scenes.draped,n=[...t.children];for(let r of n)!(r instanceof rz)||!r.enabled()||(t.remove(r),this.drapedTempScene.add(r),r.process(()=>this._renderWithLight(e,this.drapedTempScene)),this.drapedTempScene.remove(r),t.add(r))}},KB=class extends uE{_scenes;_camera;cubeCamera;cubeRenderTarget;constructor(e,t,n=64){super(),this._scenes=e,this._camera=t,this.cubeRenderTarget=new r.WebGLCubeRenderTarget(n,{generateMipmaps:!0,type:r.HalfFloatType}),this.cubeCamera=new r.CubeCamera(.1,1e3,this.cubeRenderTarget)}render(e,t,n){this._scenes.skyEnvMap.children.length!==0&&(this.cubeCamera.position.copy(this._camera.position),this.cubeCamera.update(e,this._scenes.skyEnvMap))}getEnvMapTexture(){if(this._scenes.skyEnvMap.children.length!==0)return this.cubeRenderTarget.texture}dispose(){this.cubeRenderTarget.dispose()}},qB=class extends pE{static key=`mrt`;config;constructor(e,t,n){super(e,t,n),this.config=n}createPass(){let e=this.ctx.scenes,t=this.view.camera.raw;return z(this.view.globe),new GB(e,t,this.ctx.getInputBuffer(),this.view.globe,{debugNormal:!!this.config.mrt?.debugNormal,buffers:this.view.buffers,lit:this.view.lit})}get normalBuffer(){let e=this.raw,t=e?.textureIndex.normal;return t===void 0?void 0:e?.gbufferRenderTarget.textures[t]}get effectIdsBuffer(){let e=this.raw?.textureIndex.effectIds;return e===void 0?void 0:this.raw?.gbufferRenderTarget.textures[e]}get emissiveBuffer(){let e=this.raw?.textureIndex.emissive;return e===void 0?void 0:this.raw?.gbufferRenderTarget.textures[e]}get shadowBuffer(){let e=this.raw?.textureIndex.shadow;return e===void 0?void 0:this.raw?.gbufferRenderTarget.textures[e]}get depthBuffer(){return this.raw?.allDepthCopyPass.texture}get depthBufferPacking(){return this.raw?.allDepthCopyPass.depthPacking}get globeNormalBuffer(){return this.raw?.globeNormalCopyPass.texture}get globeDepthBuffer(){return this.raw?.globeDepthCopyPass.texture}get globeDepthBufferPacking(){return this.raw?.globeDepthCopyPass.depthPacking}onUpdateConfig(e){super.onUpdateConfig(e),this._instance&&(Object.assign(this.config,e),e.mrt?.debugNormal)}onDestroy(){super.onDestroy()}};function JB(){return{camera:new r.OrthographicCamera(-1,1,1,-1,0,1),geometry:new r.PlaneGeometry(2,2)}}var YB=class extends pE{static requiredBuffers=[`selectiveEffect`];config;constructor(e,t,n){super(e,t,n),this.config=n}get viewContext(){return this.ctx}get layerConfig(){return this.config}onCreate(){let e=this.ctx.selectiveEffectRegistry;if(!e)throw Error(`SelectiveEffectRegistry not initialized. Ensure MRTPassEffectDesc is added before selective effect descriptors.`);e.registerSlot(this.id),super.onCreate()}onDestroy(){this.ctx.selectiveEffectRegistry?.unregisterSlot(this.id),super.onDestroy()}getEmissiveBuffer(){return this.find(`mrt`)?.emissiveBuffer??null}getEffectIdsBuffer(){return this.find(`mrt`)?.effectIdsBuffer??null}getEffectSlot(){return this.ctx.selectiveEffectRegistry?.getSlot(this.id)??-1}},XB=class extends pE{static key=`skyEnvMap`;static insertBefore=[`mrt`];config;constructor(e,t,n){super(e,t,n),this.config=n}createPass(){let e=this.ctx.scenes,t=this.view.camera.raw;return new KB(e,t,this.config.skyEnvMap?.resolution??256)}onUpdateConfig(e){super.onUpdateConfig(e),this._instance&&(Object.assign(this.config,e),e.skyEnvMap?.resolution)}},ZB=class extends pE{static key=`transparent`;static insertBefore=[`final`];light=new r.Group;lightsSyncMap=new Map;createPass(){let e=new r.Scene;e.add(this.light),e.add(this.ctx.scenes.transparent);let t=this.view.camera.raw,n=new uE(e,t);return n.clear=!1,this.ctx.scenes.light.addEventListener(`childadded`,({child:e})=>{let t=e.clone(!0);this.lightsSyncMap.set(e.id,t),this.light.add(t)}),this.ctx.scenes.light.addEventListener(`childremoved`,({child:e})=>{this.light.remove(this.lightsSyncMap.get(e.id)),this.lightsSyncMap.delete(e.id)}),n}update(e){for(let e of this.ctx.scenes.light.children)this.lightsSyncMap.get(e.id)?.copy(e,!0)}},QB=4,$B=1.33;function eV(e){switch(e){case r.FloatType:return 16;case r.HalfFloatType:return 8;default:return 4}}function tV(e){let t=e.width*e.height,n=0;for(let r of e.textures){let e=t*eV(r.type);r.generateMipmaps&&(e=Math.floor(e*$B)),n+=e}if((e.depthBuffer||e.depthTexture)&&(n+=t*QB),e.samples>0){let r=0;for(let t of e.textures)r+=eV(t.type);(e.depthBuffer||e.depthTexture)&&(r+=QB),n+=e.samples*t*r}return n}function nV(e,t,n,i){if(!(typeof e!=`object`||!e||n.has(e))){if(n.add(e),e instanceof r.WebGLRenderTarget){t.add(e);return}if(!(i<=0||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof r.Object3D||e instanceof r.Material||e instanceof r.Texture))for(let r of Object.keys(e)){let a=e[r];if(Array.isArray(a))for(let e of a)nV(e,t,n,i-1);else nV(a,t,n,i-1)}}}function rV(e,t){let n=e?.properties;return!n||n.get(t).__webglFramebuffer!==void 0}function iV(e,t){let n=new Set,r=new Set;nV(e.inputBuffer,n,r,0),nV(e.outputBuffer,n,r,0),nV(e.depthRenderTarget,n,r,0);for(let e of t)nV(e,n,r,3);let i=e.getRenderer?.(),a=0;for(let e of n)rV(i,e)&&(a+=tV(e));return a}var aV=class{lights=new r.Group;scenes={mrt:new r.Scene,globe:new r.Scene,draped:new r.Scene,opaque:new r.Scene,transparent:new r.Scene,skyEnvMap:new r.Scene};effectComposer;onPassesChanged;passMap=new re;constructor(e,t){this.effectComposer=new Gh(e,{stencilBuffer:!0,frameBufferType:t.halfFloat??!0?r.HalfFloatType:void 0,multisampling:t.multisampling})}setSize(e,t){this.effectComposer.setSize(e,t)}render(){this.effectComposer.render()}addPass(e,t){let n={name:e,pass:t};this.passMap.add(n),this.effectComposer.addPass(t),this.onPassesChanged?.()}insertPassBefore(e,t,n){let r={name:t,pass:n},i=this.passMap.insertBefore(e,r);this.effectComposer.addPass(n,i),this.onPassesChanged?.()}insertPassAfter(e,t,n){let r={name:t,pass:n},i=this.passMap.insertAfter(e,r);this.effectComposer.addPass(n,i),this.onPassesChanged?.()}removePass(e){let t=this.passMap.list.find(t=>t.name===e);if(!t)throw Error(`Pass not found: ${e}`);this.effectComposer.removePass(t.pass),this.passMap.list=this.passMap.list.filter(t=>t.name!==e),this.rebuildIndexMap(),this.onPassesChanged?.()}getPass(e){return this.passMap.list.find(t=>t.name===e)?.pass}getPassNames(){return this.passMap.list.map(e=>e.name)}clearPasses(){for(let e of this.passMap.list)this.effectComposer.removePass(e.pass);this.passMap.list=[],this.passMap.indexMap={},this.onPassesChanged?.()}estimateFixedGpuBytes(){return iV(this.effectComposer,this.passMap.list.map(e=>e.pass))}dispose(){this.clearPasses(),this.effectComposer.dispose()}rebuildIndexMap(){this.passMap.indexMap={};for(let e=0;e<this.passMap.list.length;e++)this.passMap.indexMap[this.passMap.list[e].name]=e}},oV=class{canvas;canvasForImage;constructor(e,t,{styleWidth:n=`300px`,styleHeight:r=`auto`}={}){this.canvas=document.createElement(`canvas`),this.canvas.width=e,this.canvas.height=t,this.canvas.style.width=n,this.canvas.style.height=r,this.canvas.style.position=`absolute`,this.canvas.style.top=`0px`,this.canvas.style.left=`0px`,this.canvas.style.zIndex=`1000`,this.canvas.style.pointerEvents=`none`,document.body.appendChild(this.canvas),this.canvasForImage=document.createElement(`canvas`),this.canvasForImage.width=e,this.canvasForImage.height=t}render(e,t){let n=t.width,r=t.height,i=new Uint8Array(n*r*4);e.readRenderTargetPixels(t,0,0,n,r,i),this.drawPixels(i,n,r)}renderFromPixels(e,t,n){this.drawPixels(e,t,n)}drawPixels(e,t,n){let r=this.canvas.getContext(`2d`);if(!r)return;r.clearRect(0,0,this.canvas.width,this.canvas.height),(this.canvasForImage.width!==t||this.canvasForImage.height!==n)&&(this.canvasForImage.width=t,this.canvasForImage.height=n);let i=r.createImageData(t,n);i.data.set(e);let a=this.canvasForImage.getContext(`2d`);if(!a)return;a.putImageData(i,0,0);let o=this.canvas.width,s=this.canvas.height;r.translate(0,s),r.scale(1,-1),r.drawImage(this.canvasForImage,0,0,o,s),r.setTransform(1,0,0,1,0,0)}dispose(){this.canvas.remove(),this.canvasForImage.remove()}},sV=5;function cV(e,t){return e.distanceTo(t)<sV}var lV=class{element;pixelBuffer;_renderer;_camera;_meshes;onPickCallback;pickScene=new r.Scene;debugBufferView;debugRenderTarget;pickRenderTarget;onHoverCallback;shouldClickPick;shouldHoverPick;mouseDownPosition;mouseDownHandler;mouseUpHandler;hoverMoveHandler;hoverLeaveHandler;hoverPosition;hoverRafId;constructor(e,t,n,i,a,o,s,c,l){this.element=e,this.pixelBuffer=new Uint8Array(4),this._renderer=t,this._camera=n,this._meshes=i,this.onPickCallback=a,this.onHoverCallback=o,this.shouldClickPick=s,this.shouldHoverPick=c,this.mouseDownHandler=e=>this.onMouseDown(e),this.mouseUpHandler=e=>this.onMouseUp(e),this.hoverMoveHandler=e=>this.onHoverMouseMove(e),this.hoverLeaveHandler=()=>this.onHoverMouseLeave();let u=this._renderer.getContext().drawingBufferWidth,d=this._renderer.getContext().drawingBufferHeight;this.pickRenderTarget=new r.WebGLRenderTarget(u,d,{format:r.RGBAFormat,depthBuffer:!0,stencilBuffer:!1}),l?.debug&&(this.debugBufferView=new oV(u,d),this.debugRenderTarget=new r.WebGLRenderTarget(u,d,{format:r.RGBAFormat,depthBuffer:!0,stencilBuffer:!1}))}onMouseDown(e){this.mouseDownPosition=new r.Vector2(e.clientX,e.clientY)}onMouseUp(e){let t=this.mouseDownPosition;this.mouseDownPosition=void 0,t&&this.shouldClickPick()&&cV(t,new r.Vector2(e.clientX,e.clientY))&&this.onMouseClick(e)}enablePick(e){e?(this.element.addEventListener(`mousedown`,this.mouseDownHandler),this.element.addEventListener(`mouseup`,this.mouseUpHandler),this.element.addEventListener(`mousemove`,this.hoverMoveHandler),this.element.addEventListener(`mouseleave`,this.hoverLeaveHandler)):(this.element.removeEventListener(`mousedown`,this.mouseDownHandler),this.element.removeEventListener(`mouseup`,this.mouseUpHandler),this.element.removeEventListener(`mousemove`,this.hoverMoveHandler),this.element.removeEventListener(`mouseleave`,this.hoverLeaveHandler),this.cancelPendingHoverPick())}onHoverMouseMove(e){e.buttons!==0||!this.shouldHoverPick()||(this.hoverPosition||=new r.Vector2,this.hoverPosition.set(e.clientX,e.clientY),this.hoverRafId===void 0&&(this.hoverRafId=requestAnimationFrame(()=>{this.hoverRafId=void 0;let e=this.hoverPosition;if(!e||(this.hoverPosition=void 0,!this.shouldHoverPick()))return;let t=this.pickBatchIdAt(e.x,e.y);this.onHoverCallback(t>0?[t]:[])})))}onHoverMouseLeave(){this.cancelPendingHoverPick(),this.shouldHoverPick()&&this.onHoverCallback([])}cancelPendingHoverPick(){this.hoverRafId!==void 0&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=void 0),this.hoverPosition=void 0}stagePickables(e){let t=[],n=[];for(let[r,i]of this._meshes){if(!EI(i))continue;let r=i.getRenderable(),a=r.parent;!a||!r.visible||(i.onBeforePicking(e),n.push(i),!(a instanceof OL)&&(this.pickScene.add(r),t.push([r,a])))}return()=>{for(let[e,n]of t)n.add(e);for(let e of n)e.onAfterPicking()}}processRender(e,t){let n=new r.Color;this._renderer.getClearColor(n);let i=this._renderer.getClearAlpha(),a=this._renderer.getRenderTarget(),o=this._renderer.autoClear,s=this.stagePickables(t);this._renderer.setClearColor(0,1),this._renderer.setRenderTarget(e),this._renderer.autoClear=!0,this._renderer.clear(!0,!0,!1),this._renderer.render(this.pickScene,this._camera),s(),this._renderer.setRenderTarget(a),this._renderer.setClearColor(n,i),this._renderer.autoClear=o}setSize(e,t){this.pickRenderTarget.setSize(e,t),this.debugRenderTarget?.setSize(e,t),this.debugBufferView&&(this.debugBufferView.canvas.width=e,this.debugBufferView.canvas.height=t,this.debugBufferView.canvasForImage.width=e,this.debugBufferView.canvasForImage.height=t)}renderDebugCanvas(){!this.debugBufferView||!this.debugRenderTarget||(this.processRender(this.debugRenderTarget),this.debugBufferView.render(this._renderer,this.debugRenderTarget))}onMouseClick(e){let t=this.pickBatchIdAt(e.clientX,e.clientY),n=t>0?[t]:[];this.onPickCallback(n)}pickBatchIdAt(e,t){let n=this.element.getBoundingClientRect(),i=e-n.left,a=t-n.top,o=this._renderer.getPixelRatio(),s=this._renderer.getContext().drawingBufferWidth,c=this._renderer.getContext().drawingBufferHeight,l=Math.max(0,Math.min(Math.floor(i*o),s-1)),u=Math.max(0,Math.min(Math.floor(a*o),c-1)),d=new r.Vector2(l+.5,c-u-.5),f=c-1-u;return this._renderer.setScissor(l,f,1,1),this._renderer.setScissorTest(!0),this.processRender(this.pickRenderTarget,d),this._renderer.readRenderTargetPixels(this.pickRenderTarget,l,f,1,1,this.pixelBuffer),this._renderer.setScissorTest(!1),(this.pixelBuffer[0]<<16)+(this.pixelBuffer[1]<<8)+this.pixelBuffer[2]}dispose(){this.enablePick(!1),this.pickRenderTarget.dispose(),this.debugRenderTarget?.dispose(),this.debugBufferView?.dispose()}},uV=class{quad;scene;camera;sampleTarget;material;constructor(){this.material=new r.ShaderMaterial({uniforms:{tDepth:{value:null},samplePos:{value:new r.Vector2}},vertexShader:`
6410
+ `,UB=class extends Nh{_renderTarget;_material;_autoResize;constructor(e,t=!0){super(`RenderTargetCopyPass`),this.needsSwap=!1,this._material=new r.ShaderMaterial({uniforms:{color:{value:null},depth:{value:null}},vertexShader:FB,fragmentShader:HB,blending:r.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1}),this._autoResize=t,this._renderTarget=e,this.fullscreenMaterial=this._material,this.setTexture(e.texture)}get texture(){return this._renderTarget.texture}get autoResize(){return this._autoResize}set autoResize(e){this._autoResize=e}setTexture(e){this._material.uniforms.color.value=e}setRenderTarget(e){this._renderTarget=e,this.setTexture(e.texture)}setDepthTexture(e){this._material.uniforms.depth.value=e;let t=e!==null;`COPY_DEPTH`in this._material.defines!==t&&(t?this._material.defines.COPY_DEPTH=``:delete this._material.defines.COPY_DEPTH,this._material.depthWrite=t,this._material.depthTest=t,this._material.depthFunc=r.AlwaysDepth,this._material.needsUpdate=!0)}render(e,t,n){e.setRenderTarget(t),e.render(this.scene,this.camera)}dispose(){this._renderTarget.dispose(),this._material.dispose()}},WB=new r.Color,GB=class extends uE{_camera;_scenes;gbufferRenderTarget;copyPass;globeDepthCopyPass;globeNormalCopyPass;allDepthCopyPass;disableShadow;globe;combinedScene=new r.Scene;drapedTempScene=new r.Scene;shadowScene=new r.Scene;dummyShadowRenderTarget=new r.WebGLRenderTarget(1,1,{depthBuffer:!0,stencilBuffer:!1});debugNormalCopyPass;gbufferScenes;forwardScenes;stampScenes;allowTransparent;buffers;sceneLit;inputBufferTemplate;textureIndex;gbufferDefines;gbufferDefinesStamped=new WeakSet;litStamped=new WeakSet;stampDirty=!0;globeNormalActive=!1;globeNormalUniform;width=1;height=1;lastProgramCount=-1;lastSceneChildCounts=[-1,-1,-1,-1,-1];constructor(e,t,n,i,a){super(),this.needsDepthTexture=!0,this.clearPass.setClearFlags(!0,!0,!0),this._scenes=e,this._camera=t,this.globe=i,this.gbufferScenes=[e.globe,e.mrt,e.draped],this.forwardScenes=[e.opaque,e.transparent],this.stampScenes=[...this.gbufferScenes,...this.forwardScenes],this.buffers=a?.buffers??CA(),this.sceneLit=a?.lit??!0,this.textureIndex=TA(this.buffers),this.gbufferDefines=FA(this.buffers),this.inputBufferTemplate=n,this.gbufferRenderTarget=n.clone(),HA(this.gbufferRenderTarget,this.buffers);let o=new r.DepthTexture(this.gbufferRenderTarget.width,this.gbufferRenderTarget.height,r.UnsignedInt248Type);o.format=r.DepthStencilFormat,this.gbufferRenderTarget.depthTexture=o,this.copyPass=new UB(this.gbufferRenderTarget),this.copyPass.setDepthTexture(o),this.globeDepthCopyPass=new sg({depthPacking:r.RGBADepthPacking}),this.allDepthCopyPass=new zB,this.disableShadow=!!a?.disableShadow,this.allowTransparent=a?.allowTransparent??!0,this.globeNormalCopyPass=new VB,this.globeNormalUniform={value:this.globeNormalCopyPass.texture},a?.debugNormal&&(this.debugNormalCopyPass=new VB,this.debugNormalCopyPass.unpackNormal=!0),this.bindNormalTexture()}bindNormalTexture(){let e=this.textureIndex.normal;if(e===void 0)return;let t=this.gbufferRenderTarget.textures[e];this.globeNormalCopyPass.setNormalTexture(t),this.debugNormalCopyPass?.setNormalTexture(t)}_renderWithLight(e,t){if(this.disableShadow){e.render(t,this._camera);return}t.add(this._scenes.light),e.render(t,this._camera),t.remove(this._scenes.light)}setBuffers(e){let t=SA.every(t=>e[t]===this.buffers[t]);if(this.buffers=e,t)return;this.textureIndex=TA(e),this.gbufferDefines=FA(e),this.gbufferDefinesStamped=new WeakSet,this.stampDirty=!0;let n=this.gbufferRenderTarget,r=this.inputBufferTemplate.clone();r.setSize(n.width,n.height),r.texture=n.texture,UA(r,e),r.depthTexture=n.depthTexture,n.depthTexture=null,this.gbufferRenderTarget=r,n.dispose(),this.copyPass.setRenderTarget(r),this.bindNormalTexture()}setLit(e){this.sceneLit!==e&&(this.sceneLit=e,this.litStamped=new WeakSet,this.stampDirty=!0)}shouldStampGBufferDefines(e){let t=this.stampDirty;this.stampDirty=!1;let n=e.info.programs?.length??0;n!==this.lastProgramCount&&(this.lastProgramCount=n,t=!0);for(let e=0;e<this.stampScenes.length;e++){let n=this.stampScenes[e].children.length;n!==this.lastSceneChildCounts[e]&&(this.lastSceneChildCounts[e]=n,t=!0)}return t}stampGBufferDefines(){for(let e of this.gbufferScenes)e.traverse(e=>{this.forEachMaterial(e,e=>this.stampGBufferDefine(e))});for(let e of this.forwardScenes)e.traverse(e=>{this.forEachMaterial(e,e=>this.stampLitDefine(e))});this._scenes.draped.traverse(e=>{this.forEachMaterial(e,e=>nz(e,this.globeNormalUniform))})}forEachMaterial(e,t){let n=e.material;if(n){if(Array.isArray(n))for(let e of n)t(e);else t(n)}}stampGBufferDefine(e){e.defines??={};let t=!1,n=e.transparent?1:!1;if((e.defines.NVR_BLENDED??!1)!==n&&(e.defines[rP]=n,t=!0),!this.gbufferDefinesStamped.has(e)){this.gbufferDefinesStamped.add(e);for(let n of PA){let r=this.gbufferDefines[n]??!1;(e.defines[n]??!1)!==r&&(e.defines[n]=r,t=!0)}}t&&(e.needsUpdate=!0),this.stampLitDefine(e)}stampLitDefine(e){if(this.litStamped.has(e))return;this.litStamped.add(e),e.defines??={};let t=!this.sceneLit&&1;(e.defines.NVR_UNLIT_SCENE??!1)!==t&&(e.defines[nP]=t,e.needsUpdate=!0)}render(e,t,n){this.shouldStampGBufferDefines(e)&&this.stampGBufferDefines();let i=this._scenes.draped.children.length!==0,a=this.gbufferRenderTarget;this.clearPass.enabled&&this.clearPass.render(e,t,null),e.shadowMap.enabled&&!this.disableShadow&&(e.setRenderTarget(this.dummyShadowRenderTarget),this.shadowScene.add(this._scenes.globe),this.shadowScene.add(this._scenes.mrt),this.shadowScene.add(this._scenes.opaque),e.shadowMap.needsUpdate=!0,this._renderWithLight(e,this.shadowScene),this.shadowScene.clear());let o=!this.globe.hideUnderground||!this.allowTransparent&&this.globe.transparent;e.setRenderTarget(a),e.setClearColor(e.getClearColor(WB),e.getClearAlpha()),e.clear(),this._renderWithLight(e,this._scenes.globe);let s=(i||this.buffers.globeNormal)&&this.textureIndex.normal!==void 0;this.setGlobeNormalActive(s),s&&this.globeNormalCopyPass.render(e,null,null),this.globeDepthCopyPass.setDepthTexture(a.depthTexture),this.globeDepthCopyPass.render(e,null,null),o&&(this.allDepthCopyPass.setDepthTexture(this.globeDepthCopyPass.texture,r.RGBADepthPacking),this.allDepthCopyPass.copyDepth(!1),this.allDepthCopyPass.render(e,null,null)),e.setRenderTarget(a),o&&e.clearDepth();let c=!o&&this.allowTransparent&&this.globe.transparent&&this.globe.hideUnderground;c&&e.clearColor(),i&&this._renderDrapedMesh(e),c&&e.clearDepth(),c?(this.combinedScene.clear(),this.combinedScene.add(this._scenes.globe),this.combinedScene.add(this._scenes.mrt),this._renderWithLight(e,this.combinedScene)):this._renderWithLight(e,this._scenes.mrt),this.debugNormalCopyPass?.render(e,null,null);let l=this.renderToScreen?null:t;this.debugNormalCopyPass&&this.copyPass.setTexture(this.debugNormalCopyPass.texture),this.copyPass.render(e,l,null),this._renderWithLight(e,this._scenes.opaque),this.allDepthCopyPass.setDepthTexture(l?.depthTexture??null),this.allDepthCopyPass.copyDepth(o),this.allDepthCopyPass.render(e,null,null)}setDepthTexture(){}setSize(e,t){this.width=e,this.height=t,this.gbufferRenderTarget.setSize(e,t),this.globeDepthCopyPass.setSize(e,t),this.allDepthCopyPass.setSize(e,t),this.globeNormalActive&&this.globeNormalCopyPass.setSize(e,t),this.debugNormalCopyPass?.setSize(e,t)}setGlobeNormalActive(e){this.globeNormalActive!==e&&(this.globeNormalActive=e,this.globeNormalCopyPass.setSize(e?this.width:1,e?this.height:1))}_renderDrapedMesh(e){let t=this._scenes.draped,n=[...t.children];for(let r of n)!(r instanceof rz)||!r.enabled()||(t.remove(r),this.drapedTempScene.add(r),r.process(()=>this._renderWithLight(e,this.drapedTempScene)),this.drapedTempScene.remove(r),t.add(r))}},KB=class extends uE{_scenes;_camera;cubeCamera;cubeRenderTarget;constructor(e,t,n=64){super(),this._scenes=e,this._camera=t,this.cubeRenderTarget=new r.WebGLCubeRenderTarget(n,{generateMipmaps:!0,type:r.HalfFloatType}),this.cubeCamera=new r.CubeCamera(.1,1e3,this.cubeRenderTarget)}render(e,t,n){this._scenes.skyEnvMap.children.length!==0&&(this.cubeCamera.position.copy(this._camera.position),this.cubeCamera.update(e,this._scenes.skyEnvMap))}getEnvMapTexture(){if(this._scenes.skyEnvMap.children.length!==0)return this.cubeRenderTarget.texture}dispose(){this.cubeRenderTarget.dispose()}},qB=class extends pE{static key=`mrt`;config;constructor(e,t,n){super(e,t,n),this.config=n}createPass(){let e=this.ctx.scenes,t=this.view.camera.raw;return z(this.view.globe),new GB(e,t,this.ctx.getInputBuffer(),this.view.globe,{debugNormal:!!this.config.mrt?.debugNormal,buffers:this.view.buffers,lit:this.view.lit})}get normalBuffer(){let e=this.raw,t=e?.textureIndex.normal;return t===void 0?void 0:e?.gbufferRenderTarget.textures[t]}get effectIdsBuffer(){let e=this.raw?.textureIndex.effectIds;return e===void 0?void 0:this.raw?.gbufferRenderTarget.textures[e]}get emissiveBuffer(){let e=this.raw?.textureIndex.emissive;return e===void 0?void 0:this.raw?.gbufferRenderTarget.textures[e]}get shadowBuffer(){let e=this.raw?.textureIndex.shadow;return e===void 0?void 0:this.raw?.gbufferRenderTarget.textures[e]}get depthBuffer(){return this.raw?.allDepthCopyPass.texture}get depthBufferPacking(){return this.raw?.allDepthCopyPass.depthPacking}get globeNormalBuffer(){return this.raw?.globeNormalCopyPass.texture}get globeDepthBuffer(){return this.raw?.globeDepthCopyPass.texture}get globeDepthBufferPacking(){return this.raw?.globeDepthCopyPass.depthPacking}onUpdateConfig(e){super.onUpdateConfig(e),this._instance&&(Object.assign(this.config,e),e.mrt?.debugNormal)}onDestroy(){super.onDestroy()}};function JB(){return{camera:new r.OrthographicCamera(-1,1,1,-1,0,1),geometry:new r.PlaneGeometry(2,2)}}var YB=class extends pE{static requiredBuffers=[`selectiveEffect`];config;constructor(e,t,n){super(e,t,n),this.config=n}get viewContext(){return this.ctx}get layerConfig(){return this.config}onCreate(){let e=this.ctx.selectiveEffectRegistry;if(!e)throw Error(`SelectiveEffectRegistry not initialized. Ensure MRTPassEffectDesc is added before selective effect descriptors.`);e.registerSlot(this.id),super.onCreate()}onDestroy(){this.ctx.selectiveEffectRegistry?.unregisterSlot(this.id),super.onDestroy()}getEmissiveBuffer(){return this.find(`mrt`)?.emissiveBuffer??null}getEffectIdsBuffer(){return this.find(`mrt`)?.effectIdsBuffer??null}getEffectSlot(){return this.ctx.selectiveEffectRegistry?.getSlot(this.id)??-1}},XB=class extends pE{static key=`skyEnvMap`;static insertBefore=[`mrt`];config;constructor(e,t,n){super(e,t,n),this.config=n}createPass(){let e=this.ctx.scenes,t=this.view.camera.raw;return new KB(e,t,this.config.skyEnvMap?.resolution??256)}onUpdateConfig(e){super.onUpdateConfig(e),this._instance&&(Object.assign(this.config,e),e.skyEnvMap?.resolution)}},ZB=class extends pE{static key=`transparent`;static insertBefore=[`final`];light=new r.Group;lightsSyncMap=new Map;createPass(){let e=new r.Scene;e.add(this.light),e.add(this.ctx.scenes.transparent);let t=this.view.camera.raw,n=new uE(e,t);return n.clear=!1,this.ctx.scenes.light.addEventListener(`childadded`,({child:e})=>{let t=e.clone(!0);this.lightsSyncMap.set(e.id,t),this.light.add(t)}),this.ctx.scenes.light.addEventListener(`childremoved`,({child:e})=>{this.light.remove(this.lightsSyncMap.get(e.id)),this.lightsSyncMap.delete(e.id)}),n}update(e){for(let e of this.ctx.scenes.light.children)this.lightsSyncMap.get(e.id)?.copy(e,!0)}},QB=4,$B=1.33;function eV(e){switch(e){case r.FloatType:return 16;case r.HalfFloatType:return 8;default:return 4}}function tV(e){let t=e.width*e.height,n=0;for(let r of e.textures){let e=t*eV(r.type);r.generateMipmaps&&(e=Math.floor(e*$B)),n+=e}if((e.depthBuffer||e.depthTexture)&&(n+=t*QB),e.samples>0){let r=0;for(let t of e.textures)r+=eV(t.type);(e.depthBuffer||e.depthTexture)&&(r+=QB),n+=e.samples*t*r}return n}function nV(e,t,n,i){if(!(typeof e!=`object`||!e||n.has(e))){if(n.add(e),e instanceof r.WebGLRenderTarget){t.add(e);return}if(!(i<=0||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof r.Object3D||e instanceof r.Material||e instanceof r.Texture))for(let r of Object.keys(e)){let a=e[r];if(Array.isArray(a))for(let e of a)nV(e,t,n,i-1);else nV(a,t,n,i-1)}}}function rV(e,t){let n=e?.properties;return!n||n.get(t).__webglFramebuffer!==void 0}function iV(e,t){let n=new Set,r=new Set;nV(e.inputBuffer,n,r,0),nV(e.outputBuffer,n,r,0),nV(e.depthRenderTarget,n,r,0);for(let e of t)nV(e,n,r,3);let i=e.getRenderer?.(),a=0;for(let e of n)rV(i,e)&&(a+=tV(e));return a}var aV=class{lights=new r.Group;scenes={mrt:new r.Scene,globe:new r.Scene,draped:new r.Scene,opaque:new r.Scene,transparent:new r.Scene,skyEnvMap:new r.Scene};effectComposer;onPassesChanged;passMap=new re;constructor(e,t){this.effectComposer=new Gh(e,{stencilBuffer:!0,frameBufferType:t.halfFloat??!0?r.HalfFloatType:void 0,multisampling:t.multisampling})}setSize(e,t){this.effectComposer.setSize(e,t)}render(){this.effectComposer.render()}addPass(e,t){let n={name:e,pass:t};this.passMap.add(n),this.effectComposer.addPass(t),this.onPassesChanged?.()}insertPassBefore(e,t,n){let r={name:t,pass:n},i=this.passMap.insertBefore(e,r);this.effectComposer.addPass(n,i),this.onPassesChanged?.()}insertPassAfter(e,t,n){let r={name:t,pass:n},i=this.passMap.insertAfter(e,r);this.effectComposer.addPass(n,i),this.onPassesChanged?.()}removePass(e){let t=this.passMap.list.find(t=>t.name===e);if(!t)throw Error(`Pass not found: ${e}`);this.effectComposer.removePass(t.pass),this.passMap.list=this.passMap.list.filter(t=>t.name!==e),this.rebuildIndexMap(),this.onPassesChanged?.()}getPass(e){return this.passMap.list.find(t=>t.name===e)?.pass}getPassNames(){return this.passMap.list.map(e=>e.name)}clearPasses(){for(let e of this.passMap.list)this.effectComposer.removePass(e.pass);this.passMap.list=[],this.passMap.indexMap={},this.onPassesChanged?.()}estimateFixedGpuBytes(){return iV(this.effectComposer,this.passMap.list.map(e=>e.pass))}dispose(){this.clearPasses(),this.effectComposer.dispose()}rebuildIndexMap(){this.passMap.indexMap={};for(let e=0;e<this.passMap.list.length;e++)this.passMap.indexMap[this.passMap.list[e].name]=e}},oV=class{canvas;canvasForImage;constructor(e,t,{styleWidth:n=`300px`,styleHeight:r=`auto`}={}){this.canvas=document.createElement(`canvas`),this.canvas.width=e,this.canvas.height=t,this.canvas.style.width=n,this.canvas.style.height=r,this.canvas.style.position=`absolute`,this.canvas.style.top=`0px`,this.canvas.style.left=`0px`,this.canvas.style.zIndex=`1000`,this.canvas.style.pointerEvents=`none`,document.body.appendChild(this.canvas),this.canvasForImage=document.createElement(`canvas`),this.canvasForImage.width=e,this.canvasForImage.height=t}render(e,t){let n=t.width,r=t.height,i=new Uint8Array(n*r*4);e.readRenderTargetPixels(t,0,0,n,r,i),this.drawPixels(i,n,r)}renderFromPixels(e,t,n){this.drawPixels(e,t,n)}drawPixels(e,t,n){let r=this.canvas.getContext(`2d`);if(!r)return;r.clearRect(0,0,this.canvas.width,this.canvas.height),(this.canvasForImage.width!==t||this.canvasForImage.height!==n)&&(this.canvasForImage.width=t,this.canvasForImage.height=n);let i=r.createImageData(t,n);i.data.set(e);let a=this.canvasForImage.getContext(`2d`);if(!a)return;a.putImageData(i,0,0);let o=this.canvas.width,s=this.canvas.height;r.translate(0,s),r.scale(1,-1),r.drawImage(this.canvasForImage,0,0,o,s),r.setTransform(1,0,0,1,0,0)}dispose(){this.canvas.remove(),this.canvasForImage.remove()}},sV=5,cV=30;function lV(e,t,n=5){return e.distanceTo(t)<n}var uV=3,dV=10,fV=class{element;pixelBuffer;_renderer;_camera;_meshes;onPickCallback;pickScene=new r.Scene;debugBufferView;debugRenderTarget;pickRenderTarget;onHoverCallback;shouldClickPick;shouldHoverPick;pointerDownPosition;pointerDownHandler;pointerUpHandler;pointerCancelHandler;hoverMoveHandler;hoverLeaveHandler;hoverPosition;hoverRafId;constructor(e,t,n,i,a,o,s,c,l){this.element=e,this.pixelBuffer=new Uint8Array(4),this._renderer=t,this._camera=n,this._meshes=i,this.onPickCallback=a,this.onHoverCallback=o,this.shouldClickPick=s,this.shouldHoverPick=c,this.pointerDownHandler=e=>this.onPointerDown(e),this.pointerUpHandler=e=>this.onPointerUp(e),this.pointerCancelHandler=()=>this.onPointerCancel(),this.hoverMoveHandler=e=>this.onHoverPointerMove(e),this.hoverLeaveHandler=()=>this.onHoverPointerLeave();let u=this._renderer.getContext().drawingBufferWidth,d=this._renderer.getContext().drawingBufferHeight;this.pickRenderTarget=new r.WebGLRenderTarget(u,d,{format:r.RGBAFormat,depthBuffer:!0,stencilBuffer:!1}),l?.debug&&(this.debugBufferView=new oV(u,d),this.debugRenderTarget=new r.WebGLRenderTarget(u,d,{format:r.RGBAFormat,depthBuffer:!0,stencilBuffer:!1}))}onPointerDown(e){if(!e.isPrimary){this.pointerDownPosition=void 0;return}this.pointerDownPosition=new r.Vector2(e.clientX,e.clientY)}onPointerUp(e){if(!e.isPrimary)return;let t=this.pointerDownPosition;if(this.pointerDownPosition=void 0,!t||!this.shouldClickPick())return;let n=e.pointerType===`touch`?30:5;lV(t,new r.Vector2(e.clientX,e.clientY),n)&&this.onClickPick(e)}onPointerCancel(){this.pointerDownPosition=void 0}enablePick(e){e?(this.element.addEventListener(`pointerdown`,this.pointerDownHandler),this.element.addEventListener(`pointerup`,this.pointerUpHandler),this.element.addEventListener(`pointercancel`,this.pointerCancelHandler),this.element.addEventListener(`pointermove`,this.hoverMoveHandler),this.element.addEventListener(`pointerleave`,this.hoverLeaveHandler)):(this.element.removeEventListener(`pointerdown`,this.pointerDownHandler),this.element.removeEventListener(`pointerup`,this.pointerUpHandler),this.element.removeEventListener(`pointercancel`,this.pointerCancelHandler),this.element.removeEventListener(`pointermove`,this.hoverMoveHandler),this.element.removeEventListener(`pointerleave`,this.hoverLeaveHandler),this.cancelPendingHoverPick())}onHoverPointerMove(e){e.buttons!==0||!this.shouldHoverPick()||(this.hoverPosition||=new r.Vector2,this.hoverPosition.set(e.clientX,e.clientY),this.hoverRafId===void 0&&(this.hoverRafId=requestAnimationFrame(()=>{this.hoverRafId=void 0;let e=this.hoverPosition;if(!e||(this.hoverPosition=void 0,!this.shouldHoverPick()))return;let t=this.pickBatchIdAt(e.x,e.y);this.onHoverCallback(t>0?[t]:[])})))}onHoverPointerLeave(){this.cancelPendingHoverPick(),this.shouldHoverPick()&&this.onHoverCallback([])}cancelPendingHoverPick(){this.hoverRafId!==void 0&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=void 0),this.hoverPosition=void 0}stagePickables(e){let t=[],n=[];for(let[r,i]of this._meshes){if(!EI(i))continue;let r=i.getRenderable(),a=r.parent;!a||!r.visible||(i.onBeforePicking(e),n.push(i),!(a instanceof OL)&&(this.pickScene.add(r),t.push([r,a])))}return()=>{for(let[e,n]of t)n.add(e);for(let e of n)e.onAfterPicking()}}processRender(e,t){let n=new r.Color;this._renderer.getClearColor(n);let i=this._renderer.getClearAlpha(),a=this._renderer.getRenderTarget(),o=this._renderer.autoClear,s=this.stagePickables(t);this._renderer.setClearColor(0,1),this._renderer.setRenderTarget(e),this._renderer.autoClear=!0,this._renderer.clear(!0,!0,!1),this._renderer.render(this.pickScene,this._camera),s(),this._renderer.setRenderTarget(a),this._renderer.setClearColor(n,i),this._renderer.autoClear=o}setSize(e,t){this.pickRenderTarget.setSize(e,t),this.debugRenderTarget?.setSize(e,t),this.debugBufferView&&(this.debugBufferView.canvas.width=e,this.debugBufferView.canvas.height=t,this.debugBufferView.canvasForImage.width=e,this.debugBufferView.canvasForImage.height=t)}renderDebugCanvas(){!this.debugBufferView||!this.debugRenderTarget||(this.processRender(this.debugRenderTarget),this.debugBufferView.render(this._renderer,this.debugRenderTarget))}onClickPick(e){let t=e.pointerType===`touch`?10:3,n=this.pickBatchIdAt(e.clientX,e.clientY,t),r=n>0?[n]:[];this.onPickCallback(r)}pickBatchIdAt(e,t,n=3){let i=this.element.getBoundingClientRect(),a=e-i.left,o=t-i.top,s=this._renderer.getPixelRatio(),c=this._renderer.getContext().drawingBufferWidth,l=this._renderer.getContext().drawingBufferHeight,u=Math.max(0,Math.min(Math.floor(a*s),c-1)),d=Math.max(0,Math.min(Math.floor(o*s),l-1)),f=new r.Vector2(u+.5,l-d-.5),p=l-1-d,m=Math.max(0,Math.round(n*s)),h=Math.max(0,u-m),g=Math.min(c-1,u+m),_=Math.max(0,p-m),v=Math.min(l-1,p+m),y=g-h+1,b=v-_+1;this._renderer.setScissor(h,_,y,b),this._renderer.setScissorTest(!0),this.processRender(this.pickRenderTarget,f),this.pixelBuffer.length<y*b*4&&(this.pixelBuffer=new Uint8Array(y*b*4)),this._renderer.readRenderTargetPixels(this.pickRenderTarget,h,_,y,b,this.pixelBuffer),this._renderer.setScissorTest(!1);let x=0,S=1/0;for(let e=0;e<b;e++)for(let t=0;t<y;t++){let n=(e*y+t)*4,r=(this.pixelBuffer[n]<<16)+(this.pixelBuffer[n+1]<<8)+this.pixelBuffer[n+2];if(r===0)continue;let i=h+t-u,a=_+e-p,o=i*i+a*a;o<S&&(S=o,x=r)}return x}dispose(){this.enablePick(!1),this.pickRenderTarget.dispose(),this.debugRenderTarget?.dispose(),this.debugBufferView?.dispose()}},pV=class{quad;scene;camera;sampleTarget;material;constructor(){this.material=new r.ShaderMaterial({uniforms:{tDepth:{value:null},samplePos:{value:new r.Vector2}},vertexShader:`
6411
6411
  varying vec2 vUv;
6412
6412
  void main() {
6413
6413
  vUv = uv;
@@ -6422,11 +6422,11 @@ void main() {
6422
6422
  vec4 depthColor = texture2D(tDepth, samplePos);
6423
6423
  gl_FragColor = depthColor;
6424
6424
  }
6425
- `});let e=new r.PlaneGeometry(2,2);this.quad=new r.Mesh(e,this.material),this.scene=new r.Scene,this.scene.add(this.quad),this.camera=new r.OrthographicCamera(-1,1,1,-1,0,1),this.sampleTarget=new r.WebGLRenderTarget(1,1,{format:r.RGBAFormat})}update(e,t){this.material.uniforms.tDepth.value=e,this.material.uniforms.samplePos.value.copy(t)}render(e){e.setRenderTarget(this.sampleTarget),e.render(this.scene,this.camera),e.setRenderTarget(null);let t=new Uint8Array(4);return e.readRenderTargetPixels(this.sampleTarget,0,0,1,1,t),t}dispose(){this.quad.geometry.dispose(),this.material.dispose(),this.sampleTarget.dispose()}},dV=class{depthPickPass;constructor(){this.depthPickPass=new uV}pick(e,t,n,r,i){let a=this._sampleDepthAt(e,t,n,r);return a===null||a>.99?null:this._reconstructWorldPosition(e,t,a,n,i)}_unpackRGBAToDepth(e){let t=255/256,n=[1,256,65536,16777216],r=[t/n[0],t/n[1],t/n[2],1/n[3]];return e[0]/255*r[0]+e[1]/255*r[1]+e[2]/255*r[2]+e[3]/255*r[3]}_texelCenter(e,t,n){return Math.max(0,Math.min(t-1,Math.floor(e*n)))+.5}_sampleDepthAt(e,t,n,i){if(!i)return null;let a=n.getContext().drawingBufferWidth,o=n.getContext().drawingBufferHeight,s=n.getPixelRatio(),c=this._texelCenter(e,a,s),l=this._texelCenter(t,o,s),u=new r.Vector2(c/a,1-l/o);this.depthPickPass.update(i,u);let d=this.depthPickPass.render(n);return this._unpackRGBAToDepth(d)}dispose(){this.depthPickPass.dispose()}_reconstructWorldPosition(e,t,n,i,a){let o=a.near,s=a.far,c=i.getContext().drawingBufferWidth,l=i.getContext().drawingBufferHeight,u=i.getPixelRatio(),d=new r.Vector2(this._texelCenter(e,c,u)/c*2-1,-(this._texelCenter(t,l,u)/l*2-1)),f;if(i.capabilities.logarithmicDepthBuffer){let e=2**(n/(2/Math.log2(s+1)*.5))-1+o;f=new r.Vector4(d.x,d.y,n*2-1,1);let t=f.clone().applyMatrix4(a.projectionMatrixInverse);t.w!==0&&t.divideScalar(t.w);let i=-e,c=i/t.z;return t.x*=c,t.y*=c,t.z=i,new r.Vector3(t.x,t.y,t.z).applyMatrix4(a.matrixWorld)}{f=new r.Vector4(d.x,d.y,n*2-1,1);let e=f.clone().applyMatrix4(a.projectionMatrixInverse);return e.divideScalar(e.w),new r.Vector3(e.x,e.y,e.z).applyMatrix4(a.matrixWorld)}}};function fV(e){return`attributionHtml`in e}function pV(e){return fV(e)?JSON.stringify([`html`,e.attributionHtml]):JSON.stringify([`src`,e.attribution,e.attributionUrl??null,e.logo??null,e.logoUrl??null,e.creditLayerId??null,(e.children??[]).map(e=>[e.attribution,e.minZoom??null,e.maxZoom??null])])}function mV(e){let t=new Set,n=[];for(let r of e){let e=pV(r);t.has(e)||(t.add(e),n.push(r))}return n}function hV(e){let t=new Map;for(let n of e)for(let e of _V(n))t.set(e,(t.get(e)??0)+1);return Array.from(t.entries()).sort((e,t)=>t[1]-e[1]||(e[0]<t[0]?-1:+(e[0]>t[0]))).map(([e])=>e)}function gV(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function _V(e){let t=new DOMParser().parseFromString(e,`text/html`),n=[],r=``,i=()=>{let e=r.trim();e&&n.push(e),r=``},a=e=>{e.childNodes.forEach(e=>{if(e instanceof Text){(e.textContent??``).split(`;`).forEach((e,t)=>{t>0&&i(),r+=gV(e)});return}if(e instanceof HTMLAnchorElement){r+=e.outerHTML;return}e instanceof Element&&a(e)})};return a(t.body),i(),n}function vV(e,t){return t===void 0||!(e.minZoom!==void 0&&t<e.minZoom||e.maxZoom!==void 0&&t>e.maxZoom)}function yV(e){let t;try{t=new URL(e,`http://localhost/`)}catch{return}if(t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`)return e}function bV(e,t){let n=document.createElement(`a`);return n.href=e,n.target=`_blank`,n.rel=`noopener noreferrer`,t!==void 0&&(n.textContent=t),n}function xV(e,t){SV(e,new DOMParser().parseFromString(t,`text/html`).body)}function SV(e,t,n=!0){t.childNodes.forEach(t=>{if(t instanceof Text){n?TV(e,t.textContent??``):e.appendChild(document.createTextNode(t.textContent??``));return}if(t instanceof HTMLAnchorElement){let r=t.getAttribute(`href`),i=r?yV(r):void 0;if(!i){SV(e,t,n);return}let a=bV(i);SV(a,t,!1),e.appendChild(a);return}t instanceof Element&&SV(e,t,n)})}var CV=/https?:\/\/[^\s]+/g,wV=/[.,;:!?)\]}'"]+$/;function TV(e,t){let n=0;for(let r of t.matchAll(CV)){let i=r.index??0,a=r[0],o=a.match(wV);o&&(a=a.slice(0,a.length-o[0].length)),i>n&&e.appendChild(document.createTextNode(t.slice(n,i)));let s=yV(a);s?e.appendChild(bV(s,a)):e.appendChild(document.createTextNode(a)),n=i+a.length}n<t.length&&e.appendChild(document.createTextNode(t.slice(n)))}var EV=`navara-attribution-styles`,DV=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" aria-hidden="true">
6425
+ `});let e=new r.PlaneGeometry(2,2);this.quad=new r.Mesh(e,this.material),this.scene=new r.Scene,this.scene.add(this.quad),this.camera=new r.OrthographicCamera(-1,1,1,-1,0,1),this.sampleTarget=new r.WebGLRenderTarget(1,1,{format:r.RGBAFormat})}update(e,t){this.material.uniforms.tDepth.value=e,this.material.uniforms.samplePos.value.copy(t)}render(e){e.setRenderTarget(this.sampleTarget),e.render(this.scene,this.camera),e.setRenderTarget(null);let t=new Uint8Array(4);return e.readRenderTargetPixels(this.sampleTarget,0,0,1,1,t),t}dispose(){this.quad.geometry.dispose(),this.material.dispose(),this.sampleTarget.dispose()}},mV=class{depthPickPass;constructor(){this.depthPickPass=new pV}pick(e,t,n,r,i){let a=this._sampleDepthAt(e,t,n,r);return a===null||a>.99?null:this._reconstructWorldPosition(e,t,a,n,i)}_unpackRGBAToDepth(e){let t=255/256,n=[1,256,65536,16777216],r=[t/n[0],t/n[1],t/n[2],1/n[3]];return e[0]/255*r[0]+e[1]/255*r[1]+e[2]/255*r[2]+e[3]/255*r[3]}_texelCenter(e,t,n){return Math.max(0,Math.min(t-1,Math.floor(e*n)))+.5}_sampleDepthAt(e,t,n,i){if(!i)return null;let a=n.getContext().drawingBufferWidth,o=n.getContext().drawingBufferHeight,s=n.getPixelRatio(),c=this._texelCenter(e,a,s),l=this._texelCenter(t,o,s),u=new r.Vector2(c/a,1-l/o);this.depthPickPass.update(i,u);let d=this.depthPickPass.render(n);return this._unpackRGBAToDepth(d)}dispose(){this.depthPickPass.dispose()}_reconstructWorldPosition(e,t,n,i,a){let o=a.near,s=a.far,c=i.getContext().drawingBufferWidth,l=i.getContext().drawingBufferHeight,u=i.getPixelRatio(),d=new r.Vector2(this._texelCenter(e,c,u)/c*2-1,-(this._texelCenter(t,l,u)/l*2-1)),f;if(i.capabilities.logarithmicDepthBuffer){let e=2**(n/(2/Math.log2(s+1)*.5))-1+o;f=new r.Vector4(d.x,d.y,n*2-1,1);let t=f.clone().applyMatrix4(a.projectionMatrixInverse);t.w!==0&&t.divideScalar(t.w);let i=-e,c=i/t.z;return t.x*=c,t.y*=c,t.z=i,new r.Vector3(t.x,t.y,t.z).applyMatrix4(a.matrixWorld)}{f=new r.Vector4(d.x,d.y,n*2-1,1);let e=f.clone().applyMatrix4(a.projectionMatrixInverse);return e.divideScalar(e.w),new r.Vector3(e.x,e.y,e.z).applyMatrix4(a.matrixWorld)}}};function hV(e){return`attributionHtml`in e}function gV(e){return hV(e)?JSON.stringify([`html`,e.attributionHtml]):JSON.stringify([`src`,e.attribution,e.attributionUrl??null,e.logo??null,e.logoUrl??null,e.creditLayerId??null,(e.children??[]).map(e=>[e.attribution,e.minZoom??null,e.maxZoom??null])])}function _V(e){let t=new Set,n=[];for(let r of e){let e=gV(r);t.has(e)||(t.add(e),n.push(r))}return n}function vV(e){let t=new Map;for(let n of e)for(let e of bV(n))t.set(e,(t.get(e)??0)+1);return Array.from(t.entries()).sort((e,t)=>t[1]-e[1]||(e[0]<t[0]?-1:+(e[0]>t[0]))).map(([e])=>e)}function yV(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function bV(e){let t=new DOMParser().parseFromString(e,`text/html`),n=[],r=``,i=()=>{let e=r.trim();e&&n.push(e),r=``},a=e=>{e.childNodes.forEach(e=>{if(e instanceof Text){(e.textContent??``).split(`;`).forEach((e,t)=>{t>0&&i(),r+=yV(e)});return}if(e instanceof HTMLAnchorElement){r+=e.outerHTML;return}e instanceof Element&&a(e)})};return a(t.body),i(),n}function xV(e,t){return t===void 0||!(e.minZoom!==void 0&&t<e.minZoom||e.maxZoom!==void 0&&t>e.maxZoom)}function SV(e){let t;try{t=new URL(e,`http://localhost/`)}catch{return}if(t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`)return e}function CV(e,t){let n=document.createElement(`a`);return n.href=e,n.target=`_blank`,n.rel=`noopener noreferrer`,t!==void 0&&(n.textContent=t),n}function wV(e,t){TV(e,new DOMParser().parseFromString(t,`text/html`).body)}function TV(e,t,n=!0){t.childNodes.forEach(t=>{if(t instanceof Text){n?OV(e,t.textContent??``):e.appendChild(document.createTextNode(t.textContent??``));return}if(t instanceof HTMLAnchorElement){let r=t.getAttribute(`href`),i=r?SV(r):void 0;if(!i){TV(e,t,n);return}let a=CV(i);TV(a,t,!1),e.appendChild(a);return}t instanceof Element&&TV(e,t,n)})}var EV=/https?:\/\/[^\s]+/g,DV=/[.,;:!?)\]}'"]+$/;function OV(e,t){let n=0;for(let r of t.matchAll(EV)){let i=r.index??0,a=r[0],o=a.match(DV);o&&(a=a.slice(0,a.length-o[0].length)),i>n&&e.appendChild(document.createTextNode(t.slice(n,i)));let s=SV(a);s?e.appendChild(CV(s,a)):e.appendChild(document.createTextNode(a)),n=i+a.length}n<t.length&&e.appendChild(document.createTextNode(t.slice(n)))}var kV=`navara-attribution-styles`,AV=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" aria-hidden="true">
6426
6426
  <circle cx="12" cy="12" r="10.5" stroke="currentColor" stroke-width="2" />
6427
6427
  <circle cx="12" cy="8" r="1" fill="currentColor" />
6428
6428
  <rect x="11" y="11" width="2" height="6" rx="1" fill="currentColor" />
6429
- </svg>`,OV=`
6429
+ </svg>`,jV=`
6430
6430
  .navara-attr-dock {
6431
6431
  position: fixed;
6432
6432
  right: 8px;
@@ -6569,7 +6569,7 @@ void main() {
6569
6569
  .navara-attr-card a:hover {
6570
6570
  text-decoration: underline;
6571
6571
  }
6572
- `,kV=0,AV={attribution:`Navara`,attributionUrl:`https://navara-docs.reearth.workers.dev//`},jV=class extends _o{view;items=[];styleEl;dock;card;listEl;logosEl;toggle;isOpen=!1;lastZoomLevel;hasZoomBands=!1;layerCredits=new Map;layerCleanups=[];style;position;boundKeydown;boundPreRender;constructor(e={}){super(),this.style=e.style??{},this.position=e.position??`bottom-right`,this.boundKeydown=this.handleKeydown.bind(this),this.boundPreRender=this.handlePreRender.bind(this)}displayedItems(){return[AV,...this.items]}async init(e,t){this.view=e,e.on(`preRender`,this.boundPreRender),this.apply()}add(e){this.items=mV([...this.items,...e]),this.apply()}remove(e){let t=new Set(e.map(pV));this.items=this.items.filter(e=>!t.has(pV(e))),this.apply()}clear(){this.items=[],this.apply()}apply(){let e=this.resolveCreditLayers(this.items),t=new Set(e.map(e=>e.id));t.size===this.layerCredits.size&&[...t].every(e=>this.layerCredits.has(e))||this.trackLayers(e),this.render()}resolveCreditLayers(e){let t=this.view;if(!t)return[];let n=new Set,r=[];for(let i of e){if(fV(i)||!i.creditLayerId||n.has(i.creditLayerId))continue;n.add(i.creditLayerId);let e=t.findLayerById(i.creditLayerId);e&&r.push(e)}return r}show(){this.setOpen(!0)}hide(){this.setOpen(!1)}dispose(){this.view?.off(`preRender`,this.boundPreRender),this.teardownDom(),this.items=[],this.view=void 0}setStyle(e){this.style={...this.style,...e},this.applyStyle()}applyStyle(){let e=this.dock;if(!e)return;let t=(t,n)=>{n!==void 0&&e.style.setProperty(t,n)};t(`--nvr-attr-title`,this.style.titleColor),t(`--nvr-attr-link`,this.style.linkColor),t(`--nvr-attr-bullet`,this.style.listStyleColor),t(`--nvr-attr-text`,this.style.textColor),t(`--nvr-attr-nested`,this.style.nestedTextColor),t(`--nvr-attr-bg`,this.style.backgroundColor),t(`--nvr-attr-border`,this.style.borderColor)}render(){if(!this.view)return;this.ensureDom();let e=this.displayedItems();this.hasZoomBands=e.some(e=>!fV(e)&&(e.children?.some(e=>e.minZoom!==void 0||e.maxZoom!==void 0)??!1)),this.lastZoomLevel=this.currentZoomLevel(),this.populateList(),this.populateLogos(),this.dock&&(this.dock.hidden=!1);let t=e.some(e=>!fV(e)&&!!e.logo);this.logosEl&&(this.logosEl.hidden=!t)}ensureDom(){if(!this.styleEl){let e=document.getElementById(EV);if(e instanceof HTMLStyleElement)this.styleEl=e;else{let e=document.createElement(`style`);e.id=EV,e.textContent=OV,document.head.appendChild(e),this.styleEl=e}kV+=1}if(this.dock)return;let e=document.createElement(`div`);e.className=`navara-attr-dock`,this.position===`bottom-left`&&e.classList.add(`navara-attr-dock--left`);let t=document.createElement(`div`);t.className=`navara-attr-card`,t.hidden=!this.isOpen;let n=document.createElement(`div`);n.className=`navara-attr-head`;let r=document.createElement(`h3`);r.textContent=`Attributions`;let i=document.createElement(`button`);i.className=`navara-attr-close`,i.type=`button`,i.textContent=`✕`,i.setAttribute(`aria-label`,`Close`),i.addEventListener(`click`,()=>this.setOpen(!1)),n.appendChild(r),n.appendChild(i);let a=document.createElement(`ul`);a.className=`navara-attr-list`,t.appendChild(n),t.appendChild(a);let o=document.createElement(`button`);o.className=`navara-attr-toggle`,o.type=`button`,o.innerHTML=DV,o.setAttribute(`aria-expanded`,String(this.isOpen)),o.setAttribute(`aria-label`,this.isOpen?`Hide attributions`:`Show attributions`),o.addEventListener(`click`,()=>this.setOpen()),e.appendChild(t),e.appendChild(o),document.body.appendChild(e);let s=document.createElement(`div`);s.className=`navara-attr-logoframe`,this.position===`bottom-left`&&s.classList.add(`navara-attr-logoframe--left`),document.body.appendChild(s),document.addEventListener(`keydown`,this.boundKeydown),this.dock=e,this.card=t,this.listEl=a,this.logosEl=s,this.toggle=o,this.applyStyle()}createItemShell(){let e=document.createElement(`li`);e.className=`navara-attr-item`;let t=document.createElement(`div`);t.className=`navara-attr-name`;let n=document.createElement(`span`);n.className=`navara-attr-bullet`,t.appendChild(n);let r=document.createElement(`span`);return t.appendChild(r),e.appendChild(t),{li:e,text:r}}populateList(){if(this.listEl){this.listEl.replaceChildren();for(let e of this.displayedItems()){let{li:t,text:n}=this.createItemShell();if(fV(e)){xV(n,e.attributionHtml),this.listEl.appendChild(t);continue}let r=e.attributionUrl?yV(e.attributionUrl):void 0;r?n.appendChild(bV(r,e.attribution)):n.textContent=e.attribution;let i=document.createElement(`ul`);if(i.className=`navara-attr-related`,e.children)for(let t of e.children){if(!vV(t,this.lastZoomLevel))continue;let e=document.createElement(`li`);xV(e,t.attribution),i.appendChild(e)}if(e.creditLayerId)for(let t of this.layerCreditStrings(e.creditLayerId)){let e=document.createElement(`li`);xV(e,t),i.appendChild(e)}i.childElementCount>0&&t.appendChild(i),this.listEl.appendChild(t)}}}layerCreditStrings(e){let t=this.layerCredits.get(e);if(!t)return[];let n=[];for(let e of t.visible){let r=t.credits.get(e);r&&n.push(r)}return hV(n)}requestRender(){this.dock&&this.isOpen&&this.populateList()}populateLogos(){if(this.logosEl){this.logosEl.replaceChildren();for(let e of this.displayedItems()){if(fV(e)||!e.logo)continue;let t=document.createElement(`img`);t.src=e.logo,t.alt=e.attribution,t.className=`navara-attr-logo`,t.draggable=!1;let n=e.logoUrl?yV(e.logoUrl):void 0,r=t;n&&(r=bV(n),r.appendChild(t)),this.logosEl.appendChild(r)}}}setOpen(e){this.isOpen=e??!this.isOpen,!(!this.card||!this.toggle)&&(this.card.hidden=!this.isOpen,this.toggle.setAttribute(`aria-expanded`,String(this.isOpen)),this.toggle.setAttribute(`aria-label`,this.isOpen?`Hide attributions`:`Show attributions`),this.isOpen&&(this.hasZoomBands&&(this.lastZoomLevel=this.currentZoomLevel()),this.populateList()))}handleKeydown(e){e.key===`Escape`&&this.isOpen&&this.setOpen(!1)}handlePreRender(){if(!this.dock||!this.hasZoomBands||!this.isOpen)return;let e=this.currentZoomLevel();e!==this.lastZoomLevel&&(this.lastZoomLevel=e,this.requestRender())}currentZoomLevel(){let e=this.view?.camera.zoom;return e===void 0?void 0:Math.floor(e)}teardownDom(){for(let e of this.layerCleanups)e();this.layerCleanups=[],this.dock&&(document.removeEventListener(`keydown`,this.boundKeydown),this.dock.remove()),this.logosEl?.remove(),this.styleEl&&(kV=Math.max(0,kV-1),kV===0&&this.styleEl.remove()),this.dock=void 0,this.card=void 0,this.listEl=void 0,this.logosEl=void 0,this.toggle=void 0,this.styleEl=void 0,this.isOpen=!1,this.layerCredits.clear()}trackLayers(e){for(let e of this.layerCleanups)e();this.layerCleanups=[],this.layerCredits.clear();for(let t of e){let e={credits:new Map,visible:new Set};this.layerCredits.set(t.id,e);let n=({featureSetId:t,credit:n})=>{n&&(e.credits.set(t,n),e.visible.add(t),this.requestRender())},r=({featureSetId:t})=>{e.credits.has(t)&&(e.credits.delete(t),e.visible.delete(t),this.requestRender())},i=({featureSetId:t,visible:n})=>{e.credits.has(t)&&(n?e.visible.add(t):e.visible.delete(t),this.requestRender())},a=()=>{},o=()=>{a(),this.layerCleanups=this.layerCleanups.filter(e=>e!==a),this.layerCredits.delete(t.id),this.requestRender()};a=()=>{t.off(`featureCreated`,n),t.off(`featureRemoved`,r),t.off(`featureVisibilityChanged`,i),t.off(`deleted`,o)},t.on(`featureCreated`,n),t.on(`featureRemoved`,r),t.on(`featureVisibilityChanged`,i),t.on(`deleted`,o),this.layerCleanups.push(a)}}},MV=new r.Color(16777215),NV=class extends r.Object3D{mainLight;cascadedLights;direction=new r.Vector3(-1,-1,-1);constructor(e,t){super();let n=new r.DirectionalLight(e,t);n.castShadow=!0,this.mainLight=n,this.cascadedLights=[n],this.add(n),this.add(n.target)}setCount(e){e=Math.max(1,e);let t=this.cascadedLights.length;if(e===t)return this;if(e>t){let n=this.mainLight;for(let r=t;r<e;++r){let e=n.clone();e.color.copy(MV),this.add(e),this.add(e.target),this.cascadedLights[r]=e}}else for(let n=e;n<t;++n){let e=this.cascadedLights[n];e.dispose(),this.remove(e.target),this.remove(e)}return this.cascadedLights.length=e,this}dispose(){for(let e=0;e<this.cascadedLights.length;++e)this.cascadedLights[e].dispose()}copy(e,t){super.copy(e,!1),this.cascadedLights.length=0,this.clear();for(let t of e.cascadedLights){let e=t.clone();this.add(e),this.add(e.target),this.cascadedLights.push(e)}return this}},PV=`Invariant failed`;function FV(e,t){if(!e)throw Error(PV)}var IV=class e{near=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];far=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];constructor(e,t){e!=null&&t!=null&&this.setFromCamera(e,t)}clone(){return new e().copy(this)}copy(e){for(let t=0;t<4;++t)this.near[t].copy(e.near[t]),this.far[t].copy(e.far[t]);return this}setFromCamera(e,t){let n=e.isOrthographicCamera===!0,r=e.projectionMatrixInverse;this.near[0].set(1,1,-1),this.near[1].set(1,-1,-1),this.near[2].set(-1,-1,-1),this.near[3].set(-1,1,-1);for(let e=0;e<4;++e)this.near[e].applyMatrix4(r);this.far[0].set(1,1,1),this.far[1].set(1,-1,1),this.far[2].set(-1,-1,1),this.far[3].set(-1,1,1);for(let e=0;e<4;++e){let i=this.far[e];i.applyMatrix4(r);let a=Math.abs(i.z);n?i.z*=Math.min(t/a,1):i.multiplyScalar(Math.min(t/a,1))}return this}split(t,n=[]){for(let r=0;r<t.length;++r){let i=n[r]??=new e;if(r===0)for(let e=0;e<4;++e)i.near[e].copy(this.near[e]);else for(let e=0;e<4;++e)i.near[e].lerpVectors(this.near[e],this.far[e],t[r-1]);if(r===t.length-1)for(let e=0;e<4;++e)i.far[e].copy(this.far[e]);else for(let e=0;e<4;++e)i.far[e].lerpVectors(this.near[e],this.far[e],t[r])}return n.length=t.length,n}applyMatrix4(e){for(let t=0;t<4;++t)this.near[t].applyMatrix4(e),this.far[t].applyMatrix4(e);return this}},LV=`// Based on the following work:
6572
+ `,MV=0,NV={attribution:`Navara`,attributionUrl:`https://navara.world/`},PV=class extends _o{view;items=[];styleEl;dock;card;listEl;logosEl;toggle;isOpen=!1;lastZoomLevel;hasZoomBands=!1;layerCredits=new Map;layerCleanups=[];style;position;boundKeydown;boundPreRender;constructor(e={}){super(),this.style=e.style??{},this.position=e.position??`bottom-right`,this.boundKeydown=this.handleKeydown.bind(this),this.boundPreRender=this.handlePreRender.bind(this)}displayedItems(){return[NV,...this.items]}async init(e,t){this.view=e,e.on(`preRender`,this.boundPreRender),this.apply()}add(e){this.items=_V([...this.items,...e]),this.apply()}remove(e){let t=new Set(e.map(gV));this.items=this.items.filter(e=>!t.has(gV(e))),this.apply()}clear(){this.items=[],this.apply()}apply(){let e=this.resolveCreditLayers(this.items),t=new Set(e.map(e=>e.id));t.size===this.layerCredits.size&&[...t].every(e=>this.layerCredits.has(e))||this.trackLayers(e),this.render()}resolveCreditLayers(e){let t=this.view;if(!t)return[];let n=new Set,r=[];for(let i of e){if(hV(i)||!i.creditLayerId||n.has(i.creditLayerId))continue;n.add(i.creditLayerId);let e=t.findLayerById(i.creditLayerId);e&&r.push(e)}return r}show(){this.setOpen(!0)}hide(){this.setOpen(!1)}dispose(){this.view?.off(`preRender`,this.boundPreRender),this.teardownDom(),this.items=[],this.view=void 0}setStyle(e){this.style={...this.style,...e},this.applyStyle()}applyStyle(){let e=this.dock;if(!e)return;let t=(t,n)=>{n!==void 0&&e.style.setProperty(t,n)};t(`--nvr-attr-title`,this.style.titleColor),t(`--nvr-attr-link`,this.style.linkColor),t(`--nvr-attr-bullet`,this.style.listStyleColor),t(`--nvr-attr-text`,this.style.textColor),t(`--nvr-attr-nested`,this.style.nestedTextColor),t(`--nvr-attr-bg`,this.style.backgroundColor),t(`--nvr-attr-border`,this.style.borderColor)}render(){if(!this.view)return;this.ensureDom();let e=this.displayedItems();this.hasZoomBands=e.some(e=>!hV(e)&&(e.children?.some(e=>e.minZoom!==void 0||e.maxZoom!==void 0)??!1)),this.lastZoomLevel=this.currentZoomLevel(),this.populateList(),this.populateLogos(),this.dock&&(this.dock.hidden=!1);let t=e.some(e=>!hV(e)&&!!e.logo);this.logosEl&&(this.logosEl.hidden=!t)}ensureDom(){if(!this.styleEl){let e=document.getElementById(kV);if(e instanceof HTMLStyleElement)this.styleEl=e;else{let e=document.createElement(`style`);e.id=kV,e.textContent=jV,document.head.appendChild(e),this.styleEl=e}MV+=1}if(this.dock)return;let e=document.createElement(`div`);e.className=`navara-attr-dock`,this.position===`bottom-left`&&e.classList.add(`navara-attr-dock--left`);let t=document.createElement(`div`);t.className=`navara-attr-card`,t.hidden=!this.isOpen;let n=document.createElement(`div`);n.className=`navara-attr-head`;let r=document.createElement(`h3`);r.textContent=`Attributions`;let i=document.createElement(`button`);i.className=`navara-attr-close`,i.type=`button`,i.textContent=`✕`,i.setAttribute(`aria-label`,`Close`),i.addEventListener(`click`,()=>this.setOpen(!1)),n.appendChild(r),n.appendChild(i);let a=document.createElement(`ul`);a.className=`navara-attr-list`,t.appendChild(n),t.appendChild(a);let o=document.createElement(`button`);o.className=`navara-attr-toggle`,o.type=`button`,o.innerHTML=AV,o.setAttribute(`aria-expanded`,String(this.isOpen)),o.setAttribute(`aria-label`,this.isOpen?`Hide attributions`:`Show attributions`),o.addEventListener(`click`,()=>this.setOpen()),e.appendChild(t),e.appendChild(o),document.body.appendChild(e);let s=document.createElement(`div`);s.className=`navara-attr-logoframe`,this.position===`bottom-left`&&s.classList.add(`navara-attr-logoframe--left`),document.body.appendChild(s),document.addEventListener(`keydown`,this.boundKeydown),this.dock=e,this.card=t,this.listEl=a,this.logosEl=s,this.toggle=o,this.applyStyle()}createItemShell(){let e=document.createElement(`li`);e.className=`navara-attr-item`;let t=document.createElement(`div`);t.className=`navara-attr-name`;let n=document.createElement(`span`);n.className=`navara-attr-bullet`,t.appendChild(n);let r=document.createElement(`span`);return t.appendChild(r),e.appendChild(t),{li:e,text:r}}populateList(){if(this.listEl){this.listEl.replaceChildren();for(let e of this.displayedItems()){let{li:t,text:n}=this.createItemShell();if(hV(e)){wV(n,e.attributionHtml),this.listEl.appendChild(t);continue}let r=e.attributionUrl?SV(e.attributionUrl):void 0;r?n.appendChild(CV(r,e.attribution)):n.textContent=e.attribution;let i=document.createElement(`ul`);if(i.className=`navara-attr-related`,e.children)for(let t of e.children){if(!xV(t,this.lastZoomLevel))continue;let e=document.createElement(`li`);wV(e,t.attribution),i.appendChild(e)}if(e.creditLayerId)for(let t of this.layerCreditStrings(e.creditLayerId)){let e=document.createElement(`li`);wV(e,t),i.appendChild(e)}i.childElementCount>0&&t.appendChild(i),this.listEl.appendChild(t)}}}layerCreditStrings(e){let t=this.layerCredits.get(e);if(!t)return[];let n=[];for(let e of t.visible){let r=t.credits.get(e);r&&n.push(r)}return vV(n)}requestRender(){this.dock&&this.isOpen&&this.populateList()}populateLogos(){if(this.logosEl){this.logosEl.replaceChildren();for(let e of this.displayedItems()){if(hV(e)||!e.logo)continue;let t=document.createElement(`img`);t.src=e.logo,t.alt=e.attribution,t.className=`navara-attr-logo`,t.draggable=!1;let n=e.logoUrl?SV(e.logoUrl):void 0,r=t;n&&(r=CV(n),r.appendChild(t)),this.logosEl.appendChild(r)}}}setOpen(e){this.isOpen=e??!this.isOpen,!(!this.card||!this.toggle)&&(this.card.hidden=!this.isOpen,this.toggle.setAttribute(`aria-expanded`,String(this.isOpen)),this.toggle.setAttribute(`aria-label`,this.isOpen?`Hide attributions`:`Show attributions`),this.isOpen&&(this.hasZoomBands&&(this.lastZoomLevel=this.currentZoomLevel()),this.populateList()))}handleKeydown(e){e.key===`Escape`&&this.isOpen&&this.setOpen(!1)}handlePreRender(){if(!this.dock||!this.hasZoomBands||!this.isOpen)return;let e=this.currentZoomLevel();e!==this.lastZoomLevel&&(this.lastZoomLevel=e,this.requestRender())}currentZoomLevel(){let e=this.view?.camera.zoom;return e===void 0?void 0:Math.floor(e)}teardownDom(){for(let e of this.layerCleanups)e();this.layerCleanups=[],this.dock&&(document.removeEventListener(`keydown`,this.boundKeydown),this.dock.remove()),this.logosEl?.remove(),this.styleEl&&(MV=Math.max(0,MV-1),MV===0&&this.styleEl.remove()),this.dock=void 0,this.card=void 0,this.listEl=void 0,this.logosEl=void 0,this.toggle=void 0,this.styleEl=void 0,this.isOpen=!1,this.layerCredits.clear()}trackLayers(e){for(let e of this.layerCleanups)e();this.layerCleanups=[],this.layerCredits.clear();for(let t of e){let e={credits:new Map,visible:new Set};this.layerCredits.set(t.id,e);let n=({featureSetId:t,credit:n})=>{n&&(e.credits.set(t,n),e.visible.add(t),this.requestRender())},r=({featureSetId:t})=>{e.credits.has(t)&&(e.credits.delete(t),e.visible.delete(t),this.requestRender())},i=({featureSetId:t,visible:n})=>{e.credits.has(t)&&(n?e.visible.add(t):e.visible.delete(t),this.requestRender())},a=()=>{},o=()=>{a(),this.layerCleanups=this.layerCleanups.filter(e=>e!==a),this.layerCredits.delete(t.id),this.requestRender()};a=()=>{t.off(`featureCreated`,n),t.off(`featureRemoved`,r),t.off(`featureVisibilityChanged`,i),t.off(`deleted`,o)},t.on(`featureCreated`,n),t.on(`featureRemoved`,r),t.on(`featureVisibilityChanged`,i),t.on(`deleted`,o),this.layerCleanups.push(a)}}},FV=new r.Color(16777215),IV=class extends r.Object3D{mainLight;cascadedLights;direction=new r.Vector3(-1,-1,-1);constructor(e,t){super();let n=new r.DirectionalLight(e,t);n.castShadow=!0,this.mainLight=n,this.cascadedLights=[n],this.add(n),this.add(n.target)}setCount(e){e=Math.max(1,e);let t=this.cascadedLights.length;if(e===t)return this;if(e>t){let n=this.mainLight;for(let r=t;r<e;++r){let e=n.clone();e.color.copy(FV),this.add(e),this.add(e.target),this.cascadedLights[r]=e}}else for(let n=e;n<t;++n){let e=this.cascadedLights[n];e.dispose(),this.remove(e.target),this.remove(e)}return this.cascadedLights.length=e,this}dispose(){for(let e=0;e<this.cascadedLights.length;++e)this.cascadedLights[e].dispose()}copy(e,t){super.copy(e,!1),this.cascadedLights.length=0,this.clear();for(let t of e.cascadedLights){let e=t.clone();this.add(e),this.add(e.target),this.cascadedLights.push(e)}return this}},LV=`Invariant failed`;function RV(e,t){if(!e)throw Error(LV)}var zV=class e{near=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];far=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];constructor(e,t){e!=null&&t!=null&&this.setFromCamera(e,t)}clone(){return new e().copy(this)}copy(e){for(let t=0;t<4;++t)this.near[t].copy(e.near[t]),this.far[t].copy(e.far[t]);return this}setFromCamera(e,t){let n=e.isOrthographicCamera===!0,r=e.projectionMatrixInverse;this.near[0].set(1,1,-1),this.near[1].set(1,-1,-1),this.near[2].set(-1,-1,-1),this.near[3].set(-1,1,-1);for(let e=0;e<4;++e)this.near[e].applyMatrix4(r);this.far[0].set(1,1,1),this.far[1].set(1,-1,1),this.far[2].set(-1,-1,1),this.far[3].set(-1,1,1);for(let e=0;e<4;++e){let i=this.far[e];i.applyMatrix4(r);let a=Math.abs(i.z);n?i.z*=Math.min(t/a,1):i.multiplyScalar(Math.min(t/a,1))}return this}split(t,n=[]){for(let r=0;r<t.length;++r){let i=n[r]??=new e;if(r===0)for(let e=0;e<4;++e)i.near[e].copy(this.near[e]);else for(let e=0;e<4;++e)i.near[e].lerpVectors(this.near[e],this.far[e],t[r-1]);if(r===t.length-1)for(let e=0;e<4;++e)i.far[e].copy(this.far[e]);else for(let e=0;e<4;++e)i.far[e].lerpVectors(this.near[e],this.far[e],t[r])}return n.length=t.length,n}applyMatrix4(e){for(let t=0;t<4;++t)this.near[t].applyMatrix4(e),this.far[t].applyMatrix4(e);return this}},BV=`// Based on the following work:
6573
6573
  // https://github.com/StrandedKitty/three-csm/tree/master/src
6574
6574
  // https://github.com/mrdoob/three.js/tree/r169/examples/jsm/csm
6575
6575
 
@@ -6681,7 +6681,7 @@ void cascadedFadedLights() {
6681
6681
  }
6682
6682
  #pragma unroll_loop_end
6683
6683
  }
6684
- `,RV=`// Based on the following work:
6684
+ `,VV=`// Based on the following work:
6685
6685
  // https://github.com/StrandedKitty/three-csm/tree/master/src
6686
6686
  // https://github.com/mrdoob/three.js/tree/r169/examples/jsm/csm
6687
6687
 
@@ -6773,7 +6773,7 @@ void cascadedLights() {
6773
6773
  }
6774
6774
  #pragma unroll_loop_end
6775
6775
  }
6776
- `,zV=`// Based on the following work:
6776
+ `,HV=`// Based on the following work:
6777
6777
  // https://github.com/StrandedKitty/three-csm/tree/master/src
6778
6778
  // https://github.com/mrdoob/three.js/tree/r169/examples/jsm/csm
6779
6779
 
@@ -6808,7 +6808,7 @@ void cascadedLightsWithoutShadows() {
6808
6808
  }
6809
6809
  #pragma unroll_loop_end
6810
6810
  }
6811
- `,BV=`// Default shader.
6811
+ `,UV=`// Default shader.
6812
6812
  // See: https://github.com/mrdoob/three.js/blob/r169/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js#L136
6813
6813
 
6814
6814
  void defaultLights() {
@@ -6851,7 +6851,7 @@ void defaultLights() {
6851
6851
  }
6852
6852
  #pragma unroll_loop_end
6853
6853
  }
6854
- `,VV=`void nonShadowCastingLights() {
6854
+ `,WV=`void nonShadowCastingLights() {
6855
6855
  #pragma unroll_loop_start
6856
6856
  for (int i = NUM_DIR_LIGHT_SHADOWS; i < NUM_DIR_LIGHTS; i++) {
6857
6857
  directionalLight = directionalLights[i];
@@ -6869,7 +6869,7 @@ void defaultLights() {
6869
6869
  }
6870
6870
  #pragma unroll_loop_end
6871
6871
  }
6872
- `,HV=`
6872
+ `,GV=`
6873
6873
  #include <lights_pars_begin>
6874
6874
 
6875
6875
  #ifdef CSM
@@ -6877,7 +6877,7 @@ void defaultLights() {
6877
6877
  uniform float csmNear;
6878
6878
  uniform float csmFar;
6879
6879
  #endif // CSM
6880
- `;function UV(e){return e.replace(/^\s*void\s+\w+\s*\(\s*\)\s*/m,``)}var WV=`
6880
+ `;function KV(e){return e.replace(/^\s*void\s+\w+\s*\(\s*\)\s*/m,``)}var qV=`
6881
6881
  #if NUM_DIR_LIGHTS > 0 && defined(RE_Direct)
6882
6882
  DirectionalLight directionalLight;
6883
6883
  #if defined(USE_SHADOWMAP) && NUM_DIR_LIGHT_SHADOWS > 0
@@ -6887,22 +6887,22 @@ void defaultLights() {
6887
6887
  #ifdef CSM
6888
6888
  #ifdef USE_SHADOWMAP
6889
6889
  #ifdef CSM_FADE
6890
- ${UV(LV)}
6890
+ ${KV(BV)}
6891
6891
  #else
6892
- ${UV(RV)}
6892
+ ${KV(VV)}
6893
6893
  #endif // CSM_FADE
6894
6894
  #elif NUM_DIR_LIGHT_SHADOWS > 0
6895
- ${UV(zV)}
6895
+ ${KV(HV)}
6896
6896
  #endif // USE_SHADOWMAP
6897
6897
 
6898
6898
  #if NUM_DIR_LIGHTS > NUM_DIR_LIGHT_SHADOWS
6899
- ${UV(VV)}
6899
+ ${KV(WV)}
6900
6900
  #endif
6901
6901
  #else
6902
- ${UV(BV)}
6902
+ ${KV(UV)}
6903
6903
  #endif // CSM
6904
6904
  #endif // NUM_DIR_LIGHTS > 0 && defined(RE_Direct)
6905
- `;function GV({source:e,startLine:t,endLine:n,replacement:r}){let i=`\n${t}\n`,a=e.indexOf(i);if(a<0)return e;let o=`\n${n}\n`,s=e.indexOf(o,a+i.length);return s<0?e:e.slice(0,a+1)+r+e.slice(s+o.length-1)}function KV(e){return e.replace(`#include <lights_pars_begin>`,HV).replace(`#include <lights_fragment_begin>`,GV({source:r.ShaderChunk.lights_fragment_begin,startLine:`#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )`,endLine:`#endif`,replacement:WV}))}var qV=`
6905
+ `;function JV({source:e,startLine:t,endLine:n,replacement:r}){let i=`\n${t}\n`,a=e.indexOf(i);if(a<0)return e;let o=`\n${n}\n`,s=e.indexOf(o,a+i.length);return s<0?e:e.slice(0,a+1)+r+e.slice(s+o.length-1)}function YV(e){return e.replace(`#include <lights_pars_begin>`,GV).replace(`#include <lights_fragment_begin>`,JV({source:r.ShaderChunk.lights_fragment_begin,startLine:`#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )`,endLine:`#endif`,replacement:qV}))}var XV=`
6906
6906
  #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
6907
6907
  // Per-cascade shadow matrices composed with the render camera's world matrix
6908
6908
  // on the CPU in f64 (shadow.matrix * camera.matrixWorld). Multiplied with the
@@ -6919,13 +6919,13 @@ void defaultLights() {
6919
6919
  #endif
6920
6920
  uniform mat4 nvrCsmShadowMatrixView[ CSM_CASCADE_COUNT ];
6921
6921
  #endif
6922
- `;function JV(e,t,n){if(!e.includes(t))throw Error(`Failed to replace "${t}" in shader code. The pattern was not found.`);return e.replace(t,n)}function YV(e,t){if(e.defines?.USE_SHADOWMAP_DEPTH||!e.vertexShader.includes(`#include <shadowmap_vertex>`))return;e.uniforms.nvrCsmShadowMatrixView=t;let n=JV(r.ShaderChunk.shadowmap_vertex,`shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );`,`#if UNROLLED_LOOP_INDEX < CSM_CASCADE_COUNT
6922
+ `;function ZV(e,t,n){if(!e.includes(t))throw Error(`Failed to replace "${t}" in shader code. The pattern was not found.`);return e.replace(t,n)}function QV(e,t){if(e.defines?.USE_SHADOWMAP_DEPTH||!e.vertexShader.includes(`#include <shadowmap_vertex>`))return;e.uniforms.nvrCsmShadowMatrixView=t;let n=ZV(r.ShaderChunk.shadowmap_vertex,`shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );`,`#if UNROLLED_LOOP_INDEX < CSM_CASCADE_COUNT
6923
6923
  shadowWorldPosition = vec4( mvPosition.xyz + ( viewMatrix * vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0.0 ) ).xyz, 1.0 );
6924
6924
  #else
6925
6925
  shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
6926
- #endif`);n=JV(n,`vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;`,`#if UNROLLED_LOOP_INDEX < CSM_CASCADE_COUNT
6926
+ #endif`);n=ZV(n,`vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;`,`#if UNROLLED_LOOP_INDEX < CSM_CASCADE_COUNT
6927
6927
  vDirectionalShadowCoord[ i ] = nvrCsmShadowMatrixView[ i ] * shadowWorldPosition;
6928
6928
  #else
6929
6929
  vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
6930
- #endif`),e.vertexShader=JV(JV(e.vertexShader,`#include <shadowmap_pars_vertex>`,`#include <shadowmap_pars_vertex>\n${qV}`),`#include <shadowmap_vertex>`,n)}function XV(e,t,n){n.length=e.length;for(let i=0;i<e.length;i++)(n[i]??(n[i]=new r.Matrix4)).multiplyMatrices(e[i].shadow.matrix,t)}var ZV=class{map=new Map;setup(e,t){if(this.map.has(e))return e;e.userData.defines??={},e.userData.defines.CSM=1,e.userData.defines.CSM_CASCADE_COUNT=t.cascadeCount,t.fade&&(e.userData.defines.CSM_FADE=1);let n={};this.map.set(e,n);let r=(e,r)=>{n.parameters=e,t.captureRenderer(r);let i=t.cascades,a=t.mainCamera.near,o=Math.min(t.mainCamera.far,t.far),s=e.uniforms;s.csmCascades={value:i},s.csmNear={value:a},s.csmFar={value:o},e.fragmentShader=KV(e.fragmentShader),YV(e,t.shadowMatricesViewUniform)},i=e.onBeforeCompile.bind(e),a=e.customProgramCacheKey.bind(e);Object.prototype.hasOwnProperty.call(e,`hasOwnProperty`)&&(n.originalHandler=i),e.customProgramCacheKey=()=>i.toString()+a(),e.onBeforeCompile=(...t)=>{let[n]=t;n.defines??={},Object.assign(n.defines,e.userData.defines),i.apply(e,t),r(...t)};let o=()=>{this.map.delete(e),e.removeEventListener(`dispose`,o)};return e.addEventListener(`dispose`,o),e}update(e){let t=e.cascadeCount,n=e.fade,r=e.cascades,i=e.mainCamera.near,a=Math.min(e.mainCamera.far,e.far);for(let[e,o]of this.map.entries()){let s=e.userData.defines;if(s!=null){let r=!1;s.CSM_FADE!=null!==n&&(n?s.CSM_FADE=1:delete s.CSM_FADE,r=!0),s.CSM_CASCADE_COUNT!==t&&(s.CSM_CASCADE_COUNT=t,r=!0),r&&(e.needsUpdate=!0)}let c=o.parameters?.uniforms;c!=null&&(c.csmCascades.value=r,c.csmNear.value=i,c.csmFar.value=a)}}rollback(e){let t=this.map.get(e);return t==null?e:this.rollbackToState(e,t)}rollbackToState(e,{parameters:t,originalHandler:n}){return t!=null&&(delete t.uniforms.csmCascades,delete t.uniforms.csmNear,delete t.uniforms.csmFar,delete t.uniforms.nvrCsmShadowMatrixView),n==null?delete e.onBeforeCompile:e.onBeforeCompile=n,e.userData.defines!=null&&(delete e.userData.defines.CSM,delete e.userData.defines.CSM_CASCADE_COUNT,delete e.userData.defines.CSM_FADE),e.needsUpdate=!0,this.map.delete(e),e}dispose(){for(let[e,t]of this.map)this.rollbackToState(e,t);this.map.clear()}};Math.PI/180,180/Math.PI;function QV(e,t,n){return(1-n)*e+n*t}var $V={uniform:(e,t,n,r,i=[])=>{for(let r=0;r<e;++r)i[r]=(t+(n-t)*(r+1)/e)/n;return i.length=e,i},logarithmic:(e,t,n,r,i=[])=>{for(let r=0;r<e;++r)i[r]=t*(n/t)**((r+1)/e)/n;return i.length=e,i},practical:(e,t,n,r=.5,i=[])=>{for(let a=0;a<e;++a){let o=(t+(n-t)*(a+1)/e)/n,s=t*(n/t)**((a+1)/e)/n;i[a]=QV(o,s,r)}return i.length=e,i}};function eH(e,t,n,r,i,a=[]){return $V[e](t,n,r,i,a)}var tH=new r.Vector3,nH=new r.Vector3,rH=new r.Matrix4,iH=new r.Matrix4,aH=new IV,oH=new r.Box3,sH={cascadeCount:4,mapSize:2048,far:5e3,mode:`practical`,lambda:.5,margin:200,fade:!0,disableLastCascadeCutoff:!1},cH=class{mainCamera;needsUpdateFrusta=!0;directionalLights=new NV;materialStates=new ZV;mainFrustum=new IV;cascadedFrusta=[];splits=[];cascades=[];_far;_mode;_lambda;_margin;_fade;_disableLastCascadeCutoff;_shadowMatricesView=[];_shadowMatricesViewFrame=-1;_renderer=null;shadowMatricesViewUniform;constructor(e,t){this.mainCamera=e;let n=()=>(this.refreshShadowMatricesView(),this._shadowMatricesView);this.shadowMatricesViewUniform={get value(){return n()}};let{cascadeCount:r,mapSize:i,far:a,mode:o,lambda:s,margin:c,fade:l,disableLastCascadeCutoff:u}={...sH,...t};this._far=a,this._mode=o,this._lambda=s,this._margin=c,this._fade=l,this._disableLastCascadeCutoff=u,this.cascadeCount=r,this.mapSize=i}dispose(){this.materialStates.dispose(),this.directionalLights.dispose()}setupMaterial(e){return this.materialStates.setup(e,this)}captureRenderer(e){this._renderer??=e}refreshShadowMatricesView(){let e=this._renderer?.info.render.frame??-1;(e===-1||e!==this._shadowMatricesViewFrame)&&(this._shadowMatricesViewFrame=e,XV(this.directionalLights.cascadedLights,this.mainCamera.matrixWorld,this._shadowMatricesView))}rollbackMaterial(e){return this.materialStates.rollback(e)}setupMaterials(e){for(let t=0;t<e.length;++t)this.materialStates.setup(e[t],this);return()=>{for(let t=0;t<e.length;++t)this.materialStates.rollback(e[t])}}updateCascades(){let e=this.cascadeCount,t=this.splits;eH(this.mode,e,this.mainCamera.near,Math.min(this.mainCamera.far,this.far),this.lambda,t),this.mainFrustum.setFromCamera(this.mainCamera,this.far),this.mainFrustum.split(t,this.cascadedFrusta);let n=this.cascades;for(let i=0;i<e;++i)(n[i]??(n[i]=new r.Vector2)).set(t[i-1]??0,t[i]??0);this.disableLastCascadeCutoff&&(n[e-1].y=1/0),n.length=e}getFrustumRadius(e){let t=e.near,n=e.far,r=Math.max(n[0].distanceTo(n[2]),n[0].distanceTo(t[2]));if(this.fade){let e=this.mainCamera,t=e.near,i=Math.min(e.far,this.far),a=n[0].z/(i-t);r+=.25*a**2*(i-t)}return r*.5}updateShadowBounds(){let e=this.cascadedFrusta,t=this.directionalLights.cascadedLights;FV(e.length===t.length);for(let n=0;n<e.length;++n){let e=this.getFrustumRadius(this.cascadedFrusta[n]),r=t[n].shadow.camera;r.left=-e,r.right=e,r.top=e,r.bottom=-e,r.near=0,r.far=e*2+this.margin,r.updateProjectionMatrix()}}updateFrusta(){this.updateCascades(),this.updateShadowBounds(),this.materialStates.update(this)}update(){this.needsUpdateFrusta&&(this.needsUpdateFrusta=!1,this.updateFrusta());let e=this.directionalLights,t=tH.copy(e.direction).normalize(),n=rH.lookAt(new r.Vector3,t,r.Object3D.DEFAULT_UP),i=iH.multiplyMatrices(iH.copy(n).invert(),this.mainCamera.matrixWorld),a=this.margin,o=this.mapSize,s=this.cascadedFrusta,c=e.cascadedLights;for(let e=0;e<s.length;++e){let{near:r,far:l}=aH.copy(s[e]).applyMatrix4(i),u=oH.makeEmpty();for(let e=0;e<4;e++)u.expandByPoint(r[e]),u.expandByPoint(l[e]);let d=u.getCenter(nH);d.z=u.max.z+a;let f=c[e],{left:p,right:m,top:h,bottom:g}=f.shadow.camera,_=(m-p)/o,v=(h-g)/o;d.x=Math.round(d.x/_)*_,d.y=Math.round(d.y/v)*v,d.applyMatrix4(n),f.position.copy(d),f.target.position.copy(d),f.target.position.add(t)}}get cascadeCount(){return this.directionalLights.cascadedLights.length}set cascadeCount(e){e!==this.cascadeCount&&(this.directionalLights.setCount(e),this.needsUpdateFrusta=!0)}get mapSize(){return this.directionalLights.mainLight.shadow.mapSize.width}set mapSize(e){if(e!==this.mapSize){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n){let r=t[n].shadow;r.mapSize.width=e,r.mapSize.height=e,r.map!=null&&(r.map.dispose(),r.map=null)}}}get far(){return this._far}set far(e){e!==this._far&&(this._far=e,this.needsUpdateFrusta=!0)}get mode(){return this._mode}set mode(e){e!==this._mode&&(this._mode=e,this.needsUpdateFrusta=!0)}get lambda(){return this._lambda}set lambda(e){e!==this._lambda&&(this._lambda=e,this.needsUpdateFrusta=!0)}get margin(){return this._margin}set margin(e){e!==this._margin&&(this._margin=e,this.needsUpdateFrusta=!0)}get fade(){return this._fade}set fade(e){e!==this._fade&&(this._fade=e,this.needsUpdateFrusta=!0)}get disableLastCascadeCutoff(){return this._disableLastCascadeCutoff}set disableLastCascadeCutoff(e){e!==this._disableLastCascadeCutoff&&(this._disableLastCascadeCutoff=e,this.needsUpdateFrusta=!0)}get intensity(){return this.directionalLights.mainLight.intensity}set intensity(e){if(e!==this.intensity){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].intensity=e}}get shadowIntensity(){return this.directionalLights.mainLight.shadow.intensity}set shadowIntensity(e){if(e!==this.shadowIntensity){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.intensity=e}}get color(){return this.directionalLights.mainLight.color}set color(e){e!==this.color&&this.directionalLights.mainLight.color.copy(e)}get bias(){return this.directionalLights.mainLight.shadow.bias}set bias(e){if(e!==this.bias){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.bias=e}}get normalBias(){return this.directionalLights.mainLight.shadow.normalBias}set normalBias(e){if(e!==this.normalBias){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.normalBias=e}}get radius(){return this.directionalLights.mainLight.shadow.radius}set radius(e){if(e!==this.radius){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.radius=e}}get blurSamples(){return this.directionalLights.mainLight.shadow.blurSamples}set blurSamples(e){if(e!==this.blurSamples){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.blurSamples=e}}},lH=class extends r.Group{csm;displayFrustum=!0;displayPlanes=!0;displayShadowBounds=!0;frustumLines;cascadeLines=[];cascadePlanes=[];shadowLines=[];constructor(e){super(),this.csm=e;let t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),i=new r.BufferGeometry;i.setIndex(new r.BufferAttribute(t,1)),i.setAttribute(`position`,new r.BufferAttribute(n,3,!1));let a=new r.LineSegments(i,new r.LineBasicMaterial);this.add(a),this.frustumLines=a}updateVisibility(){let e=this.displayFrustum,t=this.displayPlanes,n=this.displayShadowBounds,r=this.frustumLines,i=this.cascadeLines,a=this.cascadePlanes,o=this.shadowLines;for(let r=0,s=i.length;r<s;r++){let s=i[r],c=a[r],l=o[r];s.visible=e,c.visible=e&&t,l.visible=n}r.visible=e}update(){let e=this.csm,t=e.mainCamera,n=e.cascadeCount,i=e.mainFrustum,a=e.cascadedFrusta,o=e.directionalLights.cascadedLights,s=this.frustumLines.geometry.getAttribute(`position`),c=this.cascadeLines,l=this.cascadePlanes,u=this.shadowLines;for(this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.updateMatrixWorld(!0);c.length>n;){let e=c.pop(),t=l.pop(),n=u.pop();e&&this.remove(e),t&&this.remove(t),n&&this.remove(n)}for(;c.length<n;){let e=new r.Box3Helper(new r.Box3,new r.Color(16777215)),t=new r.MeshBasicMaterial({transparent:!0,opacity:.1,depthWrite:!1,side:r.DoubleSide}),n=new r.Mesh(new r.PlaneGeometry,t),i=new r.Group,a=new r.Box3Helper(new r.Box3,new r.Color(16776960));i.add(a),this.add(e),this.add(n),this.add(i),c.push(e),l.push(n),u.push(i)}for(let e=0;e<n;e++){let t=a[e],n=o[e].shadow.camera,r=t.far,i=c[e],s=l[e],d=u[e],f=d.children[0];i.box.min.copy(r[2]),i.box.max.copy(r[0]),i.box.max.z+=1e-4,s.position.addVectors(r[0],r[2]),s.position.multiplyScalar(.5),s.scale.subVectors(r[0],r[2]),s.scale.z=1e-4,this.remove(d),d.position.copy(n.position),d.quaternion.copy(n.quaternion),d.scale.copy(n.scale),d.updateMatrixWorld(!0),this.attach(d),f.box.min.set(n.bottom,n.left,-n.far),f.box.max.set(n.top,n.right,-n.near)}let d=i.near,f=i.far;s.setXYZ(0,f[0].x,f[0].y,f[0].z),s.setXYZ(1,f[3].x,f[3].y,f[3].z),s.setXYZ(2,f[2].x,f[2].y,f[2].z),s.setXYZ(3,f[1].x,f[1].y,f[1].z),s.setXYZ(4,d[0].x,d[0].y,d[0].z),s.setXYZ(5,d[3].x,d[3].y,d[3].z),s.setXYZ(6,d[2].x,d[2].y,d[2].z),s.setXYZ(7,d[1].x,d[1].y,d[1].z),s.needsUpdate=!0}},uH=class{viewers=[];lights;enabled=!1;constructor(e){this.lights=e}render(e){if(!this.enabled||!e.shadowMap.enabled)return;let t=this.lights.children.find(e=>e instanceof NV);if(this.viewers.length&&t?.cascadedLights.length===this.viewers.length){this.viewers.forEach(t=>{t&&t.render(e)});return}this.viewers.length=0,t&&t.cascadedLights.forEach((e,t)=>{if(e.shadow.map&&e.shadow.map.texture){let n=new xM(e);n.position.set(0,100*t),n.size.set(100,100),this.viewers.push(n)}})}},dH=p(d(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):n.Stats=r()})(e,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;t<i.children.length;t++)i.children[t].style.display=t===e?`block`:`none`;r=e}var r=0,i=document.createElement(`div`);i.style.cssText=`position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000`,i.addEventListener(`click`,function(e){e.preventDefault(),n(++r%i.children.length)},!1);var a=(performance||Date).now(),o=a,s=0,c=t(new e.Panel(`FPS`,`#0ff`,`#002`)),l=t(new e.Panel(`MS`,`#0f0`,`#020`));if(self.performance&&self.performance.memory)var u=t(new e.Panel(`MB`,`#f08`,`#201`));return n(0),{REVISION:16,dom:i,addPanel:t,showPanel:n,begin:function(){a=(performance||Date).now()},end:function(){s++;var e=(performance||Date).now();if(l.update(e-a,200),e>o+1e3&&(c.update(1e3*s/(e-o),100),o=e,s=0,u)){var t=performance.memory;u.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var r=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,c=48*o,l=3*o,u=2*o,d=3*o,f=15*o,p=74*o,m=30*o,h=document.createElement(`canvas`);h.width=s,h.height=c,h.style.cssText=`width:80px;height:48px`;var g=h.getContext(`2d`);return g.font=`bold `+9*o+`px Helvetica,Arial,sans-serif`,g.textBaseline=`top`,g.fillStyle=n,g.fillRect(0,0,s,c),g.fillStyle=t,g.fillText(e,l,u),g.fillRect(d,f,p,m),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d,f,p,m),{dom:h,update:function(c,_){r=Math.min(r,c),i=Math.max(i,c),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,s,f),g.fillStyle=t,g.fillText(a(c)+` `+e+` (`+a(r)+`-`+a(i)+`)`,l,u),g.drawImage(h,d+o,f,p-o,m,d,f,p-o,m),g.fillRect(d+p-o,f,o,m),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d+p-o,f,o,a((1-c/_)*m))}}},e})}))(),1),fH=1e3,pH=class{stats;renderer;drawCalls;numTriangles;memGeometries;wasmMemory;jsMemory;memorySampler;lastMemorySampleAt=0;maxWasmMB=1;maxJsHeapMB=1;constructor(e,t){this.stats=new dH.default,this.renderer=e,this.memorySampler=t,this.drawCalls=this.stats.addPanel(new dH.default.Panel(`Draws`,`#0ff`,`#002`)),this.numTriangles=this.stats.addPanel(new dH.default.Panel(`Triangles`,`#0fff57`,`#013a12`)),this.memGeometries=this.stats.addPanel(new dH.default.Panel(`Geometries`,`#ffa100`,`#301e00`)),this.wasmMemory=this.stats.addPanel(new dH.default.Panel(`WASM MB`,`#f08`,`#201`)),this.jsMemory=this.stats.addPanel(new dH.default.Panel(`JS MB`,`#f4f`,`#210`)),this.stats.showPanel(0)}begin(){this.renderer.beginRender(),this.stats.begin()}end(){let e=this.renderer.endRender();e.calls&&this.drawCalls.update(e.calls,500),e.triangles&&this.numTriangles.update(e.triangles,500),e.memGeometries&&this.memGeometries.update(e.memGeometries,500),this.sampleMemory(),this.stats.end()}sampleMemory(){if(!this.memorySampler)return;let e=performance.now();if(e-this.lastMemorySampleAt<fH)return;this.lastMemorySampleAt=e;let t=this.memorySampler();t&&(t.wasmMB!==void 0&&(this.maxWasmMB=Math.max(this.maxWasmMB,t.wasmMB),this.wasmMemory.update(t.wasmMB,t.budgetMB??this.maxWasmMB)),t.jsHeapMB!==void 0&&(this.maxJsHeapMB=Math.max(this.maxJsHeapMB,t.jsHeapMB),this.jsMemory.update(t.jsHeapMB,this.maxJsHeapMB)))}get dom(){return this.stats.dom}},mH=20,hH={r_scaler:0,g_scaler:0,b_scaler:0,offset:0,max_offset:0,min_offset:0,boundary:0,epsilon:0},gH=6,_H=3,vH=2,yH=200;async function bH(e,t,r){if(t.length===0)return[];let i=xH(e),a=r?.signal;OH(a);let o=SH(r?.level??i.maxZoom,i),s=r?.level==null?i.minZoom:o,c=new Float64Array(t.length*2);t.forEach((e,t)=>{c[t*2]=(0,n.angleToRadian)(e.lng),c[t*2+1]=(0,n.angleToRadian)(e.lat)});let l=(0,n.terrainPositionsToTiles)(i.geographic,o,c),u=new Map;for(let e=0;e<t.length;e++){let t=l[e*2],n=l[e*2+1],r=`${t}/${n}`,i=u.get(r);i||(i={x:t,y:n,indices:[]},u.set(r,i)),i.indices.push(e)}let d=t.map(e=>({lat:e.lat,lng:e.lng,height:void 0,level:void 0})),f=new Map,p=DH(gH);return await Promise.all([...u.values()].map(async e=>{let t=new Float64Array(e.indices.length*2);e.indices.forEach((e,n)=>{t[n*2]=c[e*2],t[n*2+1]=c[e*2+1]});let n=await CH(i,e,o,s,f,p,a);if(!n)return;let r=await TH(i,n,t,a);r&&e.indices.forEach((e,t)=>{let i=r[t];i!==void 0&&Number.isFinite(i)&&(d[e].height=i,d[e].level=n.level)})})),d}function xH(e){let t=e.url;if(!t)throw TypeError(`sampleTerrainMostDetailed: source.url is required`);if(e.type===`quantized-mesh`)return{kind:`quantized-mesh`,url:t,geographic:e.geographic??!0,tms:e.tms??!0,minZoom:e.minZoom??0,maxZoom:e.maxZoom??mH,token:e.token??void 0,decoder:hH};let n=e;return{kind:`raster-dem`,url:t,geographic:!1,tms:n.tms??!1,minZoom:n.minZoom??0,maxZoom:n.maxZoom??mH,token:void 0,decoder:{...hH,...n.elevationDecoder}}}function SH(e,t){return Math.min(Math.max(Math.floor(e),t.minZoom),t.maxZoom)}async function CH(e,t,r,i,a,o,s){let c=r;for(;c>=i;){let l=Math.max(c-(c===r?1:_H)+1,i),u=[];for(let e=c;e>=l;e--)u.push(e);let d=await Promise.all(u.map(i=>{let c=r-i,l=t.x>>c,u=t.y>>c,d=(0,n.terrainTileUrl)(e.url,e.geographic,e.tms,l,u,i),f=a.get(d);return f||(f=o(()=>wH(e,d,s)),a.set(d,f)),f.then(e=>({level:i,x:l,y:u,outcome:e}))}));for(let{level:e,x:t,y:n,outcome:r}of d){if(r.kind===`ok`)return{x:t,y:n,level:e,response:r.response};if(r.kind===`failed`)return null}c=l-1}return null}async function wH(e,t,n){let r={};e.kind===`quantized-mesh`&&(r.Accept=`application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01`),e.token&&(r.Authorization=`Bearer ${e.token}`);for(let e=0;;e++){OH(n);let i;try{i=await fetch(t,{headers:r,signal:n})}catch(t){if(n?.aborted)throw t;if(e<vH){await kH(yH*2**e);continue}return{kind:`failed`}}if(i.ok)return{kind:`ok`,response:i};if(i.status===404||i.status===410)return{kind:`missing`};if(i.status===401||i.status===403)throw Error(`sampleTerrainMostDetailed: ${i.status} ${i.statusText} for ${t} — check the source's token`);if(i.status>=500&&e<vH){await kH(yH*2**e);continue}return{kind:`failed`}}}async function TH(e,t,r,i){if(e.kind===`quantized-mesh`){let a=new Uint8Array(await t.response.arrayBuffer());return OH(i),(0,n.sampleQuantizedMeshHeights)(a,e.geographic,t.x,t.y,t.level,r)??null}let a=await EH(await t.response.blob());return OH(i),a?(0,n.sampleRasterDemHeights)(a,e.decoder,t.x,t.y,t.level,r)??null:null}async function EH(e){if(Th())try{let t=await DF(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch{return null}let t;try{t=await createImageBitmap(e)}catch{return null}try{let e=new OffscreenCanvas(t.width,t.height).getContext(`2d`);if(!e)return null;e.drawImage(t,0,0);let n=e.getImageData(0,0,t.width,t.height);return new Uint8Array(n.data.buffer,0,n.data.length)}finally{t.close()}}function DH(e){let t=0,n=[],r=()=>{t--,n.shift()?.()};return async i=>{t>=e&&await new Promise(e=>n.push(e)),t++;try{return await i()}finally{r()}}}function OH(e){if(e?.aborted)throw e.reason instanceof Error?e.reason:new DOMException(`The operation was aborted.`,`AbortError`)}function kH(e){return new Promise(t=>setTimeout(t,e))}function AH(e,t){return e.bits===t&&e.height!=null}var jH=``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/index-VfUncKuS.js`).href:new URL(`assets/index-VfUncKuS.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),MH={linear:0,quadInOut:1,cubicInOut:2,cubicOut:3,quinticInOut:4},NH=class extends M{_camera;_renderer;_globe;_atmosphere;skyEnvMap;mrtPass;transparentPass;finalPass;renderPassOrchestrator;_scenes;_core;_fontManager=new Lc(Bc);_options;_stats;_eventDisposer;_disposed=!1;_renderFlag={forceUpdate:!1,animation:!1};_declutter=new LP(RP);_declutterSize=new r.Vector2;_declutterRetry;_declutterRetryDelay=0;_isIdle=!1;_uniforms;_pendingFlights=new Map;_hoveredFeature=null;_meshes=new Map;_abortControllers=new Map;_workerPoolPromises=new Map;_loadedTexs=new Map;_texturizedSceneByTileCoordinates;_tileTextureCompositor;_tileMapByHandle=new Map;_textureFragmentIndex=new Map;_tileMeshToFragmentIds=new Map;_hillshadeContext=new yB;_initialized=!1;_inMemoryBufferStore=new MB;_buf={u8:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Uint8Array?t:this._core?.getBufferU8(e)??null},f32:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Float32Array?t:this._core?.getBufferF32(e)??null},f64:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Float64Array?t:this._core?.getBufferF64(e)??null},u32:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Uint32Array?t:this._core?.getBufferU32(e)??null},removeU8:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Uint8Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferU8(e)??null},removeU32:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Uint32Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferU32(e)??null},removeF32:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Float32Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferF32(e)??null},removeF64:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Float64Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferF64(e)??null},setU8:(e,t,n)=>{this._core?.hasDataRequester(t)&&this._core?.setBufferU8(e,t,n.length,e=>{e.set(n)})},newU8:e=>this._core?.newBufferU8(e.length,t=>{t.set(e)}),newU32:e=>this._core?.newBufferU32(e.length,t=>{t.set(e)}),newF32:e=>this._core?.newBufferF32(e.length,t=>{t.set(e)}),newF64:e=>this._core?.newBufferF64(e.length,t=>{t.set(e)}),adoptU8:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},adoptU32:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},adoptF32:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},adoptF64:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},setExternal:(e,t,n)=>{this._core?.hasDataRequester(t)&&(this._core.setExternalBuffer(e,t,n.byteLength),this._inMemoryBufferStore.set(e,n))},remove:e=>{this._inMemoryBufferStore.delete(e),this._core?.removeBuffer(e)},drainRemovedExternalHandles:()=>{let e=this._core?.drainRemovedExternalHandles();if(e)for(let t of e)this._inMemoryBufferStore.delete(t)},triggerDataRequesterLoaded:(e,t)=>{this._core?.triggerDataRequesterLoaded(e,t)},triggerDataRequesterFailed:e=>{this._core?.triggerDataRequesterFailed(e)}};_texFragment={triggerTextureFragmentLoaded:(e,t)=>{this._core?.triggerTextureFragmentLoaded(e,t)}};_vectorRevision=0;_rasterRevision=0;_tileHandler=jB({getCore:()=>this._core,getVectorRevision:()=>this._vectorRevision,getRasterRevision:()=>this._rasterRevision});_globeHandler={getTransparent:()=>this._core?.getGlobeTransparent(),getMaxSse:()=>this._core?.getGlobeMaxSse(),getSegments:()=>this._core?.getGlobeSegments(),getColor:()=>{let e=this._core?.getGlobeColor();return e===void 0?void 0:new nE().setHex(e)},getHideUnderground:()=>this._core?.getGlobeHideUnderground(),getUseNormal:()=>this._core?.getGlobeUseNormal(),getOpacity:()=>this._core?.getGlobeOpacity(),getWireframe:()=>this._core?.getGlobeWireframe(),getElevationColormap:()=>this._core?.getGlobeElevationColormap(),setTransparent:e=>{this._core?.setGlobeTransparent(e)},setMaxSse:e=>{this._core?.setGlobeMaxSse(e)},setSegments:e=>{this._core?.setGlobeSegments(e)},setColor:e=>{this._core?.setGlobeColor(e.toHex())},setHideUnderground:e=>{this._core?.setGlobeHideUnderground(e)},setUseNormal:e=>{this._core?.setGlobeUseNormal(e)},setOpacity:e=>{this._core?.setGlobeOpacity(e)},setWireframe:e=>{this._core?.setGlobeWireframe(e)},setElevationColormap:e=>{this._core?.setGlobeElevationColormap(e.flatten());let t=e.createImage(),n=new r.Texture(t);n.wrapS=r.ClampToEdgeWrapping,n.wrapT=r.ClampToEdgeWrapping,n.minFilter=r.LinearFilter,n.magFilter=r.LinearFilter,n.generateMipmaps=!1,n.flipY=!1,n.needsUpdate=!0,this._uniforms.colorMapTexture.value=n,this._defaultTextureOptions.additionalTexturesInUse={...this._defaultTextureOptions.additionalTexturesInUse,colorMapTexture:!0}}};_workerTaskHandler={triggerWorkerTaskCompleted:(e,t)=>{this._core?.triggerWorkerTaskCompleted(e,t)},triggerWorkerTaskFailed:e=>{this._core?this._core.triggerWorkerTaskFailed(e):e.free()},hasWorkerTask:e=>!!this._core?.hasWorkerTask(e)};_featureHandler={getTransferablePolygonBatchedFeature:e=>this._core?.getTransferablePolygonBatchedFeature(e),getTransferablePolylineBatchedFeature:e=>this._core?.getTransferablePolylineBatchedFeature(e),markFeatureIsRendered:(e,t)=>{this._core?.markFeatureIsRendered(e,t)},reportFeatureGpuBytes:(e,t)=>{this._core?.reportFeatureGpuBytes(e,t)},readAllBatchedProperties:(e,t)=>this._core?.readAllBatchedProperties(e,t),readFilteredBatchedProperties:(e,t,n)=>this._core?.readFilteredBatchedProperties(e,t,n)};_meshHandler={setTileMeshPrepared:e=>{this._core?.setTileMeshPrepared(e)}};_layerHandler={getLayerIndex:e=>this._core?.getLayerIndex(e)};_ownedRootElement;_eventManager=new x;_pickHelper;_terrainPicker;_defaultTextureOptions;layersManager=new lz;shadowMapViewers;eventContext;registries;viewContext;plugins=[];_attribution;_buffers;_lit=!0;pixelRatioMatchedMedia;fixedGpuBytesReportScheduled=!1;fixedGpuBytesResyncPending=!1;framesSinceFixedGpuBytesReport=0;lastReportedFixedGpuBytes=-1;get attribution(){return this._attribution}get buffers(){return this._buffers}get lit(){return this._lit}set lit(e){this._lit!==e&&(this._lit=e,this.viewContext._setLit(e),this.forceUpdate())}constructor(e={}){if(super(),cP(),this._buffers=CA(),!e.canvas){let t=document.createElement(`div`);t.id=`navara-root`,t.style.width=`100vw`,t.style.height=`100vh`,e.canvas=document.createElement(`canvas`),e.canvas.id=`navara-canvas`,e.canvas.style.width=`100%`,e.canvas.style.height=`100%`,t.appendChild(e.canvas),document.body.appendChild(t),this._ownedRootElement=t}if(this._options=e,e.defaultAttribution!==!1&&!dA()){let t=typeof e.defaultAttribution==`object`?e.defaultAttribution:void 0;this._attribution=new jV(t),this.addPlugin(this._attribution)}this._terrainPicker=new dV,e.canvas?.addEventListener(`contextmenu`,e=>{e.preventDefault()});let t=new r.WebGLRenderer({antialias:(e.multisampling??0)>0,logarithmicDepthBuffer:e.logarithmicDepthBuffer??!0,canvas:e.canvas,stencil:!0});t.info.autoReset=!1,t.autoClearStencil=!1,t.autoClearColor=!1,t.autoClearDepth=!1,this._renderer=t,t.shadowMap.enabled=!!e.shadow,this._renderer.shadowMap.type=r.PCFShadowMap,t.shadowMap.autoUpdate=!1;let{width:n,height:i}=this._getCanvasSize()??{};if(z(n&&i),typeof e?.pixelRatio==`number`||!dA()){let n=dA()?1:bF({override:e.pixelRatio,mobileOptimization:e.mobileOptimization});t.setPixelRatio(n)}t.setSize(n,i,!dA()),e.container&&e.container.appendChild(t.domElement),this._texturizedSceneByTileCoordinates=new AL(this._renderer),this._tileTextureCompositor=new NL({renderer:this._renderer,texturizedSceneByTileCoordinates:this._texturizedSceneByTileCoordinates,mercatorY:this._tileHandler.mercatorY,size:lF(this.isMobileOptimized())}),this._scenes={light:new r.Group,mrt:new r.Scene,globe:new r.Scene,draped:new r.Scene,opaque:new r.Scene,transparent:new r.Scene,skyEnvMap:new r.Scene},this._camera=new aC,this.renderPassOrchestrator=new aV(this._renderer,{halfFloat:e.halfFloat??!0,multisampling:e.multisampling}),this.renderPassOrchestrator.setSize(n,i),this.renderPassOrchestrator.onPassesChanged=()=>this._scheduleFixedGpuBytesReport();let a=e.backgroundColor?e.backgroundColor.toHex():0;if(this._renderer.setClearColor(a),!e.disableAutoResize&&!dA()&&(window.addEventListener(`resize`,this._handleResize),this.pixelRatioMatchedMedia=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.pixelRatioMatchedMedia.addEventListener(`change`,this._handleResize)),e.debug){let t=e.container||this._renderer.domElement.parentElement;t&&(this._stats=new pH({beginRender:()=>this._renderer.info.reset(),endRender:()=>({...this._renderer.info.render,memGeometries:this._renderer.info.memory.geometries})},()=>{let e=this._core?.getMemoryStats(),t=e?.bufferTotalBytes,n=e?.externalBufferBytes,r=e?.budgetBytes;e?.free();let i=performance.memory,a=1048576;return{wasmMB:t===void 0?void 0:t/a,jsBufMB:n===void 0?void 0:n/a,jsHeapMB:i?i.usedJSHeapSize/a:void 0,budgetMB:r===void 0?void 0:r/a}}),t.appendChild(this._stats.dom))}if(this._uniforms={viewportAndPixelRatio:{value:null},frustumNearFar:{value:null},frustumRatio:{value:null},tGlobeDepth:{value:null},tGlobeNormal:{value:null},tSkyEnvMap:{value:null},inverseProjectionMatrix:{value:null},fov:{value:this._camera.raw.fov*Math.PI/180},screenHeightPx:{value:i},time:{value:0},colorMapTexture:{value:null},waterTexture:{value:null}},this._defaultTextureOptions={maxAnisotropy:this._renderer.capabilities.getMaxAnisotropy(),magFilter:r.LinearFilter,minFilter:r.LinearFilter,useMipmaps:!0,maxTextures:Math.max(this._renderer.capabilities.maxTextures,8)-6},e.waterTexture?.enabled){let t=e.waterTexture.url??_C;this._uniforms.waterTexture.value=lR.load(t,e=>{e.wrapS=r.RepeatWrapping,e.wrapT=r.RepeatWrapping}),this._defaultTextureOptions.additionalTexturesInUse={...this._defaultTextureOptions.additionalTexturesInUse,waterTexture:!0}}this._atmosphere=new tE(this._renderer,e.atmosphere,this._camera),this._atmosphere.on(`needsUpdate`,this.forceUpdate),this._atmosphere.on(`textureLoaded`,this.forceUpdate),this.on(`layer`,(e,t,...n)=>{this.layersManager.emitById(e,t,...n)}),this._renderFlag.animation=!!e.animation,this._camera.on(`frustumChanged`,()=>{this.renderPassOrchestrator.effectComposer.setMainCamera(this._camera.raw)}),this.shadowMapViewers=new uH(this._scenes.light)}convertMouseEventToMapEvent(e){let t=this._renderer.domElement.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=mA(this,n,r);return i?Object.assign(e,{map:{x:i.x,y:i.y,z:i.z}}):null}initializeRenderPass(){this.skyEnvMap=this.addEffect({skyEnvMap:{}}),this.mrtPass=this.addEffect({mrt:{}}),this.transparentPass=this.addEffect({transparent:{}}),this.finalPass=this.addEffect({final:{}})}get renderPass(){let e=this.mrtPass.ref.raw;return z(e),e}get camera(){return this._camera}get globe(){return this._globe}get atmosphere(){return this._atmosphere}get toneMappingExposure(){return this._renderer.toneMappingExposure}set toneMappingExposure(e){this._renderer.toneMappingExposure=e,this.forceUpdate()}get cacheBytes(){return this._options.cacheBytes}set cacheBytes(e){this._options.cacheBytes=e,this._core?.setCacheBytes(e)}get lodFog(){let e=this._options.lodFog;if(e)return e}set lodFog(e){let t={..._F({isMobile:this.isMobileOptimized()}),...this._options.lodFog,...e};this._options.lodFog=t,this._core?.setLodFog(t.enabled,t.density,t.sseFactor)}get dynamicSse(){let e=this._options.dynamicSse;if(e)return e}set dynamicSse(e){let n={...yF(),...this._options.dynamicSse,...e};this._options.dynamicSse=n,this._core?.setDynamicSse(new t.DynamicSse(n.enabled,n.density,n.sseFactor,n.heightFalloff,n.minHeight,n.maxHeight))}setSseMultiplierRange(e,t){this._options.memoryBudget={...this._options.memoryBudget,sseMultiplierMin:e,sseMultiplierMax:t},this._core?.setSseMultiplierRange(e,t)}memoryStats(){let e=this._core?.getMemoryStats();if(!e)return;let t={bufferTotalBytes:e.bufferTotalBytes,externalBufferBytes:e.externalBufferBytes,bufferCount:e.bufferCount,gpuBytesEst:e.gpuBytesEst,externalCpuBytes:e.externalCpuBytes,reservedBytes:e.reservedBytes,fixedGpuBytes:e.fixedGpuBytes,budgetBytes:e.budgetBytes,evictedCount:e.evictedCount,sseMultiplier:e.sseMultiplier,retainedVector:e.retainedVector,retainedTerrain:e.retainedTerrain,retainedRaster:e.retainedRaster,retainedTiles3d:e.retainedTiles3d};return e.free(),t}async workerMemoryStats(){if(this._initialized)return Dh(),{tileWorkers:Eh(),fontWorker:await this._fontManager.memoryStats()}}get globeDepthTexture(){return this.renderPass.globeDepthCopyPass.texture}get depthTexture(){return this.renderPass.allDepthCopyPass.texture}isMobileOptimized(){return this._options.mobileOptimization??VP()}forceUpdate=()=>{this._renderFlag.forceUpdate=!0};async init(){if(this._core||this._initialized)return;this._initialized=!0;let e=this.isMobileOptimized(),n=iE(e);e&&(this._hillshadeContext.normalMapScale=.5);let i=dF({isMobile:e,poolSize:n.total});xh(jH,n,{maxWorkerHeapBytes:this._options.memoryBudget?.maxWorkerHeapBytes??i.maxWorkerHeapBytes}),await Promise.all([(0,t.default)(),tl()]),this._core=new t.Core(PH()),this._core.start();let a=this._options.cacheBytes??i.cacheBytes;this._options.cacheBytes=a,this._core.setCacheBytes(a),this._core.setMaxPendingRequests(this._options.memoryBudget?.maxPendingRequests??i.maxPendingRequests),this._core.setSseMultiplierRange(this._options.memoryBudget?.sseMultiplierMin??i.sseMultiplierMin,this._options.memoryBudget?.sseMultiplierMax??i.sseMultiplierMax);let o=uF({isMobile:e});this._core.setMemoryCostHints(o.atlasTileBytes,o.rasterTileBytes),this._scheduleFixedGpuBytesReport();let s={..._F({isMobile:e}),...this._options.lodFog};this._options.lodFog=s,this._core.setLodFog(s.enabled,s.density,s.sseFactor);let c={...yF(),...this._options.dynamicSse};this._options.dynamicSse=c,this._core.setDynamicSse(new t.DynamicSse(c.enabled,c.density,c.sseFactor,c.heightFalloff,c.minHeight,c.maxHeight)),this._fontManager.setConcurrencyManager(n),this._fontManager.setMemoryBudget(this._options.memoryBudget?.fontBudgetBytes??i.fontBudgetBytes),this._globe=new go(this._globeHandler,this._options),this.viewContext=new PP(this._scenes,this.layersManager,this.renderPassOrchestrator,n,this._core,this._meshes),this.registries=new _E(this,this.viewContext),this.viewContext.on(`meshPassKeyChanged`,this._syncGBuffers),this.viewContext._setRegistries(this.registries),this.eventContext=new OF({eventManager:this._eventManager,scenes:this._scenes,camera:this._camera,meshes:this._meshes,abortControllers:this._abortControllers,buf:this._buf,texFragment:this._texFragment,tileHandler:this._tileHandler,workerTaskHandler:this._workerTaskHandler,meshHandler:this._meshHandler,featureHandler:this._featureHandler,loadedTexs:this._loadedTexs,workerPoolPromises:this._workerPoolPromises,uniforms:this._uniforms,texturizedSceneByTileCoordinates:this._texturizedSceneByTileCoordinates,tileTextureCompositor:this._tileTextureCompositor,tileMapByHandle:this._tileMapByHandle,textureOptions:this._defaultTextureOptions,renderFlag:this._renderFlag,viewEvents:this,layersManager:this.layersManager,viewContext:this.viewContext,flightHandler:(e,t)=>{let n=this._pendingFlights.get(e);n&&(this._pendingFlights.delete(e),n(t))},layerHandler:this._layerHandler,fontManager:this._fontManager,textureFragmentIndex:this._textureFragmentIndex,tileMeshToFragmentIds:this._tileMeshToFragmentIds,hillshadeContext:this._hillshadeContext,declutter:this._declutter}),this.registerBuiltIns(),dA()||(this._eventDisposer=NB(this._core,this._renderer.domElement,()=>{let e=this._renderer.domElement.getBoundingClientRect(),t=this.pickDepthPosition(e.left+e.width/2,e.top+e.height/2);return t?this._camera.raw.position.distanceTo(t):null}),this._pickHelper=new lV(this._renderer.domElement,this._renderer,this._camera.raw,this._meshes,this.onPick.bind(this),this.onHoverPick.bind(this),()=>!!this.size(`featureClick`),()=>!!(this.size(`featureHover`)||this.size(`featureEnter`)||this.size(`featureLeave`))),this._pickHelper.enablePick(this._options.picking??!0)),this.initializeRenderPass(),this.viewContext._setRenderPass(this.renderPass),Ch().catch(e=>console.error(`Failed to warm up the worker pool:`,e)),await Promise.all(this.plugins.map(e=>e.init(this,this.viewContext))),this._startMainLoop();let l=new r.Vector2;this._renderer.getSize(l),this.resize(l.width,l.height,this._renderer.getPixelRatio()),this._camera.core=this._core,this._renderer.domElement.addEventListener(`mousedown`,e=>{let t=this.convertMouseEventToMapEvent(e);t&&this.emit(`mousedown`,t)}),this._renderer.domElement.addEventListener(`mouseenter`,e=>{let t=this.convertMouseEventToMapEvent(e);t&&this.emit(`mouseenter`,t)}),this._renderer.domElement.addEventListener(`mouseleave`,e=>{let t=this.convertMouseEventToMapEvent(e);t&&this.emit(`mouseleave`,t)}),this._renderer.domElement.addEventListener(`mousemove`,e=>{let t=this.convertMouseEventToMapEvent(e);t&&this.emit(`mousemove`,t)}),this._renderer.domElement.addEventListener(`mouseup`,e=>{let t=this.convertMouseEventToMapEvent(e);t&&this.emit(`mouseup`,t)}),this._renderer.domElement.addEventListener(`click`,e=>{let t=this.convertMouseEventToMapEvent(e);t&&this.emit(`click`,t)})}dispose(){this._disposed=!0,this._initialized=!1;for(let e of this._pendingFlights.values())e(!1);this._pendingFlights.clear(),this._declutterRetry!==void 0&&(clearTimeout(this._declutterRetry),this._declutterRetry=void 0),this._attribution?.dispose(),this._attribution=void 0,dA()||(window.removeEventListener(`resize`,this._handleResize),this.pixelRatioMatchedMedia?.removeEventListener(`change`,this._handleResize)),this._eventDisposer&&=(this._eventDisposer(),void 0),this._pickHelper&&=(this._pickHelper.dispose(),void 0),this._terrainPicker&&this._terrainPicker.dispose(),this._fontManager.dispose(),this._atmosphere._dispose(),this.skyEnvMap?.delete(),this.mrtPass?.delete(),this.transparentPass?.delete(),this.finalPass?.delete();for(let e of this._abortControllers.values())e.abort();this._abortControllers.clear();for(let e of this._loadedTexs.values())wF(e);this._loadedTexs.clear(),this._hillshadeContext.dispose(),this._declutter.dispose(),this._meshes.clear(),this._inMemoryBufferStore.clear(),this._workerPoolPromises.clear(),this._tileMapByHandle.clear(),this._textureFragmentIndex.clear(),this._tileMeshToFragmentIds.clear(),this.renderPassOrchestrator.dispose(),this._tileTextureCompositor.dispose(),this._core?.free(),this._core=void 0,this._stats&&=(this._stats.dom.remove(),void 0),this._renderer.setAnimationLoop(null),`dispose`in this._renderer&&typeof this._renderer.dispose==`function`&&this._renderer.dispose(),this._ownedRootElement?.remove(),this._ownedRootElement=void 0,Sh()}resize=(e,t,n)=>{if(this._disposed)return;let i=this._getCanvasSize(),a=typeof e==`number`?e:i?.width,o=typeof t==`number`?t:i?.height;if(typeof a!=`number`||typeof o!=`number`)return;this._camera.raw.aspect=a/o,this._camera.raw.updateProjectionMatrix(),this._renderer.setSize(a,o,!dA()),this.renderPassOrchestrator.setSize(a,o),this._options.pixelRatio==null&&n&&this._renderer.setPixelRatio(n);let s=this._renderer.getDrawingBufferSize(new r.Vector2);this._pickHelper?.setSize(s.x,s.y),this._core?.resize(a,o,n??1),this._scheduleFixedGpuBytesReport(),this.emit(`resize`,a,o)};_reportFixedGpuBytes(){if(this._disposed||!this._core)return;let e=this.renderPassOrchestrator.estimateFixedGpuBytes();this.framesSinceFixedGpuBytesReport=0,e!==this.lastReportedFixedGpuBytes&&(this.lastReportedFixedGpuBytes=e,this._core.setFixedGpuBytes(e))}_scheduleFixedGpuBytesReport(){this.fixedGpuBytesResyncPending=!0,!this.fixedGpuBytesReportScheduled&&(this.fixedGpuBytesReportScheduled=!0,queueMicrotask(()=>{this.fixedGpuBytesReportScheduled=!1,this._reportFixedGpuBytes()}))}_updateUniforms(){let e=this._getCanvasSize(),t=this._renderer.getPixelRatio(),n=this._camera.raw.fov*Math.PI/180,r=this._camera.raw.near*Math.tan(.5*n),i=-r,a=this._camera.raw.aspect*r,o=-a;this._uniforms.viewportAndPixelRatio.value=[e?.width??0,e?.height??0,t],this._uniforms.frustumNearFar.value=[this._camera.raw.near,this._camera.raw.far],this._uniforms.frustumRatio.value=[r,i,a,o],this._uniforms.tGlobeDepth.value=this.renderPass.globeDepthCopyPass.texture,this._uniforms.tGlobeNormal.value=this.renderPass.globeNormalCopyPass.texture,this._uniforms.tSkyEnvMap.value=this.skyEnvMap.ref.raw?.getEnvMapTexture()??null,this._uniforms.inverseProjectionMatrix.value=this._camera.raw.projectionMatrixInverse,this._uniforms.fov.value=n,this._uniforms.screenHeightPx.value=e?.height??0}_update(e){this.emit(`preUpdate`,e),this._core?.update(e);let t=this._core?.readEvents();return!t&&!this._eventManager.needsUpdate()||!this._core?!1:(this.eventContext.updatedAt=e,bB(this.eventContext,t),t?.free(),this._buf.drainRemovedExternalHandles(),this._camera.raw.updateMatrixWorld(),this._updateUniforms(),this.emit(`postUpdate`,e),!0)}_forceFeatureUpdates(e){for(let t of this.layersManager.getResourceLayers())t._processFeatureUpdates(e)&&(this._renderFlag.forceUpdate=!0)}_scheduleDeclutterFrame(e){if(this._declutterRetry!==void 0){if(e>=this._declutterRetryDelay)return;clearTimeout(this._declutterRetry)}this._declutterRetryDelay=e,this._declutterRetry=setTimeout(()=>{this._declutterRetry=void 0,this._renderFlag.forceUpdate=!0},e)}_render(e){this._vectorRevision=this._core?.vectorRevision()??this._vectorRevision,this._rasterRevision=this._core?.rasterRevision()??this._rasterRevision,this._uniforms.time.value=e,this._atmosphere._update();{let t=this._renderer.getDrawingBufferSize(this._declutterSize),n=this._renderer.getPixelRatio(),r=this._declutter.update(this._camera.raw,t.x/n,t.y/n,e);r===`throttled`?this._scheduleDeclutterFrame(this._declutter.remainingThrottleMs(e)):r===`animating`&&this._scheduleDeclutterFrame(16)}this.emit(`preRender`,e),this.renderPassOrchestrator.render(),this._pickHelper?.renderDebugCanvas(),this.shadowMapViewers.render(this._renderer),this.emit(`postRender`,e),this.fixedGpuBytesResyncPending?(this.fixedGpuBytesResyncPending=!1,this._reportFixedGpuBytes()):++this.framesSinceFixedGpuBytesReport>=120&&(this.framesSinceFixedGpuBytesReport=0,this._reportFixedGpuBytes())}_convertColorsToNumbers(e){if(typeof e!=`object`||!e)return e;let t={...e};for(let[e,n]of Object.entries(t))if(n&&typeof n==`object`&&!Array.isArray(n)){let r={...n};for(let[e,t]of Object.entries(r))t instanceof nE&&(r[e]=t.toHex());t[e]=r}return t}addLayer(e){let t=`source`in e&&e.source instanceof sz?{...e,source:e.source.id}:e,n=this._convertColorsToNumbers(t),r=this._core?.addLayer(n);z(r),z(this._core);let i=new cz(r,this._core,this._convertColorsToNumbers.bind(this));return this.layersManager.add(i),i}addSource(e){return z(this._core),z(e.type),new sz(this._core.addSource(e),e.type,this._core)}addMesh(e){let t=this.registries.mesh.findMeshType(e);if(!t)throw new yE(`mesh`,e);let n=this.registries.mesh.create(t,e);if(n.onCreate(),n.update&&this.on(`preRender`,n.update.bind(n)),n.onResize){this.on(`resize`,n.onResize.bind(n));let e=this._getCanvasSize();e&&n.onResize(e.width,e.height)}n.on(`needsUpdate`,this.forceUpdate);let r=new kP(n);return this.layersManager.add(r),r}addLight(e){let t=this.registries.light.findLightType(e);if(!t)throw new yE(`light`,e);let n=this.registries.light.create(t,e);n.onCreate(),n.update&&this.on(`preRender`,n.update.bind(n)),n.on(`needsUpdate`,this.forceUpdate);let r=new AP(n);return this.layersManager.add(r),r}addEffect(e){let t=this.registries.effect.findEffectType(e);if(!t)throw new yE(`effect`,e);this._assertGBufferCapacity(t);let n=this.registries.effect.create(t,e),r=new jP(n);return this.layersManager.add(r),this._syncGBuffers(),r.on(`deleted`,this._syncGBuffers),n.onCreate(),n.update&&this.on(`preRender`,n.update.bind(n)),n.on(`needsUpdate`,this.forceUpdate),r}_syncGBuffers=()=>{let e=[];for(let t of this.layersManager.getEffectDescs()){let n=t.ref.constructor;n.requiredBuffers&&e.push(n.requiredBuffers)}this._scenes.draped.children.length>0&&e.push([`globeNormal`]),this._buffers=wA(e),this.viewContext._setGBufferOptions(this._buffers)};_assertGBufferCapacity(e){let t=this.registries.effect.getRequiredBuffers(e);if(t.length===0)return;let n=wA([Object.keys(this._buffers).filter(e=>this._buffers[e]),t]),r=2+SA.filter(e=>n[e]).length,i=this.viewContext.getRenderer().getContext(),a=i.getParameter(i.MAX_DRAW_BUFFERS);if(r>a)throw Error(`The "${e}" effect requires G-buffers [${t.join(`, `)}], but the resulting ${r} MRT attachments exceed this device's MAX_DRAW_BUFFERS (${a}).`)}findLayerById(e){let t=this.layersManager.get(e);return t instanceof cz?t:void 0}updateLayerById(e,t){z(this._core);let n=this.layersManager.get(e);!n||!(n instanceof cz)||n.update(t)}updateMeshById(e,t){let n=this.layersManager.get(e);!n||!(n instanceof kP)||n.update(t)}updateLightById(e,t){let n=this.layersManager.get(e);!n||!(n instanceof AP)||n.update(t)}updateEffectById(e,t){let n=this.layersManager.get(e);!n||!(n instanceof jP)||n.update(t)}deleteLayerById(e){z(this._core);let t=this.layersManager.get(e);return!t||!(t instanceof cz)?!1:(t.delete(),!0)}deleteMeshById(e){let t=this.layersManager.get(e);return!t||!(t instanceof kP)?!1:(t.delete(),!0)}deleteLightById(e){let t=this.layersManager.get(e);return!t||!(t instanceof AP)?!1:(t.delete(),!0)}deleteEffectById(e){let t=this.layersManager.get(e);return!t||!(t instanceof jP)?!1:(t.delete(),!0)}registerBuiltIns(){this.registerBuiltInEffects()}registerBuiltInEffects(){this.registerEffect(`skyEnvMap`,XB),this.registerEffect(`mrt`,qB),this.registerEffect(`transparent`,ZB),this.registerEffect(`final`,PB)}registerMesh(e,t){this.registries.mesh.register(e,t)}registerLight(e,t){this.registries.light.register(e,t)}registerEffect(e,t){this.registries.effect.register(e,t)}addPlugin(e){if(this._initialized)throw Error("Plugin must be added before `view.init()`.");return this.plugins.push(e),this}addFontFamily(e){return this._fontManager.registerFontFamily(e),this}removeFontFamily(e){return this._fontManager.unregisterFontFamily(e),this}setCamera(e){function t(e){return Number.isFinite(e)&&e!=null}let n=e.lng,r=e.lat,i=t(n)&&t(r)?new Float64Array([n,r,e.height??0]):null;this._core?.changeCamera(i,e.pitch,e.heading,e.roll,e.distance)}moveCamera(e,n){switch(e){case t.CameraDirection.Forward:this._core?.moveCamera(t.CameraDirection.Forward,n);break;case t.CameraDirection.Backward:this._core?.moveCamera(t.CameraDirection.Backward,n);break;case t.CameraDirection.Up:this._core?.moveCamera(t.CameraDirection.Up,n);break;case t.CameraDirection.Down:this._core?.moveCamera(t.CameraDirection.Down,n);break;case t.CameraDirection.Left:this._core?.moveCamera(t.CameraDirection.Left,n);break;case t.CameraDirection.Right:this._core?.moveCamera(t.CameraDirection.Right,n)}}moveCameraWithDirection(e,t){e.length===3&&this._core?.moveCameraWithDirection(new Float64Array(e),t)}flyTo(e,t={}){let n=e,r=new Float64Array([n.lng,n.lat,n.height??0]),i=this._core?.flyTo(r,n.pitch,n.heading,n.roll,t.duration,t.maxHeight,n.distance,t.easing===void 0?void 0:MH[t.easing]);return i===void 0?Promise.resolve(!1):new Promise(e=>{this._pendingFlights.set(i,e)})}lookAt(e,t){this._core?.lookAt(new Float64Array([e.lng,e.lat,e.height]),new Float64Array([t.x,t.y,t.z]))}cameraFollow(e,t,n){let r=t?new Float64Array([t.lng,t.lat,t.height]):void 0,i=n?new Float64Array([n.x,n.y,n.z]):void 0;this._core?.cameraFollow(e,r,i)}cameraFreeLook(e,t){let n=t?new Float64Array([t.lng,t.lat,t.height]):void 0;this._core?.cameraFreeLook(e,n)}sampleTerrainHeight(e){let n=new t.LLE(il(e.lat),il(e.lng),0);return this._core?.sampleTerrainHeight(n)}async sampleTerrainMostDetailed(e,t,n){z(this._core);let r=e instanceof sz?e.id:e,i=this._core.getSourceDescription(r);if(i?.type!==`quantized-mesh`&&i?.type!==`raster-dem`)throw Error(`sampleTerrainMostDetailed: source "${r}" is not a registered quantized-mesh or raster-dem source`);return bH(i,t,n)}observeTerrainHeightAt(e,n){if(!this._core)return()=>{};let r=new t.LLE(il(e.lat),il(e.lng),0),i=this._core.registerSampleTerrainHeightEvent(r),a=e=>{AH(e,i)&&n(e.height)};return this.on(`_sample_terrain_height_received`,a),()=>{this._core?.unregisterSampleTerrainHeightEvent(i),this.off(`_sample_terrain_height_received`,a)}}rotateAroundAxis(e,t){this._core?.rotateAroundAxis(new Float64Array([e.x,e.y,e.z]),t)}rotateAround(e){this._core?.rotateAroundAxis(null,e)}_startMainLoop(){let e=this._options.idleThreshold??100;this._renderer.setAnimationLoop(t=>{if(this._disposed)return;this._stats?.begin(),this._forceFeatureUpdates(t);let n=this._update(t);(n||this._renderFlag.forceUpdate||this._renderFlag.animation)&&this._render(t),this._renderFlag.forceUpdate=!1,n?this._isIdle=!1:!this._isIdle&&this.eventContext.updatedAt>0&&t-this.eventContext.updatedAt>=e&&(this._isIdle=!0,this.emit(`idle`)),this._stats?.end()})}_getCanvasSize(){let e=this._options.container??this._renderer.domElement?.parentElement??this._renderer.domElement;if(!e)return;let t=e.offsetWidth,n=e.offsetHeight;if(typeof t==`number`||typeof n==`number`)return{width:t,height:n}}_handleResize=()=>{let{width:e,height:t}=this._getCanvasSize()??{};if(!e||!t)return;let n=dA()?this._options.pixelRatio??1:bF({override:this._options.pixelRatio,mobileOptimization:this._options.mobileOptimization});this.resize(e,t,n)};resolvePickedFeature(e){let t=this._core?.readPropertyByGlobalBatchId(e);return t?{properties:t.properties,batchId:t.batchId??e,layerId:t.layerId}:{properties:{},batchId:e,layerId:void 0}}onPick(e){this._renderFlag.forceUpdate=!0,e.length>0?this.emit(`featureClick`,this.resolvePickedFeature(e[0])):this.emit(`featureClick`,null)}onHoverPick(e){this._renderFlag.forceUpdate=!0;let t=e.length>0?e[0]:0,n=this._hoveredFeature;if((n?.batchId??0)===t)return;let r=t>0?this.resolvePickedFeature(t):null;this._hoveredFeature=r,n&&this.emit(`featureLeave`,n),r&&this.emit(`featureEnter`,r),this.emit(`featureHover`,r)}get animation(){return this._renderFlag.animation}set animation(e){this._renderFlag.animation=e}get canvas(){return this._renderer.domElement}get screenSize(){let e=new r.Vector2;return this._renderer.getSize(e),e}get pixelRatio(){return this._renderer.getPixelRatio()}get shadowMapViewersEnabled(){return this.shadowMapViewers.enabled}set shadowMapViewersEnabled(e){this.shadowMapViewers.enabled=e}pickTerrainPosition(e,t){return this._terrainPicker.pick(e,t,this._renderer,this.globeDepthTexture,this._camera.raw)}pickDepthPosition(e,t){return this._terrainPicker.pick(e,t,this._renderer,this.depthTexture,this._camera.raw)}};function PH(){return Math.random().toString(36).slice(2)}e.ATMOSPHERE_HIGHER_ORDER_SCATTERING_URL=lC,e.ATMOSPHERE_IRRADIANCE_URL=cC,e.ATMOSPHERE_SCATTERING_URL=sC,e.ATMOSPHERE_SINGLE_MIE_SCATTERING_URL=uC,e.ATMOSPHERE_TEXTURE_URLS=vC,e.ATMOSPHERE_TRANSMITTANCE_URL=oC,e.AllDepthCopyPass=zB,e.Atmosphere=tE,e.AttributionPlugin=jV,e.BATCHED_ATTRIBUTE_NAMES=lI,e.BATCH_TEXTURE_ROW=cI,e.BaseDesc=fE,e.BaseHandle=OP,e.BatchedFeatureMesh=kI,e.BatchedSdfTextMesh=$R,e.BufferView=oV,e.CLOUD_LOCAL_WEATHER_URL=fC,e.CLOUD_SHAPE_DETAIL_URL=mC,e.CLOUD_SHAPE_URL=pC,e.CLOUD_TURBULENCE_URL=hC,e.CSMHelper=lH,Object.defineProperty(e,"CameraDirection",{enumerable:!0,get:function(){return t.CameraDirection}}),e.CascadedShadowMaps=cH,e.Color=nE,e.ColorMap=ho,e.ConflictingTransformError=bE,e.CopyPass=dE,e.CustomEffectPass=lE,e.CustomRenderPass=GB,e.DEFAULT_EFFECT_OPTIONS=oE,e.DEPTH_PACKING_SHADER=LB,e.DescRegistry=aE,e.DrapedMesh=rz,e.Effect=cE,e.EffectDesc=pE,e.EffectDescRegistry=mE,e.EffectHandle=jP,e.EllipsoidGeodesic=el,e.EventHandler=M,e.FeatureEvaluator=oz,e.FeatureMesh=UI,e.FinalCopyEffectDesc=PB,e.GBUFFER_ATTACHMENT_NAMES=SA,e.GBUFFER_DEFINE_NAMES=PA,e.GBUFFER_EFFECT_ID_LOCATION_DEFINE=kA,e.GBUFFER_EFFECT_WRITE_BUILTIN=RA,e.GBUFFER_EFFECT_WRITE_ID_ONLY=BA,e.GBUFFER_EFFECT_WRITE_SHADER_MATERIAL=zA,e.GBUFFER_EFFECT_WRITE_ZERO=VA,e.GBUFFER_EMISSIVE_LOCATION_DEFINE=jA,e.GBUFFER_NORMAL_LOCATION_DEFINE=DA,e.GBUFFER_NORMAL_WRITE_BASIC=LA,e.GBUFFER_NORMAL_WRITE_PHYSICAL=IA,e.GBUFFER_PARS_FRAGMENT=EA,e.GBUFFER_SHADOW_LOCATION_DEFINE=NA,e.GBUFFER_TEXTURE_INDEX=xA,e.GEOMETRY_TYPES=kF,e.GlyphKind=yR,e.InstancedMesh=GI,e.InstancedMeshDesc=EP,e.InstancedSpriteMesh=vR,e.JAPAN_GSI_ELEVATION_DECODER=yC,e.Layer=cz,e.LightDesc=DP,e.LightDescRegistry=hE,e.LightHandle=AP,e.MAPBOX_ELEVATION_DECODER=bC,e.MAX_BATCH_TEXTURE_WIDTH=pI,e.MB=WP,e.MODEL_BATCH_TEXTURE_CONFIG=CI,e.MRTPassEffectDesc=qB,e.MeshDesc=mP,e.MeshDescRegistry=gE,e.MeshDescWithSelectiveEffect=hP,e.MeshHandle=kP,e.ModelMesh=wI,e.NORMAL_PACKING_SHADER=IB,e.NVR_BLENDED_DEFINE=rP,e.NVR_LIT_DEFINE=eP,e.NVR_UNLIT_DEFINE=tP,e.NVR_UNLIT_SCENE_DEFINE=nP,e.NormalCopyPass=VB,e.POLYGON_BATCH_TEXTURE_ROWS=DI,e.POLYLINE_BATCH_TEXTURE_ROWS=OI,e.Pass=sE,e.PickableInstancedMeshWrapper=XL,e.PickableMesh=TI,e.PickableMeshWrapper=YL,e.PickableMultiInstancedMeshWrapper=ZL,e.Plugin=_o,e.PolygonMesh=LI,e.PolygonOutlineMesh=HI,e.PolylineMesh=BI,e.RTE_ONE_UNIFORM=qc,e.Registries=_E,e.RenderPass=uE,e.RenderTargetCopyPass=UB,e.SKY_RENDER_ORDER=iz,e.STARS_ASSETS_URL=dC,e.STARS_RENDER_ORDER=az,e.STBN_URL=gC,e.SelectiveEffectDesc=YB,e.SelectiveEffectRegistry=NP,e.ShaderLib=xE,e.SkyEnvMapEffectDesc=XB,e.SkyEnvMapPass=KB,e.Source=sz,e.TERRARIUM_ELEVATION_DECODER=xC,e.TILE_EMISSIVE_EFFECT_BUFFER_REPLACEMENT=mM,e.TILE_NORMAL_BUFFER_REPLACEMENT=pM,e.TILE_PICK_FRAGMENT_OVERRIDE=hM,e.TILE_VERTEX_INJECTIONS=gM,e.TileMesh=UL,e.TransparentPassEffectDesc=ZB,e.USE_GBUFFER_EMISSIVE_DEFINE=AA,e.USE_GBUFFER_SELECTIVE_EFFECT_DEFINE=OA,e.USE_GBUFFER_SHADOW_DEFINE=MA,e.UnknownTypeError=yE,e.VALID_GEOMETRY_TYPES=AF,e.ViewContext=PP,e.WATERMASK_OCEAN_REFLECTIVITY=cM,e.WATERMASK_OCEAN_ROUGHNESS=lM,e.WATER_NORMAL_URL=_C,e.appendOptionalGBufferAttachments=UA,e.applyLitOption=iP,e.assertNoTransformConflict=fP,e.batchBaseIndex=vI,e.blendFunction=gA,e.breakLines=GR,e.buildLabelLayout=JR,e.calcCameraPosition=$c,e.calcModelMatrixRTE=Yc,e.cascadedShadowMaps=pb,e.composeWorldMatrixForRTE=Xc,e.computeGBufferDefines=FA,e.computeGBufferTextureIndex=TA,e.convertScreenToWorld=ol,e.convertWorldToScreen=ml,e.createFullscreenQuad=JB,e.createGBufferAttachments=HA,e.createInstancedSpriteMaterialEnhancer=Wj,e.createPolygonMaterialEnhancer=lj,e.createPolylineMaterialEnhancer=Mj,e.createReplacer=Q,e.createSdfTextMaterialEnhancer=sM,e.createShadowMapDepthEnhancer=gj,e.default=NH,e.degreeToRadian=il,e.depth=mb,e.eastNorthUpToFixedFrame=cl,e.encodeFloatToRGBA=uI,e.encodePositionRTE=Jc,e.fetchFontFamilyFromCss=So,e.generateTileCommonInjection=uM,e.generateTileMapFragment=dM,e.generateTileNormalFragmentMaps=fM,e.generators=hb,e.geodeticSurfaceNormal=sl,e.geodeticToVector3=nl,e.getBatchDataTexture=_I,e.getDefaultCacheBytes=nF,e.getDefaultDynamicSse=yF,e.getDefaultLodFog=_F,e.getDefaultMemoryBudgets=dF,e.getHeightFromEllipsoid=Kc,e.getPickRay=Wc,e.getPlaneFromPointNormal=Uc,e.getRayPlaneIntersection=Gc,e.getRowIndex=gI,e.getWGS84Eccentricity=yl,e.getWGS84EccentricitySquared=_l,e.getWGS84Flattening=vl,e.getWGS84SemiMajorAxis=hl,e.getWGS84SemiMinorAxis=gl,e.headingPitchRollToFixedFrame=pl,e.initBatchDataTexture=hI,e.initBatchedMaterial=mI,e.initNavaraApi=tl,e.interleavedGradientNoise=gb,e.isAttributionHtml=fV,e.isFeatureMesh=WI,e.isPickableMesh=EI,e.isRtlText=WR,e.lineWidthFu=HR,e.math=_b,e.mergeGeodetic=pP,e.northEastDownToFixedFrame=ll,e.northUpEastToFixedFrame=ul,e.northWestUpToFixedFrame=dl,e.overrideMaterialsForMRT=cP,e.packShowOpacity=dI,e.packing=vb,e.parseCssUnicodeRange=bo,e.parseFontFamilyFromCss=xo,e.radianToDegree=al,e.raySphereIntersection=yb,e.resolveGBufferOptions=CA,e.setRTCPosition=II,e.setRTEPosition=FI,e.setupMaterialForDrape=nz,e.setupMaterialForMRT=dP,e.setupRTEBeforeRender=PI,e.setupRTECallback=NI,e.setupSelectiveEffectUniforms=IP,e.transform=bb,e.turbo=xb,e.unionGBufferRequirements=wA,e.unpackShowOpacity=fI,e.updateBatchAttribute=yI,e.vector3ToGeodetic=rl,e.vogelDisk=Sb,e.westUpNorthToFixedFrame=fl});
6930
+ #endif`),e.vertexShader=ZV(ZV(e.vertexShader,`#include <shadowmap_pars_vertex>`,`#include <shadowmap_pars_vertex>\n${XV}`),`#include <shadowmap_vertex>`,n)}function $V(e,t,n){n.length=e.length;for(let i=0;i<e.length;i++)(n[i]??(n[i]=new r.Matrix4)).multiplyMatrices(e[i].shadow.matrix,t)}var eH=class{map=new Map;setup(e,t){if(this.map.has(e))return e;e.userData.defines??={},e.userData.defines.CSM=1,e.userData.defines.CSM_CASCADE_COUNT=t.cascadeCount,t.fade&&(e.userData.defines.CSM_FADE=1);let n={};this.map.set(e,n);let r=(e,r)=>{n.parameters=e,t.captureRenderer(r);let i=t.cascades,a=t.mainCamera.near,o=Math.min(t.mainCamera.far,t.far),s=e.uniforms;s.csmCascades={value:i},s.csmNear={value:a},s.csmFar={value:o},e.fragmentShader=YV(e.fragmentShader),QV(e,t.shadowMatricesViewUniform)},i=e.onBeforeCompile.bind(e),a=e.customProgramCacheKey.bind(e);Object.prototype.hasOwnProperty.call(e,`hasOwnProperty`)&&(n.originalHandler=i),e.customProgramCacheKey=()=>i.toString()+a(),e.onBeforeCompile=(...t)=>{let[n]=t;n.defines??={},Object.assign(n.defines,e.userData.defines),i.apply(e,t),r(...t)};let o=()=>{this.map.delete(e),e.removeEventListener(`dispose`,o)};return e.addEventListener(`dispose`,o),e}update(e){let t=e.cascadeCount,n=e.fade,r=e.cascades,i=e.mainCamera.near,a=Math.min(e.mainCamera.far,e.far);for(let[e,o]of this.map.entries()){let s=e.userData.defines;if(s!=null){let r=!1;s.CSM_FADE!=null!==n&&(n?s.CSM_FADE=1:delete s.CSM_FADE,r=!0),s.CSM_CASCADE_COUNT!==t&&(s.CSM_CASCADE_COUNT=t,r=!0),r&&(e.needsUpdate=!0)}let c=o.parameters?.uniforms;c!=null&&(c.csmCascades.value=r,c.csmNear.value=i,c.csmFar.value=a)}}rollback(e){let t=this.map.get(e);return t==null?e:this.rollbackToState(e,t)}rollbackToState(e,{parameters:t,originalHandler:n}){return t!=null&&(delete t.uniforms.csmCascades,delete t.uniforms.csmNear,delete t.uniforms.csmFar,delete t.uniforms.nvrCsmShadowMatrixView),n==null?delete e.onBeforeCompile:e.onBeforeCompile=n,e.userData.defines!=null&&(delete e.userData.defines.CSM,delete e.userData.defines.CSM_CASCADE_COUNT,delete e.userData.defines.CSM_FADE),e.needsUpdate=!0,this.map.delete(e),e}dispose(){for(let[e,t]of this.map)this.rollbackToState(e,t);this.map.clear()}};Math.PI/180,180/Math.PI;function tH(e,t,n){return(1-n)*e+n*t}var nH={uniform:(e,t,n,r,i=[])=>{for(let r=0;r<e;++r)i[r]=(t+(n-t)*(r+1)/e)/n;return i.length=e,i},logarithmic:(e,t,n,r,i=[])=>{for(let r=0;r<e;++r)i[r]=t*(n/t)**((r+1)/e)/n;return i.length=e,i},practical:(e,t,n,r=.5,i=[])=>{for(let a=0;a<e;++a){let o=(t+(n-t)*(a+1)/e)/n,s=t*(n/t)**((a+1)/e)/n;i[a]=tH(o,s,r)}return i.length=e,i}};function rH(e,t,n,r,i,a=[]){return nH[e](t,n,r,i,a)}var iH=new r.Vector3,aH=new r.Vector3,oH=new r.Matrix4,sH=new r.Matrix4,cH=new zV,lH=new r.Box3,uH={cascadeCount:4,mapSize:2048,far:5e3,mode:`practical`,lambda:.5,margin:200,fade:!0,disableLastCascadeCutoff:!1},dH=class{mainCamera;needsUpdateFrusta=!0;directionalLights=new IV;materialStates=new eH;mainFrustum=new zV;cascadedFrusta=[];splits=[];cascades=[];_far;_mode;_lambda;_margin;_fade;_disableLastCascadeCutoff;_shadowMatricesView=[];_shadowMatricesViewFrame=-1;_renderer=null;shadowMatricesViewUniform;constructor(e,t){this.mainCamera=e;let n=()=>(this.refreshShadowMatricesView(),this._shadowMatricesView);this.shadowMatricesViewUniform={get value(){return n()}};let{cascadeCount:r,mapSize:i,far:a,mode:o,lambda:s,margin:c,fade:l,disableLastCascadeCutoff:u}={...uH,...t};this._far=a,this._mode=o,this._lambda=s,this._margin=c,this._fade=l,this._disableLastCascadeCutoff=u,this.cascadeCount=r,this.mapSize=i}dispose(){this.materialStates.dispose(),this.directionalLights.dispose()}setupMaterial(e){return this.materialStates.setup(e,this)}captureRenderer(e){this._renderer??=e}refreshShadowMatricesView(){let e=this._renderer?.info.render.frame??-1;(e===-1||e!==this._shadowMatricesViewFrame)&&(this._shadowMatricesViewFrame=e,$V(this.directionalLights.cascadedLights,this.mainCamera.matrixWorld,this._shadowMatricesView))}rollbackMaterial(e){return this.materialStates.rollback(e)}setupMaterials(e){for(let t=0;t<e.length;++t)this.materialStates.setup(e[t],this);return()=>{for(let t=0;t<e.length;++t)this.materialStates.rollback(e[t])}}updateCascades(){let e=this.cascadeCount,t=this.splits;rH(this.mode,e,this.mainCamera.near,Math.min(this.mainCamera.far,this.far),this.lambda,t),this.mainFrustum.setFromCamera(this.mainCamera,this.far),this.mainFrustum.split(t,this.cascadedFrusta);let n=this.cascades;for(let i=0;i<e;++i)(n[i]??(n[i]=new r.Vector2)).set(t[i-1]??0,t[i]??0);this.disableLastCascadeCutoff&&(n[e-1].y=1/0),n.length=e}getFrustumRadius(e){let t=e.near,n=e.far,r=Math.max(n[0].distanceTo(n[2]),n[0].distanceTo(t[2]));if(this.fade){let e=this.mainCamera,t=e.near,i=Math.min(e.far,this.far),a=n[0].z/(i-t);r+=.25*a**2*(i-t)}return r*.5}updateShadowBounds(){let e=this.cascadedFrusta,t=this.directionalLights.cascadedLights;RV(e.length===t.length);for(let n=0;n<e.length;++n){let e=this.getFrustumRadius(this.cascadedFrusta[n]),r=t[n].shadow.camera;r.left=-e,r.right=e,r.top=e,r.bottom=-e,r.near=0,r.far=e*2+this.margin,r.updateProjectionMatrix()}}updateFrusta(){this.updateCascades(),this.updateShadowBounds(),this.materialStates.update(this)}update(){this.needsUpdateFrusta&&(this.needsUpdateFrusta=!1,this.updateFrusta());let e=this.directionalLights,t=iH.copy(e.direction).normalize(),n=oH.lookAt(new r.Vector3,t,r.Object3D.DEFAULT_UP),i=sH.multiplyMatrices(sH.copy(n).invert(),this.mainCamera.matrixWorld),a=this.margin,o=this.mapSize,s=this.cascadedFrusta,c=e.cascadedLights;for(let e=0;e<s.length;++e){let{near:r,far:l}=cH.copy(s[e]).applyMatrix4(i),u=lH.makeEmpty();for(let e=0;e<4;e++)u.expandByPoint(r[e]),u.expandByPoint(l[e]);let d=u.getCenter(aH);d.z=u.max.z+a;let f=c[e],{left:p,right:m,top:h,bottom:g}=f.shadow.camera,_=(m-p)/o,v=(h-g)/o;d.x=Math.round(d.x/_)*_,d.y=Math.round(d.y/v)*v,d.applyMatrix4(n),f.position.copy(d),f.target.position.copy(d),f.target.position.add(t)}}get cascadeCount(){return this.directionalLights.cascadedLights.length}set cascadeCount(e){e!==this.cascadeCount&&(this.directionalLights.setCount(e),this.needsUpdateFrusta=!0)}get mapSize(){return this.directionalLights.mainLight.shadow.mapSize.width}set mapSize(e){if(e!==this.mapSize){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n){let r=t[n].shadow;r.mapSize.width=e,r.mapSize.height=e,r.map!=null&&(r.map.dispose(),r.map=null)}}}get far(){return this._far}set far(e){e!==this._far&&(this._far=e,this.needsUpdateFrusta=!0)}get mode(){return this._mode}set mode(e){e!==this._mode&&(this._mode=e,this.needsUpdateFrusta=!0)}get lambda(){return this._lambda}set lambda(e){e!==this._lambda&&(this._lambda=e,this.needsUpdateFrusta=!0)}get margin(){return this._margin}set margin(e){e!==this._margin&&(this._margin=e,this.needsUpdateFrusta=!0)}get fade(){return this._fade}set fade(e){e!==this._fade&&(this._fade=e,this.needsUpdateFrusta=!0)}get disableLastCascadeCutoff(){return this._disableLastCascadeCutoff}set disableLastCascadeCutoff(e){e!==this._disableLastCascadeCutoff&&(this._disableLastCascadeCutoff=e,this.needsUpdateFrusta=!0)}get intensity(){return this.directionalLights.mainLight.intensity}set intensity(e){if(e!==this.intensity){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].intensity=e}}get shadowIntensity(){return this.directionalLights.mainLight.shadow.intensity}set shadowIntensity(e){if(e!==this.shadowIntensity){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.intensity=e}}get color(){return this.directionalLights.mainLight.color}set color(e){e!==this.color&&this.directionalLights.mainLight.color.copy(e)}get bias(){return this.directionalLights.mainLight.shadow.bias}set bias(e){if(e!==this.bias){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.bias=e}}get normalBias(){return this.directionalLights.mainLight.shadow.normalBias}set normalBias(e){if(e!==this.normalBias){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.normalBias=e}}get radius(){return this.directionalLights.mainLight.shadow.radius}set radius(e){if(e!==this.radius){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.radius=e}}get blurSamples(){return this.directionalLights.mainLight.shadow.blurSamples}set blurSamples(e){if(e!==this.blurSamples){let t=this.directionalLights.cascadedLights;for(let n=0;n<t.length;++n)t[n].shadow.blurSamples=e}}},fH=class extends r.Group{csm;displayFrustum=!0;displayPlanes=!0;displayShadowBounds=!0;frustumLines;cascadeLines=[];cascadePlanes=[];shadowLines=[];constructor(e){super(),this.csm=e;let t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),i=new r.BufferGeometry;i.setIndex(new r.BufferAttribute(t,1)),i.setAttribute(`position`,new r.BufferAttribute(n,3,!1));let a=new r.LineSegments(i,new r.LineBasicMaterial);this.add(a),this.frustumLines=a}updateVisibility(){let e=this.displayFrustum,t=this.displayPlanes,n=this.displayShadowBounds,r=this.frustumLines,i=this.cascadeLines,a=this.cascadePlanes,o=this.shadowLines;for(let r=0,s=i.length;r<s;r++){let s=i[r],c=a[r],l=o[r];s.visible=e,c.visible=e&&t,l.visible=n}r.visible=e}update(){let e=this.csm,t=e.mainCamera,n=e.cascadeCount,i=e.mainFrustum,a=e.cascadedFrusta,o=e.directionalLights.cascadedLights,s=this.frustumLines.geometry.getAttribute(`position`),c=this.cascadeLines,l=this.cascadePlanes,u=this.shadowLines;for(this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.updateMatrixWorld(!0);c.length>n;){let e=c.pop(),t=l.pop(),n=u.pop();e&&this.remove(e),t&&this.remove(t),n&&this.remove(n)}for(;c.length<n;){let e=new r.Box3Helper(new r.Box3,new r.Color(16777215)),t=new r.MeshBasicMaterial({transparent:!0,opacity:.1,depthWrite:!1,side:r.DoubleSide}),n=new r.Mesh(new r.PlaneGeometry,t),i=new r.Group,a=new r.Box3Helper(new r.Box3,new r.Color(16776960));i.add(a),this.add(e),this.add(n),this.add(i),c.push(e),l.push(n),u.push(i)}for(let e=0;e<n;e++){let t=a[e],n=o[e].shadow.camera,r=t.far,i=c[e],s=l[e],d=u[e],f=d.children[0];i.box.min.copy(r[2]),i.box.max.copy(r[0]),i.box.max.z+=1e-4,s.position.addVectors(r[0],r[2]),s.position.multiplyScalar(.5),s.scale.subVectors(r[0],r[2]),s.scale.z=1e-4,this.remove(d),d.position.copy(n.position),d.quaternion.copy(n.quaternion),d.scale.copy(n.scale),d.updateMatrixWorld(!0),this.attach(d),f.box.min.set(n.bottom,n.left,-n.far),f.box.max.set(n.top,n.right,-n.near)}let d=i.near,f=i.far;s.setXYZ(0,f[0].x,f[0].y,f[0].z),s.setXYZ(1,f[3].x,f[3].y,f[3].z),s.setXYZ(2,f[2].x,f[2].y,f[2].z),s.setXYZ(3,f[1].x,f[1].y,f[1].z),s.setXYZ(4,d[0].x,d[0].y,d[0].z),s.setXYZ(5,d[3].x,d[3].y,d[3].z),s.setXYZ(6,d[2].x,d[2].y,d[2].z),s.setXYZ(7,d[1].x,d[1].y,d[1].z),s.needsUpdate=!0}},pH=class{viewers=[];lights;enabled=!1;constructor(e){this.lights=e}render(e){if(!this.enabled||!e.shadowMap.enabled)return;let t=this.lights.children.find(e=>e instanceof IV);if(this.viewers.length&&t?.cascadedLights.length===this.viewers.length){this.viewers.forEach(t=>{t&&t.render(e)});return}this.viewers.length=0,t&&t.cascadedLights.forEach((e,t)=>{if(e.shadow.map&&e.shadow.map.texture){let n=new xM(e);n.position.set(0,100*t),n.size.set(100,100),this.viewers.push(n)}})}},mH=p(d(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):n.Stats=r()})(e,function(){var e=function(){function t(e){return i.appendChild(e.dom),e}function n(e){for(var t=0;t<i.children.length;t++)i.children[t].style.display=t===e?`block`:`none`;r=e}var r=0,i=document.createElement(`div`);i.style.cssText=`position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000`,i.addEventListener(`click`,function(e){e.preventDefault(),n(++r%i.children.length)},!1);var a=(performance||Date).now(),o=a,s=0,c=t(new e.Panel(`FPS`,`#0ff`,`#002`)),l=t(new e.Panel(`MS`,`#0f0`,`#020`));if(self.performance&&self.performance.memory)var u=t(new e.Panel(`MB`,`#f08`,`#201`));return n(0),{REVISION:16,dom:i,addPanel:t,showPanel:n,begin:function(){a=(performance||Date).now()},end:function(){s++;var e=(performance||Date).now();if(l.update(e-a,200),e>o+1e3&&(c.update(1e3*s/(e-o),100),o=e,s=0,u)){var t=performance.memory;u.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){a=this.end()},domElement:i,setMode:n}};return e.Panel=function(e,t,n){var r=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,c=48*o,l=3*o,u=2*o,d=3*o,f=15*o,p=74*o,m=30*o,h=document.createElement(`canvas`);h.width=s,h.height=c,h.style.cssText=`width:80px;height:48px`;var g=h.getContext(`2d`);return g.font=`bold `+9*o+`px Helvetica,Arial,sans-serif`,g.textBaseline=`top`,g.fillStyle=n,g.fillRect(0,0,s,c),g.fillStyle=t,g.fillText(e,l,u),g.fillRect(d,f,p,m),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d,f,p,m),{dom:h,update:function(c,_){r=Math.min(r,c),i=Math.max(i,c),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,s,f),g.fillStyle=t,g.fillText(a(c)+` `+e+` (`+a(r)+`-`+a(i)+`)`,l,u),g.drawImage(h,d+o,f,p-o,m,d,f,p-o,m),g.fillRect(d+p-o,f,o,m),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d+p-o,f,o,a((1-c/_)*m))}}},e})}))(),1),hH=1e3,gH=class{stats;renderer;drawCalls;numTriangles;memGeometries;wasmMemory;jsMemory;memorySampler;lastMemorySampleAt=0;maxWasmMB=1;maxJsHeapMB=1;constructor(e,t){this.stats=new mH.default,this.renderer=e,this.memorySampler=t,this.drawCalls=this.stats.addPanel(new mH.default.Panel(`Draws`,`#0ff`,`#002`)),this.numTriangles=this.stats.addPanel(new mH.default.Panel(`Triangles`,`#0fff57`,`#013a12`)),this.memGeometries=this.stats.addPanel(new mH.default.Panel(`Geometries`,`#ffa100`,`#301e00`)),this.wasmMemory=this.stats.addPanel(new mH.default.Panel(`WASM MB`,`#f08`,`#201`)),this.jsMemory=this.stats.addPanel(new mH.default.Panel(`JS MB`,`#f4f`,`#210`)),this.stats.showPanel(0)}begin(){this.renderer.beginRender(),this.stats.begin()}end(){let e=this.renderer.endRender();e.calls&&this.drawCalls.update(e.calls,500),e.triangles&&this.numTriangles.update(e.triangles,500),e.memGeometries&&this.memGeometries.update(e.memGeometries,500),this.sampleMemory(),this.stats.end()}sampleMemory(){if(!this.memorySampler)return;let e=performance.now();if(e-this.lastMemorySampleAt<hH)return;this.lastMemorySampleAt=e;let t=this.memorySampler();t&&(t.wasmMB!==void 0&&(this.maxWasmMB=Math.max(this.maxWasmMB,t.wasmMB),this.wasmMemory.update(t.wasmMB,t.budgetMB??this.maxWasmMB)),t.jsHeapMB!==void 0&&(this.maxJsHeapMB=Math.max(this.maxJsHeapMB,t.jsHeapMB),this.jsMemory.update(t.jsHeapMB,this.maxJsHeapMB)))}get dom(){return this.stats.dom}},_H=20,vH={r_scaler:0,g_scaler:0,b_scaler:0,offset:0,max_offset:0,min_offset:0,boundary:0,epsilon:0},yH=6,bH=3,xH=2,SH=200;async function CH(e,t,r){if(t.length===0)return[];let i=wH(e),a=r?.signal;jH(a);let o=TH(r?.level??i.maxZoom,i),s=r?.level==null?i.minZoom:o,c=new Float64Array(t.length*2);t.forEach((e,t)=>{c[t*2]=(0,n.angleToRadian)(e.lng),c[t*2+1]=(0,n.angleToRadian)(e.lat)});let l=(0,n.terrainPositionsToTiles)(i.geographic,o,c),u=new Map;for(let e=0;e<t.length;e++){let t=l[e*2],n=l[e*2+1],r=`${t}/${n}`,i=u.get(r);i||(i={x:t,y:n,indices:[]},u.set(r,i)),i.indices.push(e)}let d=t.map(e=>({lat:e.lat,lng:e.lng,height:void 0,level:void 0})),f=new Map,p=AH(yH);return await Promise.all([...u.values()].map(async e=>{let t=new Float64Array(e.indices.length*2);e.indices.forEach((e,n)=>{t[n*2]=c[e*2],t[n*2+1]=c[e*2+1]});let n=await EH(i,e,o,s,f,p,a);if(!n)return;let r=await OH(i,n,t,a);r&&e.indices.forEach((e,t)=>{let i=r[t];i!==void 0&&Number.isFinite(i)&&(d[e].height=i,d[e].level=n.level)})})),d}function wH(e){let t=e.url;if(!t)throw TypeError(`sampleTerrainMostDetailed: source.url is required`);if(e.type===`quantized-mesh`)return{kind:`quantized-mesh`,url:t,geographic:e.geographic??!0,tms:e.tms??!0,minZoom:e.minZoom??0,maxZoom:e.maxZoom??_H,token:e.token??void 0,decoder:vH};let n=e;return{kind:`raster-dem`,url:t,geographic:!1,tms:n.tms??!1,minZoom:n.minZoom??0,maxZoom:n.maxZoom??_H,token:void 0,decoder:{...vH,...n.elevationDecoder}}}function TH(e,t){return Math.min(Math.max(Math.floor(e),t.minZoom),t.maxZoom)}async function EH(e,t,r,i,a,o,s){let c=r;for(;c>=i;){let l=Math.max(c-(c===r?1:bH)+1,i),u=[];for(let e=c;e>=l;e--)u.push(e);let d=await Promise.all(u.map(i=>{let c=r-i,l=t.x>>c,u=t.y>>c,d=(0,n.terrainTileUrl)(e.url,e.geographic,e.tms,l,u,i),f=a.get(d);return f||(f=o(()=>DH(e,d,s)),a.set(d,f)),f.then(e=>({level:i,x:l,y:u,outcome:e}))}));for(let{level:e,x:t,y:n,outcome:r}of d){if(r.kind===`ok`)return{x:t,y:n,level:e,response:r.response};if(r.kind===`failed`)return null}c=l-1}return null}async function DH(e,t,n){let r={};e.kind===`quantized-mesh`&&(r.Accept=`application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01`),e.token&&(r.Authorization=`Bearer ${e.token}`);for(let e=0;;e++){jH(n);let i;try{i=await fetch(t,{headers:r,signal:n})}catch(t){if(n?.aborted)throw t;if(e<xH){await MH(SH*2**e);continue}return{kind:`failed`}}if(i.ok)return{kind:`ok`,response:i};if(i.status===404||i.status===410)return{kind:`missing`};if(i.status===401||i.status===403)throw Error(`sampleTerrainMostDetailed: ${i.status} ${i.statusText} for ${t} — check the source's token`);if(i.status>=500&&e<xH){await MH(SH*2**e);continue}return{kind:`failed`}}}async function OH(e,t,r,i){if(e.kind===`quantized-mesh`){let a=new Uint8Array(await t.response.arrayBuffer());return jH(i),(0,n.sampleQuantizedMeshHeights)(a,e.geographic,t.x,t.y,t.level,r)??null}let a=await kH(await t.response.blob());return jH(i),a?(0,n.sampleRasterDemHeights)(a,e.decoder,t.x,t.y,t.level,r)??null:null}async function kH(e){if(Th())try{let t=await DF(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch{return null}let t;try{t=await createImageBitmap(e)}catch{return null}try{let e=new OffscreenCanvas(t.width,t.height).getContext(`2d`);if(!e)return null;e.drawImage(t,0,0);let n=e.getImageData(0,0,t.width,t.height);return new Uint8Array(n.data.buffer,0,n.data.length)}finally{t.close()}}function AH(e){let t=0,n=[],r=()=>{t--,n.shift()?.()};return async i=>{t>=e&&await new Promise(e=>n.push(e)),t++;try{return await i()}finally{r()}}}function jH(e){if(e?.aborted)throw e.reason instanceof Error?e.reason:new DOMException(`The operation was aborted.`,`AbortError`)}function MH(e){return new Promise(t=>setTimeout(t,e))}function NH(e,t){return e.bits===t&&e.height!=null}var PH=``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/index-VfUncKuS.js`).href:new URL(`assets/index-VfUncKuS.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),FH={linear:0,quadInOut:1,cubicInOut:2,cubicOut:3,quinticInOut:4},IH=class extends M{_camera;_renderer;_globe;_atmosphere;skyEnvMap;mrtPass;transparentPass;finalPass;renderPassOrchestrator;_scenes;_core;_fontManager=new Lc(Bc);_options;_stats;_eventDisposer;_disposed=!1;_renderFlag={forceUpdate:!1,animation:!1};_declutter=new LP(RP);_declutterSize=new r.Vector2;_declutterRetry;_declutterRetryDelay=0;_isIdle=!1;_uniforms;_pendingFlights=new Map;_hoveredFeature=null;_meshes=new Map;_abortControllers=new Map;_workerPoolPromises=new Map;_loadedTexs=new Map;_texturizedSceneByTileCoordinates;_tileTextureCompositor;_tileMapByHandle=new Map;_textureFragmentIndex=new Map;_tileMeshToFragmentIds=new Map;_hillshadeContext=new yB;_initialized=!1;_inMemoryBufferStore=new MB;_buf={u8:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Uint8Array?t:this._core?.getBufferU8(e)??null},f32:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Float32Array?t:this._core?.getBufferF32(e)??null},f64:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Float64Array?t:this._core?.getBufferF64(e)??null},u32:e=>{let t=this._inMemoryBufferStore.get(e);return t instanceof Uint32Array?t:this._core?.getBufferU32(e)??null},removeU8:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Uint8Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferU8(e)??null},removeU32:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Uint32Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferU32(e)??null},removeF32:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Float32Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferF32(e)??null},removeF64:e=>{let t=this._inMemoryBufferStore.take(e);return t instanceof Float64Array?(this._core?.removeBuffer(e),t):this._core?.removeBufferF64(e)??null},setU8:(e,t,n)=>{this._core?.hasDataRequester(t)&&this._core?.setBufferU8(e,t,n.length,e=>{e.set(n)})},newU8:e=>this._core?.newBufferU8(e.length,t=>{t.set(e)}),newU32:e=>this._core?.newBufferU32(e.length,t=>{t.set(e)}),newF32:e=>this._core?.newBufferF32(e.length,t=>{t.set(e)}),newF64:e=>this._core?.newBufferF64(e.length,t=>{t.set(e)}),adoptU8:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},adoptU32:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},adoptF32:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},adoptF64:e=>{let t=this._core?.newExternalBuffer(e.byteLength);return t!=null&&this._inMemoryBufferStore.set(t,e),t},setExternal:(e,t,n)=>{this._core?.hasDataRequester(t)&&(this._core.setExternalBuffer(e,t,n.byteLength),this._inMemoryBufferStore.set(e,n))},remove:e=>{this._inMemoryBufferStore.delete(e),this._core?.removeBuffer(e)},drainRemovedExternalHandles:()=>{let e=this._core?.drainRemovedExternalHandles();if(e)for(let t of e)this._inMemoryBufferStore.delete(t)},triggerDataRequesterLoaded:(e,t)=>{this._core?.triggerDataRequesterLoaded(e,t)},triggerDataRequesterFailed:e=>{this._core?.triggerDataRequesterFailed(e)}};_texFragment={triggerTextureFragmentLoaded:(e,t)=>{this._core?.triggerTextureFragmentLoaded(e,t)}};_vectorRevision=0;_rasterRevision=0;_tileHandler=jB({getCore:()=>this._core,getVectorRevision:()=>this._vectorRevision,getRasterRevision:()=>this._rasterRevision});_globeHandler={getTransparent:()=>this._core?.getGlobeTransparent(),getMaxSse:()=>this._core?.getGlobeMaxSse(),getSegments:()=>this._core?.getGlobeSegments(),getColor:()=>{let e=this._core?.getGlobeColor();return e===void 0?void 0:new nE().setHex(e)},getHideUnderground:()=>this._core?.getGlobeHideUnderground(),getUseNormal:()=>this._core?.getGlobeUseNormal(),getOpacity:()=>this._core?.getGlobeOpacity(),getWireframe:()=>this._core?.getGlobeWireframe(),getElevationColormap:()=>this._core?.getGlobeElevationColormap(),setTransparent:e=>{this._core?.setGlobeTransparent(e)},setMaxSse:e=>{this._core?.setGlobeMaxSse(e)},setSegments:e=>{this._core?.setGlobeSegments(e)},setColor:e=>{this._core?.setGlobeColor(e.toHex())},setHideUnderground:e=>{this._core?.setGlobeHideUnderground(e)},setUseNormal:e=>{this._core?.setGlobeUseNormal(e)},setOpacity:e=>{this._core?.setGlobeOpacity(e)},setWireframe:e=>{this._core?.setGlobeWireframe(e)},setElevationColormap:e=>{this._core?.setGlobeElevationColormap(e.flatten());let t=e.createImage(),n=new r.Texture(t);n.wrapS=r.ClampToEdgeWrapping,n.wrapT=r.ClampToEdgeWrapping,n.minFilter=r.LinearFilter,n.magFilter=r.LinearFilter,n.generateMipmaps=!1,n.flipY=!1,n.needsUpdate=!0,this._uniforms.colorMapTexture.value=n,this._defaultTextureOptions.additionalTexturesInUse={...this._defaultTextureOptions.additionalTexturesInUse,colorMapTexture:!0}}};_workerTaskHandler={triggerWorkerTaskCompleted:(e,t)=>{this._core?.triggerWorkerTaskCompleted(e,t)},triggerWorkerTaskFailed:e=>{this._core?this._core.triggerWorkerTaskFailed(e):e.free()},hasWorkerTask:e=>!!this._core?.hasWorkerTask(e)};_featureHandler={getTransferablePolygonBatchedFeature:e=>this._core?.getTransferablePolygonBatchedFeature(e),getTransferablePolylineBatchedFeature:e=>this._core?.getTransferablePolylineBatchedFeature(e),markFeatureIsRendered:(e,t)=>{this._core?.markFeatureIsRendered(e,t)},reportFeatureGpuBytes:(e,t)=>{this._core?.reportFeatureGpuBytes(e,t)},readAllBatchedProperties:(e,t)=>this._core?.readAllBatchedProperties(e,t),readFilteredBatchedProperties:(e,t,n)=>this._core?.readFilteredBatchedProperties(e,t,n)};_meshHandler={setTileMeshPrepared:e=>{this._core?.setTileMeshPrepared(e)}};_layerHandler={getLayerIndex:e=>this._core?.getLayerIndex(e)};_ownedRootElement;_eventManager=new x;_pickHelper;_terrainPicker;_defaultTextureOptions;layersManager=new lz;shadowMapViewers;eventContext;registries;viewContext;plugins=[];_attribution;_buffers;_lit=!0;pixelRatioMatchedMedia;fixedGpuBytesReportScheduled=!1;fixedGpuBytesResyncPending=!1;framesSinceFixedGpuBytesReport=0;lastReportedFixedGpuBytes=-1;get attribution(){return this._attribution}get buffers(){return this._buffers}get lit(){return this._lit}set lit(e){this._lit!==e&&(this._lit=e,this.viewContext._setLit(e),this.forceUpdate())}constructor(e={}){if(super(),cP(),this._buffers=CA(),!e.canvas){let t=document.createElement(`div`);t.id=`navara-root`,t.style.width=`100vw`,t.style.height=`100vh`,e.canvas=document.createElement(`canvas`),e.canvas.id=`navara-canvas`,e.canvas.style.width=`100%`,e.canvas.style.height=`100%`,t.appendChild(e.canvas),document.body.appendChild(t),this._ownedRootElement=t}if(this._options=e,e.defaultAttribution!==!1&&!dA()){let t=typeof e.defaultAttribution==`object`?e.defaultAttribution:void 0;this._attribution=new PV(t),this.addPlugin(this._attribution)}this._terrainPicker=new mV,e.canvas?.addEventListener(`contextmenu`,e=>{e.preventDefault()});let t=new r.WebGLRenderer({antialias:(e.multisampling??0)>0,logarithmicDepthBuffer:e.logarithmicDepthBuffer??!0,canvas:e.canvas,stencil:!0});t.info.autoReset=!1,t.autoClearStencil=!1,t.autoClearColor=!1,t.autoClearDepth=!1,this._renderer=t,t.shadowMap.enabled=!!e.shadow,this._renderer.shadowMap.type=r.PCFShadowMap,t.shadowMap.autoUpdate=!1;let{width:n,height:i}=this._getCanvasSize()??{};if(z(n&&i),typeof e?.pixelRatio==`number`||!dA()){let n=dA()?1:bF({override:e.pixelRatio,mobileOptimization:e.mobileOptimization});t.setPixelRatio(n)}t.setSize(n,i,!dA()),e.container&&e.container.appendChild(t.domElement),this._texturizedSceneByTileCoordinates=new AL(this._renderer),this._tileTextureCompositor=new NL({renderer:this._renderer,texturizedSceneByTileCoordinates:this._texturizedSceneByTileCoordinates,mercatorY:this._tileHandler.mercatorY,size:lF(this.isMobileOptimized())}),this._scenes={light:new r.Group,mrt:new r.Scene,globe:new r.Scene,draped:new r.Scene,opaque:new r.Scene,transparent:new r.Scene,skyEnvMap:new r.Scene},this._camera=new aC,this.renderPassOrchestrator=new aV(this._renderer,{halfFloat:e.halfFloat??!0,multisampling:e.multisampling}),this.renderPassOrchestrator.setSize(n,i),this.renderPassOrchestrator.onPassesChanged=()=>this._scheduleFixedGpuBytesReport();let a=e.backgroundColor?e.backgroundColor.toHex():0;if(this._renderer.setClearColor(a),!e.disableAutoResize&&!dA()&&(window.addEventListener(`resize`,this._handleResize),this.pixelRatioMatchedMedia=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.pixelRatioMatchedMedia.addEventListener(`change`,this._handleResize)),e.debug){let t=e.container||this._renderer.domElement.parentElement;t&&(this._stats=new gH({beginRender:()=>this._renderer.info.reset(),endRender:()=>({...this._renderer.info.render,memGeometries:this._renderer.info.memory.geometries})},()=>{let e=this._core?.getMemoryStats(),t=e?.bufferTotalBytes,n=e?.externalBufferBytes,r=e?.budgetBytes;e?.free();let i=performance.memory,a=1048576;return{wasmMB:t===void 0?void 0:t/a,jsBufMB:n===void 0?void 0:n/a,jsHeapMB:i?i.usedJSHeapSize/a:void 0,budgetMB:r===void 0?void 0:r/a}}),t.appendChild(this._stats.dom))}if(this._uniforms={viewportAndPixelRatio:{value:null},frustumNearFar:{value:null},frustumRatio:{value:null},tGlobeDepth:{value:null},tGlobeNormal:{value:null},tSkyEnvMap:{value:null},inverseProjectionMatrix:{value:null},fov:{value:this._camera.raw.fov*Math.PI/180},screenHeightPx:{value:i},time:{value:0},colorMapTexture:{value:null},waterTexture:{value:null}},this._defaultTextureOptions={maxAnisotropy:this._renderer.capabilities.getMaxAnisotropy(),magFilter:r.LinearFilter,minFilter:r.LinearFilter,useMipmaps:!0,maxTextures:Math.max(this._renderer.capabilities.maxTextures,8)-6},e.waterTexture?.enabled){let t=e.waterTexture.url??_C;this._uniforms.waterTexture.value=lR.load(t,e=>{e.wrapS=r.RepeatWrapping,e.wrapT=r.RepeatWrapping}),this._defaultTextureOptions.additionalTexturesInUse={...this._defaultTextureOptions.additionalTexturesInUse,waterTexture:!0}}this._atmosphere=new tE(this._renderer,e.atmosphere,this._camera),this._atmosphere.on(`needsUpdate`,this.forceUpdate),this._atmosphere.on(`textureLoaded`,this.forceUpdate),this.on(`layer`,(e,t,...n)=>{this.layersManager.emitById(e,t,...n)}),this._renderFlag.animation=!!e.animation,this._camera.on(`frustumChanged`,()=>{this.renderPassOrchestrator.effectComposer.setMainCamera(this._camera.raw)}),this.shadowMapViewers=new pH(this._scenes.light)}convertToMapEvent(e){let t=this._renderer.domElement.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=mA(this,n,r);return i?Object.assign(e,{map:{x:i.x,y:i.y,z:i.z}}):null}initializeRenderPass(){this.skyEnvMap=this.addEffect({skyEnvMap:{}}),this.mrtPass=this.addEffect({mrt:{}}),this.transparentPass=this.addEffect({transparent:{}}),this.finalPass=this.addEffect({final:{}})}get renderPass(){let e=this.mrtPass.ref.raw;return z(e),e}get camera(){return this._camera}get globe(){return this._globe}get atmosphere(){return this._atmosphere}get toneMappingExposure(){return this._renderer.toneMappingExposure}set toneMappingExposure(e){this._renderer.toneMappingExposure=e,this.forceUpdate()}get cacheBytes(){return this._options.cacheBytes}set cacheBytes(e){this._options.cacheBytes=e,this._core?.setCacheBytes(e)}get lodFog(){let e=this._options.lodFog;if(e)return e}set lodFog(e){let t={..._F({isMobile:this.isMobileOptimized()}),...this._options.lodFog,...e};this._options.lodFog=t,this._core?.setLodFog(t.enabled,t.density,t.sseFactor)}get dynamicSse(){let e=this._options.dynamicSse;if(e)return e}set dynamicSse(e){let n={...yF(),...this._options.dynamicSse,...e};this._options.dynamicSse=n,this._core?.setDynamicSse(new t.DynamicSse(n.enabled,n.density,n.sseFactor,n.heightFalloff,n.minHeight,n.maxHeight))}setSseMultiplierRange(e,t){this._options.memoryBudget={...this._options.memoryBudget,sseMultiplierMin:e,sseMultiplierMax:t},this._core?.setSseMultiplierRange(e,t)}memoryStats(){let e=this._core?.getMemoryStats();if(!e)return;let t={bufferTotalBytes:e.bufferTotalBytes,externalBufferBytes:e.externalBufferBytes,bufferCount:e.bufferCount,gpuBytesEst:e.gpuBytesEst,externalCpuBytes:e.externalCpuBytes,reservedBytes:e.reservedBytes,fixedGpuBytes:e.fixedGpuBytes,budgetBytes:e.budgetBytes,evictedCount:e.evictedCount,sseMultiplier:e.sseMultiplier,retainedVector:e.retainedVector,retainedTerrain:e.retainedTerrain,retainedRaster:e.retainedRaster,retainedTiles3d:e.retainedTiles3d};return e.free(),t}async workerMemoryStats(){if(this._initialized)return Dh(),{tileWorkers:Eh(),fontWorker:await this._fontManager.memoryStats()}}get globeDepthTexture(){return this.renderPass.globeDepthCopyPass.texture}get depthTexture(){return this.renderPass.allDepthCopyPass.texture}isMobileOptimized(){return this._options.mobileOptimization??VP()}forceUpdate=()=>{this._renderFlag.forceUpdate=!0};async init(){if(this._core||this._initialized)return;this._initialized=!0;let e=this.isMobileOptimized(),n=iE(e);e&&(this._hillshadeContext.normalMapScale=.5);let i=dF({isMobile:e,poolSize:n.total});xh(PH,n,{maxWorkerHeapBytes:this._options.memoryBudget?.maxWorkerHeapBytes??i.maxWorkerHeapBytes}),await Promise.all([(0,t.default)(),tl()]),this._core=new t.Core(LH()),this._core.start();let a=this._options.cacheBytes??i.cacheBytes;this._options.cacheBytes=a,this._core.setCacheBytes(a),this._core.setMaxPendingRequests(this._options.memoryBudget?.maxPendingRequests??i.maxPendingRequests),this._core.setSseMultiplierRange(this._options.memoryBudget?.sseMultiplierMin??i.sseMultiplierMin,this._options.memoryBudget?.sseMultiplierMax??i.sseMultiplierMax);let o=uF({isMobile:e});this._core.setMemoryCostHints(o.atlasTileBytes,o.rasterTileBytes),this._scheduleFixedGpuBytesReport();let s={..._F({isMobile:e}),...this._options.lodFog};this._options.lodFog=s,this._core.setLodFog(s.enabled,s.density,s.sseFactor);let c={...yF(),...this._options.dynamicSse};this._options.dynamicSse=c,this._core.setDynamicSse(new t.DynamicSse(c.enabled,c.density,c.sseFactor,c.heightFalloff,c.minHeight,c.maxHeight)),this._fontManager.setConcurrencyManager(n),this._fontManager.setMemoryBudget(this._options.memoryBudget?.fontBudgetBytes??i.fontBudgetBytes),this._globe=new go(this._globeHandler,this._options),this.viewContext=new PP(this._scenes,this.layersManager,this.renderPassOrchestrator,n,this._core,this._meshes),this.registries=new _E(this,this.viewContext),this.viewContext.on(`meshPassKeyChanged`,this._syncGBuffers),this.viewContext._setRegistries(this.registries),this.eventContext=new OF({eventManager:this._eventManager,scenes:this._scenes,camera:this._camera,meshes:this._meshes,abortControllers:this._abortControllers,buf:this._buf,texFragment:this._texFragment,tileHandler:this._tileHandler,workerTaskHandler:this._workerTaskHandler,meshHandler:this._meshHandler,featureHandler:this._featureHandler,loadedTexs:this._loadedTexs,workerPoolPromises:this._workerPoolPromises,uniforms:this._uniforms,texturizedSceneByTileCoordinates:this._texturizedSceneByTileCoordinates,tileTextureCompositor:this._tileTextureCompositor,tileMapByHandle:this._tileMapByHandle,textureOptions:this._defaultTextureOptions,renderFlag:this._renderFlag,viewEvents:this,layersManager:this.layersManager,viewContext:this.viewContext,flightHandler:(e,t)=>{let n=this._pendingFlights.get(e);n&&(this._pendingFlights.delete(e),n(t))},layerHandler:this._layerHandler,fontManager:this._fontManager,textureFragmentIndex:this._textureFragmentIndex,tileMeshToFragmentIds:this._tileMeshToFragmentIds,hillshadeContext:this._hillshadeContext,declutter:this._declutter}),this.registerBuiltIns(),dA()||(this._eventDisposer=NB(this._core,this._renderer.domElement,()=>{let e=this._renderer.domElement.getBoundingClientRect(),t=this.pickDepthPosition(e.left+e.width/2,e.top+e.height/2);return t?this._camera.raw.position.distanceTo(t):null}),this._pickHelper=new fV(this._renderer.domElement,this._renderer,this._camera.raw,this._meshes,this.onPick.bind(this),this.onHoverPick.bind(this),()=>!!this.size(`featureClick`),()=>!!(this.size(`featureHover`)||this.size(`featureEnter`)||this.size(`featureLeave`))),this._pickHelper.enablePick(this._options.picking??!0)),this.initializeRenderPass(),this.viewContext._setRenderPass(this.renderPass),Ch().catch(e=>console.error(`Failed to warm up the worker pool:`,e)),await Promise.all(this.plugins.map(e=>e.init(this,this.viewContext))),this._startMainLoop();let l=new r.Vector2;this._renderer.getSize(l),this.resize(l.width,l.height,this._renderer.getPixelRatio()),this._camera.core=this._core;let u;this._renderer.domElement.addEventListener(`pointerdown`,e=>{u=e.isPrimary&&e.button===0?new r.Vector2(e.clientX,e.clientY):void 0;let t=this.convertToMapEvent(e);t&&this.emit(`pointerdown`,t)}),this._renderer.domElement.addEventListener(`pointerenter`,e=>{let t=this.convertToMapEvent(e);t&&this.emit(`pointerenter`,t)}),this._renderer.domElement.addEventListener(`pointerleave`,e=>{let t=this.convertToMapEvent(e);t&&this.emit(`pointerleave`,t)}),this._renderer.domElement.addEventListener(`pointermove`,e=>{let t=this.convertToMapEvent(e);t&&this.emit(`pointermove`,t)}),this._renderer.domElement.addEventListener(`pointerup`,e=>{let t=this.convertToMapEvent(e);if(t&&this.emit(`pointerup`,t),!e.isPrimary||e.button!==0)return;let n=u;if(u=void 0,!n||!t)return;let i=e.pointerType===`touch`?30:5;lV(n,new r.Vector2(e.clientX,e.clientY),i)&&this.emit(`click`,t)}),this._renderer.domElement.addEventListener(`pointercancel`,e=>{u=void 0,this.emit(`pointercancel`,e)})}dispose(){this._disposed=!0,this._initialized=!1;for(let e of this._pendingFlights.values())e(!1);this._pendingFlights.clear(),this._declutterRetry!==void 0&&(clearTimeout(this._declutterRetry),this._declutterRetry=void 0),this._attribution?.dispose(),this._attribution=void 0,dA()||(window.removeEventListener(`resize`,this._handleResize),this.pixelRatioMatchedMedia?.removeEventListener(`change`,this._handleResize)),this._eventDisposer&&=(this._eventDisposer(),void 0),this._pickHelper&&=(this._pickHelper.dispose(),void 0),this._terrainPicker&&this._terrainPicker.dispose(),this._fontManager.dispose(),this._atmosphere._dispose(),this.skyEnvMap?.delete(),this.mrtPass?.delete(),this.transparentPass?.delete(),this.finalPass?.delete();for(let e of this._abortControllers.values())e.abort();this._abortControllers.clear();for(let e of this._loadedTexs.values())wF(e);this._loadedTexs.clear(),this._hillshadeContext.dispose(),this._declutter.dispose(),this._meshes.clear(),this._inMemoryBufferStore.clear(),this._workerPoolPromises.clear(),this._tileMapByHandle.clear(),this._textureFragmentIndex.clear(),this._tileMeshToFragmentIds.clear(),this.renderPassOrchestrator.dispose(),this._tileTextureCompositor.dispose(),this._core?.free(),this._core=void 0,this._stats&&=(this._stats.dom.remove(),void 0),this._renderer.setAnimationLoop(null),`dispose`in this._renderer&&typeof this._renderer.dispose==`function`&&this._renderer.dispose(),this._ownedRootElement?.remove(),this._ownedRootElement=void 0,Sh()}resize=(e,t,n)=>{if(this._disposed)return;let i=this._getCanvasSize(),a=typeof e==`number`?e:i?.width,o=typeof t==`number`?t:i?.height;if(typeof a!=`number`||typeof o!=`number`)return;this._camera.raw.aspect=a/o,this._camera.raw.updateProjectionMatrix(),this._renderer.setSize(a,o,!dA()),this.renderPassOrchestrator.setSize(a,o),this._options.pixelRatio==null&&n&&this._renderer.setPixelRatio(n);let s=this._renderer.getDrawingBufferSize(new r.Vector2);this._pickHelper?.setSize(s.x,s.y),this._core?.resize(a,o,n??1),this._scheduleFixedGpuBytesReport(),this.emit(`resize`,a,o)};_reportFixedGpuBytes(){if(this._disposed||!this._core)return;let e=this.renderPassOrchestrator.estimateFixedGpuBytes();this.framesSinceFixedGpuBytesReport=0,e!==this.lastReportedFixedGpuBytes&&(this.lastReportedFixedGpuBytes=e,this._core.setFixedGpuBytes(e))}_scheduleFixedGpuBytesReport(){this.fixedGpuBytesResyncPending=!0,!this.fixedGpuBytesReportScheduled&&(this.fixedGpuBytesReportScheduled=!0,queueMicrotask(()=>{this.fixedGpuBytesReportScheduled=!1,this._reportFixedGpuBytes()}))}_updateUniforms(){let e=this._getCanvasSize(),t=this._renderer.getPixelRatio(),n=this._camera.raw.fov*Math.PI/180,r=this._camera.raw.near*Math.tan(.5*n),i=-r,a=this._camera.raw.aspect*r,o=-a;this._uniforms.viewportAndPixelRatio.value=[e?.width??0,e?.height??0,t],this._uniforms.frustumNearFar.value=[this._camera.raw.near,this._camera.raw.far],this._uniforms.frustumRatio.value=[r,i,a,o],this._uniforms.tGlobeDepth.value=this.renderPass.globeDepthCopyPass.texture,this._uniforms.tGlobeNormal.value=this.renderPass.globeNormalCopyPass.texture,this._uniforms.tSkyEnvMap.value=this.skyEnvMap.ref.raw?.getEnvMapTexture()??null,this._uniforms.inverseProjectionMatrix.value=this._camera.raw.projectionMatrixInverse,this._uniforms.fov.value=n,this._uniforms.screenHeightPx.value=e?.height??0}_update(e){this.emit(`preUpdate`,e),this._core?.update(e);let t=this._core?.readEvents();return!t&&!this._eventManager.needsUpdate()||!this._core?!1:(this.eventContext.updatedAt=e,bB(this.eventContext,t),t?.free(),this._buf.drainRemovedExternalHandles(),this._camera.raw.updateMatrixWorld(),this._updateUniforms(),this.emit(`postUpdate`,e),!0)}_forceFeatureUpdates(e){for(let t of this.layersManager.getResourceLayers())t._processFeatureUpdates(e)&&(this._renderFlag.forceUpdate=!0)}_scheduleDeclutterFrame(e){if(this._declutterRetry!==void 0){if(e>=this._declutterRetryDelay)return;clearTimeout(this._declutterRetry)}this._declutterRetryDelay=e,this._declutterRetry=setTimeout(()=>{this._declutterRetry=void 0,this._renderFlag.forceUpdate=!0},e)}_render(e){this._vectorRevision=this._core?.vectorRevision()??this._vectorRevision,this._rasterRevision=this._core?.rasterRevision()??this._rasterRevision,this._uniforms.time.value=e,this._atmosphere._update();{let t=this._renderer.getDrawingBufferSize(this._declutterSize),n=this._renderer.getPixelRatio(),r=this._declutter.update(this._camera.raw,t.x/n,t.y/n,e);r===`throttled`?this._scheduleDeclutterFrame(this._declutter.remainingThrottleMs(e)):r===`animating`&&this._scheduleDeclutterFrame(16)}this.emit(`preRender`,e),this.renderPassOrchestrator.render(),this._pickHelper?.renderDebugCanvas(),this.shadowMapViewers.render(this._renderer),this.emit(`postRender`,e),this.fixedGpuBytesResyncPending?(this.fixedGpuBytesResyncPending=!1,this._reportFixedGpuBytes()):++this.framesSinceFixedGpuBytesReport>=120&&(this.framesSinceFixedGpuBytesReport=0,this._reportFixedGpuBytes())}_convertColorsToNumbers(e){if(typeof e!=`object`||!e)return e;let t={...e};for(let[e,n]of Object.entries(t))if(n&&typeof n==`object`&&!Array.isArray(n)){let r={...n};for(let[e,t]of Object.entries(r))t instanceof nE&&(r[e]=t.toHex());t[e]=r}return t}addLayer(e){let t=`source`in e&&e.source instanceof sz?{...e,source:e.source.id}:e,n=this._convertColorsToNumbers(t),r=this._core?.addLayer(n);z(r),z(this._core);let i=new cz(r,this._core,this._convertColorsToNumbers.bind(this));return this.layersManager.add(i),i}addSource(e){return z(this._core),z(e.type),new sz(this._core.addSource(e),e.type,this._core)}_trackAsyncCreate(e,t,n,r){if(!(n instanceof Promise)){r();return}n.then(r,n=>{console.error(`Failed to create ${e} descriptor:`,n),t.emit(`error`,n)})}addMesh(e){let t=this.registries.mesh.findMeshType(e);if(!t)throw new yE(`mesh`,e);let n=this.registries.mesh.create(t,e);this._trackAsyncCreate(`mesh`,n,n.onCreate(),()=>{if(!n.destroyed){if(n.update&&this.on(`preRender`,n.update.bind(n)),n.onResize){this.on(`resize`,n.onResize.bind(n));let e=this._getCanvasSize();e&&n.onResize(e.width,e.height)}n.on(`needsUpdate`,this.forceUpdate),this.forceUpdate()}});let r=new kP(n);return r.on(`deleted`,this.forceUpdate),this.layersManager.add(r),r}addLight(e){let t=this.registries.light.findLightType(e);if(!t)throw new yE(`light`,e);let n=this.registries.light.create(t,e);this._trackAsyncCreate(`light`,n,n.onCreate(),()=>{n.destroyed||(n.update&&this.on(`preRender`,n.update.bind(n)),n.on(`needsUpdate`,this.forceUpdate),this.forceUpdate())});let r=new AP(n);return r.on(`deleted`,this.forceUpdate),this.layersManager.add(r),r}addEffect(e){let t=this.registries.effect.findEffectType(e);if(!t)throw new yE(`effect`,e);this._assertGBufferCapacity(t);let n=this.registries.effect.create(t,e),r=new jP(n);return this.layersManager.add(r),this._syncGBuffers(),r.on(`deleted`,()=>{this._syncGBuffers(),this.forceUpdate()}),this._trackAsyncCreate(`effect`,n,n.onCreate(),()=>{n.destroyed||(n.update&&this.on(`preRender`,n.update.bind(n)),n.on(`needsUpdate`,this.forceUpdate),this.forceUpdate())}),r}_syncGBuffers=()=>{let e=[];for(let t of this.layersManager.getEffectDescs()){let n=t.ref.constructor;n.requiredBuffers&&e.push(n.requiredBuffers)}this._scenes.draped.children.length>0&&e.push([`globeNormal`]),this._buffers=wA(e),this.viewContext._setGBufferOptions(this._buffers)};_assertGBufferCapacity(e){let t=this.registries.effect.getRequiredBuffers(e);if(t.length===0)return;let n=wA([Object.keys(this._buffers).filter(e=>this._buffers[e]),t]),r=2+SA.filter(e=>n[e]).length,i=this.viewContext.getRenderer().getContext(),a=i.getParameter(i.MAX_DRAW_BUFFERS);if(r>a)throw Error(`The "${e}" effect requires G-buffers [${t.join(`, `)}], but the resulting ${r} MRT attachments exceed this device's MAX_DRAW_BUFFERS (${a}).`)}findLayerById(e){let t=this.layersManager.get(e);return t instanceof cz?t:void 0}updateLayerById(e,t){z(this._core);let n=this.layersManager.get(e);!n||!(n instanceof cz)||n.update(t)}updateMeshById(e,t){let n=this.layersManager.get(e);!n||!(n instanceof kP)||n.update(t)}updateLightById(e,t){let n=this.layersManager.get(e);!n||!(n instanceof AP)||n.update(t)}updateEffectById(e,t){let n=this.layersManager.get(e);!n||!(n instanceof jP)||n.update(t)}deleteLayerById(e){z(this._core);let t=this.layersManager.get(e);return!t||!(t instanceof cz)?!1:(t.delete(),!0)}deleteMeshById(e){let t=this.layersManager.get(e);return!t||!(t instanceof kP)?!1:(t.delete(),!0)}deleteLightById(e){let t=this.layersManager.get(e);return!t||!(t instanceof AP)?!1:(t.delete(),!0)}deleteEffectById(e){let t=this.layersManager.get(e);return!t||!(t instanceof jP)?!1:(t.delete(),!0)}registerBuiltIns(){this.registerBuiltInEffects()}registerBuiltInEffects(){this.registerEffect(`skyEnvMap`,XB),this.registerEffect(`mrt`,qB),this.registerEffect(`transparent`,ZB),this.registerEffect(`final`,PB)}registerMesh(e,t){this.registries.mesh.register(e,t)}registerLight(e,t){this.registries.light.register(e,t)}registerEffect(e,t){this.registries.effect.register(e,t)}addPlugin(e){if(this._initialized)throw Error("Plugin must be added before `view.init()`.");return this.plugins.push(e),this}addFontFamily(e){return this._fontManager.registerFontFamily(e),this}removeFontFamily(e){return this._fontManager.unregisterFontFamily(e),this}setCamera(e){function t(e){return Number.isFinite(e)&&e!=null}let n=e.lng,r=e.lat,i=t(n)&&t(r)?new Float64Array([n,r,e.height??0]):null;this._core?.changeCamera(i,e.pitch,e.heading,e.roll,e.distance)}moveCamera(e,n){switch(e){case t.CameraDirection.Forward:this._core?.moveCamera(t.CameraDirection.Forward,n);break;case t.CameraDirection.Backward:this._core?.moveCamera(t.CameraDirection.Backward,n);break;case t.CameraDirection.Up:this._core?.moveCamera(t.CameraDirection.Up,n);break;case t.CameraDirection.Down:this._core?.moveCamera(t.CameraDirection.Down,n);break;case t.CameraDirection.Left:this._core?.moveCamera(t.CameraDirection.Left,n);break;case t.CameraDirection.Right:this._core?.moveCamera(t.CameraDirection.Right,n)}}moveCameraWithDirection(e,t){e.length===3&&this._core?.moveCameraWithDirection(new Float64Array(e),t)}flyTo(e,t={}){let n=e,r=new Float64Array([n.lng,n.lat,n.height??0]),i=this._core?.flyTo(r,n.pitch,n.heading,n.roll,t.duration,t.maxHeight,n.distance,t.easing===void 0?void 0:FH[t.easing]);return i===void 0?Promise.resolve(!1):new Promise(e=>{this._pendingFlights.set(i,e)})}lookAt(e,t){this._core?.lookAt(new Float64Array([e.lng,e.lat,e.height]),new Float64Array([t.x,t.y,t.z]))}cameraFollow(e,t,n){let r=t?new Float64Array([t.lng,t.lat,t.height]):void 0,i=n?new Float64Array([n.x,n.y,n.z]):void 0;this._core?.cameraFollow(e,r,i)}cameraFreeLook(e,t){let n=t?new Float64Array([t.lng,t.lat,t.height]):void 0;this._core?.cameraFreeLook(e,n)}sampleTerrainHeight(e){let n=new t.LLE(il(e.lat),il(e.lng),0);return this._core?.sampleTerrainHeight(n)}async sampleTerrainMostDetailed(e,t,n){z(this._core);let r=e instanceof sz?e.id:e,i=this._core.getSourceDescription(r);if(i?.type!==`quantized-mesh`&&i?.type!==`raster-dem`)throw Error(`sampleTerrainMostDetailed: source "${r}" is not a registered quantized-mesh or raster-dem source`);return CH(i,t,n)}observeTerrainHeightAt(e,n){if(!this._core)return()=>{};let r=new t.LLE(il(e.lat),il(e.lng),0),i=this._core.registerSampleTerrainHeightEvent(r),a=e=>{NH(e,i)&&n(e.height)};return this.on(`_sample_terrain_height_received`,a),()=>{this._core?.unregisterSampleTerrainHeightEvent(i),this.off(`_sample_terrain_height_received`,a)}}rotateAroundAxis(e,t){this._core?.rotateAroundAxis(new Float64Array([e.x,e.y,e.z]),t)}rotateAround(e){this._core?.rotateAroundAxis(null,e)}_startMainLoop(){let e=this._options.idleThreshold??100;this._renderer.setAnimationLoop(t=>{if(this._disposed)return;this._stats?.begin(),this._forceFeatureUpdates(t);let n=this._update(t);(n||this._renderFlag.forceUpdate||this._renderFlag.animation)&&this._render(t),this._renderFlag.forceUpdate=!1,n?this._isIdle=!1:!this._isIdle&&this.eventContext.updatedAt>0&&t-this.eventContext.updatedAt>=e&&(this._isIdle=!0,this.emit(`idle`)),this._stats?.end()})}_getCanvasSize(){let e=this._options.container??this._renderer.domElement?.parentElement??this._renderer.domElement;if(!e)return;let t=e.offsetWidth,n=e.offsetHeight;if(typeof t==`number`||typeof n==`number`)return{width:t,height:n}}_handleResize=()=>{let{width:e,height:t}=this._getCanvasSize()??{};if(!e||!t)return;let n=dA()?this._options.pixelRatio??1:bF({override:this._options.pixelRatio,mobileOptimization:this._options.mobileOptimization});this.resize(e,t,n)};resolvePickedFeature(e){let t=this._core?.readPropertyByGlobalBatchId(e);return t?{properties:t.properties,batchId:t.batchId??e,layerId:t.layerId}:{properties:{},batchId:e,layerId:void 0}}onPick(e){this._renderFlag.forceUpdate=!0,e.length>0?this.emit(`featureClick`,this.resolvePickedFeature(e[0])):this.emit(`featureClick`,null)}onHoverPick(e){this._renderFlag.forceUpdate=!0;let t=e.length>0?e[0]:0,n=this._hoveredFeature;if((n?.batchId??0)===t)return;let r=t>0?this.resolvePickedFeature(t):null;this._hoveredFeature=r,n&&this.emit(`featureLeave`,n),r&&this.emit(`featureEnter`,r),this.emit(`featureHover`,r)}get animation(){return this._renderFlag.animation}set animation(e){this._renderFlag.animation=e}get canvas(){return this._renderer.domElement}get screenSize(){let e=new r.Vector2;return this._renderer.getSize(e),e}get pixelRatio(){return this._renderer.getPixelRatio()}get shadowMapViewersEnabled(){return this.shadowMapViewers.enabled}set shadowMapViewersEnabled(e){this.shadowMapViewers.enabled=e}pickTerrainPosition(e,t){return this._terrainPicker.pick(e,t,this._renderer,this.globeDepthTexture,this._camera.raw)}pickDepthPosition(e,t){return this._terrainPicker.pick(e,t,this._renderer,this.depthTexture,this._camera.raw)}};function LH(){return Math.random().toString(36).slice(2)}e.ATMOSPHERE_HIGHER_ORDER_SCATTERING_URL=lC,e.ATMOSPHERE_IRRADIANCE_URL=cC,e.ATMOSPHERE_SCATTERING_URL=sC,e.ATMOSPHERE_SINGLE_MIE_SCATTERING_URL=uC,e.ATMOSPHERE_TEXTURE_URLS=vC,e.ATMOSPHERE_TRANSMITTANCE_URL=oC,e.AllDepthCopyPass=zB,e.Atmosphere=tE,e.AttributionPlugin=PV,e.BATCHED_ATTRIBUTE_NAMES=lI,e.BATCH_TEXTURE_ROW=cI,e.BaseDesc=fE,e.BaseHandle=OP,e.BatchedFeatureMesh=kI,e.BatchedSdfTextMesh=$R,e.BufferView=oV,e.CLICK_PIXEL_TOLERANCE=sV,e.CLOUD_LOCAL_WEATHER_URL=fC,e.CLOUD_SHAPE_DETAIL_URL=mC,e.CLOUD_SHAPE_URL=pC,e.CLOUD_TURBULENCE_URL=hC,e.CSMHelper=fH,Object.defineProperty(e,"CameraDirection",{enumerable:!0,get:function(){return t.CameraDirection}}),e.CascadedShadowMaps=dH,e.Color=nE,e.ColorMap=ho,e.ConflictingTransformError=bE,e.CopyPass=dE,e.CustomEffectPass=lE,e.CustomRenderPass=GB,e.DEFAULT_EFFECT_OPTIONS=oE,e.DEPTH_PACKING_SHADER=LB,e.DescRegistry=aE,e.DrapedMesh=rz,e.Effect=cE,e.EffectDesc=pE,e.EffectDescRegistry=mE,e.EffectHandle=jP,e.EllipsoidGeodesic=el,e.EventHandler=M,e.FeatureEvaluator=oz,e.FeatureMesh=UI,e.FinalCopyEffectDesc=PB,e.GBUFFER_ATTACHMENT_NAMES=SA,e.GBUFFER_DEFINE_NAMES=PA,e.GBUFFER_EFFECT_ID_LOCATION_DEFINE=kA,e.GBUFFER_EFFECT_WRITE_BUILTIN=RA,e.GBUFFER_EFFECT_WRITE_ID_ONLY=BA,e.GBUFFER_EFFECT_WRITE_SHADER_MATERIAL=zA,e.GBUFFER_EFFECT_WRITE_ZERO=VA,e.GBUFFER_EMISSIVE_LOCATION_DEFINE=jA,e.GBUFFER_NORMAL_LOCATION_DEFINE=DA,e.GBUFFER_NORMAL_WRITE_BASIC=LA,e.GBUFFER_NORMAL_WRITE_PHYSICAL=IA,e.GBUFFER_PARS_FRAGMENT=EA,e.GBUFFER_SHADOW_LOCATION_DEFINE=NA,e.GBUFFER_TEXTURE_INDEX=xA,e.GEOMETRY_TYPES=kF,e.GlyphKind=yR,e.InstancedMesh=GI,e.InstancedMeshDesc=EP,e.InstancedSpriteMesh=vR,e.JAPAN_GSI_ELEVATION_DECODER=yC,e.Layer=cz,e.LightDesc=DP,e.LightDescRegistry=hE,e.LightHandle=AP,e.MAPBOX_ELEVATION_DECODER=bC,e.MAX_BATCH_TEXTURE_WIDTH=pI,e.MB=WP,e.MODEL_BATCH_TEXTURE_CONFIG=CI,e.MRTPassEffectDesc=qB,e.MeshDesc=mP,e.MeshDescRegistry=gE,e.MeshDescWithSelectiveEffect=hP,e.MeshHandle=kP,e.ModelMesh=wI,e.NORMAL_PACKING_SHADER=IB,e.NVR_BLENDED_DEFINE=rP,e.NVR_LIT_DEFINE=eP,e.NVR_UNLIT_DEFINE=tP,e.NVR_UNLIT_SCENE_DEFINE=nP,e.NormalCopyPass=VB,e.PICK_RADIUS=uV,e.POLYGON_BATCH_TEXTURE_ROWS=DI,e.POLYLINE_BATCH_TEXTURE_ROWS=OI,e.Pass=sE,e.PickableInstancedMeshWrapper=XL,e.PickableMesh=TI,e.PickableMeshWrapper=YL,e.PickableMultiInstancedMeshWrapper=ZL,e.Plugin=_o,e.PolygonMesh=LI,e.PolygonOutlineMesh=HI,e.PolylineMesh=BI,e.RTE_ONE_UNIFORM=qc,e.Registries=_E,e.RenderPass=uE,e.RenderTargetCopyPass=UB,e.SKY_RENDER_ORDER=iz,e.STARS_ASSETS_URL=dC,e.STARS_RENDER_ORDER=az,e.STBN_URL=gC,e.SelectiveEffectDesc=YB,e.SelectiveEffectRegistry=NP,e.ShaderLib=xE,e.SkyEnvMapEffectDesc=XB,e.SkyEnvMapPass=KB,e.Source=sz,e.TAP_PIXEL_TOLERANCE=cV,e.TERRARIUM_ELEVATION_DECODER=xC,e.TILE_EMISSIVE_EFFECT_BUFFER_REPLACEMENT=mM,e.TILE_NORMAL_BUFFER_REPLACEMENT=pM,e.TILE_PICK_FRAGMENT_OVERRIDE=hM,e.TILE_VERTEX_INJECTIONS=gM,e.TOUCH_PICK_RADIUS=dV,e.TileMesh=UL,e.TransparentPassEffectDesc=ZB,e.USE_GBUFFER_EMISSIVE_DEFINE=AA,e.USE_GBUFFER_SELECTIVE_EFFECT_DEFINE=OA,e.USE_GBUFFER_SHADOW_DEFINE=MA,e.UnknownTypeError=yE,e.VALID_GEOMETRY_TYPES=AF,e.ViewContext=PP,e.WATERMASK_OCEAN_REFLECTIVITY=cM,e.WATERMASK_OCEAN_ROUGHNESS=lM,e.WATER_NORMAL_URL=_C,e.appendOptionalGBufferAttachments=UA,e.applyLitOption=iP,e.assertNoTransformConflict=fP,e.batchBaseIndex=vI,e.blendFunction=gA,e.breakLines=GR,e.buildLabelLayout=JR,e.calcCameraPosition=$c,e.calcModelMatrixRTE=Yc,e.cascadedShadowMaps=pb,e.composeWorldMatrixForRTE=Xc,e.computeGBufferDefines=FA,e.computeGBufferTextureIndex=TA,e.convertScreenToWorld=ol,e.convertWorldToScreen=ml,e.createFullscreenQuad=JB,e.createGBufferAttachments=HA,e.createInstancedSpriteMaterialEnhancer=Wj,e.createPolygonMaterialEnhancer=lj,e.createPolylineMaterialEnhancer=Mj,e.createReplacer=Q,e.createSdfTextMaterialEnhancer=sM,e.createShadowMapDepthEnhancer=gj,e.default=IH,e.degreeToRadian=il,e.depth=mb,e.eastNorthUpToFixedFrame=cl,e.encodeFloatToRGBA=uI,e.encodePositionRTE=Jc,e.fetchFontFamilyFromCss=So,e.generateTileCommonInjection=uM,e.generateTileMapFragment=dM,e.generateTileNormalFragmentMaps=fM,e.generators=hb,e.geodeticSurfaceNormal=sl,e.geodeticToVector3=nl,e.getBatchDataTexture=_I,e.getDefaultCacheBytes=nF,e.getDefaultDynamicSse=yF,e.getDefaultLodFog=_F,e.getDefaultMemoryBudgets=dF,e.getHeightFromEllipsoid=Kc,e.getPickRay=Wc,e.getPlaneFromPointNormal=Uc,e.getRayPlaneIntersection=Gc,e.getRowIndex=gI,e.getWGS84Eccentricity=yl,e.getWGS84EccentricitySquared=_l,e.getWGS84Flattening=vl,e.getWGS84SemiMajorAxis=hl,e.getWGS84SemiMinorAxis=gl,e.headingPitchRollToFixedFrame=pl,e.initBatchDataTexture=hI,e.initBatchedMaterial=mI,e.initNavaraApi=tl,e.interleavedGradientNoise=gb,e.isAttributionHtml=hV,e.isFeatureMesh=WI,e.isPickableMesh=EI,e.isRtlText=WR,e.lineWidthFu=HR,e.math=_b,e.mergeGeodetic=pP,e.northEastDownToFixedFrame=ll,e.northUpEastToFixedFrame=ul,e.northWestUpToFixedFrame=dl,e.overrideMaterialsForMRT=cP,e.packShowOpacity=dI,e.packing=vb,e.parseCssUnicodeRange=bo,e.parseFontFamilyFromCss=xo,e.radianToDegree=al,e.raySphereIntersection=yb,e.resolveGBufferOptions=CA,e.setRTCPosition=II,e.setRTEPosition=FI,e.setupMaterialForDrape=nz,e.setupMaterialForMRT=dP,e.setupRTEBeforeRender=PI,e.setupRTECallback=NI,e.setupSelectiveEffectUniforms=IP,e.transform=bb,e.turbo=xb,e.unionGBufferRequirements=wA,e.unpackShowOpacity=fI,e.updateBatchAttribute=yI,e.vector3ToGeodetic=rl,e.vogelDisk=Sb,e.westUpNorthToFixedFrame=fl});
6931
6931
  //# sourceMappingURL=index.umd.cjs.map