import{aas_e}from"./chunk-HMHR6SIB.js";import{aasZ}from"./chunk-GMMUK6QU.js";import{aas_t}from"./chunk-XCRMBS5M.js";import{aasOe}from"./chunk-NHNM56MI.js";import{aasLe}from"./chunk-OKWGJEQO.js";import{aaste}from"./chunk-ZBEWS6NN.js";import{basQt}from"./chunk-V7XARCCV.js";import{aasjt}from"./chunk-SACP225T.js";import{casCe,daszt}from"./chunk-NW2YE576.js";import{aasbt,dasG}from"./chunk-2NIQ5ECB.js";import{dasxe,easNe,fasKt,hasU}from"./chunk-7YEOLR2L.js";import{aasBt}from"./chunk-QHHYYTCM.js";import{aast,basu,casPt,dasz,easvt}from"./chunk-RH3GFHG2.js";import{aasp}from"./chunk-FRWNWNYJ.js";import"./chunk-UKWFHLUK.js";import"./chunk-UAWOHN7R.js";import{aasO}from"./chunk-TA3RE4KQ.js";import{aasSt,baset}from"./chunk-RTY3VPG6.js";import{easg}from"./chunk-LRNH5AEO.js";functionrt(e){e=O(e,O.EMPTY_OBJECT),this._ellipsoid=O(e.ellipsoid,z.default),this._rectangle=O(e.rectangle,U.MAX_VALUE),this._projection=newbt(this._ellipsoid),this._numberOfLevelZeroTilesX=O(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=O(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(rt.prototype,{ellipsoid:{get:function(){returnthis._ellipsoid}},rectangle:{get:function(){returnthis._rectangle}},projection:{get:function(){returnthis._projection}}});rt.prototype.getNumberOfXTilesAtLevel=function(e){returnthis._numberOfLevelZeroTilesX<<e};rt.prototype.getNumberOfYTilesAtLevel=function(e){returnthis._numberOfLevelZeroTilesY<<e};rt.prototype.rectangleToNativeRectangle=function(e,i){et.defined("rectangle",e);letr=p.toDegrees(e.west),n=p.toDegrees(e.south),o=p.toDegrees(e.east),a=p.toDegrees(e.north);returng(i)?(i.west=r,i.south=n,i.east=o,i.north=a,i):newU(r,n,o,a)};rt.prototype.tileXYToNativeRectangle=function(e,i,r,n){leto=this.tileXYToRectangle(e,i,r,n);returno.west=p.toDegrees(o.west),o.south=p.toDegrees(o.south),o.east=p.toDegrees(o.east),o.north=p.toDegrees(o.north),o};rt.prototype.tileXYToRectangle=function(e,i,r,n){leto=this._rectangle,a=this.getNumberOfXTilesAtLevel(r),c=this.getNumberOfYTilesAtLevel(r),l=o.width/a,s=e*l+o.west,d=(e+1)*l+o.west,h=o.height/c,N=o.north-i*h,S=o.north-(i+1)*h;returng(n)||(n=newU(s,S,d,N)),n.west=s,n.south=S,n.east=d,n.north=N,n};rt.prototype.positionToTileXY=function(e,i,r){letn=this._rectangle;if(!U.contains(n,e))return;leto=this.getNumberOfXTilesAtLevel(i),a=this.getNumberOfYTilesAtLevel(i),c=n.width/o,l=n.height/a,s=e.longitude;n.east<n.west&&(s+=p.TWO_PI);letd=(s-n.west)/c|0;d>=o&&(d=o-1);leth=(n.north-e.latitude)/l|0;returnh>=a&&(h=a-1),g(r)?(r.x=d,r.y=h,r):newPt(d,h)};varDe=rt;varIe=newt,He=newt,ke=newu,ee=newt,hn=newt,ye=newG,pn=newDe,Lt=[newu,newu,newu,newu],Ot=newPt,w={};w.initialize=function(){lete=w._initPromise;returng(e)||(e=xe.fetchJson(Ne("Assets/approximateTerrainHeights.json")).then(function(i){w._terrainHeights=i}),w._initPromise=e),e};w.getMinimumMaximumHeights=function(e,i){if(et.defined("rectangle",e),!g(w._terrainHeights))thrownewSt("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");i=O(i,z.default);letr=Ae(e),n=w._defaultMinTerrainHeight,o=w._defaultMaxTerrainHeight;if(g(r)){leta=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];g(c)&&(n=c[0],o=c[1]),i.cartographicToCartesian(U.northeast(e,ke),Ie),i.cartographicToCartesian(U.southwest(e,ke),He),t.midpoint(He,Ie,ee);letl=i.scaleToGeodeticSurface(ee,hn);if(g(l)){lets=t.distance(ee,l);n=Math.min(n,-s)}elsen=w._defaultMinTerrainHeight}returnn=Math.max(w._defaultMinTerrainHeight,n),{minimumTerrainHeight:n,maximumTerrainHeight:o}};w.getBoundingSphere=function(e,i){if(et.defined("rectangle",e),!g(w._terrainHeights))thrownewSt("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");i=O(i,z.default);letr=Ae(e),n=w._defaultMaxTerrainHeight;if(g(r)){leta=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];g(c)&&(n=c[1])}leto=G.fromRectangle3D(e,i,0);returnG.fromRectangle3D(e,i,n,ye),G.union(o,ye,o)};functionAe(e){u.fromRad