olamaps-web-sdk 1.1.1 → 1.1.2
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.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/olamaps-web-sdk.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import { NavigationControlOptions } from 'maplibre-gl';
|
|
|
6
6
|
import * as OlaMapsGl from 'maplibre-gl';
|
|
7
7
|
import { PopupOptions } from 'maplibre-gl';
|
|
8
8
|
|
|
9
|
+
declare type MapMethods = {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
|
|
9
13
|
declare interface olaMapProps {
|
|
10
14
|
apiKey: string;
|
|
11
15
|
mode?: string;
|
|
@@ -24,7 +28,7 @@ export declare class OlaMaps {
|
|
|
24
28
|
private addAttribution;
|
|
25
29
|
private fetchStaticMap;
|
|
26
30
|
private add3dLayer;
|
|
27
|
-
init(options?: MapOptions): Map_2 &
|
|
31
|
+
init(options?: MapOptions): Map_2 & MapMethods;
|
|
28
32
|
addNavigationControls(options?: NavigationControlOptions): OlaMapsGl.NavigationControl;
|
|
29
33
|
addGeolocateControls(options: GeolocateControlOptions): OlaMapsGl.GeolocateControl;
|
|
30
34
|
getMercatorCoordinate(): typeof OlaMapsGl.MercatorCoordinate;
|
package/dist/index.js
CHANGED
|
@@ -51247,7 +51247,9 @@ class gV {
|
|
|
51247
51247
|
typeof this.olaMaps[o] == "function" && (i[o] = this.olaMaps[o].bind(this.olaMaps));
|
|
51248
51248
|
}), Object.keys(jd).forEach((o) => {
|
|
51249
51249
|
typeof jd[o] == "function" ? i[o] = (...l) => new jd[o](...l) : i[o] = jd[o];
|
|
51250
|
-
}),
|
|
51250
|
+
}), Object.getOwnPropertyNames(this.olaMaps).forEach((o) => {
|
|
51251
|
+
o in i || (i[o] = this.olaMaps[o]);
|
|
51252
|
+
}), Object.assign(this.olaMaps, i);
|
|
51251
51253
|
}
|
|
51252
51254
|
addNavigationControls(e) {
|
|
51253
51255
|
return new mo.NavigationControl(e);
|
|
@@ -2198,4 +2198,4 @@ DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
|
2198
2198
|
* limitations under the License.
|
|
2199
2199
|
*
|
|
2200
2200
|
* SPDX-License-Identifier: Apache-2.0
|
|
2201
|
-
*/var Wr=null;try{Wr=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function li(t,e,i){this.low=t|0,this.high=e|0,this.unsigned=!!i}li.prototype.__isLong__,Object.defineProperty(li.prototype,"__isLong__",{value:!0});function Ls(t){return(t&&t.__isLong__)===!0}function Gw(t){var e=Math.clz32(t&-t);return t?31-e:e}li.isLong=Ls;var Xw={},Ww={};function Va(t,e){var i,s,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(s=Ww[t],s)?s:(i=Yt(t,0,!0),o&&(Ww[t]=i),i)):(t|=0,(o=-128<=t&&t<128)&&(s=Xw[t],s)?s:(i=Yt(t,t<0?-1:0,!1),o&&(Xw[t]=i),i))}li.fromInt=Va;function qr(t,e){if(isNaN(t))return e?lo:yn;if(e){if(t<0)return lo;if(t>=Zw)return eA}else{if(t<=-Kw)return hr;if(t+1>=Kw)return Qw}return t<0?qr(-t,e).neg():Yt(t%sc|0,t/sc|0,e)}li.fromNumber=qr;function Yt(t,e,i){return new li(t,e,i)}li.fromBits=Yt;var gf=Math.pow;function Eg(t,e,i){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(i=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?lo:yn;if(i=i||10,i<2||36<i)throw RangeError("radix");var s;if((s=t.indexOf("-"))>0)throw Error("interior hyphen");if(s===0)return Eg(t.substring(1),e,i).neg();for(var o=qr(gf(i,8)),l=yn,u=0;u<t.length;u+=8){var c=Math.min(8,t.length-u),x=parseInt(t.substring(u,u+c),i);if(c<8){var w=qr(gf(i,c));l=l.mul(w).add(qr(x))}else l=l.mul(o),l=l.add(qr(x))}return l.unsigned=e,l}li.fromString=Eg;function gn(t,e){return typeof t=="number"?qr(t,e):typeof t=="string"?Eg(t,e):Yt(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}li.fromValue=gn;var qw=65536,_z=1<<24,sc=qw*qw,Zw=sc*sc,Kw=Zw/2,Jw=Va(_z),yn=Va(0);li.ZERO=yn;var lo=Va(0,!0);li.UZERO=lo;var rc=Va(1);li.ONE=rc;var Yw=Va(1,!0);li.UONE=Yw;var Sg=Va(-1);li.NEG_ONE=Sg;var Qw=Yt(-1,2147483647,!1);li.MAX_VALUE=Qw;var eA=Yt(-1,-1,!0);li.MAX_UNSIGNED_VALUE=eA;var hr=Yt(0,-2147483648,!1);li.MIN_VALUE=hr;var Ge=li.prototype;Ge.toInt=function(){return this.unsigned?this.low>>>0:this.low},Ge.toNumber=function(){return this.unsigned?(this.high>>>0)*sc+(this.low>>>0):this.high*sc+(this.low>>>0)},Ge.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(hr)){var i=qr(e),s=this.div(i),o=s.mul(i).sub(this);return s.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var l=qr(gf(e,6),this.unsigned),u=this,c="";;){var x=u.div(l),w=u.sub(x.mul(l)).toInt()>>>0,C=w.toString(e);if(u=x,u.isZero())return C+c;for(;C.length<6;)C="0"+C;c=""+C+c}},Ge.getHighBits=function(){return this.high},Ge.getHighBitsUnsigned=function(){return this.high>>>0},Ge.getLowBits=function(){return this.low},Ge.getLowBitsUnsigned=function(){return this.low>>>0},Ge.getNumBitsAbs=function(){if(this.isNegative())return this.eq(hr)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,i=31;i>0&&!(e&1<<i);i--);return this.high!=0?i+33:i+1},Ge.isZero=function(){return this.high===0&&this.low===0},Ge.eqz=Ge.isZero,Ge.isNegative=function(){return!this.unsigned&&this.high<0},Ge.isPositive=function(){return this.unsigned||this.high>=0},Ge.isOdd=function(){return(this.low&1)===1},Ge.isEven=function(){return(this.low&1)===0},Ge.equals=function(e){return Ls(e)||(e=gn(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},Ge.eq=Ge.equals,Ge.notEquals=function(e){return!this.eq(e)},Ge.neq=Ge.notEquals,Ge.ne=Ge.notEquals,Ge.lessThan=function(e){return this.comp(e)<0},Ge.lt=Ge.lessThan,Ge.lessThanOrEqual=function(e){return this.comp(e)<=0},Ge.lte=Ge.lessThanOrEqual,Ge.le=Ge.lessThanOrEqual,Ge.greaterThan=function(e){return this.comp(e)>0},Ge.gt=Ge.greaterThan,Ge.greaterThanOrEqual=function(e){return this.comp(e)>=0},Ge.gte=Ge.greaterThanOrEqual,Ge.ge=Ge.greaterThanOrEqual,Ge.compare=function(e){if(Ls(e)||(e=gn(e)),this.eq(e))return 0;var i=this.isNegative(),s=e.isNegative();return i&&!s?-1:!i&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},Ge.comp=Ge.compare,Ge.negate=function(){return!this.unsigned&&this.eq(hr)?hr:this.not().add(rc)},Ge.neg=Ge.negate,Ge.add=function(e){Ls(e)||(e=gn(e));var i=this.high>>>16,s=this.high&65535,o=this.low>>>16,l=this.low&65535,u=e.high>>>16,c=e.high&65535,x=e.low>>>16,w=e.low&65535,C=0,M=0,P=0,j=0;return j+=l+w,P+=j>>>16,j&=65535,P+=o+x,M+=P>>>16,P&=65535,M+=s+c,C+=M>>>16,M&=65535,C+=i+u,C&=65535,Yt(P<<16|j,C<<16|M,this.unsigned)},Ge.subtract=function(e){return Ls(e)||(e=gn(e)),this.add(e.neg())},Ge.sub=Ge.subtract,Ge.multiply=function(e){if(this.isZero())return this;if(Ls(e)||(e=gn(e)),Wr){var i=Wr.mul(this.low,this.high,e.low,e.high);return Yt(i,Wr.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?lo:yn;if(this.eq(hr))return e.isOdd()?hr:yn;if(e.eq(hr))return this.isOdd()?hr:yn;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Jw)&&e.lt(Jw))return qr(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,o=this.high&65535,l=this.low>>>16,u=this.low&65535,c=e.high>>>16,x=e.high&65535,w=e.low>>>16,C=e.low&65535,M=0,P=0,j=0,Y=0;return Y+=u*C,j+=Y>>>16,Y&=65535,j+=l*C,P+=j>>>16,j&=65535,j+=u*w,P+=j>>>16,j&=65535,P+=o*C,M+=P>>>16,P&=65535,P+=l*w,M+=P>>>16,P&=65535,P+=u*x,M+=P>>>16,P&=65535,M+=s*C+o*w+l*x+u*c,M&=65535,Yt(j<<16|Y,M<<16|P,this.unsigned)},Ge.mul=Ge.multiply,Ge.divide=function(e){if(Ls(e)||(e=gn(e)),e.isZero())throw Error("division by zero");if(Wr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var i=(this.unsigned?Wr.div_u:Wr.div_s)(this.low,this.high,e.low,e.high);return Yt(i,Wr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?lo:yn;var s,o,l;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return lo;if(e.gt(this.shru(1)))return Yw;l=lo}else{if(this.eq(hr)){if(e.eq(rc)||e.eq(Sg))return hr;if(e.eq(hr))return rc;var u=this.shr(1);return s=u.div(e).shl(1),s.eq(yn)?e.isNegative()?rc:Sg:(o=this.sub(e.mul(s)),l=s.add(o.div(e)),l)}else if(e.eq(hr))return this.unsigned?lo:yn;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();l=yn}for(o=this;o.gte(e);){s=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(s)/Math.LN2),x=c<=48?1:gf(2,c-48),w=qr(s),C=w.mul(e);C.isNegative()||C.gt(o);)s-=x,w=qr(s,this.unsigned),C=w.mul(e);w.isZero()&&(w=rc),l=l.add(w),o=o.sub(C)}return l},Ge.div=Ge.divide,Ge.modulo=function(e){if(Ls(e)||(e=gn(e)),Wr){var i=(this.unsigned?Wr.rem_u:Wr.rem_s)(this.low,this.high,e.low,e.high);return Yt(i,Wr.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},Ge.mod=Ge.modulo,Ge.rem=Ge.modulo,Ge.not=function(){return Yt(~this.low,~this.high,this.unsigned)},Ge.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},Ge.clz=Ge.countLeadingZeros,Ge.countTrailingZeros=function(){return this.low?Gw(this.low):Gw(this.high)+32},Ge.ctz=Ge.countTrailingZeros,Ge.and=function(e){return Ls(e)||(e=gn(e)),Yt(this.low&e.low,this.high&e.high,this.unsigned)},Ge.or=function(e){return Ls(e)||(e=gn(e)),Yt(this.low|e.low,this.high|e.high,this.unsigned)},Ge.xor=function(e){return Ls(e)||(e=gn(e)),Yt(this.low^e.low,this.high^e.high,this.unsigned)},Ge.shiftLeft=function(e){return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Yt(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Yt(0,this.low<<e-32,this.unsigned)},Ge.shl=Ge.shiftLeft,Ge.shiftRight=function(e){return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Yt(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Yt(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},Ge.shr=Ge.shiftRight,Ge.shiftRightUnsigned=function(e){return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Yt(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?Yt(this.high,0,this.unsigned):Yt(this.high>>>e-32,0,this.unsigned)},Ge.shru=Ge.shiftRightUnsigned,Ge.shr_u=Ge.shiftRightUnsigned,Ge.rotateLeft=function(e){var i;return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?Yt(this.high,this.low,this.unsigned):e<32?(i=32-e,Yt(this.low<<e|this.high>>>i,this.high<<e|this.low>>>i,this.unsigned)):(e-=32,i=32-e,Yt(this.high<<e|this.low>>>i,this.low<<e|this.high>>>i,this.unsigned))},Ge.rotl=Ge.rotateLeft,Ge.rotateRight=function(e){var i;return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?Yt(this.high,this.low,this.unsigned):e<32?(i=32-e,Yt(this.high<<i|this.low>>>e,this.low<<i|this.high>>>e,this.unsigned)):(e-=32,i=32-e,Yt(this.low<<i|this.high>>>e,this.high<<i|this.low>>>e,this.unsigned))},Ge.rotr=Ge.rotateRight,Ge.toSigned=function(){return this.unsigned?Yt(this.low,this.high,!1):this},Ge.toUnsigned=function(){return this.unsigned?this:Yt(this.low,this.high,!0)},Ge.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},Ge.toBytesLE=function(){var e=this.high,i=this.low;return[i&255,i>>>8&255,i>>>16&255,i>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},Ge.toBytesBE=function(){var e=this.high,i=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,i>>>24,i>>>16&255,i>>>8&255,i&255]},li.fromBytes=function(e,i,s){return s?li.fromBytesLE(e,i):li.fromBytesBE(e,i)},li.fromBytesLE=function(e,i){return new li(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,i)},li.fromBytesBE=function(e,i){return new li(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],i)};const mz=16;function tA(t){t==="X"&&(t="");const e=t.padEnd(mz,"0");return li.fromString(e,!0,16)}function gz(t){if(t.isZero())return"X";let e=t.countTrailingZeros();const i=e%4;e=(e-i)/4;const s=e;e*=4;const l=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-s-l.length).join("0")+l}function yz(t,e){const i=bz(t).shiftRightUnsigned(2);return t.add(li.fromNumber(2*e+1-4).multiply(i))}function bz(t){return t.and(t.not().add(1))}const vz=3,xz=2*30+1,iA=180/Math.PI;function wz(t){if(t.length===0)throw new Error(`Invalid Hilbert quad key ${t}`);const e=t.split("/"),i=parseInt(e[0],10),s=e[1],o=s.length;let l=0;const u=[0,0];for(let c=o-1;c>=0;c--){l=o-c;const x=s[c];let w=0,C=0;x==="1"?C=1:x==="2"?(w=1,C=1):x==="3"&&(w=1);const M=Math.pow(2,l-1);Tz(M,u,w,C),u[0]+=M*w,u[1]+=M*C}if(i%2===1){const c=u[0];u[0]=u[1],u[1]=c}return{face:i,ij:u,level:l}}function Az(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<vz+xz;)e="0"+e;const i=e.lastIndexOf("1"),s=e.substring(0,3),o=e.substring(3,i),l=o.length/2,u=li.fromString(s,!0,2).toString(10);let c="";if(l!==0)for(c=li.fromString(o,!0,2).toString(4);c.length<l;)c="0"+c;return`${u}/${c}`}function sA(t,e,i){const s=1<<e;return[(t[0]+i[0])/s,(t[1]+i[1])/s]}function rA(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function nA(t){return[rA(t[0]),rA(t[1])]}function oA(t,[e,i]){switch(t){case 0:return[1,e,i];case 1:return[-e,1,i];case 2:return[-e,-i,1];case 3:return[-1,-i,-e];case 4:return[i,-1,-e];case 5:return[i,e,-1];default:throw new Error("Invalid face")}}function aA([t,e,i]){const s=Math.atan2(i,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*iA,s*iA]}function Tz(t,e,i,s){if(s===0){i===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const o=e[0];e[0]=e[1],e[1]=o}}function Ez(t){const e=sA(t.ij,t.level,[.5,.5]),i=nA(e),s=oA(t.face,i);return aA(s)}const Sz=100;function lA(t){const{face:e,ij:i,level:s}=t,o=[[0,0],[0,1],[1,1],[1,0],[0,0]],l=Math.max(1,Math.ceil(Sz*Math.pow(2,-s))),u=new Float64Array(4*l*2+2);let c=0,x=0;for(let w=0;w<4;w++){const C=o[w].slice(0),M=o[w+1],P=(M[0]-C[0])/l,j=(M[1]-C[1])/l;for(let Y=0;Y<l;Y++){C[0]+=P,C[1]+=j;const Q=sA(i,s,C),_e=nA(Q),me=oA(e,_e),we=aA(me);Math.abs(we[1])>89.999&&(we[0]=x);const Ee=we[0]-x;we[0]+=Ee>180?-360:Ee<-180?360:0,u[c++]=we[0],u[c++]=we[1],x=we[0]}}return u[c++]=u[0],u[c++]=u[1],u}function Cg(t){const e=Cz(t);return wz(e)}function Cz(t){if(t.indexOf("/")>0)return t;const e=tA(t);return Az(e)}function Iz(t){const e=Cg(t);return Ez(e)}function Rz(t){let e;if(t.face===2||t.face===5){let i=null,s=0;for(let o=0;o<4;o++){const l=`${t.face}/${o}`,u=Cg(l),c=lA(u);(typeof i>"u"||i===null)&&(i=new Float64Array(4*c.length)),i.set(c,s),s+=c.length}e=cA(i)}else{const i=lA(t);e=cA(i)}return e}function cA(t){if(t.length%2!==0)throw new Error("Invalid corners");const e=[],i=[];for(let s=0;s<t.length;s+=2)e.push(t[s]),i.push(t[s+1]);return e.sort((s,o)=>s-o),i.sort((s,o)=>s-o),{west:e[0],east:e[e.length-1],north:i[i.length-1],south:i[0]}}function Mz(t,e){const i=(e==null?void 0:e.minimumHeight)||0,s=(e==null?void 0:e.maximumHeight)||0,o=Cg(t),l=Rz(o),u=l.west,c=l.south,x=l.east,w=l.north,C=[];return C.push(new Se(u,w,i)),C.push(new Se(x,w,i)),C.push(new Se(x,c,i)),C.push(new Se(u,c,i)),C.push(new Se(u,w,s)),C.push(new Se(x,w,s)),C.push(new Se(x,c,s)),C.push(new Se(u,c,s)),C}function hA(t){const e=t.token,i={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},s=Mz(e,i),o=Iz(e),l=o[0],u=o[1],c=wi.WGS84.cartographicToCartesian([l,u,i.maximumHeight]),x=new Se(c[0],c[1],c[2]);s.push(x);const w=Ck(s);return[...w.center,...w.halfAxes]}const Pz={QUADTREE:4,OCTREE:8};function Bz(t,e,i){if(t!=null&&t.box){const s=tA(t.s2VolumeInfo.token),o=yz(s,e),l=gz(o),u={...t.s2VolumeInfo};switch(u.token=l,i){case"OCTREE":const w=t.s2VolumeInfo,C=w.maximumHeight-w.minimumHeight,M=C/2,P=w.minimumHeight+C/2;w.minimumHeight=P-M,w.maximumHeight=P+M;break}return{box:hA(u),s2VolumeInfo:u}}}async function uA(t){const{subtree:e,subtreeData:i={level:0,x:0,y:0,z:0},parentData:s={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:o=0,implicitOptions:l,loaderOptions:u,s2VolumeBox:c}=t,{subdivisionScheme:x,subtreeLevels:w,maximumLevel:C,contentUrlTemplate:M,subtreesUriTemplate:P,basePath:j}=l,Y={children:[],lodMetricValue:0,contentUrl:""};if(!C)return n0.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${M} won't be loaded...`),Y;const Q=s.localLevel+1,_e=i.level+Q;if(_e>C)return Y;const me=Pz[x],we=Math.log2(me),Ee=o&1,Oe=o>>1&1,Ne=o>>2&1,ze=Ha(s.localX,Ee,1),nt=Ha(s.localY,Oe,1),mt=Ha(s.localZ,Ne,1),We=Ha(i.x,ze,Q),at=Ha(i.y,nt,Q),it=Ha(i.z,mt,Q),Ut=Ha(s.mortonIndex,o,we),Rt=Q===w&&Ig(e.childSubtreeAvailability,Ut);let yt,_i,Us,$i;if(Rt){const Gi=`${j}/${P}`,Ui=Rg(Gi,_e,We,at,it);yt=await Ro(Ui,$w,u),$i=0,_i={level:_e,x:We,y:at,z:it},Us={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else yt=e,$i=(me**Q-1)/(me-1)+Ut,_i=i,Us={mortonIndex:Ut,localLevel:Q,localX:ze,localY:nt,localZ:mt};if(!Ig(yt.tileAvailability,$i))return Y;Ig(yt.contentAvailability,$i)&&(Y.contentUrl=Rg(M,_e,We,at,it));for(let Gi=0;Gi<me;Gi++){const Ui=Bz(c,Gi,x),Bi=await uA({subtree:yt,subtreeData:_i,parentData:Us,childIndex:Gi,implicitOptions:l,loaderOptions:u,s2VolumeBox:Ui});(Bi.contentUrl||Bi.children.length)&&Y.children.push(Bi)}return Y.contentUrl||Y.children.length?Dz(Y,{level:_e,x:We,y:at,z:it},l,c):Y}function Ig(t,e){let i;return Array.isArray(t)?(i=t[0],t.length>1&&n0.once('Not supported extension "3DTILES_multiple_contents" has been detected')):i=t,"constant"in i?!!i.constant:i.explicitBitstream?kz(e,i.explicitBitstream):!1}function Dz(t,e,i,s){const{basePath:o,refine:l,getRefine:u,lodMetricType:c,getTileType:x,rootLodMetricValue:w,rootBoundingVolume:C}=i,M=t.contentUrl&&t.contentUrl.replace(`${o}/`,""),P=w/2**e.level,j=s!=null&&s.box?{box:s.box}:C,Y=Oz(j,e,i.subdivisionScheme);return{children:t.children,contentUrl:t.contentUrl,content:{uri:M},id:t.contentUrl,refine:u(l),type:x(t),lodMetricType:c,lodMetricValue:P,geometricError:P,transform:t.transform,boundingVolume:Y}}function Oz(t,e,i){if(t.region){const{level:s,x:o,y:l,z:u}=e,[c,x,w,C,M,P]=t.region,j=2**s,Y=(w-c)/j,[Q,_e]=[c+Y*o,c+Y*(o+1)],me=(C-x)/j,[we,Ee]=[x+me*l,x+me*(l+1)];let Oe,Ne;if(i==="OCTREE"){const ze=(P-M)/j;[Oe,Ne]=[M+ze*u,M+ze*(u+1)]}else[Oe,Ne]=[M,P];return{region:[Q,we,_e,Ee,Oe,Ne]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function Ha(t,e,i){return(t<<i)+e}function Rg(t,e,i,s,o){const l=Fz({level:e,x:i,y:s,z:o});return t.replace(/{level}|{x}|{y}|{z}/gi,u=>l[u])}function Fz(t){const e={};for(const i in t)e[`{${i}}`]=t[i];return e}function kz(t,e){const i=Math.floor(t/8),s=t%8;return(e[i]>>s&1)===1}function Mg(t,e=""){if(!e)return ao.EMPTY;const s=e.split("?")[0].split(".").pop();switch(s){case"pnts":return ao.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ao.SCENEGRAPH;default:return s||ao.EMPTY}}function Pg(t){switch(t){case"REPLACE":case"replace":return mn.REPLACE;case"ADD":case"add":return mn.ADD;default:return t}}function Bg(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){const s=new URL(t,`${e}/`);return decodeURI(s.toString())}else if(t.startsWith("/"))return t;return dS(e,t)}function dA(t,e){var o;if(!t)return null;let i;if(t.content){const l=t.content.uri||((o=t.content)==null?void 0:o.url);typeof l<"u"&&(i=Bg(l,e))}return{...t,id:i,contentUrl:i,lodMetricType:tc.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Mg(t,i),refine:Pg(t.refine)}}async function Nz(t,e,i){let s=null;const o=pA(t.root);o&&t.root?s=await fA(t.root,t,e,o,i):s=dA(t.root,e);const l=[];for(l.push(s);l.length>0;){const u=l.pop()||{},c=u.children||[],x=[];for(const w of c){const C=pA(w);let M;C?M=await fA(w,t,e,C,i):M=dA(w,e),M&&(x.push(M),l.push(M))}u.children=x}return s}async function fA(t,e,i,s,o){var Oe,Ne,ze;const{subdivisionScheme:l,maximumLevel:u,availableLevels:c,subtreeLevels:x,subtrees:{uri:w}}=s,C=Rg(w,0,0,0,0),M=Bg(C,i),P=await Ro(M,$w,o),j=(Oe=t.content)==null?void 0:Oe.uri,Y=j?Bg(j,i):"",Q=(Ne=e==null?void 0:e.root)==null?void 0:Ne.refine,_e=t.geometricError,me=(ze=t.boundingVolume.extensions)==null?void 0:ze["3DTILES_bounding_volume_S2"];if(me){const mt={box:hA(me),s2VolumeInfo:me};t.boundingVolume=mt}const we=t.boundingVolume,Ee={contentUrlTemplate:Y,subtreesUriTemplate:w,subdivisionScheme:l,subtreeLevels:x,maximumLevel:Number.isFinite(c)?c-1:u,refine:Q,basePath:i,lodMetricType:tc.GEOMETRIC_ERROR,rootLodMetricValue:_e,rootBoundingVolume:we,getTileType:Mg,getRefine:Pg};return await Lz(t,i,P,Ee,o)}async function Lz(t,e,i,s,o){if(!t)return null;const{children:l,contentUrl:u}=await uA({subtree:i,implicitOptions:s,loaderOptions:o});let c,x=null;return u&&(c=u,x={uri:u.replace(`${e}/`,"")}),{...t,id:c,contentUrl:c,lodMetricType:tc.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Mg(t,c),refine:Pg(t.refine),content:x||t.content,children:l}}function pA(t){var e;return((e=t==null?void 0:t.extensions)==null?void 0:e["3DTILES_implicit_tiling"])||(t==null?void 0:t.implicitTiling)}const _A={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Pw,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:Uz,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Uz(t,e={},i){const s=e["3d-tiles"]||{};let o;return s.isTileset==="auto"?o=(i==null?void 0:i.url)&&i.url.indexOf(".json")!==-1:o=s.isTileset,o?zz(t,e,i):Vz(t,e,i)}async function zz(t,e,i){var x;const s=JSON.parse(new TextDecoder().decode(t)),o=(i==null?void 0:i.url)||"",l=Hz(o),u=await Nz(s,l,e||{});return{...s,shape:"tileset3d",loader:_A,url:o,queryString:(i==null?void 0:i.queryString)||"",basePath:l,root:u||s.root,type:lr.TILES3D,lodMetricType:tc.GEOMETRIC_ERROR,lodMetricValue:((x=s.root)==null?void 0:x.geometricError)||0}}async function Vz(t,e,i){const s={content:{shape:"tile3d",featureIds:null}};return await Hw(t,0,e,i,s.content),s.content}function Hz(t){return jp(t)}const mA=[0],jz={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:_A,onTilesetLoad:{type:"function",value:t=>{}},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:(t,e,i)=>{}},_getMeshColor:{type:"function",value:t=>[255,255,255]}};class Dg extends l1{initializeState(){"onTileLoadFail"in this.props&&Jt.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){var e,i;return!!((i=(e=this.state)==null?void 0:e.tileset3d)!=null&&i.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:i,changeFlags:s}){if(e.data&&e.data!==i.data&&this._loadTileset(e.data),s.viewportChanged){const{activeViewports:o}=this.state;Object.keys(o).length&&(this._updateTileset(o),this.state.lastUpdatedViewports=o,this.state.activeViewports={})}if(s.propsChanged){const{layerMap:o}=this.state;for(const l in o)o[l].needsUpdate=!0}}activateViewport(e){const{activeViewports:i,lastUpdatedViewports:s}=this.state;this.internalState.viewport=e,i[e.id]=e;const o=s==null?void 0:s[e.id];(!o||!e.equals(o))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:i}){const s=i&&i.props.tile;return e.picked&&(e.object=s),e.sourceTile=s,e}filterSubLayer({layer:e,viewport:i}){const{tile:s}=e.props,{id:o}=i;return s.selected&&s.viewportIds.includes(o)}_updateAutoHighlight(e){const i=e.sourceTile,s=this.state.layerMap[i==null?void 0:i.id];s&&s.layer&&s.layer.updateAutoHighlight(e)}async _loadTileset(e){const{loadOptions:i={}}=this.props,s=this.props.loader||this.props.loaders,o=Array.isArray(s)?s[0]:s,l={loadOptions:{...i}};let u=e;if(o.preload){const w=await o.preload(e,i);w.url&&(u=w.url),w.headers&&(l.loadOptions.fetch={...l.loadOptions.fetch,headers:w.headers}),Object.assign(l,w)}const c=await Ro(u,o,l.loadOptions),x=new S6(c,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...l});this.setState({tileset3d:x,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(x)}_onTileLoad(e){const{lastUpdatedViewports:i}=this.state;this.props.onTileLoad(e),this._updateTileset(i),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;const{tileset3d:i}=this.state,{timeline:s}=this.context,o=Object.keys(e).length;!s||!o||!i||i.selectTiles(Object.values(e)).then(l=>{this.state.frameNumber!==l&&this.setState({frameNumber:l})})}_getSubLayer(e,i){if(!e.content)return null;switch(e.type){case ao.POINTCLOUD:return this._makePointCloudLayer(e,i);case ao.SCENEGRAPH:return this._make3DModelLayer(e);case ao.MESH:return this._makeSimpleMeshLayer(e,i);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,i){const{attributes:s,pointCount:o,constantRGBA:l,cartographicOrigin:u,modelMatrix:c}=e.content,{positions:x,normals:w,colors:C}=s;if(!x)return null;const M=i&&i.props.data||{header:{vertexCount:o},attributes:{POSITION:x,NORMAL:w,COLOR_0:C}},{pointSize:P,getPointColor:j}=this.props,Y=this.getSubLayerClass("pointcloud",Fm);return new Y({pointSize:P},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:M,coordinateSystem:Wt.METER_OFFSETS,coordinateOrigin:u,modelMatrix:c,getColor:l||j,_offset:0})}_make3DModelLayer(e){const{gltf:i,instances:s,cartographicOrigin:o,modelMatrix:l}=e.content,u=this.getSubLayerClass("scenegraph",rg);return new u({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:s||mA,scenegraph:i,coordinateSystem:Wt.METER_OFFSETS,coordinateOrigin:o,modelMatrix:l,getTransformMatrix:c=>c.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,i){const s=e.content,{attributes:o,indices:l,modelMatrix:u,cartographicOrigin:c,coordinateSystem:x=Wt.METER_OFFSETS,material:w,featureIds:C}=s,{_getMeshColor:M}=this.props,P=i&&i.props.mesh||new Fl({topology:"triangle-list",attributes:$z(o),indices:l}),j=this.getSubLayerClass("mesh",ng);return new j(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:P,data:mA,getColor:M(e),pbrMaterial:w,modelMatrix:u,coordinateOrigin:c,coordinateSystem:x,featureIds:C,_offset:0})}renderLayers(){const{tileset3d:e,layerMap:i}=this.state;return e?e.tiles.map(s=>{const o=i[s.id]=i[s.id]||{tile:s};let{layer:l}=o;return s.selected&&(l?o.needsUpdate&&(l=this._getSubLayer(s,l),o.needsUpdate=!1):l=this._getSubLayer(s)),o.layer=l,l}).filter(Boolean):null}}Dg.defaultProps=jz,Dg.layerName="Tile3DLayer";function $z(t){const e={};return e.positions={...t.positions,value:new Float32Array(t.positions.value)},t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}const Og=512,Gz=Math.PI/180;function gA({map:t,gl:e,deck:i}){if(t.__deck)return t.__deck;const s=i==null?void 0:i.props._customRender,o=i==null?void 0:i.props.onLoad,l=vA({...i==null?void 0:i.props,_customRender:()=>{t.triggerRepaint(),s==null||s("")}});let u;return(!i||i.props.gl===e)&&(Object.assign(l,{gl:e,width:null,height:null,touchAction:"unset",viewState:Vh(t)}),i!=null&&i.isInitialized?yA(i,t):l.onLoad=()=>{o==null||o(),yA(u,t)}),i?(u=i,i.setProps(l),i.userData.isExternal=!0):(u=new Rh(l),t.on("remove",()=>{bA(t)})),u.userData.mapboxLayers=new Set,t.__deck=u,t.on("render",()=>{u.isInitialized&&Jz(u,t)}),u}function yA(t,e){const i=()=>{t.isInitialized?Yz(t,e):e.off("move",i)};e.on("move",i)}function bA(t){var e;(e=t.__deck)==null||e.finalize(),t.__deck=null}function vA(t){return{...t,parameters:{depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthFunc:515,blendEquation:32774,...t.parameters},views:t.views||[new om({id:"mapbox"})]}}function Xz(t,e){t.userData.mapboxLayers.add(e),Fg(t)}function Wz(t,e){t.userData.mapboxLayers.delete(e),Fg(t)}function qz(t,e){Fg(t)}function Zz(t,e,i){let{currentViewport:s}=t.userData,o=!1;s||(s=xA(t,e,!0),t.userData.currentViewport=s,o=!0),t.isInitialized&&t._drawLayers("mapbox-repaint",{viewports:[s],layerFilter:({layer:l})=>i.id===l.id||l.props.operation.includes("terrain"),clearStack:o,clearCanvas:!1})}function Vh(t){var o;const{lng:e,lat:i}=t.getCenter(),s={longitude:(e+540)%360-180,latitude:i,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:t.getPadding(),repeat:t.getRenderWorldCopies()};return(o=t.getTerrain)!=null&&o.call(t)&&Kz(t,s),s}function Kz(t,e){if(t.getFreeCameraOptions){const{position:i}=t.getFreeCameraOptions();if(!i||i.z===void 0)return;const s=t.transform.height,{longitude:o,latitude:l,pitch:u}=e,c=i.x*Og,x=(1-i.y)*Og,w=i.z*Og,C=dh([o,l]),M=c-C[0],P=x-C[1],j=Math.sqrt(M*M+P*P),Y=u*Gz,Q=1.5*s,_e=Y<.001?Q*Math.cos(Y)/w:Q*Math.sin(Y)/j;e.zoom=Math.log2(_e);const me=Q*Math.cos(Y)/_e,we=w-me;e.position=[0,0,we/Id(l)]}else typeof t.transform.elevation=="number"&&(e.position=[0,0,t.transform.elevation])}function xA(t,e,i=!0){return new Ba({id:"mapbox",x:0,y:0,width:t.width,height:t.height,...Vh(e),nearZMultiplier:i?.02:.1,nearZ:e.transform._nearZ/e.transform.height,farZ:e.transform._farZ/e.transform.height})}function Jz(t,e){const{mapboxLayers:i,isExternal:s}=t.userData;if(s){const o=Array.from(i,C=>C.id),u=Ul(t.props.layers,Boolean).some(C=>C&&!o.includes(C.id));let c=t.getViewports();const x=c.findIndex(C=>C.id==="mapbox"),w=c.length>1||x<0;(u||w)&&(x>=0&&(c=c.slice(),c[x]=xA(t,e,!1)),t._drawLayers("mapbox-repaint",{viewports:c,layerFilter:C=>(!t.props.layerFilter||t.props.layerFilter(C))&&(C.viewport.id!=="mapbox"||!o.includes(C.layer.id)),clearCanvas:!1}))}t.userData.currentViewport=null}function Yz(t,e){t.setProps({viewState:Vh(e)}),t.needsRedraw({clearRedrawFlags:!0})}function Fg(t){if(t.userData.isExternal)return;const e=[];t.userData.mapboxLayers.forEach(i=>{const s=i.props.type,o=new s(i.props);e.push(o)}),t.setProps({layers:e})}class Qz{constructor(e){if(!e.id)throw new Error("Layer must have an unique id");this.id=e.id,this.type="custom",this.renderingMode=e.renderingMode||"3d",this.map=null,this.deck=null,this.props=e}onAdd(e,i){this.map=e,this.deck=gA({map:e,gl:i,deck:this.props.deck}),Xz(this.deck,this)}onRemove(){this.deck&&Wz(this.deck,this)}setProps(e){Object.assign(this.props,e,{id:this.id}),this.deck&&qz(this.deck)}render(){Zz(this.deck,this.map,this)}}const kg="__UNDEFINED__";function yf(t,e,i,s){if(!t||!e||!t.style||!t.style._loaded)return;const o=Ul(s,Boolean);if(i!==s){const c=Ul(i,Boolean),x=new Set(c.map(w=>w.id));for(const w of o)x.delete(w.id);for(const w of x)t.getLayer(w)&&t.removeLayer(w)}for(const c of o){const x=t.getLayer(c.id);x?(x.implementation||x).setProps(c.props):t.addLayer(new Qz({id:c.id,deck:e}),c.props.beforeId)}const l=t.style._order,u={};for(const c of o){let{beforeId:x}=c.props;(!x||!l.includes(x))&&(x=kg),u[x]=u[x]||[],u[x].push(c.id)}for(const c in u){const x=u[c];let w=c===kg?l.length:l.indexOf(c),C=c===kg?void 0:c;for(let M=x.length-1;M>=0;M--){const P=x[M],j=l.indexOf(P);j!==w-1&&(t.moveLayer(P,C),j>w&&w++),w--,C=P}}}class e5{constructor(e){this._handleStyleChange=()=>{yf(this._map,this._deck,this._props.layers,this._props.layers)},this._updateContainerSize=()=>{if(this._map&&this._container){const{clientWidth:o,clientHeight:l}=this._map.getContainer();Object.assign(this._container.style,{width:`${o}px`,height:`${l}px`})}},this._updateViewState=()=>{const o=this._deck;o&&(o.setProps({viewState:Vh(this._map)}),o.isInitialized&&o.redraw())},this._handleMouseEvent=o=>{const l=this._deck;if(!l||!l.isInitialized)return;const u={type:o.type,offsetCenter:o.point,srcEvent:o},c=this._lastMouseDownPoint;switch(!o.point&&c&&(u.deltaX=o.originalEvent.clientX-c.clientX,u.deltaY=o.originalEvent.clientY-c.clientY,u.offsetCenter={x:c.x+u.deltaX,y:c.y+u.deltaY}),u.type){case"mousedown":l._onPointerDown(u),this._lastMouseDownPoint={...o.point,clientX:o.originalEvent.clientX,clientY:o.originalEvent.clientY};break;case"dragstart":u.type="panstart",l._onEvent(u);break;case"drag":u.type="panmove",l._onEvent(u);break;case"dragend":u.type="panend",l._onEvent(u);break;case"click":u.tapCount=1,l._onEvent(u);break;case"dblclick":u.type="click",u.tapCount=2,l._onEvent(u);break;case"mousemove":u.type="pointermove",l._onPointerMove(u);break;case"mouseout":u.type="pointerleave",l._onPointerMove(u);break;default:return}};const{interleaved:i=!1,...s}=e;this._interleaved=i,this._props=s}setProps(e){this._interleaved&&e.layers&&yf(this._map,this._deck,this._props.layers,e.layers),Object.assign(this._props,e),this._deck&&this._deck.setProps(this._interleaved?vA(this._props):this._props)}onAdd(e){return this._map=e,this._interleaved?this._onAddInterleaved(e):this._onAddOverlaid(e)}_onAddOverlaid(e){const i=document.createElement("div");return Object.assign(i.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=i,this._deck=new Rh({...this._props,parent:i,viewState:Vh(e)}),e.on("resize",this._updateContainerSize),e.on("render",this._updateViewState),e.on("mousedown",this._handleMouseEvent),e.on("dragstart",this._handleMouseEvent),e.on("drag",this._handleMouseEvent),e.on("dragend",this._handleMouseEvent),e.on("mousemove",this._handleMouseEvent),e.on("mouseout",this._handleMouseEvent),e.on("click",this._handleMouseEvent),e.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),i}_onAddInterleaved(e){const i=e.painter.context.gl;return i instanceof WebGLRenderingContext&&Jt.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=gA({map:e,gl:i,deck:new Rh({...this._props,gl:i})}),e.on("styledata",this._handleStyleChange),yf(e,this._deck,[],this._props.layers),document.createElement("div")}onRemove(){const e=this._map;e&&(this._interleaved?this._onRemoveInterleaved(e):this._onRemoveOverlaid(e)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(e){var i;e.off("resize",this._updateContainerSize),e.off("render",this._updateViewState),e.off("mousedown",this._handleMouseEvent),e.off("dragstart",this._handleMouseEvent),e.off("drag",this._handleMouseEvent),e.off("dragend",this._handleMouseEvent),e.off("mousemove",this._handleMouseEvent),e.off("mouseout",this._handleMouseEvent),e.off("click",this._handleMouseEvent),e.off("dblclick",this._handleMouseEvent),(i=this._deck)==null||i.finalize()}_onRemoveInterleaved(e){e.off("styledata",this._handleStyleChange),yf(e,this._deck,this._props.layers,[]),bA(e)}getDefaultPosition(){return"top-left"}pickObject(e){return os(this._deck),this._deck.pickObject(e)}pickMultipleObjects(e){return os(this._deck),this._deck.pickMultipleObjects(e)}pickObjects(e){return os(this._deck),this._deck.pickObjects(e)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}}class wA{constructor({apiKey:e,accessToken:i="",mode:s="2d",threedTileset:o=cE}){O(this,"olaMaps");O(this,"apiKey");O(this,"accessToken");O(this,"mode");O(this,"threedTileset");this.apiKey=e,this.mode=s,this.threedTileset=o,this.accessToken=i}addOlaLogo(e){var o;if(typeof window>"u")return;const i=document.getElementsByClassName("maplibregl-ctrl-bottom-left");let s="#000";(o=e.style)!=null&&o.includes("dark")&&(s="#FFF");for(let l=0;l<i.length;l++){const u=document.createElement("div");u.style.position="absolute",u.style.bottom="4px",u.style.left="10px",u.style.zIndex="1000",u.innerHTML=hE(s),i[l].appendChild(u)}}addAttribution(){const e=document.querySelectorAll(".maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib-inner");e==null||e.forEach(i=>{const s=i.querySelector("a");s&&(s.style.display="none");const o="ola-maps-link";if(!i.querySelector(`#${o}`)){const u=document.createElement("a");u.id=o,u.href="https://maps.olakrutrim.com/",u.target="_blank",u.textContent="Ola Maps ",i.appendChild(u)}const l="osm-link";if(!i.querySelector(`#${l}`)){const u=document.createElement("a");u.id=l,u.href="https://www.openstreetmap.org/copyright",u.target="_blank",u.textContent="| © OpenStreetMap contributors",i.appendChild(u)}})}fetchStaticMap(e){try{return fetch(e).then(i=>i.blob())}catch(i){console.log(i)}}async add3dLayer(){if(!this.threedTileset)throw new Error("3d Tileset is not initialized");const e=new Dg({id:"tile-3d-layer",data:`${this.threedTileset}?api_key=${this.apiKey}`,beforeId:"poi_railway"}),i=new e5({interleaved:!0,layers:[e]});i&&this.olaMaps.on("style.load",()=>{this.olaMaps.setFilter("building-3d",["all",["!has","hide_3d"],["!=","render_as_3d",!0]]),this.olaMaps.addControl(i)})}init(e){this.olaMaps=new Qn.Map({container:(e==null?void 0:e.container)||"map",center:(e==null?void 0:e.center)||[0,0],zoom:(e==null?void 0:e.zoom)||9,hash:(e==null?void 0:e.hash)||!1,style:(e==null?void 0:e.style)||lE,transformRequest:(o,l)=>{if(this.accessToken)return{url:o,headers:{Authorization:`Bearer ${this.accessToken}`}};{const u=new URL(o);return l!=="Image"&&u.searchParams.append("api_key",this.apiKey),{url:u.toString()}}},...e}),this.mode==="3d"&&this.add3dLayer(),this.addOlaLogo(e),this.addAttribution();const i={};return Object.getOwnPropertyNames(Qn.Map.prototype).forEach(o=>{typeof this.olaMaps[o]=="function"&&(i[o]=this.olaMaps[o].bind(this.olaMaps))}),Object.keys(Xu).forEach(o=>{typeof Xu[o]=="function"?i[o]=(...l)=>new Xu[o](...l):i[o]=Xu[o]}),i}addNavigationControls(e){return new Qn.NavigationControl(e)}addGeolocateControls(e){return new Qn.GeolocateControl(e)}getMercatorCoordinate(){return Qn.MercatorCoordinate}addMarker(e){return new Qn.Marker(e)}addPopup(e){return new Qn.Popup(e)}getStaticMap(e,i){const s=this.fetchStaticMap(e);s==null||s.then(o=>{const l=URL.createObjectURL(o),u=document.createElement("img");u.src=l;const c=document.getElementById(i);c&&!c.querySelector("img")?c==null||c.appendChild(u):console.log("An image already exists in the element.")}).catch(o=>console.error(o))}}typeof window<"u"&&(window.OlaMaps=wA),Hr.OlaMaps=wA,Object.defineProperty(Hr,Symbol.toStringTag,{value:"Module"})});
|
|
2201
|
+
*/var Wr=null;try{Wr=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function li(t,e,i){this.low=t|0,this.high=e|0,this.unsigned=!!i}li.prototype.__isLong__,Object.defineProperty(li.prototype,"__isLong__",{value:!0});function Ls(t){return(t&&t.__isLong__)===!0}function Gw(t){var e=Math.clz32(t&-t);return t?31-e:e}li.isLong=Ls;var Xw={},Ww={};function Va(t,e){var i,s,o;return e?(t>>>=0,(o=0<=t&&t<256)&&(s=Ww[t],s)?s:(i=Yt(t,0,!0),o&&(Ww[t]=i),i)):(t|=0,(o=-128<=t&&t<128)&&(s=Xw[t],s)?s:(i=Yt(t,t<0?-1:0,!1),o&&(Xw[t]=i),i))}li.fromInt=Va;function qr(t,e){if(isNaN(t))return e?lo:yn;if(e){if(t<0)return lo;if(t>=Zw)return eA}else{if(t<=-Kw)return hr;if(t+1>=Kw)return Qw}return t<0?qr(-t,e).neg():Yt(t%sc|0,t/sc|0,e)}li.fromNumber=qr;function Yt(t,e,i){return new li(t,e,i)}li.fromBits=Yt;var gf=Math.pow;function Eg(t,e,i){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(i=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?lo:yn;if(i=i||10,i<2||36<i)throw RangeError("radix");var s;if((s=t.indexOf("-"))>0)throw Error("interior hyphen");if(s===0)return Eg(t.substring(1),e,i).neg();for(var o=qr(gf(i,8)),l=yn,u=0;u<t.length;u+=8){var c=Math.min(8,t.length-u),x=parseInt(t.substring(u,u+c),i);if(c<8){var w=qr(gf(i,c));l=l.mul(w).add(qr(x))}else l=l.mul(o),l=l.add(qr(x))}return l.unsigned=e,l}li.fromString=Eg;function gn(t,e){return typeof t=="number"?qr(t,e):typeof t=="string"?Eg(t,e):Yt(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}li.fromValue=gn;var qw=65536,_z=1<<24,sc=qw*qw,Zw=sc*sc,Kw=Zw/2,Jw=Va(_z),yn=Va(0);li.ZERO=yn;var lo=Va(0,!0);li.UZERO=lo;var rc=Va(1);li.ONE=rc;var Yw=Va(1,!0);li.UONE=Yw;var Sg=Va(-1);li.NEG_ONE=Sg;var Qw=Yt(-1,2147483647,!1);li.MAX_VALUE=Qw;var eA=Yt(-1,-1,!0);li.MAX_UNSIGNED_VALUE=eA;var hr=Yt(0,-2147483648,!1);li.MIN_VALUE=hr;var Ge=li.prototype;Ge.toInt=function(){return this.unsigned?this.low>>>0:this.low},Ge.toNumber=function(){return this.unsigned?(this.high>>>0)*sc+(this.low>>>0):this.high*sc+(this.low>>>0)},Ge.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(hr)){var i=qr(e),s=this.div(i),o=s.mul(i).sub(this);return s.toString(e)+o.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var l=qr(gf(e,6),this.unsigned),u=this,c="";;){var x=u.div(l),w=u.sub(x.mul(l)).toInt()>>>0,C=w.toString(e);if(u=x,u.isZero())return C+c;for(;C.length<6;)C="0"+C;c=""+C+c}},Ge.getHighBits=function(){return this.high},Ge.getHighBitsUnsigned=function(){return this.high>>>0},Ge.getLowBits=function(){return this.low},Ge.getLowBitsUnsigned=function(){return this.low>>>0},Ge.getNumBitsAbs=function(){if(this.isNegative())return this.eq(hr)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,i=31;i>0&&!(e&1<<i);i--);return this.high!=0?i+33:i+1},Ge.isZero=function(){return this.high===0&&this.low===0},Ge.eqz=Ge.isZero,Ge.isNegative=function(){return!this.unsigned&&this.high<0},Ge.isPositive=function(){return this.unsigned||this.high>=0},Ge.isOdd=function(){return(this.low&1)===1},Ge.isEven=function(){return(this.low&1)===0},Ge.equals=function(e){return Ls(e)||(e=gn(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},Ge.eq=Ge.equals,Ge.notEquals=function(e){return!this.eq(e)},Ge.neq=Ge.notEquals,Ge.ne=Ge.notEquals,Ge.lessThan=function(e){return this.comp(e)<0},Ge.lt=Ge.lessThan,Ge.lessThanOrEqual=function(e){return this.comp(e)<=0},Ge.lte=Ge.lessThanOrEqual,Ge.le=Ge.lessThanOrEqual,Ge.greaterThan=function(e){return this.comp(e)>0},Ge.gt=Ge.greaterThan,Ge.greaterThanOrEqual=function(e){return this.comp(e)>=0},Ge.gte=Ge.greaterThanOrEqual,Ge.ge=Ge.greaterThanOrEqual,Ge.compare=function(e){if(Ls(e)||(e=gn(e)),this.eq(e))return 0;var i=this.isNegative(),s=e.isNegative();return i&&!s?-1:!i&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},Ge.comp=Ge.compare,Ge.negate=function(){return!this.unsigned&&this.eq(hr)?hr:this.not().add(rc)},Ge.neg=Ge.negate,Ge.add=function(e){Ls(e)||(e=gn(e));var i=this.high>>>16,s=this.high&65535,o=this.low>>>16,l=this.low&65535,u=e.high>>>16,c=e.high&65535,x=e.low>>>16,w=e.low&65535,C=0,M=0,P=0,j=0;return j+=l+w,P+=j>>>16,j&=65535,P+=o+x,M+=P>>>16,P&=65535,M+=s+c,C+=M>>>16,M&=65535,C+=i+u,C&=65535,Yt(P<<16|j,C<<16|M,this.unsigned)},Ge.subtract=function(e){return Ls(e)||(e=gn(e)),this.add(e.neg())},Ge.sub=Ge.subtract,Ge.multiply=function(e){if(this.isZero())return this;if(Ls(e)||(e=gn(e)),Wr){var i=Wr.mul(this.low,this.high,e.low,e.high);return Yt(i,Wr.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?lo:yn;if(this.eq(hr))return e.isOdd()?hr:yn;if(e.eq(hr))return this.isOdd()?hr:yn;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Jw)&&e.lt(Jw))return qr(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,o=this.high&65535,l=this.low>>>16,u=this.low&65535,c=e.high>>>16,x=e.high&65535,w=e.low>>>16,C=e.low&65535,M=0,P=0,j=0,Y=0;return Y+=u*C,j+=Y>>>16,Y&=65535,j+=l*C,P+=j>>>16,j&=65535,j+=u*w,P+=j>>>16,j&=65535,P+=o*C,M+=P>>>16,P&=65535,P+=l*w,M+=P>>>16,P&=65535,P+=u*x,M+=P>>>16,P&=65535,M+=s*C+o*w+l*x+u*c,M&=65535,Yt(j<<16|Y,M<<16|P,this.unsigned)},Ge.mul=Ge.multiply,Ge.divide=function(e){if(Ls(e)||(e=gn(e)),e.isZero())throw Error("division by zero");if(Wr){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var i=(this.unsigned?Wr.div_u:Wr.div_s)(this.low,this.high,e.low,e.high);return Yt(i,Wr.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?lo:yn;var s,o,l;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return lo;if(e.gt(this.shru(1)))return Yw;l=lo}else{if(this.eq(hr)){if(e.eq(rc)||e.eq(Sg))return hr;if(e.eq(hr))return rc;var u=this.shr(1);return s=u.div(e).shl(1),s.eq(yn)?e.isNegative()?rc:Sg:(o=this.sub(e.mul(s)),l=s.add(o.div(e)),l)}else if(e.eq(hr))return this.unsigned?lo:yn;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();l=yn}for(o=this;o.gte(e);){s=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var c=Math.ceil(Math.log(s)/Math.LN2),x=c<=48?1:gf(2,c-48),w=qr(s),C=w.mul(e);C.isNegative()||C.gt(o);)s-=x,w=qr(s,this.unsigned),C=w.mul(e);w.isZero()&&(w=rc),l=l.add(w),o=o.sub(C)}return l},Ge.div=Ge.divide,Ge.modulo=function(e){if(Ls(e)||(e=gn(e)),Wr){var i=(this.unsigned?Wr.rem_u:Wr.rem_s)(this.low,this.high,e.low,e.high);return Yt(i,Wr.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},Ge.mod=Ge.modulo,Ge.rem=Ge.modulo,Ge.not=function(){return Yt(~this.low,~this.high,this.unsigned)},Ge.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},Ge.clz=Ge.countLeadingZeros,Ge.countTrailingZeros=function(){return this.low?Gw(this.low):Gw(this.high)+32},Ge.ctz=Ge.countTrailingZeros,Ge.and=function(e){return Ls(e)||(e=gn(e)),Yt(this.low&e.low,this.high&e.high,this.unsigned)},Ge.or=function(e){return Ls(e)||(e=gn(e)),Yt(this.low|e.low,this.high|e.high,this.unsigned)},Ge.xor=function(e){return Ls(e)||(e=gn(e)),Yt(this.low^e.low,this.high^e.high,this.unsigned)},Ge.shiftLeft=function(e){return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Yt(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Yt(0,this.low<<e-32,this.unsigned)},Ge.shl=Ge.shiftLeft,Ge.shiftRight=function(e){return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Yt(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Yt(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},Ge.shr=Ge.shiftRight,Ge.shiftRightUnsigned=function(e){return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?Yt(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?Yt(this.high,0,this.unsigned):Yt(this.high>>>e-32,0,this.unsigned)},Ge.shru=Ge.shiftRightUnsigned,Ge.shr_u=Ge.shiftRightUnsigned,Ge.rotateLeft=function(e){var i;return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?Yt(this.high,this.low,this.unsigned):e<32?(i=32-e,Yt(this.low<<e|this.high>>>i,this.high<<e|this.low>>>i,this.unsigned)):(e-=32,i=32-e,Yt(this.high<<e|this.low>>>i,this.low<<e|this.high>>>i,this.unsigned))},Ge.rotl=Ge.rotateLeft,Ge.rotateRight=function(e){var i;return Ls(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?Yt(this.high,this.low,this.unsigned):e<32?(i=32-e,Yt(this.high<<i|this.low>>>e,this.low<<i|this.high>>>e,this.unsigned)):(e-=32,i=32-e,Yt(this.low<<i|this.high>>>e,this.high<<i|this.low>>>e,this.unsigned))},Ge.rotr=Ge.rotateRight,Ge.toSigned=function(){return this.unsigned?Yt(this.low,this.high,!1):this},Ge.toUnsigned=function(){return this.unsigned?this:Yt(this.low,this.high,!0)},Ge.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},Ge.toBytesLE=function(){var e=this.high,i=this.low;return[i&255,i>>>8&255,i>>>16&255,i>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},Ge.toBytesBE=function(){var e=this.high,i=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,i>>>24,i>>>16&255,i>>>8&255,i&255]},li.fromBytes=function(e,i,s){return s?li.fromBytesLE(e,i):li.fromBytesBE(e,i)},li.fromBytesLE=function(e,i){return new li(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,i)},li.fromBytesBE=function(e,i){return new li(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],i)};const mz=16;function tA(t){t==="X"&&(t="");const e=t.padEnd(mz,"0");return li.fromString(e,!0,16)}function gz(t){if(t.isZero())return"X";let e=t.countTrailingZeros();const i=e%4;e=(e-i)/4;const s=e;e*=4;const l=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-s-l.length).join("0")+l}function yz(t,e){const i=bz(t).shiftRightUnsigned(2);return t.add(li.fromNumber(2*e+1-4).multiply(i))}function bz(t){return t.and(t.not().add(1))}const vz=3,xz=2*30+1,iA=180/Math.PI;function wz(t){if(t.length===0)throw new Error(`Invalid Hilbert quad key ${t}`);const e=t.split("/"),i=parseInt(e[0],10),s=e[1],o=s.length;let l=0;const u=[0,0];for(let c=o-1;c>=0;c--){l=o-c;const x=s[c];let w=0,C=0;x==="1"?C=1:x==="2"?(w=1,C=1):x==="3"&&(w=1);const M=Math.pow(2,l-1);Tz(M,u,w,C),u[0]+=M*w,u[1]+=M*C}if(i%2===1){const c=u[0];u[0]=u[1],u[1]=c}return{face:i,ij:u,level:l}}function Az(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<vz+xz;)e="0"+e;const i=e.lastIndexOf("1"),s=e.substring(0,3),o=e.substring(3,i),l=o.length/2,u=li.fromString(s,!0,2).toString(10);let c="";if(l!==0)for(c=li.fromString(o,!0,2).toString(4);c.length<l;)c="0"+c;return`${u}/${c}`}function sA(t,e,i){const s=1<<e;return[(t[0]+i[0])/s,(t[1]+i[1])/s]}function rA(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function nA(t){return[rA(t[0]),rA(t[1])]}function oA(t,[e,i]){switch(t){case 0:return[1,e,i];case 1:return[-e,1,i];case 2:return[-e,-i,1];case 3:return[-1,-i,-e];case 4:return[i,-1,-e];case 5:return[i,e,-1];default:throw new Error("Invalid face")}}function aA([t,e,i]){const s=Math.atan2(i,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*iA,s*iA]}function Tz(t,e,i,s){if(s===0){i===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const o=e[0];e[0]=e[1],e[1]=o}}function Ez(t){const e=sA(t.ij,t.level,[.5,.5]),i=nA(e),s=oA(t.face,i);return aA(s)}const Sz=100;function lA(t){const{face:e,ij:i,level:s}=t,o=[[0,0],[0,1],[1,1],[1,0],[0,0]],l=Math.max(1,Math.ceil(Sz*Math.pow(2,-s))),u=new Float64Array(4*l*2+2);let c=0,x=0;for(let w=0;w<4;w++){const C=o[w].slice(0),M=o[w+1],P=(M[0]-C[0])/l,j=(M[1]-C[1])/l;for(let Y=0;Y<l;Y++){C[0]+=P,C[1]+=j;const Q=sA(i,s,C),_e=nA(Q),me=oA(e,_e),we=aA(me);Math.abs(we[1])>89.999&&(we[0]=x);const Ee=we[0]-x;we[0]+=Ee>180?-360:Ee<-180?360:0,u[c++]=we[0],u[c++]=we[1],x=we[0]}}return u[c++]=u[0],u[c++]=u[1],u}function Cg(t){const e=Cz(t);return wz(e)}function Cz(t){if(t.indexOf("/")>0)return t;const e=tA(t);return Az(e)}function Iz(t){const e=Cg(t);return Ez(e)}function Rz(t){let e;if(t.face===2||t.face===5){let i=null,s=0;for(let o=0;o<4;o++){const l=`${t.face}/${o}`,u=Cg(l),c=lA(u);(typeof i>"u"||i===null)&&(i=new Float64Array(4*c.length)),i.set(c,s),s+=c.length}e=cA(i)}else{const i=lA(t);e=cA(i)}return e}function cA(t){if(t.length%2!==0)throw new Error("Invalid corners");const e=[],i=[];for(let s=0;s<t.length;s+=2)e.push(t[s]),i.push(t[s+1]);return e.sort((s,o)=>s-o),i.sort((s,o)=>s-o),{west:e[0],east:e[e.length-1],north:i[i.length-1],south:i[0]}}function Mz(t,e){const i=(e==null?void 0:e.minimumHeight)||0,s=(e==null?void 0:e.maximumHeight)||0,o=Cg(t),l=Rz(o),u=l.west,c=l.south,x=l.east,w=l.north,C=[];return C.push(new Se(u,w,i)),C.push(new Se(x,w,i)),C.push(new Se(x,c,i)),C.push(new Se(u,c,i)),C.push(new Se(u,w,s)),C.push(new Se(x,w,s)),C.push(new Se(x,c,s)),C.push(new Se(u,c,s)),C}function hA(t){const e=t.token,i={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},s=Mz(e,i),o=Iz(e),l=o[0],u=o[1],c=wi.WGS84.cartographicToCartesian([l,u,i.maximumHeight]),x=new Se(c[0],c[1],c[2]);s.push(x);const w=Ck(s);return[...w.center,...w.halfAxes]}const Pz={QUADTREE:4,OCTREE:8};function Bz(t,e,i){if(t!=null&&t.box){const s=tA(t.s2VolumeInfo.token),o=yz(s,e),l=gz(o),u={...t.s2VolumeInfo};switch(u.token=l,i){case"OCTREE":const w=t.s2VolumeInfo,C=w.maximumHeight-w.minimumHeight,M=C/2,P=w.minimumHeight+C/2;w.minimumHeight=P-M,w.maximumHeight=P+M;break}return{box:hA(u),s2VolumeInfo:u}}}async function uA(t){const{subtree:e,subtreeData:i={level:0,x:0,y:0,z:0},parentData:s={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:o=0,implicitOptions:l,loaderOptions:u,s2VolumeBox:c}=t,{subdivisionScheme:x,subtreeLevels:w,maximumLevel:C,contentUrlTemplate:M,subtreesUriTemplate:P,basePath:j}=l,Y={children:[],lodMetricValue:0,contentUrl:""};if(!C)return n0.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${M} won't be loaded...`),Y;const Q=s.localLevel+1,_e=i.level+Q;if(_e>C)return Y;const me=Pz[x],we=Math.log2(me),Ee=o&1,Oe=o>>1&1,Ne=o>>2&1,ze=Ha(s.localX,Ee,1),nt=Ha(s.localY,Oe,1),mt=Ha(s.localZ,Ne,1),We=Ha(i.x,ze,Q),at=Ha(i.y,nt,Q),it=Ha(i.z,mt,Q),Ut=Ha(s.mortonIndex,o,we),Rt=Q===w&&Ig(e.childSubtreeAvailability,Ut);let yt,_i,Us,$i;if(Rt){const Gi=`${j}/${P}`,Ui=Rg(Gi,_e,We,at,it);yt=await Ro(Ui,$w,u),$i=0,_i={level:_e,x:We,y:at,z:it},Us={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else yt=e,$i=(me**Q-1)/(me-1)+Ut,_i=i,Us={mortonIndex:Ut,localLevel:Q,localX:ze,localY:nt,localZ:mt};if(!Ig(yt.tileAvailability,$i))return Y;Ig(yt.contentAvailability,$i)&&(Y.contentUrl=Rg(M,_e,We,at,it));for(let Gi=0;Gi<me;Gi++){const Ui=Bz(c,Gi,x),Bi=await uA({subtree:yt,subtreeData:_i,parentData:Us,childIndex:Gi,implicitOptions:l,loaderOptions:u,s2VolumeBox:Ui});(Bi.contentUrl||Bi.children.length)&&Y.children.push(Bi)}return Y.contentUrl||Y.children.length?Dz(Y,{level:_e,x:We,y:at,z:it},l,c):Y}function Ig(t,e){let i;return Array.isArray(t)?(i=t[0],t.length>1&&n0.once('Not supported extension "3DTILES_multiple_contents" has been detected')):i=t,"constant"in i?!!i.constant:i.explicitBitstream?kz(e,i.explicitBitstream):!1}function Dz(t,e,i,s){const{basePath:o,refine:l,getRefine:u,lodMetricType:c,getTileType:x,rootLodMetricValue:w,rootBoundingVolume:C}=i,M=t.contentUrl&&t.contentUrl.replace(`${o}/`,""),P=w/2**e.level,j=s!=null&&s.box?{box:s.box}:C,Y=Oz(j,e,i.subdivisionScheme);return{children:t.children,contentUrl:t.contentUrl,content:{uri:M},id:t.contentUrl,refine:u(l),type:x(t),lodMetricType:c,lodMetricValue:P,geometricError:P,transform:t.transform,boundingVolume:Y}}function Oz(t,e,i){if(t.region){const{level:s,x:o,y:l,z:u}=e,[c,x,w,C,M,P]=t.region,j=2**s,Y=(w-c)/j,[Q,_e]=[c+Y*o,c+Y*(o+1)],me=(C-x)/j,[we,Ee]=[x+me*l,x+me*(l+1)];let Oe,Ne;if(i==="OCTREE"){const ze=(P-M)/j;[Oe,Ne]=[M+ze*u,M+ze*(u+1)]}else[Oe,Ne]=[M,P];return{region:[Q,we,_e,Ee,Oe,Ne]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function Ha(t,e,i){return(t<<i)+e}function Rg(t,e,i,s,o){const l=Fz({level:e,x:i,y:s,z:o});return t.replace(/{level}|{x}|{y}|{z}/gi,u=>l[u])}function Fz(t){const e={};for(const i in t)e[`{${i}}`]=t[i];return e}function kz(t,e){const i=Math.floor(t/8),s=t%8;return(e[i]>>s&1)===1}function Mg(t,e=""){if(!e)return ao.EMPTY;const s=e.split("?")[0].split(".").pop();switch(s){case"pnts":return ao.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ao.SCENEGRAPH;default:return s||ao.EMPTY}}function Pg(t){switch(t){case"REPLACE":case"replace":return mn.REPLACE;case"ADD":case"add":return mn.ADD;default:return t}}function Bg(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){const s=new URL(t,`${e}/`);return decodeURI(s.toString())}else if(t.startsWith("/"))return t;return dS(e,t)}function dA(t,e){var o;if(!t)return null;let i;if(t.content){const l=t.content.uri||((o=t.content)==null?void 0:o.url);typeof l<"u"&&(i=Bg(l,e))}return{...t,id:i,contentUrl:i,lodMetricType:tc.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Mg(t,i),refine:Pg(t.refine)}}async function Nz(t,e,i){let s=null;const o=pA(t.root);o&&t.root?s=await fA(t.root,t,e,o,i):s=dA(t.root,e);const l=[];for(l.push(s);l.length>0;){const u=l.pop()||{},c=u.children||[],x=[];for(const w of c){const C=pA(w);let M;C?M=await fA(w,t,e,C,i):M=dA(w,e),M&&(x.push(M),l.push(M))}u.children=x}return s}async function fA(t,e,i,s,o){var Oe,Ne,ze;const{subdivisionScheme:l,maximumLevel:u,availableLevels:c,subtreeLevels:x,subtrees:{uri:w}}=s,C=Rg(w,0,0,0,0),M=Bg(C,i),P=await Ro(M,$w,o),j=(Oe=t.content)==null?void 0:Oe.uri,Y=j?Bg(j,i):"",Q=(Ne=e==null?void 0:e.root)==null?void 0:Ne.refine,_e=t.geometricError,me=(ze=t.boundingVolume.extensions)==null?void 0:ze["3DTILES_bounding_volume_S2"];if(me){const mt={box:hA(me),s2VolumeInfo:me};t.boundingVolume=mt}const we=t.boundingVolume,Ee={contentUrlTemplate:Y,subtreesUriTemplate:w,subdivisionScheme:l,subtreeLevels:x,maximumLevel:Number.isFinite(c)?c-1:u,refine:Q,basePath:i,lodMetricType:tc.GEOMETRIC_ERROR,rootLodMetricValue:_e,rootBoundingVolume:we,getTileType:Mg,getRefine:Pg};return await Lz(t,i,P,Ee,o)}async function Lz(t,e,i,s,o){if(!t)return null;const{children:l,contentUrl:u}=await uA({subtree:i,implicitOptions:s,loaderOptions:o});let c,x=null;return u&&(c=u,x={uri:u.replace(`${e}/`,"")}),{...t,id:c,contentUrl:c,lodMetricType:tc.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:Mg(t,c),refine:Pg(t.refine),content:x||t.content,children:l}}function pA(t){var e;return((e=t==null?void 0:t.extensions)==null?void 0:e["3DTILES_implicit_tiling"])||(t==null?void 0:t.implicitTiling)}const _A={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Pw,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:Uz,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Uz(t,e={},i){const s=e["3d-tiles"]||{};let o;return s.isTileset==="auto"?o=(i==null?void 0:i.url)&&i.url.indexOf(".json")!==-1:o=s.isTileset,o?zz(t,e,i):Vz(t,e,i)}async function zz(t,e,i){var x;const s=JSON.parse(new TextDecoder().decode(t)),o=(i==null?void 0:i.url)||"",l=Hz(o),u=await Nz(s,l,e||{});return{...s,shape:"tileset3d",loader:_A,url:o,queryString:(i==null?void 0:i.queryString)||"",basePath:l,root:u||s.root,type:lr.TILES3D,lodMetricType:tc.GEOMETRIC_ERROR,lodMetricValue:((x=s.root)==null?void 0:x.geometricError)||0}}async function Vz(t,e,i){const s={content:{shape:"tile3d",featureIds:null}};return await Hw(t,0,e,i,s.content),s.content}function Hz(t){return jp(t)}const mA=[0],jz={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:_A,onTilesetLoad:{type:"function",value:t=>{}},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:(t,e,i)=>{}},_getMeshColor:{type:"function",value:t=>[255,255,255]}};class Dg extends l1{initializeState(){"onTileLoadFail"in this.props&&Jt.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){var e,i;return!!((i=(e=this.state)==null?void 0:e.tileset3d)!=null&&i.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({props:e,oldProps:i,changeFlags:s}){if(e.data&&e.data!==i.data&&this._loadTileset(e.data),s.viewportChanged){const{activeViewports:o}=this.state;Object.keys(o).length&&(this._updateTileset(o),this.state.lastUpdatedViewports=o,this.state.activeViewports={})}if(s.propsChanged){const{layerMap:o}=this.state;for(const l in o)o[l].needsUpdate=!0}}activateViewport(e){const{activeViewports:i,lastUpdatedViewports:s}=this.state;this.internalState.viewport=e,i[e.id]=e;const o=s==null?void 0:s[e.id];(!o||!e.equals(o))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:e,sourceLayer:i}){const s=i&&i.props.tile;return e.picked&&(e.object=s),e.sourceTile=s,e}filterSubLayer({layer:e,viewport:i}){const{tile:s}=e.props,{id:o}=i;return s.selected&&s.viewportIds.includes(o)}_updateAutoHighlight(e){const i=e.sourceTile,s=this.state.layerMap[i==null?void 0:i.id];s&&s.layer&&s.layer.updateAutoHighlight(e)}async _loadTileset(e){const{loadOptions:i={}}=this.props,s=this.props.loader||this.props.loaders,o=Array.isArray(s)?s[0]:s,l={loadOptions:{...i}};let u=e;if(o.preload){const w=await o.preload(e,i);w.url&&(u=w.url),w.headers&&(l.loadOptions.fetch={...l.loadOptions.fetch,headers:w.headers}),Object.assign(l,w)}const c=await Ro(u,o,l.loadOptions),x=new S6(c,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...l});this.setState({tileset3d:x,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(x)}_onTileLoad(e){const{lastUpdatedViewports:i}=this.state;this.props.onTileLoad(e),this._updateTileset(i),this.setNeedsUpdate()}_onTileUnload(e){delete this.state.layerMap[e.id],this.props.onTileUnload(e)}_updateTileset(e){if(!e)return;const{tileset3d:i}=this.state,{timeline:s}=this.context,o=Object.keys(e).length;!s||!o||!i||i.selectTiles(Object.values(e)).then(l=>{this.state.frameNumber!==l&&this.setState({frameNumber:l})})}_getSubLayer(e,i){if(!e.content)return null;switch(e.type){case ao.POINTCLOUD:return this._makePointCloudLayer(e,i);case ao.SCENEGRAPH:return this._make3DModelLayer(e);case ao.MESH:return this._makeSimpleMeshLayer(e,i);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${e.content.type}`)}}_makePointCloudLayer(e,i){const{attributes:s,pointCount:o,constantRGBA:l,cartographicOrigin:u,modelMatrix:c}=e.content,{positions:x,normals:w,colors:C}=s;if(!x)return null;const M=i&&i.props.data||{header:{vertexCount:o},attributes:{POSITION:x,NORMAL:w,COLOR_0:C}},{pointSize:P,getPointColor:j}=this.props,Y=this.getSubLayerClass("pointcloud",Fm);return new Y({pointSize:P},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${e.id}`,tile:e,data:M,coordinateSystem:Wt.METER_OFFSETS,coordinateOrigin:u,modelMatrix:c,getColor:l||j,_offset:0})}_make3DModelLayer(e){const{gltf:i,instances:s,cartographicOrigin:o,modelMatrix:l}=e.content,u=this.getSubLayerClass("scenegraph",rg);return new u({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${e.id}`,tile:e,data:s||mA,scenegraph:i,coordinateSystem:Wt.METER_OFFSETS,coordinateOrigin:o,modelMatrix:l,getTransformMatrix:c=>c.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(e,i){const s=e.content,{attributes:o,indices:l,modelMatrix:u,cartographicOrigin:c,coordinateSystem:x=Wt.METER_OFFSETS,material:w,featureIds:C}=s,{_getMeshColor:M}=this.props,P=i&&i.props.mesh||new Fl({topology:"triangle-list",attributes:$z(o),indices:l}),j=this.getSubLayerClass("mesh",ng);return new j(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${e.id}`,tile:e,mesh:P,data:mA,getColor:M(e),pbrMaterial:w,modelMatrix:u,coordinateOrigin:c,coordinateSystem:x,featureIds:C,_offset:0})}renderLayers(){const{tileset3d:e,layerMap:i}=this.state;return e?e.tiles.map(s=>{const o=i[s.id]=i[s.id]||{tile:s};let{layer:l}=o;return s.selected&&(l?o.needsUpdate&&(l=this._getSubLayer(s,l),o.needsUpdate=!1):l=this._getSubLayer(s)),o.layer=l,l}).filter(Boolean):null}}Dg.defaultProps=jz,Dg.layerName="Tile3DLayer";function $z(t){const e={};return e.positions={...t.positions,value:new Float32Array(t.positions.value)},t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}const Og=512,Gz=Math.PI/180;function gA({map:t,gl:e,deck:i}){if(t.__deck)return t.__deck;const s=i==null?void 0:i.props._customRender,o=i==null?void 0:i.props.onLoad,l=vA({...i==null?void 0:i.props,_customRender:()=>{t.triggerRepaint(),s==null||s("")}});let u;return(!i||i.props.gl===e)&&(Object.assign(l,{gl:e,width:null,height:null,touchAction:"unset",viewState:Vh(t)}),i!=null&&i.isInitialized?yA(i,t):l.onLoad=()=>{o==null||o(),yA(u,t)}),i?(u=i,i.setProps(l),i.userData.isExternal=!0):(u=new Rh(l),t.on("remove",()=>{bA(t)})),u.userData.mapboxLayers=new Set,t.__deck=u,t.on("render",()=>{u.isInitialized&&Jz(u,t)}),u}function yA(t,e){const i=()=>{t.isInitialized?Yz(t,e):e.off("move",i)};e.on("move",i)}function bA(t){var e;(e=t.__deck)==null||e.finalize(),t.__deck=null}function vA(t){return{...t,parameters:{depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthFunc:515,blendEquation:32774,...t.parameters},views:t.views||[new om({id:"mapbox"})]}}function Xz(t,e){t.userData.mapboxLayers.add(e),Fg(t)}function Wz(t,e){t.userData.mapboxLayers.delete(e),Fg(t)}function qz(t,e){Fg(t)}function Zz(t,e,i){let{currentViewport:s}=t.userData,o=!1;s||(s=xA(t,e,!0),t.userData.currentViewport=s,o=!0),t.isInitialized&&t._drawLayers("mapbox-repaint",{viewports:[s],layerFilter:({layer:l})=>i.id===l.id||l.props.operation.includes("terrain"),clearStack:o,clearCanvas:!1})}function Vh(t){var o;const{lng:e,lat:i}=t.getCenter(),s={longitude:(e+540)%360-180,latitude:i,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:t.getPadding(),repeat:t.getRenderWorldCopies()};return(o=t.getTerrain)!=null&&o.call(t)&&Kz(t,s),s}function Kz(t,e){if(t.getFreeCameraOptions){const{position:i}=t.getFreeCameraOptions();if(!i||i.z===void 0)return;const s=t.transform.height,{longitude:o,latitude:l,pitch:u}=e,c=i.x*Og,x=(1-i.y)*Og,w=i.z*Og,C=dh([o,l]),M=c-C[0],P=x-C[1],j=Math.sqrt(M*M+P*P),Y=u*Gz,Q=1.5*s,_e=Y<.001?Q*Math.cos(Y)/w:Q*Math.sin(Y)/j;e.zoom=Math.log2(_e);const me=Q*Math.cos(Y)/_e,we=w-me;e.position=[0,0,we/Id(l)]}else typeof t.transform.elevation=="number"&&(e.position=[0,0,t.transform.elevation])}function xA(t,e,i=!0){return new Ba({id:"mapbox",x:0,y:0,width:t.width,height:t.height,...Vh(e),nearZMultiplier:i?.02:.1,nearZ:e.transform._nearZ/e.transform.height,farZ:e.transform._farZ/e.transform.height})}function Jz(t,e){const{mapboxLayers:i,isExternal:s}=t.userData;if(s){const o=Array.from(i,C=>C.id),u=Ul(t.props.layers,Boolean).some(C=>C&&!o.includes(C.id));let c=t.getViewports();const x=c.findIndex(C=>C.id==="mapbox"),w=c.length>1||x<0;(u||w)&&(x>=0&&(c=c.slice(),c[x]=xA(t,e,!1)),t._drawLayers("mapbox-repaint",{viewports:c,layerFilter:C=>(!t.props.layerFilter||t.props.layerFilter(C))&&(C.viewport.id!=="mapbox"||!o.includes(C.layer.id)),clearCanvas:!1}))}t.userData.currentViewport=null}function Yz(t,e){t.setProps({viewState:Vh(e)}),t.needsRedraw({clearRedrawFlags:!0})}function Fg(t){if(t.userData.isExternal)return;const e=[];t.userData.mapboxLayers.forEach(i=>{const s=i.props.type,o=new s(i.props);e.push(o)}),t.setProps({layers:e})}class Qz{constructor(e){if(!e.id)throw new Error("Layer must have an unique id");this.id=e.id,this.type="custom",this.renderingMode=e.renderingMode||"3d",this.map=null,this.deck=null,this.props=e}onAdd(e,i){this.map=e,this.deck=gA({map:e,gl:i,deck:this.props.deck}),Xz(this.deck,this)}onRemove(){this.deck&&Wz(this.deck,this)}setProps(e){Object.assign(this.props,e,{id:this.id}),this.deck&&qz(this.deck)}render(){Zz(this.deck,this.map,this)}}const kg="__UNDEFINED__";function yf(t,e,i,s){if(!t||!e||!t.style||!t.style._loaded)return;const o=Ul(s,Boolean);if(i!==s){const c=Ul(i,Boolean),x=new Set(c.map(w=>w.id));for(const w of o)x.delete(w.id);for(const w of x)t.getLayer(w)&&t.removeLayer(w)}for(const c of o){const x=t.getLayer(c.id);x?(x.implementation||x).setProps(c.props):t.addLayer(new Qz({id:c.id,deck:e}),c.props.beforeId)}const l=t.style._order,u={};for(const c of o){let{beforeId:x}=c.props;(!x||!l.includes(x))&&(x=kg),u[x]=u[x]||[],u[x].push(c.id)}for(const c in u){const x=u[c];let w=c===kg?l.length:l.indexOf(c),C=c===kg?void 0:c;for(let M=x.length-1;M>=0;M--){const P=x[M],j=l.indexOf(P);j!==w-1&&(t.moveLayer(P,C),j>w&&w++),w--,C=P}}}class e5{constructor(e){this._handleStyleChange=()=>{yf(this._map,this._deck,this._props.layers,this._props.layers)},this._updateContainerSize=()=>{if(this._map&&this._container){const{clientWidth:o,clientHeight:l}=this._map.getContainer();Object.assign(this._container.style,{width:`${o}px`,height:`${l}px`})}},this._updateViewState=()=>{const o=this._deck;o&&(o.setProps({viewState:Vh(this._map)}),o.isInitialized&&o.redraw())},this._handleMouseEvent=o=>{const l=this._deck;if(!l||!l.isInitialized)return;const u={type:o.type,offsetCenter:o.point,srcEvent:o},c=this._lastMouseDownPoint;switch(!o.point&&c&&(u.deltaX=o.originalEvent.clientX-c.clientX,u.deltaY=o.originalEvent.clientY-c.clientY,u.offsetCenter={x:c.x+u.deltaX,y:c.y+u.deltaY}),u.type){case"mousedown":l._onPointerDown(u),this._lastMouseDownPoint={...o.point,clientX:o.originalEvent.clientX,clientY:o.originalEvent.clientY};break;case"dragstart":u.type="panstart",l._onEvent(u);break;case"drag":u.type="panmove",l._onEvent(u);break;case"dragend":u.type="panend",l._onEvent(u);break;case"click":u.tapCount=1,l._onEvent(u);break;case"dblclick":u.type="click",u.tapCount=2,l._onEvent(u);break;case"mousemove":u.type="pointermove",l._onPointerMove(u);break;case"mouseout":u.type="pointerleave",l._onPointerMove(u);break;default:return}};const{interleaved:i=!1,...s}=e;this._interleaved=i,this._props=s}setProps(e){this._interleaved&&e.layers&&yf(this._map,this._deck,this._props.layers,e.layers),Object.assign(this._props,e),this._deck&&this._deck.setProps(this._interleaved?vA(this._props):this._props)}onAdd(e){return this._map=e,this._interleaved?this._onAddInterleaved(e):this._onAddOverlaid(e)}_onAddOverlaid(e){const i=document.createElement("div");return Object.assign(i.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=i,this._deck=new Rh({...this._props,parent:i,viewState:Vh(e)}),e.on("resize",this._updateContainerSize),e.on("render",this._updateViewState),e.on("mousedown",this._handleMouseEvent),e.on("dragstart",this._handleMouseEvent),e.on("drag",this._handleMouseEvent),e.on("dragend",this._handleMouseEvent),e.on("mousemove",this._handleMouseEvent),e.on("mouseout",this._handleMouseEvent),e.on("click",this._handleMouseEvent),e.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),i}_onAddInterleaved(e){const i=e.painter.context.gl;return i instanceof WebGLRenderingContext&&Jt.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=gA({map:e,gl:i,deck:new Rh({...this._props,gl:i})}),e.on("styledata",this._handleStyleChange),yf(e,this._deck,[],this._props.layers),document.createElement("div")}onRemove(){const e=this._map;e&&(this._interleaved?this._onRemoveInterleaved(e):this._onRemoveOverlaid(e)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(e){var i;e.off("resize",this._updateContainerSize),e.off("render",this._updateViewState),e.off("mousedown",this._handleMouseEvent),e.off("dragstart",this._handleMouseEvent),e.off("drag",this._handleMouseEvent),e.off("dragend",this._handleMouseEvent),e.off("mousemove",this._handleMouseEvent),e.off("mouseout",this._handleMouseEvent),e.off("click",this._handleMouseEvent),e.off("dblclick",this._handleMouseEvent),(i=this._deck)==null||i.finalize()}_onRemoveInterleaved(e){e.off("styledata",this._handleStyleChange),yf(e,this._deck,this._props.layers,[]),bA(e)}getDefaultPosition(){return"top-left"}pickObject(e){return os(this._deck),this._deck.pickObject(e)}pickMultipleObjects(e){return os(this._deck),this._deck.pickMultipleObjects(e)}pickObjects(e){return os(this._deck),this._deck.pickObjects(e)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}}class wA{constructor({apiKey:e,accessToken:i="",mode:s="2d",threedTileset:o=cE}){O(this,"olaMaps");O(this,"apiKey");O(this,"accessToken");O(this,"mode");O(this,"threedTileset");this.apiKey=e,this.mode=s,this.threedTileset=o,this.accessToken=i}addOlaLogo(e){var o;if(typeof window>"u")return;const i=document.getElementsByClassName("maplibregl-ctrl-bottom-left");let s="#000";(o=e.style)!=null&&o.includes("dark")&&(s="#FFF");for(let l=0;l<i.length;l++){const u=document.createElement("div");u.style.position="absolute",u.style.bottom="4px",u.style.left="10px",u.style.zIndex="1000",u.innerHTML=hE(s),i[l].appendChild(u)}}addAttribution(){const e=document.querySelectorAll(".maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib-inner");e==null||e.forEach(i=>{const s=i.querySelector("a");s&&(s.style.display="none");const o="ola-maps-link";if(!i.querySelector(`#${o}`)){const u=document.createElement("a");u.id=o,u.href="https://maps.olakrutrim.com/",u.target="_blank",u.textContent="Ola Maps ",i.appendChild(u)}const l="osm-link";if(!i.querySelector(`#${l}`)){const u=document.createElement("a");u.id=l,u.href="https://www.openstreetmap.org/copyright",u.target="_blank",u.textContent="| © OpenStreetMap contributors",i.appendChild(u)}})}fetchStaticMap(e){try{return fetch(e).then(i=>i.blob())}catch(i){console.log(i)}}async add3dLayer(){if(!this.threedTileset)throw new Error("3d Tileset is not initialized");const e=new Dg({id:"tile-3d-layer",data:`${this.threedTileset}?api_key=${this.apiKey}`,beforeId:"poi_railway"}),i=new e5({interleaved:!0,layers:[e]});i&&this.olaMaps.on("style.load",()=>{this.olaMaps.setFilter("building-3d",["all",["!has","hide_3d"],["!=","render_as_3d",!0]]),this.olaMaps.addControl(i)})}init(e){this.olaMaps=new Qn.Map({container:(e==null?void 0:e.container)||"map",center:(e==null?void 0:e.center)||[0,0],zoom:(e==null?void 0:e.zoom)||9,hash:(e==null?void 0:e.hash)||!1,style:(e==null?void 0:e.style)||lE,transformRequest:(o,l)=>{if(this.accessToken)return{url:o,headers:{Authorization:`Bearer ${this.accessToken}`}};{const u=new URL(o);return l!=="Image"&&u.searchParams.append("api_key",this.apiKey),{url:u.toString()}}},...e}),this.mode==="3d"&&this.add3dLayer(),this.addOlaLogo(e),this.addAttribution();const i={};return Object.getOwnPropertyNames(Qn.Map.prototype).forEach(o=>{typeof this.olaMaps[o]=="function"&&(i[o]=this.olaMaps[o].bind(this.olaMaps))}),Object.keys(Xu).forEach(o=>{typeof Xu[o]=="function"?i[o]=(...l)=>new Xu[o](...l):i[o]=Xu[o]}),Object.getOwnPropertyNames(this.olaMaps).forEach(o=>{o in i||(i[o]=this.olaMaps[o])}),Object.assign(this.olaMaps,i)}addNavigationControls(e){return new Qn.NavigationControl(e)}addGeolocateControls(e){return new Qn.GeolocateControl(e)}getMercatorCoordinate(){return Qn.MercatorCoordinate}addMarker(e){return new Qn.Marker(e)}addPopup(e){return new Qn.Popup(e)}getStaticMap(e,i){const s=this.fetchStaticMap(e);s==null||s.then(o=>{const l=URL.createObjectURL(o),u=document.createElement("img");u.src=l;const c=document.getElementById(i);c&&!c.querySelector("img")?c==null||c.appendChild(u):console.log("An image already exists in the element.")}).catch(o=>console.error(o))}}typeof window<"u"&&(window.OlaMaps=wA),Hr.OlaMaps=wA,Object.defineProperty(Hr,Symbol.toStringTag,{value:"Module"})});
|