/** * SmartEarth WebSDK - https://websdk.terra-it.cn * Version 5.3.1 */ import{a as Oe}from"./chunk-DMXICNHG.js";import{a as Z}from"./chunk-3B3UDCHP.js";import{a as Ct}from"./chunk-X2QIAW2L.js";import{a as De}from"./chunk-5B7R4ODL.js";import{a as Le}from"./chunk-A6RR2BLJ.js";import{a as ee}from"./chunk-EPQZOCRV.js";import{b as te}from"./chunk-BUR4N7VJ.js";import{a as Xt}from"./chunk-33CJ2NM7.js";import{c as Ce,d as jt}from"./chunk-TNSV6TPX.js";import{a as vt,d as G}from"./chunk-QHUUGFLC.js";import{d as _e,e as Ne,f as Qt,i as U}from"./chunk-BHJLM5NY.js";import{a as zt}from"./chunk-3LWOQSP3.js";import{a as At,b as t,c as u,d as Pt,e as z,f as Bt}from"./chunk-7DK7KB7Q.js";import{a as p}from"./chunk-JSZDCKFG.js";import"./chunk-YGIPMXAD.js";import"./chunk-54HAFFPJ.js";import{a as L}from"./chunk-5HWP5DW7.js";import{a as St,b as et}from"./chunk-INT7THOB.js";import{e as m}from"./chunk-PPCZYYBW.js";function rt(e){e=L(e,L.EMPTY_OBJECT),this._ellipsoid=L(e.ellipsoid,z.default),this._rectangle=L(e.rectangle,U.MAX_VALUE),this._bounds=L(e.bounds,[]),this._projection=new vt(this._ellipsoid),this._numberOfLevelZeroTilesX=L(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=L(e.numberOfLevelZeroTilesY,1),this._tileInfo=e.tileInfo}Object.defineProperties(rt.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},bounds:{get:function(){return this._bounds}},projection:{get:function(){return this._projection}}});rt.prototype.getNumberOfXTilesAtLevel=function(e){if(!m(this._tileInfo))return this._numberOfLevelZeroTilesX<=i&&(f=i-1);let h=(n.north-e.latitude)/l|0;return h>=a&&(h=a-1),m(r)?(r.x=f,r.y=h,r):new Pt(f,h)};var Ie=rt;var He=new t,ye=new t,ke=new u,ne=new t,pn=new t,Me=new G,fn=new Ie,Ot=[new u,new u,new u,new u],Lt=new Pt,w={};w.initialize=function(){let e=w._initPromise;return m(e)||(e=_e.fetchJson(Ne("Assets/approximateTerrainHeights.json")).then(function(o){if(At.changeApproximateTerrainHeights===!0)for(let r in o)o.hasOwnProperty(r)&&(o[r][0]=At.minTerrainHeight,o[r][1]=At.maxTerrainHeight);w._terrainHeights=o}),w._initPromise=e),e};w.getMinimumMaximumHeights=function(e,o){if(et.defined("rectangle",e),!m(w._terrainHeights))throw new St("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");o=L(o,z.default);let r=be(e),n=w._defaultMinTerrainHeight,i=w._defaultMaxTerrainHeight;if(m(r)){let a=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];m(c)&&(n=c[0],i=c[1]),o.cartographicToCartesian(U.northeast(e,ke),He),o.cartographicToCartesian(U.southwest(e,ke),ye),t.midpoint(ye,He,ne);let l=o.scaleToGeodeticSurface(ne,pn);if(m(l)){let s=t.distance(ne,l);n=Math.min(n,-s)}else n=w._defaultMinTerrainHeight}return n=Math.max(w._defaultMinTerrainHeight,n),{minimumTerrainHeight:n,maximumTerrainHeight:i}};w.getBoundingSphere=function(e,o){if(et.defined("rectangle",e),!m(w._terrainHeights))throw new St("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");o=L(o,z.default);let r=be(e),n=w._defaultMaxTerrainHeight;if(m(r)){let a=`${r.level}-${r.x}-${r.y}`,c=w._terrainHeights[a];m(c)&&(n=c[1])}let i=G.fromRectangle3D(e,o,0);return G.fromRectangle3D(e,o,n,Me),G.union(i,Me,i)};function be(e){u.fromRadians(e.east,e.north,0,Ot[0]),u.fromRadians(e.west,e.north,0,Ot[1]),u.fromRadians(e.east,e.south,0,Ot[2]),u.fromRadians(e.west,e.south,0,Ot[3]);let o=0,r=0,n=0,i=0,a=w._terrainHeightsMaxLevel,c;for(c=0;c<=a;++c){let l=!1;for(let s=0;s<4;++s){let f=Ot[s];if(fn.positionToTileXY(f,c,Lt),s===0)n=Lt.x,i=Lt.y;else if(n!==Lt.x||i!==Lt.y){l=!0;break}}if(l)break;o=n,r=i}if(c!==0)return{x:o,y:r,level:c>a?a:c-1}}w._terrainHeightsMaxLevel=6;w._defaultMaxTerrainHeight=9e3;w._defaultMinTerrainHeight=-1e5;w._terrainHeights=void 0;w._initPromise=void 0;Object.defineProperties(w,{initialized:{get:function(){return m(w._terrainHeights)}}});var Yt=w;var he=[vt,Oe],dn=he.length,Qe=Math.cos(p.toRadians(30)),Re=Math.cos(p.toRadians(150)),tn=0,en=1e3;function ct(e){e=L(e,L.EMPTY_OBJECT);let o=e.positions;if(!m(o)||o.length<2)throw new St("At least two positions are required.");if(m(e.arcType)&&e.arcType!==Z.GEODESIC&&e.arcType!==Z.RHUMB)throw new St("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=L(e.width,1),this._positions=o,this.granularity=L(e.granularity,9999),this.loop=L(e.loop,!1),this.arcType=L(e.arcType,Z.GEODESIC),this._ellipsoid=z.default,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(ct.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+z.packedLength+1+1}}});ct.setProjectionAndEllipsoid=function(e,o){let r=0;for(let n=0;nQe||ap.PI_OVER_TWO&&(l=!0,c=t.subtract(a,r,Ye),f=s.cartesianToCartographic(c,Xe)),f.height=0;let h=e.project(f,i);return i=t.subtract(h,n,i),i.z=0,i=t.normalize(i,i),l&&t.negate(i,i),i}var bn=new t,Fe=new t;function Ue(e,o,r,n,i,a){let c=t.subtract(o,e,bn);t.normalize(c,c);let l=r-tn,s=t.multiplyByScalar(c,l,Fe);t.add(e,s,i);let f=n-en;s=t.multiplyByScalar(c,f,Fe),t.add(o,s,a)}var Rn=new t;function Gt(e,o){let r=Xt.getPointDistance(qt,e),n=Xt.getPointDistance(qt,o),i=Rn;p.equalsEpsilon(r,0,p.EPSILON2)?(i=nt(o,e,i),t.multiplyByScalar(i,p.EPSILON2,i),t.add(e,i,e)):p.equalsEpsilon(n,0,p.EPSILON2)&&(i=nt(e,o,i),t.multiplyByScalar(i,p.EPSILON2,i),t.add(o,i,o))}function An(e,o){let r=Math.abs(e.longitude),n=Math.abs(o.longitude);if(p.equalsEpsilon(r,p.PI,p.EPSILON11)){let i=p.sign(o.longitude);return e.longitude=i*(r-p.EPSILON11),1}else if(p.equalsEpsilon(n,p.PI,p.EPSILON11)){let i=p.sign(e.longitude);return o.longitude=i*(n-p.EPSILON11),2}return 0}var on=new u,rn=new u,Ge=new t,ae=new t,qe=new t,We=new t,Pn=new t,Ze=new t,vn=[on,rn],Bn=new U,zn=new t,jn=new t,Xn=new t,Yn=new t,Fn=new t,Un=new t,ce=new t,se=new t,Gn=new t,qn=new t,Wn=new t,Ve=new t,Zn=new t,Vn=new t,$n=new Ct,Jn=new Ct,$e=new t,Kn=new t,Je=new t,Qn=[new G,new G],an=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],Ke=an.length;function to(e,o,r,n,i,a,c){let l,s,f=o._ellipsoid,h=r.length/3-1,_=h*8,S=_*4,R=h*36,D=_>65535?new Uint32Array(R):new Uint16Array(R),I=new Float64Array(_*3),j=new Float32Array(S),q=new Float32Array(S),d=new Float32Array(S),X=new Float32Array(S),v=new Float32Array(S),k,H,N,y;c&&(k=new Float32Array(S),H=new Float32Array(S),N=new Float32Array(S),y=new Float32Array(_*2));let P=a.length/2,B=0,E=on;E.height=0;let x=rn;x.height=0;let O=Ge,C=ae;if(c)for(s=0,l=1;lQe?(ot=Dt(o,E,mt,pt,ce),it=Dt(o,x,W,gt,se)):T===1?(it=Dt(o,x,W,gt,se),ot.x=0,ot.y=p.sign(E.longitude-Math.abs(x.longitude)),ot.z=0):(ot=Dt(o,E,mt,pt,ce),it.x=0,it.y=p.sign(E.longitude-x.longitude),it.z=0)}let ue=t.distance(Vt,lt),we=Ct.fromCartesian(ht,$n),Ht=t.subtract(st,ht,Gn),cn=t.normalize(Ht,Ve),xt=t.subtract(Vt,ht,qn);xt=t.normalize(xt,xt);let ut=t.cross(cn,xt,Ve);ut=t.normalize(ut,ut);let yt=t.cross(xt,mt,Zn);yt=t.normalize(yt,yt);let kt=t.subtract(lt,st,Wn);kt=t.normalize(kt,kt);let Mt=t.cross(W,kt,Vn);Mt=t.normalize(Mt,Mt);let sn=ue/M,ln=fe/M,$t=0,_t,bt,ft,Se=0,Te=0;if(c){$t=t.distance(pt,gt),_t=Ct.fromCartesian(pt,Jn),bt=t.subtract(gt,pt,$e),ft=t.normalize(bt,Kn);let T=ft.x;ft.x=ft.y,ft.y=-T,Se=$t/B,Te=de/B}for(g=0;g<8;g++){let T=Tt+g*4,wt=It+g*2,Nt=T+3,xe=g<4?1:-1,Rt=g===2||g===3||g===6||g===7?1:-1;t.pack(we.high,j,T),j[Nt]=Ht.x,t.pack(we.low,q,T),q[Nt]=Ht.y,t.pack(yt,d,T),d[Nt]=Ht.z,t.pack(Mt,X,T),X[Nt]=sn*xe,t.pack(ut,v,T);let dt=ln*Rt;dt===0&&Rt<0&&(dt=9),v[Nt]=dt,c&&(k[T]=_t.high.x,k[T+1]=_t.high.y,k[T+2]=_t.low.x,k[T+3]=_t.low.y,N[T]=-ot.y,N[T+1]=ot.x,N[T+2]=it.y,N[T+3]=-it.x,H[T]=bt.x,H[T+1]=bt.y,H[T+2]=ft.x,H[T+3]=ft.y,y[wt]=Se*xe,dt=Te*Rt,dt===0&&Rt<0&&(dt=9),y[wt+1]=dt)}let $=Xn,J=Yn,K=zn,Q=jn,hn=U.fromCartographicArray(vn,Bn),Ee=Yt.getMinimumMaximumHeights(hn,f),Jt=Ee.minimumTerrainHeight,Kt=Ee.maximumTerrainHeight;Wt+=Math.abs(Jt),Wt+=Math.abs(Kt),Ue(ht,Vt,Jt,Kt,$,K),Ue(st,lt,Jt,Kt,J,Q);let tt=t.multiplyByScalar(ut,p.EPSILON5,Je);t.add($,tt,$),t.add(J,tt,J),t.add(K,tt,K),t.add(Q,tt,Q),Gt($,J),Gt(K,Q),t.pack($,I,b),t.pack(J,I,b+3),t.pack(Q,I,b+6),t.pack(K,I,b+9),tt=t.multiplyByScalar(ut,-2*p.EPSILON5,Je),t.add($,tt,$),t.add(J,tt,J),t.add(K,tt,K),t.add(Q,tt,Q),Gt($,J),Gt(K,Q),t.pack($,I,b+12),t.pack(J,I,b+15),t.pack(Q,I,b+18),t.pack(K,I,b+21),V+=2,s+=3,It+=16,b+=24,Tt+=32,fe+=ue,de+=$t}s=0;let me=0;for(l=0;l