@openglobus/openglobus-react 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +5 -5
- package/dist/index.umd.js +2 -2
- package/dist/src/index.d.ts +3 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -21921,14 +21921,14 @@ class Rt {
|
|
|
21921
21921
|
Rt.__counter__ = 0;
|
|
21922
21922
|
let Ct;
|
|
21923
21923
|
const Fn = kn({
|
|
21924
|
-
|
|
21925
|
-
|
|
21924
|
+
globus: null,
|
|
21925
|
+
setGlobus: () => {
|
|
21926
21926
|
}
|
|
21927
21927
|
}), kh = ({ children: c }) => {
|
|
21928
21928
|
const [e, t] = Dn(Ct);
|
|
21929
|
-
return /* @__PURE__ */ ir.createElement(Fn.Provider, { value: {
|
|
21929
|
+
return /* @__PURE__ */ ir.createElement(Fn.Provider, { value: { globus: e, setGlobus: t } }, c);
|
|
21930
21930
|
}, Dh = () => Nn(Fn), Oh = ({ children: c }) => {
|
|
21931
|
-
const e = Hn(null), {
|
|
21931
|
+
const e = Hn(null), { setGlobus: t } = Dh();
|
|
21932
21932
|
return On(() => {
|
|
21933
21933
|
if (Ct)
|
|
21934
21934
|
e.current = Ct.$target;
|
|
@@ -21978,7 +21978,7 @@ const Fn = kn({
|
|
|
21978
21978
|
}, id: "globus", ref: e }, c));
|
|
21979
21979
|
};
|
|
21980
21980
|
export {
|
|
21981
|
-
kh as
|
|
21981
|
+
kh as GlobusContextProvider,
|
|
21982
21982
|
Oh as default,
|
|
21983
21983
|
Dh as useGlobusContext
|
|
21984
21984
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(je,Me){typeof exports=="object"&&typeof module<"u"?Me(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],Me):(je=typeof globalThis<"u"?globalThis:je||self,Me(je["@openglobus/react"]={},je.React))})(this,function(je,Me){"use strict";const Ni=2*Math.PI,nt=2147483647,fe=549755748352,pe=-fe,O=Math.PI/180,we=180/Math.PI,hi=.5*O,Hn=Math.sqrt(.5),On=.1,Ye=1e-10,Rr=1e-12,Sr=1e-14,Vn=1e-15;function Hi(c=0,e=1){return Math.floor(Math.random()*(e-c))+c}function Oi(c,e){return(c%e+e)%e}function Ir(c){const e=Oi(c,Ni);return Math.abs(e)<Sr&&Math.abs(c)>Sr?Ni:e}function zr(c,e){return e<c?0:1}function ci(c){const e=Math.abs(c);return e-Math.floor(e)}function Un(c){return Math.pow(2,c)}function Gn(c,e,t){return t+c*(e-t)}function Fr(c){return c-Math.floor(c/360)*360}const jn=Math.PI*.5,kr=180/Math.PI,Yn=kr*2,Vi=Math.PI/360,qn=kr*jn;class B{constructor(e=0,t=0,i=0){this.lon=0,this.lat=0,this.height=0,this.lon=e,this.lat=t,this.height=i}isZero(){return this.lon===0&&this.lat===0&&this.height===0}static join(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t[i]=new B(r[0],r[1],r[2])}return t}static createFromArray(e){return new B(e[0],e[1],e[2])}static toArray(e){return[e.lon,e.lat,e.height]}toArray(){return B.toArray(this)}static forwardMercator(e,t,i){return new B(e*Gi,Math.log(Math.tan((90+t)*Vi))*Dt,i)}static forwardMercatorRes(e,t){return t.lon=e.lon*Gi,t.lat=Math.log(Math.tan((90+e.lat)*Vi))*Dt,t.height=e.height,t}static inverseMercator(e,t,i=0){return new B(e*Xn,Yn*Math.atan(Math.exp(t*Dr))-qn,i)}set(e=0,t=0,i=0){return this.lon=e,this.lat=t,this.height=i,this}copy(e){return this.lon=e.lon,this.lat=e.lat,this.height=e.height,this}clone(){return new B(this.lon,this.lat,this.height)}forwardMercator(){return B.forwardMercator(this.lon,this.lat,this.height)}forwardMercatorEPS01(){let e=this.lat;return e>89.9?e=89.9:e<-89.9&&(e=-89.9),new B(this.lon*Gi,Math.log(Math.tan((90+e)*Vi))*Dt)}inverseMercator(){return B.inverseMercator(this.lon,this.lat,this.height)}equal(e){return e.height?this.lon===e.lon&&this.lat===e.lat&&this.height===e.height:this.lon===e.lon&&this.lat===e.lat}}const re=2003750834e-2,Ui=re*2,Dr=Math.PI/re,Dt=re/Math.PI,Wn=Math.PI*.5,Gi=re/180,Xn=180/re,Nr=Math.PI/360,Zn=180/Math.PI,ji=2*re,di=1/ji;function Hr(c){return new B(c.lon*re/180,Math.log(Math.tan((90+c.lat)*Nr))*Dt,c.height)}function fi(c){return c*re/180}function ui(c){return Math.log(Math.tan((90+c)*Nr))*Dt}function $n(c){return Zn*(2*Math.atan(Math.exp(c*Dr))-Wn)}function Kn(c,e,t){let i=Ui/Math.pow(2,t),r=new B(-re+c*i,re-e*i-i);return new U(r,new B(r.lon+i,r.lat+i))}const ce=$n(re),Re=-ce;class U{constructor(e=new B,t=new B){this.southWest=e,this.northEast=t}static createFromArray(e){return new U(new B(e[0],e[1]),new B(e[2],e[3]))}static createByCoordinates(e){let t=fe,i=pe,r=fe,s=pe;for(let n=0;n<e.length;n++){const a=e[n];a.lon<t&&(t=a.lon),a.lon>i&&(i=a.lon),a.lat<r&&(r=a.lat),a.lat>s&&(s=a.lat)}return new U(new B(t,r),new B(i,s))}static createByCoordinatesArr(e){let t=fe,i=pe,r=fe,s=pe;for(let n=0;n<e.length;n++){const a=e[n];a[0]<t&&(t=a[0]),a[0]>i&&(i=a[0]),a[1]<r&&(r=a[1]),a[1]>s&&(s=a[1])}return new U(new B(t,r),new B(i,s))}static fromTile(e,t,i,r=ji,s=ji){const n=Math.pow(2,i),a=Math.pow(2,i),o=r/a,l=s/n,h=-r*.5+e*o,d=s*.5-t*l,f=d-l,u=h+o;return new U(new B(h,f),new B(u,d))}setByCoordinates(e){let t=fe,i=pe,r=fe,s=pe;for(let n=0;n<e.length;n++){const a=e[n];a.lon<t&&(t=a.lon),a.lon>i&&(i=a.lon),a.lat<r&&(r=a.lat),a.lat>s&&(s=a.lat)}return this.southWest.lon=t,this.southWest.lat=r,this.northEast.lon=i,this.northEast.lat=s,this}isInside(e){const t=this.southWest,i=this.northEast;return e.lon>=t.lon&&e.lon<=i.lon&&e.lat>=t.lat&&e.lat<=i.lat}overlaps(e){const t=this.southWest,i=this.northEast;return t.lon<=e.northEast.lon&&i.lon>=e.southWest.lon&&t.lat<=e.northEast.lat&&i.lat>=e.southWest.lat}getWidth(){return this.northEast.lon-this.southWest.lon}getHeight(){return this.northEast.lat-this.southWest.lat}clone(){return new U(this.southWest.clone(),this.northEast.clone())}getCenter(){const e=this.southWest,t=this.northEast;return new B(e.lon+(t.lon-e.lon)*.5,e.lat+(t.lat-e.lat)*.5)}getNorthWest(){return new B(this.southWest.lon,this.northEast.lat)}getNorthEast(){return new B(this.northEast.lon,this.northEast.lat)}getSouthWest(){return new B(this.southWest.lon,this.southWest.lat)}getSouthEast(){return new B(this.northEast.lon,this.southWest.lat)}getNorth(){return this.northEast.lat}getEast(){return this.northEast.lon}getWest(){return this.southWest.lon}getSouth(){return this.southWest.lat}equals(e){return this.southWest.lon===e.southWest.lon&&this.southWest.lat===e.southWest.lat&&this.northEast.lon===e.northEast.lon&&this.northEast.lat===e.northEast.lat}forwardMercator(){return new U(this.southWest.forwardMercator(),this.northEast.forwardMercator())}inverseMercator(){return new U(this.southWest.inverseMercator(),this.northEast.inverseMercator())}getCartesianBounds(e){let t=fe,i=pe,r=fe,s=pe,n=fe,a=pe;const o=[new B(this.southWest.lon,this.southWest.lat),new B(this.southWest.lon,this.northEast.lat),new B(this.northEast.lon,this.northEast.lat),new B(this.northEast.lon,this.southWest.lat)];for(let l=0;l<o.length;l++){const h=e.lonLatToCartesian(o[l]),d=h.x,f=h.y,u=h.z;d<t&&(t=d),d>i&&(i=d),f<r&&(r=f),f>s&&(s=f),u<n&&(n=u),u>a&&(a=u)}return[t,r,n,i,s,a]}toString(){return`[${this.southWest.lon.toFixed(5)}, ${this.southWest.lat.toFixed(5)}, ${this.northEast.lon.toFixed(5)}, ${this.northEast.lat.toFixed(5)}]`}}class at{constructor(){this._m=[0,0,0,0,0,0,0,0,0]}set(e){return this._m[0]=e[0],this._m[1]=e[1],this._m[2]=e[2],this._m[3]=e[3],this._m[4]=e[4],this._m[5]=e[5],this._m[6]=e[6],this._m[7]=e[7],this._m[8]=e[8],this}clone(){let e=new at;return e.set(this._m),e}copy(e){return this.set(e._m)}transposeTo(){let e=new at,t=this._m;return e._m[0]=t[0],e._m[1]=t[3],e._m[2]=t[6],e._m[3]=t[1],e._m[4]=t[4],e._m[5]=t[7],e._m[6]=t[2],e._m[7]=t[5],e._m[8]=t[8],e}setIdentity(){return this._m[0]=1,this._m[1]=0,this._m[2]=0,this._m[3]=0,this._m[4]=1,this._m[5]=0,this._m[6]=0,this._m[7]=0,this._m[8]=1,this}mulVec(e){let t=e.x,i=e.y,r=e.z,s=this._m;return new p(s[0]*t+s[3]*i+s[6]*r,s[1]*t+s[4]*i+s[7]*r,s[2]*t+s[5]*i+s[8]*r)}toMatrix4(){let e=new ne,t=e._m,i=this._m;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=0,t[4]=i[3],t[5]=i[4],t[6]=i[5],t[7]=0,t[8]=i[6],t[9]=i[7],t[10]=i[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,e}}class J{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.z=i,this.w=r}static get identity(){return new J(0,0,0,1)}static fromVec(e){return new J(e[0],e[1],e[2],e[3])}toVec3(){return new p(this.x,this.y,this.z)}clone(){return new J(this.x,this.y,this.z,this.w)}equal(e){return this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}toArray(){return[this.x,this.y,this.z,this.w]}toArray3(){return[this.x,this.y,this.z]}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}addA(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}subA(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}affinity(){let e=1/this.w;return this.x*=e,this.y*=e,this.z*=e,this.w=1,this}scaleTo(e){return new J(this.x*e,this.y*e,this.z*e,this.w*e)}getStep(e){return new J(this.x<e?0:1,this.y<e?0:1,this.z<e?0:1,this.w<e?0:1)}getFrac(e){return new J(ci(e.x),ci(e.y),ci(e.z),ci(e.w))}dot(e){return e.x*this.x+e.y*this.y+e.z*this.z+e.w*this.w}isZero(){return!(this.x||this.y||this.z||this.w)}}class ne{constructor(){this._m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}static identity(){let e=new ne;return e._m[0]=1,e._m[1]=0,e._m[2]=0,e._m[3]=0,e._m[4]=0,e._m[5]=1,e._m[6]=0,e._m[7]=0,e._m[8]=0,e._m[9]=0,e._m[10]=1,e._m[11]=0,e._m[12]=0,e._m[13]=0,e._m[14]=0,e._m[15]=1,e}set(e){return this._m[0]=e[0],this._m[1]=e[1],this._m[2]=e[2],this._m[3]=e[3],this._m[4]=e[4],this._m[5]=e[5],this._m[6]=e[6],this._m[7]=e[7],this._m[8]=e[8],this._m[9]=e[9],this._m[10]=e[10],this._m[11]=e[11],this._m[12]=e[12],this._m[13]=e[13],this._m[14]=e[14],this._m[15]=e[15],this}clone(){let e=new ne;return e.set(this._m),e}copy(e){return this.set(e._m)}toMatrix3(){let e=new at,t=this._m,i=e._m;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[4],i[4]=t[5],i[5]=t[6],i[6]=t[8],i[7]=t[9],i[8]=t[10],e}mulVec3(e){let t=e.x,i=e.y,r=e.z;return new p(this._m[0]*t+this._m[4]*i+this._m[8]*r+this._m[12],this._m[1]*t+this._m[5]*i+this._m[9]*r+this._m[13],this._m[2]*t+this._m[6]*i+this._m[10]*r+this._m[14])}mulVec4(e){let t=e.x,i=e.y,r=e.z,s=e.w;return new J(this._m[0]*t+this._m[4]*i+this._m[8]*r+this._m[12]*s,this._m[1]*t+this._m[5]*i+this._m[9]*r+this._m[13]*s,this._m[2]*t+this._m[6]*i+this._m[10]*r+this._m[14]*s,this._m[3]*t+this._m[7]*i+this._m[11]*r+this._m[15]*s)}toInverseMatrix3(){let e=this._m,t=e[0],i=e[1],r=e[2],s=e[4],n=e[5],a=e[6],o=e[8],l=e[9],h=e[10],d=h*n-a*l,f=-h*s+a*o,u=l*s-n*o,g=t*d+i*f+r*u;if(!g)return;g=1/g;let _=new at;return _._m[0]=d*g,_._m[1]=(-h*i+r*l)*g,_._m[2]=(a*i-r*n)*g,_._m[3]=f*g,_._m[4]=(h*t-r*o)*g,_._m[5]=(-a*t+r*s)*g,_._m[6]=u*g,_._m[7]=(-l*t+i*o)*g,_._m[8]=(n*t-i*s)*g,_}inverseTo(e=new ne){let t=this._m[0],i=this._m[1],r=this._m[2],s=this._m[3],n=this._m[4],a=this._m[5],o=this._m[6],l=this._m[7],h=this._m[8],d=this._m[9],f=this._m[10],u=this._m[11],g=this._m[12],_=this._m[13],m=this._m[14],v=this._m[15],b=t*a-i*n,y=t*o-r*n,w=t*l-s*n,x=i*o-r*a,T=i*l-s*a,A=r*l-s*o,E=h*_-d*g,C=h*m-f*g,P=h*v-u*g,I=d*m-f*_,k=d*v-u*_,z=f*v-u*m,L=1/(b*z-y*k+w*I+x*P-T*C+A*E);return e._m[0]=(a*z-o*k+l*I)*L,e._m[1]=(-i*z+r*k-s*I)*L,e._m[2]=(_*A-m*T+v*x)*L,e._m[3]=(-d*A+f*T-u*x)*L,e._m[4]=(-n*z+o*P-l*C)*L,e._m[5]=(t*z-r*P+s*C)*L,e._m[6]=(-g*A+m*w-v*y)*L,e._m[7]=(h*A-f*w+u*y)*L,e._m[8]=(n*k-a*P+l*E)*L,e._m[9]=(-t*k+i*P-s*E)*L,e._m[10]=(g*T-_*w+v*b)*L,e._m[11]=(-h*T+d*w-u*b)*L,e._m[12]=(-n*I+a*C-o*E)*L,e._m[13]=(t*I-i*C+r*E)*L,e._m[14]=(-g*x+_*y-m*b)*L,e._m[15]=(h*x-d*y+f*b)*L,e}transposeTo(){let e=new ne;return e._m[0]=this._m[0],e._m[1]=this._m[4],e._m[2]=this._m[8],e._m[3]=this._m[12],e._m[4]=this._m[1],e._m[5]=this._m[5],e._m[6]=this._m[9],e._m[7]=this._m[13],e._m[8]=this._m[2],e._m[9]=this._m[6],e._m[10]=this._m[10],e._m[11]=this._m[14],e._m[12]=this._m[3],e._m[13]=this._m[7],e._m[14]=this._m[11],e._m[15]=this._m[15],e}setIdentity(){return this._m[0]=1,this._m[1]=0,this._m[2]=0,this._m[3]=0,this._m[4]=0,this._m[5]=1,this._m[6]=0,this._m[7]=0,this._m[8]=0,this._m[9]=0,this._m[10]=1,this._m[11]=0,this._m[12]=0,this._m[13]=0,this._m[14]=0,this._m[15]=1,this}mul(e){let t=this._m[0],i=this._m[1],r=this._m[2],s=this._m[3],n=this._m[4],a=this._m[5],o=this._m[6],l=this._m[7],h=this._m[8],d=this._m[9],f=this._m[10],u=this._m[11],g=this._m[12],_=this._m[13],m=this._m[14],v=this._m[15],b=e._m[0],y=e._m[1],w=e._m[2],x=e._m[3],T=e._m[4],A=e._m[5],E=e._m[6],C=e._m[7],P=e._m[8],I=e._m[9],k=e._m[10],z=e._m[11],L=e._m[12],S=e._m[13],F=e._m[14],R=e._m[15],M=new ne;return M._m[0]=b*t+y*n+w*h+x*g,M._m[1]=b*i+y*a+w*d+x*_,M._m[2]=b*r+y*o+w*f+x*m,M._m[3]=b*s+y*l+w*u+x*v,M._m[4]=T*t+A*n+E*h+C*g,M._m[5]=T*i+A*a+E*d+C*_,M._m[6]=T*r+A*o+E*f+C*m,M._m[7]=T*s+A*l+E*u+C*v,M._m[8]=P*t+I*n+k*h+z*g,M._m[9]=P*i+I*a+k*d+z*_,M._m[10]=P*r+I*o+k*f+z*m,M._m[11]=P*s+I*l+k*u+z*v,M._m[12]=L*t+S*n+F*h+R*g,M._m[13]=L*i+S*a+F*d+R*_,M._m[14]=L*r+S*o+F*f+R*m,M._m[15]=L*s+S*l+F*u+R*v,M}translate(e){let t=e.x,i=e.y,r=e.z,s=this._m;return s[12]=s[0]*t+s[4]*i+s[8]*r+s[12],s[13]=s[1]*t+s[5]*i+s[9]*r+s[13],s[14]=s[2]*t+s[6]*i+s[10]*r+s[14],s[15]=s[3]*t+s[7]*i+s[11]*r+s[15],this}translateToPosition(e){let t=this._m;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this}rotate(e,t){let i=Math.cos(t),r=Math.sin(t),s=new ne,n=s._m;return n[0]=i+(1-i)*e.x*e.x,n[1]=(1-i)*e.y*e.x-r*e.z,n[2]=(1-i)*e.z*e.x+r*e.y,n[3]=0,n[4]=(1-i)*e.x*e.y+r*e.z,n[5]=i+(1-i)*e.y*e.y,n[6]=(1-i)*e.z*e.y-r*e.x,n[7]=0,n[8]=(1-i)*e.x*e.z-r*e.y,n[9]=(1-i)*e.y*e.z+r*e.x,n[10]=i+(1-i)*e.z*e.z,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this.mul(s)}setRotation(e,t){let i=Math.cos(t),r=Math.sin(t),s=this._m;return s[0]=i+(1-i)*e.x*e.x,s[1]=(1-i)*e.y*e.x-r*e.z,s[2]=(1-i)*e.z*e.x+r*e.y,s[3]=0,s[4]=(1-i)*e.x*e.y+r*e.z,s[5]=i+(1-i)*e.y*e.y,s[6]=(1-i)*e.z*e.y-r*e.x,s[7]=0,s[8]=(1-i)*e.x*e.z-r*e.y,s[9]=(1-i)*e.y*e.z+r*e.x,s[10]=i+(1-i)*e.z*e.z,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}rotateBetweenVectors(e,t){return D.getRotationBetweenVectors(e,t).getMat4()}scale(e){let t=this._m;return t[0]=t[0]*e.x,t[1]=t[1]*e.x,t[2]=t[2]*e.x,t[3]=t[3]*e.x,t[4]=t[4]*e.y,t[5]=t[5]*e.y,t[6]=t[6]*e.y,t[7]=t[7]*e.y,t[8]=t[8]*e.z,t[9]=t[9]*e.z,t[10]=t[10]*e.z,t[11]=t[11]*e.z,this}setPerspective(e,t,i,r,s,n){let a=t-e,o=r-i,l=n-s;return this._m[0]=s*2/a,this._m[1]=0,this._m[2]=0,this._m[3]=0,this._m[4]=0,this._m[5]=s*2/o,this._m[6]=0,this._m[7]=0,this._m[8]=(t+e)/a,this._m[9]=(r+i)/o,this._m[10]=-(n+s)/l,this._m[11]=-1,this._m[12]=0,this._m[13]=0,this._m[14]=-(n*s*2)/l,this._m[15]=0,this}setOrtho(e,t,i,r,s,n){let a=1/(e-t),o=1/(i-r),l=1/(s-n),h=this._m;return h[0]=-2*a,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=-2*o,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=2*l,h[11]=0,h[12]=(e+t)*a,h[13]=(r+i)*o,h[14]=(n+s)*l,h[15]=1,this}eulerToMatrix(e,t,i){let r=Math.cos(e),s=Math.sin(e),n=Math.cos(t),a=Math.sin(t),o=Math.cos(i),l=Math.sin(i),h=r*a,d=s*a,f=this._m;return f[0]=n*o,f[1]=-n*l,f[2]=-a,f[4]=-d*o+r*l,f[5]=d*l+r*o,f[6]=-s*n,f[8]=h*o+s*l,f[9]=-h*l+s*o,f[10]=r*n,f[3]=f[7]=f[11]=f[12]=f[13]=f[14]=0,f[15]=1,this}}class D{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.z=i,this.w=r}static get IDENTITY(){return new D(0,0,0,1)}static xRotation(e){return e*=.5,new D(Math.sin(e),0,0,Math.cos(e))}static yRotation(e){return e*=.5,new D(0,Math.sin(e),0,Math.cos(e))}static zRotation(e){return e*=.5,new D(0,0,Math.sin(e),Math.cos(e))}static axisAngleToQuat(e,t=0){let i=e.getNormal(),r=t*.5,s=Math.sin(r);return new D(i.x*s,i.y*s,i.z*s,Math.cos(r))}static getLookRotation(e,t){let i=e.getNormal().negate(),r=t.cross(i).normalize(),s=i.cross(r),n=1+r.x+s.y+i.z;if(n>1e-6){let o=1/(2*Math.sqrt(n));return new D((i.y-s.z)*o,(r.z-i.x)*o,(s.x-r.y)*o,.25/o)}if(r.x>s.y&&r.x>i.z){let o=1/(2*Math.sqrt(1+r.x-s.y-i.z));return new D(.25/o,(s.x+r.y)*o,(r.z+i.x)*o,(i.y-s.z)*o)}if(s.y>i.z){let o=1/(2*Math.sqrt(1+s.y-r.x-i.z));return new D((s.x+r.y)*o,.25/o,(i.y+s.z)*o,(r.z-i.x)*o)}let a=1/(2*Math.sqrt(1+i.z-r.x-s.y));return new D((r.z+i.x)*a,(i.y+s.z)*a,.25/a,(s.x-r.y)*a)}static getLookAtSourceDest(e,t){let i=t.subA(e).normalize(),r=p.FORWARD.dot(i);if(Math.abs(r- -1)<1e-6)return D.axisAngleToQuat(p.UP,Math.PI);if(Math.abs(r-1)<1e-6)return new D(0,0,0,1);let s=Math.acos(r),n=p.FORWARD.cross(i).normalize();return D.axisAngleToQuat(n,s)}static getRotationBetweenVectors(e,t){let i=e.cross(t);return new D(i.x,i.y,i.z,1+e.dot(t)).normalize()}static getRotationBetweenVectorsRes(e,t,i){let r=e.cross(t);return i.set(r.x,r.y,r.z,1+e.dot(t)),i.normalize()}static getRotationBetweenVectorsUp(e,t,i){let r=e.dot(t);if(Math.abs(r+1)<1e-6)return D.axisAngleToQuat(i,Math.PI);if(Math.abs(r-1)<1e-6)return new D(0,0,0,1);let s=Math.acos(r),n=e.cross(t).normalize();return D.axisAngleToQuat(n,s)}isZero(){return this.x===0&&this.y===0&&this.z===0&&this.w===0}clear(){return this.x=this.y=this.z=this.w=0,this}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}setIdentity(){return this.x=0,this.y=0,this.z=0,this.w=1,this}clone(){return new D(this.x,this.y,this.z,this.w)}add(e){return new D(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)}sub(e){return new D(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)}scaleTo(e){return new D(this.x*e,this.y*e,this.z*e,this.w*e)}scale(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}toVec(){return[this.x,this.y,this.z,this.w]}setFromSphericalCoords(e,t,i){let r=Math.sin(i/2),s=Math.cos(i/2),n=Math.sin(e),a=Math.cos(e),o=Math.sin(t),l=Math.cos(t);return this.x=r*a*o,this.y=r*n,this.z=r*n*l,this.w=s,this}setLookRotation(e,t){let i=e.getNormal().negate(),r=t.cross(i).normalize(),s=i.cross(r),n=1+r.x+s.y+i.z;if(n>1e-6){let a=1/(2*Math.sqrt(n));this.x=(i.y-s.z)*a,this.y=(r.z-i.x)*a,this.z=(s.x-r.y)*a,this.w=.25/a}else if(r.x>s.y&&r.x>i.z){let a=1/(2*Math.sqrt(1+r.x-s.y-i.z));this.x=.25/a,this.y=(s.x+r.y)*a,this.z=(r.z+i.x)*a,this.w=(i.y-s.z)*a}else if(s.y>i.z){let a=1/(2*Math.sqrt(1+s.y-r.x-i.z));this.x=(s.x+r.y)*a,this.y=.25/a,this.z=(i.y+s.z)*a,this.w=(r.z-i.x)*a}else{let a=1/(2*Math.sqrt(1+i.z-r.x-s.y));this.x=(r.z+i.x)*a,this.y=(i.y+s.z)*a,this.z=.25/a,this.w=(s.x-r.y)*a}return this}toSphericalCoords(){let e=this.w,t=Math.sqrt(1-e*e);Math.abs(t)<5e-4&&(t=1);let i=this.x/t,r=this.y/t,s=this.z/t,n,a=-Math.asin(r);return i*i+s*s<5e-4?n=0:n=Math.atan2(i,s),n<0&&(n+=360),{lat:a,lon:n,alpha:Math.acos(e)}}setFromAxisAngle(e,t){let i=e.getNormal(),r=t*.5,s=Math.sin(r);return this.set(i.x*s,i.y*s,i.z*s,Math.cos(r)),this}getAxisAngle(){let e=this.x,t=this.y,i=this.z,r=this.w,s=Math.sqrt(e*e+t*t+i*i),n,a;if(s>1e-7){let o=1/s;n=new p(e*o,t*o,i*o),r<0?a=2*Math.atan2(-s,-r):a=2*Math.atan2(s,r)}else n=new p(0,0,0),a=0;return{axis:n,angle:a}}setFromEulerAngles(e,t,i){let r=e*hi,s=t*hi,n=i*hi,a=Math.cos(r),o=Math.cos(s),l=Math.cos(n),h=Math.sin(r),d=Math.sin(s),f=Math.sin(n),u=o*l,g=d*f;return this.w=a*u+h*g,this.x=h*u-a*g,this.y=a*d*l+h*o*f,this.z=a*o*f-h*d*l,this.normalize()}getEulerAngles(){let e=this.x,t=this.y,i=this.z,r=this.w,s=t*t,n=Math.atan2(2*(r*e+t*i),1-2*(e*e+s)),a=r*t-i*e;a<-1?a=-1:a>1&&(a=1);let o=Math.asin(2*a),l=Math.atan2(2*(r*i+e*t),1-2*(s+i*i));return{roll:n,pitch:o,yaw:l}}setFromMatrix4(e){let t,i,r=[],s,n,a,o=e._m,l=[1,2,0];return t=o[0]+o[5]+o[10],t>0?(i=Math.sqrt(t+1),this.w=i/2,i=.5/i,this.x=(o[6]-o[9])*i,this.y=(o[8]-o[2])*i,this.z=(o[1]-o[4])*i):(s=0,o[5]>o[0]&&(s=1),o[10]>o[s*5]&&(s=2),n=l[s],a=l[n],i=Math.sqrt(o[s*5]-(o[n*5]+o[a*5])+1),r[s]=i*.5,i!==0&&(i=.5/i),r[3]=(o[n*4+a]-o[a*4+n])*i,r[n]=(o[s*4+n]+o[n*4+s])*i,r[a]=(o[s*4+a]+o[a*4+s])*i,this.x=r[0],this.y=r[1],this.z=r[2],this.w=r[3]),this}getMat4(e=new ne){let t=this.x+this.x,i=this.y+this.y,r=this.z+this.z,s=this.w*t,n=this.w*i,a=this.w*r,o=this.x*t,l=this.x*i,h=this.x*r,d=this.y*i,f=this.y*r,u=this.z*r;return e.set([1-(d+u),l-a,h+n,0,l+a,1-(o+u),f-s,0,h-n,f+s,1-(o+d),0,0,0,0,1])}getMat3(){let e=new at,t=e._m,i=this.x,r=this.y,s=this.z,n=this.w,a=i+i,o=r+r,l=s+s,h=i*a,d=i*o;i=i*l;let f=r*o;return r=r*l,s=s*l,a=n*a,o=n*o,n=n*l,t[0]=1-(f+s),t[1]=d-n,t[2]=i+o,t[3]=d+n,t[4]=1-(h+s),t[5]=r-a,t[6]=i-o,t[7]=r+a,t[8]=1-(h+f),e}mulVec3(e){let t=e.x,i=e.y,r=e.z,s=this.x,n=this.y,a=this.z,o=this.w,l=o*t+n*r-a*i,h=o*i+a*t-s*r,d=o*r+s*i-n*t;return t=-s*t-n*i-a*r,new p(l*o+t*-s+h*-a-d*-n,h*o+t*-n+d*-s-l*-a,d*o+t*-a+l*-n-h*-s)}mul(e){let t=this.x,i=this.y,r=this.z,s=this.w,n=e.x,a=e.y,o=e.z,l=e.w;return new D(t*l+s*n+i*o-r*a,i*l+s*a+r*n-t*o,r*l+s*o+t*a-i*n,s*l-t*n-i*a-r*o)}mulA(e){let t=this.x,i=this.y,r=this.z,s=this.w,n=e.x,a=e.y,o=e.z,l=e.w;return this.x=t*l+s*n+i*o-r*a,this.y=i*l+s*a+r*n-t*o,this.z=r*l+s*o+t*a-i*n,this.w=s*l-t*n-i*a-r*o,this}conjugate(){return new D(-this.x,-this.y,-this.z,this.w)}inverse(){let e=1/this.magnitude2();return new D(-this.x*e,-this.y*e,-this.z*e,this.w*e)}magnitude(){let e=this.x,t=this.y,i=this.z,r=this.w;return Math.sqrt(e*e+t*t+i*i+r*r)}magnitude2(){let e=this.x,t=this.y,i=this.z,r=this.w;return e*e+t*t+i*i+r*r}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}normalize(){let e=this.x,t=this.y,i=this.z,r=this.w,s=Math.sqrt(e*e+t*t+i*i+r*r);return s===0?(this.x=0,this.y=0,this.z=0,this.w=0,this):(s=1/s,this.x=e*s,this.y=t*s,this.z=i*s,this.w=r*s,this)}isEqual(e){let t=this.dot(e);return Math.abs(t-1)<.001}slerp(e,t){let i=this.x,r=this.y,s=this.z,n=this.w,a=e.x,o=e.y,l=e.z,h=e.w,d,f,u,g,_;return f=i*a+r*o+s*l+n*h,f<0&&(f=-f,a=-a,o=-o,l=-l,h=-h),1-f>1e-6?(d=Math.acos(f),u=Math.sin(d),g=Math.sin((1-t)*d)/u,_=Math.sin(t*d)/u):(g=1-t,_=t),new D(g*i+_*a,g*r+_*o,g*s+_*l,g*n+_*h)}getRoll(e=!1){let t=this.x,i=this.y,r=this.z,s=this.w;if(e){let n=2*i,a=2*r,o=a*s,l=n*t,h=n*i,d=a*r;return Math.atan2(l+o,1-(h+d))}else return Math.atan2(2*(t*i+s*r),s*s+t*t-i*i-r*r)}getPitch(e=!1){let t=this.x,i=this.y,r=this.z,s=this.w;if(e){let n=2*t,a=2*r,o=n*s,l=n*t,h=a*i,d=a*r;return Math.atan2(h+o,1-(l+d))}else return Math.atan2(2*(i*r+s*t),s*s-t*t-i*i+r*r)}getYaw(e=!1){let t=this.x,i=this.y,r=this.z,s=this.w;if(e){let n=2*t,a=2*i,o=2*r,l=a*s,h=n*t,d=o*t,f=a*i;return Math.atan2(d+l,1-(h+f))}else return Math.asin(-2*(t*r-s*i))}}class p{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}static get UP(){return new p(0,1,0)}static get DOWN(){return new p(0,-1,0)}static get RIGHT(){return new p(1,0,0)}static get LEFT(){return new p(-1,0,0)}static get FORWARD(){return new p(0,0,-1)}static get BACKWARD(){return new p(0,0,1)}static get ZERO(){return new p}static get UNIT_X(){return new p(1,0,0)}static get UNIT_Y(){return new p(0,1,0)}static get UNIT_Z(){return new p(0,0,1)}static get NORTH(){return p.UNIT_Z}static doubleToTwoFloats(e,t,i){let r=e.x,s=e.y,n=e.z;if(r>=0){let a=Math.floor(r/65536)*65536;t.x=Math.fround(a),i.x=Math.fround(r-a)}else{let a=Math.floor(-r/65536)*65536;t.x=Math.fround(-a),i.x=Math.fround(r+a)}if(s>=0){let a=Math.floor(s/65536)*65536;t.y=Math.fround(a),i.y=Math.fround(s-a)}else{let a=Math.floor(-s/65536)*65536;t.y=Math.fround(-a),i.y=Math.fround(s+a)}if(n>=0){let a=Math.floor(n/65536)*65536;t.z=Math.fround(a),i.z=Math.fround(n-a)}else{let a=Math.floor(-n/65536)*65536;t.z=Math.fround(-a),i.z=Math.fround(n+a)}}static doubleToTwoFloat32Array(e,t,i){let r=e.x,s=e.y,n=e.z;if(r>=0){let a=Math.floor(r/65536)*65536;t[0]=Math.fround(a),i[0]=Math.fround(r-a)}else{let a=Math.floor(-r/65536)*65536;t[0]=Math.fround(-a),i[0]=Math.fround(r+a)}if(s>=0){let a=Math.floor(s/65536)*65536;t[1]=Math.fround(a),i[1]=Math.fround(s-a)}else{let a=Math.floor(-s/65536)*65536;t[1]=Math.fround(-a),i[1]=Math.fround(s+a)}if(n>=0){let a=Math.floor(n/65536)*65536;t[2]=Math.fround(a),i[2]=Math.fround(n-a)}else{let a=Math.floor(-n/65536)*65536;t[2]=Math.fround(-a),i[2]=Math.fround(n+a)}}static fromVec(e){return new p(e[0],e[1],e[2])}static angle(e,t){return Math.acos(e.dot(t)/Math.sqrt(e.length2()*t.length2()))}static lerp(e,t,i){return new p(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i,e.z+(t.z-e.z)*i)}static add(e,t){let i=new p(e.x,e.y,e.z);return i.addA(t),i}static sub(e,t){let i=new p(e.x,e.y,e.z);return i.subA(t),i}static scale(e,t){return e.scaleTo(t)}static mul(e,t){let i=new p(e.x,e.y,e.z);return i.mulA(t),i}static noncollinear(e,t){return!!(e.y*t.z-e.z*t.y||e.z*t.x-e.x*t.z||e.x*t.y-e.y*t.z)}static proj_b_to_plane(e,t,i){let r=e.sub(t.scaleTo(t.dot(e)/t.dot(t)));return i&&r.isZero()?new p(i.x,i.y,i.z):r}static proj_b_to_a(e,t){return t.scaleTo(t.dot(e)/t.dot(t))}static orthoNormalize(e,t){return e=e.getNormal(),e.scale(t.dot(e)),t.subA(e).normalize()}static div(e,t){let i=new p(e.x,e.y,e.z);return i.divA(t),i}static length2(e){return e.length2()}static dot(e,t){return e.dot(t)}toVec4(){return new J(this.x,this.y,this.z,1)}clone(){return new p(this.x,this.y,this.z)}toString(){return`(${this.x},${this.y},${this.z})`}isZero(){return!(this.x||this.y||this.z)}projToVec(e){return e.scaleTo(e.dot(this)/e.dot(e))}equal(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}length2(){return this.x*this.x+this.y*this.y+this.z*this.z}getQuat(){return new D(this.x,this.y,this.z)}addA(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}add(e){return new p(this.x+e.x,this.y+e.y,this.z+e.z)}subA(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}sub(e){return new p(this.x-e.x,this.y-e.y,this.z-e.z)}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}scaleTo(e){return new p(this.x*e,this.y*e,this.z*e)}mulA(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}mul(e){return new p(this.x*e.x,this.y*e.y,this.z*e.z)}divA(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}div(e){return new p(this.x/e.x,this.y/e.y,this.z/e.z)}dot(e){return e.x*this.x+e.y*this.y+e.z*this.z}dotArr(e){return e[0]*this.x+e[1]*this.y+e[2]*this.z}cross(e){return new p(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}clear(){return this.x=this.y=this.z=0,this}getNormal(){let e=new p;e.copy(this);let t=1/e.length();return e.x*=t,e.y*=t,e.z*=t,e}normal(){let e=new p;e.copy(this);let t=1/e.length();return e.x*=t,e.y*=t,e.z*=t,e}normalNegate(){let e=new p;e.copy(this);let t=-1/e.length();return e.x*=t,e.y*=t,e.z*=t,e}normalNegateScale(e){let t=new p;t.copy(this);let i=-e/t.length();return t.x*=i,t.y*=i,t.z*=i,t}normalScale(e){let t=new p;t.copy(this);let i=e/t.length();return t.x*=i,t.y*=i,t.z*=i,t}normalize(){let e=1/this.length();return this.x*=e,this.y*=e,this.z*=e,this}toVec(){return[this.x,this.y,this.z]}toArray(){return[this.x,this.y,this.z]}distance(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return Math.sqrt(t*t+i*i+r*r)}distance2(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}set(e,t,i){return this.x=e,this.y=t,this.z=i,this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}negateTo(){return new p(-this.x,-this.y,-this.z)}projToRay(e,t){let i=p.proj_b_to_a(p.sub(this,e),t);return i.addA(e),i}angle(e){return p.angle(this,e)}lerp(e,t){return new p(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t,this.z+(e.z-this.z)*t)}smerp(e,t){let i=1-t;return new p(this.x*t+e.x*i,this.y*t+e.y*i,this.z*t+e.z*i)}static get LERP_DELTA(){return 1e-6}slerp(e,t){let i=new p;if(t<=0)return i.copy(this),i;if(t>=1)return i.copy(e),i;let r,s,n,a,o=this.dot(e);return 1-o>p.LERP_DELTA?(r=Math.acos(o),s=Math.sin(r),n=Math.sin((1-t)*r)/s,a=Math.sin(t*r)/s):(n=1-t,a=t),p.add(this.scaleTo(n),e.scale(a))}getRotationTo(e,t){let i=this.clone(),r=e.clone();i.normalize(),r.normalize();let s=i.dot(r);if(s>=1)return D.IDENTITY.clone();if(s<1e-6-1)if(t.equal(p.ZERO)){let n=p.UNIT_X.cross(i);return n.isZero()&&(n=p.UNIT_Y.cross(i)),n.normalize(),D.axisAngleToQuat(n,Math.PI)}else return D.axisAngleToQuat(t,Math.PI);else{let n=Math.sqrt((1+s)*2),a=1/n,o=i.cross(r),l=new D(o.x*a,o.y*a,o.z*a,n*.5);return l.normalize(),l}}}class V{constructor(e=0,t=0){this.x=e,this.y=t}static get UP(){return new V(0,1)}static get DOWN(){return new V(0,-1)}static get RIGHT(){return new V(1,0)}static get LEFT(){return new V(-1,0)}static get ZERO(){return new V}static add(e,t){const i=new V(e.x,e.y);return i.addA(t),i}static sub(e,t){var i=new V(e.x,e.y);return i.subA(t),i}static scale(e,t){let i=new V(e.x,e.y);return i.scale(t),i}static mul(e,t){let i=new V(e.x,e.y);return i.mulA(t),i}static div(e,t){let i=new V(e.x,e.y);return i.divA(t),i}static proj_b_to_a(e,t){return t.scaleTo(t.dot(e)/t.dot(t))}static angle(e,t){return Math.acos(e.dot(t)/Math.sqrt(e.length2()*t.length2()))}static orthoNormalize(e,t){return e=e.normal(),e.scale(t.dot(e)),t.sub(e).normalize()}toVector3(){return new p(this.x,this.y,0)}clone(){return new V(this.x,this.y)}equal(e){return this.x===e.x&&this.y===e.y}copy(e){return this.x=e.x,this.y=e.y,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}length2(){return this.x*this.x+this.y*this.y}addA(e){return this.x+=e.x,this.y+=e.y,this}add(e){return new V(this.x+e.x,this.y+e.y)}subA(e){return this.x-=e.x,this.y-=e.y,this}sub(e){return new V(this.x-e.x,this.y-e.y)}scale(e){return this.x*=e,this.y*=e,this}scaleTo(e){return new V(this.x*e,this.y*e)}mulA(e){return this.x*=e.x,this.y*=e.y,this}mul(e){return new V(this.x*e.x,this.y*e.y)}divA(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return e.x*this.x+e.y*this.y}dotArr(e){return e[0]*this.x+e[1]*this.y}cross(e){return this.x*e.y-this.y*e.x}clear(){return this.x=this.y=0,this}normal(){let e=new V;e.copy(this);let t=1/e.length();return e.x*=t,e.y*=t,e}normalize(){let e=1/this.length();return this.x*=e,this.y*=e,this}toVec(){return[this.x,this.y]}distance(e){return V.sub(this,e).length()}set(e,t){return this.x=e,this.y=t,this}negate(){return this.x=-this.x,this.y=-this.y,this}negateTo(){return new V(-this.x,-this.y)}projToRay(e,t){let i=V.proj_b_to_a(V.sub(this,e),t);return i.add(e),i}angle(e){return V.angle(this,e)}lerp(e,t,i){let r=this.clone();return i<=0?r.copy(e):i>=1?r.copy(t):r=V.add(e,V.sub(t,e).scale(i)),r}static get LERP_DELTA(){return 1e-6}slerp(e,t){let i=new V;if(t<=0)return i.copy(this),i;if(t>=1)return i.copy(e),i;let r,s,n,a,o=this.dot(e);return 1-o>V.LERP_DELTA?(r=Math.acos(o),s=Math.sin(r),n=Math.sin((1-t)*r)/s,a=Math.sin(t*r)/s):(n=1-t,a=t),V.add(this.scale(n),e.scale(a))}}const Or={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Yi(c,e){return c??e}function At(c){return c==null}let Qn=0;function Vr(c){let e=c._openglobus_id;return e||(e=c._openglobus_id=++Qn),e}function Ur(c){return typeof c=="string"||c instanceof String}function ot(c,e){let t=Or[c];if(t&&(c=t),c[0]==="#"){let i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=c.replace(i,function(n,a,o,l){return a+a+o+o+l+l}),s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return s?new J(parseInt(s[1],16)/255,parseInt(s[2],16)/255,parseInt(s[3],16)/255,At(e)?1:e):new J}else{At(e)&&(e=1);let i=c.split(",");return new J(parseInt(i[0].split("(")[1])/255,parseInt(i[1])/255,parseInt(i[2])/255,At(i[3])?e:parseFloat(i[3]))}}function qi(c,e){let t=ot(c,e);return new Float32Array([t.x,t.y,t.z,t.w])}function Wi(c){let e=Or[c];if(e&&(c=e),c[0]==="#"){let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i=c.replace(t,function(s,n,a,o){return n+n+a+a+o+o}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return r?new p(parseInt(r[1],16)/255,parseInt(r[2],16)/255,parseInt(r[3],16)/255):new p}else{let t=c.split(",");return new p(parseInt(t[0].split("(")[1])/255,parseInt(t[1])/255,parseInt(t[2])/255)}}function Et(c,e){return c.replace(/{[^{}]+}/g,function(t){return e[t.replace(/[{}]+/g,"")]||""})}function Gr(c){let e=document.createElement("div");e.innerHTML=c;let t=[];for(let i=0;i<e.childNodes.length;i++)t.push(e.childNodes[i]),e.removeChild(e.childNodes[i]);return t}function Jn(c,e=""){return c?c.trim():e}function lt(c,e){if(c){if(c instanceof p)return c.clone();if(c instanceof Array)return p.fromVec(c);if(c instanceof V)return new p(c.x,c.y,0)}else if(e)return e;return new p}function qe(c,e){if(c){if(Ur(c))return ot(c);if(c instanceof Array)return J.fromVec(c);if(c instanceof J)return c.clone()}else if(e)return e;return new J(1,1,1,1)}function Se(c,e){if(c){if(Ur(c))return Wi(c);if(c instanceof Array)return p.fromVec(c);if(c instanceof p)return c.clone()}else if(e)return e;return new p(1,1,1)}function jr(c,e){if(c){if(c instanceof Array)return new U(Xi(c[0]),Xi(c[1]));if(c instanceof U)return c.clone()}else if(e)return e;return new U}function Xi(c,e){if(c){if(c instanceof Array)return new B(c[0],c[1],c[2]);if(c instanceof B)return c.clone()}else if(e)return e;return new B}function ea(c,e){let t=0,i=c.length-1;for(;t<=i;){let r=Math.floor((t+i)*.5);if(Math.abs(c[r]-e)<.001)return r;c[r]<e?t=r+1:i=r-1}return-1}function Zi(c,e,t){let i=0,r=c.length-1;for(;i<=r;){let s=r+i>>1,n=t(e,c[s],s);if(n>0)i=s+1;else if(n<0)r=s-1;else return s}return-i-1}function ta(c,e,t){let i=Zi(c,e,t);return i<0&&(i=~i),c.splice(i,0,e),i}function ia(c,e,t,i,r=!1){let s=new B(e.lon-c.lon,e.lat-c.lat),n=new B(i.lon-t.lon,i.lat-t.lat),a=-s.lat,o=+s.lon,l=-(a*c.lon+o*c.lat),h=-n.lat,d=+n.lon,f=-(h*t.lon+d*t.lat),u=h*c.lon+d*c.lat+f,g=h*e.lon+d*e.lat+f,_=a*t.lon+o*t.lat+l,m=a*i.lon+o*i.lat+l;if(r&&(u*g>0||_*m>0))return;let v=u/(u-g);return new B(c.lon+v*s.lon,c.lat+v*s.lat)}function Yr(c,e,t=!1){let i,r=0;return function(){const s=arguments;r?(t&&clearTimeout(i),i=setTimeout(()=>{Date.now()-r>=e&&(c.apply(null,s),r=Date.now())},e-(Date.now()-r))):(c.apply(null,s),r=Date.now())}}function Z(c,e){let t=new c.constructor(c.length+e.length);return t.set(c,0),t.set(e,c.length),t}function ve(c=[],e=[]){if(ArrayBuffer.isView(c))return Z(c,e);for(let t=0;t<e.length;t++)c.push(e[t]);return c}function X(c,e=Float32Array){if(ArrayBuffer.isView(c))return c;{const t=new e(c.length);return t.set(c,0),t}}function Nt(c){return ArrayBuffer.isView(c)?Array.from(c):c}function Te(c,e,t,i){if(ArrayBuffer.isView(c))return e<0&&(t=Math.abs(e),e+=c.length),ee(c,e,t,i);{let r;return e<0?r=c.splice(e):r=c.splice(e,t),i&&(i.result=r),c}}function ee(c,e,t,i){if(c.length===0)return c;const r=c.length-t,s=new c.constructor(r);return s.set(c.subarray(0,e)),s.set(c.subarray(e+t),e),i&&(i.result=c.subarray(e,e+t)),s}function qr(c,e,t,i,r){const s=r+1,n=t+s,a=i+s;let o=new Float64Array(s*s*3),l=0;for(let h=t;h<n;h++)for(let d=i;d<a;d++){let f=3*(h*(e+1)+d);o[l++]=c[f],o[l++]=c[f+1],o[l++]=c[f+2]}return o}function ra(c,e,t,i,r){const s=r+1,n=t+s,a=i+s;let o=new Float32Array(s*s*3),l=0;for(let h=t;h<n;h++)for(let d=i;d<a;d++){let f=3*(h*(e+1)+d);o[l++]=c[f],o[l++]=c[f+1],o[l++]=c[f+2]}return o}function Wr(c,e,t,i,r,s,n,a,o,l,h,d,f){const u=s+a+1,g=n+a+1;r+=1;let _=0,m=0;for(let v=s;v<u;v++)for(let b=n;b<g;b++){let y=v*r+b,w=3*y,x=c[w],T=c[w+1],A=c[w+2];!i||i[y]===0?(x<d.xmin&&(d.xmin=x),x>d.xmax&&(d.xmax=x),T<d.ymin&&(d.ymin=T),T>d.ymax&&(d.ymax=T),A<d.zmin&&(d.zmin=A),A>d.zmax&&(d.zmax=A)):f[m]=1,m++,o[_]=x,h[_]=t[w],l[_++]=e[w],o[_]=T,h[_]=t[w+1],l[_++]=e[w+1],o[_]=A,h[_]=t[w+2],l[_++]=e[w+2]}}function Xr(c){return c.map(e=>Array.isArray(e)?Xr(e):e)}async function sa(c){return new Promise(e=>{const t=new Image;return t.addEventListener("load",()=>{e(t)}),t.src=c,t.crossOrigin="",t})}function na(c){let t=new URLSearchParams(location.search).get(c);if(t)return Number(t)}const aa=.001,oa=1e3,$i=60,la=1/$i,_i=3600,ha=1/_i,Zr=12*_i,Ht=86400,$r=1/864e5,Ki=1/Ht,Kr=2451545;function ca(c,e,t){let i=(e-14)/12|0,r=c+4800+i;return(1461*r/4|0)+(367*(e-2-12*i)/12|0)-(3*((r+100)/100|0)/4|0)+t-32075}function Qr(c){let e=ca(c.getUTCFullYear(),c.getUTCMonth()+1,c.getUTCDate()),t=c.getUTCHours()-12;t<0&&(t+=24);let i=c.getUTCSeconds()+t*_i+c.getUTCMinutes()*$i+c.getUTCMilliseconds()*aa;i>=Zr&&e--;let r=i*Ki|0;return e+=r,i-=Ht*r,i<0&&(e--,i+=Ht),e+i*Ki}function da(c){let e=_a,t=Zi(e,c,function(r,s){return r-s.jd});t<0&&(t=~t),t>=e.length&&(t=e.length-1);let i=e[t].leapSeconds;return t!==0&&(e[t].jd-c)*Ht>i&&(i=e[t-1].leapSeconds),c+i*Ki}function fa(c){let e=c|0,t=(c-e)*Ht;t>=Zr&&e++;let i=e+68569|0,r=4*i/146097|0;i=i-((146097*r+3)/4|0)|0;let s=4e3*(i+1)/1461001|0;i=i-(1461*s/4|0)+31|0;let n=80*i/2447|0,a=i-(2447*n/80|0)|0;i=n/11|0;let o=n+2-12*i|0,l=100*(r-49)+s+i|0,h=t*ha|0,d=t-h*_i,f=d*la|0;d=d-f*$i;let u=d|0,g=(d-u)*oa|0;return h+=12,h>23&&(h-=24),new Date(Date.UTC(l,o-1,a,h,f,u,g))}function ua(c,e){return c+e*$r}function Y(c,e){return{jd:c,leapSeconds:e}}const _a=[Y(24413175e-1,10),Y(24414995e-1,11),Y(24416835e-1,12),Y(24420485e-1,13),Y(24424135e-1,14),Y(24427785e-1,15),Y(24431445e-1,16),Y(24435095e-1,17),Y(24438745e-1,18),Y(24442395e-1,19),Y(24447865e-1,20),Y(24451515e-1,21),Y(24455165e-1,22),Y(24462475e-1,23),Y(24471615e-1,24),Y(24478925e-1,25),Y(24482575e-1,26),Y(24488045e-1,27),Y(24491695e-1,28),Y(24495345e-1,29),Y(24500835e-1,30),Y(24506305e-1,31),Y(24511795e-1,32),Y(24537365e-1,33),Y(24548325e-1,34),Y(24561095e-1,35),Y(24572045e-1,36)];da(Kr);class ga{constructor(e){this.vertices=[new p,new p,new p,new p,new p,new p,new p,new p],e&&this.setFromBoundsArr(e)}copy(e){for(let t=0,i=this.vertices.length;t<i;t++)this.vertices[t].copy(e.vertices[t])}setFromBoundsArr(e){let t=e[0],i=e[3],r=e[1],s=e[4],n=e[2],a=e[5],o=this.vertices;o[0].set(t,r,n),o[1].set(i,r,n),o[2].set(i,r,a),o[3].set(t,r,a),o[4].set(t,s,n),o[5].set(i,s,n),o[6].set(i,s,a),o[7].set(t,s,a)}setFromExtent(e,t){this.setFromBoundsArr(t.getCartesianBounds(e))}}class Ze{constructor(e=0,t){this.radius=e,this.center=t?t.clone():new p}setFromBounds(e){let t=new p(e[0],e[1],e[2]);this.center.set(t.x+(e[3]-t.x)*.5,t.y+(e[3]-t.y)*.5,t.z+(e[5]-t.z)*.5),this.radius=this.center.distance(t)}setFromExtent(e,t){this.setFromBounds(t.getCartesianBounds(e))}}function We(c,e){return new Ot(c,e)}class Ot{constructor(e,t){this.__id=Ot.__counter__++,this._eventNames=[],e&&this.registerNames(e),this._sender=t||this,this._stopPropagation=!1,this._stampCache={}}bindSender(e){this._sender=e||this}registerNames(e){for(let t=0;t<e.length;t++)this[e[t]]={active:!0,handlers:[]},this._eventNames.push(e[t]);return this}_getStamp(e,t,i){return`${e}_${t}_${i}`}_stamp(e,t){let i=Vr(t),r=this._getStamp(e,this.__id,i);return this._stampCache[r]?!1:(this._stampCache[r]=i,!0)}on(e,t,i,r=0){if(this._stamp(e,t)&&this[e]){let s=t.bind(i||this._sender);s._openglobus_id=t._openglobus_id,s._openglobus_priority=r,ta(this[e].handlers,s,(n,a)=>(a._openglobus_priority||0)-(n._openglobus_priority||0))}}off(e,t){if(t){let i=this._getStamp(e,this.__id,t._openglobus_id);if(t._openglobus_id&&this._stampCache[i]){let r=this[e].handlers,s=r.length,n=-1;for(;s--;)if(r[s]._openglobus_id===t._openglobus_id){n=s;break}n!==-1&&(r.splice(n,1),this._stampCache[i]=void 0,delete this._stampCache[i])}}}dispatch(e,...t){let i=!0;if(e&&e.active&&!this._stopPropagation){let r=e.handlers.slice(0),s=r.length;for(;s--;)r[s](...t)===!1&&(i=!1)}return this._stopPropagation=!1,i}stopPropagation(){this._stopPropagation=!0}clear(){for(let e=0;e<this._eventNames.length;e++){let t=this[this._eventNames[e]];t.handlers.length=0,t.handlers=[]}this._eventNames.length=0,this._eventNames=[]}}Ot.__counter__=0;const ma=["render"];class Pe{constructor(e={}){this.__id=Pe.__counter__++,this.events=We(ma),this.model=e.model||null,this.template=e.template||"",this.parent=e.parent||null,this._classList=e.classList||[],this.el=null}static getHTML(e,t){return Et(e,t)}static parseHTML(e){return Gr(e)}static insertAfter(e,t){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)t.parentNode&&t.parentNode.insertBefore(e[i],t.nextSibling);return e}static insertBefore(e,t){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)t.parentNode&&t.parentNode.insertBefore(e[i],t);return e}insertBefore(e){this.el||this.render(),this.el&&(e instanceof HTMLElement&&e.parentNode&&Pe.insertBefore(this.el,e),e instanceof Pe&&e.el&&e.el.parentNode&&Pe.insertBefore(this.el,e.el))}insertAfter(e){this.el||this.render(),this.el&&(e instanceof HTMLElement&&e.parentNode&&Pe.insertAfter(this.el,e),e instanceof Pe&&e.el&&e.el.parentNode&&Pe.insertAfter(this.el,e.el))}isEqual(e){return e.__id===this.__id}appendTo(e,t=!1,i=!1){return e&&(this.el||(this.beforeRender(e),this.render()),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),t&&(e.innerHTML=""),this.el&&(i?e.childNodes[0]?Pe.insertBefore(this.el,e.childNodes[0]):e.appendChild(this.el):e.appendChild(this.el)),this.afterRender(e)),this}afterRender(e){}beforeRender(e){}stopPropagation(){this.events.stopPropagation()}renderTemplate(e){return Pe.parseHTML(Pe.getHTML(this.template,e||{}))[0]}render(e){this.el=this.renderTemplate(e);for(let t=0,i=this._classList.length;t<i;t++)this.el.classList.add(this._classList[t]);return this.events.dispatch(this.events.render,this),this}select(e){return this.el?this.el.querySelector(e):null}selectRemove(e){if(this.el){let t=this.select(e);if(t&&t.parentNode)return t.parentNode.removeChild(t),t}}selectAll(e,t){if(this.el){const i=this.el.querySelectorAll(e);if(t)for(let r=0,s=i.length;r<s;r++)t(i[r],r);return i}}remove(){this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}Pe.__counter__=0;const pa=`<div class="og-button" title="{title}">
|
|
1
|
+
(function(je,Me){typeof exports=="object"&&typeof module<"u"?Me(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],Me):(je=typeof globalThis<"u"?globalThis:je||self,Me(je["@openglobus/openglobus-react"]={},je.React))})(this,function(je,Me){"use strict";const Ni=2*Math.PI,nt=2147483647,fe=549755748352,pe=-fe,O=Math.PI/180,we=180/Math.PI,hi=.5*O,Hn=Math.sqrt(.5),On=.1,Ye=1e-10,Rr=1e-12,Sr=1e-14,Vn=1e-15;function Hi(c=0,e=1){return Math.floor(Math.random()*(e-c))+c}function Oi(c,e){return(c%e+e)%e}function Ir(c){const e=Oi(c,Ni);return Math.abs(e)<Sr&&Math.abs(c)>Sr?Ni:e}function zr(c,e){return e<c?0:1}function ci(c){const e=Math.abs(c);return e-Math.floor(e)}function Un(c){return Math.pow(2,c)}function Gn(c,e,t){return t+c*(e-t)}function Fr(c){return c-Math.floor(c/360)*360}const jn=Math.PI*.5,kr=180/Math.PI,Yn=kr*2,Vi=Math.PI/360,qn=kr*jn;class B{constructor(e=0,t=0,i=0){this.lon=0,this.lat=0,this.height=0,this.lon=e,this.lat=t,this.height=i}isZero(){return this.lon===0&&this.lat===0&&this.height===0}static join(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t[i]=new B(r[0],r[1],r[2])}return t}static createFromArray(e){return new B(e[0],e[1],e[2])}static toArray(e){return[e.lon,e.lat,e.height]}toArray(){return B.toArray(this)}static forwardMercator(e,t,i){return new B(e*Gi,Math.log(Math.tan((90+t)*Vi))*Dt,i)}static forwardMercatorRes(e,t){return t.lon=e.lon*Gi,t.lat=Math.log(Math.tan((90+e.lat)*Vi))*Dt,t.height=e.height,t}static inverseMercator(e,t,i=0){return new B(e*Xn,Yn*Math.atan(Math.exp(t*Dr))-qn,i)}set(e=0,t=0,i=0){return this.lon=e,this.lat=t,this.height=i,this}copy(e){return this.lon=e.lon,this.lat=e.lat,this.height=e.height,this}clone(){return new B(this.lon,this.lat,this.height)}forwardMercator(){return B.forwardMercator(this.lon,this.lat,this.height)}forwardMercatorEPS01(){let e=this.lat;return e>89.9?e=89.9:e<-89.9&&(e=-89.9),new B(this.lon*Gi,Math.log(Math.tan((90+e)*Vi))*Dt)}inverseMercator(){return B.inverseMercator(this.lon,this.lat,this.height)}equal(e){return e.height?this.lon===e.lon&&this.lat===e.lat&&this.height===e.height:this.lon===e.lon&&this.lat===e.lat}}const re=2003750834e-2,Ui=re*2,Dr=Math.PI/re,Dt=re/Math.PI,Wn=Math.PI*.5,Gi=re/180,Xn=180/re,Nr=Math.PI/360,Zn=180/Math.PI,ji=2*re,di=1/ji;function Hr(c){return new B(c.lon*re/180,Math.log(Math.tan((90+c.lat)*Nr))*Dt,c.height)}function fi(c){return c*re/180}function ui(c){return Math.log(Math.tan((90+c)*Nr))*Dt}function $n(c){return Zn*(2*Math.atan(Math.exp(c*Dr))-Wn)}function Kn(c,e,t){let i=Ui/Math.pow(2,t),r=new B(-re+c*i,re-e*i-i);return new U(r,new B(r.lon+i,r.lat+i))}const ce=$n(re),Re=-ce;class U{constructor(e=new B,t=new B){this.southWest=e,this.northEast=t}static createFromArray(e){return new U(new B(e[0],e[1]),new B(e[2],e[3]))}static createByCoordinates(e){let t=fe,i=pe,r=fe,s=pe;for(let n=0;n<e.length;n++){const a=e[n];a.lon<t&&(t=a.lon),a.lon>i&&(i=a.lon),a.lat<r&&(r=a.lat),a.lat>s&&(s=a.lat)}return new U(new B(t,r),new B(i,s))}static createByCoordinatesArr(e){let t=fe,i=pe,r=fe,s=pe;for(let n=0;n<e.length;n++){const a=e[n];a[0]<t&&(t=a[0]),a[0]>i&&(i=a[0]),a[1]<r&&(r=a[1]),a[1]>s&&(s=a[1])}return new U(new B(t,r),new B(i,s))}static fromTile(e,t,i,r=ji,s=ji){const n=Math.pow(2,i),a=Math.pow(2,i),o=r/a,l=s/n,h=-r*.5+e*o,d=s*.5-t*l,f=d-l,u=h+o;return new U(new B(h,f),new B(u,d))}setByCoordinates(e){let t=fe,i=pe,r=fe,s=pe;for(let n=0;n<e.length;n++){const a=e[n];a.lon<t&&(t=a.lon),a.lon>i&&(i=a.lon),a.lat<r&&(r=a.lat),a.lat>s&&(s=a.lat)}return this.southWest.lon=t,this.southWest.lat=r,this.northEast.lon=i,this.northEast.lat=s,this}isInside(e){const t=this.southWest,i=this.northEast;return e.lon>=t.lon&&e.lon<=i.lon&&e.lat>=t.lat&&e.lat<=i.lat}overlaps(e){const t=this.southWest,i=this.northEast;return t.lon<=e.northEast.lon&&i.lon>=e.southWest.lon&&t.lat<=e.northEast.lat&&i.lat>=e.southWest.lat}getWidth(){return this.northEast.lon-this.southWest.lon}getHeight(){return this.northEast.lat-this.southWest.lat}clone(){return new U(this.southWest.clone(),this.northEast.clone())}getCenter(){const e=this.southWest,t=this.northEast;return new B(e.lon+(t.lon-e.lon)*.5,e.lat+(t.lat-e.lat)*.5)}getNorthWest(){return new B(this.southWest.lon,this.northEast.lat)}getNorthEast(){return new B(this.northEast.lon,this.northEast.lat)}getSouthWest(){return new B(this.southWest.lon,this.southWest.lat)}getSouthEast(){return new B(this.northEast.lon,this.southWest.lat)}getNorth(){return this.northEast.lat}getEast(){return this.northEast.lon}getWest(){return this.southWest.lon}getSouth(){return this.southWest.lat}equals(e){return this.southWest.lon===e.southWest.lon&&this.southWest.lat===e.southWest.lat&&this.northEast.lon===e.northEast.lon&&this.northEast.lat===e.northEast.lat}forwardMercator(){return new U(this.southWest.forwardMercator(),this.northEast.forwardMercator())}inverseMercator(){return new U(this.southWest.inverseMercator(),this.northEast.inverseMercator())}getCartesianBounds(e){let t=fe,i=pe,r=fe,s=pe,n=fe,a=pe;const o=[new B(this.southWest.lon,this.southWest.lat),new B(this.southWest.lon,this.northEast.lat),new B(this.northEast.lon,this.northEast.lat),new B(this.northEast.lon,this.southWest.lat)];for(let l=0;l<o.length;l++){const h=e.lonLatToCartesian(o[l]),d=h.x,f=h.y,u=h.z;d<t&&(t=d),d>i&&(i=d),f<r&&(r=f),f>s&&(s=f),u<n&&(n=u),u>a&&(a=u)}return[t,r,n,i,s,a]}toString(){return`[${this.southWest.lon.toFixed(5)}, ${this.southWest.lat.toFixed(5)}, ${this.northEast.lon.toFixed(5)}, ${this.northEast.lat.toFixed(5)}]`}}class at{constructor(){this._m=[0,0,0,0,0,0,0,0,0]}set(e){return this._m[0]=e[0],this._m[1]=e[1],this._m[2]=e[2],this._m[3]=e[3],this._m[4]=e[4],this._m[5]=e[5],this._m[6]=e[6],this._m[7]=e[7],this._m[8]=e[8],this}clone(){let e=new at;return e.set(this._m),e}copy(e){return this.set(e._m)}transposeTo(){let e=new at,t=this._m;return e._m[0]=t[0],e._m[1]=t[3],e._m[2]=t[6],e._m[3]=t[1],e._m[4]=t[4],e._m[5]=t[7],e._m[6]=t[2],e._m[7]=t[5],e._m[8]=t[8],e}setIdentity(){return this._m[0]=1,this._m[1]=0,this._m[2]=0,this._m[3]=0,this._m[4]=1,this._m[5]=0,this._m[6]=0,this._m[7]=0,this._m[8]=1,this}mulVec(e){let t=e.x,i=e.y,r=e.z,s=this._m;return new p(s[0]*t+s[3]*i+s[6]*r,s[1]*t+s[4]*i+s[7]*r,s[2]*t+s[5]*i+s[8]*r)}toMatrix4(){let e=new ne,t=e._m,i=this._m;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=0,t[4]=i[3],t[5]=i[4],t[6]=i[5],t[7]=0,t[8]=i[6],t[9]=i[7],t[10]=i[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,e}}class J{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.z=i,this.w=r}static get identity(){return new J(0,0,0,1)}static fromVec(e){return new J(e[0],e[1],e[2],e[3])}toVec3(){return new p(this.x,this.y,this.z)}clone(){return new J(this.x,this.y,this.z,this.w)}equal(e){return this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}toArray(){return[this.x,this.y,this.z,this.w]}toArray3(){return[this.x,this.y,this.z]}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}addA(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}subA(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}scale(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}affinity(){let e=1/this.w;return this.x*=e,this.y*=e,this.z*=e,this.w=1,this}scaleTo(e){return new J(this.x*e,this.y*e,this.z*e,this.w*e)}getStep(e){return new J(this.x<e?0:1,this.y<e?0:1,this.z<e?0:1,this.w<e?0:1)}getFrac(e){return new J(ci(e.x),ci(e.y),ci(e.z),ci(e.w))}dot(e){return e.x*this.x+e.y*this.y+e.z*this.z+e.w*this.w}isZero(){return!(this.x||this.y||this.z||this.w)}}class ne{constructor(){this._m=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}static identity(){let e=new ne;return e._m[0]=1,e._m[1]=0,e._m[2]=0,e._m[3]=0,e._m[4]=0,e._m[5]=1,e._m[6]=0,e._m[7]=0,e._m[8]=0,e._m[9]=0,e._m[10]=1,e._m[11]=0,e._m[12]=0,e._m[13]=0,e._m[14]=0,e._m[15]=1,e}set(e){return this._m[0]=e[0],this._m[1]=e[1],this._m[2]=e[2],this._m[3]=e[3],this._m[4]=e[4],this._m[5]=e[5],this._m[6]=e[6],this._m[7]=e[7],this._m[8]=e[8],this._m[9]=e[9],this._m[10]=e[10],this._m[11]=e[11],this._m[12]=e[12],this._m[13]=e[13],this._m[14]=e[14],this._m[15]=e[15],this}clone(){let e=new ne;return e.set(this._m),e}copy(e){return this.set(e._m)}toMatrix3(){let e=new at,t=this._m,i=e._m;return i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[4],i[4]=t[5],i[5]=t[6],i[6]=t[8],i[7]=t[9],i[8]=t[10],e}mulVec3(e){let t=e.x,i=e.y,r=e.z;return new p(this._m[0]*t+this._m[4]*i+this._m[8]*r+this._m[12],this._m[1]*t+this._m[5]*i+this._m[9]*r+this._m[13],this._m[2]*t+this._m[6]*i+this._m[10]*r+this._m[14])}mulVec4(e){let t=e.x,i=e.y,r=e.z,s=e.w;return new J(this._m[0]*t+this._m[4]*i+this._m[8]*r+this._m[12]*s,this._m[1]*t+this._m[5]*i+this._m[9]*r+this._m[13]*s,this._m[2]*t+this._m[6]*i+this._m[10]*r+this._m[14]*s,this._m[3]*t+this._m[7]*i+this._m[11]*r+this._m[15]*s)}toInverseMatrix3(){let e=this._m,t=e[0],i=e[1],r=e[2],s=e[4],n=e[5],a=e[6],o=e[8],l=e[9],h=e[10],d=h*n-a*l,f=-h*s+a*o,u=l*s-n*o,g=t*d+i*f+r*u;if(!g)return;g=1/g;let _=new at;return _._m[0]=d*g,_._m[1]=(-h*i+r*l)*g,_._m[2]=(a*i-r*n)*g,_._m[3]=f*g,_._m[4]=(h*t-r*o)*g,_._m[5]=(-a*t+r*s)*g,_._m[6]=u*g,_._m[7]=(-l*t+i*o)*g,_._m[8]=(n*t-i*s)*g,_}inverseTo(e=new ne){let t=this._m[0],i=this._m[1],r=this._m[2],s=this._m[3],n=this._m[4],a=this._m[5],o=this._m[6],l=this._m[7],h=this._m[8],d=this._m[9],f=this._m[10],u=this._m[11],g=this._m[12],_=this._m[13],m=this._m[14],v=this._m[15],b=t*a-i*n,y=t*o-r*n,w=t*l-s*n,x=i*o-r*a,T=i*l-s*a,A=r*l-s*o,E=h*_-d*g,C=h*m-f*g,P=h*v-u*g,I=d*m-f*_,k=d*v-u*_,z=f*v-u*m,L=1/(b*z-y*k+w*I+x*P-T*C+A*E);return e._m[0]=(a*z-o*k+l*I)*L,e._m[1]=(-i*z+r*k-s*I)*L,e._m[2]=(_*A-m*T+v*x)*L,e._m[3]=(-d*A+f*T-u*x)*L,e._m[4]=(-n*z+o*P-l*C)*L,e._m[5]=(t*z-r*P+s*C)*L,e._m[6]=(-g*A+m*w-v*y)*L,e._m[7]=(h*A-f*w+u*y)*L,e._m[8]=(n*k-a*P+l*E)*L,e._m[9]=(-t*k+i*P-s*E)*L,e._m[10]=(g*T-_*w+v*b)*L,e._m[11]=(-h*T+d*w-u*b)*L,e._m[12]=(-n*I+a*C-o*E)*L,e._m[13]=(t*I-i*C+r*E)*L,e._m[14]=(-g*x+_*y-m*b)*L,e._m[15]=(h*x-d*y+f*b)*L,e}transposeTo(){let e=new ne;return e._m[0]=this._m[0],e._m[1]=this._m[4],e._m[2]=this._m[8],e._m[3]=this._m[12],e._m[4]=this._m[1],e._m[5]=this._m[5],e._m[6]=this._m[9],e._m[7]=this._m[13],e._m[8]=this._m[2],e._m[9]=this._m[6],e._m[10]=this._m[10],e._m[11]=this._m[14],e._m[12]=this._m[3],e._m[13]=this._m[7],e._m[14]=this._m[11],e._m[15]=this._m[15],e}setIdentity(){return this._m[0]=1,this._m[1]=0,this._m[2]=0,this._m[3]=0,this._m[4]=0,this._m[5]=1,this._m[6]=0,this._m[7]=0,this._m[8]=0,this._m[9]=0,this._m[10]=1,this._m[11]=0,this._m[12]=0,this._m[13]=0,this._m[14]=0,this._m[15]=1,this}mul(e){let t=this._m[0],i=this._m[1],r=this._m[2],s=this._m[3],n=this._m[4],a=this._m[5],o=this._m[6],l=this._m[7],h=this._m[8],d=this._m[9],f=this._m[10],u=this._m[11],g=this._m[12],_=this._m[13],m=this._m[14],v=this._m[15],b=e._m[0],y=e._m[1],w=e._m[2],x=e._m[3],T=e._m[4],A=e._m[5],E=e._m[6],C=e._m[7],P=e._m[8],I=e._m[9],k=e._m[10],z=e._m[11],L=e._m[12],S=e._m[13],F=e._m[14],R=e._m[15],M=new ne;return M._m[0]=b*t+y*n+w*h+x*g,M._m[1]=b*i+y*a+w*d+x*_,M._m[2]=b*r+y*o+w*f+x*m,M._m[3]=b*s+y*l+w*u+x*v,M._m[4]=T*t+A*n+E*h+C*g,M._m[5]=T*i+A*a+E*d+C*_,M._m[6]=T*r+A*o+E*f+C*m,M._m[7]=T*s+A*l+E*u+C*v,M._m[8]=P*t+I*n+k*h+z*g,M._m[9]=P*i+I*a+k*d+z*_,M._m[10]=P*r+I*o+k*f+z*m,M._m[11]=P*s+I*l+k*u+z*v,M._m[12]=L*t+S*n+F*h+R*g,M._m[13]=L*i+S*a+F*d+R*_,M._m[14]=L*r+S*o+F*f+R*m,M._m[15]=L*s+S*l+F*u+R*v,M}translate(e){let t=e.x,i=e.y,r=e.z,s=this._m;return s[12]=s[0]*t+s[4]*i+s[8]*r+s[12],s[13]=s[1]*t+s[5]*i+s[9]*r+s[13],s[14]=s[2]*t+s[6]*i+s[10]*r+s[14],s[15]=s[3]*t+s[7]*i+s[11]*r+s[15],this}translateToPosition(e){let t=this._m;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this}rotate(e,t){let i=Math.cos(t),r=Math.sin(t),s=new ne,n=s._m;return n[0]=i+(1-i)*e.x*e.x,n[1]=(1-i)*e.y*e.x-r*e.z,n[2]=(1-i)*e.z*e.x+r*e.y,n[3]=0,n[4]=(1-i)*e.x*e.y+r*e.z,n[5]=i+(1-i)*e.y*e.y,n[6]=(1-i)*e.z*e.y-r*e.x,n[7]=0,n[8]=(1-i)*e.x*e.z-r*e.y,n[9]=(1-i)*e.y*e.z+r*e.x,n[10]=i+(1-i)*e.z*e.z,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this.mul(s)}setRotation(e,t){let i=Math.cos(t),r=Math.sin(t),s=this._m;return s[0]=i+(1-i)*e.x*e.x,s[1]=(1-i)*e.y*e.x-r*e.z,s[2]=(1-i)*e.z*e.x+r*e.y,s[3]=0,s[4]=(1-i)*e.x*e.y+r*e.z,s[5]=i+(1-i)*e.y*e.y,s[6]=(1-i)*e.z*e.y-r*e.x,s[7]=0,s[8]=(1-i)*e.x*e.z-r*e.y,s[9]=(1-i)*e.y*e.z+r*e.x,s[10]=i+(1-i)*e.z*e.z,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}rotateBetweenVectors(e,t){return D.getRotationBetweenVectors(e,t).getMat4()}scale(e){let t=this._m;return t[0]=t[0]*e.x,t[1]=t[1]*e.x,t[2]=t[2]*e.x,t[3]=t[3]*e.x,t[4]=t[4]*e.y,t[5]=t[5]*e.y,t[6]=t[6]*e.y,t[7]=t[7]*e.y,t[8]=t[8]*e.z,t[9]=t[9]*e.z,t[10]=t[10]*e.z,t[11]=t[11]*e.z,this}setPerspective(e,t,i,r,s,n){let a=t-e,o=r-i,l=n-s;return this._m[0]=s*2/a,this._m[1]=0,this._m[2]=0,this._m[3]=0,this._m[4]=0,this._m[5]=s*2/o,this._m[6]=0,this._m[7]=0,this._m[8]=(t+e)/a,this._m[9]=(r+i)/o,this._m[10]=-(n+s)/l,this._m[11]=-1,this._m[12]=0,this._m[13]=0,this._m[14]=-(n*s*2)/l,this._m[15]=0,this}setOrtho(e,t,i,r,s,n){let a=1/(e-t),o=1/(i-r),l=1/(s-n),h=this._m;return h[0]=-2*a,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=-2*o,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=2*l,h[11]=0,h[12]=(e+t)*a,h[13]=(r+i)*o,h[14]=(n+s)*l,h[15]=1,this}eulerToMatrix(e,t,i){let r=Math.cos(e),s=Math.sin(e),n=Math.cos(t),a=Math.sin(t),o=Math.cos(i),l=Math.sin(i),h=r*a,d=s*a,f=this._m;return f[0]=n*o,f[1]=-n*l,f[2]=-a,f[4]=-d*o+r*l,f[5]=d*l+r*o,f[6]=-s*n,f[8]=h*o+s*l,f[9]=-h*l+s*o,f[10]=r*n,f[3]=f[7]=f[11]=f[12]=f[13]=f[14]=0,f[15]=1,this}}class D{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.z=i,this.w=r}static get IDENTITY(){return new D(0,0,0,1)}static xRotation(e){return e*=.5,new D(Math.sin(e),0,0,Math.cos(e))}static yRotation(e){return e*=.5,new D(0,Math.sin(e),0,Math.cos(e))}static zRotation(e){return e*=.5,new D(0,0,Math.sin(e),Math.cos(e))}static axisAngleToQuat(e,t=0){let i=e.getNormal(),r=t*.5,s=Math.sin(r);return new D(i.x*s,i.y*s,i.z*s,Math.cos(r))}static getLookRotation(e,t){let i=e.getNormal().negate(),r=t.cross(i).normalize(),s=i.cross(r),n=1+r.x+s.y+i.z;if(n>1e-6){let o=1/(2*Math.sqrt(n));return new D((i.y-s.z)*o,(r.z-i.x)*o,(s.x-r.y)*o,.25/o)}if(r.x>s.y&&r.x>i.z){let o=1/(2*Math.sqrt(1+r.x-s.y-i.z));return new D(.25/o,(s.x+r.y)*o,(r.z+i.x)*o,(i.y-s.z)*o)}if(s.y>i.z){let o=1/(2*Math.sqrt(1+s.y-r.x-i.z));return new D((s.x+r.y)*o,.25/o,(i.y+s.z)*o,(r.z-i.x)*o)}let a=1/(2*Math.sqrt(1+i.z-r.x-s.y));return new D((r.z+i.x)*a,(i.y+s.z)*a,.25/a,(s.x-r.y)*a)}static getLookAtSourceDest(e,t){let i=t.subA(e).normalize(),r=p.FORWARD.dot(i);if(Math.abs(r- -1)<1e-6)return D.axisAngleToQuat(p.UP,Math.PI);if(Math.abs(r-1)<1e-6)return new D(0,0,0,1);let s=Math.acos(r),n=p.FORWARD.cross(i).normalize();return D.axisAngleToQuat(n,s)}static getRotationBetweenVectors(e,t){let i=e.cross(t);return new D(i.x,i.y,i.z,1+e.dot(t)).normalize()}static getRotationBetweenVectorsRes(e,t,i){let r=e.cross(t);return i.set(r.x,r.y,r.z,1+e.dot(t)),i.normalize()}static getRotationBetweenVectorsUp(e,t,i){let r=e.dot(t);if(Math.abs(r+1)<1e-6)return D.axisAngleToQuat(i,Math.PI);if(Math.abs(r-1)<1e-6)return new D(0,0,0,1);let s=Math.acos(r),n=e.cross(t).normalize();return D.axisAngleToQuat(n,s)}isZero(){return this.x===0&&this.y===0&&this.z===0&&this.w===0}clear(){return this.x=this.y=this.z=this.w=0,this}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}setIdentity(){return this.x=0,this.y=0,this.z=0,this.w=1,this}clone(){return new D(this.x,this.y,this.z,this.w)}add(e){return new D(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)}sub(e){return new D(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)}scaleTo(e){return new D(this.x*e,this.y*e,this.z*e,this.w*e)}scale(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}toVec(){return[this.x,this.y,this.z,this.w]}setFromSphericalCoords(e,t,i){let r=Math.sin(i/2),s=Math.cos(i/2),n=Math.sin(e),a=Math.cos(e),o=Math.sin(t),l=Math.cos(t);return this.x=r*a*o,this.y=r*n,this.z=r*n*l,this.w=s,this}setLookRotation(e,t){let i=e.getNormal().negate(),r=t.cross(i).normalize(),s=i.cross(r),n=1+r.x+s.y+i.z;if(n>1e-6){let a=1/(2*Math.sqrt(n));this.x=(i.y-s.z)*a,this.y=(r.z-i.x)*a,this.z=(s.x-r.y)*a,this.w=.25/a}else if(r.x>s.y&&r.x>i.z){let a=1/(2*Math.sqrt(1+r.x-s.y-i.z));this.x=.25/a,this.y=(s.x+r.y)*a,this.z=(r.z+i.x)*a,this.w=(i.y-s.z)*a}else if(s.y>i.z){let a=1/(2*Math.sqrt(1+s.y-r.x-i.z));this.x=(s.x+r.y)*a,this.y=.25/a,this.z=(i.y+s.z)*a,this.w=(r.z-i.x)*a}else{let a=1/(2*Math.sqrt(1+i.z-r.x-s.y));this.x=(r.z+i.x)*a,this.y=(i.y+s.z)*a,this.z=.25/a,this.w=(s.x-r.y)*a}return this}toSphericalCoords(){let e=this.w,t=Math.sqrt(1-e*e);Math.abs(t)<5e-4&&(t=1);let i=this.x/t,r=this.y/t,s=this.z/t,n,a=-Math.asin(r);return i*i+s*s<5e-4?n=0:n=Math.atan2(i,s),n<0&&(n+=360),{lat:a,lon:n,alpha:Math.acos(e)}}setFromAxisAngle(e,t){let i=e.getNormal(),r=t*.5,s=Math.sin(r);return this.set(i.x*s,i.y*s,i.z*s,Math.cos(r)),this}getAxisAngle(){let e=this.x,t=this.y,i=this.z,r=this.w,s=Math.sqrt(e*e+t*t+i*i),n,a;if(s>1e-7){let o=1/s;n=new p(e*o,t*o,i*o),r<0?a=2*Math.atan2(-s,-r):a=2*Math.atan2(s,r)}else n=new p(0,0,0),a=0;return{axis:n,angle:a}}setFromEulerAngles(e,t,i){let r=e*hi,s=t*hi,n=i*hi,a=Math.cos(r),o=Math.cos(s),l=Math.cos(n),h=Math.sin(r),d=Math.sin(s),f=Math.sin(n),u=o*l,g=d*f;return this.w=a*u+h*g,this.x=h*u-a*g,this.y=a*d*l+h*o*f,this.z=a*o*f-h*d*l,this.normalize()}getEulerAngles(){let e=this.x,t=this.y,i=this.z,r=this.w,s=t*t,n=Math.atan2(2*(r*e+t*i),1-2*(e*e+s)),a=r*t-i*e;a<-1?a=-1:a>1&&(a=1);let o=Math.asin(2*a),l=Math.atan2(2*(r*i+e*t),1-2*(s+i*i));return{roll:n,pitch:o,yaw:l}}setFromMatrix4(e){let t,i,r=[],s,n,a,o=e._m,l=[1,2,0];return t=o[0]+o[5]+o[10],t>0?(i=Math.sqrt(t+1),this.w=i/2,i=.5/i,this.x=(o[6]-o[9])*i,this.y=(o[8]-o[2])*i,this.z=(o[1]-o[4])*i):(s=0,o[5]>o[0]&&(s=1),o[10]>o[s*5]&&(s=2),n=l[s],a=l[n],i=Math.sqrt(o[s*5]-(o[n*5]+o[a*5])+1),r[s]=i*.5,i!==0&&(i=.5/i),r[3]=(o[n*4+a]-o[a*4+n])*i,r[n]=(o[s*4+n]+o[n*4+s])*i,r[a]=(o[s*4+a]+o[a*4+s])*i,this.x=r[0],this.y=r[1],this.z=r[2],this.w=r[3]),this}getMat4(e=new ne){let t=this.x+this.x,i=this.y+this.y,r=this.z+this.z,s=this.w*t,n=this.w*i,a=this.w*r,o=this.x*t,l=this.x*i,h=this.x*r,d=this.y*i,f=this.y*r,u=this.z*r;return e.set([1-(d+u),l-a,h+n,0,l+a,1-(o+u),f-s,0,h-n,f+s,1-(o+d),0,0,0,0,1])}getMat3(){let e=new at,t=e._m,i=this.x,r=this.y,s=this.z,n=this.w,a=i+i,o=r+r,l=s+s,h=i*a,d=i*o;i=i*l;let f=r*o;return r=r*l,s=s*l,a=n*a,o=n*o,n=n*l,t[0]=1-(f+s),t[1]=d-n,t[2]=i+o,t[3]=d+n,t[4]=1-(h+s),t[5]=r-a,t[6]=i-o,t[7]=r+a,t[8]=1-(h+f),e}mulVec3(e){let t=e.x,i=e.y,r=e.z,s=this.x,n=this.y,a=this.z,o=this.w,l=o*t+n*r-a*i,h=o*i+a*t-s*r,d=o*r+s*i-n*t;return t=-s*t-n*i-a*r,new p(l*o+t*-s+h*-a-d*-n,h*o+t*-n+d*-s-l*-a,d*o+t*-a+l*-n-h*-s)}mul(e){let t=this.x,i=this.y,r=this.z,s=this.w,n=e.x,a=e.y,o=e.z,l=e.w;return new D(t*l+s*n+i*o-r*a,i*l+s*a+r*n-t*o,r*l+s*o+t*a-i*n,s*l-t*n-i*a-r*o)}mulA(e){let t=this.x,i=this.y,r=this.z,s=this.w,n=e.x,a=e.y,o=e.z,l=e.w;return this.x=t*l+s*n+i*o-r*a,this.y=i*l+s*a+r*n-t*o,this.z=r*l+s*o+t*a-i*n,this.w=s*l-t*n-i*a-r*o,this}conjugate(){return new D(-this.x,-this.y,-this.z,this.w)}inverse(){let e=1/this.magnitude2();return new D(-this.x*e,-this.y*e,-this.z*e,this.w*e)}magnitude(){let e=this.x,t=this.y,i=this.z,r=this.w;return Math.sqrt(e*e+t*t+i*i+r*r)}magnitude2(){let e=this.x,t=this.y,i=this.z,r=this.w;return e*e+t*t+i*i+r*r}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}normalize(){let e=this.x,t=this.y,i=this.z,r=this.w,s=Math.sqrt(e*e+t*t+i*i+r*r);return s===0?(this.x=0,this.y=0,this.z=0,this.w=0,this):(s=1/s,this.x=e*s,this.y=t*s,this.z=i*s,this.w=r*s,this)}isEqual(e){let t=this.dot(e);return Math.abs(t-1)<.001}slerp(e,t){let i=this.x,r=this.y,s=this.z,n=this.w,a=e.x,o=e.y,l=e.z,h=e.w,d,f,u,g,_;return f=i*a+r*o+s*l+n*h,f<0&&(f=-f,a=-a,o=-o,l=-l,h=-h),1-f>1e-6?(d=Math.acos(f),u=Math.sin(d),g=Math.sin((1-t)*d)/u,_=Math.sin(t*d)/u):(g=1-t,_=t),new D(g*i+_*a,g*r+_*o,g*s+_*l,g*n+_*h)}getRoll(e=!1){let t=this.x,i=this.y,r=this.z,s=this.w;if(e){let n=2*i,a=2*r,o=a*s,l=n*t,h=n*i,d=a*r;return Math.atan2(l+o,1-(h+d))}else return Math.atan2(2*(t*i+s*r),s*s+t*t-i*i-r*r)}getPitch(e=!1){let t=this.x,i=this.y,r=this.z,s=this.w;if(e){let n=2*t,a=2*r,o=n*s,l=n*t,h=a*i,d=a*r;return Math.atan2(h+o,1-(l+d))}else return Math.atan2(2*(i*r+s*t),s*s-t*t-i*i+r*r)}getYaw(e=!1){let t=this.x,i=this.y,r=this.z,s=this.w;if(e){let n=2*t,a=2*i,o=2*r,l=a*s,h=n*t,d=o*t,f=a*i;return Math.atan2(d+l,1-(h+f))}else return Math.asin(-2*(t*r-s*i))}}class p{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}static get UP(){return new p(0,1,0)}static get DOWN(){return new p(0,-1,0)}static get RIGHT(){return new p(1,0,0)}static get LEFT(){return new p(-1,0,0)}static get FORWARD(){return new p(0,0,-1)}static get BACKWARD(){return new p(0,0,1)}static get ZERO(){return new p}static get UNIT_X(){return new p(1,0,0)}static get UNIT_Y(){return new p(0,1,0)}static get UNIT_Z(){return new p(0,0,1)}static get NORTH(){return p.UNIT_Z}static doubleToTwoFloats(e,t,i){let r=e.x,s=e.y,n=e.z;if(r>=0){let a=Math.floor(r/65536)*65536;t.x=Math.fround(a),i.x=Math.fround(r-a)}else{let a=Math.floor(-r/65536)*65536;t.x=Math.fround(-a),i.x=Math.fround(r+a)}if(s>=0){let a=Math.floor(s/65536)*65536;t.y=Math.fround(a),i.y=Math.fround(s-a)}else{let a=Math.floor(-s/65536)*65536;t.y=Math.fround(-a),i.y=Math.fround(s+a)}if(n>=0){let a=Math.floor(n/65536)*65536;t.z=Math.fround(a),i.z=Math.fround(n-a)}else{let a=Math.floor(-n/65536)*65536;t.z=Math.fround(-a),i.z=Math.fround(n+a)}}static doubleToTwoFloat32Array(e,t,i){let r=e.x,s=e.y,n=e.z;if(r>=0){let a=Math.floor(r/65536)*65536;t[0]=Math.fround(a),i[0]=Math.fround(r-a)}else{let a=Math.floor(-r/65536)*65536;t[0]=Math.fround(-a),i[0]=Math.fround(r+a)}if(s>=0){let a=Math.floor(s/65536)*65536;t[1]=Math.fround(a),i[1]=Math.fround(s-a)}else{let a=Math.floor(-s/65536)*65536;t[1]=Math.fround(-a),i[1]=Math.fround(s+a)}if(n>=0){let a=Math.floor(n/65536)*65536;t[2]=Math.fround(a),i[2]=Math.fround(n-a)}else{let a=Math.floor(-n/65536)*65536;t[2]=Math.fround(-a),i[2]=Math.fround(n+a)}}static fromVec(e){return new p(e[0],e[1],e[2])}static angle(e,t){return Math.acos(e.dot(t)/Math.sqrt(e.length2()*t.length2()))}static lerp(e,t,i){return new p(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i,e.z+(t.z-e.z)*i)}static add(e,t){let i=new p(e.x,e.y,e.z);return i.addA(t),i}static sub(e,t){let i=new p(e.x,e.y,e.z);return i.subA(t),i}static scale(e,t){return e.scaleTo(t)}static mul(e,t){let i=new p(e.x,e.y,e.z);return i.mulA(t),i}static noncollinear(e,t){return!!(e.y*t.z-e.z*t.y||e.z*t.x-e.x*t.z||e.x*t.y-e.y*t.z)}static proj_b_to_plane(e,t,i){let r=e.sub(t.scaleTo(t.dot(e)/t.dot(t)));return i&&r.isZero()?new p(i.x,i.y,i.z):r}static proj_b_to_a(e,t){return t.scaleTo(t.dot(e)/t.dot(t))}static orthoNormalize(e,t){return e=e.getNormal(),e.scale(t.dot(e)),t.subA(e).normalize()}static div(e,t){let i=new p(e.x,e.y,e.z);return i.divA(t),i}static length2(e){return e.length2()}static dot(e,t){return e.dot(t)}toVec4(){return new J(this.x,this.y,this.z,1)}clone(){return new p(this.x,this.y,this.z)}toString(){return`(${this.x},${this.y},${this.z})`}isZero(){return!(this.x||this.y||this.z)}projToVec(e){return e.scaleTo(e.dot(this)/e.dot(e))}equal(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}length2(){return this.x*this.x+this.y*this.y+this.z*this.z}getQuat(){return new D(this.x,this.y,this.z)}addA(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}add(e){return new p(this.x+e.x,this.y+e.y,this.z+e.z)}subA(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}sub(e){return new p(this.x-e.x,this.y-e.y,this.z-e.z)}scale(e){return this.x*=e,this.y*=e,this.z*=e,this}scaleTo(e){return new p(this.x*e,this.y*e,this.z*e)}mulA(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}mul(e){return new p(this.x*e.x,this.y*e.y,this.z*e.z)}divA(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}div(e){return new p(this.x/e.x,this.y/e.y,this.z/e.z)}dot(e){return e.x*this.x+e.y*this.y+e.z*this.z}dotArr(e){return e[0]*this.x+e[1]*this.y+e[2]*this.z}cross(e){return new p(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}clear(){return this.x=this.y=this.z=0,this}getNormal(){let e=new p;e.copy(this);let t=1/e.length();return e.x*=t,e.y*=t,e.z*=t,e}normal(){let e=new p;e.copy(this);let t=1/e.length();return e.x*=t,e.y*=t,e.z*=t,e}normalNegate(){let e=new p;e.copy(this);let t=-1/e.length();return e.x*=t,e.y*=t,e.z*=t,e}normalNegateScale(e){let t=new p;t.copy(this);let i=-e/t.length();return t.x*=i,t.y*=i,t.z*=i,t}normalScale(e){let t=new p;t.copy(this);let i=e/t.length();return t.x*=i,t.y*=i,t.z*=i,t}normalize(){let e=1/this.length();return this.x*=e,this.y*=e,this.z*=e,this}toVec(){return[this.x,this.y,this.z]}toArray(){return[this.x,this.y,this.z]}distance(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return Math.sqrt(t*t+i*i+r*r)}distance2(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}set(e,t,i){return this.x=e,this.y=t,this.z=i,this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}negateTo(){return new p(-this.x,-this.y,-this.z)}projToRay(e,t){let i=p.proj_b_to_a(p.sub(this,e),t);return i.addA(e),i}angle(e){return p.angle(this,e)}lerp(e,t){return new p(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t,this.z+(e.z-this.z)*t)}smerp(e,t){let i=1-t;return new p(this.x*t+e.x*i,this.y*t+e.y*i,this.z*t+e.z*i)}static get LERP_DELTA(){return 1e-6}slerp(e,t){let i=new p;if(t<=0)return i.copy(this),i;if(t>=1)return i.copy(e),i;let r,s,n,a,o=this.dot(e);return 1-o>p.LERP_DELTA?(r=Math.acos(o),s=Math.sin(r),n=Math.sin((1-t)*r)/s,a=Math.sin(t*r)/s):(n=1-t,a=t),p.add(this.scaleTo(n),e.scale(a))}getRotationTo(e,t){let i=this.clone(),r=e.clone();i.normalize(),r.normalize();let s=i.dot(r);if(s>=1)return D.IDENTITY.clone();if(s<1e-6-1)if(t.equal(p.ZERO)){let n=p.UNIT_X.cross(i);return n.isZero()&&(n=p.UNIT_Y.cross(i)),n.normalize(),D.axisAngleToQuat(n,Math.PI)}else return D.axisAngleToQuat(t,Math.PI);else{let n=Math.sqrt((1+s)*2),a=1/n,o=i.cross(r),l=new D(o.x*a,o.y*a,o.z*a,n*.5);return l.normalize(),l}}}class V{constructor(e=0,t=0){this.x=e,this.y=t}static get UP(){return new V(0,1)}static get DOWN(){return new V(0,-1)}static get RIGHT(){return new V(1,0)}static get LEFT(){return new V(-1,0)}static get ZERO(){return new V}static add(e,t){const i=new V(e.x,e.y);return i.addA(t),i}static sub(e,t){var i=new V(e.x,e.y);return i.subA(t),i}static scale(e,t){let i=new V(e.x,e.y);return i.scale(t),i}static mul(e,t){let i=new V(e.x,e.y);return i.mulA(t),i}static div(e,t){let i=new V(e.x,e.y);return i.divA(t),i}static proj_b_to_a(e,t){return t.scaleTo(t.dot(e)/t.dot(t))}static angle(e,t){return Math.acos(e.dot(t)/Math.sqrt(e.length2()*t.length2()))}static orthoNormalize(e,t){return e=e.normal(),e.scale(t.dot(e)),t.sub(e).normalize()}toVector3(){return new p(this.x,this.y,0)}clone(){return new V(this.x,this.y)}equal(e){return this.x===e.x&&this.y===e.y}copy(e){return this.x=e.x,this.y=e.y,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}length2(){return this.x*this.x+this.y*this.y}addA(e){return this.x+=e.x,this.y+=e.y,this}add(e){return new V(this.x+e.x,this.y+e.y)}subA(e){return this.x-=e.x,this.y-=e.y,this}sub(e){return new V(this.x-e.x,this.y-e.y)}scale(e){return this.x*=e,this.y*=e,this}scaleTo(e){return new V(this.x*e,this.y*e)}mulA(e){return this.x*=e.x,this.y*=e.y,this}mul(e){return new V(this.x*e.x,this.y*e.y)}divA(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return e.x*this.x+e.y*this.y}dotArr(e){return e[0]*this.x+e[1]*this.y}cross(e){return this.x*e.y-this.y*e.x}clear(){return this.x=this.y=0,this}normal(){let e=new V;e.copy(this);let t=1/e.length();return e.x*=t,e.y*=t,e}normalize(){let e=1/this.length();return this.x*=e,this.y*=e,this}toVec(){return[this.x,this.y]}distance(e){return V.sub(this,e).length()}set(e,t){return this.x=e,this.y=t,this}negate(){return this.x=-this.x,this.y=-this.y,this}negateTo(){return new V(-this.x,-this.y)}projToRay(e,t){let i=V.proj_b_to_a(V.sub(this,e),t);return i.add(e),i}angle(e){return V.angle(this,e)}lerp(e,t,i){let r=this.clone();return i<=0?r.copy(e):i>=1?r.copy(t):r=V.add(e,V.sub(t,e).scale(i)),r}static get LERP_DELTA(){return 1e-6}slerp(e,t){let i=new V;if(t<=0)return i.copy(this),i;if(t>=1)return i.copy(e),i;let r,s,n,a,o=this.dot(e);return 1-o>V.LERP_DELTA?(r=Math.acos(o),s=Math.sin(r),n=Math.sin((1-t)*r)/s,a=Math.sin(t*r)/s):(n=1-t,a=t),V.add(this.scale(n),e.scale(a))}}const Or={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Yi(c,e){return c??e}function At(c){return c==null}let Qn=0;function Vr(c){let e=c._openglobus_id;return e||(e=c._openglobus_id=++Qn),e}function Ur(c){return typeof c=="string"||c instanceof String}function ot(c,e){let t=Or[c];if(t&&(c=t),c[0]==="#"){let i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,r=c.replace(i,function(n,a,o,l){return a+a+o+o+l+l}),s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return s?new J(parseInt(s[1],16)/255,parseInt(s[2],16)/255,parseInt(s[3],16)/255,At(e)?1:e):new J}else{At(e)&&(e=1);let i=c.split(",");return new J(parseInt(i[0].split("(")[1])/255,parseInt(i[1])/255,parseInt(i[2])/255,At(i[3])?e:parseFloat(i[3]))}}function qi(c,e){let t=ot(c,e);return new Float32Array([t.x,t.y,t.z,t.w])}function Wi(c){let e=Or[c];if(e&&(c=e),c[0]==="#"){let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i=c.replace(t,function(s,n,a,o){return n+n+a+a+o+o}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return r?new p(parseInt(r[1],16)/255,parseInt(r[2],16)/255,parseInt(r[3],16)/255):new p}else{let t=c.split(",");return new p(parseInt(t[0].split("(")[1])/255,parseInt(t[1])/255,parseInt(t[2])/255)}}function Et(c,e){return c.replace(/{[^{}]+}/g,function(t){return e[t.replace(/[{}]+/g,"")]||""})}function Gr(c){let e=document.createElement("div");e.innerHTML=c;let t=[];for(let i=0;i<e.childNodes.length;i++)t.push(e.childNodes[i]),e.removeChild(e.childNodes[i]);return t}function Jn(c,e=""){return c?c.trim():e}function lt(c,e){if(c){if(c instanceof p)return c.clone();if(c instanceof Array)return p.fromVec(c);if(c instanceof V)return new p(c.x,c.y,0)}else if(e)return e;return new p}function qe(c,e){if(c){if(Ur(c))return ot(c);if(c instanceof Array)return J.fromVec(c);if(c instanceof J)return c.clone()}else if(e)return e;return new J(1,1,1,1)}function Se(c,e){if(c){if(Ur(c))return Wi(c);if(c instanceof Array)return p.fromVec(c);if(c instanceof p)return c.clone()}else if(e)return e;return new p(1,1,1)}function jr(c,e){if(c){if(c instanceof Array)return new U(Xi(c[0]),Xi(c[1]));if(c instanceof U)return c.clone()}else if(e)return e;return new U}function Xi(c,e){if(c){if(c instanceof Array)return new B(c[0],c[1],c[2]);if(c instanceof B)return c.clone()}else if(e)return e;return new B}function ea(c,e){let t=0,i=c.length-1;for(;t<=i;){let r=Math.floor((t+i)*.5);if(Math.abs(c[r]-e)<.001)return r;c[r]<e?t=r+1:i=r-1}return-1}function Zi(c,e,t){let i=0,r=c.length-1;for(;i<=r;){let s=r+i>>1,n=t(e,c[s],s);if(n>0)i=s+1;else if(n<0)r=s-1;else return s}return-i-1}function ta(c,e,t){let i=Zi(c,e,t);return i<0&&(i=~i),c.splice(i,0,e),i}function ia(c,e,t,i,r=!1){let s=new B(e.lon-c.lon,e.lat-c.lat),n=new B(i.lon-t.lon,i.lat-t.lat),a=-s.lat,o=+s.lon,l=-(a*c.lon+o*c.lat),h=-n.lat,d=+n.lon,f=-(h*t.lon+d*t.lat),u=h*c.lon+d*c.lat+f,g=h*e.lon+d*e.lat+f,_=a*t.lon+o*t.lat+l,m=a*i.lon+o*i.lat+l;if(r&&(u*g>0||_*m>0))return;let v=u/(u-g);return new B(c.lon+v*s.lon,c.lat+v*s.lat)}function Yr(c,e,t=!1){let i,r=0;return function(){const s=arguments;r?(t&&clearTimeout(i),i=setTimeout(()=>{Date.now()-r>=e&&(c.apply(null,s),r=Date.now())},e-(Date.now()-r))):(c.apply(null,s),r=Date.now())}}function Z(c,e){let t=new c.constructor(c.length+e.length);return t.set(c,0),t.set(e,c.length),t}function ve(c=[],e=[]){if(ArrayBuffer.isView(c))return Z(c,e);for(let t=0;t<e.length;t++)c.push(e[t]);return c}function X(c,e=Float32Array){if(ArrayBuffer.isView(c))return c;{const t=new e(c.length);return t.set(c,0),t}}function Nt(c){return ArrayBuffer.isView(c)?Array.from(c):c}function Te(c,e,t,i){if(ArrayBuffer.isView(c))return e<0&&(t=Math.abs(e),e+=c.length),ee(c,e,t,i);{let r;return e<0?r=c.splice(e):r=c.splice(e,t),i&&(i.result=r),c}}function ee(c,e,t,i){if(c.length===0)return c;const r=c.length-t,s=new c.constructor(r);return s.set(c.subarray(0,e)),s.set(c.subarray(e+t),e),i&&(i.result=c.subarray(e,e+t)),s}function qr(c,e,t,i,r){const s=r+1,n=t+s,a=i+s;let o=new Float64Array(s*s*3),l=0;for(let h=t;h<n;h++)for(let d=i;d<a;d++){let f=3*(h*(e+1)+d);o[l++]=c[f],o[l++]=c[f+1],o[l++]=c[f+2]}return o}function ra(c,e,t,i,r){const s=r+1,n=t+s,a=i+s;let o=new Float32Array(s*s*3),l=0;for(let h=t;h<n;h++)for(let d=i;d<a;d++){let f=3*(h*(e+1)+d);o[l++]=c[f],o[l++]=c[f+1],o[l++]=c[f+2]}return o}function Wr(c,e,t,i,r,s,n,a,o,l,h,d,f){const u=s+a+1,g=n+a+1;r+=1;let _=0,m=0;for(let v=s;v<u;v++)for(let b=n;b<g;b++){let y=v*r+b,w=3*y,x=c[w],T=c[w+1],A=c[w+2];!i||i[y]===0?(x<d.xmin&&(d.xmin=x),x>d.xmax&&(d.xmax=x),T<d.ymin&&(d.ymin=T),T>d.ymax&&(d.ymax=T),A<d.zmin&&(d.zmin=A),A>d.zmax&&(d.zmax=A)):f[m]=1,m++,o[_]=x,h[_]=t[w],l[_++]=e[w],o[_]=T,h[_]=t[w+1],l[_++]=e[w+1],o[_]=A,h[_]=t[w+2],l[_++]=e[w+2]}}function Xr(c){return c.map(e=>Array.isArray(e)?Xr(e):e)}async function sa(c){return new Promise(e=>{const t=new Image;return t.addEventListener("load",()=>{e(t)}),t.src=c,t.crossOrigin="",t})}function na(c){let t=new URLSearchParams(location.search).get(c);if(t)return Number(t)}const aa=.001,oa=1e3,$i=60,la=1/$i,_i=3600,ha=1/_i,Zr=12*_i,Ht=86400,$r=1/864e5,Ki=1/Ht,Kr=2451545;function ca(c,e,t){let i=(e-14)/12|0,r=c+4800+i;return(1461*r/4|0)+(367*(e-2-12*i)/12|0)-(3*((r+100)/100|0)/4|0)+t-32075}function Qr(c){let e=ca(c.getUTCFullYear(),c.getUTCMonth()+1,c.getUTCDate()),t=c.getUTCHours()-12;t<0&&(t+=24);let i=c.getUTCSeconds()+t*_i+c.getUTCMinutes()*$i+c.getUTCMilliseconds()*aa;i>=Zr&&e--;let r=i*Ki|0;return e+=r,i-=Ht*r,i<0&&(e--,i+=Ht),e+i*Ki}function da(c){let e=_a,t=Zi(e,c,function(r,s){return r-s.jd});t<0&&(t=~t),t>=e.length&&(t=e.length-1);let i=e[t].leapSeconds;return t!==0&&(e[t].jd-c)*Ht>i&&(i=e[t-1].leapSeconds),c+i*Ki}function fa(c){let e=c|0,t=(c-e)*Ht;t>=Zr&&e++;let i=e+68569|0,r=4*i/146097|0;i=i-((146097*r+3)/4|0)|0;let s=4e3*(i+1)/1461001|0;i=i-(1461*s/4|0)+31|0;let n=80*i/2447|0,a=i-(2447*n/80|0)|0;i=n/11|0;let o=n+2-12*i|0,l=100*(r-49)+s+i|0,h=t*ha|0,d=t-h*_i,f=d*la|0;d=d-f*$i;let u=d|0,g=(d-u)*oa|0;return h+=12,h>23&&(h-=24),new Date(Date.UTC(l,o-1,a,h,f,u,g))}function ua(c,e){return c+e*$r}function Y(c,e){return{jd:c,leapSeconds:e}}const _a=[Y(24413175e-1,10),Y(24414995e-1,11),Y(24416835e-1,12),Y(24420485e-1,13),Y(24424135e-1,14),Y(24427785e-1,15),Y(24431445e-1,16),Y(24435095e-1,17),Y(24438745e-1,18),Y(24442395e-1,19),Y(24447865e-1,20),Y(24451515e-1,21),Y(24455165e-1,22),Y(24462475e-1,23),Y(24471615e-1,24),Y(24478925e-1,25),Y(24482575e-1,26),Y(24488045e-1,27),Y(24491695e-1,28),Y(24495345e-1,29),Y(24500835e-1,30),Y(24506305e-1,31),Y(24511795e-1,32),Y(24537365e-1,33),Y(24548325e-1,34),Y(24561095e-1,35),Y(24572045e-1,36)];da(Kr);class ga{constructor(e){this.vertices=[new p,new p,new p,new p,new p,new p,new p,new p],e&&this.setFromBoundsArr(e)}copy(e){for(let t=0,i=this.vertices.length;t<i;t++)this.vertices[t].copy(e.vertices[t])}setFromBoundsArr(e){let t=e[0],i=e[3],r=e[1],s=e[4],n=e[2],a=e[5],o=this.vertices;o[0].set(t,r,n),o[1].set(i,r,n),o[2].set(i,r,a),o[3].set(t,r,a),o[4].set(t,s,n),o[5].set(i,s,n),o[6].set(i,s,a),o[7].set(t,s,a)}setFromExtent(e,t){this.setFromBoundsArr(t.getCartesianBounds(e))}}class Ze{constructor(e=0,t){this.radius=e,this.center=t?t.clone():new p}setFromBounds(e){let t=new p(e[0],e[1],e[2]);this.center.set(t.x+(e[3]-t.x)*.5,t.y+(e[3]-t.y)*.5,t.z+(e[5]-t.z)*.5),this.radius=this.center.distance(t)}setFromExtent(e,t){this.setFromBounds(t.getCartesianBounds(e))}}function We(c,e){return new Ot(c,e)}class Ot{constructor(e,t){this.__id=Ot.__counter__++,this._eventNames=[],e&&this.registerNames(e),this._sender=t||this,this._stopPropagation=!1,this._stampCache={}}bindSender(e){this._sender=e||this}registerNames(e){for(let t=0;t<e.length;t++)this[e[t]]={active:!0,handlers:[]},this._eventNames.push(e[t]);return this}_getStamp(e,t,i){return`${e}_${t}_${i}`}_stamp(e,t){let i=Vr(t),r=this._getStamp(e,this.__id,i);return this._stampCache[r]?!1:(this._stampCache[r]=i,!0)}on(e,t,i,r=0){if(this._stamp(e,t)&&this[e]){let s=t.bind(i||this._sender);s._openglobus_id=t._openglobus_id,s._openglobus_priority=r,ta(this[e].handlers,s,(n,a)=>(a._openglobus_priority||0)-(n._openglobus_priority||0))}}off(e,t){if(t){let i=this._getStamp(e,this.__id,t._openglobus_id);if(t._openglobus_id&&this._stampCache[i]){let r=this[e].handlers,s=r.length,n=-1;for(;s--;)if(r[s]._openglobus_id===t._openglobus_id){n=s;break}n!==-1&&(r.splice(n,1),this._stampCache[i]=void 0,delete this._stampCache[i])}}}dispatch(e,...t){let i=!0;if(e&&e.active&&!this._stopPropagation){let r=e.handlers.slice(0),s=r.length;for(;s--;)r[s](...t)===!1&&(i=!1)}return this._stopPropagation=!1,i}stopPropagation(){this._stopPropagation=!0}clear(){for(let e=0;e<this._eventNames.length;e++){let t=this[this._eventNames[e]];t.handlers.length=0,t.handlers=[]}this._eventNames.length=0,this._eventNames=[]}}Ot.__counter__=0;const ma=["render"];class Pe{constructor(e={}){this.__id=Pe.__counter__++,this.events=We(ma),this.model=e.model||null,this.template=e.template||"",this.parent=e.parent||null,this._classList=e.classList||[],this.el=null}static getHTML(e,t){return Et(e,t)}static parseHTML(e){return Gr(e)}static insertAfter(e,t){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)t.parentNode&&t.parentNode.insertBefore(e[i],t.nextSibling);return e}static insertBefore(e,t){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)t.parentNode&&t.parentNode.insertBefore(e[i],t);return e}insertBefore(e){this.el||this.render(),this.el&&(e instanceof HTMLElement&&e.parentNode&&Pe.insertBefore(this.el,e),e instanceof Pe&&e.el&&e.el.parentNode&&Pe.insertBefore(this.el,e.el))}insertAfter(e){this.el||this.render(),this.el&&(e instanceof HTMLElement&&e.parentNode&&Pe.insertAfter(this.el,e),e instanceof Pe&&e.el&&e.el.parentNode&&Pe.insertAfter(this.el,e.el))}isEqual(e){return e.__id===this.__id}appendTo(e,t=!1,i=!1){return e&&(this.el||(this.beforeRender(e),this.render()),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),t&&(e.innerHTML=""),this.el&&(i?e.childNodes[0]?Pe.insertBefore(this.el,e.childNodes[0]):e.appendChild(this.el):e.appendChild(this.el)),this.afterRender(e)),this}afterRender(e){}beforeRender(e){}stopPropagation(){this.events.stopPropagation()}renderTemplate(e){return Pe.parseHTML(Pe.getHTML(this.template,e||{}))[0]}render(e){this.el=this.renderTemplate(e);for(let t=0,i=this._classList.length;t<i;t++)this.el.classList.add(this._classList[t]);return this.events.dispatch(this.events.render,this),this}select(e){return this.el?this.el.querySelector(e):null}selectRemove(e){if(this.el){let t=this.select(e);if(t&&t.parentNode)return t.parentNode.removeChild(t),t}}selectAll(e,t){if(this.el){const i=this.el.querySelectorAll(e);if(t)for(let r=0,s=i.length;r<s;r++)t(i[r],r);return i}}remove(){this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}Pe.__counter__=0;const pa=`<div class="og-button" title="{title}">
|
|
2
2
|
<div class="og-button-icon">{icon}</div>
|
|
3
3
|
<div class="og-button-text">{text}</div>
|
|
4
4
|
</div>`,va=["click","mousedown","mouseup","touchstart","touchend","touchcancel"];class gi extends Pe{constructor(e={}){super({template:Et(pa,{icon:e.icon||"",text:e.text||"",title:e.title||""}),...e}),this._onMouseDown=t=>{t.preventDefault(),this.events.dispatch(this.events.mousedown,this,t)},this._onMouseUp=t=>{t.preventDefault(),this.events.dispatch(this.events.mouseup,this,t)},this._onTouchStart=t=>{t.preventDefault(),this.events.dispatch(this.events.touchstart,this,t)},this._onTouchEnd=t=>{t.preventDefault(),this.events.dispatch(this.events.touchend,this,t)},this._onTouchCancel=t=>{t.preventDefault(),this.events.dispatch(this.events.touchcancel,this,t)},this._onMouseClick=t=>{this._mouseClickHandler(t)},this.events=this.events.registerNames(va),this.el=null,this.name=e.name||"",this.$icon=null,this.$text=null}render(e){return super.render(e),this.$icon=this.select(".og-button-icon"),this.$text=this.select(".og-button-text"),this.el.__og_button__=this,this._initEvents(),this}_initEvents(){this.el&&(this.el.addEventListener("click",this._onMouseClick),this.el.addEventListener("mousedown",this._onMouseDown),this.el.addEventListener("mouseup",this._onMouseUp),this.el.addEventListener("touchstart",this._onTouchStart),this.el.addEventListener("touchend",this._onTouchEnd),this.el.addEventListener("touchcancel",this._onTouchCancel))}_mouseClickHandler(e){e.preventDefault(),this.events.dispatch(this.events.click,this,e)}remove(){this._clearEvents(),super.remove()}_clearEvents(){this.el&&this.el.removeEventListener("click",this._onMouseClick)}}class Le{constructor(e={}){this.__id=Le.__counter__++,this._name=e.name||`_control_${this.__id.toString()}`,this.planet=null,this._initialized=!1,this.renderer=null,this.autoActivate=e.autoActivate||!1,this._active=!1,this._deferredActive=!0}get name(){return this._name}oninit(){}onadd(){}onremove(){}onactivate(){}ondeactivate(){}addTo(e){e&&(this.renderer=e,e.controls[this.name]=this,this.onadd&&this.onadd(),e.isInitialized()&&(this._initialized=!0,this.oninit&&this.oninit(),this.autoActivate&&this.activate()))}remove(){this.deactivate(),this.onremove&&this.onremove();let e=this.renderer,t=this.name;if(!e)return;let i=e.controls[t];i&&this.isEqual(i)&&delete e.controls[t],this.renderer=null,this._active=!1,this._initialized=!1}activate(){this._active||(this._initialized||(this._initialized=!0,this.oninit&&this.oninit()),this._deferredActive?(this._active=!0,this.onactivate&&this.onactivate()):this._deferredActive=!0)}deactivate(){this._active?(this._active=!1,this.ondeactivate&&this.ondeactivate()):this._initialized||(this._deferredActive=!1)}isActive(){return this._active}isEqual(e){return e.__id===this.__id}}Le.__counter__=0;const xa=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
@@ -3918,4 +3918,4 @@
|
|
|
3918
3918
|
mapped = pow(mapped, vec3(1.0 / gamma));
|
|
3919
3919
|
|
|
3920
3920
|
fragColor = vec4(mapped, hdrColor.a);
|
|
3921
|
-
}`})}const Eh=0;let Ch=0,Ph=0,Lh=0;function Rn(c,e,t){return new Promise((i,r)=>{function s(){const n=c.clientWaitSync(e,t,0);n==c.WAIT_FAILED?r():n==c.TIMEOUT_EXPIRED?requestAnimationFrame(s):i()}s()})}class Bh{constructor(e,t={}){if(this._readPickingBuffer_webgl1=()=>{this.pickingFramebuffer.activate(),this.pickingFramebuffer.readAllPixels(this._tempPickingPix_),this.pickingFramebuffer.deactivate()},this._readPickingBuffer_webgl2=()=>{const s=this.handler.gl,n=this._pickingPixelBuffer;if(!this._skipPickingFrame){this._skipPickingFrame=!0;let a=this._tempPickingPix_,o=this.pickingFramebuffer.width,l=this.pickingFramebuffer.height;this.pickingFramebuffer.activate(),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(0,0,o,l,s.RGBA,s.UNSIGNED_BYTE,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),this.pickingFramebuffer.deactivate();const h=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);s.flush(),Rn(s,h,0).then(()=>{this._skipPickingFrame=!1,s.deleteSync(h),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,a),s.bindBuffer(s.PIXEL_PACK_BUFFER,null)})}},this._readDistanceBuffer_webgl1=()=>{this.distanceFramebuffer.activate(),this.distanceFramebuffer.readAllPixels(this._tempDistancePix_),this.distanceFramebuffer.deactivate()},this._readDistanceBuffer_webgl2=()=>{const s=this.handler.gl,n=this._distancePixelBuffer;if(!this._skipDistanceFrame){this._skipDistanceFrame=!0;let a=this._tempDistancePix_,o=this.distanceFramebuffer.width,l=this.distanceFramebuffer.height;this.distanceFramebuffer.activate(),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(0,0,o,l,s.RGBA,s.UNSIGNED_BYTE,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),this.distanceFramebuffer.deactivate();const h=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);s.flush(),Rn(s,h,0).then(()=>{this._skipDistanceFrame=!1,s.deleteSync(h),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,a),s.bindBuffer(s.PIXEL_PACK_BUFFER,null)})}},this.div=null,this.handler=e,this.exposure=3.01,this.gamma=.47,this.whitepoint=1,this.brightThreshold=.9,this._renderNodesArr=[],this.renderNodes={},this.activeCamera=null,this.events=dh(this),this.controls={},t.controls)for(let s in t.controls)this.controls[t.controls[s].name]=t.controls[s];this.controlsBag={},this.colorObjects=new Map,this._pickingCallbacks=[],this.pickingFramebuffer=null,this._tempPickingPix_=new Uint8Array([]),this.distanceFramebuffer=null,this._distanceCallbacks=[],this._tempDistancePix_=new Uint8Array([]),this._depthCallbacks=[],this.depthFramebuffer=null;let i=new URLSearchParams(location.search);i.get("og_msaa")?this._msaa=Number(i.get("og_msaa")):this._msaa=t.msaa!=null?t.msaa:Eh,this._internalFormat="RGBA16F",this._format="RGBA",this._type="FLOAT",this.sceneFramebuffer=null,this.blitFramebuffer=null,this.toneMappingFramebuffer=null,this._initialized=!1,this.billboardsTextureAtlas=new Cr,this.geoObjectsTextureAtlas=new Cr,this.fontAtlas=new wh(t.fontsSrc),this._entityCollections=[],this._currentOutput="screen",this._fnScreenFrame=null,this.labelWorker=new Ma(4),this.__useDistanceFramebuffer__=!0,this.screenDepthFramebuffer=null,this.screenFramePositionBuffer=null,this.screenTexture={},this.outputTexture=null,this._skipDistanceFrame=!1,this._distancePixelBuffer=null,this._skipPickingFrame=!1,this._pickingPixelBuffer=null,this._readDistanceBuffer=this._readDistanceBuffer_webgl2,this._readPickingBuffer=this._readPickingBuffer_webgl2,(t.autoActivate||At(t.autoActivate))&&this.start()}enableBlendOneSrcAlpha(){let e=this.handler.gl;e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}enableBlendDefault(){let e=this.handler.gl;e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE)}setEventsActivity(e){this.events.active=e}addDepthCallback(e,t){let i=Ph++;return this._depthCallbacks.push({id:i,callback:t,sender:e}),i}removeDepthCallback(e){for(let t=0;t<this._depthCallbacks.length;t++)if(e===this._depthCallbacks[t].id){this._depthCallbacks.splice(t,1);break}}addDistanceCallback(e,t){let i=Lh++;return this._distanceCallbacks.push({id:i,callback:t,sender:e}),i}removeDistanceCallback(e){for(let t=0;t<this._distanceCallbacks.length;t++)if(e===this._distanceCallbacks[t].id){this._distanceCallbacks.splice(t,1);break}}addPickingCallback(e,t){let i=Ch++;return this._pickingCallbacks.push({id:i,callback:t,sender:e}),i}removePickingCallback(e){for(let t=0;t<this._pickingCallbacks.length;t++)if(e===this._pickingCallbacks[t].id){this._pickingCallbacks.splice(t,1);break}}getPickingObject(e,t,i){return this.colorObjects.get(`${e}_${t}_${i}`)}getPickingObjectArr(e){return this.colorObjects.get(`${e[0]}_${e[1]}_${e[2]}`)}getPickingObject3v(e){return this.colorObjects.get(`${e.x}_${e.y}_${e.z}`)}assignPickingColor(e){if(!e._pickingColor||e._pickingColor.isZero()){let t=0,i=0,r=0,s="0_0_0";for(;!(t||i||r)||this.colorObjects.has(s);)t=Hi(1,255),i=Hi(1,255),r=Hi(1,255),s=`${t}_${i}_${r}`;e._pickingColor?e._pickingColor.set(t,i,r):e._pickingColor=new p(t,i,r),e._pickingColorU=new Float32Array([t/255,i/255,r/255]),this.colorObjects.set(s,e)}}clearPickingColor(e){if(e._pickingColor&&!e._pickingColor.isZero()){let t=e._pickingColor;t.isZero()||(this.colorObjects.delete(`${t.x}_${t.y}_${t.z}`),t.x=t.y=t.z=0)}}getWidth(){return this.handler.canvas.clientWidth}getHeight(){return this.handler.canvas.clientHeight}getCenter(){let e=this.handler.canvas;return new V(Math.round(e.width*.5),Math.round(e.height*.5))}getClientCenter(){let e=this.handler.canvas;return new V(Math.round(e.clientWidth*.5),Math.round(e.clientHeight*.5))}addControl(e){e.addTo(this)}addControls(e){for(let t=0;t<e.length;t++)e[t].addTo(this)}removeControl(e){e.remove()}isInitialized(){return this._initialized}initialize(){if(!this._initialized){if(this._initialized=!0,this.handler.initialize(),this.billboardsTextureAtlas.assignHandler(this.handler),this.geoObjectsTextureAtlas.assignHandler(this.handler),this.fontAtlas.assignHandler(this.handler),this.handler.setFrameCallback(()=>{this.draw()}),this.activeCamera=new bn(this,{eye:new p(0,0,0),look:new p(0,0,-1),up:new p(0,1,0)}),this.events.initialize(),this.events.on("charkeypress",be.KEY_APOSTROPHE,function(){He.setVisibility(!He.getVisibility())}),this.handler.addProgram(Th()),this.pickingFramebuffer=new Be(this.handler,{width:640,height:480}),this.pickingFramebuffer.init(),this._tempPickingPix_=new Uint8Array(this.pickingFramebuffer.width*this.pickingFramebuffer.height*4),this.distanceFramebuffer=new Be(this.handler,{width:320,height:240}),this.distanceFramebuffer.init(),this._tempDistancePix_=new Uint8Array(this.distanceFramebuffer.width*this.distanceFramebuffer.height*4),this.depthFramebuffer=new Be(this.handler,{size:2,internalFormat:["RGBA","DEPTH_COMPONENT24"],format:["RGBA","DEPTH_COMPONENT"],type:["UNSIGNED_BYTE","UNSIGNED_INT"],attachment:["COLOR_ATTACHMENT","DEPTH_ATTACHMENT"],useDepth:!1}),this.depthFramebuffer.init(),this.screenDepthFramebuffer=new Be(this.handler,{useDepth:!1}),this.screenDepthFramebuffer.init(),this.handler.gl.type==="webgl")this._readDistanceBuffer=this._readDistanceBuffer_webgl1,this._readPickingBuffer=this._readPickingBuffer_webgl1,this.sceneFramebuffer=new Be(this.handler),this.sceneFramebuffer.init(),this._fnScreenFrame=this._screenFrameNoMSAA,this.screenTexture={screen:this.sceneFramebuffer.textures[0],picking:this.pickingFramebuffer.textures[0],distance:this.distanceFramebuffer.textures[0],depth:this.screenDepthFramebuffer.textures[0]};else{let e=this.getMaxMSAA(this._internalFormat);this._msaa>e&&(this._msaa=e),this.handler.addPrograms([Ah()]),this.handler.addPrograms([xh()]),this.sceneFramebuffer=new oh(this.handler,{size:1,msaa:this._msaa,internalFormat:this._internalFormat,filter:"LINEAR"}),this.sceneFramebuffer.init(),this.blitFramebuffer=new Be(this.handler,{size:1,useDepth:!1,internalFormat:this._internalFormat,format:this._format,type:this._type,filter:"NEAREST"}),this.blitFramebuffer.init(),this.toneMappingFramebuffer=new Be(this.handler,{useDepth:!1}),this.toneMappingFramebuffer.init(),this._fnScreenFrame=this._screenFrameMSAA,this.screenTexture={screen:this.toneMappingFramebuffer.textures[0],picking:this.pickingFramebuffer.textures[0],distance:this.distanceFramebuffer.textures[0],depth:this.screenDepthFramebuffer.textures[0],frustum:this.depthFramebuffer.textures[0]},this._initReadPixelsBuffers()}this.handler.ONCANVASRESIZE=()=>{this._resizeStart(),this.events.dispatch(this.events.resize,this.handler.canvas),this._resizeEnd(),this.events.dispatch(this.events.resizeend,this.handler.canvas)},this.screenFramePositionBuffer=this.handler.createArrayBuffer(new Float32Array([1,1,-1,1,1,-1,-1,-1]),2,4),this.outputTexture=this.screenTexture.screen,this._initializeRenderNodes(),this._initializeControls()}}_initReadPixelsBuffers(){let e=this.handler.gl;this._distancePixelBuffer=e.createBuffer(),e.bindBuffer(e.PIXEL_PACK_BUFFER,this._distancePixelBuffer),e.bufferData(e.PIXEL_PACK_BUFFER,this.distanceFramebuffer.width*this.distanceFramebuffer.height*4,e.STREAM_READ),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),this._pickingPixelBuffer=e.createBuffer(),e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pickingPixelBuffer),e.bufferData(e.PIXEL_PACK_BUFFER,this.pickingFramebuffer.width*this.pickingFramebuffer.height*4,e.STREAM_READ),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}_initializeControls(){let e=this.controls;this.controls={};for(let t in e)this.addControl(e[t])}resize(){this._resizeEnd()}setCurrentScreen(e){this._currentOutput=e,this.screenTexture[e]&&(this.outputTexture=this.screenTexture[e])}_resizeStart(){let e=this.handler.canvas;this.activeCamera.setAspectRatio(e.width/e.height),this.sceneFramebuffer.setSize(e.width*.5,e.height*.5),this.blitFramebuffer&&this.blitFramebuffer.setSize(e.width*.5,e.height*.5,!0)}_resizeEnd(){let e=this.handler.canvas;this.activeCamera.setAspectRatio(e.width/e.height),this.sceneFramebuffer.setSize(e.width,e.height),this.blitFramebuffer&&this.blitFramebuffer.setSize(e.width,e.height,!0),this.toneMappingFramebuffer&&this.toneMappingFramebuffer.setSize(e.width,e.height,!0),this.depthFramebuffer&&this.depthFramebuffer.setSize(e.clientWidth,e.clientHeight,!0),this.screenDepthFramebuffer&&this.screenDepthFramebuffer.setSize(e.clientWidth,e.clientHeight,!0),this.handler.gl.type==="webgl"?(this.screenTexture.screen=this.sceneFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.distance=this.distanceFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]):(this.screenTexture.screen=this.toneMappingFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.distance=this.distanceFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]),this.setCurrentScreen(this._currentOutput)}removeNode(e){e.remove()}addNode(e){this.renderNodes[e.name]?He.logWrn(`Node name ${e.name} already exists.`):(e.assign(this),this._renderNodesArr.unshift(e),this.renderNodes[e.name]=e)}_initializeRenderNodes(){for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].initialize()}addNodeBefore(e,t){if(this.renderNodes[e.name])He.logWrn(`Node name ${e.name} already exists.`);else{e.assign(this),this.renderNodes[e.name]=e;for(let i=0;i<this._renderNodesArr.length;i++)if(this._renderNodesArr[i].isEqual(t)){this._renderNodesArr.splice(i,0,e);break}this._renderNodesArr.unshift(e)}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t])}getMaxMSAA(e){let t=this.handler.gl;return t.getInternalformatParameter(t.RENDERBUFFER,t[e],t.SAMPLES)[0]}getMSAA(){return this._msaa}enqueueEntityCollectionsToDraw(e){this._entityCollections.push.apply(this._entityCollections,e)}_drawOpaqueEntityCollections(){let e=this._entityCollections;if(e.length){this.enableBlendDefault();let t=e.length;for(;t--;){let i=e[t];e[t]._fadingOpacity&&(i.events.dispatch(i.events.draw,i),e[t].geoObjectHandler.draw())}for(t=e.length;t--;)e[t]._fadingOpacity&&e[t].pointCloudHandler.draw()}}_drawTransparentEntityCollections(){let e=this._entityCollections;if(e.length){let t=this.handler.gl;this.enableBlendDefault(),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.billboardsTextureAtlas.texture);let i=e.length;for(;i--;){let s=e[i];s._fadingOpacity&&s.billboardHandler.draw()}let r=this.fontAtlas.atlasesArr;for(i=0;i<r.length;i++)t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,r[i].texture);for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].labelHandler.draw();for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].rayHandler.draw();for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].polylineHandler.draw();for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].stripHandler.draw()}}_clearEntityCollectionQueue(){this._entityCollections.length=0,this._entityCollections=[]}draw(){this.activeCamera.checkMoveEnd();let e=this.events;e.handleEvents();let t=this.sceneFramebuffer;t.activate();let i=this.handler,r=i.gl;r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),e.dispatch(e.draw,this);let s=this.activeCamera.frustums,n=e.pointerEvent()||this.activeCamera.isMoving,a=this._renderNodesArr,o=s.length;for(;o--;){this.activeCamera.setCurrentFrustum(o),r.clear(r.DEPTH_BUFFER_BIT);let l=a.length;for(;l--;)a[l].preDrawNode();for(this._drawOpaqueEntityCollections(),l=a.length;l--;)this.enableBlendDefault(),a[l].drawNode();this._drawTransparentEntityCollections(),this._clearEntityCollectionQueue(),n&&(this._drawPickingBuffer(),this.__useDistanceFramebuffer__&&this._drawDistanceBuffer())}t.deactivate(),this.blitFramebuffer&&t.blitTo(this.blitFramebuffer,0),n&&(i.isWebGl2()&&this._drawDepthBuffer(),this._readPickingBuffer(),this.__useDistanceFramebuffer__&&this._readDistanceBuffer()),this._fnScreenFrame(),e.dispatch(e.postdraw,this),e.mouseState.wheelDelta=0,e.mouseState.justStopped=!1,e.mouseState.moving=!1,e.touchState.moving=!1}_screenFrameMSAA(){let e=this.handler,t=e.programs.toneMapping,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),this.toneMappingFramebuffer.activate(),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.blitFramebuffer.textures[0]),r.uniform1i(i.uniforms.hdrBuffer,0),r.uniform1f(i.uniforms.gamma,this.gamma),r.uniform1f(i.uniforms.exposure,this.exposure),r.uniform1f(i.uniforms.whitepoint,this.whitepoint),r.drawArrays(r.TRIANGLE_STRIP,0,4),this.toneMappingFramebuffer.deactivate(),t=e.programs.screenFrame,i=t._program,t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_screenFrameNoMSAA(){let e=this.handler,t=e.programs.screenFrame,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_drawPickingBuffer(){this.pickingFramebuffer.activate();let t=this.handler.gl;this.activeCamera.isFirstPass?(t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)):t.clear(t.DEPTH_BUFFER_BIT),t.disable(t.BLEND);let i=this._pickingCallbacks;for(let r=0,s=i.length;r<s;r++)i[r].callback.call(i[r].sender);t.enable(t.BLEND),this.pickingFramebuffer.deactivate()}_drawDistanceBuffer(){this.distanceFramebuffer.activate();let t=this.handler.gl;this.activeCamera.isFirstPass?(t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)):t.clear(t.DEPTH_BUFFER_BIT),t.disable(t.BLEND);let i=this._distanceCallbacks,r=i.length;for(;r--;)i[r].callback.call(i[r].sender);t.enable(t.BLEND),this.distanceFramebuffer.deactivate()}_drawDepthBuffer(){this.depthFramebuffer.activate();let e=this.handler,t=e.gl;t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.enable(t.DEPTH_TEST);let i=this._depthCallbacks,r=i.length;for(;r--;)i[r].callback.call(i[r].sender);this.depthFramebuffer.deactivate(),this.screenDepthFramebuffer.activate();let s=e.programs.depth,n=s._program;t.bindBuffer(t.ARRAY_BUFFER,this.screenFramePositionBuffer),t.vertexAttribPointer(n.attributes.corners,2,t.FLOAT,!1,0,0),s.activate(),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.depthFramebuffer.textures[1]),t.uniform1i(n.uniforms.depthTexture,0),t.drawArrays(t.TRIANGLE_STRIP,0,4),this.screenDepthFramebuffer.deactivate()}readPickingColor(e,t,i){let r=this.pickingFramebuffer.width,s=this.pickingFramebuffer.height;e=Math.round(e*r),t=Math.round(t*s);let n=(t*r+e)*4;i[0]=this._tempPickingPix_[n],i[1]=this._tempPickingPix_[n+1],i[2]=this._tempPickingPix_[n+2]}readDistanceColor(e,t,i){let r=this.distanceFramebuffer.width,s=this.distanceFramebuffer.height;e=Math.round(e*r),t=Math.round(t*s);let n=(t*r+e)*4;i[0]=this._tempDistancePix_[n],i[1]=this._tempDistancePix_[n+1],i[2]=this._tempDistancePix_[n+2]}start(){this._initialized||this.initialize(),this.handler.start()}destroy(){for(let e in this.controls)this.controls[e].remove();for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].remove();this.div=null,this._renderNodesArr=[],this.renderNodes={},this.activeCamera=null,this.controls={},this.controlsBag={},this.colorObjects.clear(),this.colorObjects=null,this._pickingCallbacks=[],this.pickingFramebuffer=null,this._tempPickingPix_=null,this.distanceFramebuffer=null,this._distanceCallbacks=[],this._tempDistancePix_=null,this._depthCallbacks=[],this.depthFramebuffer=null,this.sceneFramebuffer=null,this.blitFramebuffer=null,this.toneMappingFramebuffer=null,this._entityCollections=[],this.handler.destroy(),this.handler=null,this._initialized=!1}}const Mh="/night.png",Rh="/spec.png",Sn="/res",Sh="globus_planet_";class Ft{constructor(e){this.$target=null,this._instanceID=`__globus${Ft.__counter__++?Ft.__counter__:""}__`,window[this._instanceID]=this,this._canvas=document.createElement("canvas"),this._canvas.id=`canvas${this._instanceID}`,this._canvas.style.width="100%",this._canvas.style.height="100%",this._canvas.style.display="block",this._canvas.style.opacity="0.0",this._canvas.style.transition="opacity 150ms",this.$inner=document.createElement("div"),this.$inner.classList.add("og-inner"),this.$inner.appendChild(this._canvas),this.$inner.attributions=document.createElement("div"),e.attributionContainer?e.attributionContainer.appendChild(this.$inner.attributions):(this.$inner.attributions.classList.add("og-attribution"),this.$inner.appendChild(this.$inner.attributions)),e.target&&this.attachTo(e.target);const t=n=>{n.preventDefault()};this._canvas.onmouseenter=function(){document.addEventListener("mousewheel",t,{capture:!1,passive:!1})},this._canvas.onmouseleave=function(){document.removeEventListener("mousewheel",t)},this.renderer=new Bh(new Di(this._canvas,{autoActivate:!1,pixelRatio:e.dpi||window.devicePixelRatio+.15,context:{antialias:!1,premultipliedAlpha:!1}}),{autoActivate:!1,msaa:e.msaa,fontsSrc:e.fontsSrc}),this.renderer.div=this.$inner,e.skybox&&this.renderer.addNode(e.skybox),this._planetName=e.name?e.name:Sh+Ft.__counter__,this.planet=new eh({name:this._planetName,frustums:e.frustums,ellipsoid:e.ellipsoid,maxGridSize:e.maxGridSize,nightTextureSrc:e.nightTextureSrc===null?null:`${e.resourcesSrc||Sn}${Mh}`,specularTextureSrc:e.specularTextureSrc===null?null:`${e.resourcesSrc||Sn}${Rh}`,minAltitude:e.minAltitude,maxAltitude:e.maxAltitude||15e6,maxEqualZoomAltitude:e.maxEqualZoomAltitude,minEqualZoomAltitude:e.minEqualZoomAltitude,minEqualZoomCameraSlope:e.minEqualZoomCameraSlope,quadTreeStrategyPrototype:e.quadTreeStrategyPrototype,maxLoadingRequests:e.maxLoadingRequests,atmosphereEnabled:e.atmosphereEnabled}),e.terrain?Array.isArray(e.terrain)?this.planet.setTerrain(e.terrain[0]):this.planet.setTerrain(e.terrain):this.planet.setTerrain(new ri),this.renderer.addNode(this.planet),e.controls?this.planet.addControls(e.controls):this.planet.addControls([new hl,e.useEarthNavigation?new el:new fr({minSlope:e.minSlope}),new al,new Jo,new il,new ya]);const i=this.renderer.controls;let r;for(let n in i)if(i[n]instanceof sn){r=i[n];break}r?this.sun=r:(this.sun=new sn,this.planet.addControl(this.sun)),e.sun&&(e.sun.active!==void 0&&!e.sun.active&&this.sun.deactivate(),e.sun.stopped===!0&&this.sun.stop()),e.layers&&this.planet.addLayers(e.layers);let s=e.viewExtent;s&&(s instanceof Array?this.planet.viewExtentArr(s):this.planet.viewExtent(s)),(e.autoActivate||At(e.autoActivate))&&this.start()}start(){this.renderer.start(),this.fadeIn()}fadeIn(){this._canvas.style.opacity="1.0"}fadeOut(){this._canvas.style.opacity="0"}attachTo(e){this.detach();let t;e instanceof HTMLElement?t=e:t=document.getElementById(e)||document.querySelector(e),t&&(this.$target=t,t.appendChild(this.$inner))}detach(){this.$target&&this.$target.removeChild(this.$inner)}destroy(){this.detach(),this.renderer.destroy()}}Ft.__counter__=0;let kt;const In=Me.createContext({globe:null,setGlobe:()=>{}}),zn=({children:c})=>{const[e,t]=Me.useState(kt);return Me.createElement(In.Provider,{value:{globe:e,setGlobe:t}},c)},Fn=()=>Me.useContext(In),Ih=({children:c})=>{const e=Me.useRef(null),{setGlobe:t}=Fn();return Me.useEffect(()=>{if(kt)e.current=kt.$target;else{let i=function(n,a,o){for(var l="",h=o;h>0;h--){var d=0,f=1<<h-1;n&f&&d++,a&f&&(d+=2),l+=d.toString()}return l};const r=new An("OpenStreetMap",{isBaseLayer:!0,url:"//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",visibility:!0,attribution:"Data @ OpenStreetMap contributors, ODbL"}),s=new An("sat",{isBaseLayer:!0,subdomains:["t0","t1","t2","t3"],url:"https://ecn.{s}.tiles.virtualearth.net/tiles/a{quad}.jpeg?n=z&g=7146",visibility:!0,attribution:'<a href="http://www.bing.com" target="_blank"><img title="Bing Imagery" src="https://sandcastle.cesium.com/CesiumUnminified/Assets/Images/bing_maps_credit.png" alt="Bing"></a> © 2021 Microsoft Corporation',maxNativeZoom:19,defaultTextures:[{color:"#001522"},{color:"#E4E6F3"}],shininess:18,specular:[63e-5,55e-5,32e-5],ambient:"rgb(100,100,140)",diffuse:"rgb(450,450,450)",nightTextureCoefficient:2.7,urlRewrite:function(n,a){return Et(a,{s:this._getSubdomain(),quad:i(n.tileX,n.tileY,n.tileZoom)})}});return kt=new Ft({target:e.current,name:"Earth",terrain:new ih,layers:[r,s],autoActivate:!0}),kt.planet.atmosphereEnabled=!0,()=>{}}t(kt)},[]),Me.createElement(zn,null,Me.createElement("div",{style:{width:"100%",height:"100%"},id:"globus",ref:e},c))};je.GlobeContextProvider=zn,je.default=Ih,je.useGlobusContext=Fn,Object.defineProperties(je,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
3921
|
+
}`})}const Eh=0;let Ch=0,Ph=0,Lh=0;function Rn(c,e,t){return new Promise((i,r)=>{function s(){const n=c.clientWaitSync(e,t,0);n==c.WAIT_FAILED?r():n==c.TIMEOUT_EXPIRED?requestAnimationFrame(s):i()}s()})}class Bh{constructor(e,t={}){if(this._readPickingBuffer_webgl1=()=>{this.pickingFramebuffer.activate(),this.pickingFramebuffer.readAllPixels(this._tempPickingPix_),this.pickingFramebuffer.deactivate()},this._readPickingBuffer_webgl2=()=>{const s=this.handler.gl,n=this._pickingPixelBuffer;if(!this._skipPickingFrame){this._skipPickingFrame=!0;let a=this._tempPickingPix_,o=this.pickingFramebuffer.width,l=this.pickingFramebuffer.height;this.pickingFramebuffer.activate(),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(0,0,o,l,s.RGBA,s.UNSIGNED_BYTE,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),this.pickingFramebuffer.deactivate();const h=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);s.flush(),Rn(s,h,0).then(()=>{this._skipPickingFrame=!1,s.deleteSync(h),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,a),s.bindBuffer(s.PIXEL_PACK_BUFFER,null)})}},this._readDistanceBuffer_webgl1=()=>{this.distanceFramebuffer.activate(),this.distanceFramebuffer.readAllPixels(this._tempDistancePix_),this.distanceFramebuffer.deactivate()},this._readDistanceBuffer_webgl2=()=>{const s=this.handler.gl,n=this._distancePixelBuffer;if(!this._skipDistanceFrame){this._skipDistanceFrame=!0;let a=this._tempDistancePix_,o=this.distanceFramebuffer.width,l=this.distanceFramebuffer.height;this.distanceFramebuffer.activate(),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(0,0,o,l,s.RGBA,s.UNSIGNED_BYTE,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),this.distanceFramebuffer.deactivate();const h=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);s.flush(),Rn(s,h,0).then(()=>{this._skipDistanceFrame=!1,s.deleteSync(h),s.bindBuffer(s.PIXEL_PACK_BUFFER,n),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,a),s.bindBuffer(s.PIXEL_PACK_BUFFER,null)})}},this.div=null,this.handler=e,this.exposure=3.01,this.gamma=.47,this.whitepoint=1,this.brightThreshold=.9,this._renderNodesArr=[],this.renderNodes={},this.activeCamera=null,this.events=dh(this),this.controls={},t.controls)for(let s in t.controls)this.controls[t.controls[s].name]=t.controls[s];this.controlsBag={},this.colorObjects=new Map,this._pickingCallbacks=[],this.pickingFramebuffer=null,this._tempPickingPix_=new Uint8Array([]),this.distanceFramebuffer=null,this._distanceCallbacks=[],this._tempDistancePix_=new Uint8Array([]),this._depthCallbacks=[],this.depthFramebuffer=null;let i=new URLSearchParams(location.search);i.get("og_msaa")?this._msaa=Number(i.get("og_msaa")):this._msaa=t.msaa!=null?t.msaa:Eh,this._internalFormat="RGBA16F",this._format="RGBA",this._type="FLOAT",this.sceneFramebuffer=null,this.blitFramebuffer=null,this.toneMappingFramebuffer=null,this._initialized=!1,this.billboardsTextureAtlas=new Cr,this.geoObjectsTextureAtlas=new Cr,this.fontAtlas=new wh(t.fontsSrc),this._entityCollections=[],this._currentOutput="screen",this._fnScreenFrame=null,this.labelWorker=new Ma(4),this.__useDistanceFramebuffer__=!0,this.screenDepthFramebuffer=null,this.screenFramePositionBuffer=null,this.screenTexture={},this.outputTexture=null,this._skipDistanceFrame=!1,this._distancePixelBuffer=null,this._skipPickingFrame=!1,this._pickingPixelBuffer=null,this._readDistanceBuffer=this._readDistanceBuffer_webgl2,this._readPickingBuffer=this._readPickingBuffer_webgl2,(t.autoActivate||At(t.autoActivate))&&this.start()}enableBlendOneSrcAlpha(){let e=this.handler.gl;e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}enableBlendDefault(){let e=this.handler.gl;e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE)}setEventsActivity(e){this.events.active=e}addDepthCallback(e,t){let i=Ph++;return this._depthCallbacks.push({id:i,callback:t,sender:e}),i}removeDepthCallback(e){for(let t=0;t<this._depthCallbacks.length;t++)if(e===this._depthCallbacks[t].id){this._depthCallbacks.splice(t,1);break}}addDistanceCallback(e,t){let i=Lh++;return this._distanceCallbacks.push({id:i,callback:t,sender:e}),i}removeDistanceCallback(e){for(let t=0;t<this._distanceCallbacks.length;t++)if(e===this._distanceCallbacks[t].id){this._distanceCallbacks.splice(t,1);break}}addPickingCallback(e,t){let i=Ch++;return this._pickingCallbacks.push({id:i,callback:t,sender:e}),i}removePickingCallback(e){for(let t=0;t<this._pickingCallbacks.length;t++)if(e===this._pickingCallbacks[t].id){this._pickingCallbacks.splice(t,1);break}}getPickingObject(e,t,i){return this.colorObjects.get(`${e}_${t}_${i}`)}getPickingObjectArr(e){return this.colorObjects.get(`${e[0]}_${e[1]}_${e[2]}`)}getPickingObject3v(e){return this.colorObjects.get(`${e.x}_${e.y}_${e.z}`)}assignPickingColor(e){if(!e._pickingColor||e._pickingColor.isZero()){let t=0,i=0,r=0,s="0_0_0";for(;!(t||i||r)||this.colorObjects.has(s);)t=Hi(1,255),i=Hi(1,255),r=Hi(1,255),s=`${t}_${i}_${r}`;e._pickingColor?e._pickingColor.set(t,i,r):e._pickingColor=new p(t,i,r),e._pickingColorU=new Float32Array([t/255,i/255,r/255]),this.colorObjects.set(s,e)}}clearPickingColor(e){if(e._pickingColor&&!e._pickingColor.isZero()){let t=e._pickingColor;t.isZero()||(this.colorObjects.delete(`${t.x}_${t.y}_${t.z}`),t.x=t.y=t.z=0)}}getWidth(){return this.handler.canvas.clientWidth}getHeight(){return this.handler.canvas.clientHeight}getCenter(){let e=this.handler.canvas;return new V(Math.round(e.width*.5),Math.round(e.height*.5))}getClientCenter(){let e=this.handler.canvas;return new V(Math.round(e.clientWidth*.5),Math.round(e.clientHeight*.5))}addControl(e){e.addTo(this)}addControls(e){for(let t=0;t<e.length;t++)e[t].addTo(this)}removeControl(e){e.remove()}isInitialized(){return this._initialized}initialize(){if(!this._initialized){if(this._initialized=!0,this.handler.initialize(),this.billboardsTextureAtlas.assignHandler(this.handler),this.geoObjectsTextureAtlas.assignHandler(this.handler),this.fontAtlas.assignHandler(this.handler),this.handler.setFrameCallback(()=>{this.draw()}),this.activeCamera=new bn(this,{eye:new p(0,0,0),look:new p(0,0,-1),up:new p(0,1,0)}),this.events.initialize(),this.events.on("charkeypress",be.KEY_APOSTROPHE,function(){He.setVisibility(!He.getVisibility())}),this.handler.addProgram(Th()),this.pickingFramebuffer=new Be(this.handler,{width:640,height:480}),this.pickingFramebuffer.init(),this._tempPickingPix_=new Uint8Array(this.pickingFramebuffer.width*this.pickingFramebuffer.height*4),this.distanceFramebuffer=new Be(this.handler,{width:320,height:240}),this.distanceFramebuffer.init(),this._tempDistancePix_=new Uint8Array(this.distanceFramebuffer.width*this.distanceFramebuffer.height*4),this.depthFramebuffer=new Be(this.handler,{size:2,internalFormat:["RGBA","DEPTH_COMPONENT24"],format:["RGBA","DEPTH_COMPONENT"],type:["UNSIGNED_BYTE","UNSIGNED_INT"],attachment:["COLOR_ATTACHMENT","DEPTH_ATTACHMENT"],useDepth:!1}),this.depthFramebuffer.init(),this.screenDepthFramebuffer=new Be(this.handler,{useDepth:!1}),this.screenDepthFramebuffer.init(),this.handler.gl.type==="webgl")this._readDistanceBuffer=this._readDistanceBuffer_webgl1,this._readPickingBuffer=this._readPickingBuffer_webgl1,this.sceneFramebuffer=new Be(this.handler),this.sceneFramebuffer.init(),this._fnScreenFrame=this._screenFrameNoMSAA,this.screenTexture={screen:this.sceneFramebuffer.textures[0],picking:this.pickingFramebuffer.textures[0],distance:this.distanceFramebuffer.textures[0],depth:this.screenDepthFramebuffer.textures[0]};else{let e=this.getMaxMSAA(this._internalFormat);this._msaa>e&&(this._msaa=e),this.handler.addPrograms([Ah()]),this.handler.addPrograms([xh()]),this.sceneFramebuffer=new oh(this.handler,{size:1,msaa:this._msaa,internalFormat:this._internalFormat,filter:"LINEAR"}),this.sceneFramebuffer.init(),this.blitFramebuffer=new Be(this.handler,{size:1,useDepth:!1,internalFormat:this._internalFormat,format:this._format,type:this._type,filter:"NEAREST"}),this.blitFramebuffer.init(),this.toneMappingFramebuffer=new Be(this.handler,{useDepth:!1}),this.toneMappingFramebuffer.init(),this._fnScreenFrame=this._screenFrameMSAA,this.screenTexture={screen:this.toneMappingFramebuffer.textures[0],picking:this.pickingFramebuffer.textures[0],distance:this.distanceFramebuffer.textures[0],depth:this.screenDepthFramebuffer.textures[0],frustum:this.depthFramebuffer.textures[0]},this._initReadPixelsBuffers()}this.handler.ONCANVASRESIZE=()=>{this._resizeStart(),this.events.dispatch(this.events.resize,this.handler.canvas),this._resizeEnd(),this.events.dispatch(this.events.resizeend,this.handler.canvas)},this.screenFramePositionBuffer=this.handler.createArrayBuffer(new Float32Array([1,1,-1,1,1,-1,-1,-1]),2,4),this.outputTexture=this.screenTexture.screen,this._initializeRenderNodes(),this._initializeControls()}}_initReadPixelsBuffers(){let e=this.handler.gl;this._distancePixelBuffer=e.createBuffer(),e.bindBuffer(e.PIXEL_PACK_BUFFER,this._distancePixelBuffer),e.bufferData(e.PIXEL_PACK_BUFFER,this.distanceFramebuffer.width*this.distanceFramebuffer.height*4,e.STREAM_READ),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),this._pickingPixelBuffer=e.createBuffer(),e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pickingPixelBuffer),e.bufferData(e.PIXEL_PACK_BUFFER,this.pickingFramebuffer.width*this.pickingFramebuffer.height*4,e.STREAM_READ),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}_initializeControls(){let e=this.controls;this.controls={};for(let t in e)this.addControl(e[t])}resize(){this._resizeEnd()}setCurrentScreen(e){this._currentOutput=e,this.screenTexture[e]&&(this.outputTexture=this.screenTexture[e])}_resizeStart(){let e=this.handler.canvas;this.activeCamera.setAspectRatio(e.width/e.height),this.sceneFramebuffer.setSize(e.width*.5,e.height*.5),this.blitFramebuffer&&this.blitFramebuffer.setSize(e.width*.5,e.height*.5,!0)}_resizeEnd(){let e=this.handler.canvas;this.activeCamera.setAspectRatio(e.width/e.height),this.sceneFramebuffer.setSize(e.width,e.height),this.blitFramebuffer&&this.blitFramebuffer.setSize(e.width,e.height,!0),this.toneMappingFramebuffer&&this.toneMappingFramebuffer.setSize(e.width,e.height,!0),this.depthFramebuffer&&this.depthFramebuffer.setSize(e.clientWidth,e.clientHeight,!0),this.screenDepthFramebuffer&&this.screenDepthFramebuffer.setSize(e.clientWidth,e.clientHeight,!0),this.handler.gl.type==="webgl"?(this.screenTexture.screen=this.sceneFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.distance=this.distanceFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]):(this.screenTexture.screen=this.toneMappingFramebuffer.textures[0],this.screenTexture.picking=this.pickingFramebuffer.textures[0],this.screenTexture.distance=this.distanceFramebuffer.textures[0],this.screenTexture.depth=this.screenDepthFramebuffer.textures[0],this.screenTexture.frustum=this.depthFramebuffer.textures[0]),this.setCurrentScreen(this._currentOutput)}removeNode(e){e.remove()}addNode(e){this.renderNodes[e.name]?He.logWrn(`Node name ${e.name} already exists.`):(e.assign(this),this._renderNodesArr.unshift(e),this.renderNodes[e.name]=e)}_initializeRenderNodes(){for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].initialize()}addNodeBefore(e,t){if(this.renderNodes[e.name])He.logWrn(`Node name ${e.name} already exists.`);else{e.assign(this),this.renderNodes[e.name]=e;for(let i=0;i<this._renderNodesArr.length;i++)if(this._renderNodesArr[i].isEqual(t)){this._renderNodesArr.splice(i,0,e);break}this._renderNodesArr.unshift(e)}}addNodes(e){for(let t=0;t<e.length;t++)this.addNode(e[t])}getMaxMSAA(e){let t=this.handler.gl;return t.getInternalformatParameter(t.RENDERBUFFER,t[e],t.SAMPLES)[0]}getMSAA(){return this._msaa}enqueueEntityCollectionsToDraw(e){this._entityCollections.push.apply(this._entityCollections,e)}_drawOpaqueEntityCollections(){let e=this._entityCollections;if(e.length){this.enableBlendDefault();let t=e.length;for(;t--;){let i=e[t];e[t]._fadingOpacity&&(i.events.dispatch(i.events.draw,i),e[t].geoObjectHandler.draw())}for(t=e.length;t--;)e[t]._fadingOpacity&&e[t].pointCloudHandler.draw()}}_drawTransparentEntityCollections(){let e=this._entityCollections;if(e.length){let t=this.handler.gl;this.enableBlendDefault(),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.billboardsTextureAtlas.texture);let i=e.length;for(;i--;){let s=e[i];s._fadingOpacity&&s.billboardHandler.draw()}let r=this.fontAtlas.atlasesArr;for(i=0;i<r.length;i++)t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,r[i].texture);for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].labelHandler.draw();for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].rayHandler.draw();for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].polylineHandler.draw();for(i=e.length;i--;)e[i]._fadingOpacity&&e[i].stripHandler.draw()}}_clearEntityCollectionQueue(){this._entityCollections.length=0,this._entityCollections=[]}draw(){this.activeCamera.checkMoveEnd();let e=this.events;e.handleEvents();let t=this.sceneFramebuffer;t.activate();let i=this.handler,r=i.gl;r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),e.dispatch(e.draw,this);let s=this.activeCamera.frustums,n=e.pointerEvent()||this.activeCamera.isMoving,a=this._renderNodesArr,o=s.length;for(;o--;){this.activeCamera.setCurrentFrustum(o),r.clear(r.DEPTH_BUFFER_BIT);let l=a.length;for(;l--;)a[l].preDrawNode();for(this._drawOpaqueEntityCollections(),l=a.length;l--;)this.enableBlendDefault(),a[l].drawNode();this._drawTransparentEntityCollections(),this._clearEntityCollectionQueue(),n&&(this._drawPickingBuffer(),this.__useDistanceFramebuffer__&&this._drawDistanceBuffer())}t.deactivate(),this.blitFramebuffer&&t.blitTo(this.blitFramebuffer,0),n&&(i.isWebGl2()&&this._drawDepthBuffer(),this._readPickingBuffer(),this.__useDistanceFramebuffer__&&this._readDistanceBuffer()),this._fnScreenFrame(),e.dispatch(e.postdraw,this),e.mouseState.wheelDelta=0,e.mouseState.justStopped=!1,e.mouseState.moving=!1,e.touchState.moving=!1}_screenFrameMSAA(){let e=this.handler,t=e.programs.toneMapping,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),this.toneMappingFramebuffer.activate(),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.blitFramebuffer.textures[0]),r.uniform1i(i.uniforms.hdrBuffer,0),r.uniform1f(i.uniforms.gamma,this.gamma),r.uniform1f(i.uniforms.exposure,this.exposure),r.uniform1f(i.uniforms.whitepoint,this.whitepoint),r.drawArrays(r.TRIANGLE_STRIP,0,4),this.toneMappingFramebuffer.deactivate(),t=e.programs.screenFrame,i=t._program,t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_screenFrameNoMSAA(){let e=this.handler,t=e.programs.screenFrame,i=t._program,r=e.gl;r.disable(r.DEPTH_TEST),t.activate(),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.outputTexture),r.uniform1i(i.uniforms.texture,0),r.bindBuffer(r.ARRAY_BUFFER,this.screenFramePositionBuffer),r.vertexAttribPointer(i.attributes.corners,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLE_STRIP,0,4),r.enable(r.DEPTH_TEST)}_drawPickingBuffer(){this.pickingFramebuffer.activate();let t=this.handler.gl;this.activeCamera.isFirstPass?(t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)):t.clear(t.DEPTH_BUFFER_BIT),t.disable(t.BLEND);let i=this._pickingCallbacks;for(let r=0,s=i.length;r<s;r++)i[r].callback.call(i[r].sender);t.enable(t.BLEND),this.pickingFramebuffer.deactivate()}_drawDistanceBuffer(){this.distanceFramebuffer.activate();let t=this.handler.gl;this.activeCamera.isFirstPass?(t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)):t.clear(t.DEPTH_BUFFER_BIT),t.disable(t.BLEND);let i=this._distanceCallbacks,r=i.length;for(;r--;)i[r].callback.call(i[r].sender);t.enable(t.BLEND),this.distanceFramebuffer.deactivate()}_drawDepthBuffer(){this.depthFramebuffer.activate();let e=this.handler,t=e.gl;t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.enable(t.DEPTH_TEST);let i=this._depthCallbacks,r=i.length;for(;r--;)i[r].callback.call(i[r].sender);this.depthFramebuffer.deactivate(),this.screenDepthFramebuffer.activate();let s=e.programs.depth,n=s._program;t.bindBuffer(t.ARRAY_BUFFER,this.screenFramePositionBuffer),t.vertexAttribPointer(n.attributes.corners,2,t.FLOAT,!1,0,0),s.activate(),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.depthFramebuffer.textures[1]),t.uniform1i(n.uniforms.depthTexture,0),t.drawArrays(t.TRIANGLE_STRIP,0,4),this.screenDepthFramebuffer.deactivate()}readPickingColor(e,t,i){let r=this.pickingFramebuffer.width,s=this.pickingFramebuffer.height;e=Math.round(e*r),t=Math.round(t*s);let n=(t*r+e)*4;i[0]=this._tempPickingPix_[n],i[1]=this._tempPickingPix_[n+1],i[2]=this._tempPickingPix_[n+2]}readDistanceColor(e,t,i){let r=this.distanceFramebuffer.width,s=this.distanceFramebuffer.height;e=Math.round(e*r),t=Math.round(t*s);let n=(t*r+e)*4;i[0]=this._tempDistancePix_[n],i[1]=this._tempDistancePix_[n+1],i[2]=this._tempDistancePix_[n+2]}start(){this._initialized||this.initialize(),this.handler.start()}destroy(){for(let e in this.controls)this.controls[e].remove();for(let e=0;e<this._renderNodesArr.length;e++)this._renderNodesArr[e].remove();this.div=null,this._renderNodesArr=[],this.renderNodes={},this.activeCamera=null,this.controls={},this.controlsBag={},this.colorObjects.clear(),this.colorObjects=null,this._pickingCallbacks=[],this.pickingFramebuffer=null,this._tempPickingPix_=null,this.distanceFramebuffer=null,this._distanceCallbacks=[],this._tempDistancePix_=null,this._depthCallbacks=[],this.depthFramebuffer=null,this.sceneFramebuffer=null,this.blitFramebuffer=null,this.toneMappingFramebuffer=null,this._entityCollections=[],this.handler.destroy(),this.handler=null,this._initialized=!1}}const Mh="/night.png",Rh="/spec.png",Sn="/res",Sh="globus_planet_";class Ft{constructor(e){this.$target=null,this._instanceID=`__globus${Ft.__counter__++?Ft.__counter__:""}__`,window[this._instanceID]=this,this._canvas=document.createElement("canvas"),this._canvas.id=`canvas${this._instanceID}`,this._canvas.style.width="100%",this._canvas.style.height="100%",this._canvas.style.display="block",this._canvas.style.opacity="0.0",this._canvas.style.transition="opacity 150ms",this.$inner=document.createElement("div"),this.$inner.classList.add("og-inner"),this.$inner.appendChild(this._canvas),this.$inner.attributions=document.createElement("div"),e.attributionContainer?e.attributionContainer.appendChild(this.$inner.attributions):(this.$inner.attributions.classList.add("og-attribution"),this.$inner.appendChild(this.$inner.attributions)),e.target&&this.attachTo(e.target);const t=n=>{n.preventDefault()};this._canvas.onmouseenter=function(){document.addEventListener("mousewheel",t,{capture:!1,passive:!1})},this._canvas.onmouseleave=function(){document.removeEventListener("mousewheel",t)},this.renderer=new Bh(new Di(this._canvas,{autoActivate:!1,pixelRatio:e.dpi||window.devicePixelRatio+.15,context:{antialias:!1,premultipliedAlpha:!1}}),{autoActivate:!1,msaa:e.msaa,fontsSrc:e.fontsSrc}),this.renderer.div=this.$inner,e.skybox&&this.renderer.addNode(e.skybox),this._planetName=e.name?e.name:Sh+Ft.__counter__,this.planet=new eh({name:this._planetName,frustums:e.frustums,ellipsoid:e.ellipsoid,maxGridSize:e.maxGridSize,nightTextureSrc:e.nightTextureSrc===null?null:`${e.resourcesSrc||Sn}${Mh}`,specularTextureSrc:e.specularTextureSrc===null?null:`${e.resourcesSrc||Sn}${Rh}`,minAltitude:e.minAltitude,maxAltitude:e.maxAltitude||15e6,maxEqualZoomAltitude:e.maxEqualZoomAltitude,minEqualZoomAltitude:e.minEqualZoomAltitude,minEqualZoomCameraSlope:e.minEqualZoomCameraSlope,quadTreeStrategyPrototype:e.quadTreeStrategyPrototype,maxLoadingRequests:e.maxLoadingRequests,atmosphereEnabled:e.atmosphereEnabled}),e.terrain?Array.isArray(e.terrain)?this.planet.setTerrain(e.terrain[0]):this.planet.setTerrain(e.terrain):this.planet.setTerrain(new ri),this.renderer.addNode(this.planet),e.controls?this.planet.addControls(e.controls):this.planet.addControls([new hl,e.useEarthNavigation?new el:new fr({minSlope:e.minSlope}),new al,new Jo,new il,new ya]);const i=this.renderer.controls;let r;for(let n in i)if(i[n]instanceof sn){r=i[n];break}r?this.sun=r:(this.sun=new sn,this.planet.addControl(this.sun)),e.sun&&(e.sun.active!==void 0&&!e.sun.active&&this.sun.deactivate(),e.sun.stopped===!0&&this.sun.stop()),e.layers&&this.planet.addLayers(e.layers);let s=e.viewExtent;s&&(s instanceof Array?this.planet.viewExtentArr(s):this.planet.viewExtent(s)),(e.autoActivate||At(e.autoActivate))&&this.start()}start(){this.renderer.start(),this.fadeIn()}fadeIn(){this._canvas.style.opacity="1.0"}fadeOut(){this._canvas.style.opacity="0"}attachTo(e){this.detach();let t;e instanceof HTMLElement?t=e:t=document.getElementById(e)||document.querySelector(e),t&&(this.$target=t,t.appendChild(this.$inner))}detach(){this.$target&&this.$target.removeChild(this.$inner)}destroy(){this.detach(),this.renderer.destroy()}}Ft.__counter__=0;let kt;const In=Me.createContext({globus:null,setGlobus:()=>{}}),zn=({children:c})=>{const[e,t]=Me.useState(kt);return Me.createElement(In.Provider,{value:{globus:e,setGlobus:t}},c)},Fn=()=>Me.useContext(In),Ih=({children:c})=>{const e=Me.useRef(null),{setGlobus:t}=Fn();return Me.useEffect(()=>{if(kt)e.current=kt.$target;else{let i=function(n,a,o){for(var l="",h=o;h>0;h--){var d=0,f=1<<h-1;n&f&&d++,a&f&&(d+=2),l+=d.toString()}return l};const r=new An("OpenStreetMap",{isBaseLayer:!0,url:"//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",visibility:!0,attribution:"Data @ OpenStreetMap contributors, ODbL"}),s=new An("sat",{isBaseLayer:!0,subdomains:["t0","t1","t2","t3"],url:"https://ecn.{s}.tiles.virtualearth.net/tiles/a{quad}.jpeg?n=z&g=7146",visibility:!0,attribution:'<a href="http://www.bing.com" target="_blank"><img title="Bing Imagery" src="https://sandcastle.cesium.com/CesiumUnminified/Assets/Images/bing_maps_credit.png" alt="Bing"></a> © 2021 Microsoft Corporation',maxNativeZoom:19,defaultTextures:[{color:"#001522"},{color:"#E4E6F3"}],shininess:18,specular:[63e-5,55e-5,32e-5],ambient:"rgb(100,100,140)",diffuse:"rgb(450,450,450)",nightTextureCoefficient:2.7,urlRewrite:function(n,a){return Et(a,{s:this._getSubdomain(),quad:i(n.tileX,n.tileY,n.tileZoom)})}});return kt=new Ft({target:e.current,name:"Earth",terrain:new ih,layers:[r,s],autoActivate:!0}),kt.planet.atmosphereEnabled=!0,()=>{}}t(kt)},[]),Me.createElement(zn,null,Me.createElement("div",{style:{width:"100%",height:"100%"},id:"globus",ref:e},c))};je.GlobusContextProvider=zn,je.default=Ih,je.useGlobusContext=Fn,Object.defineProperties(je,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import '@openglobus/og/css/og.css';
|
|
3
3
|
import { Globe } from '@openglobus/og';
|
|
4
4
|
interface GlobusContextProps {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
globus: Globe | null;
|
|
6
|
+
setGlobus: React.Dispatch<React.SetStateAction<Globe | null>>;
|
|
7
7
|
}
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const GlobusContextProvider: React.FC<{
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
}>;
|
|
11
11
|
export declare const useGlobusContext: () => GlobusContextProps;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/openglobus-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Openglobus React Components",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"private": false,
|
|
7
7
|
"module": "dist/index.mjs",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
8
|
+
"types": "dist/src/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|