@mappedin/mappedin-js 6.17.0 → 6.18.0

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.
@@ -0,0 +1 @@
1
+ import{a as ks}from"./chunk-X2XAL5AL.js";import{$ as Sh,C as Ph,D as $f,Ma as Hf,Na as Kf,O as Na,Oa as Jf,P as Th,Pa as Qf,Q as Ve,Ua as em,Y as on,_ as rr,a as A,aa as zt,b as j,ba as fi,d as bh,da as sn,e as Gf,f as wh,ha as Mr,i as Fa,ia as Yf,ob as As,r as Xf,ta as Zf,u as qf,za as Wf}from"./chunk-KNYR4VGD.js";import{a as nt,b as ri,c as Nf,e as Vf,g as jf,h as P,i as B,j as he,k as ie,l as Oa,m as Uf}from"./chunk-FQILVVN4.js";var Yb=Vf((ts,Ca)=>{A();var w5=200,Ib="__lodash_hash_undefined__",P5=800,T5=16,Eb=9007199254740991,Ab="[object Arguments]",S5="[object Array]",C5="[object AsyncFunction]",M5="[object Boolean]",I5="[object Date]",E5="[object Error]",kb="[object Function]",A5="[object GeneratorFunction]",k5="[object Map]",D5="[object Number]",L5="[object Null]",Db="[object Object]",R5="[object Proxy]",z5="[object RegExp]",B5="[object Set]",O5="[object String]",F5="[object Undefined]",N5="[object WeakMap]",V5="[object ArrayBuffer]",j5="[object DataView]",U5="[object Float32Array]",G5="[object Float64Array]",X5="[object Int8Array]",q5="[object Int16Array]",$5="[object Int32Array]",Y5="[object Uint8Array]",Z5="[object Uint8ClampedArray]",W5="[object Uint16Array]",H5="[object Uint32Array]",K5=/[\\^$.*+?()[\]{}|]/g,J5=/^\[object .+?Constructor\]$/,Q5=/^(?:0|[1-9]\d*)$/,We={};We[U5]=We[G5]=We[X5]=We[q5]=We[$5]=We[Y5]=We[Z5]=We[W5]=We[H5]=!0;We[Ab]=We[S5]=We[V5]=We[M5]=We[j5]=We[I5]=We[E5]=We[kb]=We[k5]=We[D5]=We[Db]=We[z5]=We[B5]=We[O5]=We[N5]=!1;var Lb=typeof global=="object"&&global&&global.Object===Object&&global,e4=typeof self=="object"&&self&&self.Object===Object&&self,ns=Lb||e4||Function("return this")(),Rb=typeof ts=="object"&&ts&&!ts.nodeType&&ts,is=Rb&&typeof Ca=="object"&&Ca&&!Ca.nodeType&&Ca,zb=is&&is.exports===Rb,Yd=zb&&Lb.process,xb=(function(){try{var e=is&&is.require&&is.require("util").types;return e||Yd&&Yd.binding&&Yd.binding("util")}catch(t){}})(),vb=xb&&xb.isTypedArray;function t4(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}function i4(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}function r4(e){return function(t){return e(t)}}function n4(e,t){return e==null?void 0:e[t]}function a4(e,t){return function(i){return e(t(i))}}var o4=Array.prototype,s4=Function.prototype,ju=Object.prototype,Zd=ns["__core-js_shared__"],Uu=s4.toString,gr=ju.hasOwnProperty,bb=(function(){var e=/[^.]+$/.exec(Zd&&Zd.keys&&Zd.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),Bb=ju.toString,l4=Uu.call(Object),u4=RegExp("^"+Uu.call(gr).replace(K5,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Nu=zb?ns.Buffer:void 0,wb=ns.Symbol,Pb=ns.Uint8Array,Tb=Nu?Nu.allocUnsafe:void 0,Ob=a4(Object.getPrototypeOf,Object),Sb=Object.create,h4=ju.propertyIsEnumerable,c4=o4.splice,In=wb?wb.toStringTag:void 0,Vu=(function(){try{var e=ef(Object,"defineProperty");return e({},"",{}),e}catch(t){}})(),p4=Nu?Nu.isBuffer:void 0,Cb=Math.max,d4=Date.now,Fb=ef(ns,"Map"),rs=ef(Object,"create"),f4=(function(){function e(){}return function(t){if(!An(t))return{};if(Sb)return Sb(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}})();function En(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function m4(){this.__data__=rs?rs(null):{},this.size=0}function y4(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function g4(e){var t=this.__data__;if(rs){var i=t[e];return i===Ib?void 0:i}return gr.call(t,e)?t[e]:void 0}function _4(e){var t=this.__data__;return rs?t[e]!==void 0:gr.call(t,e)}function x4(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=rs&&t===void 0?Ib:t,this}En.prototype.clear=m4;En.prototype.delete=y4;En.prototype.get=g4;En.prototype.has=_4;En.prototype.set=x4;function _r(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function v4(){this.__data__=[],this.size=0}function b4(e){var t=this.__data__,i=Gu(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():c4.call(t,i,1),--this.size,!0}function w4(e){var t=this.__data__,i=Gu(t,e);return i<0?void 0:t[i][1]}function P4(e){return Gu(this.__data__,e)>-1}function T4(e,t){var i=this.__data__,r=Gu(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}_r.prototype.clear=v4;_r.prototype.delete=b4;_r.prototype.get=w4;_r.prototype.has=P4;_r.prototype.set=T4;function Ma(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function S4(){this.size=0,this.__data__={hash:new En,map:new(Fb||_r),string:new En}}function C4(e){var t=qu(this,e).delete(e);return this.size-=t?1:0,t}function M4(e){return qu(this,e).get(e)}function I4(e){return qu(this,e).has(e)}function E4(e,t){var i=qu(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}Ma.prototype.clear=S4;Ma.prototype.delete=C4;Ma.prototype.get=M4;Ma.prototype.has=I4;Ma.prototype.set=E4;function Ia(e){var t=this.__data__=new _r(e);this.size=t.size}function A4(){this.__data__=new _r,this.size=0}function k4(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}function D4(e){return this.__data__.get(e)}function L4(e){return this.__data__.has(e)}function R4(e,t){var i=this.__data__;if(i instanceof _r){var r=i.__data__;if(!Fb||r.length<w5-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new Ma(r)}return i.set(e,t),this.size=i.size,this}Ia.prototype.clear=A4;Ia.prototype.delete=k4;Ia.prototype.get=D4;Ia.prototype.has=L4;Ia.prototype.set=R4;function z4(e,t){var i=Jd(e),r=!i&&Kd(e),n=!i&&!r&&Ub(e),a=!i&&!r&&!n&&Xb(e),o=i||r||n||a,s=o?i4(e.length,String):[],l=s.length;for(var u in e)(t||gr.call(e,u))&&!(o&&(u=="length"||n&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Vb(u,l)))&&s.push(u);return s}function Wd(e,t,i){(i!==void 0&&!$u(e[t],i)||i===void 0&&!(t in e))&&Qd(e,t,i)}function B4(e,t,i){var r=e[t];(!(gr.call(e,t)&&$u(r,i))||i===void 0&&!(t in e))&&Qd(e,t,i)}function Gu(e,t){for(var i=e.length;i--;)if($u(e[i][0],t))return i;return-1}function Qd(e,t,i){t=="__proto__"&&Vu?Vu(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var O4=H4();function Xu(e){return e==null?e===void 0?F5:L5:In&&In in Object(e)?K4(e):r6(e)}function Mb(e){return as(e)&&Xu(e)==Ab}function F4(e){if(!An(e)||t6(e))return!1;var t=rf(e)?u4:J5;return t.test(s6(e))}function N4(e){return as(e)&&Gb(e.length)&&!!We[Xu(e)]}function V4(e){if(!An(e))return i6(e);var t=jb(e),i=[];for(var r in e)r=="constructor"&&(t||!gr.call(e,r))||i.push(r);return i}function Nb(e,t,i,r,n){e!==t&&O4(t,function(a,o){if(n||(n=new Ia),An(a))j4(e,t,o,i,Nb,r,n);else{var s=r?r(Hd(e,o),a,o+"",e,t,n):void 0;s===void 0&&(s=a),Wd(e,o,s)}},qb)}function j4(e,t,i,r,n,a,o){var s=Hd(e,i),l=Hd(t,i),u=o.get(l);if(u){Wd(e,i,u);return}var h=a?a(s,l,i+"",e,t,o):void 0,c=h===void 0;if(c){var p=Jd(l),d=!p&&Ub(l),f=!p&&!d&&Xb(l);h=l,p||d||f?Jd(s)?h=s:l6(s)?h=Y4(s):d?(c=!1,h=X4(l,!0)):f?(c=!1,h=$4(l,!0)):h=[]:u6(l)||Kd(l)?(h=s,Kd(s)?h=h6(s):(!An(s)||rf(s))&&(h=J4(l))):c=!1}c&&(o.set(l,h),n(h,l,r,a,o),o.delete(l)),Wd(e,i,h)}function U4(e,t){return a6(n6(e,t,$b),e+"")}var G4=Vu?function(e,t){return Vu(e,"toString",{configurable:!0,enumerable:!1,value:p6(t),writable:!0})}:$b;function X4(e,t){if(t)return e.slice();var i=e.length,r=Tb?Tb(i):new e.constructor(i);return e.copy(r),r}function q4(e){var t=new e.constructor(e.byteLength);return new Pb(t).set(new Pb(e)),t}function $4(e,t){var i=t?q4(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}function Y4(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t}function Z4(e,t,i,r){var n=!i;i||(i={});for(var a=-1,o=t.length;++a<o;){var s=t[a],l=r?r(i[s],e[s],s,i,e):void 0;l===void 0&&(l=e[s]),n?Qd(i,s,l):B4(i,s,l)}return i}function W4(e){return U4(function(t,i){var r=-1,n=i.length,a=n>1?i[n-1]:void 0,o=n>2?i[2]:void 0;for(a=e.length>3&&typeof a=="function"?(n--,a):void 0,o&&Q4(i[0],i[1],o)&&(a=n<3?void 0:a,n=1),t=Object(t);++r<n;){var s=i[r];s&&e(t,s,r,a)}return t})}function H4(e){return function(t,i,r){for(var n=-1,a=Object(t),o=r(t),s=o.length;s--;){var l=o[e?s:++n];if(i(a[l],l,a)===!1)break}return t}}function qu(e,t){var i=e.__data__;return e6(t)?i[typeof t=="string"?"string":"hash"]:i.map}function ef(e,t){var i=n4(e,t);return F4(i)?i:void 0}function K4(e){var t=gr.call(e,In),i=e[In];try{e[In]=void 0;var r=!0}catch(a){}var n=Bb.call(e);return r&&(t?e[In]=i:delete e[In]),n}function J4(e){return typeof e.constructor=="function"&&!jb(e)?f4(Ob(e)):{}}function Vb(e,t){var i=typeof e;return t=t==null?Eb:t,!!t&&(i=="number"||i!="symbol"&&Q5.test(e))&&e>-1&&e%1==0&&e<t}function Q4(e,t,i){if(!An(i))return!1;var r=typeof t;return(r=="number"?tf(i)&&Vb(t,i.length):r=="string"&&t in i)?$u(i[t],e):!1}function e6(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function t6(e){return!!bb&&bb in e}function jb(e){var t=e&&e.constructor,i=typeof t=="function"&&t.prototype||ju;return e===i}function i6(e){var t=[];if(e!=null)for(var i in Object(e))t.push(i);return t}function r6(e){return Bb.call(e)}function n6(e,t,i){return t=Cb(t===void 0?e.length-1:t,0),function(){for(var r=arguments,n=-1,a=Cb(r.length-t,0),o=Array(a);++n<a;)o[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(o),t4(e,this,s)}}function Hd(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var a6=o6(G4);function o6(e){var t=0,i=0;return function(){var r=d4(),n=T5-(r-i);if(i=r,n>0){if(++t>=P5)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function s6(e){if(e!=null){try{return Uu.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function $u(e,t){return e===t||e!==e&&t!==t}var Kd=Mb((function(){return arguments})())?Mb:function(e){return as(e)&&gr.call(e,"callee")&&!h4.call(e,"callee")},Jd=Array.isArray;function tf(e){return e!=null&&Gb(e.length)&&!rf(e)}function l6(e){return as(e)&&tf(e)}var Ub=p4||d6;function rf(e){if(!An(e))return!1;var t=Xu(e);return t==kb||t==A5||t==C5||t==R5}function Gb(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Eb}function An(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function as(e){return e!=null&&typeof e=="object"}function u6(e){if(!as(e)||Xu(e)!=Db)return!1;var t=Ob(e);if(t===null)return!0;var i=gr.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&Uu.call(i)==l4}var Xb=vb?r4(vb):N4;function h6(e){return Z4(e,qb(e))}function qb(e){return tf(e)?z4(e,!0):V4(e)}var c6=W4(function(e,t,i){Nb(e,t,i)});function p6(e){return function(){return e}}function $b(e){return e}function d6(){return!1}Ca.exports=c6});var D1=Vf((WK,Ps)=>{"use strict";A();var Z6=!1,On=!1,S1=!0,C1=!1,m={},M1=!1;typeof Ps<"u"&&Ps.exports?(Ps.exports=m,M1=!0):typeof document<"u"?window.ClipperLib=m:self.ClipperLib=m;var uh;M1?(yt="chrome",uh="Netscape"):(yt=navigator.userAgent.toString().toLowerCase(),uh=navigator.appName);var yt,Te={};yt.indexOf("chrome")!=-1&&yt.indexOf("chromium")==-1?Te.chrome=1:Te.chrome=0;yt.indexOf("chromium")!=-1?Te.chromium=1:Te.chromium=0;yt.indexOf("safari")!=-1&&yt.indexOf("chrome")==-1&&yt.indexOf("chromium")==-1?Te.safari=1:Te.safari=0;yt.indexOf("firefox")!=-1?Te.firefox=1:Te.firefox=0;yt.indexOf("firefox/17")!=-1?Te.firefox17=1:Te.firefox17=0;yt.indexOf("firefox/15")!=-1?Te.firefox15=1:Te.firefox15=0;yt.indexOf("firefox/3")!=-1?Te.firefox3=1:Te.firefox3=0;yt.indexOf("opera")!=-1?Te.opera=1:Te.opera=0;yt.indexOf("msie 10")!=-1?Te.msie10=1:Te.msie10=0;yt.indexOf("msie 9")!=-1?Te.msie9=1:Te.msie9=0;yt.indexOf("msie 8")!=-1?Te.msie8=1:Te.msie8=0;yt.indexOf("msie 7")!=-1?Te.msie7=1:Te.msie7=0;yt.indexOf("msie ")!=-1?Te.msie=1:Te.msie=0;m.biginteger_used=null;var Qr,W6=0xdeadbeefcafe,P1=(W6&16777215)==15715070;function X(e,t,i){m.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof t>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,t,i):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function Me(){return new X(null)}function H6(e,t,i,r,n,a){for(;--a>=0;){var o=t*this[e++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=o&67108863}return n}function K6(e,t,i,r,n,a){for(var o=t&32767,s=t>>15;--a>=0;){var l=this[e]&32767,u=this[e++]>>15,h=s*l+u*o;l=o*l+((h&32767)<<15)+i[r]+(n&1073741823),n=(l>>>30)+(h>>>15)+s*u+(n>>>30),i[r++]=l&1073741823}return n}function J6(e,t,i,r,n,a){for(var o=t&16383,s=t>>14;--a>=0;){var l=this[e]&16383,u=this[e++]>>14,h=s*l+u*o;l=o*l+((h&16383)<<14)+i[r]+n,n=(l>>28)+(h>>14)+s*u,i[r++]=l&268435455}return n}P1&&uh=="Microsoft Internet Explorer"?(X.prototype.am=K6,Qr=30):P1&&uh!="Netscape"?(X.prototype.am=H6,Qr=26):(X.prototype.am=J6,Qr=28);X.prototype.DB=Qr;X.prototype.DM=(1<<Qr)-1;X.prototype.DV=1<<Qr;var Pf=52;X.prototype.FV=Math.pow(2,Pf);X.prototype.F1=Pf-Qr;X.prototype.F2=2*Qr-Pf;var Q6="0123456789abcdefghijklmnopqrstuvwxyz",ch=new Array,za,di;za=48;for(di=0;di<=9;++di)ch[za++]=di;za=97;for(di=10;di<36;++di)ch[za++]=di;za=65;for(di=10;di<36;++di)ch[za++]=di;function T1(e){return Q6.charAt(e)}function I1(e,t){var i=ch[e.charCodeAt(t)];return i==null?-1:i}function eN(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function tN(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function Jr(e){var t=Me();return t.fromInt(e),t}function iN(e,t){var i;if(t==16)i=4;else if(t==8)i=3;else if(t==256)i=8;else if(t==2)i=1;else if(t==32)i=5;else if(t==4)i=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,a=0;--r>=0;){var o=i==8?e[r]&255:I1(e,r);if(o<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,a==0?this[this.t++]=o:a+i>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=i,a>=this.DB&&(a-=this.DB)}i==8&&(e[0]&128)!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),n&&X.ZERO.subTo(this,this)}function rN(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function nN(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var i=(1<<t)-1,r,n=!1,a="",o=this.t,s=this.DB-o*this.DB%t;if(o-- >0)for(s<this.DB&&(r=this[o]>>s)>0&&(n=!0,a=T1(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&i,s<=0&&(s+=this.DB,--o)),r>0&&(n=!0),n&&(a+=T1(r));return n?a:"0"}function aN(){var e=Me();return X.ZERO.subTo(this,e),e}function oN(){return this.s<0?this.negate():this}function sN(e){var t=this.s-e.s;if(t!=0)return t;var i=this.t;if(t=i-e.t,t!=0)return this.s<0?-t:t;for(;--i>=0;)if((t=this[i]-e[i])!=0)return t;return 0}function ph(e){var t=1,i;return(i=e>>>16)!=0&&(e=i,t+=16),(i=e>>8)!=0&&(e=i,t+=8),(i=e>>4)!=0&&(e=i,t+=4),(i=e>>2)!=0&&(e=i,t+=2),(i=e>>1)!=0&&(e=i,t+=1),t}function lN(){return this.t<=0?0:this.DB*(this.t-1)+ph(this[this.t-1]^this.s&this.DM)}function uN(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s}function hN(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s}function cN(e,t){var i=e%this.DB,r=this.DB-i,n=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<i&this.DM,s;for(s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&n)<<i;for(s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()}function pN(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,a=(1<<r)-1;t[0]=this[i]>>r;for(var o=i+1;o<this.t;++o)t[o-i-1]|=(this[o]&a)<<n,t[o-i]=this[o]>>r;r>0&&(t[this.t-i-1]|=(this.s&a)<<n),t.t=this.t-i,t.clamp()}function dN(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]-e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],t[i++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[i++]=this.DV+r:r>0&&(t[i++]=r),t.t=i,t.clamp()}function fN(e,t){var i=this.abs(),r=e.abs(),n=i.t;for(t.t=n+r.t;--n>=0;)t[n]=0;for(n=0;n<r.t;++n)t[n+i.t]=i.am(0,r[n],t,n,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&X.ZERO.subTo(t,t)}function mN(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var r=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,r,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()}function yN(e,t,i){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t!=null&&t.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=Me());var a=Me(),o=this.s,s=e.s,l=this.DB-ph(r[r.t-1]);l>0?(r.lShiftTo(l,a),n.lShiftTo(l,i)):(r.copyTo(a),n.copyTo(i));var u=a.t,h=a[u-1];if(h!=0){var c=h*(1<<this.F1)+(u>1?a[u-2]>>this.F2:0),p=this.FV/c,d=(1<<this.F1)/c,f=1<<this.F2,y=i.t,g=y-u,_=t==null?Me():t;for(a.dlShiftTo(g,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),X.ONE.dlShiftTo(u,_),_.subTo(a,a);a.t<u;)a[a.t++]=0;for(;--g>=0;){var b=i[--y]==h?this.DM:Math.floor(i[y]*p+(i[y-1]+f)*d);if((i[y]+=a.am(0,b,i,g,0,u))<b)for(a.dlShiftTo(g,_),i.subTo(_,i);i[y]<--b;)i.subTo(_,i)}t!=null&&(i.drShiftTo(u,t),o!=s&&X.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),o<0&&X.ZERO.subTo(i,i)}}}function gN(e){var t=Me();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(X.ZERO)>0&&e.subTo(t,t),t}function Fn(e){this.m=e}function _N(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function xN(e){return e}function vN(e){e.divRemTo(this.m,null,e)}function bN(e,t,i){e.multiplyTo(t,i),this.reduce(i)}function wN(e,t){e.squareTo(t),this.reduce(t)}Fn.prototype.convert=_N;Fn.prototype.revert=xN;Fn.prototype.reduce=vN;Fn.prototype.mulTo=bN;Fn.prototype.sqrTo=wN;function PN(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Nn(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function TN(e){var t=Me();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(X.ZERO)>0&&this.m.subTo(t,t),t}function SN(e){var t=Me();return e.copyTo(t),this.reduce(t),t}function CN(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=e[t]&32767,r=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(i=t+this.m.t,e[i]+=this.m.am(0,r,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function MN(e,t){e.squareTo(t),this.reduce(t)}function IN(e,t,i){e.multiplyTo(t,i),this.reduce(i)}Nn.prototype.convert=TN;Nn.prototype.revert=SN;Nn.prototype.reduce=CN;Nn.prototype.mulTo=IN;Nn.prototype.sqrTo=MN;function EN(){return(this.t>0?this[0]&1:this.s)==0}function AN(e,t){if(e>4294967295||e<1)return X.ONE;var i=Me(),r=Me(),n=t.convert(this),a=ph(e)-1;for(n.copyTo(i);--a>=0;)if(t.sqrTo(i,r),(e&1<<a)>0)t.mulTo(r,n,i);else{var o=i;i=r,r=o}return t.revert(i)}function kN(e,t){var i;return e<256||t.isEven()?i=new Fn(t):i=new Nn(t),this.exp(e,i)}X.prototype.copyTo=eN;X.prototype.fromInt=tN;X.prototype.fromString=iN;X.prototype.clamp=rN;X.prototype.dlShiftTo=uN;X.prototype.drShiftTo=hN;X.prototype.lShiftTo=cN;X.prototype.rShiftTo=pN;X.prototype.subTo=dN;X.prototype.multiplyTo=fN;X.prototype.squareTo=mN;X.prototype.divRemTo=yN;X.prototype.invDigit=PN;X.prototype.isEven=EN;X.prototype.exp=AN;X.prototype.toString=nN;X.prototype.negate=aN;X.prototype.abs=oN;X.prototype.compareTo=sN;X.prototype.bitLength=lN;X.prototype.mod=gN;X.prototype.modPowInt=kN;X.ZERO=Jr(0);X.ONE=Jr(1);function DN(){var e=Me();return this.copyTo(e),e}function LN(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function RN(){return this.t==0?this.s:this[0]<<24>>24}function zN(){return this.t==0?this.s:this[0]<<16>>16}function BN(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function ON(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function FN(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),r=Jr(i),n=Me(),a=Me(),o="";for(this.divRemTo(r,n,a);n.signum()>0;)o=(i+a.intValue()).toString(e).substr(1)+o,n.divRemTo(r,n,a);return a.intValue().toString(e)+o}function NN(e,t){this.fromInt(0),t==null&&(t=10);for(var i=this.chunkSize(t),r=Math.pow(t,i),n=!1,a=0,o=0,s=0;s<e.length;++s){var l=I1(e,s);if(l<0){e.charAt(s)=="-"&&this.signum()==0&&(n=!0);continue}o=t*o+l,++a>=i&&(this.dMultiply(r),this.dAddOffset(o,0),a=0,o=0)}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(o,0)),n&&X.ZERO.subTo(this,this)}function VN(e,t,i){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(X.ONE.shiftLeft(e-1),Tf,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(X.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function jN(){var e=this.t,t=new Array;t[0]=this.s;var i=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(i<this.DB&&(r=this[e]>>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<<this.DB-i);e>=0;)i<8?(r=(this[e]&(1<<i)-1)<<8-i,r|=this[--e]>>(i+=this.DB-8)):(r=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function UN(e){return this.compareTo(e)==0}function GN(e){return this.compareTo(e)<0?this:e}function XN(e){return this.compareTo(e)>0?this:e}function qN(e,t,i){var r,n,a=Math.min(e.t,this.t);for(r=0;r<a;++r)i[r]=t(this[r],e[r]);if(e.t<this.t){for(n=e.s&this.DM,r=a;r<this.t;++r)i[r]=t(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=a;r<e.t;++r)i[r]=t(n,e[r]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()}function $N(e,t){return e&t}function YN(e){var t=Me();return this.bitwiseTo(e,$N,t),t}function Tf(e,t){return e|t}function ZN(e){var t=Me();return this.bitwiseTo(e,Tf,t),t}function E1(e,t){return e^t}function WN(e){var t=Me();return this.bitwiseTo(e,E1,t),t}function A1(e,t){return e&~t}function HN(e){var t=Me();return this.bitwiseTo(e,A1,t),t}function KN(){for(var e=Me(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function JN(e){var t=Me();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function QN(e){var t=Me();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function eV(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function tV(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+eV(this[e]);return this.s<0?this.t*this.DB:-1}function iV(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function rV(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=iV(this[i]^t);return e}function nV(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function aV(e,t){var i=X.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i}function oV(e){return this.changeBit(e,Tf)}function sV(e){return this.changeBit(e,A1)}function lV(e){return this.changeBit(e,E1)}function uV(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]+e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],t[i++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[i++]=r:r<-1&&(t[i++]=this.DV+r),t.t=i,t.clamp()}function hV(e){var t=Me();return this.addTo(e,t),t}function cV(e){var t=Me();return this.subTo(e,t),t}function pV(e){var t=Me();return this.multiplyTo(e,t),t}function dV(){var e=Me();return this.squareTo(e),e}function fV(e){var t=Me();return this.divRemTo(e,t,null),t}function mV(e){var t=Me();return this.divRemTo(e,null,t),t}function yV(e){var t=Me(),i=Me();return this.divRemTo(e,t,i),new Array(t,i)}function gV(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function _V(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Ts(){}function k1(e){return e}function xV(e,t,i){e.multiplyTo(t,i)}function vV(e,t){e.squareTo(t)}Ts.prototype.convert=k1;Ts.prototype.revert=k1;Ts.prototype.mulTo=xV;Ts.prototype.sqrTo=vV;function bV(e){return this.exp(e,new Ts)}function wV(e,t,i){var r=Math.min(this.t+e.t,t);for(i.s=0,i.t=r;r>0;)i[--r]=0;var n;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,e[r],i,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e[r],i,r,0,t-r);i.clamp()}function PV(e,t,i){--t;var r=i.t=this.t+e.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)i[this.t+r-t]=this.am(t-r,e[r],i,0,0,this.t+r-t);i.clamp(),i.drShiftTo(1,i)}function Ba(e){this.r2=Me(),this.q3=Me(),X.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function TV(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Me();return e.copyTo(t),this.reduce(t),t}function SV(e){return e}function CV(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function MV(e,t){e.squareTo(t),this.reduce(t)}function IV(e,t,i){e.multiplyTo(t,i),this.reduce(i)}Ba.prototype.convert=TV;Ba.prototype.revert=SV;Ba.prototype.reduce=CV;Ba.prototype.mulTo=IV;Ba.prototype.sqrTo=MV;function EV(e,t){var i=e.bitLength(),r,n=Jr(1),a;if(i<=0)return n;i<18?r=1:i<48?r=3:i<144?r=4:i<768?r=5:r=6,i<8?a=new Fn(t):t.isEven()?a=new Ba(t):a=new Nn(t);var o=new Array,s=3,l=r-1,u=(1<<r)-1;if(o[1]=a.convert(this),r>1){var h=Me();for(a.sqrTo(o[1],h);s<=u;)o[s]=Me(),a.mulTo(h,o[s-2],o[s]),s+=2}var c=e.t-1,p,d=!0,f=Me(),y;for(i=ph(e[c])-1;c>=0;){for(i>=l?p=e[c]>>i-l&u:(p=(e[c]&(1<<i+1)-1)<<l-i,c>0&&(p|=e[c-1]>>this.DB+i-l)),s=r;(p&1)==0;)p>>=1,--s;if((i-=s)<0&&(i+=this.DB,--c),d)o[p].copyTo(n),d=!1;else{for(;s>1;)a.sqrTo(n,f),a.sqrTo(f,n),s-=2;s>0?a.sqrTo(n,f):(y=n,n=f,f=y),a.mulTo(f,o[p],n)}for(;c>=0&&(e[c]&1<<i)==0;)a.sqrTo(n,f),y=n,n=f,f=y,--i<0&&(i=this.DB-1,--c)}return a.revert(n)}function AV(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var r=t;t=i,i=r}var n=t.getLowestSetBit(),a=i.getLowestSetBit();if(a<0)return t;for(n<a&&(a=n),a>0&&(t.rShiftTo(a,t),i.rShiftTo(a,i));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return a>0&&i.lShiftTo(a,i),i}function kV(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(t==0)i=this[0]%e;else for(var r=this.t-1;r>=0;--r)i=(t*i+this[r])%e;return i}function DV(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return X.ZERO;for(var i=e.clone(),r=this.clone(),n=Jr(1),a=Jr(0),o=Jr(0),s=Jr(1);i.signum()!=0;){for(;i.isEven();)i.rShiftTo(1,i),t?((!n.isEven()||!a.isEven())&&(n.addTo(this,n),a.subTo(e,a)),n.rShiftTo(1,n)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;r.isEven();)r.rShiftTo(1,r),t?((!o.isEven()||!s.isEven())&&(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);i.compareTo(r)>=0?(i.subTo(r,i),t&&n.subTo(o,n),a.subTo(s,a)):(r.subTo(i,r),t&&o.subTo(n,o),s.subTo(a,s))}if(r.compareTo(X.ONE)!=0)return X.ZERO;if(s.compareTo(e)>=0)return s.subtract(e);if(s.signum()<0)s.addTo(e,s);else return s;return s.signum()<0?s.add(e):s}var Lt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],LV=(1<<26)/Lt[Lt.length-1];function RV(e){var t,i=this.abs();if(i.t==1&&i[0]<=Lt[Lt.length-1]){for(t=0;t<Lt.length;++t)if(i[0]==Lt[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<Lt.length;){for(var r=Lt[t],n=t+1;n<Lt.length&&r<LV;)r*=Lt[n++];for(r=i.modInt(r);t<n;)if(r%Lt[t++]==0)return!1}return i.millerRabin(e)}function zV(e){var t=this.subtract(X.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);e=e+1>>1,e>Lt.length&&(e=Lt.length);for(var n=Me(),a=0;a<e;++a){n.fromInt(Lt[Math.floor(Math.random()*Lt.length)]);var o=n.modPow(r,this);if(o.compareTo(X.ONE)!=0&&o.compareTo(t)!=0){for(var s=1;s++<i&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(X.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}X.prototype.chunkSize=BN;X.prototype.toRadix=FN;X.prototype.fromRadix=NN;X.prototype.fromNumber=VN;X.prototype.bitwiseTo=qN;X.prototype.changeBit=aV;X.prototype.addTo=uV;X.prototype.dMultiply=gV;X.prototype.dAddOffset=_V;X.prototype.multiplyLowerTo=wV;X.prototype.multiplyUpperTo=PV;X.prototype.modInt=kV;X.prototype.millerRabin=zV;X.prototype.clone=DN;X.prototype.intValue=LN;X.prototype.byteValue=RN;X.prototype.shortValue=zN;X.prototype.signum=ON;X.prototype.toByteArray=jN;X.prototype.equals=UN;X.prototype.min=GN;X.prototype.max=XN;X.prototype.and=YN;X.prototype.or=ZN;X.prototype.xor=WN;X.prototype.andNot=HN;X.prototype.not=KN;X.prototype.shiftLeft=JN;X.prototype.shiftRight=QN;X.prototype.getLowestSetBit=tV;X.prototype.bitCount=rV;X.prototype.testBit=nV;X.prototype.setBit=oV;X.prototype.clearBit=sV;X.prototype.flipBit=lV;X.prototype.add=hV;X.prototype.subtract=cV;X.prototype.multiply=pV;X.prototype.divide=fV;X.prototype.remainder=mV;X.prototype.divideAndRemainder=yV;X.prototype.modPow=EV;X.prototype.modInverse=DV;X.prototype.pow=bV;X.prototype.gcd=AV;X.prototype.isProbablePrime=RV;X.prototype.square=dV;var we=X;we.prototype.IsNegative=function(){return this.compareTo(we.ZERO)==-1};we.op_Equality=function(e,t){return e.compareTo(t)==0};we.op_Inequality=function(e,t){return e.compareTo(t)!=0};we.op_GreaterThan=function(e,t){return e.compareTo(t)>0};we.op_LessThan=function(e,t){return e.compareTo(t)<0};we.op_Addition=function(e,t){return new we(e).add(new we(t))};we.op_Subtraction=function(e,t){return new we(e).subtract(new we(t))};we.Int128Mul=function(e,t){return new we(e).multiply(new we(t))};we.op_Division=function(e,t){return e.divide(t)};we.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof hh>"u"&&(hh=function(e,t){var i;if(typeof Object.getOwnPropertyNames>"u"){for(i in t.prototype)(typeof e.prototype[i]>"u"||e.prototype[i]==Object.prototype[i])&&(e.prototype[i]=t.prototype[i]);for(i in t)typeof e[i]>"u"&&(e[i]=t[i]);e.$baseCtor=t}else{for(var r=Object.getOwnPropertyNames(t.prototype),n=0;n<r.length;n++)typeof Object.getOwnPropertyDescriptor(e.prototype,r[n])>"u"&&Object.defineProperty(e.prototype,r[n],Object.getOwnPropertyDescriptor(t.prototype,r[n]));for(i in t)typeof e[i]>"u"&&(e[i]=t[i]);e.$baseCtor=t}});var hh;m.Path=function(){return[]};m.Paths=function(){return[]};m.DoublePoint=function(){var e=arguments;this.X=0,this.Y=0,e.length==1?(this.X=e[0].X,this.Y=e[0].Y):e.length==2&&(this.X=e[0],this.Y=e[1])};m.DoublePoint0=function(){this.X=0,this.Y=0};m.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};m.DoublePoint2=function(e,t){this.X=e,this.Y=t};m.PolyNode=function(){this.m_Parent=null,this.m_polygon=new m.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};m.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,t=this.m_Parent;t!==null;)e=!e,t=t.m_Parent;return e};m.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};m.PolyNode.prototype.Contour=function(){return this.m_polygon};m.PolyNode.prototype.AddChild=function(e){var t=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=t};m.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};m.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};m.PolyNode.prototype.Childs=function(){return this.m_Childs};m.PolyNode.prototype.Parent=function(){return this.m_Parent};m.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};m.PolyTree=function(){this.m_AllPolys=[],m.PolyNode.call(this)};m.PolyTree.prototype.Clear=function(){for(var e=0,t=this.m_AllPolys.length;e<t;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};m.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};m.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};hh(m.PolyTree,m.PolyNode);m.Math_Abs_Int64=m.Math_Abs_Int32=m.Math_Abs_Double=function(e){return Math.abs(e)};m.Math_Max_Int32_Int32=function(e,t){return Math.max(e,t)};Te.msie||Te.opera||Te.safari?m.Cast_Int32=function(e){return e|0}:m.Cast_Int32=function(e){return~~e};Te.chrome?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:Te.firefox&&typeof Number.toInteger=="function"?m.Cast_Int64=function(e){return Number.toInteger(e)}:Te.msie7||Te.msie8?m.Cast_Int64=function(e){return parseInt(e,10)}:Te.msie?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:m.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};m.Clear=function(e){e.length=0};m.PI=3.141592653589793;m.PI2=2*3.141592653589793;m.IntPoint=function(){var e=arguments,t=e.length;if(this.X=0,this.Y=0,On)if(this.Z=0,t==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(t==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(t==1)if(e[0]instanceof m.DoublePoint){var i=e[0];this.X=m.Clipper.Round(i.X),this.Y=m.Clipper.Round(i.Y),this.Z=0}else{var r=e[0];typeof r.Z>"u"&&(r.Z=0),this.X=r.X,this.Y=r.Y,this.Z=r.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=e[0],this.Y=e[1];else if(t==1)if(e[0]instanceof m.DoublePoint){var i=e[0];this.X=m.Clipper.Round(i.X),this.Y=m.Clipper.Round(i.Y)}else{var r=e[0];this.X=r.X,this.Y=r.Y}else this.X=0,this.Y=0};m.IntPoint.op_Equality=function(e,t){return e.X==t.X&&e.Y==t.Y};m.IntPoint.op_Inequality=function(e,t){return e.X!=t.X||e.Y!=t.Y};On?(m.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},m.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},m.IntPoint1dp=function(e){this.X=m.Clipper.Round(e.X),this.Y=m.Clipper.Round(e.Y),this.Z=0},m.IntPoint2=function(e,t){this.X=e,this.Y=t,this.Z=0},m.IntPoint3=function(e,t,i){this.X=e,this.Y=t,this.Z=i}):(m.IntPoint0=function(){this.X=0,this.Y=0},m.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},m.IntPoint1dp=function(e){this.X=m.Clipper.Round(e.X),this.Y=m.Clipper.Round(e.Y)},m.IntPoint2=function(e,t){this.X=e,this.Y=t});m.IntRect=function(){var e=arguments,t=e.length;t==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};m.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};m.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};m.IntRect4=function(e,t,i,r){this.left=e,this.top=t,this.right=i,this.bottom=r};m.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};m.PolyType={ptSubject:0,ptClip:1};m.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};m.JoinType={jtSquare:0,jtRound:1,jtMiter:2};m.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};C1&&(m.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});m.EdgeSide={esLeft:0,esRight:1};m.Direction={dRightToLeft:0,dLeftToRight:1};m.TEdge=function(){this.Bot=new m.IntPoint,this.Curr=new m.IntPoint,this.Top=new m.IntPoint,this.Delta=new m.IntPoint,this.Dx=0,this.PolyTyp=m.PolyType.ptSubject,this.Side=m.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};m.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new m.IntPoint};m.MyIntersectNodeSort=function(){};m.MyIntersectNodeSort.Compare=function(e,t){return t.Pt.Y-e.Pt.Y};m.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};m.Scanbeam=function(){this.Y=0,this.Next=null};m.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};m.OutPt=function(){this.Idx=0,this.Pt=new m.IntPoint,this.Next=null,this.Prev=null};m.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new m.IntPoint};m.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};m.ClipperBase.horizontal=-9007199254740992;m.ClipperBase.Skip=-2;m.ClipperBase.Unassigned=-1;m.ClipperBase.tolerance=1e-20;Z6?(m.ClipperBase.loRange=46340,m.ClipperBase.hiRange=46340):(m.ClipperBase.loRange=47453132,m.ClipperBase.hiRange=0xfffffffffffff);m.ClipperBase.near_zero=function(e){return e>-m.ClipperBase.tolerance&&e<m.ClipperBase.tolerance};m.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};m.ClipperBase.prototype.PointIsVertex=function(e,t){var i=t;do{if(m.IntPoint.op_Equality(i.Pt,e))return!0;i=i.Next}while(i!=t);return!1};m.ClipperBase.prototype.PointOnLineSegment=function(e,t,i,r){return r?e.X==t.X&&e.Y==t.Y||e.X==i.X&&e.Y==i.Y||e.X>t.X==e.X<i.X&&e.Y>t.Y==e.Y<i.Y&&we.op_Equality(we.Int128Mul(e.X-t.X,i.Y-t.Y),we.Int128Mul(i.X-t.X,e.Y-t.Y)):e.X==t.X&&e.Y==t.Y||e.X==i.X&&e.Y==i.Y||e.X>t.X==e.X<i.X&&e.Y>t.Y==e.Y<i.Y&&(e.X-t.X)*(i.Y-t.Y)==(i.X-t.X)*(e.Y-t.Y)};m.ClipperBase.prototype.PointOnPolygon=function(e,t,i){for(var r=t;;){if(this.PointOnLineSegment(e,r.Pt,r.Next.Pt,i))return!0;if(r=r.Next,r==t)break}return!1};m.ClipperBase.prototype.SlopesEqual=m.ClipperBase.SlopesEqual=function(){var e=arguments,t=e.length,i,r,n,a,o,s,l;return t==3?(i=e[0],r=e[1],l=e[2],l?we.op_Equality(we.Int128Mul(i.Delta.Y,r.Delta.X),we.Int128Mul(i.Delta.X,r.Delta.Y)):m.Cast_Int64(i.Delta.Y*r.Delta.X)==m.Cast_Int64(i.Delta.X*r.Delta.Y)):t==4?(n=e[0],a=e[1],o=e[2],l=e[3],l?we.op_Equality(we.Int128Mul(n.Y-a.Y,a.X-o.X),we.Int128Mul(n.X-a.X,a.Y-o.Y)):m.Cast_Int64((n.Y-a.Y)*(a.X-o.X))-m.Cast_Int64((n.X-a.X)*(a.Y-o.Y))===0):(n=e[0],a=e[1],o=e[2],s=e[3],l=e[4],l?we.op_Equality(we.Int128Mul(n.Y-a.Y,o.X-s.X),we.Int128Mul(n.X-a.X,o.Y-s.Y)):m.Cast_Int64((n.Y-a.Y)*(o.X-s.X))-m.Cast_Int64((n.X-a.X)*(o.Y-s.Y))===0)};m.ClipperBase.SlopesEqual3=function(e,t,i){return i?we.op_Equality(we.Int128Mul(e.Delta.Y,t.Delta.X),we.Int128Mul(e.Delta.X,t.Delta.Y)):m.Cast_Int64(e.Delta.Y*t.Delta.X)==m.Cast_Int64(e.Delta.X*t.Delta.Y)};m.ClipperBase.SlopesEqual4=function(e,t,i,r){return r?we.op_Equality(we.Int128Mul(e.Y-t.Y,t.X-i.X),we.Int128Mul(e.X-t.X,t.Y-i.Y)):m.Cast_Int64((e.Y-t.Y)*(t.X-i.X))-m.Cast_Int64((e.X-t.X)*(t.Y-i.Y))===0};m.ClipperBase.SlopesEqual5=function(e,t,i,r,n){return n?we.op_Equality(we.Int128Mul(e.Y-t.Y,i.X-r.X),we.Int128Mul(e.X-t.X,i.Y-r.Y)):m.Cast_Int64((e.Y-t.Y)*(i.X-r.X))-m.Cast_Int64((e.X-t.X)*(i.Y-r.Y))===0};m.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,t=this.m_edges.length;e<t;++e){for(var i=0,r=this.m_edges[e].length;i<r;++i)this.m_edges[e][i]=null;m.Clear(this.m_edges[e])}m.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};m.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var e=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=e}this.m_CurrentLM=null};m.ClipperBase.prototype.RangeTest=function(e,t){t.Value?(e.X>m.ClipperBase.hiRange||e.Y>m.ClipperBase.hiRange||-e.X>m.ClipperBase.hiRange||-e.Y>m.ClipperBase.hiRange)&&m.Error("Coordinate outside allowed range in RangeTest()."):(e.X>m.ClipperBase.loRange||e.Y>m.ClipperBase.loRange||-e.X>m.ClipperBase.loRange||-e.Y>m.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(e,t))};m.ClipperBase.prototype.InitEdge=function(e,t,i,r){e.Next=t,e.Prev=i,e.Curr.X=r.X,e.Curr.Y=r.Y,e.OutIdx=-1};m.ClipperBase.prototype.InitEdge2=function(e,t){e.Curr.Y>=e.Next.Curr.Y?(e.Bot.X=e.Curr.X,e.Bot.Y=e.Curr.Y,e.Top.X=e.Next.Curr.X,e.Top.Y=e.Next.Curr.Y):(e.Top.X=e.Curr.X,e.Top.Y=e.Curr.Y,e.Bot.X=e.Next.Curr.X,e.Bot.Y=e.Next.Curr.Y),this.SetDx(e),e.PolyTyp=t};m.ClipperBase.prototype.FindNextLocMin=function(e){for(var t;;){for(;m.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||m.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=m.ClipperBase.horizontal&&e.Prev.Dx!=m.ClipperBase.horizontal)break;for(;e.Prev.Dx==m.ClipperBase.horizontal;)e=e.Prev;for(t=e;e.Dx==m.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){t.Prev.Bot.X<e.Bot.X&&(e=t);break}}return e};m.ClipperBase.prototype.ProcessBound=function(e,t){var i=e,r=e,n,a;if(e.Dx==m.ClipperBase.horizontal&&(t?a=e.Prev.Bot.X:a=e.Next.Bot.X,e.Bot.X!=a&&this.ReverseHorizontal(e)),r.OutIdx!=m.ClipperBase.Skip)if(t){for(;r.Top.Y==r.Next.Bot.Y&&r.Next.OutIdx!=m.ClipperBase.Skip;)r=r.Next;if(r.Dx==m.ClipperBase.horizontal&&r.Next.OutIdx!=m.ClipperBase.Skip){for(n=r;n.Prev.Dx==m.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==r.Next.Top.X?t||(r=n.Prev):n.Prev.Top.X>r.Next.Top.X&&(r=n.Prev)}for(;e!=r;)e.NextInLML=e.Next,e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),r=r.Next}else{for(;r.Top.Y==r.Prev.Bot.Y&&r.Prev.OutIdx!=m.ClipperBase.Skip;)r=r.Prev;if(r.Dx==m.ClipperBase.horizontal&&r.Prev.OutIdx!=m.ClipperBase.Skip){for(n=r;n.Next.Dx==m.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==r.Prev.Top.X?t||(r=n.Next):n.Next.Top.X>r.Prev.Top.X&&(r=n.Next)}for(;e!=r;)e.NextInLML=e.Prev,e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),r=r.Prev}if(r.OutIdx==m.ClipperBase.Skip){if(e=r,t){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=r&&e.Dx==m.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=r&&e.Dx==m.ClipperBase.horizontal;)e=e.Next}if(e==r)t?r=e.Next:r=e.Prev;else{t?e=r.Next:e=r.Prev;var o=new m.LocalMinima;o.Next=null,o.Y=e.Bot.Y,o.LeftBound=null,o.RightBound=e,o.RightBound.WindDelta=0,r=this.ProcessBound(o.RightBound,t),this.InsertLocalMinima(o)}}return r};m.ClipperBase.prototype.AddPath=function(e,t,i){S1?!i&&t==m.PolyType.ptClip&&m.Error("AddPath: Open paths must be subject."):i||m.Error("AddPath: Open paths have been disabled.");var r=e.length-1;if(i)for(;r>0&&m.IntPoint.op_Equality(e[r],e[0]);)--r;for(;r>0&&m.IntPoint.op_Equality(e[r],e[r-1]);)--r;if(i&&r<2||!i&&r<1)return!1;for(var n=new Array,a=0;a<=r;a++)n.push(new m.TEdge);var o=!0;n[1].Curr.X=e[1].X,n[1].Curr.Y=e[1].Y;var s={Value:this.m_UseFullRange};this.RangeTest(e[0],s),this.m_UseFullRange=s.Value,s.Value=this.m_UseFullRange,this.RangeTest(e[r],s),this.m_UseFullRange=s.Value,this.InitEdge(n[0],n[1],n[r],e[0]),this.InitEdge(n[r],n[0],n[r-1],e[r]);for(var a=r-1;a>=1;--a)s.Value=this.m_UseFullRange,this.RangeTest(e[a],s),this.m_UseFullRange=s.Value,this.InitEdge(n[a],n[a+1],n[a-1],e[a]);for(var l=n[0],u=l,h=l;;){if(m.IntPoint.op_Equality(u.Curr,u.Next.Curr)){if(u==u.Next)break;u==l&&(l=u.Next),u=this.RemoveEdge(u),h=u;continue}if(u.Prev==u.Next)break;if(i&&m.ClipperBase.SlopesEqual(u.Prev.Curr,u.Curr,u.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(u.Prev.Curr,u.Curr,u.Next.Curr))){u==l&&(l=u.Next),u=this.RemoveEdge(u),u=u.Prev,h=u;continue}if(u=u.Next,u==h)break}if(!i&&u==u.Next||i&&u.Prev==u.Next)return!1;i||(this.m_HasOpenPaths=!0,l.Prev.OutIdx=m.ClipperBase.Skip);var c=l;u=l;do this.InitEdge2(u,t),u=u.Next,o&&u.Curr.Y!=l.Curr.Y&&(o=!1);while(u!=l);if(o){if(i)return!1;u.Prev.OutIdx=m.ClipperBase.Skip,u.Prev.Bot.X<u.Prev.Top.X&&this.ReverseHorizontal(u.Prev);var p=new m.LocalMinima;for(p.Next=null,p.Y=u.Bot.Y,p.LeftBound=null,p.RightBound=u,p.RightBound.Side=m.EdgeSide.esRight,p.RightBound.WindDelta=0;u.Next.OutIdx!=m.ClipperBase.Skip;)u.NextInLML=u.Next,u.Bot.X!=u.Prev.Top.X&&this.ReverseHorizontal(u),u=u.Next;return this.InsertLocalMinima(p),this.m_edges.push(n),!0}this.m_edges.push(n);for(var d,f=null;u=this.FindNextLocMin(u),u!=f;){f==null&&(f=u);var p=new m.LocalMinima;p.Next=null,p.Y=u.Bot.Y,u.Dx<u.Prev.Dx?(p.LeftBound=u.Prev,p.RightBound=u,d=!1):(p.LeftBound=u,p.RightBound=u.Prev,d=!0),p.LeftBound.Side=m.EdgeSide.esLeft,p.RightBound.Side=m.EdgeSide.esRight,i?p.LeftBound.Next==p.RightBound?p.LeftBound.WindDelta=-1:p.LeftBound.WindDelta=1:p.LeftBound.WindDelta=0,p.RightBound.WindDelta=-p.LeftBound.WindDelta,u=this.ProcessBound(p.LeftBound,d);var y=this.ProcessBound(p.RightBound,!d);p.LeftBound.OutIdx==m.ClipperBase.Skip?p.LeftBound=null:p.RightBound.OutIdx==m.ClipperBase.Skip&&(p.RightBound=null),this.InsertLocalMinima(p),d||(u=y)}return!0};m.ClipperBase.prototype.AddPaths=function(e,t,i){for(var r=!1,n=0,a=e.length;n<a;++n)this.AddPath(e[n],t,i)&&(r=!0);return r};m.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,t,i){return m.IntPoint.op_Equality(e,i)||m.IntPoint.op_Equality(e,t)||m.IntPoint.op_Equality(i,t)?!1:e.X!=i.X?t.X>e.X==t.X<i.X:t.Y>e.Y==t.Y<i.Y};m.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var t=e.Next;return e.Prev=null,t};m.ClipperBase.prototype.SetDx=function(e){e.Delta.X=e.Top.X-e.Bot.X,e.Delta.Y=e.Top.Y-e.Bot.Y,e.Delta.Y===0?e.Dx=m.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};m.ClipperBase.prototype.InsertLocalMinima=function(e){if(this.m_MinimaList===null)this.m_MinimaList=e;else if(e.Y>=this.m_MinimaList.Y)e.Next=this.m_MinimaList,this.m_MinimaList=e;else{for(var t=this.m_MinimaList;t.Next!==null&&e.Y<t.Next.Y;)t=t.Next;e.Next=t.Next,t.Next=e}};m.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};m.ClipperBase.prototype.ReverseHorizontal=function(e){var t=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=t,On&&(t=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=t)};m.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var t=e.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=m.EdgeSide.esLeft,t.OutIdx=m.ClipperBase.Unassigned),t=e.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=m.EdgeSide.esRight,t.OutIdx=m.ClipperBase.Unassigned),e=e.Next}};m.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=m.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=m.PolyFillType.pftEvenOdd,this.m_SubjFillType=m.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,m.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=m.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&e)!==0,this.StrictlySimple=(2&e)!==0,this.PreserveCollinear=(4&e)!==0,On&&(this.ZFillFunction=null)};m.Clipper.ioReverseSolution=1;m.Clipper.ioStrictlySimple=2;m.Clipper.ioPreserveCollinear=4;m.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),m.ClipperBase.prototype.Clear.call(this))};m.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};m.Clipper.prototype.Reset=function(){m.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var e=this.m_MinimaList;e!==null;)this.InsertScanbeam(e.Y),e=e.Next};m.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new m.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var t=new m.Scanbeam;t.Y=e,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var i=this.m_Scanbeam;i.Next!==null&&e<=i.Next.Y;)i=i.Next;if(e==i.Y)return;var t=new m.Scanbeam;t.Y=e,t.Next=i.Next,i.Next=t}};m.Clipper.prototype.Execute=function(){var e=arguments,t=e.length,i=e[1]instanceof m.PolyTree;if(t==4&&!i){var r=e[0],n=e[1],a=e[2],o=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&m.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,m.Clear(n),this.m_SubjFillType=a,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!1;try{var s=this.ExecuteInternal();s&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(t==4&&i){var r=e[0],l=e[1],a=e[2],o=e[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=a,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!0;try{var s=this.ExecuteInternal();s&&this.BuildResult2(l)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(t==2&&!i){var r=e[0],n=e[1];return this.Execute(r,n,m.PolyFillType.pftEvenOdd,m.PolyFillType.pftEvenOdd)}else if(t==2&&i){var r=e[0],l=e[1];return this.Execute(r,l,m.PolyFillType.pftEvenOdd,m.PolyFillType.pftEvenOdd)}};m.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var t=e.FirstLeft;t!==null&&(t.IsHole==e.IsHole||t.Pts===null);)t=t.FirstLeft;e.FirstLeft=t}};m.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),m.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(e,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),e=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{m.Clear(this.m_Joins),m.Clear(this.m_GhostJoins)}};m.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,e};m.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,t=this.m_PolyOuts.length;e<t;++e)this.DisposeOutRec(e);m.Clear(this.m_PolyOuts)};m.Clipper.prototype.DisposeOutRec=function(e){var t=this.m_PolyOuts[e];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[e]=null};m.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var t=null;for(e.Prev.Next=null;e!==null;)t=e,e=e.Next,t=null}};m.Clipper.prototype.AddJoin=function(e,t,i){var r=new m.Join;r.OutPt1=e,r.OutPt2=t,r.OffPt.X=i.X,r.OffPt.Y=i.Y,this.m_Joins.push(r)};m.Clipper.prototype.AddGhostJoin=function(e,t){var i=new m.Join;i.OutPt1=e,i.OffPt.X=t.X,i.OffPt.Y=t.Y,this.m_GhostJoins.push(i)};On&&(m.Clipper.prototype.SetZ=function(e,t){e.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,e):this.ZFillFunction(t.Top,t.Bot,e))});m.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var t=this.m_CurrentLM.LeftBound,i=this.m_CurrentLM.RightBound;this.PopLocalMinima();var r=null;if(t===null?(this.InsertEdgeIntoAEL(i,null),this.SetWindingCount(i),this.IsContributing(i)&&(r=this.AddOutPt(i,i.Bot))):i==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(r=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(i,t),this.SetWindingCount(t),i.WindCnt=t.WindCnt,i.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(r=this.AddLocalMinPoly(t,i,t.Bot)),this.InsertScanbeam(t.Top.Y)),i!=null&&(m.ClipperBase.IsHorizontal(i)?this.AddEdgeToSEL(i):this.InsertScanbeam(i.Top.Y)),!(t==null||i==null)){if(r!==null&&m.ClipperBase.IsHorizontal(i)&&this.m_GhostJoins.length>0&&i.WindDelta!==0)for(var n=0,a=this.m_GhostJoins.length;n<a;n++){var o=this.m_GhostJoins[n];this.HorzSegmentsOverlap(o.OutPt1.Pt,o.OffPt,i.Bot,i.Top)&&this.AddJoin(o.OutPt1,r,o.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&m.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(r,s,t.Top)}if(t.NextInAEL!=i){if(i.OutIdx>=0&&i.PrevInAEL.OutIdx>=0&&m.ClipperBase.SlopesEqual(i.PrevInAEL,i,this.m_UseFullRange)&&i.WindDelta!==0&&i.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(i.PrevInAEL,i.Bot);this.AddJoin(r,s,i.Top)}var l=t.NextInAEL;if(l!==null)for(;l!=i;)this.IntersectEdges(i,l,t.Curr,!1),l=l.NextInAEL}}}};m.Clipper.prototype.InsertEdgeIntoAEL=function(e,t){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,e))e.PrevInAEL=null,e.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=e,this.m_ActiveEdges=e;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,e);)t=t.NextInAEL;e.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=e),e.PrevInAEL=t,t.NextInAEL=e}};m.Clipper.prototype.E2InsertsBeforeE1=function(e,t){return t.Curr.X==e.Curr.X?t.Top.Y>e.Top.Y?t.Top.X<m.Clipper.TopX(e,t.Top.Y):e.Top.X>m.Clipper.TopX(t,e.Top.Y):t.Curr.X<e.Curr.X};m.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==m.PolyType.ptSubject?this.m_SubjFillType==m.PolyFillType.pftEvenOdd:this.m_ClipFillType==m.PolyFillType.pftEvenOdd};m.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==m.PolyType.ptSubject?this.m_ClipFillType==m.PolyFillType.pftEvenOdd:this.m_SubjFillType==m.PolyFillType.pftEvenOdd};m.Clipper.prototype.IsContributing=function(e){var t,i;switch(e.PolyTyp==m.PolyType.ptSubject?(t=this.m_SubjFillType,i=this.m_ClipFillType):(t=this.m_ClipFillType,i=this.m_SubjFillType),t){case m.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case m.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case m.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case m.ClipType.ctIntersection:switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2!==0;case m.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case m.ClipType.ctUnion:switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case m.ClipType.ctDifference:if(e.PolyTyp==m.PolyType.ptSubject)switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2!==0;case m.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case m.ClipType.ctXor:if(e.WindDelta===0)switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};m.Clipper.prototype.SetWindingCount=function(e){for(var t=e.PrevInAEL;t!==null&&(t.PolyTyp!=e.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,t=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=m.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var i=!0,r=t.PrevInAEL;r!==null;)r.PolyTyp==t.PolyTyp&&r.WindDelta!==0&&(i=!i),r=r.PrevInAEL;e.WindCnt=i?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;t!=e;)t.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=e;)e.WindCnt2+=t.WindDelta,t=t.NextInAEL};m.Clipper.prototype.AddEdgeToSEL=function(e){this.m_SortedEdges===null?(this.m_SortedEdges=e,e.PrevInSEL=null,e.NextInSEL=null):(e.NextInSEL=this.m_SortedEdges,e.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=e,this.m_SortedEdges=e)};m.Clipper.prototype.CopyAELToSEL=function(){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e=e.NextInAEL};m.Clipper.prototype.SwapPositionsInAEL=function(e,t){if(!(e.NextInAEL==e.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(e.NextInAEL==t){var i=t.NextInAEL;i!==null&&(i.PrevInAEL=e);var r=e.PrevInAEL;r!==null&&(r.NextInAEL=t),t.PrevInAEL=r,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=i}else if(t.NextInAEL==e){var i=e.NextInAEL;i!==null&&(i.PrevInAEL=t);var r=t.PrevInAEL;r!==null&&(r.NextInAEL=e),e.PrevInAEL=r,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=i}else{var i=e.NextInAEL,r=e.PrevInAEL;e.NextInAEL=t.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=t.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),t.NextInAEL=i,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=r,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}e.PrevInAEL===null?this.m_ActiveEdges=e:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};m.Clipper.prototype.SwapPositionsInSEL=function(e,t){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(e.NextInSEL==t){var i=t.NextInSEL;i!==null&&(i.PrevInSEL=e);var r=e.PrevInSEL;r!==null&&(r.NextInSEL=t),t.PrevInSEL=r,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=i}else if(t.NextInSEL==e){var i=e.NextInSEL;i!==null&&(i.PrevInSEL=t);var r=t.PrevInSEL;r!==null&&(r.NextInSEL=e),e.PrevInSEL=r,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=i}else{var i=e.NextInSEL,r=e.PrevInSEL;e.NextInSEL=t.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=t.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),t.NextInSEL=i,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=r,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}e.PrevInSEL===null?this.m_SortedEdges=e:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};m.Clipper.prototype.AddLocalMaxPoly=function(e,t,i){this.AddOutPt(e,i),t.WindDelta==0&&this.AddOutPt(t,i),e.OutIdx==t.OutIdx?(e.OutIdx=-1,t.OutIdx=-1):e.OutIdx<t.OutIdx?this.AppendPolygon(e,t):this.AppendPolygon(t,e)};m.Clipper.prototype.AddLocalMinPoly=function(e,t,i){var r,n,a;if(m.ClipperBase.IsHorizontal(t)||e.Dx>t.Dx?(r=this.AddOutPt(e,i),t.OutIdx=e.OutIdx,e.Side=m.EdgeSide.esLeft,t.Side=m.EdgeSide.esRight,n=e,n.PrevInAEL==t?a=t.PrevInAEL:a=n.PrevInAEL):(r=this.AddOutPt(t,i),e.OutIdx=t.OutIdx,e.Side=m.EdgeSide.esRight,t.Side=m.EdgeSide.esLeft,n=t,n.PrevInAEL==e?a=e.PrevInAEL:a=n.PrevInAEL),a!==null&&a.OutIdx>=0&&m.Clipper.TopX(a,i.Y)==m.Clipper.TopX(n,i.Y)&&m.ClipperBase.SlopesEqual(n,a,this.m_UseFullRange)&&n.WindDelta!==0&&a.WindDelta!==0){var o=this.AddOutPt(a,i);this.AddJoin(r,o,n.Top)}return r};m.Clipper.prototype.CreateOutRec=function(){var e=new m.OutRec;return e.Idx=-1,e.IsHole=!1,e.IsOpen=!1,e.FirstLeft=null,e.Pts=null,e.BottomPt=null,e.PolyNode=null,this.m_PolyOuts.push(e),e.Idx=this.m_PolyOuts.length-1,e};m.Clipper.prototype.AddOutPt=function(e,t){var i=e.Side==m.EdgeSide.esLeft;if(e.OutIdx<0){var r=this.CreateOutRec();r.IsOpen=e.WindDelta===0;var n=new m.OutPt;return r.Pts=n,n.Idx=r.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=n,n.Prev=n,r.IsOpen||this.SetHoleState(e,r),On&&(m.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):m.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),e.OutIdx=r.Idx,n}else{var r=this.m_PolyOuts[e.OutIdx],a=r.Pts;if(i&&m.IntPoint.op_Equality(t,a.Pt))return a;if(!i&&m.IntPoint.op_Equality(t,a.Prev.Pt))return a.Prev;var n=new m.OutPt;return n.Idx=r.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=a,n.Prev=a.Prev,n.Prev.Next=n,a.Prev=n,i&&(r.Pts=n),On&&(m.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):m.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),n}};m.Clipper.prototype.SwapPoints=function(e,t){var i=new m.IntPoint(e.Value);e.Value.X=t.Value.X,e.Value.Y=t.Value.Y,t.Value.X=i.X,t.Value.Y=i.Y};m.Clipper.prototype.HorzSegmentsOverlap=function(e,t,i,r){return e.X>i.X==e.X<r.X||t.X>i.X==t.X<r.X||i.X>e.X==i.X<t.X||r.X>e.X==r.X<t.X||e.X==i.X&&t.X==r.X?!0:e.X==r.X&&t.X==i.X};m.Clipper.prototype.InsertPolyPtBetween=function(e,t,i){var r=new m.OutPt;return r.Pt.X=i.X,r.Pt.Y=i.Y,t==e.Next?(e.Next=r,t.Prev=r,r.Next=t,r.Prev=e):(t.Next=r,e.Prev=r,r.Next=e,r.Prev=t),r};m.Clipper.prototype.SetHoleState=function(e,t){for(var i=!1,r=e.PrevInAEL;r!==null;)r.OutIdx>=0&&r.WindDelta!=0&&(i=!i,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[r.OutIdx])),r=r.PrevInAEL;i&&(t.IsHole=!0)};m.Clipper.prototype.GetDx=function(e,t){return e.Y==t.Y?m.ClipperBase.horizontal:(t.X-e.X)/(t.Y-e.Y)};m.Clipper.prototype.FirstIsBottomPt=function(e,t){for(var i=e.Prev;m.IntPoint.op_Equality(i.Pt,e.Pt)&&i!=e;)i=i.Prev;var r=Math.abs(this.GetDx(e.Pt,i.Pt));for(i=e.Next;m.IntPoint.op_Equality(i.Pt,e.Pt)&&i!=e;)i=i.Next;var n=Math.abs(this.GetDx(e.Pt,i.Pt));for(i=t.Prev;m.IntPoint.op_Equality(i.Pt,t.Pt)&&i!=t;)i=i.Prev;var a=Math.abs(this.GetDx(t.Pt,i.Pt));for(i=t.Next;m.IntPoint.op_Equality(i.Pt,t.Pt)&&i!=t;)i=i.Next;var o=Math.abs(this.GetDx(t.Pt,i.Pt));return r>=a&&r>=o||n>=a&&n>=o};m.Clipper.prototype.GetBottomPt=function(e){for(var t=null,i=e.Next;i!=e;)i.Pt.Y>e.Pt.Y?(e=i,t=null):i.Pt.Y==e.Pt.Y&&i.Pt.X<=e.Pt.X&&(i.Pt.X<e.Pt.X?(t=null,e=i):i.Next!=e&&i.Prev!=e&&(t=i)),i=i.Next;if(t!==null)for(;t!=i;)for(this.FirstIsBottomPt(i,t)||(e=t),t=t.Next;m.IntPoint.op_Inequality(t.Pt,e.Pt);)t=t.Next;return e};m.Clipper.prototype.GetLowermostRec=function(e,t){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var i=e.BottomPt,r=t.BottomPt;return i.Pt.Y>r.Pt.Y?e:i.Pt.Y<r.Pt.Y?t:i.Pt.X<r.Pt.X?e:i.Pt.X>r.Pt.X||i.Next==i?t:r.Next==r||this.FirstIsBottomPt(i,r)?e:t};m.Clipper.prototype.Param1RightOfParam2=function(e,t){do if(e=e.FirstLeft,e==t)return!0;while(e!==null);return!1};m.Clipper.prototype.GetOutRec=function(e){for(var t=this.m_PolyOuts[e];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};m.Clipper.prototype.AppendPolygon=function(e,t){var i=this.m_PolyOuts[e.OutIdx],r=this.m_PolyOuts[t.OutIdx],n;this.Param1RightOfParam2(i,r)?n=r:this.Param1RightOfParam2(r,i)?n=i:n=this.GetLowermostRec(i,r);var a=i.Pts,o=a.Prev,s=r.Pts,l=s.Prev,u;e.Side==m.EdgeSide.esLeft?(t.Side==m.EdgeSide.esLeft?(this.ReversePolyPtLinks(s),s.Next=a,a.Prev=s,o.Next=l,l.Prev=o,i.Pts=l):(l.Next=a,a.Prev=l,s.Prev=o,o.Next=s,i.Pts=s),u=m.EdgeSide.esLeft):(t.Side==m.EdgeSide.esRight?(this.ReversePolyPtLinks(s),o.Next=l,l.Prev=o,s.Next=a,a.Prev=s):(o.Next=s,s.Prev=o,a.Prev=l,l.Next=a),u=m.EdgeSide.esRight),i.BottomPt=null,n==r&&(r.FirstLeft!=i&&(i.FirstLeft=r.FirstLeft),i.IsHole=r.IsHole),r.Pts=null,r.BottomPt=null,r.FirstLeft=i;var h=e.OutIdx,c=t.OutIdx;e.OutIdx=-1,t.OutIdx=-1;for(var p=this.m_ActiveEdges;p!==null;){if(p.OutIdx==c){p.OutIdx=h,p.Side=u;break}p=p.NextInAEL}r.Idx=i.Idx};m.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var t,i;t=e;do i=t.Next,t.Next=t.Prev,t.Prev=i,t=i;while(t!=e)}};m.Clipper.SwapSides=function(e,t){var i=e.Side;e.Side=t.Side,t.Side=i};m.Clipper.SwapPolyIndexes=function(e,t){var i=e.OutIdx;e.OutIdx=t.OutIdx,t.OutIdx=i};m.Clipper.prototype.IntersectEdges=function(e,t,i,r){var n=!r&&e.NextInLML===null&&e.Top.X==i.X&&e.Top.Y==i.Y,a=!r&&t.NextInLML===null&&t.Top.X==i.X&&t.Top.Y==i.Y,o=e.OutIdx>=0,s=t.OutIdx>=0;if(S1&&(e.WindDelta===0||t.WindDelta===0)){e.WindDelta===0&&t.WindDelta===0?(n||a)&&o&&s&&this.AddLocalMaxPoly(e,t,i):e.PolyTyp==t.PolyTyp&&e.WindDelta!=t.WindDelta&&this.m_ClipType==m.ClipType.ctUnion?e.WindDelta===0?s&&(this.AddOutPt(e,i),o&&(e.OutIdx=-1)):o&&(this.AddOutPt(t,i),s&&(t.OutIdx=-1)):e.PolyTyp!=t.PolyTyp&&(e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=m.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(e,i),o&&(e.OutIdx=-1)):t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=m.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(t,i),s&&(t.OutIdx=-1))),n&&(e.OutIdx<0?this.DeleteFromAEL(e):m.Error("Error intersecting polylines")),a&&(t.OutIdx<0?this.DeleteFromAEL(t):m.Error("Error intersecting polylines"));return}if(e.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(e)){var l=e.WindCnt;e.WindCnt=t.WindCnt,t.WindCnt=l}else e.WindCnt+t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=t.WindDelta,t.WindCnt-e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=e.WindDelta;var u,h,c,p;e.PolyTyp==m.PolyType.ptSubject?(u=this.m_SubjFillType,c=this.m_ClipFillType):(u=this.m_ClipFillType,c=this.m_SubjFillType),t.PolyTyp==m.PolyType.ptSubject?(h=this.m_SubjFillType,p=this.m_ClipFillType):(h=this.m_ClipFillType,p=this.m_SubjFillType);var d,f;switch(u){case m.PolyFillType.pftPositive:d=e.WindCnt;break;case m.PolyFillType.pftNegative:d=-e.WindCnt;break;default:d=Math.abs(e.WindCnt);break}switch(h){case m.PolyFillType.pftPositive:f=t.WindCnt;break;case m.PolyFillType.pftNegative:f=-t.WindCnt;break;default:f=Math.abs(t.WindCnt);break}if(o&&s)n||a||d!==0&&d!=1||f!==0&&f!=1||e.PolyTyp!=t.PolyTyp&&this.m_ClipType!=m.ClipType.ctXor?this.AddLocalMaxPoly(e,t,i):(this.AddOutPt(e,i),this.AddOutPt(t,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if(o)(f===0||f==1)&&(this.AddOutPt(e,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if(s)(d===0||d==1)&&(this.AddOutPt(t,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if((d===0||d==1)&&(f===0||f==1)&&!n&&!a){var y,g;switch(c){case m.PolyFillType.pftPositive:y=e.WindCnt2;break;case m.PolyFillType.pftNegative:y=-e.WindCnt2;break;default:y=Math.abs(e.WindCnt2);break}switch(p){case m.PolyFillType.pftPositive:g=t.WindCnt2;break;case m.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(e.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(e,t,i);else if(d==1&&f==1)switch(this.m_ClipType){case m.ClipType.ctIntersection:y>0&&g>0&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctUnion:y<=0&&g<=0&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctDifference:(e.PolyTyp==m.PolyType.ptClip&&y>0&&g>0||e.PolyTyp==m.PolyType.ptSubject&&y<=0&&g<=0)&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctXor:this.AddLocalMinPoly(e,t,i);break}else m.Clipper.SwapSides(e,t)}n!=a&&(n&&e.OutIdx>=0||a&&t.OutIdx>=0)&&(m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t)),n&&this.DeleteFromAEL(e),a&&this.DeleteFromAEL(t)};m.Clipper.prototype.DeleteFromAEL=function(e){var t=e.PrevInAEL,i=e.NextInAEL;t===null&&i===null&&e!=this.m_ActiveEdges||(t!==null?t.NextInAEL=i:this.m_ActiveEdges=i,i!==null&&(i.PrevInAEL=t),e.NextInAEL=null,e.PrevInAEL=null)};m.Clipper.prototype.DeleteFromSEL=function(e){var t=e.PrevInSEL,i=e.NextInSEL;t===null&&i===null&&e!=this.m_SortedEdges||(t!==null?t.NextInSEL=i:this.m_SortedEdges=i,i!==null&&(i.PrevInSEL=t),e.NextInSEL=null,e.PrevInSEL=null)};m.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&m.Error("UpdateEdgeIntoAEL: invalid call");var t=e.PrevInAEL,i=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,t!==null?t.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,i!==null&&(i.PrevInAEL=e.NextInLML),e.NextInLML.Side=e.Side,e.NextInLML.WindDelta=e.WindDelta,e.NextInLML.WindCnt=e.WindCnt,e.NextInLML.WindCnt2=e.WindCnt2,e=e.NextInLML,e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.PrevInAEL=t,e.NextInAEL=i,m.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};m.Clipper.prototype.ProcessHorizontals=function(e){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,e),t=this.m_SortedEdges};m.Clipper.prototype.GetHorzDirection=function(e,t){e.Bot.X<e.Top.X?(t.Left=e.Bot.X,t.Right=e.Top.X,t.Dir=m.Direction.dLeftToRight):(t.Left=e.Top.X,t.Right=e.Bot.X,t.Dir=m.Direction.dRightToLeft)};m.Clipper.prototype.PrepareHorzJoins=function(e,t){var i=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=m.EdgeSide.esLeft&&(i=i.Prev),t&&(m.IntPoint.op_Equality(i.Pt,e.Top)?this.AddGhostJoin(i,e.Bot):this.AddGhostJoin(i,e.Top))};m.Clipper.prototype.ProcessHorizontal=function(e,t){var i={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,i);for(var r=i.Dir,n=i.Left,a=i.Right,o=e,s=null;o.NextInLML!==null&&m.ClipperBase.IsHorizontal(o.NextInLML);)o=o.NextInLML;for(o.NextInLML===null&&(s=this.GetMaximaPair(o));;){for(var l=e==o,u=this.GetNextInAEL(e,r);u!==null&&!(u.Curr.X==e.Top.X&&e.NextInLML!==null&&u.Dx<e.NextInLML.Dx);){var h=this.GetNextInAEL(u,r);if(r==m.Direction.dLeftToRight&&u.Curr.X<=a||r==m.Direction.dRightToLeft&&u.Curr.X>=n){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,t),u==s&&l){r==m.Direction.dLeftToRight?this.IntersectEdges(e,u,u.Top,!1):this.IntersectEdges(u,e,u.Top,!1),s.OutIdx>=0&&m.Error("ProcessHorizontal error");return}else if(r==m.Direction.dLeftToRight){var c=new m.IntPoint(u.Curr.X,e.Curr.Y);this.IntersectEdges(e,u,c,!0)}else{var c=new m.IntPoint(u.Curr.X,e.Curr.Y);this.IntersectEdges(u,e,c,!0)}this.SwapPositionsInAEL(e,u)}else if(r==m.Direction.dLeftToRight&&u.Curr.X>=a||r==m.Direction.dRightToLeft&&u.Curr.X<=n)break;u=h}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,t),e.NextInLML!==null&&m.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var i={Dir:r,Left:n,Right:a};this.GetHorzDirection(e,i),r=i.Dir,n=i.Left,a=i.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var p=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var d=e.PrevInAEL,h=e.NextInAEL;if(d!==null&&d.Curr.X==e.Bot.X&&d.Curr.Y==e.Bot.Y&&d.WindDelta!==0&&d.OutIdx>=0&&d.Curr.Y>d.Top.Y&&m.ClipperBase.SlopesEqual(e,d,this.m_UseFullRange)){var f=this.AddOutPt(d,e.Bot);this.AddJoin(p,f,e.Top)}else if(h!==null&&h.Curr.X==e.Bot.X&&h.Curr.Y==e.Bot.Y&&h.WindDelta!==0&&h.OutIdx>=0&&h.Curr.Y>h.Top.Y&&m.ClipperBase.SlopesEqual(e,h,this.m_UseFullRange)){var f=this.AddOutPt(h,e.Bot);this.AddJoin(p,f,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else s!==null?s.OutIdx>=0?(r==m.Direction.dLeftToRight?this.IntersectEdges(e,s,e.Top,!1):this.IntersectEdges(s,e,e.Top,!1),s.OutIdx>=0&&m.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(s)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};m.Clipper.prototype.GetNextInAEL=function(e,t){return t==m.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};m.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};m.Clipper.prototype.IsMaxima=function(e,t){return e!==null&&e.Top.Y==t&&e.NextInLML===null};m.Clipper.prototype.IsIntermediate=function(e,t){return e.Top.Y==t&&e.NextInLML!==null};m.Clipper.prototype.GetMaximaPair=function(e){var t=null;return m.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?t=e.Next:m.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(t=e.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!m.ClipperBase.IsHorizontal(t))?null:t};m.Clipper.prototype.ProcessIntersections=function(e,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch(i){this.m_SortedEdges=null,this.m_IntersectList.length=0,m.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};m.Clipper.prototype.BuildIntersectList=function(e,t){if(this.m_ActiveEdges!==null){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;i!==null;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=m.Clipper.TopX(i,t),i=i.NextInAEL;for(var r=!0;r&&this.m_SortedEdges!==null;){for(r=!1,i=this.m_SortedEdges;i.NextInSEL!==null;){var n=i.NextInSEL,a=new m.IntPoint;if(i.Curr.X>n.Curr.X){!this.IntersectPoint(i,n,a)&&i.Curr.X>n.Curr.X+1&&m.Error("Intersection error"),a.Y>e&&(a.Y=e,Math.abs(i.Dx)>Math.abs(n.Dx)?a.X=m.Clipper.TopX(n,e):a.X=m.Clipper.TopX(i,e));var o=new m.IntersectNode;o.Edge1=i,o.Edge2=n,o.Pt.X=a.X,o.Pt.Y=a.Y,this.m_IntersectList.push(o),this.SwapPositionsInSEL(i,n),r=!0}else i=n}if(i.PrevInSEL!==null)i.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};m.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};m.Clipper.IntersectNodeSort=function(e,t){return t.Pt.Y-e.Pt.Y};m.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,t=0;t<e;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var i=t+1;i<e&&!this.EdgesAdjacent(this.m_IntersectList[i]);)i++;if(i==e)return!1;var r=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[i],this.m_IntersectList[i]=r}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};m.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,t=this.m_IntersectList.length;e<t;e++){var i=this.m_IntersectList[e];this.IntersectEdges(i.Edge1,i.Edge2,i.Pt,!0),this.SwapPositionsInAEL(i.Edge1,i.Edge2)}this.m_IntersectList.length=0};var BV=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},OV=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},FV=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},NV=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};Te.msie?m.Clipper.Round=BV:Te.chromium?m.Clipper.Round=FV:Te.safari?m.Clipper.Round=NV:m.Clipper.Round=OV;m.Clipper.TopX=function(e,t){return t==e.Top.Y?e.Top.X:e.Bot.X+m.Clipper.Round(e.Dx*(t-e.Bot.Y))};m.Clipper.prototype.IntersectPoint=function(e,t,i){i.X=0,i.Y=0;var r,n;if(m.ClipperBase.SlopesEqual(e,t,this.m_UseFullRange)||e.Dx==t.Dx)return t.Bot.Y>e.Bot.Y?(i.X=t.Bot.X,i.Y=t.Bot.Y):(i.X=e.Bot.X,i.Y=e.Bot.Y),!1;if(e.Delta.X===0)i.X=e.Bot.X,m.ClipperBase.IsHorizontal(t)?i.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,i.Y=m.Clipper.Round(i.X/t.Dx+n));else if(t.Delta.X===0)i.X=t.Bot.X,m.ClipperBase.IsHorizontal(e)?i.Y=e.Bot.Y:(r=e.Bot.Y-e.Bot.X/e.Dx,i.Y=m.Clipper.Round(i.X/e.Dx+r));else{r=e.Bot.X-e.Bot.Y*e.Dx,n=t.Bot.X-t.Bot.Y*t.Dx;var a=(n-r)/(e.Dx-t.Dx);i.Y=m.Clipper.Round(a),Math.abs(e.Dx)<Math.abs(t.Dx)?i.X=m.Clipper.Round(e.Dx*a+r):i.X=m.Clipper.Round(t.Dx*a+n)}if(i.Y<e.Top.Y||i.Y<t.Top.Y){if(e.Top.Y>t.Top.Y)return i.Y=e.Top.Y,i.X=m.Clipper.TopX(t,e.Top.Y),i.X<e.Top.X;i.Y=t.Top.Y,Math.abs(e.Dx)<Math.abs(t.Dx)?i.X=m.Clipper.TopX(e,i.Y):i.X=m.Clipper.TopX(t,i.Y)}return!0};m.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var t=this.m_ActiveEdges;t!==null;){var i=this.IsMaxima(t,e);if(i){var r=this.GetMaximaPair(t);i=r===null||!m.ClipperBase.IsHorizontal(r)}if(i){var n=t.PrevInAEL;this.DoMaxima(t),n===null?t=this.m_ActiveEdges:t=n.NextInAEL}else{if(this.IsIntermediate(t,e)&&m.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=m.Clipper.TopX(t,e),t.Curr.Y=e),this.StrictlySimple){var n=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==t.Curr.X&&n.WindDelta!==0){var a=this.AddOutPt(n,t.Curr),o=this.AddOutPt(t,t.Curr);this.AddJoin(a,o,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,e)){var a=null;t.OutIdx>=0&&(a=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var n=t.PrevInAEL,s=t.NextInAEL;if(n!==null&&n.Curr.X==t.Bot.X&&n.Curr.Y==t.Bot.Y&&a!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&m.ClipperBase.SlopesEqual(t,n,this.m_UseFullRange)&&t.WindDelta!==0&&n.WindDelta!==0){var o=this.AddOutPt(n,t.Bot);this.AddJoin(a,o,t.Top)}else if(s!==null&&s.Curr.X==t.Bot.X&&s.Curr.Y==t.Bot.Y&&a!==null&&s.OutIdx>=0&&s.Curr.Y>s.Top.Y&&m.ClipperBase.SlopesEqual(t,s,this.m_UseFullRange)&&t.WindDelta!==0&&s.WindDelta!==0){var o=this.AddOutPt(s,t.Bot);this.AddJoin(a,o,t.Top)}}t=t.NextInAEL}};m.Clipper.prototype.DoMaxima=function(e){var t=this.GetMaximaPair(e);if(t===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var i=e.NextInAEL,r=!0;i!==null&&i!=t;)this.IntersectEdges(e,i,e.Top,!0),this.SwapPositionsInAEL(e,i),i=e.NextInAEL;e.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(t)):e.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(e,t,e.Top,!1):r&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),t.OutIdx>=0&&(this.AddOutPt(t,e.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):m.Error("DoMaxima error")};m.Clipper.ReversePaths=function(e){for(var t=0,i=e.length;t<i;t++)e[t].reverse()};m.Clipper.Orientation=function(e){return m.Clipper.Area(e)>=0};m.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var t=0,i=e;do t++,i=i.Next;while(i!=e);return t};m.Clipper.prototype.BuildResult=function(e){m.Clear(e);for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t];if(r.Pts!==null){var n=r.Pts.Prev,a=this.PointCount(n);if(!(a<2)){for(var o=new Array(a),s=0;s<a;s++)o[s]=n.Pt,n=n.Prev;e.push(o)}}}};m.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t],n=this.PointCount(r.Pts);if(!(r.IsOpen&&n<2||!r.IsOpen&&n<3)){this.FixHoleLinkage(r);var a=new m.PolyNode;e.m_AllPolys.push(a),r.PolyNode=a,a.m_polygon.length=n;for(var o=r.Pts.Prev,s=0;s<n;s++)a.m_polygon[s]=o.Pt,o=o.Prev}}for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t];r.PolyNode!==null&&(r.IsOpen?(r.PolyNode.IsOpen=!0,e.AddChild(r.PolyNode)):r.FirstLeft!==null&&r.FirstLeft.PolyNode!=null?r.FirstLeft.PolyNode.AddChild(r.PolyNode):e.AddChild(r.PolyNode))}};m.Clipper.prototype.FixupOutPolygon=function(e){var t=null;e.BottomPt=null;for(var i=e.Pts;;){if(i.Prev==i||i.Prev==i.Next){this.DisposeOutPts(i),e.Pts=null;return}if(m.IntPoint.op_Equality(i.Pt,i.Next.Pt)||m.IntPoint.op_Equality(i.Pt,i.Prev.Pt)||m.ClipperBase.SlopesEqual(i.Prev.Pt,i.Pt,i.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(i.Prev.Pt,i.Pt,i.Next.Pt))){t=null;var r=i;i.Prev.Next=i.Next,i.Next.Prev=i.Prev,i=i.Prev,r=null}else{if(i==t)break;t===null&&(t=i),i=i.Next}}e.Pts=i};m.Clipper.prototype.DupOutPt=function(e,t){var i=new m.OutPt;return i.Pt.X=e.Pt.X,i.Pt.Y=e.Pt.Y,i.Idx=e.Idx,t?(i.Next=e.Next,i.Prev=e,e.Next.Prev=i,e.Next=i):(i.Prev=e.Prev,i.Next=e,e.Prev.Next=i,e.Prev=i),i};m.Clipper.prototype.GetOverlap=function(e,t,i,r,n){return e<t?i<r?(n.Left=Math.max(e,i),n.Right=Math.min(t,r)):(n.Left=Math.max(e,r),n.Right=Math.min(t,i)):i<r?(n.Left=Math.max(t,i),n.Right=Math.min(e,r)):(n.Left=Math.max(t,r),n.Right=Math.min(e,i)),n.Left<n.Right};m.Clipper.prototype.JoinHorz=function(e,t,i,r,n,a){var o=e.Pt.X>t.Pt.X?m.Direction.dRightToLeft:m.Direction.dLeftToRight,s=i.Pt.X>r.Pt.X?m.Direction.dRightToLeft:m.Direction.dLeftToRight;if(o==s)return!1;if(o==m.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;a&&e.Pt.X!=n.X&&(e=e.Next),t=this.DupOutPt(e,!a),m.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=this.DupOutPt(e,!a))}else{for(;e.Next.Pt.X>=n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;!a&&e.Pt.X!=n.X&&(e=e.Next),t=this.DupOutPt(e,a),m.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=this.DupOutPt(e,a))}if(s==m.Direction.dLeftToRight){for(;i.Next.Pt.X<=n.X&&i.Next.Pt.X>=i.Pt.X&&i.Next.Pt.Y==n.Y;)i=i.Next;a&&i.Pt.X!=n.X&&(i=i.Next),r=this.DupOutPt(i,!a),m.IntPoint.op_Inequality(r.Pt,n)&&(i=r,i.Pt.X=n.X,i.Pt.Y=n.Y,r=this.DupOutPt(i,!a))}else{for(;i.Next.Pt.X>=n.X&&i.Next.Pt.X<=i.Pt.X&&i.Next.Pt.Y==n.Y;)i=i.Next;!a&&i.Pt.X!=n.X&&(i=i.Next),r=this.DupOutPt(i,a),m.IntPoint.op_Inequality(r.Pt,n)&&(i=r,i.Pt.X=n.X,i.Pt.Y=n.Y,r=this.DupOutPt(i,a))}return o==m.Direction.dLeftToRight==a?(e.Prev=i,i.Next=e,t.Next=r,r.Prev=t):(e.Next=i,i.Prev=e,t.Prev=r,r.Next=t),!0};m.Clipper.prototype.JoinPoints=function(e,t,i){var r=e.OutPt1,n=new m.OutPt,a=e.OutPt2,o=new m.OutPt,s=e.OutPt1.Pt.Y==e.OffPt.Y;if(s&&m.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&m.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(n=e.OutPt1.Next;n!=r&&m.IntPoint.op_Equality(n.Pt,e.OffPt);)n=n.Next;var l=n.Pt.Y>e.OffPt.Y;for(o=e.OutPt2.Next;o!=a&&m.IntPoint.op_Equality(o.Pt,e.OffPt);)o=o.Next;var u=o.Pt.Y>e.OffPt.Y;return l==u?!1:l?(n=this.DupOutPt(r,!1),o=this.DupOutPt(a,!0),r.Prev=a,a.Next=r,n.Next=o,o.Prev=n,e.OutPt1=r,e.OutPt2=n,!0):(n=this.DupOutPt(r,!0),o=this.DupOutPt(a,!1),r.Next=a,a.Prev=r,n.Prev=o,o.Next=n,e.OutPt1=r,e.OutPt2=n,!0)}else if(s){for(n=r;r.Prev.Pt.Y==r.Pt.Y&&r.Prev!=n&&r.Prev!=a;)r=r.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=r&&n.Next!=a;)n=n.Next;if(n.Next==r||n.Next==a)return!1;for(o=a;a.Prev.Pt.Y==a.Pt.Y&&a.Prev!=o&&a.Prev!=n;)a=a.Prev;for(;o.Next.Pt.Y==o.Pt.Y&&o.Next!=a&&o.Next!=r;)o=o.Next;if(o.Next==a||o.Next==r)return!1;var h={Left:null,Right:null};if(!this.GetOverlap(r.Pt.X,n.Pt.X,a.Pt.X,o.Pt.X,h))return!1;var c=h.Left,p=h.Right,d=new m.IntPoint,f;return r.Pt.X>=c&&r.Pt.X<=p?(d.X=r.Pt.X,d.Y=r.Pt.Y,f=r.Pt.X>n.Pt.X):a.Pt.X>=c&&a.Pt.X<=p?(d.X=a.Pt.X,d.Y=a.Pt.Y,f=a.Pt.X>o.Pt.X):n.Pt.X>=c&&n.Pt.X<=p?(d.X=n.Pt.X,d.Y=n.Pt.Y,f=n.Pt.X>r.Pt.X):(d.X=o.Pt.X,d.Y=o.Pt.Y,f=o.Pt.X>a.Pt.X),e.OutPt1=r,e.OutPt2=a,this.JoinHorz(r,n,a,o,d,f)}else{for(n=r.Next;m.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Next;var y=n.Pt.Y>r.Pt.Y||!m.ClipperBase.SlopesEqual(r.Pt,n.Pt,e.OffPt,this.m_UseFullRange);if(y){for(n=r.Prev;m.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Prev;if(n.Pt.Y>r.Pt.Y||!m.ClipperBase.SlopesEqual(r.Pt,n.Pt,e.OffPt,this.m_UseFullRange))return!1}for(o=a.Next;m.IntPoint.op_Equality(o.Pt,a.Pt)&&o!=a;)o=o.Next;var g=o.Pt.Y>a.Pt.Y||!m.ClipperBase.SlopesEqual(a.Pt,o.Pt,e.OffPt,this.m_UseFullRange);if(g){for(o=a.Prev;m.IntPoint.op_Equality(o.Pt,a.Pt)&&o!=a;)o=o.Prev;if(o.Pt.Y>a.Pt.Y||!m.ClipperBase.SlopesEqual(a.Pt,o.Pt,e.OffPt,this.m_UseFullRange))return!1}return n==r||o==a||n==o||t==i&&y==g?!1:y?(n=this.DupOutPt(r,!1),o=this.DupOutPt(a,!0),r.Prev=a,a.Next=r,n.Next=o,o.Prev=n,e.OutPt1=r,e.OutPt2=n,!0):(n=this.DupOutPt(r,!0),o=this.DupOutPt(a,!1),r.Next=a,a.Prev=r,n.Prev=o,o.Next=n,e.OutPt1=r,e.OutPt2=n,!0)}};m.Clipper.GetBounds=function(e){for(var t=0,i=e.length;t<i&&e[t].length==0;)t++;if(t==i)return new m.IntRect(0,0,0,0);var r=new m.IntRect;for(r.left=e[t][0].X,r.right=r.left,r.top=e[t][0].Y,r.bottom=r.top;t<i;t++)for(var n=0,a=e[t].length;n<a;n++)e[t][n].X<r.left?r.left=e[t][n].X:e[t][n].X>r.right&&(r.right=e[t][n].X),e[t][n].Y<r.top?r.top=e[t][n].Y:e[t][n].Y>r.bottom&&(r.bottom=e[t][n].Y);return r};m.Clipper.prototype.GetBounds2=function(e){var t=e,i=new m.IntRect;for(i.left=e.Pt.X,i.right=e.Pt.X,i.top=e.Pt.Y,i.bottom=e.Pt.Y,e=e.Next;e!=t;)e.Pt.X<i.left&&(i.left=e.Pt.X),e.Pt.X>i.right&&(i.right=e.Pt.X),e.Pt.Y<i.top&&(i.top=e.Pt.Y),e.Pt.Y>i.bottom&&(i.bottom=e.Pt.Y),e=e.Next;return i};m.Clipper.PointInPolygon=function(e,t){var i=0,r=t.length;if(r<3)return 0;for(var n=t[0],a=1;a<=r;++a){var o=a==r?t[0]:t[a];if(o.Y==e.Y&&(o.X==e.X||n.Y==e.Y&&o.X>e.X==n.X<e.X))return-1;if(n.Y<e.Y!=o.Y<e.Y){if(n.X>=e.X)if(o.X>e.X)i=1-i;else{var s=(n.X-e.X)*(o.Y-e.Y)-(o.X-e.X)*(n.Y-e.Y);if(s==0)return-1;s>0==o.Y>n.Y&&(i=1-i)}else if(o.X>e.X){var s=(n.X-e.X)*(o.Y-e.Y)-(o.X-e.X)*(n.Y-e.Y);if(s==0)return-1;s>0==o.Y>n.Y&&(i=1-i)}}n=o}return i};m.Clipper.prototype.PointInPolygon=function(e,t){for(var i=0,r=t;;){var n=t.Pt.X,a=t.Pt.Y,o=t.Next.Pt.X,s=t.Next.Pt.Y;if(s==e.Y&&(o==e.X||a==e.Y&&o>e.X==n<e.X))return-1;if(a<e.Y!=s<e.Y){if(n>=e.X)if(o>e.X)i=1-i;else{var l=(n-e.X)*(s-e.Y)-(o-e.X)*(a-e.Y);if(l==0)return-1;l>0==s>a&&(i=1-i)}else if(o>e.X){var l=(n-e.X)*(s-e.Y)-(o-e.X)*(a-e.Y);if(l==0)return-1;l>0==s>a&&(i=1-i)}}if(t=t.Next,r==t)break}return i};m.Clipper.prototype.Poly2ContainsPoly1=function(e,t){var i=e;do{var r=this.PointInPolygon(i.Pt,t);if(r>=0)return r!=0;i=i.Next}while(i!=e);return!0};m.Clipper.prototype.FixupFirstLefts1=function(e,t){for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts!==null&&n.FirstLeft==e&&this.Poly2ContainsPoly1(n.Pts,t.Pts)&&(n.FirstLeft=t)}};m.Clipper.prototype.FixupFirstLefts2=function(e,t){for(var i=0,r=this.m_PolyOuts,n=r.length,a=r[i];i<n;i++,a=r[i])a.FirstLeft==e&&(a.FirstLeft=t)};m.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};m.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,t=this.m_Joins.length;e<t;e++){var i=this.m_Joins[e],r=this.GetOutRec(i.OutPt1.Idx),n=this.GetOutRec(i.OutPt2.Idx);if(!(r.Pts==null||n.Pts==null)){var a;if(r==n?a=r:this.Param1RightOfParam2(r,n)?a=n:this.Param1RightOfParam2(n,r)?a=r:a=this.GetLowermostRec(r,n),!!this.JoinPoints(i,r,n))if(r==n){if(r.Pts=i.OutPt1,r.BottomPt=null,n=this.CreateOutRec(),n.Pts=i.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var o=0,s=this.m_PolyOuts.length;o<s-1;o++){var l=this.m_PolyOuts[o];l.Pts==null||m.Clipper.ParseFirstLeft(l.FirstLeft)!=r||l.IsHole==r.IsHole||this.Poly2ContainsPoly1(l.Pts,i.OutPt2)&&(l.FirstLeft=n)}this.Poly2ContainsPoly1(n.Pts,r.Pts)?(n.IsHole=!r.IsHole,n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(r.Pts,n.Pts)?(n.IsHole=r.IsHole,r.IsHole=!n.IsHole,n.FirstLeft=r.FirstLeft,r.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(r,n),(r.IsHole^this.ReverseSolution)==this.Area(r)>0&&this.ReversePolyPtLinks(r.Pts)):(n.IsHole=r.IsHole,n.FirstLeft=r.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(r,n))}else n.Pts=null,n.BottomPt=null,n.Idx=r.Idx,r.IsHole=a.IsHole,a==n&&(r.FirstLeft=n.FirstLeft),n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r)}}};m.Clipper.prototype.UpdateOutPtIdxs=function(e){var t=e.Pts;do t.Idx=e.Idx,t=t.Prev;while(t!=e.Pts)};m.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var t=this.m_PolyOuts[e++],i=t.Pts;if(i!==null)do{for(var r=i.Next;r!=t.Pts;){if(m.IntPoint.op_Equality(i.Pt,r.Pt)&&r.Next!=i&&r.Prev!=i){var n=i.Prev,a=r.Prev;i.Prev=a,a.Next=i,r.Prev=n,n.Next=r,t.Pts=i;var o=this.CreateOutRec();o.Pts=r,this.UpdateOutPtIdxs(o),this.Poly2ContainsPoly1(o.Pts,t.Pts)?(o.IsHole=!t.IsHole,o.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,o.Pts)?(o.IsHole=t.IsHole,t.IsHole=!o.IsHole,o.FirstLeft=t.FirstLeft,t.FirstLeft=o):(o.IsHole=t.IsHole,o.FirstLeft=t.FirstLeft),r=i}r=r.Next}i=i.Next}while(i!=t.Pts)}};m.Clipper.Area=function(e){var t=e.length;if(t<3)return 0;for(var i=0,r=0,n=t-1;r<t;++r)i+=(e[n].X+e[r].X)*(e[n].Y-e[r].Y),n=r;return-i*.5};m.Clipper.prototype.Area=function(e){var t=e.Pts;if(t==null)return 0;var i=0;do i=i+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=e.Pts);return i*.5};C1&&(m.Clipper.OffsetPaths=function(e,t,i,r,n){var a=new m.Paths,o=new m.ClipperOffset(n,n);return o.AddPaths(e,i,r),o.Execute(a,t),a});m.Clipper.SimplifyPolygon=function(e,t){var i=new Array,r=new m.Clipper(0);return r.StrictlySimple=!0,r.AddPath(e,m.PolyType.ptSubject,!0),r.Execute(m.ClipType.ctUnion,i,t,t),i};m.Clipper.SimplifyPolygons=function(e,t){typeof t>"u"&&(t=m.PolyFillType.pftEvenOdd);var i=new Array,r=new m.Clipper(0);return r.StrictlySimple=!0,r.AddPaths(e,m.PolyType.ptSubject,!0),r.Execute(m.ClipType.ctUnion,i,t,t),i};m.Clipper.DistanceSqrd=function(e,t){var i=e.X-t.X,r=e.Y-t.Y;return i*i+r*r};m.Clipper.DistanceFromLineSqrd=function(e,t,i){var r=t.Y-i.Y,n=i.X-t.X,a=r*t.X+n*t.Y;return a=r*e.X+n*e.Y-a,a*a/(r*r+n*n)};m.Clipper.SlopesNearCollinear=function(e,t,i,r){return m.Clipper.DistanceFromLineSqrd(t,e,i)<r};m.Clipper.PointsAreClose=function(e,t,i){var r=e.X-t.X,n=e.Y-t.Y;return r*r+n*n<=i};m.Clipper.ExcludeOp=function(e){var t=e.Prev;return t.Next=e.Next,e.Next.Prev=t,t.Idx=0,t};m.Clipper.CleanPolygon=function(e,t){typeof t>"u"&&(t=1.415);var i=e.length;if(i==0)return new Array;for(var r=new Array(i),n=0;n<i;++n)r[n]=new m.OutPt;for(var n=0;n<i;++n)r[n].Pt=e[n],r[n].Next=r[(n+1)%i],r[n].Next.Prev=r[n],r[n].Idx=0;for(var a=t*t,o=r[0];o.Idx==0&&o.Next!=o.Prev;)m.Clipper.PointsAreClose(o.Pt,o.Prev.Pt,a)?(o=m.Clipper.ExcludeOp(o),i--):m.Clipper.PointsAreClose(o.Prev.Pt,o.Next.Pt,a)?(m.Clipper.ExcludeOp(o.Next),o=m.Clipper.ExcludeOp(o),i-=2):m.Clipper.SlopesNearCollinear(o.Prev.Pt,o.Pt,o.Next.Pt,a)?(o=m.Clipper.ExcludeOp(o),i--):(o.Idx=1,o=o.Next);i<3&&(i=0);for(var s=new Array(i),n=0;n<i;++n)s[n]=new m.IntPoint(o.Pt),o=o.Next;return r=null,s};m.Clipper.CleanPolygons=function(e,t){for(var i=new Array(e.length),r=0,n=e.length;r<n;r++)i[r]=m.Clipper.CleanPolygon(e[r],t);return i};m.Clipper.Minkowski=function(e,t,i,r){var n=r?1:0,a=e.length,o=t.length,s=new Array;if(i)for(var l=0;l<o;l++){for(var u=new Array(a),h=0,c=e.length,p=e[h];h<c;h++,p=e[h])u[h]=new m.IntPoint(t[l].X+p.X,t[l].Y+p.Y);s.push(u)}else for(var l=0;l<o;l++){for(var u=new Array(a),h=0,c=e.length,p=e[h];h<c;h++,p=e[h])u[h]=new m.IntPoint(t[l].X-p.X,t[l].Y-p.Y);s.push(u)}for(var d=new Array,l=0;l<o-1+n;l++)for(var h=0;h<a;h++){var f=new Array;f.push(s[l%o][h%a]),f.push(s[(l+1)%o][h%a]),f.push(s[(l+1)%o][(h+1)%a]),f.push(s[l%o][(h+1)%a]),m.Clipper.Orientation(f)||f.reverse(),d.push(f)}var y=new m.Clipper(0);return y.AddPaths(d,m.PolyType.ptSubject,!0),y.Execute(m.ClipType.ctUnion,s,m.PolyFillType.pftNonZero,m.PolyFillType.pftNonZero),s};m.Clipper.MinkowskiSum=function(){var e=arguments,t=e.length;if(t==3){var i=e[0],r=e[1],n=e[2];return m.Clipper.Minkowski(i,r,!0,n)}else if(t==4){for(var i=e[0],a=e[1],o=e[2],n=e[3],s=new m.Clipper,l,u=0,h=a.length;u<h;++u){var l=m.Clipper.Minkowski(i,a[u],!0,n);s.AddPaths(l,m.PolyType.ptSubject,!0)}n&&s.AddPaths(a,m.PolyType.ptClip,!0);var c=new m.Paths;return s.Execute(m.ClipType.ctUnion,c,o,o),c}};m.Clipper.MinkowskiDiff=function(e,t,i){return m.Clipper.Minkowski(e,t,!1,i)};m.Clipper.PolyTreeToPaths=function(e){var t=new Array;return m.Clipper.AddPolyNodeToPaths(e,m.Clipper.NodeType.ntAny,t),t};m.Clipper.AddPolyNodeToPaths=function(e,t,i){var r=!0;switch(t){case m.Clipper.NodeType.ntOpen:return;case m.Clipper.NodeType.ntClosed:r=!e.IsOpen;break;default:break}e.m_polygon.length>0&&r&&i.push(e.m_polygon);for(var n=0,a=e.Childs(),o=a.length,s=a[n];n<o;n++,s=a[n])m.Clipper.AddPolyNodeToPaths(s,t,i)};m.Clipper.OpenPathsFromPolyTree=function(e){for(var t=new m.Paths,i=0,r=e.ChildCount();i<r;i++)e.Childs()[i].IsOpen&&t.push(e.Childs()[i].m_polygon);return t};m.Clipper.ClosedPathsFromPolyTree=function(e){var t=new m.Paths;return m.Clipper.AddPolyNodeToPaths(e,m.Clipper.NodeType.ntClosed,t),t};hh(m.Clipper,m.ClipperBase);m.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};m.ClipperOffset=function(e,t){typeof e>"u"&&(e=2),typeof t>"u"&&(t=m.ClipperOffset.def_arc_tolerance),this.m_destPolys=new m.Paths,this.m_srcPoly=new m.Path,this.m_destPoly=new m.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new m.IntPoint,this.m_polyNodes=new m.PolyNode,this.MiterLimit=e,this.ArcTolerance=t,this.m_lowest.X=-1};m.ClipperOffset.two_pi=6.28318530717959;m.ClipperOffset.def_arc_tolerance=.25;m.ClipperOffset.prototype.Clear=function(){m.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};m.ClipperOffset.Round=m.Clipper.Round;m.ClipperOffset.prototype.AddPath=function(e,t,i){var r=e.length-1;if(!(r<0)){var n=new m.PolyNode;if(n.m_jointype=t,n.m_endtype=i,i==m.EndType.etClosedLine||i==m.EndType.etClosedPolygon)for(;r>0&&m.IntPoint.op_Equality(e[0],e[r]);)r--;n.m_polygon.push(e[0]);for(var a=0,o=0,s=1;s<=r;s++)m.IntPoint.op_Inequality(n.m_polygon[a],e[s])&&(a++,n.m_polygon.push(e[s]),(e[s].Y>n.m_polygon[o].Y||e[s].Y==n.m_polygon[o].Y&&e[s].X<n.m_polygon[o].X)&&(o=a));if(!(i==m.EndType.etClosedPolygon&&a<2||i!=m.EndType.etClosedPolygon&&a<0)&&(this.m_polyNodes.AddChild(n),i==m.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new m.IntPoint(0,o);else{var l=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[o].Y>l.Y||n.m_polygon[o].Y==l.Y&&n.m_polygon[o].X<l.X)&&(this.m_lowest=new m.IntPoint(this.m_polyNodes.ChildCount()-1,o))}}};m.ClipperOffset.prototype.AddPaths=function(e,t,i){for(var r=0,n=e.length;r<n;r++)this.AddPath(e[r],t,i)};m.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!m.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];(t.m_endtype==m.EndType.etClosedPolygon||t.m_endtype==m.EndType.etClosedLine&&m.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];t.m_endtype==m.EndType.etClosedLine&&!m.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};m.ClipperOffset.GetUnitNormal=function(e,t){var i=t.X-e.X,r=t.Y-e.Y;if(i==0&&r==0)return new m.DoublePoint(0,0);var n=1/Math.sqrt(i*i+r*r);return i*=n,r*=n,new m.DoublePoint(r,-i)};m.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,m.ClipperBase.near_zero(e)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];i.m_endtype==m.EndType.etClosedPolygon&&this.m_destPolys.push(i.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var r;this.ArcTolerance<=0?r=m.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*m.ClipperOffset.def_arc_tolerance?r=Math.abs(e)*m.ClipperOffset.def_arc_tolerance:r=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-r/Math.abs(e));this.m_sin=Math.sin(m.ClipperOffset.two_pi/n),this.m_cos=Math.cos(m.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/m.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];this.m_srcPoly=i.m_polygon;var a=this.m_srcPoly.length;if(!(a==0||e<=0&&(a<3||i.m_endtype!=m.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,a==1){if(i.m_jointype==m.JoinType.jtRound)for(var o=1,s=0,l=1;l<=n;l++){this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+o*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+s*e)));var u=o;o=o*this.m_cos-this.m_sin*s,s=u*this.m_sin+s*this.m_cos}else for(var o=-1,s=-1,l=0;l<4;++l)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+o*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+s*e))),o<0?o=1:s<0?s=1:o=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var l=0;l<a-1;l++)this.m_normals.push(m.ClipperOffset.GetUnitNormal(this.m_srcPoly[l],this.m_srcPoly[l+1]));if(i.m_endtype==m.EndType.etClosedLine||i.m_endtype==m.EndType.etClosedPolygon?this.m_normals.push(m.ClipperOffset.GetUnitNormal(this.m_srcPoly[a-1],this.m_srcPoly[0])):this.m_normals.push(new m.DoublePoint(this.m_normals[a-2])),i.m_endtype==m.EndType.etClosedPolygon){for(var h=a-1,l=0;l<a;l++)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(i.m_endtype==m.EndType.etClosedLine){for(var h=a-1,l=0;l<a;l++)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var c=this.m_normals[a-1],l=a-1;l>0;l--)this.m_normals[l]=new m.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new m.DoublePoint(-c.X,-c.Y),h=0;for(var l=a-1;l>=0;l--)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var h=0,l=1;l<a-1;++l)h=this.OffsetPoint(l,h,i.m_jointype);var p;if(i.m_endtype==m.EndType.etOpenButt){var l=a-1;p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[l].X*e),m.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[l].Y*e)),this.m_destPoly.push(p),p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[l].X-this.m_normals[l].X*e),m.ClipperOffset.Round(this.m_srcPoly[l].Y-this.m_normals[l].Y*e)),this.m_destPoly.push(p)}else{var l=a-1;h=a-2,this.m_sinA=0,this.m_normals[l]=new m.DoublePoint(-this.m_normals[l].X,-this.m_normals[l].Y),i.m_endtype==m.EndType.etOpenSquare?this.DoSquare(l,h):this.DoRound(l,h)}for(var l=a-1;l>0;l--)this.m_normals[l]=new m.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new m.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),h=a-1;for(var l=h-1;l>0;--l)h=this.OffsetPoint(l,h,i.m_jointype);i.m_endtype==m.EndType.etOpenButt?(p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(p),p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(p)):(h=1,this.m_sinA=0,i.m_endtype==m.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};m.ClipperOffset.prototype.Execute=function(){var e=arguments,t=e[0]instanceof m.PolyTree;if(t){var i=e[0],r=e[1];i.Clear(),this.FixOrientations(),this.DoOffset(r);var n=new m.Clipper(0);if(n.AddPaths(this.m_destPolys,m.PolyType.ptSubject,!0),r>0)n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftPositive,m.PolyFillType.pftPositive);else{var a=m.Clipper.GetBounds(this.m_destPolys),o=new m.Path;if(o.push(new m.IntPoint(a.left-10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.top-10)),o.push(new m.IntPoint(a.left-10,a.top-10)),n.AddPath(o,m.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftNegative,m.PolyFillType.pftNegative),i.ChildCount()==1&&i.Childs()[0].ChildCount()>0){var s=i.Childs()[0];i.Childs()[0]=s.Childs()[0];for(var l=1;l<s.ChildCount();l++)i.AddChild(s.Childs()[l])}else i.Clear()}}else{var i=e[0],r=e[1];m.Clear(i),this.FixOrientations(),this.DoOffset(r);var n=new m.Clipper(0);if(n.AddPaths(this.m_destPolys,m.PolyType.ptSubject,!0),r>0)n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftPositive,m.PolyFillType.pftPositive);else{var a=m.Clipper.GetBounds(this.m_destPolys),o=new m.Path;o.push(new m.IntPoint(a.left-10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.top-10)),o.push(new m.IntPoint(a.left-10,a.top-10)),n.AddPath(o,m.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftNegative,m.PolyFillType.pftNegative),i.length>0&&i.splice(0,1)}}};m.ClipperOffset.prototype.OffsetPoint=function(e,t,i){if(this.m_sinA=this.m_normals[t].X*this.m_normals[e].Y-this.m_normals[e].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[t].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new m.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(i){case m.JoinType.jtMiter:{var r=1+(this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y);r>=this.m_miterLim?this.DoMiter(e,t,r):this.DoSquare(e,t);break}case m.JoinType.jtSquare:this.DoSquare(e,t);break;case m.JoinType.jtRound:this.DoRound(e,t);break}return t=e,t};m.ClipperOffset.prototype.DoSquare=function(e,t){var i=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*i)),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*i)))),this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*i)),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*i))))};m.ClipperOffset.prototype.DoMiter=function(e,t,i){var r=this.m_delta/i;this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[t].X+this.m_normals[e].X)*r),m.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[t].Y+this.m_normals[e].Y)*r)))};m.ClipperOffset.prototype.DoRound=function(e,t){for(var i=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y),r=m.Cast_Int32(m.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(i))),n=this.m_normals[t].X,a=this.m_normals[t].Y,o,s=0;s<r;++s)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+n*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+a*this.m_delta))),o=n,n=n*this.m_cos-this.m_sin*a,a=o*this.m_sin+a*this.m_cos;this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};m.Error=function(e){try{throw new Error(e)}catch(t){alert(t.message)}};m.JS={};m.JS.AreaOfPolygon=function(e,t){return t||(t=1),m.Clipper.Area(e)/(t*t)};m.JS.AreaOfPolygons=function(e,t){t||(t=1);for(var i=0,r=0;r<e.length;r++)i+=m.Clipper.Area(e[r]);return i/(t*t)};m.JS.BoundsOfPath=function(e,t){return m.JS.BoundsOfPaths([e],t)};m.JS.BoundsOfPaths=function(e,t){t||(t=1);var i=m.Clipper.GetBounds(e);return i.left/=t,i.bottom/=t,i.right/=t,i.top/=t,i};m.JS.Clean=function(r,t){if(!(r instanceof Array))return[];var i=r[0]instanceof Array,r=m.JS.Clone(r);if(typeof t!="number"||t===null)return m.Error("Delta is not a number in Clean()."),r;if(r.length===0||r.length==1&&r[0].length===0||t<0)return r;i||(r=[r]);for(var n=r.length,a,o,s,l,u,h,c,p=[],d=0;d<n;d++)if(o=r[d],a=o.length,a!==0){if(a<3){s=o,p.push(s);continue}for(s=o,l=t*t,u=o[0],h=1,c=1;c<a;c++)(o[c].X-u.X)*(o[c].X-u.X)+(o[c].Y-u.Y)*(o[c].Y-u.Y)<=l||(s[h]=o[c],u=o[c],h++);u=o[h-1],(o[0].X-u.X)*(o[0].X-u.X)+(o[0].Y-u.Y)*(o[0].Y-u.Y)<=l&&h--,h<a&&s.splice(h,a-h),s.length&&p.push(s)}return!i&&p.length?p=p[0]:!i&&p.length===0?p=[]:i&&p.length===0&&(p=[[]]),p};m.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var t=e[0]instanceof Array;t||(e=[e]);var i=e.length,r,n,a,o,s=new Array(i);for(n=0;n<i;n++){for(r=e[n].length,o=new Array(r),a=0;a<r;a++)o[a]={X:e[n][a].X,Y:e[n][a].Y};s[n]=o}return t||(s=s[0]),s};m.JS.Lighten=function(e,t){if(!(e instanceof Array))return[];if(typeof t!="number"||t===null)return m.Error("Tolerance is not a number in Lighten()."),m.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||t<0)return m.JS.Clone(e);e[0]instanceof Array||(e=[e]);var i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v=e.length,w=t*t,T=[];for(i=0;i<v;i++)if(n=e[i],s=n.length,s!=0){for(a=0;a<1e6;a++){for(o=[],s=n.length,n[s-1].X!=n[0].X||n[s-1].Y!=n[0].Y?(d=1,n.push({X:n[0].X,Y:n[0].Y}),s=n.length):d=0,p=[],r=0;r<s-2;r++)l=n[r],h=n[r+1],u=n[r+2],_=l.X,b=l.Y,f=u.X-_,y=u.Y-b,(f!==0||y!==0)&&(g=((h.X-_)*f+(h.Y-b)*y)/(f*f+y*y),g>1?(_=u.X,b=u.Y):g>0&&(_+=f*g,b+=y*g)),f=h.X-_,y=h.Y-b,c=f*f+y*y,c<=w&&(p[r+1]=1,r++);for(o.push({X:n[0].X,Y:n[0].Y}),r=1;r<s-1;r++)p[r]||o.push({X:n[r].X,Y:n[r].Y});if(o.push({X:n[s-1].X,Y:n[s-1].Y}),d&&n.pop(),p.length)n=o;else break}s=o.length,o[s-1].X==o[0].X&&o[s-1].Y==o[0].Y&&o.pop(),o.length>2&&T.push(o)}return!e[0]instanceof Array&&(T=T[0]),typeof T>"u"&&(T=[[]]),T};m.JS.PerimeterOfPath=function(e,t,i){if(typeof e>"u")return 0;var r=Math.sqrt,n=0,a,o,s=0,l=0,u=0,h=0,c=e.length;if(c<2)return 0;for(t&&(e[c]=e[0],c++);--c;)a=e[c],s=a.X,l=a.Y,o=e[c-1],u=o.X,h=o.Y,n+=r((s-u)*(s-u)+(l-h)*(l-h));return t&&e.pop(),n/i};m.JS.PerimeterOfPaths=function(e,t,i){i||(i=1);for(var r=0,n=0;n<e.length;n++)r+=m.JS.PerimeterOfPath(e[n],t,i);return r};m.JS.ScaleDownPath=function(e,t){var i,r;for(t||(t=1),i=e.length;i--;)r=e[i],r.X=r.X/t,r.Y=r.Y/t};m.JS.ScaleDownPaths=function(e,t){var i,r,n,a=Math.round;for(t||(t=1),i=e.length;i--;)for(r=e[i].length;r--;)n=e[i][r],n.X=n.X/t,n.Y=n.Y/t};m.JS.ScaleUpPath=function(e,t){var i,r,n=Math.round;for(t||(t=1),i=e.length;i--;)r=e[i],r.X=n(r.X*t),r.Y=n(r.Y*t)};m.JS.ScaleUpPaths=function(e,t){var i,r,n,a=Math.round;for(t||(t=1),i=e.length;i--;)for(r=e[i].length;r--;)n=e[i][r],n.X=a(n.X*t),n.Y=a(n.Y*t)};m.ExPolygons=function(){return[]};m.ExPolygon=function(){this.outer=null,this.holes=null};m.JS.AddOuterPolyNodeToExPolygons=function(e,t){var i=new m.ExPolygon;i.outer=e.Contour();var r=e.Childs(),n=r.length;i.holes=new Array(n);var a,o,s,l,u,h;for(s=0;s<n;s++)for(a=r[s],i.holes[s]=a.Contour(),l=0,u=a.Childs(),h=u.length;l<h;l++)o=u[l],m.JS.AddOuterPolyNodeToExPolygons(o,t);t.push(i)};m.JS.ExPolygonsToPaths=function(e){var t,i,r,n,a=new m.Paths;for(t=0,r=e.length;t<r;t++)for(a.push(e[t].outer),i=0,n=e[t].holes.length;i<n;i++)a.push(e[t].holes[i]);return a};m.JS.PolyTreeToExPolygons=function(e){var t=new m.ExPolygons,i,r,n,a;for(r=0,n=e.Childs(),a=n.length;r<a;r++)i=n[r],m.JS.AddOuterPolyNodeToExPolygons(i,t);return t};Ps.exports=m});A();var Ds="[MappedinJS]",iw=(n=>(n[n.LOG=0]="LOG",n[n.WARN=1]="WARN",n[n.ERROR=2]="ERROR",n[n.SILENT=3]="SILENT",n))(iw||{});function rw(e="",{prefix:t=Ds}={}){let i="".concat(t).concat(e?"-".concat(e):""),r=(n,a)=>{if(typeof window<"u"&&window.rnDebug){let o=a.map(s=>s instanceof Error&&s.stack?"".concat(s.message,"\n").concat(s.stack):s);window.rnDebug("".concat(e," ").concat(n,": ").concat(o.join(" ")))}};return{logState:j.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(i,...n),r("log",n))},warn(...n){this.logState<=1&&(console.warn(i,...n),r("warn",n))},error(...n){this.logState<=2&&(console.error(i,...n),r("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}var tm=rw();function l8(e){0<=e&&e<=3&&(tm.logState=e)}var ft=tm;A();function im(e,t,i=!1){let r=null,n=0,a=function(...o){n++,n===1&&i===!0&&e(...o);let s=()=>{(!i||n>1)&&e(...o),r=null,n=0};clearTimeout(r),r=setTimeout(s,t)};return a.cancel=function(){r&&(clearTimeout(r),r=null),n=0},a}function c8(e,t,i){let r=null,n=null,a,o=null,s=0;i||(i={});let l=function(){s=i.leading===!1?0:Date.now(),o=null,n&&(a=e.apply(r,n)),o||(r=n=null)};return function(...u){let h=Date.now();!s&&i.leading===!1&&(s=h);let c=t-(h-s);return c<=0||c>t?(o&&(clearTimeout(o),o=null),s=h,a=e.apply(this,u),o||(r=n=null)):!o&&i.trailing!==!1&&(r=this,n=u,o=setTimeout(l,c)),a}}A();A();function nw(e,t){return"".concat(t," ").concat(e)}var Va=class extends Error{constructor(t,i=Ds){super(nw(t,i)),this.name="MappedinError"}},rm=class extends Va{constructor(t,i=Ds){super(t,i),this.name="MappedinRenderError"}};var nm=["ease-in","ease-out","ease-in-out","linear","ease-out-cubic"];var Ls=e=>e,aw=e=>e*e,Ch=e=>1-Math.cos(e*Math.PI/2),ow=e=>1-(1-e)*(1-e),sw=e=>1-Math.pow(1-e,3),am={linear:Ls,"ease-in":aw,"ease-out":ow,"ease-in-out":Ch,"ease-out-cubic":sw};function Mh(e,t,i,r,n,a=Ls){if(t===i)return n;e=Math.max(t,Math.min(e,i));let o=(e-Math.min(t,i))/Math.abs(i-t),s=typeof a=="function"?a(o):am[a](o);return r+s*(n-r)}function lw(e,t){let i=0;if(t.length<2)return i;let n=t[0]<t[1]?(a,o)=>a>o:(a,o)=>a<o;for(;i<t.length-1&&n(e,t[i+1]);)i++;return i>t.length-2?Math.max(0,t.length-2):i}function om(e,t,i,r="ease-in"){if(t.length!==i.length)throw new Va("Input and output ranges must have the same number of values.");e=Math.max(t[0],Math.min(e,t[t.length-1]));let n=lw(e,t),a=(e-t[n])/(t[n+1]-t[n]),o=typeof r=="function"?r(a):am[r](a);return i[n]+o*(i[n+1]-i[n])}A();A();var Li=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Li.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?Li.Bounce.In(e*2)*.5:Li.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),ja=function(){return performance.now()},uw=(function(){function e(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(i){return t._tweens[i]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];for(var n=0,a=i;n<a.length;n++){var o=a[n];(t=o._group)===null||t===void 0||t.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},e.prototype.remove=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];for(var r=0,n=t;r<n.length;r++){var a=n[r];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,i){t===void 0&&(t=ja()),i===void 0&&(i=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<r.length;n++){var a=this._tweens[r[n]],o=!i;a&&a.update(t,o)===!1&&!i&&this.remove(a)}r=Object.keys(this._tweensAddedDuringUpdate)}},e})(),qn={Linear:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),a=qn.Utils.Linear;return t<0?a(e[0],e[1],r):t>1?a(e[i],e[i-1],i-r):a(e[n],e[n+1>i?i:n+1],r-n)},Bezier:function(e,t){for(var i=0,r=e.length-1,n=Math.pow,a=qn.Utils.Bernstein,o=0;o<=r;o++)i+=n(1-t,r-o)*n(t,o)*e[o]*a(r,o);return i},CatmullRom:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),a=qn.Utils.CatmullRom;return e[0]===e[i]?(t<0&&(n=Math.floor(r=i*(1+t))),a(e[(n-1+i)%i],e[n],e[(n+1)%i],e[(n+2)%i],r-n)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[i]-(a(e[i],e[i],e[i-1],e[i-1],r-i)-e[i]):a(e[n?n-1:0],e[n],e[i<n+1?i:n+1],e[i<n+2?i:n+2],r-n)},Utils:{Linear:function(e,t,i){return(t-e)*i+e},Bernstein:function(e,t){var i=qn.Utils.Factorial;return i(e)/i(t)/i(e-t)},Factorial:(function(){var e=[1];return function(t){var i=1;if(e[t])return e[t];for(var r=t;r>1;r--)i*=r;return e[t]=i,i}})(),CatmullRom:function(e,t,i,r,n){var a=(i-e)*.5,o=(r-t)*.5,s=n*n,l=n*s;return(2*t-2*i+a+o)*l+(-3*t+3*i-2*a-o)*s+a*n+t}}},sm=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),Ih=new uw,v8=(function(){function e(t,i){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Li.Linear.None,this._interpolationFunction=qn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=sm.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof i=="object"?(this._group=i,i.add(this)):i===!0&&(this._group=Ih,Ih.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,i){if(i===void 0&&(i=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=i<0?0:i,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,i){if(t===void 0&&(t=ja()),i===void 0&&(i=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||i){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var a in this._valuesEnd)n[a]=this._valuesEnd[a];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,i)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,i,r,n,a){for(var o in r){var s=t[o],l=Array.isArray(s),u=l?"array":typeof s,h=!l&&Array.isArray(r[o]);if(!(u==="undefined"||u==="function")){if(h){var c=r[o];if(c.length===0)continue;for(var p=[s],d=0,f=c.length;d<f;d+=1){var y=this._handleRelativeValue(s,c[d]);if(isNaN(y)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(y)}h&&(r[o]=p)}if((u==="object"||l)&&s&&!h){i[o]=l?[]:{};var g=s;for(var _ in g)i[o][_]=g[_];n[o]=l?[]:{};var c=r[o];if(!this._isDynamic){var b={};for(var _ in c)b[_]=c[_];r[o]=c=b}this._setupProperties(g,i[o],c,n[o],a)}else(typeof i[o]>"u"||a)&&(i[o]=s),l||(i[o]*=1),h?n[o]=r[o].slice().reverse():n[o]=i[o]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=ja()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=ja()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=Li.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=qn.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,i){var r=this,n;if(t===void 0&&(t=ja()),i===void 0&&(i=e.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(i)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=t-this._startTime,s=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),l=this._duration+this._repeat*s,u=function(){if(r._duration===0||o>l)return 1;var y=Math.trunc(o/s),g=o-y*s,_=Math.min(g/r._duration,1);return _===0&&o===r._duration?1:_},h=u(),c=this._easingFunction(h);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),this._duration===0||o>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((o-this._duration)/s)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=s*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,f=this._chainedTweens.length;d<f;d++)this._chainedTweens[d].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,i,r,n){for(var a in r)if(i[a]!==void 0){var o=i[a]||0,s=r[a],l=Array.isArray(t[a]),u=Array.isArray(s),h=!l&&u;h?t[a]=this._interpolationFunction(s,n):typeof s=="object"&&s?this._updateProperties(t[a],o,s,n):(s=this._handleRelativeValue(o,s),typeof s=="number"&&(t[a]=o+(s-o)*n))}},e.prototype._handleRelativeValue=function(t,i){return typeof i!="string"?i:i.charAt(0)==="+"||i.charAt(0)==="-"?t+parseFloat(i):parseFloat(i)},e.prototype._swapEndStartRepeatValues=function(t){var i=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=i},e.autoStartOnUpdate=!1,e})();var b8=sm.nextId,Ri=Ih,w8=Ri.getAll.bind(Ri),P8=Ri.removeAll.bind(Ri),T8=Ri.add.bind(Ri),S8=Ri.remove.bind(Ri),C8=Ri.update.bind(Ri);var hw={linear:Li.Linear.None,"ease-in":Li.Quadratic.In,"ease-out":Li.Quadratic.Out,"ease-in-out":Li.Quadratic.InOut};var cw={tension:0,cornerRadius:.5},pw="mappedin",lm="collision-worker.csp.js",um="maplibre-worker.csp.js",Eh="";function hm(e){Eh=e}var cm="";function dw(e){cm=e}var pm=!1;function fw(){pm=!0}function mw(){return pm}var dm=!0;function yw(e){dm=e}function Ah(){return dm}A();A();A();import xt from"zod";var kh=xt.enum(nm),gw=e=>{let t=e[0];for(let i=1;i<e.length;i++){let r=e[i];if(r<=t)return!1;t=r}return!0},_w=e=>{let t=e[0];for(let i=1;i<e.length;i++){let r=e[i];if(r>=t)return!1;t=r}return!0},fm=e=>gw(e)||_w(e),xw=xt.object({on:xt.literal("zoom-level"),input:xt.tuple([xt.number()]).rest(xt.number()).refine(fm,{message:"input array must be strictly increasing or decreasing"}),output:xt.tuple([xt.number()]).rest(xt.number()),easing:kh.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"}),Rs=/^\d+(\.\d+)?px$/;function Dh(e){return typeof e=="string"&&Rs.test(e)}function vw(e){return parseFloat(e)}function mm(e){return typeof e=="object"&&e!==null&&"output"in e&&Array.isArray(e.output)&&e.output.length>0&&Dh(e.output[0])}function bw(e){return Dh(e)||mm(e)}var ww=xt.object({on:xt.literal("zoom-level"),input:xt.tuple([xt.number()]).rest(xt.number()).refine(fm,{message:"input array must be strictly increasing or decreasing"}),output:xt.tuple([xt.string().regex(Rs)]).rest(xt.string().regex(Rs)),easing:kh.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});A();A();A();A();A();A();import{z as jt}from"zod";var ym=jt.object({rotation:jt.array(jt.number()).length(3).optional(),altitude:jt.number().optional(),scale:jt.array(jt.number()).length(3).optional(),interactive:jt.boolean().optional(),verticalOffset:jt.number().optional(),id:jt.union([jt.number(),jt.string()]).optional()}),gm=jt.object({color:jt.string()});A();import{z as ge}from"zod";var Lh=ge.object({visible:ge.boolean(),color:ge.string(),flipToFaceCamera:ge.boolean(),font:ge.string().optional(),fontSize:ge.number(),margin:ge.union([ge.number(),ge.tuple([ge.number(),ge.number(),ge.number(),ge.number()])]),outlineColor:ge.string(),outlineOpacity:ge.number(),outlineBlur:ge.union([ge.number(),ge.string()]),outlineWidth:ge.number(),outlineOffsetX:ge.number(),outlineOffsetY:ge.number(),strokeWidth:ge.number(),maxWidth:ge.number().optional(),maxHeight:ge.number().optional(),strokeOpacity:ge.number(),strokeColor:ge.string(),fillOpacity:ge.number(),hoverColor:ge.string().optional(),id:ge.union([ge.string(),ge.number()]),type:ge.literal("text3d"),position:ge.tuple([ge.number(),ge.number(),ge.number()]),content:ge.string(),rotation:ge.number()}),Rh=ge.strictObject(Lh.partial().omit({id:!0,type:!0}).shape),_m=ge.strictObject(Rh.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape);A();var Pw=Object.create,gp=Object.defineProperty,Tw=Object.getOwnPropertyDescriptor,Sw=Object.getOwnPropertyNames,Cw=Object.getPrototypeOf,Mw=Object.prototype.hasOwnProperty,vi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wn=(e,t)=>{for(var i in t)gp(e,i,{get:t[i],enumerable:!0})},Iw=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Sw(t))!Mw.call(e,n)&&n!==i&&gp(e,n,{get:()=>t[n],enumerable:!(r=Tw(t,n))||r.enumerable});return e},se=(e,t,i)=>(i=e!=null?Pw(Cw(e)):{},Iw(t||!e||!e.__esModule?gp(i,"default",{value:e,enumerable:!0}):i,e)),ce=vi((e,t)=>{"use strict";t.exports=i;function i(r,n){this.x=r,this.y=n}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,n){return this.clone()._rotateAround(r,n)},matMult:function(r){return this.clone()._matMult(r)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var n=r.x-this.x,a=r.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,n){return Math.atan2(this.x*n-this.y*r,this.x*r+this.y*n)},_matMult:function(r){var n=r[0]*this.x+r[1]*this.y,a=r[2]*this.x+r[3]*this.y;return this.x=n,this.y=a,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var n=Math.cos(r),a=Math.sin(r),o=n*this.x-a*this.y,s=a*this.x+n*this.y;return this.x=o,this.y=s,this},_rotateAround:function(r,n){var a=Math.cos(r),o=Math.sin(r),s=n.x+a*(this.x-n.x)-o*(this.y-n.y),l=n.y+o*(this.x-n.x)+a*(this.y-n.y);return this.x=s,this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(r){return r instanceof i?r:Array.isArray(r)?new i(r[0],r[1]):r}}),Ew=vi((e,t)=>{"use strict";t.exports=i;function i(r,n,a,o){this.cx=3*r,this.bx=3*(a-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(o-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=n,this.p2x=a,this.p2y=o}i.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,n){if(n===void 0&&(n=1e-6),r<0)return 0;if(r>1)return 1;for(var a=r,o=0;o<8;o++){var s=this.sampleCurveX(a)-r;if(Math.abs(s)<n)return a;var l=this.sampleCurveDerivativeX(a);if(Math.abs(l)<1e-6)break;a=a-s/l}var u=0,h=1;for(a=r,o=0;o<20&&(s=this.sampleCurveX(a),!(Math.abs(s-r)<n));o++)r>s?u=a:h=a,a=(h-u)*.5+u;return a},solve:function(r,n){return this.sampleCurveY(this.solveCurveX(r,n))}}}),Aw=vi((e,t)=>{function i(r,n){var a,o,s,l,u,h,c,p,d,f;for(a=r.length&3,o=r.length-a,s=n,u=3432918353,c=461845907,f=0;f<o;)d=r.charCodeAt(f)&255|(r.charCodeAt(++f)&255)<<8|(r.charCodeAt(++f)&255)<<16|(r.charCodeAt(++f)&255)<<24,++f,d=(d&65535)*u+(((d>>>16)*u&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,s^=d,s=s<<13|s>>>19,l=(s&65535)*5+(((s>>>16)*5&65535)<<16)&4294967295,s=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(d=0,a){case 3:d^=(r.charCodeAt(f+2)&255)<<16;case 2:d^=(r.charCodeAt(f+1)&255)<<8;case 1:d^=r.charCodeAt(f)&255,d=(d&65535)*u+(((d>>>16)*u&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,s^=d}return s^=r.length,s^=s>>>16,s=(s&65535)*2246822507+(((s>>>16)*2246822507&65535)<<16)&4294967295,s^=s>>>13,s=(s&65535)*3266489909+(((s>>>16)*3266489909&65535)<<16)&4294967295,s^=s>>>16,s>>>0}typeof t<"u"&&(t.exports=i)}),kw=vi((e,t)=>{function i(r,n){for(var a=r.length,o=n^a,s=0,l;a>=4;)l=r.charCodeAt(s)&255|(r.charCodeAt(++s)&255)<<8|(r.charCodeAt(++s)&255)<<16|(r.charCodeAt(++s)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)^l,a-=4,++s;switch(a){case 3:o^=(r.charCodeAt(s+2)&255)<<16;case 2:o^=(r.charCodeAt(s+1)&255)<<8;case 1:o^=r.charCodeAt(s)&255,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)}return o^=o>>>13,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>15,o>>>0}typeof t!==void 0&&(t.exports=i)}),wg=vi((e,t)=>{var i=Aw(),r=kw();t.exports=i,t.exports.murmur3=i,t.exports.murmur2=r}),Pg=vi((e,t)=>{"use strict";var i=ce();t.exports=r;function r(l,u,h,c,p){this.properties={},this.extent=h,this.type=0,this._pbf=l,this._geometry=-1,this._keys=c,this._values=p,l.readFields(n,this,u)}function n(l,u,h){l==1?u.id=h.readVarint():l==2?a(h,u):l==3?u.type=h.readVarint():l==4&&(u._geometry=h.pos)}function a(l,u){for(var h=l.readVarint()+l.pos;l.pos<h;){var c=u._keys[l.readVarint()],p=u._values[l.readVarint()];u.properties[c]=p}}r.types=["Unknown","Point","LineString","Polygon"],r.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var u=l.readVarint()+l.pos,h=1,c=0,p=0,d=0,f=[],y;l.pos<u;){if(c<=0){var g=l.readVarint();h=g&7,c=g>>3}if(c--,h===1||h===2)p+=l.readSVarint(),d+=l.readSVarint(),h===1&&(y&&f.push(y),y=[]),y.push(new i(p,d));else if(h===7)y&&y.push(y[0].clone());else throw new Error("unknown command "+h)}return y&&f.push(y),f},r.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var u=l.readVarint()+l.pos,h=1,c=0,p=0,d=0,f=1/0,y=-1/0,g=1/0,_=-1/0;l.pos<u;){if(c<=0){var b=l.readVarint();h=b&7,c=b>>3}if(c--,h===1||h===2)p+=l.readSVarint(),d+=l.readSVarint(),p<f&&(f=p),p>y&&(y=p),d<g&&(g=d),d>_&&(_=d);else if(h!==7)throw new Error("unknown command "+h)}return[f,g,y,_]},r.prototype.toGeoJSON=function(l,u,h){var c=this.extent*Math.pow(2,h),p=this.extent*l,d=this.extent*u,f=this.loadGeometry(),y=r.types[this.type],g,_;function b(T){for(var S=0;S<T.length;S++){var M=T[S],E=180-(M.y+d)*360/c;T[S]=[(M.x+p)*360/c-180,360/Math.PI*Math.atan(Math.exp(E*Math.PI/180))-90]}}switch(this.type){case 1:var v=[];for(g=0;g<f.length;g++)v[g]=f[g][0];f=v,b(f);break;case 2:for(g=0;g<f.length;g++)b(f[g]);break;case 3:for(f=o(f),g=0;g<f.length;g++)for(_=0;_<f[g].length;_++)b(f[g][_]);break}f.length===1?f=f[0]:y="Multi"+y;var w={type:"Feature",geometry:{type:y,coordinates:f},properties:this.properties};return"id"in this&&(w.id=this.id),w};function o(l){var u=l.length;if(u<=1)return[l];for(var h=[],c,p,d=0;d<u;d++){var f=s(l[d]);f!==0&&(p===void 0&&(p=f<0),p===f<0?(c&&h.push(c),c=[l[d]]):c.push(l[d]))}return c&&h.push(c),h}function s(l){for(var u=0,h=0,c=l.length,p=c-1,d,f;h<c;p=h++)d=l[h],f=l[p],u+=(f.x-d.x)*(d.y+f.y);return u}}),Tg=vi((e,t)=>{"use strict";var i=Pg();t.exports=r;function r(o,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=o,this._keys=[],this._values=[],this._features=[],o.readFields(n,this,s),this.length=this._features.length}function n(o,s,l){o===15?s.version=l.readVarint():o===1?s.name=l.readString():o===5?s.extent=l.readVarint():o===2?s._features.push(l.pos):o===3?s._keys.push(l.readString()):o===4&&s._values.push(a(l))}function a(o){for(var s=null,l=o.readVarint()+o.pos;o.pos<l;){var u=o.readVarint()>>3;s=u===1?o.readString():u===2?o.readFloat():u===3?o.readDouble():u===4?o.readVarint64():u===5?o.readVarint():u===6?o.readSVarint():u===7?o.readBoolean():null}return s}r.prototype.feature=function(o){if(o<0||o>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[o];var s=this._pbf.readVarint()+this._pbf.pos;return new i(this._pbf,s,this.extent,this._keys,this._values)}}),Dw=vi((e,t)=>{"use strict";var i=Tg();t.exports=r;function r(a,o){this.layers=a.readFields(n,{},o)}function n(a,o,s){if(a===3){var l=new i(s,s.readVarint()+s.pos);l.length&&(o[l.name]=l)}}}),$l=vi((e,t)=>{t.exports.VectorTile=Dw(),t.exports.VectorTileFeature=Pg(),t.exports.VectorTileLayer=Tg()}),Lw=vi(e=>{e.read=function(t,i,r,n,a){var o,s,l=a*8-n-1,u=(1<<l)-1,h=u>>1,c=-7,p=r?a-1:0,d=r?-1:1,f=t[i+p];for(p+=d,o=f&(1<<-c)-1,f>>=-c,c+=l;c>0;o=o*256+t[i+p],p+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=s*256+t[i+p],p+=d,c-=8);if(o===0)o=1-h;else{if(o===u)return s?NaN:(f?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-h}return(f?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,i,r,n,a,o){var s,l,u,h=o*8-a-1,c=(1<<h)-1,p=c>>1,d=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,y=n?1:-1,g=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(l=isNaN(i)?1:0,s=c):(s=Math.floor(Math.log(i)/Math.LN2),i*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+p>=1?i+=d/u:i+=d*Math.pow(2,1-p),i*u>=2&&(s++,u/=2),s+p>=c?(l=0,s=c):s+p>=1?(l=(i*u-1)*Math.pow(2,a),s=s+p):(l=i*Math.pow(2,p-1)*Math.pow(2,a),s=0));a>=8;t[r+f]=l&255,f+=y,l/=256,a-=8);for(s=s<<a|l,h+=a;h>0;t[r+f]=s&255,f+=y,s/=256,h-=8);t[r+f-y]|=g*128}}),Sg=vi((e,t)=>{"use strict";t.exports=r;var i=Lw();function r(x){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(x)?x:new Uint8Array(x||0),this.pos=0,this.type=0,this.length=this.buf.length}r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var n=65536*65536,a=1/n,o=12,s=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");r.prototype={destroy:function(){this.buf=null},readFields:function(x,C,I){for(I=I||this.length;this.pos<I;){var F=this.readVarint(),N=F>>3,G=this.pos;this.type=F&7,x(N,C,this),this.pos===G&&this.skip(F)}return C},readMessage:function(x,C){return this.readFields(x,C,this.readVarint()+this.pos)},readFixed32:function(){var x=E(this.buf,this.pos);return this.pos+=4,x},readSFixed32:function(){var x=z(this.buf,this.pos);return this.pos+=4,x},readFixed64:function(){var x=E(this.buf,this.pos)+E(this.buf,this.pos+4)*n;return this.pos+=8,x},readSFixed64:function(){var x=E(this.buf,this.pos)+z(this.buf,this.pos+4)*n;return this.pos+=8,x},readFloat:function(){var x=i.read(this.buf,this.pos,!0,23,4);return this.pos+=4,x},readDouble:function(){var x=i.read(this.buf,this.pos,!0,52,8);return this.pos+=8,x},readVarint:function(x){var C=this.buf,I,F;return F=C[this.pos++],I=F&127,F<128||(F=C[this.pos++],I|=(F&127)<<7,F<128)||(F=C[this.pos++],I|=(F&127)<<14,F<128)||(F=C[this.pos++],I|=(F&127)<<21,F<128)?I:(F=C[this.pos],I|=(F&15)<<28,l(I,x,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var x=this.readVarint();return x%2===1?(x+1)/-2:x/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var x=this.readVarint()+this.pos,C=this.pos;return this.pos=x,x-C>=o&&s?k(this.buf,C,x):R(this.buf,C,x)},readBytes:function(){var x=this.readVarint()+this.pos,C=this.buf.subarray(this.pos,x);return this.pos=x,C},readPackedVarint:function(x,C){if(this.type!==r.Bytes)return x.push(this.readVarint(C));var I=u(this);for(x=x||[];this.pos<I;)x.push(this.readVarint(C));return x},readPackedSVarint:function(x){if(this.type!==r.Bytes)return x.push(this.readSVarint());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readSVarint());return x},readPackedBoolean:function(x){if(this.type!==r.Bytes)return x.push(this.readBoolean());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readBoolean());return x},readPackedFloat:function(x){if(this.type!==r.Bytes)return x.push(this.readFloat());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readFloat());return x},readPackedDouble:function(x){if(this.type!==r.Bytes)return x.push(this.readDouble());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readDouble());return x},readPackedFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed32());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readFixed32());return x},readPackedSFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed32());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readSFixed32());return x},readPackedFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed64());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readFixed64());return x},readPackedSFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed64());var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readSFixed64());return x},skip:function(x){var C=x&7;if(C===r.Varint)for(;this.buf[this.pos++]>127;);else if(C===r.Bytes)this.pos=this.readVarint()+this.pos;else if(C===r.Fixed32)this.pos+=4;else if(C===r.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+C)},writeTag:function(x,C){this.writeVarint(x<<3|C)},realloc:function(x){for(var C=this.length||16;C<this.pos+x;)C*=2;if(C!==this.length){var I=new Uint8Array(C);I.set(this.buf),this.buf=I,this.length=C}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(x){this.realloc(4),L(this.buf,x,this.pos),this.pos+=4},writeSFixed32:function(x){this.realloc(4),L(this.buf,x,this.pos),this.pos+=4},writeFixed64:function(x){this.realloc(8),L(this.buf,x&-1,this.pos),L(this.buf,Math.floor(x*a),this.pos+4),this.pos+=8},writeSFixed64:function(x){this.realloc(8),L(this.buf,x&-1,this.pos),L(this.buf,Math.floor(x*a),this.pos+4),this.pos+=8},writeVarint:function(x){if(x=+x||0,x>268435455||x<0){c(x,this);return}this.realloc(4),this.buf[this.pos++]=x&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=(x>>>=7)&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=(x>>>=7)&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=x>>>7&127)))},writeSVarint:function(x){this.writeVarint(x<0?-x*2-1:x*2)},writeBoolean:function(x){this.writeVarint(!!x)},writeString:function(x){x=String(x),this.realloc(x.length*4),this.pos++;var C=this.pos;this.pos=D(this.buf,x,this.pos);var I=this.pos-C;I>=128&&f(C,I,this),this.pos=C-1,this.writeVarint(I),this.pos+=I},writeFloat:function(x){this.realloc(4),i.write(this.buf,x,this.pos,!0,23,4),this.pos+=4},writeDouble:function(x){this.realloc(8),i.write(this.buf,x,this.pos,!0,52,8),this.pos+=8},writeBytes:function(x){var C=x.length;this.writeVarint(C),this.realloc(C);for(var I=0;I<C;I++)this.buf[this.pos++]=x[I]},writeRawMessage:function(x,C){this.pos++;var I=this.pos;x(C,this);var F=this.pos-I;F>=128&&f(I,F,this),this.pos=I-1,this.writeVarint(F),this.pos+=F},writeMessage:function(x,C,I){this.writeTag(x,r.Bytes),this.writeRawMessage(C,I)},writePackedVarint:function(x,C){C.length&&this.writeMessage(x,y,C)},writePackedSVarint:function(x,C){C.length&&this.writeMessage(x,g,C)},writePackedBoolean:function(x,C){C.length&&this.writeMessage(x,v,C)},writePackedFloat:function(x,C){C.length&&this.writeMessage(x,_,C)},writePackedDouble:function(x,C){C.length&&this.writeMessage(x,b,C)},writePackedFixed32:function(x,C){C.length&&this.writeMessage(x,w,C)},writePackedSFixed32:function(x,C){C.length&&this.writeMessage(x,T,C)},writePackedFixed64:function(x,C){C.length&&this.writeMessage(x,S,C)},writePackedSFixed64:function(x,C){C.length&&this.writeMessage(x,M,C)},writeBytesField:function(x,C){this.writeTag(x,r.Bytes),this.writeBytes(C)},writeFixed32Field:function(x,C){this.writeTag(x,r.Fixed32),this.writeFixed32(C)},writeSFixed32Field:function(x,C){this.writeTag(x,r.Fixed32),this.writeSFixed32(C)},writeFixed64Field:function(x,C){this.writeTag(x,r.Fixed64),this.writeFixed64(C)},writeSFixed64Field:function(x,C){this.writeTag(x,r.Fixed64),this.writeSFixed64(C)},writeVarintField:function(x,C){this.writeTag(x,r.Varint),this.writeVarint(C)},writeSVarintField:function(x,C){this.writeTag(x,r.Varint),this.writeSVarint(C)},writeStringField:function(x,C){this.writeTag(x,r.Bytes),this.writeString(C)},writeFloatField:function(x,C){this.writeTag(x,r.Fixed32),this.writeFloat(C)},writeDoubleField:function(x,C){this.writeTag(x,r.Fixed64),this.writeDouble(C)},writeBooleanField:function(x,C){this.writeVarintField(x,!!C)}};function l(x,C,I){var F=I.buf,N,G;if(G=F[I.pos++],N=(G&112)>>4,G<128||(G=F[I.pos++],N|=(G&127)<<3,G<128)||(G=F[I.pos++],N|=(G&127)<<10,G<128)||(G=F[I.pos++],N|=(G&127)<<17,G<128)||(G=F[I.pos++],N|=(G&127)<<24,G<128)||(G=F[I.pos++],N|=(G&1)<<31,G<128))return h(x,N,C);throw new Error("Expected varint not more than 10 bytes")}function u(x){return x.type===r.Bytes?x.readVarint()+x.pos:x.pos+1}function h(x,C,I){return I?C*4294967296+(x>>>0):(C>>>0)*4294967296+(x>>>0)}function c(x,C){var I,F;if(x>=0?(I=x%4294967296|0,F=x/4294967296|0):(I=~(-x%4294967296),F=~(-x/4294967296),I^4294967295?I=I+1|0:(I=0,F=F+1|0)),x>=18446744073709552e3||x<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");C.realloc(10),p(I,F,C),d(F,C)}function p(x,C,I){I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos]=x&127}function d(x,C){var I=(x&7)<<4;C.buf[C.pos++]|=I|((x>>>=3)?128:0),x&&(C.buf[C.pos++]=x&127|((x>>>=7)?128:0),x&&(C.buf[C.pos++]=x&127|((x>>>=7)?128:0),x&&(C.buf[C.pos++]=x&127|((x>>>=7)?128:0),x&&(C.buf[C.pos++]=x&127|((x>>>=7)?128:0),x&&(C.buf[C.pos++]=x&127)))))}function f(x,C,I){var F=C<=16383?1:C<=2097151?2:C<=268435455?3:Math.floor(Math.log(C)/(Math.LN2*7));I.realloc(F);for(var N=I.pos-1;N>=x;N--)I.buf[N+F]=I.buf[N]}function y(x,C){for(var I=0;I<x.length;I++)C.writeVarint(x[I])}function g(x,C){for(var I=0;I<x.length;I++)C.writeSVarint(x[I])}function _(x,C){for(var I=0;I<x.length;I++)C.writeFloat(x[I])}function b(x,C){for(var I=0;I<x.length;I++)C.writeDouble(x[I])}function v(x,C){for(var I=0;I<x.length;I++)C.writeBoolean(x[I])}function w(x,C){for(var I=0;I<x.length;I++)C.writeFixed32(x[I])}function T(x,C){for(var I=0;I<x.length;I++)C.writeSFixed32(x[I])}function S(x,C){for(var I=0;I<x.length;I++)C.writeFixed64(x[I])}function M(x,C){for(var I=0;I<x.length;I++)C.writeSFixed64(x[I])}function E(x,C){return(x[C]|x[C+1]<<8|x[C+2]<<16)+x[C+3]*16777216}function L(x,C,I){x[I]=C,x[I+1]=C>>>8,x[I+2]=C>>>16,x[I+3]=C>>>24}function z(x,C){return(x[C]|x[C+1]<<8|x[C+2]<<16)+(x[C+3]<<24)}function R(x,C,I){for(var F="",N=C;N<I;){var G=x[N],J=null,ee=G>239?4:G>223?3:G>191?2:1;if(N+ee>I)break;var ke,Ie,Be;ee===1?G<128&&(J=G):ee===2?(ke=x[N+1],(ke&192)===128&&(J=(G&31)<<6|ke&63,J<=127&&(J=null))):ee===3?(ke=x[N+1],Ie=x[N+2],(ke&192)===128&&(Ie&192)===128&&(J=(G&15)<<12|(ke&63)<<6|Ie&63,(J<=2047||J>=55296&&J<=57343)&&(J=null))):ee===4&&(ke=x[N+1],Ie=x[N+2],Be=x[N+3],(ke&192)===128&&(Ie&192)===128&&(Be&192)===128&&(J=(G&15)<<18|(ke&63)<<12|(Ie&63)<<6|Be&63,(J<=65535||J>=1114112)&&(J=null))),J===null?(J=65533,ee=1):J>65535&&(J-=65536,F+=String.fromCharCode(J>>>10&1023|55296),J=56320|J&1023),F+=String.fromCharCode(J),N+=ee}return F}function k(x,C,I){return s.decode(x.subarray(C,I))}function D(x,C,I){for(var F=0,N,G;F<C.length;F++){if(N=C.charCodeAt(F),N>55295&&N<57344)if(G)if(N<56320){x[I++]=239,x[I++]=191,x[I++]=189,G=N;continue}else N=G-55296<<10|N-56320|65536,G=null;else{N>56319||F+1===C.length?(x[I++]=239,x[I++]=191,x[I++]=189):G=N;continue}else G&&(x[I++]=239,x[I++]=191,x[I++]=189,G=null);N<128?x[I++]=N:(N<2048?x[I++]=N>>6|192:(N<65536?x[I++]=N>>12|224:(x[I++]=N>>18|240,x[I++]=N>>12&63|128),x[I++]=N>>6&63|128),x[I++]=N&63|128)}return I}}),Cg={name:"@mappedin/outdoor-context",description:"Fork of maplibre-gl-js",version:"5.6.0",main:"dist/outdoor-context.js",style:"dist/outdoor-context.css",homepage:"https://www.mappedin.com",private:!1,repository:{type:"git",url:"git://github.com/mappedin/outdoor-context.git"},types:"dist/outdoor-context.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^23.3.0","@types/geojson":"^7946.0.16","@types/geojson-vt":"3.2.5","@types/mapbox__point-geometry":"^0.1.4","@types/mapbox__vector-tile":"^1.3.4","@types/pbf":"^3.0.5","@types/supercluster":"^7.1.3",earcut:"^3.0.1","geojson-vt":"^4.0.2","gl-matrix":"^3.4.3","global-prefix":"^4.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.3.0",potpack:"^2.0.0",quickselect:"^3.0.0",supercluster:"^8.0.1",tinyqueue:"^3.0.0","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.3.0","@mapbox/mvt-fixtures":"^3.10.0","@types/benchmark":"^2.1.5","@types/d3":"^7.4.3","@types/diff":"^7.0.2","@types/earcut":"^3.0.0","@types/eslint":"^9.6.1","@types/gl":"^6.0.5","@types/glob":"^8.1.0","@types/jsdom":"^21.1.7","@types/minimist":"^1.2.5","@types/murmurhash-js":"^1.0.6","@types/nise":"^1.4.5","@types/node":"^22.15.29","@types/offscreencanvas":"^2019.7.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.5","@types/react":"^19.1.6","@types/react-dom":"^19.1.5","@types/request":"^2.48.12","@types/shuffle-seed":"^1.1.3","@types/window-or-global":"^1.0.6","@typescript-eslint/eslint-plugin":"^8.33.1","@typescript-eslint/parser":"^8.33.0","@vitest/coverage-v8":"3.1.3","@vitest/ui":"3.1.3",address:"^2.0.3",autoprefixer:"^10.4.21",benchmark:"^2.1.4",canvas:"^3.1.0",cspell:"^9.0.2",cssnano:"^7.0.7",d3:"^7.9.0","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1468520",diff:"^8.0.2","dts-bundle-generator":"^9.5.1",esbuild:"^0.27.2","esbuild-plugin-glsl":"^1.4.1",eslint:"^9.28.0","eslint-plugin-html":"^8.1.3","eslint-plugin-import":"^2.31.0","eslint-plugin-react":"^7.37.5","eslint-plugin-tsdoc":"0.4.0","eslint-plugin-vitest":"^0.5.4",expect:"^29.7.0",glob:"^11.0.2",globals:"^16.2.0",husky:"^8.0.0","is-builtin-module":"^5.0.0",jsdom:"^26.1.0","junit-report-builder":"^5.1.1","lint-staged":"^12.1.2",minimist:"^1.2.8","mock-geolocation":"^1.0.11","monocart-coverage-reports":"^2.12.6",nise:"^6.1.1","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5",nyc:"^15.1.0","pdf-merger-js":"^5.1.2",pixelmatch:"^7.1.0",pngjs:"^7.0.0",postcss:"^8.5.4","postcss-cli":"^11.0.1","postcss-inline-svg":"^6.0.0",prettier:"^3.7.4","pretty-bytes":"^7.0.0",puppeteer:"^24.9.0",react:"^19.0.0","react-dom":"^19.1.0",rw:"^1.3.3",semver:"^7.7.2",sharp:"^0.34.2","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.2",stylelint:"^16.20.0","stylelint-config-standard":"^38.0.0","ts-node":"^10.9.2",tslib:"^2.8.1",typedoc:"^0.28.5","typedoc-plugin-markdown":"^4.6.4","typedoc-plugin-missing-exports":"^4.0.0",typescript:"^5.8.3",vitest:"3.1.3","vitest-webgl-canvas-mock":"^1.1.0"},scripts:{"generate-dist-package":"node --no-warnings --loader ts-node/esm build/generate-dist-package.js","generate-shaders":"node --no-warnings --loader ts-node/esm build/generate-shaders.ts","generate-struct-arrays":"node --no-warnings --loader ts-node/esm build/generate-struct-arrays.ts","generate-style-code":"node --no-warnings --loader ts-node/esm build/generate-style-code.ts","generate-typings":"dts-bundle-generator --export-referenced-types --umd-module-name=maplibregl -o ./dist/outdoor-context.d.ts ./src/index.ts","generate-docs":"typedoc && node --no-warnings --loader ts-node/esm build/generate-docs.ts","generate-images":"node --no-warnings --loader ts-node/esm build/generate-doc-images.ts","build-dist":"npm run build-css && npm run generate-typings && npm run generate-shaders && npm run build-dev && npm run build-csp-dev && npm run build-prod && npm run build-csp","build-dev":"BUILD=dev node build/esbuild.mjs","watch-dev":"BUILD=dev node build/esbuild.mjs --watch","build-prod":"BUILD=production node build/esbuild.mjs","build-csp":"BUILD=production node build/esbuild.mjs --csp","build-csp-dev":"BUILD=dev node build/esbuild.mjs --csp","build-css":"postcss -o dist/outdoor-context.css src/css/outdoor-context.css && postcss --config postcss.config.min.js -o dist/outdoor-context-min.css src/css/outdoor-context-min.css","watch-css":"postcss --watch -o dist/outdoor-context.css src/css/outdoor-context.css",spellcheck:"cspell","start-server":"st --no-cache -H localhost --port 9966 .","start-docs":"docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint","lint-css":"stylelint **/*.css --fix -f verbose",test:"run-p lint lint-css test-render test-unit test-integration test-build","test-unit":"vitest run --config vitest.config.unit.ts","test-unit-ci":"vitest run --config vitest.config.unit.ts --coverage","test-integration":"vitest run --config vitest.config.integration.ts","test-integration-ci":"vitest run --config vitest.config.integration.ts --coverage","test-build":"vitest run --config vitest.config.build.ts","test-build-ci":"vitest run --config vitest.config.build.ts --coverage","test-watch-roots":"vitest --config vitest.config.unit.ts --watch","test-render":"node --no-warnings --loader ts-node/esm test/integration/render/run_render_tests.ts",codegen:"run-p --print-label generate-dist-package generate-style-code generate-struct-arrays generate-shaders && npm run generate-typings",benchmark:"node --no-warnings --loader ts-node/esm test/bench/run-benchmarks.ts","gl-stats":"node --no-warnings --loader ts-node/esm test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings","prettier:check":"prettier --check .","prettier:fix":"prettier --write .","publish:ci":'pnpm publish -r --no-git-checks --ignore-scripts --force --registry "https://npm.pkg.github.com/"',"version:ci":"pnpm version prerelease --no-git-tag-version","test:ci:cover":"mkdir .nyc_temp || true && pnpm cover && pnpm cover:merge && pnpm cover:report && pnpm cover:cleanup",cover:"nyc --silent pnpm test-unit-ci && cp ./coverage/vitest/unit/coverage-final.json ./.nyc_temp/coverage-maplibre.json","cover:merge":"nyc merge .nyc_temp ./.nyc_final/coverage.json","cover:report":"nyc report --reporter=json-summary --report-dir coverage/combined --temp-dir ./.nyc_final","cover:cleanup":"rm -r ./.nyc_final ./.nyc_temp ./.nyc_output"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0",pnpm:">=10.11.0"},volta:{node:"24.12.0"},"lint-staged":{"*.{ts,tsx,js,jsx,json,css,md}":["prettier --write"]}},Rw=se(ce(),1),zw=se(Ew(),1),zh;function Mg(){return zh==null&&(zh=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),zh}var zs;function Bw(){if(zs==null&&(zs=!1,Mg())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<25;i++){let r=i*4;e.fillStyle="rgb(".concat(r,",").concat(r+1,",").concat(r+2,")"),e.fillRect(i%5,Math.floor(i/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!==3&&t[i]!==i){zs=!0;break}}}return zs||!1}var ue=1e-6,Fe=typeof Float32Array<"u"?Float32Array:Array,Vi=Math.random,fj=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var _o={};wn(_o,{LDU:()=>Qw,add:()=>e2,adjoint:()=>qw,clone:()=>Fw,copy:()=>Nw,create:()=>Ow,determinant:()=>$w,equals:()=>i2,exactEquals:()=>t2,frob:()=>Jw,fromRotation:()=>Ww,fromScaling:()=>Hw,fromValues:()=>jw,identity:()=>Vw,invert:()=>Xw,mul:()=>a2,multiply:()=>Ig,multiplyScalar:()=>r2,multiplyScalarAndAdd:()=>n2,rotate:()=>Yw,scale:()=>Zw,set:()=>Uw,str:()=>Kw,sub:()=>o2,subtract:()=>Eg,transpose:()=>Gw});function Ow(){var e=new Fe(4);return Fe!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function Fw(e){var t=new Fe(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Nw(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Vw(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function jw(e,t,i,r){var n=new Fe(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function Uw(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function Gw(e,t){if(e===t){var i=t[1];e[1]=t[2],e[2]=i}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function Xw(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*a-n*r;return o?(o=1/o,e[0]=a*o,e[1]=-r*o,e[2]=-n*o,e[3]=i*o,e):null}function qw(e,t){var i=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=i,e}function $w(e){return e[0]*e[3]-e[2]*e[1]}function Ig(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*s+a*l,e[1]=n*s+o*l,e[2]=r*u+a*h,e[3]=n*u+o*h,e}function Yw(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+a*s,e[1]=n*l+o*s,e[2]=r*-s+a*l,e[3]=n*-s+o*l,e}function Zw(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1];return e[0]=r*s,e[1]=n*s,e[2]=a*l,e[3]=o*l,e}function Ww(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e}function Hw(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function Kw(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function Jw(e){return Math.hypot(e[0],e[1],e[2],e[3])}function Qw(e,t,i,r){return e[2]=r[2]/r[0],i[0]=r[0],i[1]=r[1],i[3]=r[3]-e[2]*i[1],[e,t,i]}function e2(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function Eg(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function t2(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function i2(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(i-o)<=ue*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=ue*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=ue*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=ue*Math.max(1,Math.abs(a),Math.abs(u))}function r2(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function n2(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e}var a2=Ig,o2=Eg,xo={};wn(xo,{add:()=>E2,adjoint:()=>m2,clone:()=>l2,copy:()=>u2,create:()=>Ag,determinant:()=>y2,equals:()=>L2,exactEquals:()=>D2,frob:()=>I2,fromMat2d:()=>P2,fromMat4:()=>s2,fromQuat:()=>T2,fromRotation:()=>b2,fromScaling:()=>w2,fromTranslation:()=>v2,fromValues:()=>h2,identity:()=>p2,invert:()=>f2,mul:()=>R2,multiply:()=>kg,multiplyScalar:()=>A2,multiplyScalarAndAdd:()=>k2,normalFromMat4:()=>S2,projection:()=>C2,rotate:()=>_2,scale:()=>x2,set:()=>c2,str:()=>M2,sub:()=>z2,subtract:()=>Dg,translate:()=>g2,transpose:()=>d2});function Ag(){var e=new Fe(9);return Fe!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function s2(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function l2(e){var t=new Fe(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function u2(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function h2(e,t,i,r,n,a,o,s,l){var u=new Fe(9);return u[0]=e,u[1]=t,u[2]=i,u[3]=r,u[4]=n,u[5]=a,u[6]=o,u[7]=s,u[8]=l,u}function c2(e,t,i,r,n,a,o,s,l,u){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e}function p2(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function d2(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function f2(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=h*o-s*u,p=-h*a+s*l,d=u*a-o*l,f=i*c+r*p+n*d;return f?(f=1/f,e[0]=c*f,e[1]=(-h*r+n*u)*f,e[2]=(s*r-n*o)*f,e[3]=p*f,e[4]=(h*i-n*l)*f,e[5]=(-s*i+n*a)*f,e[6]=d*f,e[7]=(-u*i+r*l)*f,e[8]=(o*i-r*a)*f,e):null}function m2(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8];return e[0]=o*h-s*u,e[1]=n*u-r*h,e[2]=r*s-n*o,e[3]=s*l-a*h,e[4]=i*h-n*l,e[5]=n*a-i*s,e[6]=a*u-o*l,e[7]=r*l-i*u,e[8]=i*o-r*a,e}function y2(e){var t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*(u*a-o*l)+i*(-u*n+o*s)+r*(l*n-a*s)}function kg(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=i[0],d=i[1],f=i[2],y=i[3],g=i[4],_=i[5],b=i[6],v=i[7],w=i[8];return e[0]=p*r+d*o+f*u,e[1]=p*n+d*s+f*h,e[2]=p*a+d*l+f*c,e[3]=y*r+g*o+_*u,e[4]=y*n+g*s+_*h,e[5]=y*a+g*l+_*c,e[6]=b*r+v*o+w*u,e[7]=b*n+v*s+w*h,e[8]=b*a+v*l+w*c,e}function g2(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=i[0],d=i[1];return e[0]=r,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=p*r+d*o+u,e[7]=p*n+d*s+h,e[8]=p*a+d*l+c,e}function _2(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=Math.sin(i),d=Math.cos(i);return e[0]=d*r+p*o,e[1]=d*n+p*s,e[2]=d*a+p*l,e[3]=d*o-p*r,e[4]=d*s-p*n,e[5]=d*l-p*a,e[6]=u,e[7]=h,e[8]=c,e}function x2(e,t,i){var r=i[0],n=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function v2(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function b2(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function w2(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function P2(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function T2(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,h=r*o,c=r*s,p=n*o,d=n*s,f=n*l,y=a*o,g=a*s,_=a*l;return e[0]=1-c-f,e[3]=h-_,e[6]=p+g,e[1]=h+_,e[4]=1-u-f,e[7]=d-y,e[2]=p-g,e[5]=d+y,e[8]=1-u-c,e}function S2(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15],b=i*s-r*o,v=i*l-n*o,w=i*u-a*o,T=r*l-n*s,S=r*u-a*s,M=n*u-a*l,E=h*y-c*f,L=h*g-p*f,z=h*_-d*f,R=c*g-p*y,k=c*_-d*y,D=p*_-d*g,x=b*D-v*k+w*R+T*z-S*L+M*E;return x?(x=1/x,e[0]=(s*D-l*k+u*R)*x,e[1]=(l*z-o*D-u*L)*x,e[2]=(o*k-s*z+u*E)*x,e[3]=(n*k-r*D-a*R)*x,e[4]=(i*D-n*z+a*L)*x,e[5]=(r*z-i*k-a*E)*x,e[6]=(y*M-g*S+_*T)*x,e[7]=(g*w-f*M-_*v)*x,e[8]=(f*S-y*w+_*b)*x,e):null}function C2(e,t,i){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/i,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function M2(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function I2(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function E2(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e}function Dg(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e}function A2(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e}function k2(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e}function D2(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function L2(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=t[0],p=t[1],d=t[2],f=t[3],y=t[4],g=t[5],_=t[6],b=t[7],v=t[8];return Math.abs(i-c)<=ue*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(r-p)<=ue*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(n-d)<=ue*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(a-f)<=ue*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(o-y)<=ue*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-g)<=ue*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-_)<=ue*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(u-b)<=ue*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(h-v)<=ue*Math.max(1,Math.abs(h),Math.abs(v))}var R2=kg,z2=Dg,V={};wn(V,{add:()=>xP,adjoint:()=>G2,clone:()=>O2,copy:()=>F2,create:()=>B2,determinant:()=>X2,equals:()=>PP,exactEquals:()=>wP,frob:()=>_P,fromQuat:()=>lP,fromQuat2:()=>rP,fromRotation:()=>Q2,fromRotationTranslation:()=>zg,fromRotationTranslationScale:()=>oP,fromRotationTranslationScaleOrigin:()=>sP,fromScaling:()=>J2,fromTranslation:()=>K2,fromValues:()=>N2,fromXRotation:()=>eP,fromYRotation:()=>tP,fromZRotation:()=>iP,frustum:()=>uP,getRotation:()=>aP,getScaling:()=>Bg,getTranslation:()=>nP,identity:()=>Lg,invert:()=>U2,lookAt:()=>mP,mul:()=>TP,multiply:()=>Rg,multiplyScalar:()=>vP,multiplyScalarAndAdd:()=>bP,ortho:()=>dP,orthoNO:()=>Fg,orthoZO:()=>fP,perspective:()=>hP,perspectiveFromFieldOfView:()=>pP,perspectiveNO:()=>Og,perspectiveZO:()=>cP,rotate:()=>Y2,rotateX:()=>Z2,rotateY:()=>W2,rotateZ:()=>H2,scale:()=>$2,set:()=>V2,str:()=>gP,sub:()=>SP,subtract:()=>Ng,targetTo:()=>yP,translate:()=>q2,transpose:()=>j2});function B2(){var e=new Fe(16);return Fe!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function O2(e){var t=new Fe(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function F2(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function N2(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y){var g=new Fe(16);return g[0]=e,g[1]=t,g[2]=i,g[3]=r,g[4]=n,g[5]=a,g[6]=o,g[7]=s,g[8]=l,g[9]=u,g[10]=h,g[11]=c,g[12]=p,g[13]=d,g[14]=f,g[15]=y,g}function V2(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e[9]=h,e[10]=c,e[11]=p,e[12]=d,e[13]=f,e[14]=y,e[15]=g,e}function Lg(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function j2(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function U2(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15],b=i*s-r*o,v=i*l-n*o,w=i*u-a*o,T=r*l-n*s,S=r*u-a*s,M=n*u-a*l,E=h*y-c*f,L=h*g-p*f,z=h*_-d*f,R=c*g-p*y,k=c*_-d*y,D=p*_-d*g,x=b*D-v*k+w*R+T*z-S*L+M*E;return x?(x=1/x,e[0]=(s*D-l*k+u*R)*x,e[1]=(n*k-r*D-a*R)*x,e[2]=(y*M-g*S+_*T)*x,e[3]=(p*S-c*M-d*T)*x,e[4]=(l*z-o*D-u*L)*x,e[5]=(i*D-n*z+a*L)*x,e[6]=(g*w-f*M-_*v)*x,e[7]=(h*M-p*w+d*v)*x,e[8]=(o*k-s*z+u*E)*x,e[9]=(r*z-i*k-a*E)*x,e[10]=(f*S-y*w+_*b)*x,e[11]=(c*w-h*S-d*b)*x,e[12]=(s*L-o*R-l*E)*x,e[13]=(i*R-r*L+n*E)*x,e[14]=(y*v-f*T-g*b)*x,e[15]=(h*T-c*v+p*b)*x,e):null}function G2(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15];return e[0]=s*(p*_-d*g)-c*(l*_-u*g)+y*(l*d-u*p),e[1]=-(r*(p*_-d*g)-c*(n*_-a*g)+y*(n*d-a*p)),e[2]=r*(l*_-u*g)-s*(n*_-a*g)+y*(n*u-a*l),e[3]=-(r*(l*d-u*p)-s*(n*d-a*p)+c*(n*u-a*l)),e[4]=-(o*(p*_-d*g)-h*(l*_-u*g)+f*(l*d-u*p)),e[5]=i*(p*_-d*g)-h*(n*_-a*g)+f*(n*d-a*p),e[6]=-(i*(l*_-u*g)-o*(n*_-a*g)+f*(n*u-a*l)),e[7]=i*(l*d-u*p)-o*(n*d-a*p)+h*(n*u-a*l),e[8]=o*(c*_-d*y)-h*(s*_-u*y)+f*(s*d-u*c),e[9]=-(i*(c*_-d*y)-h*(r*_-a*y)+f*(r*d-a*c)),e[10]=i*(s*_-u*y)-o*(r*_-a*y)+f*(r*u-a*s),e[11]=-(i*(s*d-u*c)-o*(r*d-a*c)+h*(r*u-a*s)),e[12]=-(o*(c*g-p*y)-h*(s*g-l*y)+f*(s*p-l*c)),e[13]=i*(c*g-p*y)-h*(r*g-n*y)+f*(r*p-n*c),e[14]=-(i*(s*g-l*y)-o*(r*g-n*y)+f*(r*l-n*s)),e[15]=i*(s*p-l*c)-o*(r*p-n*c)+h*(r*l-n*s),e}function X2(e){var t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],h=e[9],c=e[10],p=e[11],d=e[12],f=e[13],y=e[14],g=e[15],_=t*o-i*a,b=t*s-r*a,v=t*l-n*a,w=i*s-r*o,T=i*l-n*o,S=r*l-n*s,M=u*f-h*d,E=u*y-c*d,L=u*g-p*d,z=h*y-c*f,R=h*g-p*f,k=c*g-p*y;return _*k-b*R+v*z+w*L-T*E+S*M}function Rg(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],d=t[10],f=t[11],y=t[12],g=t[13],_=t[14],b=t[15],v=i[0],w=i[1],T=i[2],S=i[3];return e[0]=v*r+w*s+T*c+S*y,e[1]=v*n+w*l+T*p+S*g,e[2]=v*a+w*u+T*d+S*_,e[3]=v*o+w*h+T*f+S*b,v=i[4],w=i[5],T=i[6],S=i[7],e[4]=v*r+w*s+T*c+S*y,e[5]=v*n+w*l+T*p+S*g,e[6]=v*a+w*u+T*d+S*_,e[7]=v*o+w*h+T*f+S*b,v=i[8],w=i[9],T=i[10],S=i[11],e[8]=v*r+w*s+T*c+S*y,e[9]=v*n+w*l+T*p+S*g,e[10]=v*a+w*u+T*d+S*_,e[11]=v*o+w*h+T*f+S*b,v=i[12],w=i[13],T=i[14],S=i[15],e[12]=v*r+w*s+T*c+S*y,e[13]=v*n+w*l+T*p+S*g,e[14]=v*a+w*u+T*d+S*_,e[15]=v*o+w*h+T*f+S*b,e}function q2(e,t,i){var r=i[0],n=i[1],a=i[2],o,s,l,u,h,c,p,d,f,y,g,_;return t===e?(e[12]=t[0]*r+t[4]*n+t[8]*a+t[12],e[13]=t[1]*r+t[5]*n+t[9]*a+t[13],e[14]=t[2]*r+t[6]*n+t[10]*a+t[14],e[15]=t[3]*r+t[7]*n+t[11]*a+t[15]):(o=t[0],s=t[1],l=t[2],u=t[3],h=t[4],c=t[5],p=t[6],d=t[7],f=t[8],y=t[9],g=t[10],_=t[11],e[0]=o,e[1]=s,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=p,e[7]=d,e[8]=f,e[9]=y,e[10]=g,e[11]=_,e[12]=o*r+h*n+f*a+t[12],e[13]=s*r+c*n+y*a+t[13],e[14]=l*r+p*n+g*a+t[14],e[15]=u*r+d*n+_*a+t[15]),e}function $2(e,t,i){var r=i[0],n=i[1],a=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Y2(e,t,i,r){var n=r[0],a=r[1],o=r[2],s=Math.hypot(n,a,o),l,u,h,c,p,d,f,y,g,_,b,v,w,T,S,M,E,L,z,R,k,D,x,C;return s<ue?null:(s=1/s,n*=s,a*=s,o*=s,l=Math.sin(i),u=Math.cos(i),h=1-u,c=t[0],p=t[1],d=t[2],f=t[3],y=t[4],g=t[5],_=t[6],b=t[7],v=t[8],w=t[9],T=t[10],S=t[11],M=n*n*h+u,E=a*n*h+o*l,L=o*n*h-a*l,z=n*a*h-o*l,R=a*a*h+u,k=o*a*h+n*l,D=n*o*h+a*l,x=a*o*h-n*l,C=o*o*h+u,e[0]=c*M+y*E+v*L,e[1]=p*M+g*E+w*L,e[2]=d*M+_*E+T*L,e[3]=f*M+b*E+S*L,e[4]=c*z+y*R+v*k,e[5]=p*z+g*R+w*k,e[6]=d*z+_*R+T*k,e[7]=f*z+b*R+S*k,e[8]=c*D+y*x+v*C,e[9]=p*D+g*x+w*C,e[10]=d*D+_*x+T*C,e[11]=f*D+b*x+S*C,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Z2(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*r,e[5]=o*n+h*r,e[6]=s*n+c*r,e[7]=l*n+p*r,e[8]=u*n-a*r,e[9]=h*n-o*r,e[10]=c*n-s*r,e[11]=p*n-l*r,e}function W2(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*r,e[1]=o*n-h*r,e[2]=s*n-c*r,e[3]=l*n-p*r,e[8]=a*r+u*n,e[9]=o*r+h*n,e[10]=s*r+c*n,e[11]=l*r+p*n,e}function H2(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],h=t[5],c=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*r,e[1]=o*n+h*r,e[2]=s*n+c*r,e[3]=l*n+p*r,e[4]=u*n-a*r,e[5]=h*n-o*r,e[6]=c*n-s*r,e[7]=p*n-l*r,e}function K2(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function J2(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Q2(e,t,i){var r=i[0],n=i[1],a=i[2],o=Math.hypot(r,n,a),s,l,u;return o<ue?null:(o=1/o,r*=o,n*=o,a*=o,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=r*r*u+l,e[1]=n*r*u+a*s,e[2]=a*r*u-n*s,e[3]=0,e[4]=r*n*u-a*s,e[5]=n*n*u+l,e[6]=a*n*u+r*s,e[7]=0,e[8]=r*a*u+n*s,e[9]=n*a*u-r*s,e[10]=a*a*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function eP(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function tP(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function iP(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function zg(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=r+r,l=n+n,u=a+a,h=r*s,c=r*l,p=r*u,d=n*l,f=n*u,y=a*u,g=o*s,_=o*l,b=o*u;return e[0]=1-(d+y),e[1]=c+b,e[2]=p-_,e[3]=0,e[4]=c-b,e[5]=1-(h+y),e[6]=f+g,e[7]=0,e[8]=p+_,e[9]=f-g,e[10]=1-(h+d),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function rP(e,t){var i=new Fe(3),r=-t[0],n=-t[1],a=-t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=r*r+n*n+a*a+o*o;return c>0?(i[0]=(s*o+h*r+l*a-u*n)*2/c,i[1]=(l*o+h*n+u*r-s*a)*2/c,i[2]=(u*o+h*a+s*n-l*r)*2/c):(i[0]=(s*o+h*r+l*a-u*n)*2,i[1]=(l*o+h*n+u*r-s*a)*2,i[2]=(u*o+h*a+s*n-l*r)*2),zg(e,t,i),e}function nP(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Bg(e,t){var i=t[0],r=t[1],n=t[2],a=t[4],o=t[5],s=t[6],l=t[8],u=t[9],h=t[10];return e[0]=Math.hypot(i,r,n),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(l,u,h),e}function aP(e,t){var i=new Fe(3);Bg(i,t);var r=1/i[0],n=1/i[1],a=1/i[2],o=t[0]*r,s=t[1]*n,l=t[2]*a,u=t[4]*r,h=t[5]*n,c=t[6]*a,p=t[8]*r,d=t[9]*n,f=t[10]*a,y=o+h+f,g=0;return y>0?(g=Math.sqrt(y+1)*2,e[3]=.25*g,e[0]=(c-d)/g,e[1]=(p-l)/g,e[2]=(s-u)/g):o>h&&o>f?(g=Math.sqrt(1+o-h-f)*2,e[3]=(c-d)/g,e[0]=.25*g,e[1]=(s+u)/g,e[2]=(p+l)/g):h>f?(g=Math.sqrt(1+h-o-f)*2,e[3]=(p-l)/g,e[0]=(s+u)/g,e[1]=.25*g,e[2]=(c+d)/g):(g=Math.sqrt(1+f-o-h)*2,e[3]=(s-u)/g,e[0]=(p+l)/g,e[1]=(c+d)/g,e[2]=.25*g),e}function oP(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3],l=n+n,u=a+a,h=o+o,c=n*l,p=n*u,d=n*h,f=a*u,y=a*h,g=o*h,_=s*l,b=s*u,v=s*h,w=r[0],T=r[1],S=r[2];return e[0]=(1-(f+g))*w,e[1]=(p+v)*w,e[2]=(d-b)*w,e[3]=0,e[4]=(p-v)*T,e[5]=(1-(c+g))*T,e[6]=(y+_)*T,e[7]=0,e[8]=(d+b)*S,e[9]=(y-_)*S,e[10]=(1-(c+f))*S,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function sP(e,t,i,r,n){var a=t[0],o=t[1],s=t[2],l=t[3],u=a+a,h=o+o,c=s+s,p=a*u,d=a*h,f=a*c,y=o*h,g=o*c,_=s*c,b=l*u,v=l*h,w=l*c,T=r[0],S=r[1],M=r[2],E=n[0],L=n[1],z=n[2],R=(1-(y+_))*T,k=(d+w)*T,D=(f-v)*T,x=(d-w)*S,C=(1-(p+_))*S,I=(g+b)*S,F=(f+v)*M,N=(g-b)*M,G=(1-(p+y))*M;return e[0]=R,e[1]=k,e[2]=D,e[3]=0,e[4]=x,e[5]=C,e[6]=I,e[7]=0,e[8]=F,e[9]=N,e[10]=G,e[11]=0,e[12]=i[0]+E-(R*E+x*L+F*z),e[13]=i[1]+L-(k*E+C*L+N*z),e[14]=i[2]+z-(D*E+I*L+G*z),e[15]=1,e}function lP(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,h=r*o,c=r*s,p=n*o,d=n*s,f=n*l,y=a*o,g=a*s,_=a*l;return e[0]=1-c-f,e[1]=h+_,e[2]=p-g,e[3]=0,e[4]=h-_,e[5]=1-u-f,e[6]=d+y,e[7]=0,e[8]=p+g,e[9]=d-y,e[10]=1-u-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function uP(e,t,i,r,n,a,o){var s=1/(i-t),l=1/(n-r),u=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*l,e[6]=0,e[7]=0,e[8]=(i+t)*s,e[9]=(n+r)*l,e[10]=(o+a)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*u,e[15]=0,e}function Og(e,t,i,r,n){var a=1/Math.tan(t/2),o;return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(r-n),e[10]=(n+r)*o,e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e}var hP=Og;function cP(e,t,i,r,n){var a=1/Math.tan(t/2),o;return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(r-n),e[10]=n*o,e[14]=n*r*o):(e[10]=-1,e[14]=-r),e}function pP(e,t,i,r){var n=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(n+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((o-s)*l*.5),e[9]=(n-a)*u*.5,e[10]=r/(i-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*i/(i-r),e[15]=0,e}function Fg(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=(o+a)*u,e[15]=1,e}var dP=Fg;function fP(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=a*u,e[15]=1,e}function mP(e,t,i,r){var n,a,o,s,l,u,h,c,p,d,f=t[0],y=t[1],g=t[2],_=r[0],b=r[1],v=r[2],w=i[0],T=i[1],S=i[2];return Math.abs(f-w)<ue&&Math.abs(y-T)<ue&&Math.abs(g-S)<ue?Lg(e):(h=f-w,c=y-T,p=g-S,d=1/Math.hypot(h,c,p),h*=d,c*=d,p*=d,n=b*p-v*c,a=v*h-_*p,o=_*c-b*h,d=Math.hypot(n,a,o),d?(d=1/d,n*=d,a*=d,o*=d):(n=0,a=0,o=0),s=c*o-p*a,l=p*n-h*o,u=h*a-c*n,d=Math.hypot(s,l,u),d?(d=1/d,s*=d,l*=d,u*=d):(s=0,l=0,u=0),e[0]=n,e[1]=s,e[2]=h,e[3]=0,e[4]=a,e[5]=l,e[6]=c,e[7]=0,e[8]=o,e[9]=u,e[10]=p,e[11]=0,e[12]=-(n*f+a*y+o*g),e[13]=-(s*f+l*y+u*g),e[14]=-(h*f+c*y+p*g),e[15]=1,e)}function yP(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=r[0],l=r[1],u=r[2],h=n-i[0],c=a-i[1],p=o-i[2],d=h*h+c*c+p*p;d>0&&(d=1/Math.sqrt(d),h*=d,c*=d,p*=d);var f=l*p-u*c,y=u*h-s*p,g=s*c-l*h;return d=f*f+y*y+g*g,d>0&&(d=1/Math.sqrt(d),f*=d,y*=d,g*=d),e[0]=f,e[1]=y,e[2]=g,e[3]=0,e[4]=c*g-p*y,e[5]=p*f-h*g,e[6]=h*y-c*f,e[7]=0,e[8]=h,e[9]=c,e[10]=p,e[11]=0,e[12]=n,e[13]=a,e[14]=o,e[15]=1,e}function gP(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function _P(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function xP(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e}function Ng(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}function vP(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e}function bP(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e[9]=t[9]+i[9]*r,e[10]=t[10]+i[10]*r,e[11]=t[11]+i[11]*r,e[12]=t[12]+i[12]*r,e[13]=t[13]+i[13]*r,e[14]=t[14]+i[14]*r,e[15]=t[15]+i[15]*r,e}function wP(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function PP(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],p=e[10],d=e[11],f=e[12],y=e[13],g=e[14],_=e[15],b=t[0],v=t[1],w=t[2],T=t[3],S=t[4],M=t[5],E=t[6],L=t[7],z=t[8],R=t[9],k=t[10],D=t[11],x=t[12],C=t[13],I=t[14],F=t[15];return Math.abs(i-b)<=ue*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(r-v)<=ue*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-w)<=ue*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(a-T)<=ue*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(o-S)<=ue*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(s-M)<=ue*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(l-E)<=ue*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-L)<=ue*Math.max(1,Math.abs(u),Math.abs(L))&&Math.abs(h-z)<=ue*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(c-R)<=ue*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(p-k)<=ue*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(d-D)<=ue*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(f-x)<=ue*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(y-C)<=ue*Math.max(1,Math.abs(y),Math.abs(C))&&Math.abs(g-I)<=ue*Math.max(1,Math.abs(g),Math.abs(I))&&Math.abs(_-F)<=ue*Math.max(1,Math.abs(_),Math.abs(F))}var TP=Rg,SP=Ng,Yl={};wn(Yl,{add:()=>$T,calculateW:()=>zT,clone:()=>UT,conjugate:()=>NT,copy:()=>XT,create:()=>vc,dot:()=>__,equals:()=>JT,exactEquals:()=>KT,exp:()=>f_,fromEuler:()=>VT,fromMat3:()=>y_,fromValues:()=>GT,getAngle:()=>kT,getAxisAngle:()=>AT,identity:()=>ET,invert:()=>FT,len:()=>WT,length:()=>x_,lerp:()=>ZT,ln:()=>m_,mul:()=>YT,multiply:()=>d_,normalize:()=>wp,pow:()=>BT,random:()=>OT,rotateX:()=>DT,rotateY:()=>LT,rotateZ:()=>RT,rotationTo:()=>QT,scale:()=>g_,set:()=>qT,setAxes:()=>tS,setAxisAngle:()=>p_,slerp:()=>gl,sqlerp:()=>eS,sqrLen:()=>HT,squaredLength:()=>v_,str:()=>jT});var U={};wn(U,{add:()=>EP,angle:()=>WP,bezier:()=>jP,ceil:()=>AP,clone:()=>CP,copy:()=>MP,create:()=>_p,cross:()=>yl,dist:()=>rT,distance:()=>Xg,div:()=>iT,divide:()=>Gg,dot:()=>xp,equals:()=>QP,exactEquals:()=>JP,floor:()=>kP,forEach:()=>oT,fromValues:()=>xc,hermite:()=>VP,inverse:()=>FP,len:()=>Zg,length:()=>Vg,lerp:()=>NP,max:()=>LP,min:()=>DP,mul:()=>tT,multiply:()=>Ug,negate:()=>OP,normalize:()=>Yg,random:()=>UP,rotateX:()=>$P,rotateY:()=>YP,rotateZ:()=>ZP,round:()=>RP,scale:()=>zP,scaleAndAdd:()=>BP,set:()=>IP,sqrDist:()=>nT,sqrLen:()=>aT,squaredDistance:()=>qg,squaredLength:()=>$g,str:()=>KP,sub:()=>eT,subtract:()=>jg,transformMat3:()=>XP,transformMat4:()=>GP,transformQuat:()=>qP,zero:()=>HP});function _p(){var e=new Fe(3);return Fe!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function CP(e){var t=new Fe(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Vg(e){var t=e[0],i=e[1],r=e[2];return Math.hypot(t,i,r)}function xc(e,t,i){var r=new Fe(3);return r[0]=e,r[1]=t,r[2]=i,r}function MP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function IP(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e}function EP(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function jg(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function Ug(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function Gg(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function AP(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function kP(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function DP(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function LP(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function RP(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function zP(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function BP(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function Xg(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.hypot(i,r,n)}function qg(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function $g(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function OP(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function FP(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Yg(e,t){var i=t[0],r=t[1],n=t[2],a=i*i+r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function xp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function yl(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2];return e[0]=n*l-a*s,e[1]=a*o-r*l,e[2]=r*s-n*o,e}function NP(e,t,i,r){var n=t[0],a=t[1],o=t[2];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e[2]=o+r*(i[2]-o),e}function VP(e,t,i,r,n,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),h=o*(3-2*a);return e[0]=t[0]*s+i[0]*l+r[0]*u+n[0]*h,e[1]=t[1]*s+i[1]*l+r[1]*u+n[1]*h,e[2]=t[2]*s+i[2]*l+r[2]*u+n[2]*h,e}function jP(e,t,i,r,n,a){var o=1-a,s=o*o,l=a*a,u=s*o,h=3*a*s,c=3*l*o,p=l*a;return e[0]=t[0]*u+i[0]*h+r[0]*c+n[0]*p,e[1]=t[1]*u+i[1]*h+r[1]*c+n[1]*p,e[2]=t[2]*u+i[2]*h+r[2]*c+n[2]*p,e}function UP(e,t){t=t||1;var i=Vi()*2*Math.PI,r=Vi()*2-1,n=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(i)*n,e[1]=Math.sin(i)*n,e[2]=r*t,e}function GP(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[3]*r+i[7]*n+i[11]*a+i[15];return o=o||1,e[0]=(i[0]*r+i[4]*n+i[8]*a+i[12])/o,e[1]=(i[1]*r+i[5]*n+i[9]*a+i[13])/o,e[2]=(i[2]*r+i[6]*n+i[10]*a+i[14])/o,e}function XP(e,t,i){var r=t[0],n=t[1],a=t[2];return e[0]=r*i[0]+n*i[3]+a*i[6],e[1]=r*i[1]+n*i[4]+a*i[7],e[2]=r*i[2]+n*i[5]+a*i[8],e}function qP(e,t,i){var r=i[0],n=i[1],a=i[2],o=i[3],s=t[0],l=t[1],u=t[2],h=n*u-a*l,c=a*s-r*u,p=r*l-n*s,d=n*p-a*c,f=a*h-r*p,y=r*c-n*h,g=o*2;return h*=g,c*=g,p*=g,d*=2,f*=2,y*=2,e[0]=s+h+d,e[1]=l+c+f,e[2]=u+p+y,e}function $P(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[0],a[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),a[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function YP(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),a[1]=n[1],a[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function ZP(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),a[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),a[2]=n[2],e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function WP(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2],l=Math.sqrt(i*i+r*r+n*n),u=Math.sqrt(a*a+o*o+s*s),h=l*u,c=h&&xp(e,t)/h;return Math.acos(Math.min(Math.max(c,-1),1))}function HP(e){return e[0]=0,e[1]=0,e[2]=0,e}function KP(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function JP(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function QP(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(i-a)<=ue*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=ue*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=ue*Math.max(1,Math.abs(n),Math.abs(s))}var eT=jg,tT=Ug,iT=Gg,rT=Xg,nT=qg,Zg=Vg,aT=$g,oT=(function(){var e=_p();return function(t,i,r,n,a,o){var s,l;for(i||(i=3),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}})(),at={};wn(at,{add:()=>e_,ceil:()=>sT,clone:()=>Hg,copy:()=>Jg,create:()=>Wg,cross:()=>mT,dist:()=>TT,distance:()=>a_,div:()=>PT,divide:()=>r_,dot:()=>l_,equals:()=>c_,exactEquals:()=>h_,floor:()=>lT,forEach:()=>IT,fromValues:()=>Kg,inverse:()=>fT,len:()=>CT,length:()=>vp,lerp:()=>u_,max:()=>hT,min:()=>uT,mul:()=>wT,multiply:()=>i_,negate:()=>dT,normalize:()=>s_,random:()=>yT,round:()=>cT,scale:()=>n_,scaleAndAdd:()=>pT,set:()=>Qg,sqrDist:()=>ST,sqrLen:()=>MT,squaredDistance:()=>o_,squaredLength:()=>bp,str:()=>vT,sub:()=>bT,subtract:()=>t_,transformMat4:()=>gT,transformQuat:()=>_T,zero:()=>xT});function Wg(){var e=new Fe(4);return Fe!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Hg(e){var t=new Fe(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Kg(e,t,i,r){var n=new Fe(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function Jg(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Qg(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function e_(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function t_(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function i_(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function r_(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function sT(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function lT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function uT(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e}function hT(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e}function cT(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function n_(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function pT(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e}function a_(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.hypot(i,r,n,a)}function o_(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return i*i+r*r+n*n+a*a}function vp(e){var t=e[0],i=e[1],r=e[2],n=e[3];return Math.hypot(t,i,r,n)}function bp(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n}function dT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function fT(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function s_(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=i*o,e[1]=r*o,e[2]=n*o,e[3]=a*o,e}function l_(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function mT(e,t,i,r){var n=i[0]*r[1]-i[1]*r[0],a=i[0]*r[2]-i[2]*r[0],o=i[0]*r[3]-i[3]*r[0],s=i[1]*r[2]-i[2]*r[1],l=i[1]*r[3]-i[3]*r[1],u=i[2]*r[3]-i[3]*r[2],h=t[0],c=t[1],p=t[2],d=t[3];return e[0]=c*u-p*l+d*s,e[1]=-(h*u)+p*o-d*a,e[2]=h*l-c*o+d*n,e[3]=-(h*s)+c*a-p*n,e}function u_(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e[2]=o+r*(i[2]-o),e[3]=s+r*(i[3]-s),e}function yT(e,t){t=t||1;var i,r,n,a,o,s;do i=Vi()*2-1,r=Vi()*2-1,o=i*i+r*r;while(o>=1);do n=Vi()*2-1,a=Vi()*2-1,s=n*n+a*a;while(s>=1);var l=Math.sqrt((1-o)/s);return e[0]=t*i,e[1]=t*r,e[2]=t*n*l,e[3]=t*a*l,e}function gT(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*a+i[12]*o,e[1]=i[1]*r+i[5]*n+i[9]*a+i[13]*o,e[2]=i[2]*r+i[6]*n+i[10]*a+i[14]*o,e[3]=i[3]*r+i[7]*n+i[11]*a+i[15]*o,e}function _T(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2],u=i[3],h=u*r+s*a-l*n,c=u*n+l*r-o*a,p=u*a+o*n-s*r,d=-o*r-s*n-l*a;return e[0]=h*u+d*-o+c*-l-p*-s,e[1]=c*u+d*-s+p*-o-h*-l,e[2]=p*u+d*-l+h*-s-c*-o,e[3]=t[3],e}function xT(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function vT(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function h_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function c_(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(i-o)<=ue*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=ue*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=ue*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=ue*Math.max(1,Math.abs(a),Math.abs(u))}var bT=t_,wT=i_,PT=r_,TT=a_,ST=o_,CT=vp,MT=bp,IT=(function(){var e=Wg();return function(t,i,r,n,a,o){var s,l;for(i||(i=4),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}})();function vc(){var e=new Fe(4);return Fe!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ET(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function p_(e,t,i){i=i*.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function AT(e,t){var i=Math.acos(t[3])*2,r=Math.sin(i/2);return r>ue?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),i}function kT(e,t){var i=__(e,t);return Math.acos(2*i*i-1)}function d_(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*h+o*s+n*u-a*l,e[1]=n*h+o*l+a*s-r*u,e[2]=a*h+o*u+r*l-n*s,e[3]=o*h-r*s-n*l-a*u,e}function DT(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-r*s,e}function LT(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l-a*s,e[1]=n*l+o*s,e[2]=a*l+r*s,e[3]=o*l-n*s,e}function RT(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*s,e[1]=n*l-r*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e}function zT(e,t){var i=t[0],r=t[1],n=t[2];return e[0]=i,e[1]=r,e[2]=n,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),e}function f_(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=Math.sqrt(i*i+r*r+n*n),s=Math.exp(a),l=o>0?s*Math.sin(o)/o:0;return e[0]=i*l,e[1]=r*l,e[2]=n*l,e[3]=s*Math.cos(o),e}function m_(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=Math.sqrt(i*i+r*r+n*n),s=o>0?Math.atan2(o,a)/o:0;return e[0]=i*s,e[1]=r*s,e[2]=n*s,e[3]=.5*Math.log(i*i+r*r+n*n+a*a),e}function BT(e,t,i){return m_(e,t),g_(e,e,i),f_(e,e),e}function gl(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3],l=i[0],u=i[1],h=i[2],c=i[3],p,d,f,y,g;return d=n*l+a*u+o*h+s*c,d<0&&(d=-d,l=-l,u=-u,h=-h,c=-c),1-d>ue?(p=Math.acos(d),f=Math.sin(p),y=Math.sin((1-r)*p)/f,g=Math.sin(r*p)/f):(y=1-r,g=r),e[0]=y*n+g*l,e[1]=y*a+g*u,e[2]=y*o+g*h,e[3]=y*s+g*c,e}function OT(e){var t=Vi(),i=Vi(),r=Vi(),n=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*i),e[1]=n*Math.cos(2*Math.PI*i),e[2]=a*Math.sin(2*Math.PI*r),e[3]=a*Math.cos(2*Math.PI*r),e}function FT(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a,s=o?1/o:0;return e[0]=-i*s,e[1]=-r*s,e[2]=-n*s,e[3]=a*s,e}function NT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function y_(e,t){var i=t[0]+t[4]+t[8],r;if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;r=Math.sqrt(t[n*3+n]-t[a*3+a]-t[o*3+o]+1),e[n]=.5*r,r=.5/r,e[3]=(t[a*3+o]-t[o*3+a])*r,e[a]=(t[a*3+n]+t[n*3+a])*r,e[o]=(t[o*3+n]+t[n*3+o])*r}return e}function VT(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(i),l=Math.cos(i),u=Math.sin(r),h=Math.cos(r);return e[0]=a*l*h-o*s*u,e[1]=o*s*h+a*l*u,e[2]=o*l*u-a*s*h,e[3]=o*l*h+a*s*u,e}function jT(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var UT=Hg,GT=Kg,XT=Jg,qT=Qg,$T=e_,YT=d_,g_=n_,__=l_,ZT=u_,x_=vp,WT=x_,v_=bp,HT=v_,wp=s_,KT=h_,JT=c_,QT=(function(){var e=_p(),t=xc(1,0,0),i=xc(0,1,0);return function(r,n,a){var o=xp(n,a);return o<-.999999?(yl(e,t,n),Zg(e)<1e-6&&yl(e,i,n),Yg(e,e),p_(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(yl(e,n,a),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,wp(r,r))}})(),eS=(function(){var e=vc(),t=vc();return function(i,r,n,a,o,s){return gl(e,r,o,s),gl(t,n,a,s),gl(i,e,t,2*s*(1-s)),i}})(),tS=(function(){var e=Ag();return function(t,i,r,n){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=n[0],e[4]=n[1],e[7]=n[2],e[2]=-i[0],e[5]=-i[1],e[8]=-i[2],wp(t,y_(t,e))}})(),Bt={};wn(Bt,{add:()=>oS,angle:()=>CS,ceil:()=>sS,clone:()=>iS,copy:()=>nS,create:()=>b_,cross:()=>_S,dist:()=>zS,distance:()=>S_,div:()=>RS,divide:()=>T_,dot:()=>gS,equals:()=>AS,exactEquals:()=>ES,floor:()=>lS,forEach:()=>FS,fromValues:()=>rS,inverse:()=>mS,len:()=>kS,length:()=>M_,lerp:()=>xS,max:()=>hS,min:()=>uS,mul:()=>LS,multiply:()=>P_,negate:()=>fS,normalize:()=>yS,random:()=>vS,rotate:()=>SS,round:()=>cS,scale:()=>pS,scaleAndAdd:()=>dS,set:()=>aS,sqrDist:()=>BS,sqrLen:()=>OS,squaredDistance:()=>C_,squaredLength:()=>I_,str:()=>IS,sub:()=>DS,subtract:()=>w_,transformMat2:()=>bS,transformMat2d:()=>wS,transformMat3:()=>PS,transformMat4:()=>TS,zero:()=>MS});function b_(){var e=new Fe(2);return Fe!=Float32Array&&(e[0]=0,e[1]=0),e}function iS(e){var t=new Fe(2);return t[0]=e[0],t[1]=e[1],t}function rS(e,t){var i=new Fe(2);return i[0]=e,i[1]=t,i}function nS(e,t){return e[0]=t[0],e[1]=t[1],e}function aS(e,t,i){return e[0]=t,e[1]=i,e}function oS(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function w_(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function P_(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function T_(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function sS(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function lS(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function uS(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e}function hS(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e}function cS(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function pS(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function dS(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e}function S_(e,t){var i=t[0]-e[0],r=t[1]-e[1];return Math.hypot(i,r)}function C_(e,t){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function M_(e){var t=e[0],i=e[1];return Math.hypot(t,i)}function I_(e){var t=e[0],i=e[1];return t*t+i*i}function fS(e,t){return e[0]=-t[0],e[1]=-t[1],e}function mS(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function yS(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function gS(e,t){return e[0]*t[0]+e[1]*t[1]}function _S(e,t,i){var r=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=r,e}function xS(e,t,i,r){var n=t[0],a=t[1];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e}function vS(e,t){t=t||1;var i=Vi()*2*Math.PI;return e[0]=Math.cos(i)*t,e[1]=Math.sin(i)*t,e}function bS(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e}function wS(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n+i[4],e[1]=i[1]*r+i[3]*n+i[5],e}function PS(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[3]*n+i[6],e[1]=i[1]*r+i[4]*n+i[7],e}function TS(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e}function SS(e,t,i,r){var n=t[0]-i[0],a=t[1]-i[1],o=Math.sin(r),s=Math.cos(r);return e[0]=n*s-a*o+i[0],e[1]=n*o+a*s+i[1],e}function CS(e,t){var i=e[0],r=e[1],n=t[0],a=t[1],o=Math.sqrt(i*i+r*r)*Math.sqrt(n*n+a*a),s=o&&(i*n+r*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function MS(e){return e[0]=0,e[1]=0,e}function IS(e){return"vec2("+e[0]+", "+e[1]+")"}function ES(e,t){return e[0]===t[0]&&e[1]===t[1]}function AS(e,t){var i=e[0],r=e[1],n=t[0],a=t[1];return Math.abs(i-n)<=ue*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-a)<=ue*Math.max(1,Math.abs(r),Math.abs(a))}var kS=M_,DS=w_,LS=P_,RS=T_,zS=S_,BS=C_,OS=I_,FS=(function(){var e=b_();return function(t,i,r,n,a,o){var s,l;for(i||(i=2),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}})();function $t(e,t,i){return t*(8192/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function Ua(){return new Float64Array(4)}function ut(){return new Float64Array(3)}function Br(){return new Float64Array(16)}function Zn(){let e=new Float64Array(16);return V.identity(e),e}function E_(){let e=new Float32Array(16);return V.identity(e),e}function Vr(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let a=n?r==="map"?-e.bearingInRadians:0:r==="viewport"?e.bearingInRadians:0;if(a){let o=Math.sin(a),s=Math.cos(a);i=[i[0]*s-i[1]*o,i[0]*o+i[1]*s]}return[n?i[0]:$t(t,i[0],e.zoom),n?i[1]:$t(t,i[1],e.zoom)]}function bc(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function ni(e,t,i){let r=xo.determinant([e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]]);if(r===0)return null;let n=U.cross([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),a=U.cross([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),o=U.cross([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),s=U.scale([],n,-e[3]);return U.add(s,s,U.scale([],a,-t[3])),U.add(s,s,U.scale([],o,-i[3])),U.scale(s,s,1/r),s}function NS(e,t,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],n=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return n===0?null:(-r-i[3])/n}function Bs(e,t,i,r){let n=Math.sqrt(e*e+t*t),a=Math.sqrt(i*i+r*r);e/=n,t/=n,i/=a,r/=a;let o=e*i+t*r,s=Math.acos(o);return-t*i+e*r>0?s:-s}function Gt(e,t){let i=ca(e,360),r=ca(t,360),n=r-i,a=r>i?n-360:n+360;return Math.abs(n)<Math.abs(a)?n:a}function Os(e,t){let i=ca(e,Math.PI*2),r=ca(t,Math.PI*2);return Math.min(Math.abs(i-r),Math.abs(i-r+Math.PI*2),Math.abs(i-r-Math.PI*2))}function ca(e,t){return(e%t+t)%t}function _l(e,t,i,r,n){let a=Ae((e-t)/(i-t),0,1);return aa(r,n,a)}function aa(e,t,i){return e*(1-i)+t*i}function VS(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(let a of e)t=Math.min(t,a.x),i=Math.min(i,a.y),r=Math.max(r,a.x),n=Math.max(n,a.y);return[t,i,r,n]}function A_(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function Pp(e,t,i,r){let n=new zw.default(e,t,i,r);return a=>n.solve(a)}var wc=Pp(.25,.1,.25,1);function Ae(e,t,i){return Math.min(i,Math.max(t,e))}function pn(e,t,i){let r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function jS(e,t){let i=[];for(let r in e)r in t||i.push(r);return i}function K(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function Fo(e,t){let i={};for(let r=0;r<t.length;r++){let n=t[r];n in e&&(i[n]=e[n])}return i}var US=1;function k_(){return US++}function GS(e){return Math.log(e)/Math.LN2%1===0}function XS(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function It(e){return Math.pow(2,e)}function Et(e){return Math.log(e)/Math.LN2}function Tp(e,t,i){let r={};for(let n in e)r[n]=t.call(i||this,e[n],n,e);return r}function D_(e,t,i){let r={};for(let n in e)t.call(i||this,e[n],n,e)&&(r[n]=e[n]);return r}function Oi(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Oi(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e!==null&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!Oi(e[i],t[i]))return!1;return!0}return e===t}function Ot(e){return Array.isArray(e)?e.map(Ot):typeof e=="object"&&e?Tp(e,Ot):e}var xm={};function ct(e){xm[e]||(typeof console<"u"&&console.warn(e),xm[e]=!0)}function Or(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function qS(e,t,i,r){let n=t.y-e.y,a=t.x-e.x,o=r.y-i.y,s=r.x-i.x,l=o*a-s*n;if(l===0)return null;let u=e.y-i.y,h=e.x-i.x,c=(s*u-o*h)/l;return new Rw.default(e.x+c*a,e.y+c*n)}function $S([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}}function pa(e){return typeof WorkerGlobalScope<"u"&&typeof e<"u"&&e instanceof WorkerGlobalScope}function YS(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,i={};if(e.replace(t,(r,n,a,o)=>{let s=a||o;return i[n]=s?s.toLowerCase():!0,""}),i["max-age"]){let r=parseInt(i["max-age"],10);isNaN(r)?delete i["max-age"]:i["max-age"]=r}return i}var Bh=null;function ZS(e){if(Bh==null){let t=e.navigator?e.navigator.userAgent:null;Bh=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Bh}function hr(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var WS=async e=>{if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(i){throw new Error("Could not load image because of ".concat(i.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},vm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",HS=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=vm})},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):vm});function KS(e,t,i,r,n){let a=Math.max(-t,0)*4,o=(Math.max(0,i)-i)*r*4+a,s=r*4,l=Math.max(0,t),u=Math.max(0,i),h=Math.min(e.width,t+r),c=Math.min(e.height,i+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:o,stride:s}]}}async function JS(e,t,i,r,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let o=a==null?void 0:a.format;if(!o||!(o.startsWith("BGR")||o.startsWith("RGB")))throw new Error("Unrecognized format ".concat(o));let s=o.startsWith("BGR"),l=new Uint8ClampedArray(r*n*4);if(await a.copyTo(l,KS(e,t,i,r,n)),s)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{a.close()}}function Pc(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function Xe(e){return e*Math.PI/180}function ia(e){return e/Math.PI*180}function L_(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function QS(e){let t=new Float64Array(9);xo.fromQuat(t,e);let i=ia(-Math.asin(Ae(t[2],-1,1))),r,n;return Math.hypot(t[5],t[8])<.001?(r=0,n=-ia(Math.atan2(t[3],t[4]))):(r=ia(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),n=ia(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:i+90,bearing:n}}function eC(e,t,i){let r=Bt.fromValues(t.x-i.x,t.y-i.y),n=Bt.fromValues(e.x-i.x,e.y-i.y),a=r[0]*n[1]-r[1]*n[0],o=Math.atan2(a,Bt.dot(r,n));return ia(o)}function bm(e,t,i){let r=new Float64Array(4);return Yl.fromEuler(r,e,t-90,i),r}var Zl=25,Sp=0,$i=85.051129,R_={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},z_={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function tC(e,t){return R_[t]&&"touches"in e}function iC(e,t){return z_[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)}function rC(e){return R_[e]||z_[e]}var B_="AbortError";function nC(e){return e.message===B_}function Wl(){return new Error(B_)}var aC=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Fs,Oh,ve={now:aC,frame(e,t,i){let r=requestAnimationFrame(a=>{n(),t(a)}),{unsubscribe:n}=Pc(e.signal,"abort",()=>{n(),cancelAnimationFrame(r),i(Wl())},!1)},frameAsync(e){return new Promise((t,i)=>{this.frame(e,t,i)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL(e){return Fs||(Fs=document.createElement("a")),Fs.href=e,Fs.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Oh==null&&(Oh=matchMedia("(prefers-reduced-motion: reduce)")),Oh.matches):!1}},oC=se(ce(),1),Wn=class je{static testProp(t){if(!je.docStyle)return t[0];for(let i=0;i<t.length;i++)if(t[i]in je.docStyle)return t[i];return t[0]}static create(t,i,r){let n=window.document.createElement(t);return i!==void 0&&(n.className=i),r&&r.appendChild(n),n}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){je.docStyle&&je.selectProp&&(je.userSelect=je.docStyle[je.selectProp],je.docStyle[je.selectProp]="none")}static enableDrag(){je.docStyle&&je.selectProp&&(je.docStyle[je.selectProp]=je.userSelect)}static setTransform(t,i){t.style[je.transformProp]=i}static addEventListener(t,i,r,n={}){"passive"in n?t.addEventListener(i,r,n):t.addEventListener(i,r,n.capture)}static removeEventListener(t,i,r,n={}){"passive"in n?t.removeEventListener(i,r,n):t.removeEventListener(i,r,n.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",je.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",je.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",je.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,i,r){let n=i.boundingClientRect;return new oC.default((r.clientX-n.left)/i.x-t.clientLeft,(r.clientY-n.top)/i.y-t.clientTop)}static mousePos(t,i){let r=je.getScale(t);return je.getPoint(t,r,i)}static touchPos(t,i){let r=[],n=je.getScale(t);for(let a=0;a<i.length;a++)r.push(je.getPoint(t,n,i[a]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){let i=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),r=i.querySelectorAll("script");for(let n of r)n.remove();return je.clean(i),i.innerHTML}static isPossiblyDangerous(t,i){let r=i.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(t)&&(r.includes("javascript:")||r.includes("data:"))||t.startsWith("on"))return!0}static clean(t){let i=t.children;for(let r of i)je.removeAttributes(r),je.clean(r)}static removeAttributes(t){for(let{name:i,value:r}of t.attributes)je.isPossiblyDangerous(i,r)&&t.removeAttribute(i)}};Wn.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Wn.selectProp=Wn.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Wn.transformProp=Wn.testProp(["transform","WebkitTransform"]);var be=Wn,jr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function O_(e){return jr.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}var Tc="global-dispatcher",El=class extends Error{constructor(e,t,i,r){super("AJAXError: ".concat(t," (").concat(e,"): ").concat(i)),this.status=e,this.statusText=t,this.url=i,this.body=r}},Cp=()=>pa(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,sC=e=>/^file:/.test(e)||/^file:/.test(Cp())&&!/^\w+:/.test(e);async function lC(e,t){let i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Cp(),signal:t.signal});e.type==="json"&&!i.headers.has("Accept")&&i.headers.set("Accept","application/json");let r;try{r=await fetch(i)}catch(o){throw new El(0,o.message,e.url,new Blob)}if(!r.ok){let o=await r.blob();throw new El(r.status,r.statusText,e.url,o)}let n;e.type==="arrayBuffer"||e.type==="image"?n=r.arrayBuffer():e.type==="json"?n=r.json():n=r.text();let a=await n;if(t.signal.aborted)throw Wl();return{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}function uC(e,t){return new Promise((i,r)=>{var a;let n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(n.responseType="arraybuffer");for(let o in e.headers)n.setRequestHeader(o,e.headers[o]);e.type==="json"&&(n.responseType="text",(a=e.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=e.credentials==="include",n.onerror=()=>{r(new Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let o=n.response;if(e.type==="json")try{o=JSON.parse(n.response)}catch(s){r(s);return}i({data:o,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let o=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new El(n.status,n.statusText,e.url,o))}},t.signal.addEventListener("abort",()=>{n.abort(),r(Wl())}),n.send(e.body)})}var Hl=function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let i=O_(e.url);if(i)return i(e,t);if(pa(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Tc},t)}if(!sC(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return lC(e,t);if(pa(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Tc},t)}return uC(e,t)},Kl=(e,t)=>Hl(K(e,{type:"json"}),t),hC=(e,t)=>Hl(K(e,{type:"arrayBuffer"}),t);function F_(e){if(!e||e.indexOf("://")<=0||e.indexOf("data:image/")===0||e.indexOf("blob:")===0)return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}var cC=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(let r of e){let n=window.document.createElement("source");F_(r)||(t.crossOrigin="Anonymous"),n.src=r,t.appendChild(n)}})},Mp={supported:!1,testSupport:pC},io,Ip=!1,ra,N_=!1;typeof document<"u"&&(ra=document.createElement("img"),ra.onload=()=>{io&&V_(io),io=null,N_=!0},ra.onerror=()=>{Ip=!0,io=null},ra.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function pC(e){Ip||!ra||(N_?V_(e):io=e)}function V_(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,ra),e.isContextLost())return;Mp.supported=!0}catch(i){}e.deleteTexture(t),Ip=!0}var Gi;(e=>{let t,i,r,n;e.resetRequestQueue=()=>{t=[],i=0,r=0,n={}},e.addThrottleControl=h=>{let c=r++;return n[c]=h,c},e.removeThrottleControl=h=>{delete n[h],l()};let a=()=>{for(let h of Object.keys(n))if(n[h]())return!0;return!1};e.getImage=(h,c,p=!0)=>new Promise((d,f)=>{Mp.supported&&(h.headers||(h.headers={}),h.headers.accept="image/webp,*/*"),K(h,{type:"image"});let y={abortController:c,requestParameters:h,supportImageRefresh:p,state:"queued",onError:g=>{f(g)},onSuccess:g=>{d(g)}};t.push(y),l()});let o=h=>typeof createImageBitmap=="function"?WS(h):HS(h),s=async h=>{h.state="running";let{requestParameters:c,supportImageRefresh:p,onError:d,onSuccess:f,abortController:y}=h,g=p===!1&&!pa(self)&&!O_(c.url)&&(!c.headers||Object.keys(c.headers).reduce((b,v)=>b&&v==="accept",!0));i++;let _=g?u(c,y):Hl(c,y);try{let b=await _;if(delete h.abortController,h.state="completed",b.data instanceof HTMLImageElement||hr(b.data))f(b);else if(b.data){let v=await o(b.data);f({data:v,cacheControl:b.cacheControl,expires:b.expires})}}catch(b){delete h.abortController,d(b)}finally{i--,l()}},l=()=>{let h=a()?jr.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:jr.MAX_PARALLEL_IMAGE_REQUESTS;for(let c=i;c<h&&t.length>0;c++){let p=t.shift();if(p.abortController.signal.aborted){c--;continue}s(p)}},u=(h,c)=>new Promise((p,d)=>{let f=new Image,y=h.url,g=h.credentials;g&&g==="include"?f.crossOrigin="use-credentials":(g&&g==="same-origin"||!F_(y))&&(f.crossOrigin="anonymous"),c.signal.addEventListener("abort",()=>{f.src="",d(Wl())}),f.fetchPriority="high",f.onload=()=>{f.onerror=f.onload=null,p({data:f})},f.onerror=()=>{f.onerror=f.onload=null,!c.signal.aborted&&d(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},f.src=y})})(Gi||(Gi={}));Gi.resetRequestQueue();var dC=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}setTransformRequest(e){this._transformRequestFn=e}};function wm(e,t,i){i[e]&&i[e].indexOf(t)!==-1||(i[e]=i[e]||[],i[e].push(t))}function Fh(e,t,i){if(i&&i[e]){let r=i[e].indexOf(t);r!==-1&&i[e].splice(r,1)}}var $=class{constructor(e,t={}){K(this,t),this.type=e}},ne=class extends ${constructor(e,t={}){super("error",K({error:e},t))}},Ft=class{on(e,t){return this._listeners=this._listeners||{},wm(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Fh(e,t,this._listeners),Fh(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},wm(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){typeof e=="string"&&(e=new $(e,t||{}));let i=e.type;if(this.listens(i)){e.target=this;let r=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(let o of r)o.call(this,e);let n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(let o of n)Fh(i,o,this._oneTimeListeners),o.call(this,e);let a=this._eventedParent;a&&(K(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof ne&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},fC=8,mC={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},yC={"*":{type:"source"}},gC=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],_C={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},xC={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},vC={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},bC={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},wC={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},PC={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},TC={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},SC=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],CC={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},MC={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},IC={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},EC={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},AC={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},kC={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},DC={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},LC={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},RC={type:"array",value:"*"},zC={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},BC={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},OC={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},FC={type:"array",value:"*",minimum:1},NC={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},VC={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},jC={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},UC={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},GC=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],XC={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},qC={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},$C={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},YC={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},ZC={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},WC={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},HC={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},KC={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},JC={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},QC={"*":{type:"string"}},O={$version:fC,$root:mC,sources:yC,source:gC,source_vector:_C,source_raster:xC,source_raster_dem:vC,source_geojson:bC,source_video:wC,source_image:PC,layer:TC,layout:SC,layout_background:CC,layout_fill:MC,layout_circle:IC,layout_heatmap:EC,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:AC,layout_symbol:kC,layout_raster:DC,layout_hillshade:LC,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:RC,filter_operator:zC,geometry_type:BC,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:OC,expression:FC,light:NC,sky:VC,terrain:jC,projection:UC,paint:GC,paint_fill:XC,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:qC,paint_circle:$C,paint_heatmap:YC,paint_symbol:ZC,paint_raster:WC,paint_hillshade:HC,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:KC,transition:JC,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:QC},eM=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function tM(e,t){let i={};for(let r in e)r!=="ref"&&(i[r]=e[r]);return eM.forEach(r=>{r in t&&(i[r]=t[r])}),i}function Pm(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=tM(e[i],t[e[i].ref]));return e}function Le(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Le(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e!==null&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!Le(e[i],t[i]))return!1;return!0}return e===t}function ai(e,t){e.push(t)}function j_(e,t,i){ai(i,{command:"addSource",args:[e,t[e]]})}function U_(e,t,i){ai(t,{command:"removeSource",args:[e]}),i[e]=!0}function iM(e,t,i,r){U_(e,i,r),j_(e,t,i)}function rM(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!Le(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!Le(e[i][r],t[i][r]))return!1;return!0}function nM(e,t,i,r){e=e||{},t=t||{};let n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||U_(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?Le(e[n],t[n])||(e[n].type==="geojson"&&t[n].type==="geojson"&&rM(e,t,n)?ai(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):iM(n,t,i,r)):j_(n,t,i))}function Ns(e,t,i,r,n,a){e=e||{},t=t||{};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Le(e[o],t[o])||i.push({command:a,args:[r,o,t[o],n]}));for(let o in t)!Object.prototype.hasOwnProperty.call(t,o)||Object.prototype.hasOwnProperty.call(e,o)||Le(e[o],t[o])||i.push({command:a,args:[r,o,t[o],n]})}function Tm(e){return e.id}function Sm(e,t){return e[t.id]=t,e}function aM(e,t,i){e=e||[],t=t||[];let r=e.map(Tm),n=t.map(Tm),a=e.reduce(Sm,{}),o=t.reduce(Sm,{}),s=r.slice(),l=Object.create(null),u,h,c,p,d;for(let f=0,y=0;f<r.length;f++)u=r[f],Object.prototype.hasOwnProperty.call(o,u)?y++:(ai(i,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,y),1));for(let f=0,y=0;f<n.length;f++)u=n[n.length-1-f],s[s.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(a,u)?(ai(i,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-y),1)):y++,p=s[s.length-f],ai(i,{command:"addLayer",args:[o[u],p]}),s.splice(s.length-f,0,u),l[u]=!0);for(let f=0;f<n.length;f++)if(u=n[f],h=a[u],c=o[u],!(l[u]||Le(h,c))){if(!Le(h.source,c.source)||!Le(h["source-layer"],c["source-layer"])||!Le(h.type,c.type)){ai(i,{command:"removeLayer",args:[u]}),p=s[s.lastIndexOf(u)+1],ai(i,{command:"addLayer",args:[c,p]});continue}Ns(h.layout,c.layout,i,u,null,"setLayoutProperty"),Ns(h.paint,c.paint,i,u,null,"setPaintProperty"),Le(h.filter,c.filter)||ai(i,{command:"setFilter",args:[u,c.filter]}),(!Le(h.minzoom,c.minzoom)||!Le(h.maxzoom,c.maxzoom))&&ai(i,{command:"setLayerZoomRange",args:[u,c.minzoom,c.maxzoom]});for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&(d==="layout"||d==="paint"||d==="filter"||d==="metadata"||d==="minzoom"||d==="maxzoom"||(d.indexOf("paint.")===0?Ns(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Le(h[d],c[d])||ai(i,{command:"setLayerProperty",args:[u,d,c[d]]})));for(d in c)!Object.prototype.hasOwnProperty.call(c,d)||Object.prototype.hasOwnProperty.call(h,d)||d==="layout"||d==="paint"||d==="filter"||d==="metadata"||d==="minzoom"||d==="maxzoom"||(d.indexOf("paint.")===0?Ns(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Le(h[d],c[d])||ai(i,{command:"setLayerProperty",args:[u,d,c[d]]}))}}function oM(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!Le(e.version,t.version))return[{command:"setStyle",args:[t]}];Le(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Le(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),Le(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Le(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Le(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Le(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Le(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),Le(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Le(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Le(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Le(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Le(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),Le(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),Le(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let r={},n=[];nM(e.sources,t.sources,n,r);let a=[];e.layers&&e.layers.forEach(o=>{"source"in o&&r[o.source]?i.push({command:"removeLayer",args:[o.id]}):a.push(o)}),i=i.concat(n),aM(a,t.layers,i)}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:"setStyle",args:[t]}]}return i}var q=class{constructor(e,t,i,r){this.message=(e?"".concat(e,": "):"")+i,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}};function da(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}var Fi=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},sM=class G_{constructor(t,i=[]){this.parent=t,this.bindings={};for(let[r,n]of i)this.bindings[r]=n}concat(t){return new G_(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error("".concat(t," not found in scope."))}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},No={kind:"null"},Z={kind:"number"},_e={kind:"string"},me={kind:"boolean"},_i={kind:"color"},Jl={kind:"projectionDefinition"},dn={kind:"object"},pe={kind:"value"},lM={kind:"error"},Ql={kind:"collator"},Vo={kind:"formatted"},eu={kind:"padding"},vo={kind:"colorArray"},tu={kind:"numberArray"},jo={kind:"resolvedImage"},iu={kind:"variableAnchorOffsetCollection"};function Xt(e,t){return{kind:"array",itemType:e,N:t}}function He(e){if(e.kind==="array"){let t=He(e.itemType);return typeof e.N=="number"?"array<".concat(t,", ").concat(e.N,">"):e.itemType.kind==="value"?"array":"array<".concat(t,">")}else return e.kind}var uM=[No,Z,_e,me,_i,Jl,Vo,dn,Xt(pe),eu,tu,vo,jo,iu];function bo(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!bo(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let i of uM)if(!bo(i,t))return null}}return"Expected ".concat(He(e)," but found ").concat(He(t)," instead.")}function Ep(e,t){return t.some(i=>i.kind===e.kind)}function fn(e,t){return t.some(i=>i==="null"?e===null:i==="array"?Array.isArray(e):i==="object"?e&&!Array.isArray(e)&&typeof e=="object":i===typeof e)}function Ir(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}var X_=.96422,q_=1,$_=.82521,Y_=4/29,oa=6/29,Z_=3*oa*oa,hM=oa*oa*oa,cM=Math.PI/180,pM=180/Math.PI;function W_(e){return e=e%360,e<0&&(e+=360),e}function H_([e,t,i,r]){e=Nh(e),t=Nh(t),i=Nh(i);let n,a,o=Vh((.2225045*e+.7168786*t+.0606169*i)/q_);e===t&&t===i?n=a=o:(n=Vh((.4360747*e+.3850649*t+.1430804*i)/X_),a=Vh((.0139322*e+.0971045*t+.7141733*i)/$_));let s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),r]}function Nh(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Vh(e){return e>hM?Math.pow(e,1/3):e/Z_+Y_}function K_([e,t,i,r]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,o=isNaN(i)?n:n-i/200;return n=q_*Uh(n),a=X_*Uh(a),o=$_*Uh(o),[jh(3.1338561*a-1.6168667*n-.4906146*o),jh(-.9787684*a+1.9161415*n+.033454*o),jh(.0719453*a-.2289914*n+1.4052427*o),r]}function jh(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function Uh(e){return e>oa?e*e*e:Z_*(e-Y_)}function dM(e){let[t,i,r,n]=H_(e),a=Math.sqrt(i*i+r*r);return[Math.round(a*1e4)?W_(Math.atan2(r,i)*pM):NaN,a,t,n]}function fM([e,t,i,r]){return e=isNaN(e)?0:e*cM,K_([i,Math.cos(e)*t,Math.sin(e)*t,r])}function mM([e,t,i,r]){e=W_(e),t/=100,i/=100;function n(a){let o=(a+e/30)%12,s=t*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(o-3,9-o,1))}return[n(0),n(8),n(4),r]}var yM=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function co(e,t){return yM(e,t)?e[t]:void 0}function gM(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=co(_M,e);if(t){let[n,a,o]=t;return[n/255,a/255,o/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let n=e.length<6?1:2,a=1;return[Vs(e.slice(a,a+=n)),Vs(e.slice(a,a+=n)),Vs(e.slice(a,a+=n)),Vs(e.slice(a,a+n)||"ff")]}if(e.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,a=e.match(n);if(a){let[o,s,l,u,h,c,p,d,f,y,g,_]=a,b=[u||" ",p||" ",y].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let v=[l,c,f].join(""),w=v==="%%%"?100:v===""?255:0;if(w){let T=[Hn(+s/w,0,1),Hn(+h/w,0,1),Hn(+d/w,0,1),g?Cm(+g,_):1];if(Mm(T))return T}}return}}let i=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=e.match(i);if(r){let[n,a,o,s,l,u,h,c,p]=r,d=[o||" ",l||" ",h].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){let f=[+a,Hn(+s,0,100),Hn(+u,0,100),c?Cm(+c,p):1];if(Mm(f))return mM(f)}}}function Vs(e){return parseInt(e.padEnd(2,e),16)/255}function Cm(e,t){return Hn(t?e/100:e,0,1)}function Hn(e,t,i){return Math.min(Math.max(t,e),i)}function Mm(e){return!e.some(Number.isNaN)}var _M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Nr(e,t,i){return e+i*(t-e)}function fa(e,t,i){return e.map((r,n)=>Nr(r,t[n],i))}function xM(e){return e==="rgb"||e==="hcl"||e==="lab"}var te=class Kn{constructor(t,i,r,n=1,a=!0){this.r=t,this.g=i,this.b=r,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,i,r,n]))}static parse(t){if(t instanceof Kn)return t;if(typeof t!="string")return;let i=gM(t);if(i)return new Kn(...i,!1)}get rgb(){let{r:t,g:i,b:r,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[t/a,i/a,r/a,n])}get hcl(){return this.overwriteGetter("hcl",dM(this.rgb))}get lab(){return this.overwriteGetter("lab",H_(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,n]=this.rgb;return"rgba(".concat([t,i,r].map(a=>Math.round(a*255)).join(","),",").concat(n,")")}static interpolate(t,i,r,n="rgb"){switch(n){case"rgb":{let[a,o,s,l]=fa(t.rgb,i.rgb,r);return new Kn(a,o,s,l,!1)}case"hcl":{let[a,o,s,l]=t.hcl,[u,h,c,p]=i.hcl,d,f;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u<a&&a-u>180&&(v+=360),d=a+r*v}else isNaN(a)?isNaN(u)?d=NaN:(d=u,(s===1||s===0)&&(f=h)):(d=a,(c===1||c===0)&&(f=o));let[y,g,_,b]=fM([d,f!=null?f:Nr(o,h,r),Nr(s,c,r),Nr(l,p,r)]);return new Kn(y,g,_,b,!1)}case"lab":{let[a,o,s,l]=K_(fa(t.lab,i.lab,r));return new Kn(a,o,s,l,!1)}}}};te.black=new te(0,0,0,1);te.white=new te(1,1,1,1);te.transparent=new te(0,0,0,0);te.red=new te(1,0,0,1);var Ap=class{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},vM=["bottom","center","top"],Sc=class{constructor(e,t,i,r,n,a){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=a}},pr=class xl{constructor(t){this.sections=t}static fromString(t){return new xl([new Sc(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof xl?t:xl.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},Wi=class ro{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ro)return t;if(typeof t=="number")return new ro([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let i of t)if(typeof i!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];break}return new ro(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new ro(fa(t.values,i.values,r))}},Hi=class no{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof no)return t;if(typeof t=="number")return new no([t]);if(Array.isArray(t)){for(let i of t)if(typeof i!="number")return;return new no(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new no(fa(t.values,i.values,r))}},ui=class ao{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ao)return t;if(typeof t=="string"){let r=te.parse(t);return r?new ao([r]):void 0}if(!Array.isArray(t))return;let i=[];for(let r of t){if(typeof r!="string")return;let n=te.parse(r);if(!n)return;i.push(n)}return new ao(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,n="rgb"){let a=[];if(t.values.length!=i.values.length)throw new Error("colorArray: Arrays have mismatched length (".concat(t.values.length," vs. ").concat(i.values.length,"), cannot interpolate."));for(let o=0;o<t.values.length;o++)a.push(te.interpolate(t.values[o],i.values[o],r,n));return new ao(a)}},Qe=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},bM=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Xr=class vl{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof vl)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!==0)){for(let i=0;i<t.length;i+=2){let r=t[i],n=t[i+1];if(typeof r!="string"||!bM.has(r)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new vl(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){let n=t.values,a=i.values;if(n.length!==a.length)throw new Qe("Cannot interpolate values of different length. from: ".concat(t.toString(),", to: ").concat(i.toString()));let o=[];for(let s=0;s<n.length;s+=2){if(n[s]!==a[s])throw new Qe("Cannot interpolate values containing mismatched anchors. from[".concat(s,"]: ").concat(n[s],", to[").concat(s,"]: ").concat(a[s]));o.push(n[s]);let[l,u]=n[s+1],[h,c]=a[s+1];o.push([Nr(l,h,r),Nr(u,c,r)])}return new vl(o)}},Yi=class J_{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new J_({name:t,available:!1}):null}},Pn=class Jn{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}static interpolate(t,i,r){return new Jn(t,i,r)}static parse(t){if(t instanceof Jn)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new Jn(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new Jn(t.from,t.to,t.transition);if(typeof t=="string")return new Jn(t,t,1)}};function Q_(e,t,i,r){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof i=="number"&&i>=0&&i<=255?typeof r>"u"||typeof r=="number"&&r>=0&&r<=1?null:"Invalid rgba value [".concat([e,t,i,r].join(", "),"]: 'a' must be between 0 and 1."):"Invalid rgba value [".concat((typeof r=="number"?[e,t,i,r]:[e,t,i]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}function wo(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Pn||e instanceof te||e instanceof Ap||e instanceof pr||e instanceof Wi||e instanceof Hi||e instanceof ui||e instanceof Xr||e instanceof Yi)return!0;if(Array.isArray(e)){for(let t of e)if(!wo(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!wo(e[t]))return!1;return!0}else return!1}function pt(e){if(e===null)return No;if(typeof e=="string")return _e;if(typeof e=="boolean")return me;if(typeof e=="number")return Z;if(e instanceof te)return _i;if(e instanceof Pn)return Jl;if(e instanceof Ap)return Ql;if(e instanceof pr)return Vo;if(e instanceof Wi)return eu;if(e instanceof Hi)return tu;if(e instanceof ui)return vo;if(e instanceof Xr)return iu;if(e instanceof Yi)return jo;if(Array.isArray(e)){let t=e.length,i;for(let r of e){let n=pt(r);if(!i)i=n;else{if(i===n)continue;i=pe;break}}return Xt(i||pe,t)}else return dn}function po(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof te||e instanceof Pn||e instanceof pr||e instanceof Wi||e instanceof Hi||e instanceof ui||e instanceof Xr||e instanceof Yi?e.toString():JSON.stringify(e)}var Po=class ex{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error("'literal' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!wo(t[1]))return i.error("invalid value");let r=t[1],n=pt(r),a=i.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new ex(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},js={string:_e,number:Z,boolean:me,object:dn},or=class tx{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=1,n,a=t[0];if(a==="array"){let s;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in js)||u==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);s=js[u],r++}else s=pe;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);l=t[2],r++}n=Xt(s,l)}else{if(!js[a])throw new Error("Types doesn't contain name = ".concat(a));n=js[a]}let o=[];for(;r<t.length;r++){let s=i.parse(t[r],r,pe);if(!s)return null;o.push(s)}return new tx(n,o)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if(bo(this.type,pt(r))){if(i===this.args.length-1)throw new Qe("Expected value to be of type ".concat(He(this.type),", but found ").concat(He(pt(r))," instead."))}else return r}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Im={"to-boolean":me,"to-color":_i,"to-number":Z,"to-string":_e},na=class ix{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[0];if(!Im[r])throw new Error("Can't parse ".concat(r," as it is not part of the known types"));if((r==="to-boolean"||r==="to-string")&&t.length!==2)return i.error("Expected one argument.");let n=Im[r],a=[];for(let o=1;o<t.length;o++){let s=i.parse(t[o],o,pe);if(!s)return null;a.push(s)}return new ix(n,a)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,r;for(let n of this.args){if(i=n.evaluate(t),r=null,i instanceof te)return i;if(typeof i=="string"){let a=t.parseColor(i);if(a)return a}else if(Array.isArray(i)&&(i.length<3||i.length>4?r="Invalid rgba value ".concat(JSON.stringify(i),": expected an array containing either three or four numeric values."):r=Q_(i[0],i[1],i[2],i[3]),!r))return new te(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Qe(r||"Could not parse color from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let n=Wi.parse(i);if(n)return n}throw new Qe("Could not parse padding from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=Hi.parse(i);if(n)return n}throw new Qe("Could not parse numberArray from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=ui.parse(i);if(n)return n}throw new Qe("Could not parse colorArray from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let n=Xr.parse(i);if(n)return n}throw new Qe("Could not parse variableAnchorOffsetCollection from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"number":{let i=null;for(let r of this.args){if(i=r.evaluate(t),i===null)return 0;let n=Number(i);if(!isNaN(n))return n}throw new Qe("Could not convert ".concat(JSON.stringify(i)," to number."))}case"formatted":return pr.fromString(po(this.args[0].evaluate(t)));case"resolvedImage":return Yi.fromString(po(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return po(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},wM=["Unknown","Point","LineString","Polygon"],rx=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?wM[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=te.parse(e),this._parseColorCache.set(e,t)),t}},nx=class ax{constructor(t,i,r=[],n,a=new sM,o=[]){this.registry=t,this.path=r,this.key=r.map(s=>"[".concat(s,"]")).join(""),this.scope=a,this.errors=o,this.expectedType=n,this._isConstant=i}parse(t,i,r,n,a={}){return i?this.concat(i,r,n)._parse(t,a):this._parse(t,a)}_parse(t,i){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);function r(n,a,o){return o==="assert"?new or(a,[n]):o==="coerce"?new na(a,[n]):n}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n=t[0];if(typeof n!="string")return this.error("Expression name must be a string, but found ".concat(typeof n,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;let a=this.registry[n];if(a){let o=a.parse(t,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,l=o.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")o=r(o,s,i.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=r(o,s,i.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(o instanceof Po)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new rx;try{o=new Po(o.type,o.evaluate(s))}catch(l){return this.error(l.message),null}}return o}return this.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0)}else return typeof t>"u"?this.error("'undefined' value invalid. Use null instead."):typeof t=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found ".concat(typeof t," instead."))}concat(t,i,r){let n=typeof t=="number"?this.path.concat(t):this.path,a=r?this.scope.concat(r):this.scope;return new ax(this.registry,this._isConstant,n,i||null,a,this.errors)}error(t,...i){let r="".concat(this.key).concat(i.map(n=>"[".concat(n,"]")).join(""));this.errors.push(new Fi(r,t))}checkSubtype(t,i){let r=bo(t,i);return r&&this.error(r),r}},ox=class sx{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));let r=[];for(let a=1;a<t.length-1;a+=2){let o=t[a];if(typeof o!="string")return i.error("Expected string, but found ".concat(typeof o," instead."),a);if(/[^a-zA-Z0-9_]/.test(o))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=i.parse(t[a+1],a+1);if(!s)return null;r.push([o,s])}let n=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return n?new sx(r,n):null}outputDefined(){return this.result.outputDefined()}},lx=class ux{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");let r=t[1];return i.scope.has(r)?new ux(r,i.scope.get(r)):i.error('Unknown variable "'.concat(r,'". Make sure "').concat(r,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},PM=class hx{constructor(t,i,r){this.type=t,this.index=i,this.input=r}static parse(t,i){if(t.length!==3)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,Z),n=i.parse(t[2],2,Xt(i.expectedType||pe));if(!r||!n)return null;let a=n.type;return new hx(a.itemType,r,n)}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new Qe("Array index out of bounds: ".concat(i," < 0."));if(i>=r.length)throw new Qe("Array index out of bounds: ".concat(i," > ").concat(r.length-1,"."));if(i!==Math.floor(i))throw new Qe("Array index must be an integer, but found ".concat(i," instead."));return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},TM=class cx{constructor(t,i){this.type=me,this.needle=t,this.haystack=i}static parse(t,i){if(t.length!==3)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,pe),n=i.parse(t[2],2,pe);return!r||!n?null:Ep(r.type,[me,_e,Z,No,pe])?new cx(r,n):i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(He(r.type)," instead"))}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!fn(i,["boolean","string","number","null"]))throw new Qe("Expected first argument to be of type boolean, string, number or null, but found ".concat(He(pt(i))," instead."));if(!fn(r,["string","array"]))throw new Qe("Expected second argument to be of type array or string, but found ".concat(He(pt(r))," instead."));return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},SM=class Cc{constructor(t,i,r){this.type=Z,this.needle=t,this.haystack=i,this.fromIndex=r}static parse(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,pe),n=i.parse(t[2],2,pe);if(!r||!n)return null;if(!Ep(r.type,[me,_e,Z,No,pe]))return i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(He(r.type)," instead"));if(t.length===4){let a=i.parse(t[3],3,Z);return a?new Cc(r,n,a):null}else return new Cc(r,n)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!fn(i,["boolean","string","number","null"]))throw new Qe("Expected first argument to be of type boolean, string, number or null, but found ".concat(He(pt(i))," instead."));let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),fn(r,["string"])){let a=r.indexOf(i,n);return a===-1?-1:[...r.slice(0,a)].length}else{if(fn(r,["array"]))return r.indexOf(i,n);throw new Qe("Expected second argument to be of type array or string, but found ".concat(He(pt(r))," instead."))}}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},CM=class px{constructor(t,i,r,n,a,o){this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=a,this.otherwise=o}static parse(t,i){if(t.length<5)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==1)return i.error("Expected an even number of arguments.");let r,n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);let a={},o=[];for(let u=2;u<t.length-1;u+=2){let h=t[u],c=t[u+1];Array.isArray(h)||(h=[h]);let p=i.concat(u);if(h.length===0)return p.error("Expected at least one branch label.");for(let f of h){if(typeof f!="number"&&typeof f!="string")return p.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>Number.MAX_SAFE_INTEGER)return p.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof f=="number"&&Math.floor(f)!==f)return p.error("Numeric branch labels must be integer values.");if(!r)r=pt(f);else if(p.checkSubtype(r,pt(f)))return null;if(typeof a[String(f)]<"u")return p.error("Branch labels must be unique.");a[String(f)]=o.length}let d=i.parse(c,u,n);if(!d)return null;n=n||d.type,o.push(d)}let s=i.parse(t[1],1,pe);if(!s)return null;let l=i.parse(t[t.length-1],t.length-1,n);return!l||s.type.kind!=="value"&&i.concat(1).checkSubtype(r,s.type)?null:new px(r,n,s,a,o,l)}evaluate(t){let i=this.input.evaluate(t);return(pt(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},MM=class dx{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);let n=[];for(let o=1;o<t.length-1;o+=2){let s=i.parse(t[o],o,me);if(!s)return null;let l=i.parse(t[o+1],o+1,r);if(!l)return null;n.push([s,l]),r=r||l.type}let a=i.parse(t[t.length-1],t.length-1,r);if(!a)return null;if(!r)throw new Error("Can't infer output type");return new dx(r,n,a)}evaluate(t){for(let[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}},IM=class Mc{constructor(t,i,r,n){this.type=t,this.input=i,this.beginIndex=r,this.endIndex=n}static parse(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,pe),n=i.parse(t[2],2,Z);if(!r||!n)return null;if(!Ep(r.type,[Xt(pe),_e,pe]))return i.error("Expected first argument to be of type array or string, but found ".concat(He(r.type)," instead"));if(t.length===4){let a=i.parse(t[3],3,Z);return a?new Mc(r.type,r,n,a):null}else return new Mc(r.type,r,n)}evaluate(t){let i=this.input.evaluate(t),r=this.beginIndex.evaluate(t),n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),fn(i,["string"]))return[...i].slice(r,n).join("");if(fn(i,["array"]))return i.slice(r,n);throw new Qe("Expected first argument to be of type array or string, but found ".concat(He(pt(i))," instead."))}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}};function ru(e,t){let i=e.length-1,r=0,n=i,a=0,o,s;for(;r<=n;)if(a=Math.floor((r+n)/2),o=e[a],s=e[a+1],o<=t){if(a===i||t<s)return a;r=a+1}else if(o>t)n=a-1;else throw new Qe("Input is not a number.");return 0}var kp=class fx{constructor(t,i,r){this.type=t,this.input=i,this.labels=[],this.outputs=[];for(let[n,a]of r)this.labels.push(n),this.outputs.push(a)}static parse(t,i){if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return i.error("Expected an even number of arguments.");let r=i.parse(t[1],1,Z);if(!r)return null;let n=[],a=null;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);for(let o=1;o<t.length;o+=2){let s=o===1?-1/0:t[o],l=t[o+1],u=o,h=o+1;if(typeof s!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let c=i.parse(l,h,a);if(!c)return null;a=a||c.type,n.push([s,c])}return new fx(a,r,n)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);let a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);let o=ru(i,n);return r[o].evaluate(t)}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function EM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gh,Em;function AM(){if(Em)return Gh;Em=1,Gh=e;function e(t,i,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=n}return e.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(i===void 0&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var a=this.sampleCurveX(r)-t;if(Math.abs(a)<i)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-a/o}var s=0,l=1;for(r=t,n=0;n<20&&(a=this.sampleCurveX(r),!(Math.abs(a-t)<i));n++)t>a?s=r:l=r,r=(l-s)*.5+s;return r},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},Gh}var kM=AM(),DM=EM(kM),xi=class Ic{constructor(t,i,r,n,a){this.type=t,this.operator=i,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(let[o,s]of a)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(t,i,r,n){let a=0;if(t.name==="exponential")a=Xh(i,t.base,r,n);else if(t.name==="linear")a=Xh(i,1,r,n);else if(t.name==="cubic-bezier"){let o=t.controlPoints;a=new DM(o[0],o[1],o[2],o[3]).solve(Xh(i,1,r,n))}return a}static parse(t,i){let[r,n,a,...o]=t;if(!Array.isArray(n)||n.length===0)return i.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return i.error("Unknown interpolation type ".concat(String(n[0])),1,0);if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return i.error("Expected an even number of arguments.");if(a=i.parse(a,2,Z),!a)return null;let s=[],l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&i.expectedType!=vo?l=_i:i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=0;u<o.length;u+=2){let h=o[u],c=o[u+1],p=u+3,d=u+4;if(typeof h!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(s.length&&s[s.length-1][0]>=h)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);let f=i.parse(c,d,l);if(!f)return null;l=l||f.type,s.push([h,f])}return!Ir(l,Z)&&!Ir(l,Jl)&&!Ir(l,_i)&&!Ir(l,eu)&&!Ir(l,tu)&&!Ir(l,vo)&&!Ir(l,iu)&&!Ir(l,Xt(Z))?i.error("Type ".concat(He(l)," is not interpolatable.")):new Ic(l,r,n,a,s)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);let a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);let o=ru(i,n),s=i[o],l=i[o+1],u=Ic.interpolationFactor(this.interpolation,n,s,l),h=r[o].evaluate(t),c=r[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Nr(h,c,u);case"color":return te.interpolate(h,c,u);case"padding":return Wi.interpolate(h,c,u);case"colorArray":return ui.interpolate(h,c,u);case"numberArray":return Hi.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Xr.interpolate(h,c,u);case"array":return fa(h,c,u);case"projectionDefinition":return Pn.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return te.interpolate(h,c,u,"hcl");case"colorArray":return ui.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return te.interpolate(h,c,u,"lab");case"colorArray":return ui.interpolate(h,c,u,"lab")}}}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Xh(e,t,i,r){let n=r-i,a=e-i;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var Ke={color:te.interpolate,number:Nr,padding:Wi.interpolate,numberArray:Hi.interpolate,colorArray:ui.interpolate,variableAnchorOffsetCollection:Xr.interpolate,array:fa},mx=class Ec{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=null,n=i.expectedType;n&&n.kind!=="value"&&(r=n);let a=[];for(let o of t.slice(1)){let s=i.parse(o,1+a.length,r,void 0,{typeAnnotation:"omit"});if(!s)return null;r=r||s.type,a.push(s)}if(!r)throw new Error("No output type");return n&&a.some(o=>bo(n,o.type))?new Ec(pe,a):new Ec(r,a)}evaluate(t){let i=null,r=0,n;for(let a of this.args)if(r++,i=a.evaluate(t),i&&i instanceof Yi&&!i.available&&(n||(n=i.name),i=null,r===this.args.length&&(i=n)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function Am(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function LM(e,t,i){return t===i}function RM(e,t,i){return t!==i}function zM(e,t,i){return t<i}function BM(e,t,i){return t>i}function OM(e,t,i){return t<=i}function FM(e,t,i){return t>=i}function yx(e,t,i,r){return r.compare(t,i)===0}function NM(e,t,i,r){return!yx(e,t,i,r)}function VM(e,t,i,r){return r.compare(t,i)<0}function jM(e,t,i,r){return r.compare(t,i)>0}function UM(e,t,i,r){return r.compare(t,i)<=0}function GM(e,t,i,r){return r.compare(t,i)>=0}function wa(e,t,i){let r=e!=="=="&&e!=="!=";return class gx{constructor(a,o,s){this.type=me,this.lhs=a,this.rhs=o,this.collator=s,this.hasUntypedArgument=a.type.kind==="value"||o.type.kind==="value"}static parse(a,o){if(a.length!==3&&a.length!==4)return o.error("Expected two or three arguments.");let s=a[0],l=o.parse(a[1],1,pe);if(!l)return null;if(!Am(s,l.type))return o.concat(1).error('"'.concat(s,"\" comparisons are not supported for type '").concat(He(l.type),"'."));let u=o.parse(a[2],2,pe);if(!u)return null;if(!Am(s,u.type))return o.concat(2).error('"'.concat(s,"\" comparisons are not supported for type '").concat(He(u.type),"'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot compare types '".concat(He(l.type),"' and '").concat(He(u.type),"'."));r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new or(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new or(l.type,[u])));let h=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(h=o.parse(a[3],3,Ql),!h)return null}return new gx(l,u,h)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(r&&this.hasUntypedArgument){let l=pt(o),u=pt(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new Qe('Expected arguments for "'.concat(e,'" to be (string, string) or (number, number), but found (').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!r&&this.hasUntypedArgument){let l=pt(o),u=pt(s);if(l.kind!=="string"||u.kind!=="string")return t(a,o,s)}return this.collator?i(a,o,s,this.collator.evaluate(a)):t(a,o,s)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var XM=wa("==",LM,yx),qM=wa("!=",RM,NM),$M=wa("<",zM,VM),YM=wa(">",BM,jM),ZM=wa("<=",OM,UM),WM=wa(">=",FM,GM),_x=class xx{constructor(t,i,r){this.type=Ql,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");let r=t[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");let n=i.parse(r["case-sensitive"]===void 0?!1:r["case-sensitive"],1,me);if(!n)return null;let a=i.parse(r["diacritic-sensitive"]===void 0?!1:r["diacritic-sensitive"],1,me);if(!a)return null;let o=null;return r.locale&&(o=i.parse(r.locale,1,_e),!o)?null:new xx(n,a,o)}evaluate(t){return new Ap(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},HM=class vx{constructor(t,i,r,n,a){this.type=_e,this.number=t,this.locale=i,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=a}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");let r=i.parse(t[1],1,Z);if(!r)return null;let n=t[2];if(typeof n!="object"||Array.isArray(n))return i.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=i.parse(n.locale,1,_e),!a))return null;let o=null;if(n.currency&&(o=i.parse(n.currency,1,_e),!o))return null;let s=null;if(n["min-fraction-digits"]&&(s=i.parse(n["min-fraction-digits"],1,Z),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=i.parse(n["max-fraction-digits"],1,Z),!l)?null:new vx(r,a,o,s,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},bx=class wx{constructor(t){this.type=Vo,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[1];if(!Array.isArray(r)&&typeof r=="object")return i.error("First argument must be an image or text section.");let n=[],a=!1;for(let o=1;o<=t.length-1;++o){let s=t[o];if(a&&typeof s=="object"&&!Array.isArray(s)){a=!1;let l=null;if(s["font-scale"]&&(l=i.parse(s["font-scale"],1,Z),!l))return null;let u=null;if(s["text-font"]&&(u=i.parse(s["text-font"],1,Xt(_e)),!u))return null;let h=null;if(s["text-color"]&&(h=i.parse(s["text-color"],1,_i),!h))return null;let c=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!vM.includes(s["vertical-align"]))return i.error("'vertical-align' must be one of: 'bottom', 'center', 'top' but found '".concat(s["vertical-align"],"' instead."));if(c=i.parse(s["vertical-align"],1,_e),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=i.parse(t[o],1,pe);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new wx(n)}evaluate(t){let i=r=>{let n=r.content.evaluate(t);return pt(n)===jo?new Sc("",n,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new Sc(po(n),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)};return new pr(this.sections.map(i))}eachChild(t){for(let i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}},KM=class Px{constructor(t){this.type=jo,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");let r=i.parse(t[1],1,_e);return r?new Px(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=Yi.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}},JM=class Tx{constructor(t){this.type=Z,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?i.error("Expected argument of type string or array, but found ".concat(He(r.type)," instead.")):new Tx(r):null}evaluate(t){let i=this.input.evaluate(t);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Qe("Expected value to be of type string or array, but found ".concat(He(pt(i))," instead."))}eachChild(t){t(this.input)}outputDefined(){return!1}},Xi=8192;function QM(e,t){let i=eI(e[0]),r=iI(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*Xi),Math.round(r*n*Xi)]}function Dp(e,t){let i=Math.pow(2,t.z),r=(e[0]/Xi+t.x)/i,n=(e[1]/Xi+t.y)/i;return[tI(r),rI(n)]}function eI(e){return(180+e)/360}function tI(e){return e*360-180}function iI(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function rI(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function Uo(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function To(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function nI(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function aI(e,t,i){let r=e[0]-t[0],n=e[1]-t[1],a=e[0]-i[0],o=e[1]-i[1];return r*o-a*n===0&&r*a<=0&&n*o<=0}function nu(e,t,i,r){let n=[t[0]-e[0],t[1]-e[1]],a=[r[0]-i[0],r[1]-i[1]];return uI(a,n)===0?!1:!!(km(e,t,i,r)&&km(i,r,e,t))}function oI(e,t,i){for(let r of i)for(let n=0;n<r.length-1;++n)if(nu(e,t,r[n],r[n+1]))return!0;return!1}function Pa(e,t,i=!1){let r=!1;for(let n of t)for(let a=0;a<n.length-1;a++){if(aI(e,n[a],n[a+1]))return i;nI(e,n[a],n[a+1])&&(r=!r)}return r}function sI(e,t){for(let i of t)if(Pa(e,i))return!0;return!1}function Sx(e,t){for(let i of e)if(!Pa(i,t))return!1;for(let i=0;i<e.length-1;++i)if(oI(e[i],e[i+1],t))return!1;return!0}function lI(e,t){for(let i of t)if(Sx(e,i))return!0;return!1}function uI(e,t){return e[0]*t[1]-e[1]*t[0]}function km(e,t,i,r){let n=e[0]-i[0],a=e[1]-i[1],o=t[0]-i[0],s=t[1]-i[1],l=r[0]-i[0],u=r[1]-i[1],h=n*u-l*a,c=o*u-l*s;return h>0&&c<0||h<0&&c>0}function Lp(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=[];for(let o=0;o<e[n].length;o++){let s=QM(e[n][o],i);Uo(t,s),a.push(s)}r.push(a)}return r}function Cx(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=Lp(e[n],t,i);r.push(a)}return r}function Mx(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){let n=r*.5,a=e[0]-i[0]>n?-r:i[0]-e[0]>n?r:0;a===0&&(a=e[0]-i[2]>n?-r:i[2]-e[0]>n?r:0),e[0]+=a}Uo(t,e)}function hI(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Dm(e,t,i,r){let n=Math.pow(2,r.z)*Xi,a=[r.x*Xi,r.y*Xi],o=[];for(let s of e)for(let l of s){let u=[l.x+a[0],l.y+a[1]];Mx(u,t,i,n),o.push(u)}return o}function Lm(e,t,i,r){let n=Math.pow(2,r.z)*Xi,a=[r.x*Xi,r.y*Xi],o=[];for(let s of e){let l=[];for(let u of s){let h=[u.x+a[0],u.y+a[1]];Uo(t,h),l.push(h)}o.push(l)}if(t[2]-t[0]<=n/2){hI(t);for(let s of o)for(let l of s)Mx(l,t,i,n)}return o}function cI(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=Lp(t.coordinates,r,n),o=Dm(e.geometry(),i,r,n);if(!To(i,r))return!1;for(let s of o)if(!Pa(s,a))return!1}if(t.type==="MultiPolygon"){let a=Cx(t.coordinates,r,n),o=Dm(e.geometry(),i,r,n);if(!To(i,r))return!1;for(let s of o)if(!sI(s,a))return!1}return!0}function pI(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=Lp(t.coordinates,r,n),o=Lm(e.geometry(),i,r,n);if(!To(i,r))return!1;for(let s of o)if(!Sx(s,a))return!1}if(t.type==="MultiPolygon"){let a=Cx(t.coordinates,r,n),o=Lm(e.geometry(),i,r,n);if(!To(i,r))return!1;for(let s of o)if(!lI(s,a))return!1}return!0}var Rp=class bl{constructor(t,i){this.type=me,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error("'within' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(wo(t[1])){let r=t[1];if(r.type==="FeatureCollection"){let n=[];for(let a of r.features){let{type:o,coordinates:s}=a.geometry;o==="Polygon"&&n.push(s),o==="MultiPolygon"&&n.push(...s)}if(n.length){let a={type:"MultiPolygon",coordinates:n};return new bl(r,a)}}else if(r.type==="Feature"){let n=r.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new bl(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new bl(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return cI(t,this.geometries);if(t.geometryType()==="LineString")return pI(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Ix=class{constructor(e=[],t=(i,r)=>i<r?-1:i>r?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(i(r,a)>=0)break;t[e]=a,e=n}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let a=(e<<1)+1,o=a+1;if(o<this.length&&i(t[o],t[a])<0&&(a=o),i(t[a],n)>=0)break;t[e]=t[a],e=a}t[e]=n}};function Ex(e,t,i=0,r=e.length-1,n=dI){for(;r>i;){if(r-i>600){let l=r-i+1,u=t-i+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1),d=Math.max(i,Math.floor(t-u*c/l+p)),f=Math.min(r,Math.floor(t+(l-u)*c/l+p));Ex(e,t,d,f,n)}let a=e[t],o=i,s=r;for(Ga(e,i,t),n(e[r],a)>0&&Ga(e,i,r);o<s;){for(Ga(e,o,s),o++,s--;n(e[o],a)<0;)o++;for(;n(e[s],a)>0;)s--}n(e[i],a)===0?Ga(e,i,s):(s++,Ga(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function Ga(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function dI(e,t){return e<t?-1:e>t?1:0}function zp(e,t){if(e.length<=1)return[e];let i=[],r,n;for(let a of e){let o=mI(a);o!==0&&(a.area=Math.abs(o),n===void 0&&(n=o<0),n===o<0?(r&&i.push(r),r=[a]):r.push(a))}if(r&&i.push(r),t>1)for(let a=0;a<i.length;a++)i[a].length<=t||(Ex(i[a],t,1,i[a].length-1,fI),i[a]=i[a].slice(0,t));return i}function fI(e,t){return t.area-e.area}function mI(e){let t=0;for(let i=0,r=e.length,n=r-1,a,o;i<r;n=i++)a=e[i],o=e[n],t+=(o.x-a.x)*(a.y+o.y);return t}var yI=6378.137,Rm=1/298.257223563,zm=Rm*(2-Rm),Bm=Math.PI/180,Bp=class{constructor(e){let t=Bm*yI*1e3,i=Math.cos(e*Bm),r=1/(1-zm*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-zm)}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i=1/0,r,n,a,o;for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],h=this.wrap(e[s+1][0]-l)*this.kx,c=(e[s+1][1]-u)*this.ky,p=0;(h!==0||c!==0)&&(p=(this.wrap(t[0]-l)*this.kx*h+(t[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=e[s+1][0],u=e[s+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(t[0]-l)*this.kx,c=(t[1]-u)*this.ky;let d=h*h+c*c;d<i&&(i=d,r=l,n=u,a=s,o=p)}return{point:[r,n],index:a,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Ac=100,kc=50;function Ax(e,t){return t[0]-e[0]}function Al(e){return e[1]-e[0]+1}function dr(e,t){return e[1]>=e[0]&&e[1]<t}function Dc(e,t){if(e[0]>e[1])return[null,null];let i=Al(e);if(t){if(i===2)return[e,null];let n=Math.floor(i/2);return[[e[0],e[0]+n],[e[0]+n,e[1]]]}if(i===1)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Lc(e,t){if(!dr(t,e.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Uo(i,e[r]);return i}function Rc(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let r of i)Uo(t,r);return t}function Om(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Op(e,t,i){if(!Om(e)||!Om(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function cn(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function Fp(e,t,i,r,n){let a=Math.min(cn(e,[i,r],n),cn(t,[i,r],n)),o=Math.min(cn(i,[e,t],n),cn(r,[e,t],n));return Math.min(a,o)}function gI(e,t,i,r,n){if(!(dr(t,e.length)&&dr(r,i.length)))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let s=e[o],l=e[o+1];for(let u=r[0];u<r[1];++u){let h=i[u],c=i[u+1];if(nu(s,l,h,c))return 0;a=Math.min(a,Fp(s,l,h,c,n))}}return a}function _I(e,t,i,r,n){if(!(dr(t,e.length)&&dr(r,i.length)))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let s=r[0];s<=r[1];++s)if(a=Math.min(a,n.distance(e[o],i[s])),a===0)return a;return a}function xI(e,t,i){if(Pa(e,t,!0))return 0;let r=1/0;for(let n of t){let a=n[0],o=n[n.length-1];if(a!==o&&(r=Math.min(r,cn(e,[o,a],i)),r===0))return r;let s=i.pointOnLine(n,e);if(r=Math.min(r,i.distance(e,s.point)),r===0)return r}return r}function vI(e,t,i,r){if(!dr(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(Pa(e[a],i,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let o=e[a],s=e[a+1];for(let l of i)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],d=l[u];if(nu(o,s,p,d))return 0;n=Math.min(n,Fp(o,s,p,d,r))}}return n}function Fm(e,t){for(let i of e)for(let r of i)if(Pa(r,t,!0))return!0;return!1}function bI(e,t,i,r=1/0){let n=Rc(e),a=Rc(t);if(r!==1/0&&Op(n,a,i)>=r)return r;if(To(n,a)){if(Fm(e,t))return 0}else if(Fm(t,e))return 0;let o=1/0;for(let s of e)for(let l=0,u=s.length,h=u-1;l<u;h=l++){let c=s[h],p=s[l];for(let d of t)for(let f=0,y=d.length,g=y-1;f<y;g=f++){let _=d[g],b=d[f];if(nu(c,p,_,b))return 0;o=Math.min(o,Fp(c,p,_,b,i))}}return o}function Nm(e,t,i,r,n,a){if(!a)return;let o=Op(Lc(r,a),n,i);o<t&&e.push([o,a,[0,0]])}function Us(e,t,i,r,n,a,o){if(!a||!o)return;let s=Op(Lc(r,a),Lc(n,o),i);s<t&&e.push([s,a,o])}function kl(e,t,i,r,n=1/0){let a=Math.min(r.distance(e[0],i[0][0]),n);if(a===0)return a;let o=new Ix([[0,[0,e.length-1],[0,0]]],Ax),s=Rc(i);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],h=t?kc:Ac;if(Al(u)<=h){if(!dr(u,e.length))return NaN;if(t){let c=vI(e,u,i,r);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=xI(e[c],i,r);if(a=Math.min(a,p),a===0)return 0}}else{let c=Dc(u,t);Nm(o,a,r,e,s,c[0]),Nm(o,a,r,e,s,c[1])}}return a}function Dl(e,t,i,r,n,a=1/0){let o=Math.min(a,n.distance(e[0],i[0]));if(o===0)return o;let s=new Ix([[0,[0,e.length-1],[0,i.length-1]]],Ax);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],h=l[2],c=t?kc:Ac,p=r?kc:Ac;if(Al(u)<=c&&Al(h)<=p){if(!dr(u,e.length)&&dr(h,i.length))return NaN;let d;if(t&&r)d=gI(e,u,i,h,n),o=Math.min(o,d);else if(t&&!r){let f=e.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(d=cn(i[y],f,n),o=Math.min(o,d),o===0)return o}else if(!t&&r){let f=i.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(d=cn(e[y],f,n),o=Math.min(o,d),o===0)return o}else d=_I(e,u,i,h,n),o=Math.min(o,d)}else{let d=Dc(u,t),f=Dc(h,r);Us(s,o,n,e,i,d[0],f[0]),Us(s,o,n,e,i,d[0],f[1]),Us(s,o,n,e,i,d[1],f[0]),Us(s,o,n,e,i,d[1],f[1])}}return o}function wI(e,t){let i=e.geometry(),r=i.flat().map(o=>Dp([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Bp(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,Dl(r,!1,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Dl(r,!1,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,kl(r,!1,o.coordinates,n,a));break}if(a===0)return a}return a}function PI(e,t){let i=e.geometry(),r=i.flat().map(o=>Dp([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Bp(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,Dl(r,!0,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Dl(r,!0,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,kl(r,!0,o.coordinates,n,a));break}if(a===0)return a}return a}function TI(e,t){let i=e.geometry();if(i.length===0||i[0].length===0)return NaN;let r=zp(i,0).map(o=>o.map(s=>s.map(l=>Dp([l.x,l.y],e.canonical)))),n=new Bp(r[0][0][0][1]),a=1/0;for(let o of t)for(let s of r){switch(o.type){case"Point":a=Math.min(a,kl([o.coordinates],!1,s,n,a));break;case"LineString":a=Math.min(a,kl(o.coordinates,!0,s,n,a));break;case"Polygon":a=Math.min(a,bI(s,o.coordinates,n,a));break}if(a===0)return a}return a}function qh(e){return e.type==="MultiPolygon"?e.coordinates.map(t=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map(t=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map(t=>({type:"Point",coordinates:t})):[e]}var Np=class wl{constructor(t,i){this.type=Z,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error("'distance' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(wo(t[1])){let r=t[1];if(r.type==="FeatureCollection")return new wl(r,r.features.map(n=>qh(n.geometry)).flat());if(r.type==="Feature")return new wl(r,qh(r.geometry));if("type"in r&&"coordinates"in r)return new wl(r,qh(r))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return wI(t,this.geometries);if(t.geometryType()==="LineString")return PI(t,this.geometries);if(t.geometryType()==="Polygon")return TI(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Vp=class kx{constructor(t){this.type=pe,this.key=t}static parse(t,i){if(t.length!==2)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let r=t[1];return r==null?i.error("Global state property must be defined."):typeof r!="string"?i.error("Global state property must be string, but found ".concat(typeof t[1]," instead.")):new kx(r)}evaluate(t){var i;let r=(i=t.globals)===null||i===void 0?void 0:i.globalState;return!r||Object.keys(r).length===0?null:co(r,this.key)}eachChild(){}outputDefined(){return!1}},sa={"==":XM,"!=":qM,">":YM,"<":$M,">=":WM,"<=":ZM,array:or,at:PM,boolean:or,case:MM,coalesce:mx,collator:_x,format:bx,image:KM,in:TM,"index-of":SM,interpolate:xi,"interpolate-hcl":xi,"interpolate-lab":xi,length:JM,let:ox,literal:Po,match:CM,number:or,"number-format":HM,object:or,slice:IM,step:kp,string:or,"to-boolean":na,"to-color":na,"to-number":na,"to-string":na,var:lx,within:Rp,distance:Np,"global-state":Vp},Tn=class oo{constructor(t,i,r,n){this.name=t,this.type=i,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){let r=t[0],n=oo.definitions[r];if(!n)return i.error('Unknown expression "'.concat(r,'". If you wanted a literal array, use ["literal", [...]].'),0);let a=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of s){l=new nx(i.registry,Ll,i.path,null,i.scope);let c=[],p=!1;for(let d=1;d<t.length;d++){let f=t[d],y=Array.isArray(u)?u[d-1]:u.type,g=l.parse(f,1+c.length,y);if(!g){p=!0;break}c.push(g)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(c.length," instead."));continue}for(let d=0;d<c.length;d++){let f=Array.isArray(u)?u[d]:u.type,y=c[d];l.concat(d+1).checkSubtype(f,y.type)}if(l.errors.length===0)return new oo(r,a,h,c)}}if(s.length===1)i.errors.push(...l.errors);else{let u=(s.length?s:o).map(([c])=>CI(c)).join(" | "),h=[];for(let c=1;c<t.length;c++){let p=i.parse(t[c],1+h.length);if(!p)return null;h.push(He(p.type))}i.error("Expected arguments of type ".concat(u,", but found (").concat(h.join(", "),") instead."))}return null}static register(t,i){oo.definitions=i;for(let r in i)t[r]=oo}};function Vm(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let a=n?n.evaluate(e):1,o=Q_(t,i,r,a);if(o)throw new Qe(o);return new te(t/255,i/255,r/255,a,!1)}function jm(e,t){return e in t}function $h(e,t){let i=t[e];return typeof i>"u"?null:i}function SI(e,t,i,r){for(;i<=r;){let n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}function ln(e){return{type:e}}Tn.register(sa,{error:[lM,[_e],(e,[t])=>{throw new Qe(t.evaluate(e))}],typeof:[_e,[pe],(e,[t])=>He(pt(t.evaluate(e)))],"to-rgba":[Xt(Z,4),[_i],(e,[t])=>{let[i,r,n,a]=t.evaluate(e).rgb;return[i*255,r*255,n*255,a]}],rgb:[_i,[Z,Z,Z],Vm],rgba:[_i,[Z,Z,Z,Z],Vm],has:{type:me,overloads:[[[_e],(e,[t])=>jm(t.evaluate(e),e.properties())],[[_e,dn],(e,[t,i])=>jm(t.evaluate(e),i.evaluate(e))]]},get:{type:pe,overloads:[[[_e],(e,[t])=>$h(t.evaluate(e),e.properties())],[[_e,dn],(e,[t,i])=>$h(t.evaluate(e),i.evaluate(e))]]},"feature-state":[pe,[_e],(e,[t])=>$h(t.evaluate(e),e.featureState||{})],properties:[dn,[],e=>e.properties()],"geometry-type":[_e,[],e=>e.geometryType()],id:[pe,[],e=>e.id()],zoom:[Z,[],e=>e.globals.zoom],"heatmap-density":[Z,[],e=>e.globals.heatmapDensity||0],elevation:[Z,[],e=>e.globals.elevation||0],"line-progress":[Z,[],e=>e.globals.lineProgress||0],accumulated:[pe,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[Z,ln(Z),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[Z,ln(Z),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:Z,overloads:[[[Z,Z],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Z],(e,[t])=>-t.evaluate(e)]]},"/":[Z,[Z,Z],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Z,[Z,Z],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Z,[],()=>Math.LN2],pi:[Z,[],()=>Math.PI],e:[Z,[],()=>Math.E],"^":[Z,[Z,Z],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Z,[Z],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Z,[Z],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Z,[Z],(e,[t])=>Math.log(t.evaluate(e))],log2:[Z,[Z],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Z,[Z],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Z,[Z],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Z,[Z],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Z,[Z],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Z,[Z],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Z,[Z],(e,[t])=>Math.atan(t.evaluate(e))],min:[Z,ln(Z),(e,t)=>Math.min(...t.map(i=>i.evaluate(e)))],max:[Z,ln(Z),(e,t)=>Math.max(...t.map(i=>i.evaluate(e)))],abs:[Z,[Z],(e,[t])=>Math.abs(t.evaluate(e))],round:[Z,[Z],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Z,[Z],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Z,[Z],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[me,[_e,pe],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[me,[pe],(e,[t])=>e.id()===t.value],"filter-type-==":[me,[_e],(e,[t])=>e.geometryType()===t.value],"filter-<":[me,[_e,pe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[me,[pe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[me,[_e,pe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[me,[pe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[me,[_e,pe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[me,[pe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[me,[_e,pe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[me,[pe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[me,[pe],(e,[t])=>t.value in e.properties()],"filter-has-id":[me,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[me,[Xt(_e)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[me,[Xt(pe)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[me,[_e,Xt(pe)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[me,[_e,Xt(pe)],(e,[t,i])=>SI(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:me,overloads:[[[me,me],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[ln(me),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:me,overloads:[[[me,me],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[ln(me),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[me,[me],(e,[t])=>!t.evaluate(e)],"is-supported-script":[me,[_e],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return i?i(t.evaluate(e)):!0}],upcase:[_e,[_e],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[_e,[_e],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[_e,ln(pe),(e,t)=>t.map(i=>po(i.evaluate(e))).join("")],"resolved-locale":[_e,[Ql],(e,[t])=>t.evaluate(e).resolvedLocale()]});function CI(e){return Array.isArray(e)?"(".concat(e.map(He).join(", "),")"):"(".concat(He(e.type),"...)")}function Ll(e){if(e instanceof lx)return Ll(e.boundExpression);if(e instanceof Tn&&e.name==="error"||e instanceof _x||e instanceof Rp||e instanceof Np||e instanceof Vp)return!1;let t=e instanceof na||e instanceof or,i=!0;return e.eachChild(r=>{t?i=i&&Ll(r):i=i&&r instanceof Po}),i?au(e)&&ou(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function au(e){if(e instanceof Tn&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof Rp||e instanceof Np)return!1;let t=!0;return e.eachChild(i=>{t&&!au(i)&&(t=!1)}),t}function So(e){if(e instanceof Tn&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(i=>{t&&!So(i)&&(t=!1)}),t}function ou(e,t){if(e instanceof Tn&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(r=>{i&&!ou(r,t)&&(i=!1)}),i}function zc(e){return{result:"success",value:e}}function Qn(e){return{result:"error",value:e}}function ma(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function Dx(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function jp(e){return!!e.expression&&e.expression.interpolated}function xe(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function su(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&pt(e)===dn}function MI(e){return e}function II(e){switch(e.type){case"color":return te.parse;case"padding":return Wi.parse;case"numberArray":return Hi.parse;case"colorArray":return ui.parse;default:return null}}function EI(e){switch(e){case"exponential":return Rx;case"interval":return kI;case"categorical":return AI;case"identity":return DI;default:throw new Error('Unknown function type "'.concat(e,'"'))}}function Lx(e,t){let i=e.stops&&typeof e.stops[0][0]=="object",r=i||e.property!==void 0,n=i||!r,a=e.type||(jp(t)?"exponential":"interval"),o=II(t);if(o&&(e=da({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],o(h[1])])),e.default?e.default=o(e.default):e.default=o(t.default)),e.colorSpace&&!xM(e.colorSpace))throw new Error('Unknown color space: "'.concat(e.colorSpace,'"'));let s=EI(a),l,u;if(a==="categorical"){l=Object.create(null);for(let h of e.stops)l[h[0]]=h[1];u=typeof e.stops[0][0]}if(i){let h={},c=[];for(let f=0;f<e.stops.length;f++){let y=e.stops[f],g=y[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},c.push(g)),h[g].stops.push([y[0].value,y[1]])}let p=[];for(let f of c)p.push([h[f].zoom,Lx(h[f],t)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:xi.interpolationFactor.bind(void 0,d),zoomStops:p.map(f=>f[0]),evaluate({zoom:f},y){return Rx({stops:p,base:e.base},t,f).evaluate(f,y)}}}else if(n){let h=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:h,interpolationFactor:xi.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>s(e,t,c,l,u)}}else return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[e.property]:void 0;return p===void 0?Go(e.default,t.default):s(e,t,p,l,u)}}}function Go(e,t,i){if(e!==void 0)return e;if(t!==void 0)return t;if(i!==void 0)return i}function AI(e,t,i,r,n){let a=typeof i===n?r[i]:void 0;return Go(a,e.default,t.default)}function kI(e,t,i){if(xe(i)!=="number")return Go(e.default,t.default);let r=e.stops.length;if(r===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];let n=ru(e.stops.map(a=>a[0]),i);return e.stops[n][1]}function Rx(e,t,i){let r=e.base!==void 0?e.base:1;if(xe(i)!=="number")return Go(e.default,t.default);let n=e.stops.length;if(n===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];let a=ru(e.stops.map(h=>h[0]),i),o=LI(i,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=Ke[t.type]||MI;return typeof s.evaluate=="function"?{evaluate(...h){let c=s.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(!(c===void 0||p===void 0))return u(c,p,o,e.colorSpace)}}:u(s,l,o,e.colorSpace)}function DI(e,t,i){switch(t.type){case"color":i=te.parse(i);break;case"formatted":i=pr.fromString(i.toString());break;case"resolvedImage":i=Yi.fromString(i.toString());break;case"padding":i=Wi.parse(i);break;case"colorArray":i=ui.parse(i);break;case"numberArray":i=Hi.parse(i);break;default:xe(i)!==t.type&&(t.type!=="enum"||!t.values[i])&&(i=void 0)}return Go(i,e.default,t.default)}function LI(e,t,i,r){let n=r-i,a=e-i;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var Up=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new rx,this._defaultValue=t?OI(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let o=this.expression.evaluate(this._evaluator);if(o==null||typeof o=="number"&&o!==o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new Qe("Expected value to be one of ".concat(Object.keys(this._enumValues).map(s=>JSON.stringify(s)).join(", "),", but found ").concat(JSON.stringify(o)," instead."));return o}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,typeof console<"u"&&console.warn(o.message)),this._defaultValue}}};function lu(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in sa}function Gp(e,t){let i=new nx(sa,Ll,[],t?BI(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return r?zc(new Up(r,t)):Qn(i.errors)}var Co=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!So(t.expression),this.globalStateRefs=uu(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}},Rl=class{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!So(t.expression),this.globalStateRefs=uu(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}interpolationFactor(e,t,i){return this.interpolationType?xi.interpolationFactor(this.interpolationType,e,t,i):0}};function RI(e){return e._styleExpression!==void 0}function zx(e,t){let i=Gp(e,t);if(i.result==="error")return i;let r=i.value.expression,n=au(r);if(!n&&!ma(t))return Qn([new Fi("","data expressions not supported")]);let a=ou(r,["zoom"]);if(!a&&!Dx(t))return Qn([new Fi("","zoom expressions not supported")]);let o=Pl(r);if(!o&&!a)return Qn([new Fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof Fi)return Qn([o]);if(o instanceof xi&&!jp(t))return Qn([new Fi("",'"interpolate" expressions cannot be used with this property')]);if(!o)return zc(n?new Co("constant",i.value):new Co("source",i.value));let s=o instanceof xi?o.interpolation:void 0;return zc(n?new Rl("camera",i.value,o.labels,s):new Rl("composite",i.value,o.labels,s))}var Bx=class Ox{constructor(t,i){this._parameters=t,this._specification=i,da(this,Lx(this._parameters,this._specification))}static deserialize(t){return new Ox(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}};function zI(e,t){if(su(e))return new Bx(e,t);if(lu(e)){let i=zx(e,t);if(i.result==="error")throw new Error(i.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));return i.value}else{let i=e;return t.type==="color"&&typeof e=="string"?i=te.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?i=Wi.parse(e):t.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?i=Hi.parse(e):t.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?i=ui.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?i=Xr.parse(e):t.type==="projectionDefinition"&&typeof e=="string"&&(i=Pn.parse(e)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>i}}}function Pl(e){let t=null;if(e instanceof ox)t=Pl(e.result);else if(e instanceof mx){for(let i of e.args)if(t=Pl(i),t)break}else(e instanceof kp||e instanceof xi)&&e.input instanceof Tn&&e.input.name==="zoom"&&(t=e);return t instanceof Fi||e.eachChild(i=>{let r=Pl(i);r instanceof Fi?t=r:!t&&r?t=new Fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Fi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function uu(e,t=new Set){return e instanceof Vp&&t.add(e.key),e.eachChild(i=>{uu(i,t)}),t}function BI(e){let t={color:_i,string:_e,number:Z,enum:_e,boolean:me,formatted:Vo,padding:eu,numberArray:tu,colorArray:vo,projectionDefinition:Jl,resolvedImage:jo,variableAnchorOffsetCollection:iu};return e.type==="array"?Xt(t[e.value]||pe,e.length):t[e.type]}function OI(e){if(e.type==="color"&&su(e.default))return new te(0,0,0,0);switch(e.type){case"color":return te.parse(e.default)||null;case"padding":return Wi.parse(e.default)||null;case"numberArray":return Hi.parse(e.default)||null;case"colorArray":return ui.parse(e.default)||null;case"variableAnchorOffsetCollection":return Xr.parse(e.default)||null;case"projectionDefinition":return Pn.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function Xp(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!Xp(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}var FI={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Mo(e){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Xp(e)||(e=zl(e));let t=Gp(e,FI);if(t.result==="error")throw new Error(t.value.map(i=>"".concat(i.key,": ").concat(i.message)).join(", "));{let i=Fx(e);return{filter:(r,n,a)=>t.value.evaluate(r,n,{},a),needGeometry:i,getGlobalStateRefs:()=>uu(t.value.expression)}}}function NI(e,t){return e<t?-1:e>t?1:0}function Fx(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(Fx(e[t]))return!0;return!1}function zl(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?Yh(e[1],e[2],"=="):t==="!="?Gs(Yh(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Yh(e[1],e[2],t):t==="any"?VI(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(zl)):t==="none"?["all"].concat(e.slice(1).map(zl).map(Gs)):t==="in"?Um(e[1],e.slice(2)):t==="!in"?Gs(Um(e[1],e.slice(2))):t==="has"?Gm(e[1]):t==="!has"?Gs(Gm(e[1])):!0}function Yh(e,t,i){switch(e){case"$type":return["filter-type-".concat(i),t];case"$id":return["filter-id-".concat(i),t];default:return["filter-".concat(i),e,t]}}function VI(e){return["any"].concat(e.map(zl))}function Um(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(i=>typeof i!=typeof t[0])?["filter-in-large",e,["literal",t.sort(NI)]]:["filter-in-small",e,["literal",t]]}}function Gm(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Gs(e){return["!",e]}function jI(){let e={},t=O.$version;for(let i in O.$root){let r=O.$root[i];if(r.required){let n=null;i==="version"?n=t:r.type==="array"?n=[]:n={},n!=null&&(e[i]=n)}}return e}function Nx(e){let t=e.key,i=e.value;return i?[new q(t,i,"constants have been deprecated as of v8")]:[]}function ot(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function yn(e){if(Array.isArray(e))return e.map(yn);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=yn(e[i]);return t}return ot(e)}function li(e){let t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,l=[],u=xe(i);if(u!=="object")return[new q(t,i,"object expected, ".concat(u," found"))];for(let h in i){let c=h.split(".")[0],p=co(r,c)||r["*"],d;if(co(n,c))d=n[c];else if(co(r,c))d=s;else if(n["*"])d=n["*"];else if(r["*"])d=s;else{l.push(new q(t,i[h],'unknown property "'.concat(h,'"')));continue}l=l.concat(d({key:(t&&"".concat(t,"."))+h,value:i[h],valueSpec:p,style:a,styleSpec:o,object:i,objectKey:h,validateSpec:s},i))}for(let h in r)n[h]||r[h].required&&r[h].default===void 0&&i[h]===void 0&&l.push(new q(t,i,'missing required property "'.concat(h,'"')));return l}function qp(e){let t=e.value,i=e.valueSpec,r=e.validateSpec,n=e.style,a=e.styleSpec,o=e.key,s=e.arrayElementValidator||r;if(xe(t)!=="array")return[new q(o,t,"array expected, ".concat(xe(t)," found"))];if(i.length&&t.length!==i.length)return[new q(o,t,"array length ".concat(i.length," expected, length ").concat(t.length," found"))];if(i["min-length"]&&t.length<i["min-length"])return[new q(o,t,"array length at least ".concat(i["min-length"]," expected, length ").concat(t.length," found"))];let l={type:i.value,values:i.values};a.$version<7&&(l.function=i.function),xe(i.value)==="object"&&(l=i.value);let u=[];for(let h=0;h<t.length;h++)u=u.concat(s({array:t,arrayIndex:h,value:t[h],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:a,key:"".concat(o,"[").concat(h,"]")}));return u}function hu(e){let t=e.key,i=e.value,r=e.valueSpec,n=xe(i);return n==="number"&&i!==i&&(n="NaN"),n!=="number"?[new q(t,i,"number expected, ".concat(n," found"))]:"minimum"in r&&i<r.minimum?[new q(t,i,"".concat(i," is less than the minimum value ").concat(r.minimum))]:"maximum"in r&&i>r.maximum?[new q(t,i,"".concat(i," is greater than the maximum value ").concat(r.maximum))]:[]}function Vx(e){let t=e.valueSpec,i=ot(e.value.type),r,n={},a,o,s=i!=="categorical"&&e.value.property===void 0,l=!s,u=xe(e.value.stops)==="array"&&xe(e.value.stops[0])==="array"&&xe(e.value.stops[0][0])==="object",h=li({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return i==="identity"&&s&&h.push(new q(e.key,e.value,'missing required property "property"')),i!=="identity"&&!e.value.stops&&h.push(new q(e.key,e.value,'missing required property "stops"')),i==="exponential"&&e.valueSpec.expression&&!jp(e.valueSpec)&&h.push(new q(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!ma(e.valueSpec)?h.push(new q(e.key,e.value,"property functions not supported")):s&&!Dx(e.valueSpec)&&h.push(new q(e.key,e.value,"zoom functions not supported"))),(i==="categorical"||u)&&e.value.property===void 0&&h.push(new q(e.key,e.value,'"property" property is required')),h;function c(y){if(i==="identity")return[new q(y.key,y.value,'identity function may not have a "stops" property')];let g=[],_=y.value;return g=g.concat(qp({key:y.key,value:_,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),xe(_)==="array"&&_.length===0&&g.push(new q(y.key,_,"array must have at least one stop")),g}function p(y){let g=[],_=y.value,b=y.key;if(xe(_)!=="array")return[new q(b,_,"array expected, ".concat(xe(_)," found"))];if(_.length!==2)return[new q(b,_,"array length 2 expected, length ".concat(_.length," found"))];if(u){if(xe(_[0])!=="object")return[new q(b,_,"object expected, ".concat(xe(_[0])," found"))];if(_[0].zoom===void 0)return[new q(b,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new q(b,_,"object stop key must have value")];if(o&&o>ot(_[0].zoom))return[new q(b,_[0].zoom,"stop zoom values must appear in ascending order")];ot(_[0].zoom)!==o&&(o=ot(_[0].zoom),a=void 0,n={}),g=g.concat(li({key:"".concat(b,"[0]"),value:_[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:hu,value:d}}))}else g=g.concat(d({key:"".concat(b,"[0]"),value:_[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},_));return lu(yn(_[1]))?g.concat([new q("".concat(b,"[1]"),_[1],"expressions are not allowed in function stops.")]):g.concat(y.validateSpec({key:"".concat(b,"[1]"),value:_[1],valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function d(y,g){let _=xe(y.value),b=ot(y.value),v=y.value!==null?y.value:g;if(!r)r=_;else if(_!==r)return[new q(y.key,v,"".concat(_," stop domain type must match previous stop domain type ").concat(r))];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new q(y.key,v,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&i!=="categorical"){let w="number expected, ".concat(_," found");return ma(t)&&i===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new q(y.key,v,w)]}return i==="categorical"&&_==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new q(y.key,v,"integer expected, found ".concat(b))]:i!=="categorical"&&_==="number"&&a!==void 0&&b<a?[new q(y.key,v,"stop domain values must appear in ascending order")]:(a=b,i==="categorical"&&b in n?[new q(y.key,v,"stop domain values must be unique")]:(n[b]=!0,[]))}function f(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function ya(e){let t=(e.expressionContext==="property"?zx:Gp)(yn(e.value),e.valueSpec);if(t.result==="error")return t.value.map(r=>new q("".concat(e.key).concat(r.key),e.value,r.message));let i=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!i.outputDefined())return[new q(e.key,e.value,'Invalid data expression for "'.concat(e.propertyKey,'". Output values must be contained as literals within the expression.'))];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!So(i))return[new q(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!So(i))return[new q(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!ou(i,["zoom","feature-state"]))return[new q(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!au(i))return[new q(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function UI(e){let t=e.value,i=e.key,r=xe(t);return r!=="boolean"?[new q(i,t,"boolean expected, ".concat(r," found"))]:[]}function Bc(e){let t=e.key,i=e.value,r=xe(i);return r!=="string"?[new q(t,i,"color expected, ".concat(r," found"))]:te.parse(String(i))?[]:[new q(t,i,'color expected, "'.concat(i,'" found'))]}function Io(e){let t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?r.values.indexOf(ot(i))===-1&&n.push(new q(t,i,"expected one of [".concat(r.values.join(", "),"], ").concat(JSON.stringify(i)," found"))):Object.keys(r.values).indexOf(ot(i))===-1&&n.push(new q(t,i,"expected one of [".concat(Object.keys(r.values).join(", "),"], ").concat(JSON.stringify(i)," found"))),n}function $p(e){return Xp(yn(e.value))?ya(da({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):jx(e)}function jx(e){let t=e.value,i=e.key;if(xe(t)!=="array")return[new q(i,t,"array expected, ".concat(xe(t)," found"))];let r=e.styleSpec,n,a=[];if(t.length<1)return[new q(i,t,"filter array must have at least 1 element")];switch(a=a.concat(Io({key:"".concat(i,"[0]"),value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),ot(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ot(t[1])==="$type"&&a.push(new q(i,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":t.length!==3&&a.push(new q(i,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&(n=xe(t[1]),n!=="string"&&a.push(new q("".concat(i,"[1]"),t[1],"string expected, ".concat(n," found"))));for(let o=2;o<t.length;o++)n=xe(t[o]),ot(t[1])==="$type"?a=a.concat(Io({key:"".concat(i,"[").concat(o,"]"),value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&a.push(new q("".concat(i,"[").concat(o,"]"),t[o],"string, number, or boolean expected, ".concat(n," found")));break;case"any":case"all":case"none":for(let o=1;o<t.length;o++)a=a.concat(jx({key:"".concat(i,"[").concat(o,"]"),value:t[o],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=xe(t[1]),t.length!==2?a.push(new q(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):n!=="string"&&a.push(new q("".concat(i,"[1]"),t[1],"string expected, ".concat(n," found")));break}return a}function Ux(e,t){let i=e.key,r=e.validateSpec,n=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,l=a["".concat(t,"_").concat(e.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return r({key:i,value:o,valueSpec:a.transition,style:n,styleSpec:a});let h=e.valueSpec||l[s];if(!h)return[new q(i,o,'unknown property "'.concat(s,'"'))];let c;if(xe(o)==="string"&&ma(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new q(i,o,'"'.concat(s,'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ').concat(JSON.stringify(c[1])," }`."))];let p=[];return e.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&p.push(new q(i,o,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&su(yn(o))&&ot(o.type)==="identity"&&p.push(new q(i,o,'"text-font" does not support identity functions'))),p.concat(r({key:e.key,value:o,valueSpec:h,style:n,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:s}))}function Gx(e){return Ux(e,"paint")}function Xx(e){return Ux(e,"layout")}function qx(e){let t=[],i=e.value,r=e.key,n=e.style,a=e.styleSpec;if(xe(i)!=="object")return[new q(r,i,"object expected, ".concat(xe(i)," found"))];!i.type&&!i.ref&&t.push(new q(r,i,'either "type" or "ref" is required'));let o=ot(i.type),s=ot(i.ref);if(i.id){let l=ot(i.id);for(let u=0;u<e.arrayIndex;u++){let h=n.layers[u];ot(h.id)===l&&t.push(new q(r,i.id,'duplicate layer id "'.concat(i.id,'", previously used at line ').concat(h.id.__line__)))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach(u=>{u in i&&t.push(new q(r,i[u],'"'.concat(u,'" is prohibited for ref layers')))});let l;n.layers.forEach(u=>{ot(u.id)===s&&(l=u)}),l?l.ref?t.push(new q(r,i.ref,"ref cannot reference another ref layer")):o=ot(l.type):t.push(new q(r,i.ref,'ref layer "'.concat(s,'" not found')))}else if(o!=="background")if(!i.source)t.push(new q(r,i,'missing required property "source"'));else{let l=n.sources&&n.sources[i.source],u=l&&ot(l.type);l?u==="vector"&&o==="raster"?t.push(new q(r,i.source,'layer "'.concat(i.id,'" requires a raster source'))):u!=="raster-dem"&&o==="hillshade"?t.push(new q(r,i.source,'layer "'.concat(i.id,'" requires a raster-dem source'))):u!=="raster-dem"&&o==="color-relief"?t.push(new q(r,i.source,'layer "'.concat(i.id,'" requires a raster-dem source'))):u==="raster"&&o!=="raster"?t.push(new q(r,i.source,'layer "'.concat(i.id,'" requires a vector source'))):u==="vector"&&!i["source-layer"]?t.push(new q(r,i,'layer "'.concat(i.id,'" must specify a "source-layer"'))):u==="raster-dem"&&o!=="hillshade"&&o!=="color-relief"?t.push(new q(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):o==="line"&&i.paint&&i.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new q(r,i,'layer "'.concat(i.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new q(r,i.source,'source "'.concat(i.source,'" not found')))}return t=t.concat(li({key:r,value:i,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:"".concat(r,".type"),value:i.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"})},filter:$p,layout(l){return li({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Xx(da({layerType:o},u))}}})},paint(l){return li({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Gx(da({layerType:o},u))}}})}}})),t}function gn(e){let t=e.value,i=e.key,r=xe(t);return r!=="string"?[new q(i,t,"string expected, ".concat(r," found"))]:[]}function GI(e){var t;let i=(t=e.sourceName)!==null&&t!==void 0?t:"",r=e.value,n=e.styleSpec,a=n.source_raster_dem,o=e.style,s=[],l=xe(r);if(r===void 0)return s;if(l!=="object")return s.push(new q("source_raster_dem",r,"object expected, ".concat(l," found"))),s;let u=ot(r.encoding)==="custom",h=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?'"'.concat(e.value.encoding,'"'):"Default";for(let p in r)!u&&h.includes(p)?s.push(new q(p,r[p],'In "'.concat(i,'": "').concat(p,'" is only valid when "encoding" is set to "custom". ').concat(c," encoding found"))):a[p]?s=s.concat(e.validateSpec({key:p,value:r[p],valueSpec:a[p],validateSpec:e.validateSpec,style:o,styleSpec:n})):s.push(new q(p,r[p],'unknown property "'.concat(p,'"')));return s}var Xm={promoteId:XI};function $x(e){let t=e.value,i=e.key,r=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new q(i,t,'"type" is required')];let o=ot(t.type),s;switch(o){case"vector":case"raster":return s=li({key:i,value:t,valueSpec:r["source_".concat(o.replace("-","_"))],style:e.style,styleSpec:r,objectElementValidators:Xm,validateSpec:a}),s;case"raster-dem":return s=GI({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case"geojson":if(s=li({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:a,objectElementValidators:Xm}),t.cluster)for(let l in t.clusterProperties){let[u,h]=t.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...ya({key:"".concat(i,".").concat(l,".map"),value:h,expressionContext:"cluster-map"})),s.push(...ya({key:"".concat(i,".").concat(l,".reduce"),value:c,expressionContext:"cluster-reduce"}))}return s;case"video":return li({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:a,styleSpec:r});case"image":return li({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:a,styleSpec:r});case"canvas":return[new q(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Io({key:"".concat(i,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function XI({key:e,value:t}){if(xe(t)==="string")return gn({key:e,value:t});{let i=[];for(let r in t)i.push(...gn({key:"".concat(e,".").concat(r),value:t[r]}));return i}}function Yx(e){let t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],o=xe(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new q("light",t,"object expected, ".concat(o," found"))]),a;for(let s in t){let l=s.match(/^(.*)-transition$/);l&&r[l[1]]&&r[l[1]].transition?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i})):r[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):a=a.concat([new q(s,t[s],'unknown property "'.concat(s,'"'))])}return a}function Zx(e){let t=e.value,i=e.styleSpec,r=i.sky,n=e.style,a=xe(t);if(t===void 0)return[];if(a!=="object")return[new q("sky",t,"object expected, ".concat(a," found"))];let o=[];for(let s in t)r[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i})):o=o.concat([new q(s,t[s],'unknown property "'.concat(s,'"'))]);return o}function Wx(e){let t=e.value,i=e.styleSpec,r=i.terrain,n=e.style,a=[],o=xe(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new q("terrain",t,"object expected, ".concat(o," found"))]),a;for(let s in t)r[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):a=a.concat([new q(s,t[s],'unknown property "'.concat(s,'"'))]);return a}function qI(e){return gn(e).length===0?[]:ya(e)}function $I(e){return gn(e).length===0?[]:ya(e)}function YI(e){let t=e.key,i=e.value;if(xe(i)==="array"){if(i.length<1||i.length>4)return[new q(t,i,"padding requires 1 to 4 values; ".concat(i.length," values found"))];let r={type:"number"},n=[];for(let a=0;a<i.length;a++)n=n.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return hu({key:t,value:i,valueSpec:{}})}function ZI(e){let t=e.key,i=e.value;if(xe(i)==="array"){let r={type:"number"};if(i.length<1)return[new q(t,i,"array length at least 1 expected, length 0 found")];let n=[];for(let a=0;a<i.length;a++)n=n.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return hu({key:t,value:i,valueSpec:{}})}function WI(e){let t=e.key,i=e.value;if(xe(i)==="array"){if(i.length<1)return[new q(t,i,"array length at least 1 expected, length 0 found")];let r=[];for(let n=0;n<i.length;n++)r=r.concat(Bc({key:"".concat(t,"[").concat(n,"]"),value:i[n]}));return r}else return Bc({key:t,value:i})}function HI(e){let t=e.key,i=e.value,r=xe(i),n=e.styleSpec;if(r!=="array"||i.length<1||i.length%2!==0)return[new q(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let o=0;o<i.length;o+=2)a=a.concat(Io({key:"".concat(t,"[").concat(o,"]"),value:i[o],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(qp({key:"".concat(t,"[").concat(o+1,"]"),value:i[o+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a}function Hx(e){let t=[],i=e.value,r=e.key;if(Array.isArray(i)){let n=[],a=[];for(let o in i){i[o].id&&n.includes(i[o].id)&&t.push(new q(r,i,"all the sprites' ids must be unique, but ".concat(i[o].id," is duplicated"))),n.push(i[o].id),i[o].url&&a.includes(i[o].url)&&t.push(new q(r,i,"all the sprites' URLs must be unique, but ".concat(i[o].url," is duplicated"))),a.push(i[o].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(li({key:"".concat(r,"[").concat(o,"]"),value:i[o],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return gn({key:r,value:i})}function KI(e){let t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=xe(t);if(t===void 0)return[];if(a!=="object")return[new q("projection",t,"object expected, ".concat(a," found"))];let o=[];for(let s in t)r[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i})):o=o.concat([new q(s,t[s],'unknown property "'.concat(s,'"'))]);return o}function JI(e){let t=e.key,i=e.value;i=i instanceof String?i.valueOf():i;let r=xe(i);return r==="array"&&!eE(i)&&!QI(i)?[new q(t,i,"projection expected, invalid array ".concat(JSON.stringify(i)," found"))]:["array","string"].includes(r)?[]:[new q(t,i,'projection expected, invalid type "'.concat(r,'" found'))]}function QI(e){return!!["interpolate","step","literal"].includes(e[0])}function eE(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function tE(e){return!!e&&e.constructor===Object}function Kx(e){return tE(e.value)?[]:[new q(e.key,e.value,"object expected, ".concat(xe(e.value)," found"))]}var qm={"*"(){return[]},array:qp,boolean:UI,number:hu,color:Bc,constants:Nx,enum:Io,filter:$p,function:Vx,layer:qx,object:li,source:$x,light:Yx,sky:Zx,terrain:Wx,projection:KI,projectionDefinition:JI,string:gn,formatted:qI,resolvedImage:$I,padding:YI,numberArray:ZI,colorArray:WI,variableAnchorOffsetCollection:HI,sprite:Hx,state:Kx};function Bl(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=Bl,i.expression&&su(ot(t))?Vx(e):i.expression&&lu(yn(t))?ya(e):i.type&&qm[i.type]?qm[i.type](e):li(da({},e,{valueSpec:i.type?r[i.type]:i}))}function Jx(e){let t=e.value,i=e.key,r=gn(e);return r.length||(t.indexOf("{fontstack}")===-1&&r.push(new q(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&r.push(new q(i,t,'"glyphs" url must include a "{range}" token'))),r}function hi(e,t=O){let i=[];return i=i.concat(Bl({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Bl,objectElementValidators:{glyphs:Jx,"*"(){return[]}}})),e.constants&&(i=i.concat(Nx({key:"constants",value:e.constants}))),Qx(i)}hi.source=wi(bi($x));hi.sprite=wi(bi(Hx));hi.glyphs=wi(bi(Jx));hi.light=wi(bi(Yx));hi.sky=wi(bi(Zx));hi.terrain=wi(bi(Wx));hi.state=wi(bi(Kx));hi.layer=wi(bi(qx));hi.filter=wi(bi($p));hi.paintProperty=wi(bi(Gx));hi.layoutProperty=wi(bi(Xx));function bi(e){return function(t){return e(ri(nt({},t),{validateSpec:Bl}))}}function Qx(e){return[].concat(e).sort((t,i)=>t.line-i.line)}function wi(e){return function(...t){return Qx(e.apply(this,t))}}var ht=hi,mj=ht.source,iE=ht.light,rE=ht.sky,yj=ht.terrain,gj=ht.filter,nE=ht.paintProperty,aE=ht.layoutProperty;function cu(e,t){let i=!1;if(t&&t.length)for(let r of t)e.fire(new ne(new Error(r.message))),i=!0;return i}var Oc=class e0{constructor(t,i,r){let n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let o=new Int32Array(this.arrayBuffer);t=o[0],i=o[1],r=o[2],this.d=i+2*r;for(let u=0;u<this.d*this.d;u++){let h=o[3+u],c=o[3+u+1];n.push(h===c?null:o.subarray(h,c))}let s=o[3+n.length],l=o[3+n.length+1];this.keys=o.subarray(s,l),this.bboxes=o.subarray(l),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let o=0;o<this.d*this.d;o++)n.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;let a=r/i*t;this.min=-a,this.max=t+a}insert(t,i,r,n,a){this._forEachCell(i,r,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,r,n,a,o){this.cells[a].push(o)}query(t,i,r,n,a){let o=this.min,s=this.max;if(t<=o&&i<=o&&s<=r&&s<=n&&!a)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(t,i,r,n,this._queryCell,l,u,a),l}}_queryCell(t,i,r,n,a,o,s,l){let u=this.cells[a];if(u!==null){let h=this.keys,c=this.bboxes;for(let p=0;p<u.length;p++){let d=u[p];if(s[d]===void 0){let f=d*4;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&i<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(s[d]=!0,o.push(h[d])):s[d]=!1}}}}_forEachCell(t,i,r,n,a,o,s,l){let u=this._convertToCellCoord(t),h=this._convertToCellCoord(i),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n);for(let d=u;d<=c;d++)for(let f=h;f<=p;f++){let y=this.d*f+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(f),this._convertFromCellCoord(d+1),this._convertFromCellCoord(f+1)))&&a.call(this,t,i,r,n,y,o,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,i=3+this.cells.length+1+1,r=0;for(let o=0;o<this.cells.length;o++)r+=this.cells[o].length;let n=new Int32Array(i+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=i;for(let o=0;o<t.length;o++){let s=t[o];n[3+o]=a,n.set(s,a),a+=s.length}return n[3+t.length]=a,n.set(this.keys,a),a+=this.keys.length,n[3+t.length+1]=a,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer}static serialize(t,i){let r=t.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t){return new e0(t.buffer)}},sr={};function H(e,t,i={}){if(sr[e])throw new Error("".concat(e," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),sr[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}H("Object",Object);H("Set",Set);H("TransferableGridIndex",Oc);H("Color",te);H("Error",Error);H("AJAXError",El);H("ResolvedImage",Yi);H("StylePropertyFunction",Bx);H("StyleExpression",Up,{omit:["_evaluator"]});H("ZoomDependentExpression",Rl);H("ZoomConstantExpression",Co);H("CompoundExpression",Tn,{omit:["_evaluate"]});for(let e in sa)sa[e]._classRegistryKey||H("Expression_".concat(e),sa[e]);function t0(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function Yp(e){let t=e.constructor;return e.$name||t._classRegistryKey}function oE(e){if(e===null||typeof e!="object")return!1;let t=Yp(e);return!!(t&&t!=="Object")}function i0(e){return!oE(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||t0(e)||hr(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function fo(e,t){if(i0(e)){if((t0(e)||hr(e))&&t&&t.push(e),ArrayBuffer.isView(e)){let a=e;t&&t.push(a.buffer)}return e instanceof ImageData&&t&&t.push(e.data.buffer),e}if(Array.isArray(e)){let a=[];for(let o of e)a.push(fo(o,t));return a}if(typeof e!="object")throw new Error("can't serialize object of type ".concat(typeof e));let i=Yp(e);if(!i)throw new Error("can't serialize object of unregistered class ".concat(e.constructor.name));if(!sr[i])throw new Error("".concat(i," is not registered."));let{klass:r}=sr[i],n=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&n===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let a in e){if(!e.hasOwnProperty(a)||sr[i].omit.indexOf(a)>=0)continue;let o=e[a];n[a]=sr[i].shallow.indexOf(a)>=0?o:fo(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}function mo(e){if(i0(e))return e;if(Array.isArray(e))return e.map(mo);if(typeof e!="object")throw new Error("can't deserialize object of type ".concat(typeof e));let t=Yp(e)||"Object";if(!sr[t])throw new Error("can't deserialize unregistered class ".concat(t));let{klass:i}=sr[t];if(!i)throw new Error("can't deserialize unregistered class ".concat(t));if(i.deserialize)return i.deserialize(e);let r=Object.create(i.prototype);for(let n of Object.keys(e)){if(n==="$name")continue;let a=e[n];r[n]=sr[t].shallow.indexOf(n)>=0?a:mo(a)}return r}var Fc=class{constructor(){this.first=!0}update(e,t){let i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=i,!0):!1)}},mt={"Latin-1 Supplement":e=>e>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Hangul Syllables":e=>e>=44032&&e<=55215,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function sE(e){for(let t of e)if(cE(t.charCodeAt(0)))return!0;return!1}function Zp(e){let t=e.map(i=>{try{return new RegExp("\\p{sc=".concat(i,"}"),"u").source}catch(r){return null}}).filter(i=>i);return new RegExp(t.join("|"),"u")}var lE=["Arab","Dupl","Mong","Ougr","Syrc"],_j=Zp(lE),uE=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],hE=Zp(uE);function cE(e){return e===746||e===747?!0:e<4352?!1:!!(mt["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||mt["CJK Compatibility"](e)||mt["CJK Strokes"](e)||mt["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||mt["Enclosed CJK Letters and Months"](e)||mt["Ideographic Description Characters"](e)||mt.Kanbun(e)||mt.Katakana(e)&&e!==12540||mt["Halfwidth and Fullwidth Forms"](e)&&e!==65288&&e!==65289&&e!==65293&&!(e>=65306&&e<=65310)&&e!==65339&&e!==65341&&e!==65343&&!(e>=65371&&e<=65503)&&e!==65507&&!(e>=65512&&e<=65519)||mt["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||mt["Vertical Forms"](e)||mt["Yijing Hexagram Symbols"](e)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(e))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(e))||hE.test(String.fromCodePoint(e)))}var pE=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],dE=Zp(pE);function r0(e){return dE.test(String.fromCodePoint(e))}function fE(e,t){return!(!t&&r0(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||mt.Khmer(e))}function mE(e){for(let t of e)if(r0(t.charCodeAt(0)))return!0;return!1}function yE(e,t){for(let i of e)if(!fE(i.charCodeAt(0),t))return!1;return!0}var gE=class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(ga.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let i=e.pluginURL,r=new Promise(a=>{this.loadScriptResolve=a});t(i);let n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await Promise.race([r,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:i};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(i))}},ga=new gE,lt=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new Fc,this.transition=t.transition||{},this.globalState=t.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Fc,this.transition={},this.globalState={})}isSupportedScript(e){return yE(e,ga.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}},pu=class{constructor(e,t){this.property=e,this.value=t,this.expression=zI(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}},Nc=class{constructor(e){this.property=e,this.value=new pu(e,void 0)}transitioned(e,t){return new $m(this.property,this.value,t,K({},e.transition,this.transition),e.now)}untransitioned(){return new $m(this.property,this.value,null,{},0)}},du=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ot(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nc(this._values[e].property)),this._values[e].value=new pu(this._values[e].property,t===null?void 0:Ot(t))}getTransition(e){return Ot(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nc(this._values[e].property)),this._values[e].transition=Ot(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i);let r=this.getTransition(t);r!==void 0&&(e["".concat(t,"-transition")]=r)}return e}transitioned(e,t){let i=new Ym(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){let e=new Ym(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},$m=class{constructor(e,t,i,r,n){this.property=e,this.value=t,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return a.possiblyEvaluate(e,t,i);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),n,A_(o))}}else return n}},Ym=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new fu(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},_E=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Ot(this._values[e].value)}setValue(e,t){this._values[e]=new pu(this._values[e].property,t===null?void 0:Ot(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){let r=new fu(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}},gi=class{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}},fu=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},W=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){let r=this.specification.type,n=Ke[r];return n?n(e,t,i):e}},re=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return e.expression.kind==="constant"||e.expression.kind==="camera"?new gi(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)},t):new gi(this,e.expression,t)}interpolate(e,t,i){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new gi(this,{kind:"constant",value:void 0},e.parameters);let r=this.specification.type,n=Ke[r];if(n){let a=n(e.value.value,t.value.value,i);return new gi(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,i,r,n,a){return e.kind==="constant"?e.value:e.evaluate(t,i,r,n,a)}},mu=class extends re{possiblyEvaluate(e,t,i,r){if(e.value===void 0)return new gi(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},i,r),a=e.property.specification.type==="resolvedImage"&&typeof n!="string"?n.name:n,o=this._calculate(a,a,a,t);return new gi(this,{kind:"constant",value:o},t)}else if(e.expression.kind==="camera"){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new gi(this,{kind:"constant",value:n},t)}else return new gi(this,e.expression,t)}evaluate(e,t,i,r,n,a){if(e.kind==="source"){let o=e.evaluate(t,i,r,n,a);return this._calculate(o,o,o,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},Wp=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(e.value!==void 0)if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}else return this._calculate(e.expression.evaluate(new lt(Math.floor(t.zoom-1),t)),e.expression.evaluate(new lt(Math.floor(t.zoom),t)),e.expression.evaluate(new lt(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},yu=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}},vt=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let i=e[t];i.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new pu(i,void 0),n=this.defaultTransitionablePropertyValues[t]=new Nc(i);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}};H("DataDrivenProperty",re);H("DataConstantProperty",W);H("CrossFadedDataDrivenProperty",mu);H("CrossFadedProperty",Wp);H("ColorRampProperty",yu);var Xs="-transition",Pi=class extends Ft{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Mo(e.filter)),t.layout&&(this._unevaluatedLayout=new _E(t.layout)),t.paint)){this._transitionablePaint=new du(t.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new fu(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=Mo(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[t];for(let r of i.getGlobalStateRefs())e.add(r)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}setLayoutProperty(e,t,i={}){if(t!=null){let r="layers.".concat(this.id,".layout.").concat(e);if(this._validate(aE,r,e,t,i))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(Xs)?this._transitionablePaint.getTransition(e.slice(0,-Xs.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(t!=null){let r="layers.".concat(this.id,".paint.").concat(e);if(this._validate(nE,r,e,t,i))return!1}if(e.endsWith(Xs))return this._transitionablePaint.setTransition(e.slice(0,-Xs.length),t||void 0),!1;{let r=this._transitionablePaint._values[e],n=r.property.specification["property-type"]==="cross-faded-data-driven",a=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(e,o,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),D_(e,(t,i)=>t!==void 0&&!(i==="layout"&&!Object.keys(t).length)&&!(i==="paint"&&!Object.keys(t).length))}_validate(e,t,i,r,n={}){return n&&n.validate===!1?!1:cu(this,e.call(ht,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:O,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(!(!(t instanceof gi)||!ma(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}},xE={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Xo=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},vE=128,bE=5,tt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*bE),vE),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function it(e,t=1){let i=0,r=0,n=e.map(o=>{let s=wE(o.type),l=i=Zm(i,Math.max(t,s)),u=o.components||1;return r=Math.max(r,s),i+=s*u,{name:o.name,type:o.type,components:u,offset:l}}),a=Zm(i,Math.max(r,t));return{members:n,size:a,alignment:t}}function wE(e){return xE[e].BYTES_PER_ELEMENT}function Zm(e,t){return Math.ceil(e/t)*t}var PE=se(ce(),1),qo=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.int16[r+0]=t,this.int16[r+1]=i,e}};qo.prototype.bytesPerElement=4;H("StructArrayLayout2i4",qo);var gu=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}};gu.prototype.bytesPerElement=6;H("StructArrayLayout3i6",gu);var Hp=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,e}};Hp.prototype.bytesPerElement=8;H("StructArrayLayout4i8",Hp);var Kp=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};Kp.prototype.bytesPerElement=12;H("StructArrayLayout2i4i12",Kp);var Jp=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*4,l=e*8;return this.int16[s+0]=t,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=o,e}};Jp.prototype.bytesPerElement=8;H("StructArrayLayout2i4ub8",Jp);var Eo=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.float32[r+0]=t,this.float32[r+1]=i,e}};Eo.prototype.bytesPerElement=8;H("StructArrayLayout2f8",Eo);var Qp=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,n,a,o,s,l,u)}emplace(e,t,i,r,n,a,o,s,l,u,h){let c=e*10;return this.uint16[c+0]=t,this.uint16[c+1]=i,this.uint16[c+2]=r,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=o,this.uint16[c+6]=s,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,e}};Qp.prototype.bytesPerElement=20;H("StructArrayLayout10ui20",Qp);var ed=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,a,o,s,l,u,h,c)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=e*12;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,e}};ed.prototype.bytesPerElement=24;H("StructArrayLayout4i4ui4i24",ed);var td=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}};td.prototype.bytesPerElement=12;H("StructArrayLayout3f12",td);var id=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint32[i+0]=t,e}};id.prototype.bytesPerElement=4;H("StructArrayLayout1ul4",id);var rd=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,a,o,s,l)}emplace(e,t,i,r,n,a,o,s,l,u){let h=e*10,c=e*5;return this.int16[h+0]=t,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=o,this.uint32[c+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=u,e}};rd.prototype.bytesPerElement=20;H("StructArrayLayout6i1ul2ui20",rd);var nd=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};nd.prototype.bytesPerElement=12;H("StructArrayLayout2i2i2i12",nd);var ad=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}emplace(e,t,i,r,n,a){let o=e*4,s=e*8;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[s+6]=n,this.int16[s+7]=a,e}};ad.prototype.bytesPerElement=16;H("StructArrayLayout2f1f2i16",ad);var od=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*16,l=e*4,u=e*8;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=o,e}};od.prototype.bytesPerElement=16;H("StructArrayLayout2ub2f2i16",od);var _u=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}};_u.prototype.bytesPerElement=6;H("StructArrayLayout3ui6",_u);var sd=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_){let b=e*24,v=e*12,w=e*48;return this.int16[b+0]=t,this.int16[b+1]=i,this.uint16[b+2]=r,this.uint16[b+3]=n,this.uint32[v+2]=a,this.uint32[v+3]=o,this.uint32[v+4]=s,this.uint16[b+10]=l,this.uint16[b+11]=u,this.uint16[b+12]=h,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[w+36]=d,this.uint8[w+37]=f,this.uint8[w+38]=y,this.uint32[v+10]=g,this.int16[b+22]=_,e}};sd.prototype.bytesPerElement=48;H("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",sd);var ld=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,T,S,M,E,L,z,R){let k=this.length;return this.resize(k+1),this.emplace(k,e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,T,S,M,E,L,z,R)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,T,S,M,E,L,z,R,k){let D=e*32,x=e*16;return this.int16[D+0]=t,this.int16[D+1]=i,this.int16[D+2]=r,this.int16[D+3]=n,this.int16[D+4]=a,this.int16[D+5]=o,this.int16[D+6]=s,this.int16[D+7]=l,this.uint16[D+8]=u,this.uint16[D+9]=h,this.uint16[D+10]=c,this.uint16[D+11]=p,this.uint16[D+12]=d,this.uint16[D+13]=f,this.uint16[D+14]=y,this.uint16[D+15]=g,this.uint16[D+16]=_,this.uint16[D+17]=b,this.uint16[D+18]=v,this.uint16[D+19]=w,this.uint16[D+20]=T,this.uint16[D+21]=S,this.uint16[D+22]=M,this.uint32[x+12]=E,this.float32[x+13]=L,this.float32[x+14]=z,this.uint16[D+30]=R,this.uint16[D+31]=k,e}};ld.prototype.bytesPerElement=64;H("StructArrayLayout8i15ui1ul2f2ui64",ld);var xu=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.float32[i+0]=t,e}};xu.prototype.bytesPerElement=4;H("StructArrayLayout1f4",xu);var ud=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*6,a=e*3;return this.uint16[n+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,e}};ud.prototype.bytesPerElement=12;H("StructArrayLayout1ui2f12",ud);var hd=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*2,a=e*4;return this.uint32[n+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,e}};hd.prototype.bytesPerElement=8;H("StructArrayLayout1ul2ui8",hd);var cd=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}};cd.prototype.bytesPerElement=4;H("StructArrayLayout2ui4",cd);var pd=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint16[i+0]=t,e}};pd.prototype.bytesPerElement=2;H("StructArrayLayout1ui2",pd);var dd=class extends tt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,e}};dd.prototype.bytesPerElement=16;H("StructArrayLayout4f16",dd);var n0=class extends Xo{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new PE.default(this.anchorPointX,this.anchorPointY)}};n0.prototype.size=20;var a0=class extends rd{get(e){return new n0(this,e)}};H("CollisionBoxArray",a0);var o0=class extends Xo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};o0.prototype.size=48;var s0=class extends sd{get(e){return new o0(this,e)}};H("PlacedSymbolArray",s0);var l0=class extends Xo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};l0.prototype.size=64;var u0=class extends ld{get(e){return new l0(this,e)}};H("SymbolInstanceArray",u0);var h0=class extends xu{getoffsetX(e){return this.float32[e*1+0]}};H("GlyphOffsetArray",h0);var c0=class extends gu{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};H("SymbolLineVertexArray",c0);var p0=class extends Xo{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};p0.prototype.size=12;var d0=class extends ud{get(e){return new p0(this,e)}};H("TextAnchorOffsetArray",d0);var f0=class extends Xo{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};f0.prototype.size=8;var m0=class extends hd{get(e){return new f0(this,e)}};H("FeatureIndexArray",m0);var lr=class extends qo{},TE=class extends gu{},SE=class extends Hp{},CE=class extends qo{},ME=class extends qo{},IE=class extends Kp{},EE=class extends Jp{},AE=class extends Eo{},$n=class extends Qp{},kE=class extends ed{},DE=class extends td{},LE=class extends id{},Wm=class extends nd{},RE=class extends ad{},zE=class extends od{},BE=class extends _u{},Ti=class extends _u{},Vc=class extends cd{},OE=class extends pd{},FE=it([{name:"a_pos",components:2,type:"Int16"}],4),{members:NE,size:xj,alignment:vj}=FE,qe=class ea{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,n){let a=this.segments[this.segments.length-1];return t>ea.MAX_VERTEX_ARRAY_LENGTH&&ct("Max vertices per segment is ".concat(ea.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t,". Consider using the `fillLargeMeshArrays` function if you require meshes with more than ").concat(ea.MAX_VERTEX_ARRAY_LENGTH," vertices.")),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+t>ea.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(i,r,n):a}createNewSegment(t,i,r){let n={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return r!==void 0&&(n.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(t,i,r){return this.prepareSegment(0,t,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,n){return new ea([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}};qe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;H("SegmentVector",qe);function Hm(e,t){return e=Ae(Math.floor(e),0,255),t=Ae(Math.floor(t),0,255),256*e+t}var Ol=it([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),VE=se(wg(),1),y0=class g0{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,n){this.ids.push(Km(t)),this.positions.push(i,r,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let i=Km(t),r=0,n=this.ids.length-1;for(;r<n;){let o=r+n>>1;this.ids[o]>=i?n=o:r=o+1}let a=[];for(;this.ids[r]===i;){let o=this.positions[3*r],s=this.positions[3*r+1],l=this.positions[3*r+2];a.push({index:o,start:s,end:l}),r++}return a}static serialize(t,i){let r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return jc(r,n,0,r.length-1),i&&i.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){let i=new g0;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}};function Km(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,VE.default)(String(e))}function jc(e,t,i,r){for(;i<r;){let n=e[i+r>>1],a=i-1,o=r+1;for(;;){do a++;while(e[a]<n);do o--;while(e[o]>n);if(a>=o)break;qs(e,a,o),qs(t,3*a,3*o),qs(t,3*a+1,3*o+1),qs(t,3*a+2,3*o+2)}o-i<r-o?(jc(e,t,i,o),i=o+1):(jc(e,t,o+1,r),r=o)}}function qs(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}H("FeaturePositionMap",y0);var fr=class{constructor(e,t){this.gl=e.gl,this.location=t}},le=class extends fr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},Y=class extends fr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},ae=class extends fr{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},qt=class extends fr{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},Ur=class extends fr{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},Gr=class extends fr{constructor(e,t){super(e,t),this.current=te.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},Jm=class extends fr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e.length*4);for(let i=0;i<e.length;i++)t[4*i]=e[i].r,t[4*i+1]=e[i].g,t[4*i+2]=e[i].b,t[4*i+3]=e[i].a;this.gl.uniform4fv(this.location,t)}}},Qm=class extends fr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},jE=new Float32Array(16),Yt=class extends fr{constructor(e,t){super(e,t),this.current=jE}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function Uc(e){return[Hm(255*e.r,255*e.g),Hm(255*e.b,255*e.a)]}var so=class{constructor(e,t,i){this.value=e,this.uniformNames=t.map(r=>"u_".concat(r)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new Gr(e,t):new Y(e,t)}},ta=class{constructor(e,t){this.uniformNames=t.map(i=>"u_".concat(i)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,r){let n=r==="u_pattern_to"?this.patternTo:r==="u_pattern_from"?this.patternFrom:r==="u_pixel_ratio_to"?this.pixelRatioTo:r==="u_pixel_ratio_from"?this.pixelRatioFrom:null;n&&e.set(n)}getBinding(e,t,i){return i.substr(0,9)==="u_pattern"?new Ur(e,t):new Y(e,t)}},nr=class{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(n=>({name:"a_".concat(n),type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n){let a=this.paintVertexArray.length,o=this.expression.evaluate(new lt(0),t,{},r,[],n);this.paintVertexArray.resize(e),this._setPaintValue(a,e,o)}updatePaintArray(e,t,i,r){let n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(e,t,n)}_setPaintValue(e,t,i){if(this.type==="color"){let r=Uc(i);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},mi=class{constructor(e,t,i,r,n,a){this.expression=e,this.uniformNames=t.map(o=>"u_".concat(o,"_t")),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:"a_".concat(o),type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,i,r,n){let a=this.expression.evaluate(new lt(this.zoom),t,{},r,[],n),o=this.expression.evaluate(new lt(this.zoom+1),t,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,a,o)}updatePaintArray(e,t,i,r){let n=this.expression.evaluate({zoom:this.zoom},i,r),a=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(e,t,n,a)}_setPaintValue(e,t,i,r){if(this.type==="color"){let n=Uc(i),a=Uc(r);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1],a[0],a[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=Ae(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new Y(e,t)}},kr=class{constructor(e,t,i,r,n,a){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(e,t,i,r){if(!r||!i)return;let{min:n,mid:a,max:o}=i,s=r[n],l=r[a],u=r[o];if(!(!s||!l||!u))for(let h=e;h<t;h++)this.zoomInPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Ol.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Ol.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},_0=class{constructor(e,t,i){this.binders={},this._buffers=[];let r=[];for(let n in e.paint._values){if(!i(n))continue;let a=e.paint.get(n);if(!(a instanceof gi)||!ma(a.property.specification))continue;let o=UE(n,e.type),s=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,h=a.property.specification["property-type"],c=h==="cross-faded"||h==="cross-faded-data-driven";if(s.kind==="constant")this.binders[n]=c?new ta(s.value,o):new so(s.value,o,l),r.push("/u_".concat(n));else if(s.kind==="source"||c){let p=ey(n,l,"source");this.binders[n]=c?new kr(s,l,u,t,p,e.id):new nr(s,o,l,p),r.push("/a_".concat(n))}else{let p=ey(n,l,"composite");this.binders[n]=new mi(s,o,l,u,t,p),r.push("/z_".concat(n))}}this.cacheKey=r.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof nr||t instanceof mi?t.maxValue:0}populatePaintArrays(e,t,i,r,n){for(let a in this.binders){let o=this.binders[a];(o instanceof nr||o instanceof mi||o instanceof kr)&&o.populatePaintArray(e,t,i,r,n)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof ta&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,r,n){let a=!1;for(let o in e){let s=t.getPositions(o);for(let l of s){let u=i.feature(l.index);for(let h in this.binders){let c=this.binders[h];if((c instanceof nr||c instanceof mi||c instanceof kr)&&c.expression.isStateDependent===!0){let p=r.paint.get(h);c.expression=p.value,c.updatePaintArray(l.start,l.end,u,e[o],n),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof so||i instanceof ta)&&e.push(...i.uniformNames.map(r=>"#define HAS_UNIFORM_".concat(r)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof nr||i instanceof mi)for(let r=0;r<i.paintVertexAttributes.length;r++)e.push(i.paintVertexAttributes[r].name);else if(i instanceof kr)for(let r=0;r<Ol.members.length;r++)e.push(Ol.members[r].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof so||i instanceof ta||i instanceof mi)for(let r of i.uniformNames)e.push(r)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof so||n instanceof ta||n instanceof mi){for(let a of n.uniformNames)if(t[a]){let o=n.getBinding(e,t[a],a);i.push({name:a,property:r,binding:o})}}}return i}setUniforms(e,t,i,r){for(let{name:n,property:a,binding:o}of t)this.binders[a].setUniform(o,r,i.get(a),n)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof kr){let r=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof nr||i instanceof mi)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof nr||i instanceof mi||i instanceof kr)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof nr||t instanceof mi||t instanceof kr)&&t.destroy()}}},_n=class{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new _0(r,t,i);this.needsUpload=!1,this._featureMap=new y0,this._bufferOffset=0}populatePaintArrays(e,t,i,r,n,a){for(let o in this.programConfigurations)this.programConfigurations[o].populatePaintArrays(e,t,r,n,a);t.id!==void 0&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(let n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function UE(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}function GE(e){return{"line-pattern":{source:$n,composite:$n},"fill-pattern":{source:$n,composite:$n},"fill-extrusion-pattern":{source:$n,composite:$n}}[e]}function ey(e,t,i){let r={color:{source:Eo,composite:dd},number:{source:xu,composite:Eo}},n=GE(e);return n&&n[i]||r[t][i]}H("ConstantBinder",so);H("CrossFadedConstantBinder",ta);H("SourceExpressionBinder",nr);H("CrossFadedCompositeBinder",kr);H("CompositeExpressionBinder",mi);H("ProgramConfiguration",_0,{omit:["_buffers"]});H("ProgramConfigurationSet",_n);var XE=15,Gc=Math.pow(2,XE-1)-1,ty=-Gc-1;function Sn(e){let t=8192/e.extent,i=e.loadGeometry();for(let r=0;r<i.length;r++){let n=i[r];for(let a=0;a<n.length;a++){let o=n[a],s=Math.round(o.x*t),l=Math.round(o.y*t);o.x=Ae(s,ty,Gc),o.y=Ae(l,ty,Gc),(s<o.x||s>o.x+1||l<o.y||l>o.y+1)&&ct("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Cn(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Sn(e):[]}}var iy=-32768;function qE(e,t,i,r,n){e.emplaceBack(iy+t*8+r,iy+i*8+n)}var fd=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new CE,this.indexArray=new Ti,this.segments=new qe,this.programConfigurations=new _n(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){let r=this.layers[0],n=[],a=null,o=!1,s=r.type==="heatmap";if(r.type==="circle"){let u=r;a=u.layout.get("circle-sort-key"),o=!a.isConstant(),s=s||u.paint.get("circle-pitch-alignment")==="map"}let l=s?t.subdivisionGranularity.circle:1;for(let{feature:u,id:h,index:c,sourceLayerIndex:p}of e){let d=this.layers[0]._featureFilter.needGeometry,f=Cn(u,d);if(!this.layers[0]._featureFilter.filter(new lt(this.zoom,{globalState:this.globalState}),f,i))continue;let y=o?a.evaluate(f,{},i):void 0,g={id:h,properties:u.properties,type:u.type,sourceLayerIndex:p,index:c,geometry:d?f.geometry:Sn(u),patterns:{},sortKey:y};n.push(g)}o&&n.sort((u,h)=>u.sortKey-h.sortKey);for(let u of n){let{geometry:h,index:c,sourceLayerIndex:p}=u,d=e[c].feature;this.addFeature(u,h,c,i,l),t.featureIndex.insert(d,h,c,p,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,NE),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error("Invalid circle bucket granularity: ".concat(n,"; valid values are 1, 3, 5, 7."))}let o=a.length;for(let s of t)for(let l of s){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,e.sortKey),p=c.vertexLength;for(let d=0;d<o;d++)for(let f=0;f<o;f++)qE(this.layoutVertexArray,u,h,a[f],a[d]);for(let d=0;d<o-1;d++)for(let f=0;f<o-1;f++){let y=p+d*o+f,g=p+(d+1)*o+f;this.indexArray.emplaceBack(y,g+1,y+1),this.indexArray.emplaceBack(y,g,g+1)}c.vertexLength+=o*o,c.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r)}};H("CircleBucket",fd,{omit:["layers"]});var $s=se(ce(),1);function x0(e,t){for(let i=0;i<e.length;i++)if(_a(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(_a(e,t[i]))return!0;return!!md(e,t)}function $E(e,t,i){return!!(_a(e,t)||Xc(t,e,i))}function v0(e,t){if(e.length===1)return ry(t,e[0]);for(let i=0;i<t.length;i++){let r=t[i];for(let n=0;n<r.length;n++)if(_a(e,r[n]))return!0}for(let i=0;i<e.length;i++)if(ry(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(md(e,t[i]))return!0;return!1}function YE(e,t,i){for(let r=0;r<t.length;r++){let n=t[r];if(e.length>=3){for(let a=0;a<n.length;a++)if(_a(e,n[a]))return!0}if(ZE(e,n,i))return!0}return!1}function ZE(e,t,i){if(e.length>1){if(md(e,t))return!0;for(let r=0;r<t.length;r++)if(Xc(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(Xc(e[r],t,i))return!0;return!1}function md(e,t){if(e.length===0||t.length===0)return!1;for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];for(let a=0;a<t.length-1;a++){let o=t[a],s=t[a+1];if(WE(r,n,o,s))return!0}}return!1}function WE(e,t,i,r){return Or(e,i,r)!==Or(t,i,r)&&Or(e,t,i)!==Or(e,t,r)}function Xc(e,t,i){let r=i*i;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++){let a=t[n-1],o=t[n];if(HE(e,a,o)<r)return!0}return!1}function HE(e,t,i){let r=t.distSqr(i);if(r===0)return e.distSqr(t);let n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return n<0?e.distSqr(t):n>1?e.distSqr(i):e.distSqr(i.sub(t)._mult(n)._add(t))}function ry(e,t){let i=!1,r,n,a;for(let o=0;o<e.length;o++){r=e[o];for(let s=0,l=r.length-1;s<r.length;l=s++)n=r[s],a=r[l],n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}function _a(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){let a=e[r],o=e[n];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(i=!i)}return i}function KE(e,t,i,r,n){for(let o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;let a=[new $s.default(t,i),new $s.default(t,n),new $s.default(r,n),new $s.default(r,i)];if(e.length>2){for(let o of a)if(_a(e,o))return!0}for(let o=0;o<e.length-1;o++){let s=e[o],l=e[o+1];if(JE(s,l,a))return!0}return!1}function JE(e,t,i){let r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;let a=Or(e,t,i[0]);return a!==Or(e,t,i[1])||a!==Or(e,t,i[2])||a!==Or(e,t,i[3])}var qc=se(ce(),1);function yo(e,t,i){let r=t.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function vu(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function bu(e,t,i,r,n){if(!t[0]&&!t[1])return e;let a=qc.default.convert(t)._mult(n);i==="viewport"&&a._rotate(-r);let o=[];for(let s=0;s<e.length;s++){let l=e[s];o.push(l.sub(a))}return o}function QE(e,t){let i=[];for(let r=0;r<e.length;r++){let n=e[r],a=[];for(let o=0;o<n.length;o++){let s=n[o-1],l=n[o],u=n[o+1],h=o===0?new qc.default(0,0):l.sub(s)._unit()._perp(),c=o===n.length-1?new qc.default(0,0):u.sub(l)._unit()._perp(),p=h._add(c)._unit(),d=p.x*c.x+p.y*c.y;d!==0&&p._mult(1/d),a.push(p._mult(t)._add(l))}i.push(a)}return i}var ny,eA=()=>ny=ny||new vt({"circle-sort-key":new re(O.layout_circle["circle-sort-key"])}),ay,tA=()=>ay=ay||new vt({"circle-radius":new re(O.paint_circle["circle-radius"]),"circle-color":new re(O.paint_circle["circle-color"]),"circle-blur":new re(O.paint_circle["circle-blur"]),"circle-opacity":new re(O.paint_circle["circle-opacity"]),"circle-translate":new W(O.paint_circle["circle-translate"]),"circle-translate-anchor":new W(O.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new W(O.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new W(O.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new re(O.paint_circle["circle-stroke-width"]),"circle-stroke-color":new re(O.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new re(O.paint_circle["circle-stroke-opacity"])}),iA={get paint(){return tA()},get layout(){return eA()}},rA=se(ce(),1),nA=e=>e.type==="circle",aA=class extends Pi{constructor(e){super(e,iA)}createBucket(e){return new fd(e)}queryRadius(e){let t=e;return yo("circle-radius",this,t)+yo("circle-stroke-width",this,t)+vu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let l=bu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(t,i),h=this.paint.get("circle-stroke-width").evaluate(t,i),c=u+h,p=this.paint.get("circle-pitch-alignment")==="map",d=p?l:oA(l,n,o,s),f=p?c*a:c;for(let y of r)for(let g of y){let _=p?g:b0(g,n,o,s),b=f,v=n.projectTileCoordinates(g.x,g.y,o,s).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/n.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=n.cameraToCenterDistance/v),$E(d,_,b))return!0}return!1}};function b0(e,t,i,r){let n=t.projectTileCoordinates(e.x,e.y,i,r).point;return new rA.default((n.x*.5+.5)*t.width,(-n.y*.5+.5)*t.height)}function oA(e,t,i,r){return e.map(n=>b0(n,t,i,r))}var w0=class extends fd{};H("HeatmapBucket",w0,{omit:["layers"]});var oy,sA=()=>oy=oy||new vt({"heatmap-radius":new re(O.paint_heatmap["heatmap-radius"]),"heatmap-weight":new re(O.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new W(O.paint_heatmap["heatmap-intensity"]),"heatmap-color":new yu(O.paint_heatmap["heatmap-color"]),"heatmap-opacity":new W(O.paint_heatmap["heatmap-opacity"])}),lA={get paint(){return sA()}};function yd(e,{width:t,height:i},r,n){if(!n)n=new Uint8Array(t*i*r);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size. expected: ".concat(n.length," but got: ").concat(t*i*r));return e.width=t,e.height=i,e.data=n,e}function P0(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let n=yd({},{width:t,height:i},r);gd(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=n.data}function gd(e,t,i,r,n,a){if(n.width===0||n.height===0)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");let o=e.data,s=t.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((i.y+l)*e.width+i.x)*a,h=((r.y+l)*t.width+r.x)*a;for(let c=0;c<n.width*a;c++)s[h+c]=o[u+c]}return t}var _d=class T0{constructor(t,i){yd(this,t,1,i)}resize(t){P0(this,t,1)}clone(){return new T0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){gd(t,i,r,n,a,1)}},Ye=class S0{constructor(t,i){yd(this,t,4,i)}resize(t){P0(this,t,4)}replace(t,i){i?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new S0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){gd(t,i,r,n,a,4)}setPixel(t,i,r){let n=(t*this.width+i)*4;this.data[n+0]=Math.round(r.r*255/r.a),this.data[n+1]=Math.round(r.g*255/r.a),this.data[n+2]=Math.round(r.b*255/r.a),this.data[n+3]=Math.round(r.a*255)}};H("AlphaImage",_d);H("RGBAImage",Ye);function C0(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new Ye({width:i,height:r});if(!GS(i))throw new Error("width is not a power of 2 - ".concat(i));let a=(o,s,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);n.setPixel(o/4/i,s/4,u)};if(e.clips)for(let o=0,s=0;o<r;++o,s+=i*4)for(let l=0,u=0;l<i;l++,u+=4){let h=l/(i-1),{start:c,end:p}=e.clips[o],d=c*(1-h)+p*h;a(s,u,d)}else for(let o=0,s=0;o<i;o++,s+=4){let l=o/(i-1);a(0,s,l)}return n}var Ao="big-fb",uA=e=>e.type==="heatmap",hA=class extends Pi{createBucket(e){return new w0(e)}constructor(e){super(e,lA),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=C0({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ao)&&this.heatmapFbos.delete(Ao)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},sy,cA=()=>sy=sy||new vt({"hillshade-illumination-direction":new W(O.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new W(O.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new W(O.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new W(O.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new W(O.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new W(O.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new W(O.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new W(O.paint_hillshade["hillshade-method"])}),pA={get paint(){return cA()}},dA=e=>e.type==="hillshade",fA=class extends Pi{constructor(e){super(e,pA),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,n=Math.max(e.length,t.length,i.length,r.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1)));let a=t.map(Xe);return{directionRadians:e.map(Xe),altitudeRadians:a,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},ly,mA=()=>ly=ly||new vt({"color-relief-opacity":new W(O["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new yu(O["paint_color-relief"]["color-relief-color"])}),yA={get paint(){return mA()}},st=class{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,t,i){let{width:r,height:n}=e,a=(!this.size||this.size[0]!==r||this.size[1]!==n)&&!i,{context:o}=this,{gl:s}=o;if(this.useMipmap=!!(t&&t.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[r,n],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||hr(e)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,e):s.texImage2D(s.TEXTURE_2D,0,this.format,r,n,0,this.format,s.UNSIGNED_BYTE,e.data);else{let{x:l,y:u}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||hr(e)?s.texSubImage2D(s.TEXTURE_2D,0,l,u,s.RGBA,s.UNSIGNED_BYTE,e):s.texSubImage2D(s.TEXTURE_2D,0,l,u,r,n,s.RGBA,s.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,i){let{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i===n.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(i=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},gA=class{constructor(e,t,i,r=1,n=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){ct('"'.concat(i,'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".'));return}this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let l=0;l<s;l++)this.data[this._idx(-1,l)]=this.data[this._idx(0,l)],this.data[this._idx(s,l)]=this.data[this._idx(s-1,l)],this.data[this._idx(l,-1)]=this.data[this._idx(l,0)],this.data[this._idx(l,s)]=this.data[this._idx(l,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let l=0;l<s;l++)for(let u=0;u<s;u++){let h=this.get(l,u);h>this.max&&(this.max=h),h<this.min&&(this.min=h)}}get(e,t){let i=new Uint8Array(this.data.buffer),r=this._idx(e,t)*4;return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return M0(e,this.getUnpackVector())}getPixels(){return new Ye({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,a=i*this.dim,o=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1;break}switch(i){case-1:a=o-1;break;case 1:o=a+1;break}let s=-t*this.dim,l=-i*this.dim;for(let u=a;u<o;u++)for(let h=r;h<n;h++)this.data[this._idx(h,u)]=e.data[this._idx(h+s,u+l)]}};function M0(e,t){let i=t[0],r=t[1],n=t[2],a=t[3],o=Math.min(i,r,n),s=Math.round((e+a)/o);return{r:Math.floor(s*o/i)%256,g:Math.floor(s*o/r)%256,b:Math.floor(s*o/n)%256}}H("DEMData",gA);var _A=e=>e.type==="color-relief",xA=class extends Pi{constructor(e){super(e,yA)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof Co&&i._styleExpression.expression instanceof xi){this.colorRampExpression=i;let a=i._styleExpression.expression;t.elevationStops=a.labels,t.colorStops=[];for(let o of t.elevationStops)t.colorStops.push(a.evaluate({globals:{elevation:o}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[te.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let a=0;a<t.elevationStops.length-.5;a+=n)r.elevationStops.push(t.elevationStops[Math.round(a)]),r.colorStops.push(t.colorStops[Math.round(a)]);return ct("Too many colors in specification of ".concat(this.id," color-relief layer, may not render properly.")),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),n=new Ye({width:r.colorStops.length,height:1}),a=new Ye({width:r.colorStops.length,height:1});for(let o=0;o<r.elevationStops.length;o++){let s=M0(r.elevationStops[o],i);a.setPixel(0,o,new te(s.r/255,s.g/255,s.b/255,1)),n.setPixel(0,o,r.colorStops[o])}return this.colorRampTextures={elevationTexture:new st(e,a,e.gl.RGBA),colorTexture:new st(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}},vA=it([{name:"a_pos",components:2,type:"Int16"}],4),{members:bA,size:bj,alignment:wj}=vA;function xd(e,t,i){let r=i.patternDependencies,n=!1;for(let a of t){let o=a.paint.get("".concat(e,"-pattern"));o.isConstant()||(n=!0);let s=o.constantOr(null);s&&(n=!0,r[s.to]=!0,r[s.from]=!0)}return n}function vd(e,t,i,r,n){let a=n.patternDependencies;for(let o of t){let s=o.paint.get("".concat(e,"-pattern")).value;if(s.kind!=="constant"){let l=s.evaluate({zoom:r-1},i,{},n.availableImages),u=s.evaluate({zoom:r},i,{},n.availableImages),h=s.evaluate({zoom:r+1},i,{},n.availableImages);l=l&&l.name?l.name:l,u=u&&u.name?u.name:u,h=h&&h.name?h.name:h,a[l]=!0,a[u]=!0,a[h]=!0,i.patterns[o.id]={min:l,mid:u,max:h}}}return i}var Ys=se(ce(),1);function wA(e,t,i=2){let r=t&&t.length,n=r?t[0]*i:e.length,a=I0(e,0,n,i,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u;if(r&&(a=MA(e,t,a,i)),e.length>80*i){s=e[0],l=e[1];let h=s,c=l;for(let p=i;p<n;p+=i){let d=e[p],f=e[p+1];d<s&&(s=d),f<l&&(l=f),d>h&&(h=d),f>c&&(c=f)}u=Math.max(h-s,c-l),u=u!==0?32767/u:0}return ko(a,o,i,s,l,u,0),o}function I0(e,t,i,r,n){let a;if(n===FA(e,t,i,r)>0)for(let o=t;o<i;o+=r)a=uy(o/r|0,e[o],e[o+1],a);else for(let o=i-r;o>=t;o-=r)a=uy(o/r|0,e[o],e[o+1],a);return a&&xa(a,a.next)&&(Lo(a),a=a.next),a}function xn(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(xa(i,i.next)||et(i.prev,i,i.next)===0)){if(Lo(i),i=t=i.prev,i===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function ko(e,t,i,r,n,a,o){if(!e)return;!o&&a&&DA(e,r,n,a);let s=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?TA(e,r,n,a):PA(e)){t.push(l.i,e.i,u.i),Lo(e),e=u.next,s=u.next;continue}if(e=u,e===s){o?o===1?(e=SA(xn(e),t),ko(e,t,i,r,n,a,2)):o===2&&CA(e,t,i,r,n,a):ko(xn(e),t,i,r,n,a,1);break}}}function PA(e){let t=e.prev,i=e,r=e.next;if(et(t,i,r)>=0)return!1;let n=t.x,a=i.x,o=r.x,s=t.y,l=i.y,u=r.y,h=Math.min(n,a,o),c=Math.min(s,l,u),p=Math.max(n,a,o),d=Math.max(s,l,u),f=r.next;for(;f!==t;){if(f.x>=h&&f.x<=p&&f.y>=c&&f.y<=d&&lo(n,s,a,l,o,u,f.x,f.y)&&et(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function TA(e,t,i,r){let n=e.prev,a=e,o=e.next;if(et(n,a,o)>=0)return!1;let s=n.x,l=a.x,u=o.x,h=n.y,c=a.y,p=o.y,d=Math.min(s,l,u),f=Math.min(h,c,p),y=Math.max(s,l,u),g=Math.max(h,c,p),_=$c(d,f,t,i,r),b=$c(y,g,t,i,r),v=e.prevZ,w=e.nextZ;for(;v&&v.z>=_&&w&&w.z<=b;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=g&&v!==n&&v!==o&&lo(s,h,l,c,u,p,v.x,v.y)&&et(v.prev,v,v.next)>=0||(v=v.prevZ,w.x>=d&&w.x<=y&&w.y>=f&&w.y<=g&&w!==n&&w!==o&&lo(s,h,l,c,u,p,w.x,w.y)&&et(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=g&&v!==n&&v!==o&&lo(s,h,l,c,u,p,v.x,v.y)&&et(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=b;){if(w.x>=d&&w.x<=y&&w.y>=f&&w.y<=g&&w!==n&&w!==o&&lo(s,h,l,c,u,p,w.x,w.y)&&et(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function SA(e,t){let i=e;do{let r=i.prev,n=i.next.next;!xa(r,n)&&A0(r,i,i.next,n)&&Do(r,n)&&Do(n,r)&&(t.push(r.i,i.i,n.i),Lo(i),Lo(i.next),i=e=n),i=i.next}while(i!==e);return xn(i)}function CA(e,t,i,r,n,a){let o=e;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&zA(o,s)){let l=k0(o,s);o=xn(o,o.next),l=xn(l,l.next),ko(o,t,i,r,n,a,0),ko(l,t,i,r,n,a,0);return}s=s.next}o=o.next}while(o!==e)}function MA(e,t,i,r){let n=[];for(let a=0,o=t.length;a<o;a++){let s=t[a]*r,l=a<o-1?t[a+1]*r:e.length,u=I0(e,s,l,r,!1);u===u.next&&(u.steiner=!0),n.push(RA(u))}n.sort(IA);for(let a=0;a<n.length;a++)i=EA(n[a],i);return i}function IA(e,t){let i=e.x-t.x;if(i===0&&(i=e.y-t.y,i===0)){let r=(e.next.y-e.y)/(e.next.x-e.x),n=(t.next.y-t.y)/(t.next.x-t.x);i=r-n}return i}function EA(e,t){let i=AA(e,t);if(!i)return t;let r=k0(i,e);return xn(r,r.next),xn(i,i.next)}function AA(e,t){let i=t,r=e.x,n=e.y,a=-1/0,o;if(xa(e,i))return i;do{if(xa(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){let c=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(c<=r&&c>a&&(a=c,o=i.x<i.next.x?i:i.next,c===r))return o}i=i.next}while(i!==t);if(!o)return null;let s=o,l=o.x,u=o.y,h=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&E0(n<u?r:a,n,l,u,n<u?a:r,n,i.x,i.y)){let c=Math.abs(n-i.y)/(r-i.x);Do(i,e)&&(c<h||c===h&&(i.x>o.x||i.x===o.x&&kA(o,i)))&&(o=i,h=c)}i=i.next}while(i!==s);return o}function kA(e,t){return et(e.prev,e,t.prev)<0&&et(t.next,e,e.next)<0}function DA(e,t,i,r){let n=e;do n.z===0&&(n.z=$c(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,LA(n)}function LA(e){let t,i=1;do{let r=e,n;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let u=0;u<i&&(s++,o=o.nextZ,!!o);u++);let l=i;for(;s>0||l>0&&o;)s!==0&&(l===0||!o||r.z<=o.z)?(n=r,r=r.nextZ,s--):(n=o,o=o.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=o}a.nextZ=null,i*=2}while(t>1);return e}function $c(e,t,i,r,n){return e=(e-i)*n|0,t=(t-r)*n|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function RA(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function E0(e,t,i,r,n,a,o,s){return(n-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(i-o)*(t-s)&&(i-o)*(a-s)>=(n-o)*(r-s)}function lo(e,t,i,r,n,a,o,s){return!(e===o&&t===s)&&E0(e,t,i,r,n,a,o,s)}function zA(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!BA(e,t)&&(Do(e,t)&&Do(t,e)&&OA(e,t)&&(et(e.prev,e,t.prev)||et(e,t.prev,t))||xa(e,t)&&et(e.prev,e,e.next)>0&&et(t.prev,t,t.next)>0)}function et(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function xa(e,t){return e.x===t.x&&e.y===t.y}function A0(e,t,i,r){let n=Ws(et(e,t,i)),a=Ws(et(e,t,r)),o=Ws(et(i,r,e)),s=Ws(et(i,r,t));return!!(n!==a&&o!==s||n===0&&Zs(e,i,t)||a===0&&Zs(e,r,t)||o===0&&Zs(i,e,r)||s===0&&Zs(i,t,r))}function Zs(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Ws(e){return e>0?1:e<0?-1:0}function BA(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&A0(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}function Do(e,t){return et(e.prev,e,e.next)<0?et(e,t,e.next)>=0&&et(e,e.prev,t)>=0:et(e,t,e.prev)<0||et(e,e.next,t)<0}function OA(e,t){let i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}function k0(e,t){let i=Yc(e.i,e.x,e.y),r=Yc(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function uy(e,t,i,r){let n=Yc(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Lo(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Yc(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function FA(e,t,i,r){let n=0;for(let a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}var ur=class{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}},Zc=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}};Zc.noSubdivision=new Zc({fill:new ur(0,0),line:new ur(0,0),tile:new ur(0,0),stencil:new ur(0,0),circle:1});var bd=Zc;H("SubdivisionGranularityExpression",ur);H("SubdivisionGranularitySetting",bd);var zr=-32768,hn=32767,NA=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=8192/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let i=Math.round(e)|0,r=Math.round(t)|0,n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(i,r),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return jA(this._vertexBuffer,e);let t=[],i=e.length;for(let r=0;r<i;r+=3){let n=[e[r+0],e[r+1],e[r+2]],a=[this._vertexBuffer[e[r+0]*2+0],this._vertexBuffer[e[r+0]*2+1],this._vertexBuffer[e[r+1]*2+0],this._vertexBuffer[e[r+1]*2+1],this._vertexBuffer[e[r+2]*2+0],this._vertexBuffer[e[r+2]*2+1]],o=1/0,s=1/0,l=-1/0,u=-1/0;for(let f=0;f<3;f++){let y=a[f*2],g=a[f*2+1];o=Math.min(o,y),l=Math.max(l,y),s=Math.min(s,g),u=Math.max(u,g)}if(o===l||s===u)continue;let h=Math.floor(o/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(s/this._granularityCellSize),d=Math.ceil(u/this._granularityCellSize);if(h===c&&p===d){t.push(...n);continue}for(let f=p;f<d;f++){let y=this._scanlineGenerateVertexRingForCellRow(f,a,n);UA(this._vertexBuffer,y,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){let r=e*this._granularityCellSize,n=r+this._granularityCellSize,a=[];for(let o=0;o<3;o++){let s=t[o*2],l=t[o*2+1],u=t[(o+1)*2%6],h=t[((o+1)*2+1)%6],c=t[(o+2)*2%6],p=t[((o+2)*2+1)%6],d=u-s,f=h-l,y=d===0,g=f===0,_=(r-l)/f,b=(n-l)/f,v=Math.min(_,b),w=Math.max(_,b);if(!g&&(v>=1||w<=0)||g&&(l<r||l>n)){h>=r&&h<=n&&a.push(i[(o+1)%3]);continue}if(!g&&v>0){let M=s+d*v,E=l+f*v;a.push(this._vertexToIndex(M,E))}let T=s+d*Math.max(v,0),S=s+d*Math.min(w,1);if(y||this._generateIntraEdgeVertices(a,s,l,u,h,T,S),!g&&w<1){let M=s+d*w,E=l+f*w;a.push(this._vertexToIndex(M,E))}(g||h>=r&&h<=n)&&a.push(i[(o+1)%3]),!g&&(h<=r||h>=n)&&this._generateInterEdgeVertices(a,s,l,u,h,c,p,S,r,n)}return a}_generateIntraEdgeVertices(e,t,i,r,n,a,o){let s=r-t,l=n-i,u=l===0,h=u?Math.min(t,r):Math.min(a,o),c=u?Math.max(t,r):Math.max(a,o),p=Math.floor(h/this._granularityCellSize)+1,d=Math.ceil(c/this._granularityCellSize)-1;if(u?t<r:a<o)for(let f=p;f<=d;f++){let y=f*this._granularityCellSize,g=i+l*(y-t)/s;e.push(this._vertexToIndex(y,g))}else for(let f=d;f>=p;f--){let y=f*this._granularityCellSize,g=i+l*(y-t)/s;e.push(this._vertexToIndex(y,g))}}_generateInterEdgeVertices(e,t,i,r,n,a,o,s,l,u){let h=n-i,c=a-r,p=o-n,d=(l-n)/p,f=(u-n)/p,y=Math.min(d,f),g=Math.max(d,f),_=r+c*y,b=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,w=s<_,T=p===0;if(T&&(o===l||o===u))return;if(T||y>=1||g<=0){let M=t-a,E=i-o,L=(l-o)/E,z=(u-o)/E,R=Math.min(L,z),k=a+M*R;b=Math.floor(Math.min(k,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(k,s)/this._granularityCellSize)-1,w=s<k}let S=h>0?u:l;if(w)for(let M=b;M<=v;M++){let E=M*this._granularityCellSize;e.push(this._vertexToIndex(E,S))}else for(let M=v;M>=b;M--){let E=M*this._granularityCellSize;e.push(this._vertexToIndex(E,S))}}_generateOutline(e){let t=[];for(let i of e){let r=wd(i,this._granularity,!0),n=this._pointArrayToIndices(r),a=[];for(let o=1;o<n.length;o++)a.push(n[o-1]),a.push(n[o]);t.push(a)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let i=e[t+1];i===zr&&(e[t+1]=zr+1),i===hn&&(e[t+1]=hn-1)}}_generatePoleQuad(e,t,i,r,n,a){r>n!=(a===zr)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,a)),e.push(i),e.push(this._vertexToIndex(n,a)),e.push(this._vertexToIndex(r,a))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,a)),e.push(this._vertexToIndex(n,a)),e.push(i),e.push(this._vertexToIndex(r,a)))}_fillPoles(e,t,i){let r=this._vertexBuffer,n=0,a=8192,o=e.length;for(let s=2;s<o;s+=3){let l=e[s-2],u=e[s-1],h=e[s],c=r[l*2],p=r[l*2+1],d=r[u*2],f=r[u*2+1],y=r[h*2],g=r[h*2+1];t&&(p===n&&f===n&&this._generatePoleQuad(e,l,u,c,d,zr),f===n&&g===n&&this._generatePoleQuad(e,u,h,d,y,zr),g===n&&p===n&&this._generatePoleQuad(e,h,l,y,c,zr)),i&&(p===a&&f===a&&this._generatePoleQuad(e,l,u,c,d,hn),f===a&&g===a&&this._generatePoleQuad(e,u,h,d,y,hn),g===a&&p===a&&this._generatePoleQuad(e,h,l,y,c,hn))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:r}=VA(e);this._initializeVertices(i);let n;try{let o=wA(i,r),s=this._convertIndices(i,o);n=this._subdivideTrianglesScanline(s)}catch(o){console.error(o)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_convertIndices(e,t){let i=[];for(let r=0;r<t.length;r++){let n=e[t[r]*2],a=e[t[r]*2+1];i.push(this._vertexToIndex(n,a))}return i}_pointArrayToIndices(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t.push(this._vertexToIndex(r.x,r.y))}return t}};function D0(e,t,i,r=!0){return new NA(i,t).subdividePolygonInternal(e,r)}function wd(e,t,i=!1){if(!e||e.length<1)return[];if(e.length<2)return[];let r=e[0],n=e[e.length-1],a=i&&(r.x!==n.x||r.y!==n.y);if(t<2)return a?[...e,e[0]]:[...e];let o=Math.floor(8192/t),s=[];s.push(new Ys.default(e[0].x,e[0].y));let l=e.length,u=a?l:l-1;for(let h=0;h<u;h++){let c=e[h],p=h<l-1?e[h+1]:e[0],d=c.x,f=c.y,y=p.x,g=p.y,_=d!==y,b=f!==g;if(!_&&!b)continue;let v=y-d,w=g-f,T=Math.abs(v),S=Math.abs(w),M=d,E=f;for(;;){let z=v>0?(Math.floor(M/o)+1)*o:(Math.ceil(M/o)-1)*o,R=w>0?(Math.floor(E/o)+1)*o:(Math.ceil(E/o)-1)*o,k=Math.abs(M-z),D=Math.abs(E-R),x=Math.abs(M-y),C=Math.abs(E-g),I=_?k/T:Number.POSITIVE_INFINITY,F=b?D/S:Number.POSITIVE_INFINITY;if((x<=k||!_)&&(C<=D||!b))break;if(I<F&&_||!b){M=z,E=E+w*I;let N=new Ys.default(M,Math.round(E));(s[s.length-1].x!==N.x||s[s.length-1].y!==N.y)&&s.push(N)}else{M=M+v*F,E=R;let N=new Ys.default(Math.round(M),E);(s[s.length-1].x!==N.x||s[s.length-1].y!==N.y)&&s.push(N)}}let L=new Ys.default(y,g);(s[s.length-1].x!==L.x||s[s.length-1].y!==L.y)&&s.push(L)}return s}function VA(e){let t=[],i=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(i.length/2);for(let n=0;n<r.length;n++)i.push(r[n].x),i.push(r[n].y)}return{flattened:i,holeIndices:t}}function jA(e,t){let i=[];for(let r=0;r<t.length;r+=3){let n=t[r],a=t[r+1],o=t[r+2],s=e[n*2],l=e[n*2+1],u=e[a*2],h=e[a*2+1],c=e[o*2],p=e[o*2+1],d=u-s,f=h-l,y=c-s,g=p-l;d*g-f*y>0?(i.push(n),i.push(o),i.push(a)):(i.push(n),i.push(a),i.push(o))}return i}function UA(e,t,i){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let r=0,n=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<n&&(n=u,r=l)}let a=t.length,o=r,s=(o+1)%a;for(;;){let l=o-1>=0?o-1:a-1,u=(s+1)%a,h=e[t[l]*2],c=e[t[l]*2+1],p=e[t[u]*2],d=e[t[u]*2+1],f=e[t[o]*2],y=e[t[o]*2+1],g=e[t[s]*2],_=e[t[s]*2+1],b=!1;if(h<p)b=!0;else if(h>p)b=!1;else{let v=g-f,w=_-y,T=-v,S=y<_?1:-1,M=((h-f)*w+(c-y)*T)*S,E=((p-f)*w+(d-y)*T)*S;M>E&&(b=!0)}if(b){let v=t[l],w=t[o],T=t[s];v!==w&&v!==T&&w!==T&&i.push(T,w,v),o--,o<0&&(o=a-1)}else{let v=t[u],w=t[o],T=t[s];v!==w&&v!==T&&w!==T&&i.push(T,w,v),s++,s>=a&&(s=0)}if(l===u)break}}function L0(e,t,i,r,n,a,o,s,l){let u=n.length/2,h=o&&s&&l;if(u<qe.MAX_VERTEX_ARRAY_LENGTH){let c=t.prepareSegment(u,i,r),p=c.vertexLength;for(let y=0;y<a.length;y+=3)r.emplaceBack(p+a[y],p+a[y+1],p+a[y+2]);c.vertexLength+=u,c.primitiveLength+=a.length/3;let d,f;h&&(f=o.prepareSegment(u,i,s),d=f.vertexLength,f.vertexLength+=u);for(let y=0;y<n.length;y+=2)e(n[y],n[y+1]);if(h)for(let y=0;y<l.length;y++){let g=l[y];for(let _=1;_<g.length;_+=2)s.emplaceBack(d+g[_-1],d+g[_]);f.primitiveLength+=g.length/2}}else GA(t,i,r,n,a,e),h&&XA(o,i,s,n,l,e),t.forceNewSegmentOnNextPrepare(),o==null||o.forceNewSegmentOnNextPrepare()}function go(e,t,i,r,n,a,o){if(a){let s=r.count;return i(t[n*2],t[n*2+1]),e[n]=r.count,r.count++,o.vertexLength++,s}else return e[n]}function GA(e,t,i,r,n,a){let o=[];for(let c=0;c<r.length/2;c++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c=2;c<n.length;c+=3){let p=n[c-2],d=n[c-1],f=n[c],y=o[p]<l,g=o[d]<l,_=o[f]<l,b=(y?1:0)+(g?1:0)+(_?1:0);u.vertexLength+b>qe.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,y=!0,g=!0,_=!0,h=0);let v=go(o,r,a,s,p,y,u),w=go(o,r,a,s,d,g,u),T=go(o,r,a,s,f,_,u);i.emplaceBack(h+v-l,h+w-l,h+T-l),u.primitiveLength++}}function XA(e,t,i,r,n,a){let o=[];for(let c=0;c<r.length/2;c++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c=0;c<n.length;c++){let p=n[c];for(let d=1;d<n[c].length;d+=2){let f=p[d-1],y=p[d],g=o[f]<l,_=o[y]<l,b=(g?1:0)+(_?1:0);u.vertexLength+b>qe.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,g=!0,_=!0,h=0);let v=go(o,r,a,s,f,g,u),w=go(o,r,a,s,y,_,u);i.emplaceBack(h+v-l,h+w-l),u.primitiveLength++}}}var qA=500,R0=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ME,this.indexArray=new Ti,this.indexArray2=new Vc,this.programConfigurations=new _n(e.layers,e.zoom),this.segments=new qe,this.segments2=new qe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=xd("fill",this.layers,t);let r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),a=[];for(let{feature:o,id:s,index:l,sourceLayerIndex:u}of e){let h=this.layers[0]._featureFilter.needGeometry,c=Cn(o,h);if(!this.layers[0]._featureFilter.filter(new lt(this.zoom,{globalState:this.globalState}),c,i))continue;let p=n?r.evaluate(c,{},i,t.availableImages):void 0,d={id:s,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:h?c.geometry:Sn(o),patterns:{},sortKey:p};a.push(d)}n&&a.sort((o,s)=>o.sortKey-s.sortKey);for(let o of a){let{geometry:s,index:l,sourceLayerIndex:u}=o;if(this.hasPattern){let c=vd("fill",this.layers,o,this.zoom,t);this.patternFeatures.push(c)}else this.addFeature(o,s,l,i,{},t.subdivisionGranularity);let h=e[l].feature;t.featureIndex.insert(h,s,l,u,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bA),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,r,n,a){for(let o of zp(t,qA)){let s=D0(o,r,a.fill.getGranularityForZoomLevel(r.z)),l=this.layoutVertexArray;L0((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,s.verticesFlattened,s.indicesTriangles,this.segments2,this.indexArray2,s.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}};H("FillBucket",R0,{omit:["layers","patternFeatures"]});var hy,$A=()=>hy=hy||new vt({"fill-sort-key":new re(O.layout_fill["fill-sort-key"])}),cy,YA=()=>cy=cy||new vt({"fill-antialias":new W(O.paint_fill["fill-antialias"]),"fill-opacity":new re(O.paint_fill["fill-opacity"]),"fill-color":new re(O.paint_fill["fill-color"]),"fill-outline-color":new re(O.paint_fill["fill-outline-color"]),"fill-translate":new W(O.paint_fill["fill-translate"]),"fill-translate-anchor":new W(O.paint_fill["fill-translate-anchor"]),"fill-pattern":new mu(O.paint_fill["fill-pattern"])}),ZA={get paint(){return YA()},get layout(){return $A()}},WA=e=>e.type==="fill",HA=class extends Pi{constructor(e){super(e,ZA)}recalculate(e,t){super.recalculate(e,t);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new R0(e)}queryRadius(){return vu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){let n=bu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r);return v0(n,t)}isTileClipped(){return!0}},KA=it([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),JA=it([{name:"a_centroid",components:2,type:"Int16"}],4),{members:QA,size:Tj,alignment:Sj}=KA,ek=se($l(),1),tk=ek.default.VectorTileFeature.types,ik=500,Zh=Math.pow(2,13);function Xa(e,t,i,r,n,a,o,s){e.emplaceBack(t,i,Math.floor(r*Zh)*2+o,n*Zh*2,a*Zh*2,Math.round(s))}var z0=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new IE,this.centroidVertexArray=new lr,this.indexArray=new Ti,this.programConfigurations=new _n(e.layers,e.zoom),this.segments=new qe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.features=[],this.hasPattern=xd("fill-extrusion",this.layers,t);for(let{feature:r,id:n,index:a,sourceLayerIndex:o}of e){let s=this.layers[0]._featureFilter.needGeometry,l=Cn(r,s);if(!this.layers[0]._featureFilter.filter(new lt(this.zoom,{globalState:this.globalState}),l,i))continue;let u={id:n,sourceLayerIndex:o,index:a,geometry:s?l.geometry:Sn(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(vd("fill-extrusion",this.layers,u,this.zoom,t)):this.addFeature(u,u.geometry,a,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,u.geometry,a,o,this.index,!0)}}addFeatures(e,t,i){for(let r of this.features){let{geometry:n}=r;this.addFeature(r,n,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,QA),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,JA.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,r,n,a){for(let o of zp(t,ik)){let s={x:0,y:0,sampleCount:0},l=this.layoutVertexArray.length;this.processPolygon(s,r,e,o,a);let u=this.layoutVertexArray.length-l,h=Math.floor(s.x/s.sampleCount),c=Math.floor(s.y/s.sampleCount);for(let p=0;p<u;p++)this.centroidVertexArray.emplaceBack(h,c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}processPolygon(e,t,i,r,n){if(r.length<1||py(r[0]))return;for(let h of r)h.length!==0&&rk(e,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(t.z),s=tk[i.type]==="Polygon";for(let h of r){if(h.length===0||py(h))continue;let c=wd(h,o,s);this._generateSideFaces(c,a)}if(!s)return;let l=D0(r,t,o,!1),u=this.layoutVertexArray;L0((h,c)=>{Xa(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let r=1;r<e.length;r++){let n=e[r],a=e[r-1];if(nk(n,a))continue;t.segment.vertexLength+4>qe.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=n.sub(a)._perp()._unit(),s=a.dist(n);i+s>32768&&(i=0),Xa(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,i),Xa(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,i),i+=s,Xa(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,i),Xa(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,1,i);let l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function rk(e,t){for(let i=0;i<t.length;i++){let r=t[i];i===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}H("FillExtrusionBucket",z0,{omit:["layers","features"]});function nk(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function py(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var dy,ak=()=>dy=dy||new vt({"fill-extrusion-opacity":new W(O["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new re(O["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new W(O["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new W(O["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new mu(O["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new re(O["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new re(O["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new W(O["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),ok={get paint(){return ak()}},Wc=se(ce(),1),sk=e=>e.type==="fill-extrusion",lk=class extends Pi{constructor(e){super(e,ok)}createBucket(e){return new z0(e)}queryRadius(){return vu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,pixelPosMatrix:o}){let s=bu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=ck(s,o,0),c=hk(r,u,l,o),p=c[0],d=c[1];return uk(p,d,h)}};function qa(e,t){return e.x*t.x+e.y*t.y}function fy(e,t){if(e.length===1){let i=0,r=t[i++],n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){let a=t[i],o=e[0],s=n.sub(r),l=a.sub(r),u=o.sub(r),h=qa(s,s),c=qa(s,l),p=qa(l,l),d=qa(u,s),f=qa(u,l),y=h*p-c*c,g=(p*d-c*f)/y,_=(h*f-c*d)/y,b=1-g-_,v=r.z*b+n.z*g+a.z*_;if(isFinite(v))return v}return 1/0}else{let i=1/0;for(let r of t)i=Math.min(i,r.z);return i}}function uk(e,t,i){let r=1/0;v0(i,t)&&(r=fy(i,t[0]));for(let n=0;n<t.length;n++){let a=t[n],o=e[n];for(let s=0;s<a.length-1;s++){let l=a[s],u=a[s+1],h=o[s],c=o[s+1],p=[l,u,c,h,l];x0(i,p)&&(r=Math.min(r,fy(i,p)))}}return r===1/0?!1:r}function hk(e,t,i,r){let n=[],a=[],o=r[8]*t,s=r[9]*t,l=r[10]*t,u=r[11]*t,h=r[8]*i,c=r[9]*i,p=r[10]*i,d=r[11]*i;for(let f of e){let y=[],g=[];for(let _ of f){let b=_.x,v=_.y,w=r[0]*b+r[4]*v+r[12],T=r[1]*b+r[5]*v+r[13],S=r[2]*b+r[6]*v+r[14],M=r[3]*b+r[7]*v+r[15],E=w+o,L=T+s,z=S+l,R=M+u,k=w+h,D=T+c,x=S+p,C=M+d,I=new Wc.default(E/R,L/R);I.z=z/R,y.push(I);let F=new Wc.default(k/C,D/C);F.z=x/C,g.push(F)}n.push(y),a.push(g)}return[n,a]}function ck(e,t,i){let r=[];for(let n of e){let a=[n.x,n.y,i,1];at.transformMat4(a,a,t),r.push(new Wc.default(a[0]/a[3],a[1]/a[3]))}return r}var pk=it([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:dk,size:Cj,alignment:Mj}=pk,fk=it([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:mk,size:Ij,alignment:Ej}=fk,yk=se($l(),1),gk=yk.default.VectorTileFeature.types,my=63,_k=Math.cos(75/2*(Math.PI/180)),xk=15,vk=20,bk=15,B0=1/2,yy=Math.pow(2,bk-1)/B0,O0=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new EE,this.layoutVertexArray2=new AE,this.indexArray=new Ti,this.programConfigurations=new _n(e.layers,e.zoom),this.segments=new qe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=xd("line",this.layers,t);let r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),a=[];for(let{feature:o,id:s,index:l,sourceLayerIndex:u}of e){let h=this.layers[0]._featureFilter.needGeometry,c=Cn(o,h);if(!this.layers[0]._featureFilter.filter(new lt(this.zoom,{globalState:this.globalState}),c,i))continue;let p=n?r.evaluate(c,{},i):void 0,d={id:s,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:h?c.geometry:Sn(o),patterns:{},sortKey:p};a.push(d)}n&&a.sort((o,s)=>o.sortKey-s.sortKey);for(let o of a){let{geometry:s,index:l,sourceLayerIndex:u}=o;if(this.hasPattern){let c=vd("line",this.layers,o,this.zoom,t);this.patternFeatures.push(c)}else this.addFeature(o,s,l,i,{},t.subdivisionGranularity);let h=e[l].feature;t.featureIndex.insert(h,s,l,u,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,mk)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dk),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let t=+e.properties.mapbox_clip_start,i=+e.properties.mapbox_clip_end;return{start:t,end:i}}}addFeature(e,t,i,r,n,a){let o=this.layers[0].layout,s=o.get("line-join").evaluate(e,{}),l=o.get("line-cap"),u=o.get("line-miter-limit"),h=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let c of t)this.addLine(c,e,s,l,u,h,r,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}addLine(e,t,i,r,n,a,o,s){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=o?s.line.getGranularityForZoomLevel(o.z):1;if(e=wd(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=gk[t.type]==="Polygon",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let c=0;for(;c<h-1&&e[c].equals(e[c+1]);)c++;if(h<(u?3:2))return;i==="bevel"&&(n=1.05);let p=this.overscaling<=16?xk*8192/(512*this.overscaling):0,d=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),f,y,g,_,b;this.e1=this.e2=-1,u&&(f=e[h-2],b=e[c].sub(f)._unit()._perp());for(let v=c;v<h;v++){if(g=v===h-1?u?e[c+1]:void 0:e[v+1],g&&e[v].equals(g))continue;b&&(_=b),f&&(y=f),f=e[v],b=g?g.sub(f)._unit()._perp():_,_=_||b;let w=_.add(b);(w.x!==0||w.y!==0)&&w._unit();let T=_.x*b.x+_.y*b.y,S=w.x*b.x+w.y*b.y,M=S!==0?1/S:1/0,E=2*Math.sqrt(2-2*S),L=S<_k&&y&&g,z=_.x*b.y-_.y*b.x>0;if(L&&v>c){let D=f.dist(y);if(D>2*p){let x=f.sub(f.sub(y)._mult(p/D)._round());this.updateDistance(y,x),this.addCurrentVertex(x,_,0,0,d),y=x}}let R=y&&g,k=R?i:u?"butt":r;if(R&&k==="round"&&(M<a?k="miter":M<=2&&(k="fakeround")),k==="miter"&&M>n&&(k="bevel"),k==="bevel"&&(M>2&&(k="flipbevel"),M<n&&(k="miter")),y&&this.updateDistance(y,f),k==="miter")w._mult(M),this.addCurrentVertex(f,w,0,0,d);else if(k==="flipbevel"){if(M>100)w=b.mult(-1);else{let D=M*_.add(b).mag()/_.sub(b).mag();w._perp()._mult(D*(z?-1:1))}this.addCurrentVertex(f,w,0,0,d),this.addCurrentVertex(f,w.mult(-1),0,0,d)}else if(k==="bevel"||k==="fakeround"){let D=-Math.sqrt(M*M-1),x=z?D:0,C=z?0:D;if(y&&this.addCurrentVertex(f,_,x,C,d),k==="fakeround"){let I=Math.round(E*180/Math.PI/vk);for(let F=1;F<I;F++){let N=F/I;if(N!==.5){let J=N-.5,ee=1.0904+T*(-3.2452+T*(3.55645-T*1.43519)),ke=.848013+T*(-1.06021+T*.215638);N=N+N*J*(N-1)*(ee*J*J+ke)}let G=b.sub(_)._mult(N)._add(_)._unit()._mult(z?-1:1);this.addHalfVertex(f,G.x,G.y,!1,z,0,d)}}g&&this.addCurrentVertex(f,b,-x,-C,d)}else if(k==="butt")this.addCurrentVertex(f,w,0,0,d);else if(k==="square"){let D=y?1:-1;this.addCurrentVertex(f,w,D,D,d)}else k==="round"&&(y&&(this.addCurrentVertex(f,_,0,0,d),this.addCurrentVertex(f,_,1,1,d,!0)),g&&(this.addCurrentVertex(f,b,-1,-1,d,!0),this.addCurrentVertex(f,b,0,0,d)));if(L&&v<h-1){let D=f.dist(g);if(D>2*p){let x=f.add(g.sub(f)._mult(p/D)._round());this.updateDistance(f,x),this.addCurrentVertex(x,b,0,0,d),f=x}}}}addCurrentVertex(e,t,i,r,n,a=!1){let o=t.x+t.y*i,s=t.y-t.x*i,l=-t.x+t.y*r,u=-t.y-t.x*r;this.addHalfVertex(e,o,s,a,!1,i,n),this.addHalfVertex(e,l,u,a,!0,-r,n),this.distance>yy/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,a))}addHalfVertex({x:e,y:t},i,r,n,a,o,s){let l=(this.lineClips?this.scaledDistance*(yy-1):this.scaledDistance)*B0;if(this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(a?1:0),Math.round(my*i)+128,Math.round(my*r)+128,(o===0?0:o<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,c=this.lineClips.end-this.lineClips.start,p=h/c;this.layoutVertexArray2.emplaceBack(p,this.lineClipsArray.length)}let u=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),s.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}};H("LineBucket",O0,{omit:["layers","patternFeatures"]});var gy,wk=()=>gy=gy||new vt({"line-cap":new W(O.layout_line["line-cap"]),"line-join":new re(O.layout_line["line-join"]),"line-miter-limit":new W(O.layout_line["line-miter-limit"]),"line-round-limit":new W(O.layout_line["line-round-limit"]),"line-sort-key":new re(O.layout_line["line-sort-key"])}),_y,Pk=()=>_y=_y||new vt({"line-opacity":new re(O.paint_line["line-opacity"]),"line-color":new re(O.paint_line["line-color"]),"line-translate":new W(O.paint_line["line-translate"]),"line-translate-anchor":new W(O.paint_line["line-translate-anchor"]),"line-width":new re(O.paint_line["line-width"]),"line-gap-width":new re(O.paint_line["line-gap-width"]),"line-offset":new re(O.paint_line["line-offset"]),"line-blur":new re(O.paint_line["line-blur"]),"line-dasharray":new Wp(O.paint_line["line-dasharray"]),"line-pattern":new mu(O.paint_line["line-pattern"]),"line-gradient":new yu(O.paint_line["line-gradient"])}),xy={get paint(){return Pk()},get layout(){return wk()}},Tk=class extends re{possiblyEvaluate(e,t){return t=new lt(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=K({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}},Hs,Sk=e=>e.type==="line",Ck=class extends Pi{constructor(e){super(e,xy),this.gradientVersion=0,Hs||(Hs=new Tk(xy.paint.properties["line-width"].specification),Hs.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();RI(t)?this.stepInterpolant=t._styleExpression.expression instanceof kp:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=Hs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new O0(e)}queryRadius(e){let t=e,i=vy(yo("line-width",this,t),yo("line-gap-width",this,t)),r=yo("line-offset",this,t);return i/2+Math.abs(r)+vu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a}){let o=bu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),s=a/2*vy(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=QE(r,l*a)),YE(o,r,s)}isTileClipped(){return!0}};function vy(e,t){return t>0?t+2*e:e}var Mk=it([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ik=it([{name:"a_projected_pos",components:3,type:"Float32"}],4),Aj=it([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Ek=it([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),kj=it([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),by=it([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ak=it([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Dj=it([{name:"triangle",components:3,type:"Uint16"}]),Lj=it([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Rj=it([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),zj=it([{type:"Float32",name:"offsetX"}]),Bj=it([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Oj=it([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]),Ks=se(ce(),1);function kk(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?e=e.toLocaleUpperCase():r==="lowercase"&&(e=e.toLocaleLowerCase()),ga.applyArabicShaping&&(e=ga.applyArabicShaping(e)),e}function Dk(e,t,i){return e.sections.forEach(r=>{r.text=kk(r.text,t,i)}),e}function Lk(e){let t={},i={},r=[],n=0;function a(u){r.push(e[u]),n++}function o(u,h,c){let p=i[u];return delete i[u],i[h]=p,r[p].geometry[0].pop(),r[p].geometry[0]=r[p].geometry[0].concat(c[0]),p}function s(u,h,c){let p=t[h];return delete t[h],t[u]=p,r[p].geometry[0].shift(),r[p].geometry[0]=c[0].concat(r[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return"".concat(u,":").concat(p.x,":").concat(p.y)}for(let u=0;u<e.length;u++){let h=e[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let d=l(p,c),f=l(p,c,!0);if(d in i&&f in t&&i[d]!==t[f]){let y=s(d,f,c),g=o(d,f,r[y].geometry);delete t[d],delete i[f],i[l(p,r[g].geometry,!0)]=g,r[y].geometry=null}else d in i?o(d,f,c):f in t?s(d,f,c):(a(u),t[d]=n-1,i[f]=n-1)}return r.filter(u=>u.geometry)}var Rk={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"},F0=24,zk=se(Sg(),1),wy=3;function Bk(e,t,i){e===1&&i.readMessage(Ok,t)}function Ok(e,t,i){if(e===3){let{id:r,bitmap:n,width:a,height:o,left:s,top:l,advance:u}=i.readMessage(Fk,{});t.push({id:r,bitmap:new _d({width:a+2*wy,height:o+2*wy},n),metrics:{width:a,height:o,left:s,top:l,advance:u}})}}function Fk(e,t,i){e===1?t.id=i.readVarint():e===2?t.bitmap=i.readBytes():e===3?t.width=i.readVarint():e===4?t.height=i.readVarint():e===5?t.left=i.readSVarint():e===6?t.top=i.readSVarint():e===7&&(t.advance=i.readVarint())}function Nk(e){return new zk.default(e).readFields(Bk,[])}function Vk(e){let{userImage:t}=e;return t&&t.render&&t.render()?(e.data.replace(new Uint8Array(t.data.buffer)),!0):!1}function N0(e){let t=0,i=0;for(let o of e)t+=o.w*o.h,i=Math.max(i,o.w);e.sort((o,s)=>s.h-o.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}],n=0,a=0;for(let o of e)for(let s=r.length-1;s>=0;s--){let l=r[s];if(!(o.w>l.w||o.h>l.h)){if(o.x=l.x,o.y=l.y,a=Math.max(a,o.y+o.h),n=Math.max(n,o.x+o.w),o.w===l.w&&o.h===l.h){let u=r.pop();u&&s<r.length&&(r[s]=u)}else o.h===l.h?(l.x+=o.w,l.w-=o.w):o.w===l.w?(l.y+=o.h,l.h-=o.h):(r.push({x:l.x+o.w,y:l.y,w:l.w-o.w,h:o.h}),l.y+=o.h,l.h-=o.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}var oi=1,Pd=class{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:n,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=n,this.content=a,this.version=i,this.textFitWidth=o,this.textFitHeight=s}get tl(){return[this.paddedRect.x+oi,this.paddedRect.y+oi]}get br(){return[this.paddedRect.x+this.paddedRect.w-oi,this.paddedRect.y+this.paddedRect.h-oi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-oi*2)/this.pixelRatio,(this.paddedRect.h-oi*2)/this.pixelRatio]}},jk=class{constructor(e,t){let i={},r={};this.haveRenderCallbacks=[];let n=[];this.addImages(e,i,n),this.addImages(t,r,n);let{w:a,h:o}=N0(n),s=new Ye({width:a||1,height:o||1});for(let l in e){let u=e[l],h=i[l].paddedRect;Ye.copy(u.data,s,{x:0,y:0},{x:h.x+oi,y:h.y+oi},u.data)}for(let l in t){let u=t[l],h=r[l].paddedRect,c=h.x+oi,p=h.y+oi,d=u.data.width,f=u.data.height;Ye.copy(u.data,s,{x:0,y:0},{x:c,y:p},u.data),Ye.copy(u.data,s,{x:0,y:f-1},{x:c,y:p-1},{width:d,height:1}),Ye.copy(u.data,s,{x:0,y:0},{x:c,y:p+f},{width:d,height:1}),Ye.copy(u.data,s,{x:d-1,y:0},{x:c-1,y:p},{width:1,height:f}),Ye.copy(u.data,s,{x:0,y:0},{x:c+d,y:p},{width:1,height:f})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(let r in e){let n=e[r],a={x:0,y:0,w:n.data.width+2*oi,h:n.data.height+2*oi};i.push(a),t[r]=new Pd(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,n]=e.tl;i.update(t.data,void 0,{x:r,y:n})}};H("ImagePosition",Pd);H("ImageAtlas",jk);var V0=(e=>(e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e))(V0||{});function j0(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0;break}return{horizontalAlign:t,verticalAlign:i}}var Uk=se($l(),1),Gk=255,Tl=128,Py=Gk*Tl;function Ty(e,t){let{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new lt(e+1))};if(i.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:n}=i,a=0;for(;a<r.length&&r[a]<=e;)a++;a=Math.max(0,a-1);let o=a;for(;o<r.length&&r[o]<e+1;)o++;o=Math.min(r.length-1,o);let s=r[a],l=r[o];if(i.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n};let u=i.evaluate(new lt(s)),h=i.evaluate(new lt(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:h,interpolationType:n}}}function Td(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return e.kind==="source"?r/Tl:e.kind==="composite"?Ke.number(r/Tl,n/Tl,i):t}function wu(e,t){let i=0,r=0;if(e.kind==="constant")r=e.layoutSize;else if(e.kind!=="source"){let{interpolationType:n,minZoom:a,maxZoom:o}=e,s=n?Ae(xi.interpolationFactor(n,t,a,o),0,1):0;e.kind==="camera"?r=Ke.number(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}}function Fl(e,t,i){let r="never",n=e.get(t);return n?r=n:e.get(i)&&(r="always"),r}var Xk=Uk.default.VectorTileFeature.types,qk=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Js(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=s?Math.min(Py,Math.round(s[0])):0,f=s?Math.min(Py,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(r*32),Math.round(n*32),a,o,(d<<1)+(l?1:0),f,u*16,h*16,c*256,p*256)}function Ro(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function $k(e){for(let t of e.sections)if(mE(t.text))return!0;return!1}var Hc=class{constructor(e){this.layoutVertexArray=new kE,this.indexArray=new Ti,this.programConfigurations=e,this.segments=new qe,this.dynamicLayoutVertexArray=new DE,this.opacityVertexArray=new LE,this.hasVisibleVertices=!1,this.placedSymbolArray=new s0}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Mk.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ik.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,qk,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};H("SymbolBuffers",Hc);var Kc=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new qe,this.collisionVertexArray=new zE}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Ek.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};H("CollisionBuffers",Kc);var va=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(o=>o.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ty(this.zoom,t["text-size"]),this.iconSizeData=Ty(this.zoom,t["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=Fl(i,"text-overlap","text-allow-overlap")!=="never"||Fl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!r.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(o=>V0[o])),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.sourceID=e.sourceID}createArrays(){this.text=new Hc(new _n(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Hc(new _n(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new h0,this.lineVertexArray=new c0,this.symbolInstances=new u0,this.textAnchorOffsets=new d0}calculateGlyphDependencies(e,t,i,r,n){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(i||r)&&n){let o=Rk[e.charAt(a)];o&&(t[o.charCodeAt(0)]=!0)}}populate(e,t,i){let r=this.layers[0],n=r.layout,a=n.get("text-font"),o=n.get("text-field"),s=n.get("icon-image"),l=(o.value.kind!=="constant"||o.value.value instanceof pr&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=s.value.kind!=="constant"||!!s.value.value||Object.keys(s.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,d=t.availableImages,f=new lt(this.zoom,{globalState:this.globalState});for(let{feature:y,id:g,index:_,sourceLayerIndex:b}of e){let v=r._featureFilter.needGeometry,w=Cn(y,v);if(!r._featureFilter.filter(f,w,i))continue;v||(w.geometry=Sn(y));let T;if(l){let L=r.getValueAndResolveTokens("text-field",w,i,d),z=pr.factory(L),R=this.hasRTLText=this.hasRTLText||$k(z);(!R||ga.getRTLTextPluginStatus()==="unavailable"||R&&ga.isParsed())&&(T=Dk(z,r,w))}let S;if(u){let L=r.getValueAndResolveTokens("icon-image",w,i,d);L instanceof Yi?S=L:S=Yi.fromString(L)}if(!T&&!S)continue;let M=this.sortFeaturesByKey?h.evaluate(w,{},i):void 0,E={id:g,text:T,icon:S,index:_,sourceLayerIndex:b,geometry:w.geometry,properties:y.properties,type:Xk[y.type],sortKey:M};if(this.features.push(E),S&&(c[S.name]=!0),T){let L=a.evaluate(w,{},i).join(","),z=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let R of T.sections)if(R.image)c[R.image.name]=!0;else{let k=sE(T.toString()),D=R.fontStack||L,x=p[D]=p[D]||{};this.calculateGlyphDependencies(R.text,x,z,this.allowVerticalPlacement,k)}}}n.get("symbol-placement")==="line"&&(this.features=Lk(this.features)),this.sortFeaturesByKey&&this.features.sort((y,g)=>y.sortKey-g.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let i=this.lineVertexArray.length;if(e.segment!==void 0){let r=e.dist(t[e.segment+1]),n=e.dist(t[e.segment]),a={};for(let o=e.segment+1;o<t.length;o++)a[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:r},o<t.length-1&&(r+=t[o+1].dist(t[o]));for(let o=e.segment||0;o>=0;o--)a[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:n},o>0&&(n+=t[o-1].dist(t[o]));for(let o=0;o<t.length;o++){let s=a[o];this.lineVertexArray.emplaceBack(s.x,s.y,s.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.indexArray,d=e.layoutVertexArray,f=e.segments.prepareSegment(4*t.length,d,p,this.canOverlap?a.sortKey:void 0),y=this.glyphOffsetArray.length,g=f.vertexLength,_=this.allowVerticalPlacement&&o===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<t.length;v++){let{tl:w,tr:T,bl:S,br:M,tex:E,pixelOffsetTL:L,pixelOffsetBR:z,minFontScaleX:R,minFontScaleY:k,glyphOffset:D,isSDF:x,sectionIndex:C}=t[v],I=f.vertexLength,F=D[1];Js(d,s.x,s.y,w.x,F+w.y,E.x,E.y,i,x,L.x,L.y,R,k),Js(d,s.x,s.y,T.x,F+T.y,E.x+E.w,E.y,i,x,z.x,L.y,R,k),Js(d,s.x,s.y,S.x,F+S.y,E.x,E.y+E.h,i,x,L.x,z.y,R,k),Js(d,s.x,s.y,M.x,F+M.y,E.x+E.w,E.y+E.h,i,x,z.x,z.y,R,k),Ro(e.dynamicLayoutVertexArray,s,_),p.emplaceBack(I,I+2,I+1),p.emplaceBack(I+1,I+2,I+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(v===t.length-1||C!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},c,b&&b[C])}e.placedSymbolArray.emplaceBack(s.x,s.y,y,this.glyphOffsetArray.length-y,g,l,u,s.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],o,0,!1,0,h)}_addCollisionDebugVertex(e,t,i,r,n,a){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,i,r,n,a,o){let s=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=s.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new Ks.default(e,t)),this._addCollisionDebugVertex(u,h,a,c,p,new Ks.default(i,t)),this._addCollisionDebugVertex(u,h,a,c,p,new Ks.default(i,r)),this._addCollisionDebugVertex(u,h,a,c,p,new Ks.default(e,r)),s.vertexLength+=4;let d=n.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let n=e;n<t;n++){let a=this.collisionBoxArray.get(n),o=a.x1,s=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(o,s,l,u,r?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Kc(Wm,by.members,Vc),this.iconCollisionBox=new Kc(Wm,by.members,Vc);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,r,n,a,o,s,l){let u={};for(let h=t;h<i;h++){let c=e.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=r;h<n;h++){let c=e.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=a;h<o;h++){let c=e.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=s;h<l;h++){let c=e.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+i.numGlyphs*4;for(let n=i.vertexStartIndex;n<r;n+=4)e.indexArray.emplaceBack(n,n+2,n+1),e.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),r=[],n=[],a=[];for(let o=0;o<this.symbolInstances.length;++o){a.push(o);let s=this.symbolInstances.get(o);r.push(Math.round(t*s.anchorX+i*s.anchorY)|0),n.push(s.featureIndex)}return a.sort((o,s)=>r[o]-r[s]||n[s]-n[o]),a}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let i=this.symbolInstances.get(t);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((r,n,a)=>{r>=0&&a.indexOf(r)===n&&this.addIndicesForPlacedSymbol(this.text,r)}),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};H("SymbolBucket",va,{omit:["layers","collisionBoxArray","features","compareText"]});va.MAX_GLYPHS=65535;va.addDynamicAttributes=Ro;function Yk(e,t){return t.replace(/{([^{}]+)}/g,(i,r)=>e&&r in e?String(e[r]):"")}var Sy,Zk=()=>Sy=Sy||new vt({"symbol-placement":new W(O.layout_symbol["symbol-placement"]),"symbol-spacing":new W(O.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new W(O.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new re(O.layout_symbol["symbol-sort-key"]),"symbol-z-order":new W(O.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new W(O.layout_symbol["icon-allow-overlap"]),"icon-overlap":new W(O.layout_symbol["icon-overlap"]),"icon-ignore-placement":new W(O.layout_symbol["icon-ignore-placement"]),"icon-optional":new W(O.layout_symbol["icon-optional"]),"icon-rotation-alignment":new W(O.layout_symbol["icon-rotation-alignment"]),"icon-size":new re(O.layout_symbol["icon-size"]),"icon-text-fit":new W(O.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new W(O.layout_symbol["icon-text-fit-padding"]),"icon-image":new re(O.layout_symbol["icon-image"]),"icon-rotate":new re(O.layout_symbol["icon-rotate"]),"icon-padding":new re(O.layout_symbol["icon-padding"]),"icon-keep-upright":new W(O.layout_symbol["icon-keep-upright"]),"icon-offset":new re(O.layout_symbol["icon-offset"]),"icon-anchor":new re(O.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new W(O.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new W(O.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new W(O.layout_symbol["text-rotation-alignment"]),"text-field":new re(O.layout_symbol["text-field"]),"text-font":new re(O.layout_symbol["text-font"]),"text-size":new re(O.layout_symbol["text-size"]),"text-max-width":new re(O.layout_symbol["text-max-width"]),"text-line-height":new W(O.layout_symbol["text-line-height"]),"text-letter-spacing":new re(O.layout_symbol["text-letter-spacing"]),"text-justify":new re(O.layout_symbol["text-justify"]),"text-radial-offset":new re(O.layout_symbol["text-radial-offset"]),"text-variable-anchor":new W(O.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new re(O.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new re(O.layout_symbol["text-anchor"]),"text-max-angle":new W(O.layout_symbol["text-max-angle"]),"text-writing-mode":new W(O.layout_symbol["text-writing-mode"]),"text-rotate":new re(O.layout_symbol["text-rotate"]),"text-padding":new W(O.layout_symbol["text-padding"]),"text-keep-upright":new W(O.layout_symbol["text-keep-upright"]),"text-transform":new re(O.layout_symbol["text-transform"]),"text-offset":new re(O.layout_symbol["text-offset"]),"text-allow-overlap":new W(O.layout_symbol["text-allow-overlap"]),"text-overlap":new W(O.layout_symbol["text-overlap"]),"text-ignore-placement":new W(O.layout_symbol["text-ignore-placement"]),"text-optional":new W(O.layout_symbol["text-optional"])}),Cy,Wk=()=>Cy=Cy||new vt({"icon-opacity":new re(O.paint_symbol["icon-opacity"]),"icon-color":new re(O.paint_symbol["icon-color"]),"icon-halo-color":new re(O.paint_symbol["icon-halo-color"]),"icon-halo-width":new re(O.paint_symbol["icon-halo-width"]),"icon-halo-blur":new re(O.paint_symbol["icon-halo-blur"]),"icon-translate":new W(O.paint_symbol["icon-translate"]),"icon-translate-anchor":new W(O.paint_symbol["icon-translate-anchor"]),"text-opacity":new re(O.paint_symbol["text-opacity"]),"text-color":new re(O.paint_symbol["text-color"],{runtimeType:_i,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new re(O.paint_symbol["text-halo-color"]),"text-halo-width":new re(O.paint_symbol["text-halo-width"]),"text-halo-blur":new re(O.paint_symbol["text-halo-blur"]),"text-translate":new W(O.paint_symbol["text-translate"]),"text-translate-anchor":new W(O.paint_symbol["text-translate-anchor"])}),Wh={get paint(){return Wk()},get layout(){return Zk()}},U0=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:No,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};H("FormatSectionOverride",U0,{omit:["defaultValue"]});var Hk=e=>e.type==="symbol",Kk=class Jc extends Pi{constructor(t){super(t,Wh)}recalculate(t,i){if(super.recalculate(t,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let r=this.layout.get("text-writing-mode");if(r){let n=[];for(let a of r)n.indexOf(a)<0&&n.push(a);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,n){let a=this.layout.get(t).evaluate(i,{},r,n),o=this._unevaluatedLayout._values[t];return!o.isDataDriven()&&!lu(o.value)&&a?Yk(i.properties,a):a}createBucket(t){return new va(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of Wh.paint.overridableProperties){if(!Jc.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new U0(i),n=new Up(r,i.property.specification),a=null;i.value.kind==="constant"||i.value.kind==="source"?a=new Co("source",n):a=new Rl("composite",n,i.value.zoomStops),this.paint._values[t]=new gi(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!this.layout||i.isDataDriven()||r.isDataDriven()?!1:Jc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),n=Wh.paint.properties[i],a=!1,o=s=>{for(let l of s)if(n.overrides&&n.overrides.hasOverride(l)){a=!0;return}};if(r.value.kind==="constant"&&r.value.value instanceof pr)o(r.value.value.sections);else if(r.value.kind==="source"){let s=u=>{if(!a)if(u instanceof Po&&pt(u.value)===Vo){let h=u.value;o(h.sections)}else u instanceof bx?o(u.sections):u.eachChild(s)},l=r.value;l._styleExpression&&s(l._styleExpression.expression)}return a}},My,Jk=()=>My=My||new vt({"background-color":new W(O.paint_background["background-color"]),"background-pattern":new Wp(O.paint_background["background-pattern"]),"background-opacity":new W(O.paint_background["background-opacity"])}),Qk={get paint(){return Jk()}},eD=e=>e.type==="background",tD=class extends Pi{constructor(e){super(e,Qk)}},Iy,iD=()=>Iy=Iy||new vt({"raster-opacity":new W(O.paint_raster["raster-opacity"]),"raster-hue-rotate":new W(O.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new W(O.paint_raster["raster-brightness-min"]),"raster-brightness-max":new W(O.paint_raster["raster-brightness-max"]),"raster-saturation":new W(O.paint_raster["raster-saturation"]),"raster-contrast":new W(O.paint_raster["raster-contrast"]),"raster-resampling":new W(O.paint_raster["raster-resampling"]),"raster-fade-duration":new W(O.paint_raster["raster-fade-duration"])}),rD={get paint(){return iD()}},nD=e=>e.type==="raster",aD=class extends Pi{constructor(e){super(e,rD)}};function oD(e){let t=[],i=e.id;return i===void 0&&t.push({message:"layers.".concat(i,': missing required property "id"')}),e.render===void 0&&t.push({message:"layers.".concat(i,': missing required method "render"')}),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t.push({message:"layers.".concat(i,': property "renderingMode" must be either "2d" or "3d"')}),t}var sD=e=>e.type==="custom",lD=class extends Pi{constructor(e){super(e,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Hh(e){if(e.type==="custom")return new lD(e);switch(e.type){case"background":return new tD(e);case"circle":return new aA(e);case"color-relief":return new xA(e);case"fill":return new HA(e);case"fill-extrusion":return new lk(e);case"heatmap":return new hA(e);case"hillshade":return new fA(e);case"line":return new Ck(e);case"raster":return new aD(e);case"symbol":return new Kk(e)}}function Sl(e){let t=[];if(typeof e=="string")t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:n}of e){let a="".concat(r).concat(n);i.indexOf(a)===-1&&(i.push(a),t.push({id:r,url:n}))}}return t}function Ey(e,t,i){try{let r=new URL(e);return r.pathname+="".concat(t).concat(i),r.toString()}catch(r){throw new Error('Invalid sprite URL "'.concat(e,'", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically'))}}async function uD(e,t,i,r){let n=Sl(e),a=i>1?"@2x":"",o={},s={};for(let{id:l,url:u}of n){let h=t.transformRequest(Ey(u,a,".json"),"SpriteJSON");o[l]=Kl(h,r);let c=t.transformRequest(Ey(u,a,".png"),"SpriteImage");s[l]=Gi.getImage(c,r)}return await Promise.all([...Object.values(o),...Object.values(s)]),hD(o,s)}async function hD(e,t){let i={};for(let r in e){i[r]={};let n=ve.getImageCanvasContext((await t[r]).data),a=(await e[r]).data;for(let o in a){let{width:s,height:l,x:u,y:h,sdf:c,pixelRatio:p,stretchX:d,stretchY:f,content:y,textFitWidth:g,textFitHeight:_}=a[o],b={width:s,height:l,x:u,y:h,context:n};i[r][o]={data:null,pixelRatio:p,sdf:c,stretchX:d,stretchY:f,content:y,textFitWidth:g,textFitHeight:_,spriteData:b}}}return i}var Qs=1,cD=class extends Ft{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new Ye({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let i=t.spriteData;t.data=new Ye({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let i=!0,r=t.data||t.spriteData;return this._validateStretch(t.stretchX,r&&r.width)||(this.fire(new ne(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(t.stretchY,r&&r.height)||(this.fire(new ne(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(t.content,t)||(this.fire(new ne(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,r=i&&i.width||t.data.width,n=i&&i.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||n<e[1]||e[2]<0||r<e[2]||e[3]<0||n<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){let r=this.getImage(e);if(i&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw new Error("size mismatch between old image (".concat(r.data.width,"x").concat(r.data.height,") and new image (").concat(t.data.width,"x").concat(t.data.height,")."));t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let r=!0;if(!this.isLoaded())for(let n of e)this.images[n]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let i of e){let r=this.getImage(i);r||(this.fire(new $("styleimagemissing",{id:i})),r=this.getImage(i)),r?t[i]={data:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,version:r.version,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,textFitWidth:r.textFitWidth,textFitHeight:r.textFitHeight,hasRenderCallback:!!(r.userImage&&r.userImage.render)}:ct('Image "'.concat(i,'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.'))}return t}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],i=this.getImage(e);if(!i)return null;if(t&&t.position.version===i.version)return t.position;if(t)t.position.version=i.version;else{let r=i.data.width+Qs*2,n=i.data.height+Qs*2,a={w:r,h:n,x:0,y:0},o=new Pd(a,i);this.patterns[e]={bin:a,position:o}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new st(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let n in this.patterns)e.push(this.patterns[n].bin);let{w:t,h:i}=N0(e),r=this.atlasImage;r.resize({width:t||1,height:i||1});for(let n in this.patterns){let{bin:a}=this.patterns[n],o=a.x+Qs,s=a.y+Qs,l=this.getImage(n).data,u=l.width,h=l.height;Ye.copy(l,r,{x:0,y:0},{x:o,y:s},{width:u,height:h}),Ye.copy(l,r,{x:0,y:h-1},{x:o,y:s-1},{width:u,height:1}),Ye.copy(l,r,{x:0,y:0},{x:o,y:s+h},{width:u,height:1}),Ye.copy(l,r,{x:u-1,y:0},{x:o-1,y:s},{width:1,height:h}),Ye.copy(l,r,{x:0,y:0},{x:o+u,y:s},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let i=this.getImage(t);i||ct('Image with ID: "'.concat(t,'" was not found')),Vk(i)&&this.updateImage(t,i)}}};async function pD(e,t,i,r){let n=t*256,a=n+255,o=r.transformRequest(i.replace("{fontstack}",e).replace("{range}","".concat(n,"-").concat(a)),"Glyphs"),s=await hC(o,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(t,", ").concat(n,"-").concat(a));let l={};for(let u of Nk(s.data))l[u.id]=u;return l}var dD=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:a="normal",fontStyle:o="normal",lang:s=null}={}){this.buffer=t,this.cutoff=r,this.radius=i,this.lang=s;let l=this.size=e+t*4,u=this._createCanvas(l),h=this.ctx=u.getContext("2d",{willReadFrequently:!0});h.font="".concat(o," ").concat(a," ").concat(e,"px ").concat(n),h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(i),s=0,l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-n))),u=Math.min(this.size-this.buffer,o+Math.ceil(r)),h=l+2*this.buffer,c=u+2*this.buffer,p=Math.max(h*c,0),d=new Uint8ClampedArray(p),f={data:d,width:h,height:c,glyphWidth:l,glyphHeight:u,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(l===0||u===0)return f;let{ctx:y,buffer:g,gridInner:_,gridOuter:b}=this;this.lang&&(y.lang=this.lang),y.clearRect(g,g,l,u),y.fillText(e,g,g+o);let v=y.getImageData(g,g,l,u);b.fill(1e20,0,p),_.fill(0,0,p);for(let w=0;w<u;w++)for(let T=0;T<l;T++){let S=v.data[4*(w*l+T)+3]/255;if(S===0)continue;let M=(w+g)*h+T+g;if(S===1)b[M]=0,_[M]=1e20;else{let E=.5-S;b[M]=E>0?E*E:0,_[M]=E<0?E*E:0}}Ay(b,0,0,h,c,h,this.f,this.v,this.z),Ay(_,g,g,l,u,h,this.f,this.v,this.z);for(let w=0;w<p;w++){let T=Math.sqrt(b[w])-Math.sqrt(_[w]);d[w]=Math.round(255-255*(T/this.radius+this.cutoff))}return f}};function Ay(e,t,i,r,n,a,o,s,l){for(let u=t;u<t+r;u++)ky(e,i*a+u,a,n,o,s,l);for(let u=i;u<i+n;u++)ky(e,u*a+t,1,r,o,s,l)}function ky(e,t,i,r,n,a,o){a[0]=0,o[0]=-1e20,o[1]=1e20,n[0]=e[t];for(let s=1,l=0,u=0;s<r;s++){n[s]=e[t+s*i];let h=s*s;do{let c=a[l];u=(n[s]-n[c]+h-c*c)/(s-c)/2}while(u<=o[l]&&--l>-1);l++,a[l]=s,o[l]=u,o[l+1]=1e20}for(let s=0,l=0;s<r;s++){for(;o[l+1]<s;)l++;let u=a[l],h=s-u;e[t+s*i]=n[u]+h*h}}var Qc=class ep{constructor(t,i){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={}}setURL(t){this.url=t}async getGlyphs(t){let i=[];for(let a in t)for(let o of t[a])i.push(this._getAndCacheGlyphsPromise(a,o));let r=await Promise.all(i),n={};for(let{stack:a,id:o,glyph:s}of r)n[a]||(n[a]={}),n[a][o]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return n}async _getAndCacheGlyphsPromise(t,i){let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=r.glyphs[i];if(n!==void 0)return{stack:t,id:i,glyph:n};if(n=this._tinySDF(r,t,i),n)return r.glyphs[i]=n,{stack:t,id:i,glyph:n};let a=Math.floor(i/256);if(a*256>65535)throw new Error("glyphs > 65535 not supported");if(r.ranges[a])return{stack:t,id:i,glyph:n};if(!this.url)throw new Error("glyphsUrl is not set");if(!r.requests[a]){let s=ep.loadGlyphRange(t,a,this.url,this.requestManager);r.requests[a]=s}let o=await r.requests[a];for(let s in o)this._doesCharSupportLocalGlyph(+s)||(r.glyphs[+s]=o[+s]);return r.ranges[a]=!0,{stack:t,id:i,glyph:o[i]||null}}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(t))||mt["CJK Unified Ideographs"](t)||mt["Hangul Syllables"](t)||mt.Hiragana(t)||mt.Katakana(t)||mt["CJK Symbols and Punctuation"](t)||mt["Halfwidth and Fullwidth Forms"](t))}_tinySDF(t,i,r){let n=this.localIdeographFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let a=2,o=t.tinySDF;if(!o){let l="400";/bold/i.test(i)?l="900":/medium/i.test(i)?l="500":/light/i.test(i)&&(l="200"),o=t.tinySDF=new ep.TinySDF({fontSize:24*a,buffer:3*a,radius:8*a,cutoff:.25,fontFamily:n,fontWeight:l})}let s=o.draw(String.fromCharCode(r));return{id:r,bitmap:new _d({width:s.width||30*a,height:s.height||30*a},s.data),metrics:{width:s.glyphWidth/a||24,height:s.glyphHeight/a||24,left:s.glyphLeft/a+.5||0,top:s.glyphTop/a-27.5||-8,advance:s.glyphAdvance/a||24,isDoubleResolution:!0}}}};Qc.loadGlyphRange=pD,Qc.TinySDF=dD;var fD=Qc,mD=class{constructor(){this.specification=O.light.position}possiblyEvaluate(e,t){return $S(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Ke.number(e.x,t.x,i),y:Ke.number(e.y,t.y,i),z:Ke.number(e.z,t.z,i)}}},Dy="-transition",Kh,yD=class extends Ft{constructor(e){super(),Kh=Kh||new vt({anchor:new W(O.light.anchor),position:new mD,color:new W(O.light.color),intensity:new W(O.light.intensity)}),this._transitionable=new du(Kh),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(iE,e,t))for(let i in e){let r=e[i];i.endsWith(Dy)?this._transitionable.setTransition(i.slice(0,-Dy.length),r):this._transitionable.setValue(i,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return i&&i.validate===!1?!1:cu(this,e.call(ht,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:O}))}},gD=new vt({"sky-color":new W(O.sky["sky-color"]),"horizon-color":new W(O.sky["horizon-color"]),"fog-color":new W(O.sky["fog-color"]),"fog-ground-blend":new W(O.sky["fog-ground-blend"]),"horizon-fog-blend":new W(O.sky["horizon-fog-blend"]),"sky-horizon-blend":new W(O.sky["sky-horizon-blend"]),"atmosphere-blend":new W(O.sky["atmosphere-blend"])}),Ly="-transition",_D=class extends Ft{constructor(e){super(),this._transitionable=new du(gD),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new lt(0))}setSky(e,t={}){if(!this._validate(rE,e,t)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let i in e){let r=e[i];i.endsWith(Ly)?this._transitionable.setTransition(i.slice(0,-Ly.length),r):this._transitionable.setValue(i,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i={}){return(i==null?void 0:i.validate)===!1?!1:cu(this,e.call(ht,K({value:t,style:{glyphs:!0,sprite:!0},styleSpec:O})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},xD=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){let r=e.length%2===1,n=[],a=r?-e[e.length-1]*i:0,o=e[0]*i,s=!0;n.push({left:a,right:o,isDash:s,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){s=!s;let h=e[u];a=l*i,l+=h,o=l*i,n.push({left:a,right:o,isDash:s,zeroLength:h===0})}return n}addRoundDash(e,t,i){let r=t/2;for(let n=-i;n<=i;n++){let a=this.nextRow+i+n,o=this.width*a,s=0,l=e[s];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++s]);let h=Math.abs(u-l.left),c=Math.abs(u-l.right),p=Math.min(h,c),d,f=n/i*(r+1);if(l.isDash){let y=r-Math.abs(f);d=Math.sqrt(p*p+y*y)}else d=r-Math.sqrt(p*p+f*f);this.data[o+u]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let o=e.length-1;o>=0;--o){let s=e[o],l=e[o+1];s.zeroLength?e.splice(o,1):l&&l.isDash===s.isDash&&(l.left=s.left,e.splice(o,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let r=this.width*this.nextRow,n=0,a=e[n];for(let o=0;o<this.width;o++){o/a.right>1&&(a=e[++n]);let s=Math.abs(o-a.left),l=Math.abs(o-a.right),u=Math.min(s,l),h=a.isDash?u:-u;this.data[r+o]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let i=t?7:0,r=2*i+1;if(this.nextRow+r>this.height)return ct("LineAtlas out of space"),null;let n=0;for(let o=0;o<e.length;o++)n+=e[o];if(n!==0){let o=this.width/n,s=this.getDashRanges(e,this.width,o);t?this.addRoundDash(s,o,i):this.addRegularDash(s)}let a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:n};return this.nextRow+=r,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}},vD=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},bD={once:!0},wD=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new vD(()=>this.process()),this.subscription=Pc(this.target,"message",i=>this.receive(i),!1),this.globalScope=pa(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((i,r)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=t?Pc(t.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},bD):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),i(l)},reject:l=>{a==null||a.unsubscribe(),r(l)}};let o=[],s=ri(nt({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:fo(e.data,o)});this.target.postMessage(s,{transfer:o})})}receive(e){let t=e.data,i=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];let r=this.abortControllers[i];delete this.abortControllers[i],r&&r.abort();return}if(pa(self)||t.mustQueue){this.tasks[i]=t,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let n=this.resolveRejects[e];if(delete this.resolveRejects[e],!n)return;t.error?n.reject(mo(t.error)):n.resolve(mo(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(t.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let i=mo(t.data),r=new AbortController;this.abortControllers[e]=r;try{let n=await this.messageHandlers[t.type](t.sourceMapId,i,r);this.completeTask(e,null,n)}catch(n){this.completeTask(e,n)}}completeTask(e,t,i){let r=[];delete this.abortControllers[e];let n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?fo(t):null,data:fo(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},PD='(()=>{var Uy=Object.create;var ss=Object.defineProperty;var $y=Object.getOwnPropertyDescriptor;var jy=Object.getOwnPropertyNames;var qy=Object.getPrototypeOf,Wy=Object.prototype.hasOwnProperty;var ve=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xy=(t,e)=>{for(var r in e)ss(t,r,{get:e[r],enumerable:!0})},Hy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jy(e))!Wy.call(t,i)&&i!==r&&ss(t,i,{get:()=>e[i],enumerable:!(n=$y(e,i))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?Uy(qy(t)):{},Hy(e||!t||!t.__esModule?ss(r,"default",{value:t,enumerable:!0}):r,t));var ye=ve((p0,au)=>{"use strict";au.exports=hr;function hr(t,e){this.x=t,this.y=e}hr.prototype={clone:function(){return new hr(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};hr.convert=function(t){return t instanceof hr?t:Array.isArray(t)?new hr(t[0],t[1]):t}});var uu=ve((f0,lu)=>{"use strict";lu.exports=su;function su(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}su.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}}});var op=ve((Ov,el)=>{function Sg(t,e){var r,n,i,o,a,s,l,u,c,p;for(r=t.length&3,n=t.length-r,i=e,a=3432918353,l=461845907,p=0;p<n;)c=t.charCodeAt(p)&255|(t.charCodeAt(++p)&255)<<8|(t.charCodeAt(++p)&255)<<16|(t.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(t.charCodeAt(p+2)&255)<<16;case 2:c^=(t.charCodeAt(p+1)&255)<<8;case 1:c^=t.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof el<"u"&&(el.exports=Sg)});var ap=ve((Gv,tl)=>{function wg(t,e){for(var r=t.length,n=e^r,i=0,o;r>=4;)o=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(t.charCodeAt(i+2)&255)<<16;case 2:n^=(t.charCodeAt(i+1)&255)<<8;case 1:n^=t.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof tl!==void 0&&(tl.exports=wg)});var rl=ve((Nv,ta)=>{var sp=op(),Ag=ap();ta.exports=sp;ta.exports.murmur3=sp;ta.exports.murmur2=Ag});var dl=ve((LS,jp)=>{"use strict";var cb=ye();jp.exports=Rr;function Rr(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(pb,this,e)}function pb(t,e,r){t==1?e.id=r.readVarint():t==2?fb(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function fb(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}Rr.types=["Unknown","Point","LineString","Polygon"];Rr.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=[],s;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new cb(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};Rr.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};Rr.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,o=this.extent*e,a=this.loadGeometry(),s=Rr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],g=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(g*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=yb(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function yb(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=mb(t[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[o]]):n.push(t[o]))}return n&&r.push(n),r}function mb(t){for(var e=0,r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}});var gl=ve((FS,Wp)=>{"use strict";var hb=dl();Wp.exports=qp;function qp(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(db,this,e),this.length=this._features.length}function db(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(gb(r))}function gb(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}qp.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new hb(this._pbf,e,this.extent,this._keys,this._values)}});var Hp=ve((DS,Xp)=>{"use strict";var bb=gl();Xp.exports=xb;function xb(t,e){this.layers=t.readFields(vb,{},e)}function vb(t,e,r){if(t===3){var n=new bb(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Rt=ve((VS,xa)=>{xa.exports.VectorTile=Hp();xa.exports.VectorTileFeature=dl();xa.exports.VectorTileLayer=gl()});var df=ve(Sl=>{Sl.read=function(t,e,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=t[e+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+t[e+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+t[e+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};Sl.write=function(t,e,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=f/l:e+=f*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+y]=a&255,y+=m,a/=256,u-=8);t[r+y-m]|=h*128}});var mi=ve((fA,Pf)=>{"use strict";Pf.exports=J;var Aa=df();function J(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var wl=65536*65536,gf=1/wl,Ob=12,vf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_a(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xf(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_a(this.buf,this.pos)+_a(this.buf,this.pos+4)*wl;return this.pos+=8,t},readSFixed64:function(){var t=_a(this.buf,this.pos)+xf(this.buf,this.pos+4)*wl;return this.pos+=8,t},readFloat:function(){var t=Aa.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Aa.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Gb(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Ob&&vf?ex(this.buf,e,t):Qb(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==J.Bytes)return t.push(this.readVarint(e));var r=mt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==J.Bytes)return t.push(this.readSVarint());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==J.Bytes)return t.push(this.readBoolean());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==J.Bytes)return t.push(this.readFloat());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==J.Bytes)return t.push(this.readDouble());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===J.Varint)for(;this.buf[this.pos++]>127;);else if(e===J.Bytes)this.pos=this.readVarint()+this.pos;else if(e===J.Fixed32)this.pos+=4;else if(e===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Nb(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=tx(this.buf,t,this.pos);var r=this.pos-e;r>=128&&bf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Aa.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Aa.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&bf(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,J.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,jb,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,qb,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Hb,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Wb,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Xb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zb,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Jb,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Yb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Kb,e)},writeBytesField:function(t,e){this.writeTag(t,J.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,J.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,J.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,J.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};function Gb(t,e,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Or(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function mt(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Or(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Nb(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Ub(r,n,e),$b(n,e)}function Ub(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function $b(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function bf(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function jb(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function qb(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Wb(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Xb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Hb(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Zb(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Jb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Yb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Kb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function _a(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Gr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function xf(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Qb(t,e,r){for(var n="",i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=t[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=t[i+1],u=t[i+2],c=t[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function ex(t,e,r){return vf.decode(t.subarray(e,r))}function tx(t,e,r){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=i;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var gy=ve((iT,dy)=>{dy.exports=Ha;function Ha(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Ha(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Ha(t.geometries[n],e);else if(r==="Feature")Ha(t.geometry,e);else if(r==="Polygon")my(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)my(t.coordinates[n],e);return t}function my(t,e){if(t.length!==0){hy(t[0],e);for(var r=1;r<t.length;r++)hy(t[r],!e)}}function hy(t,e){for(var r=0,n=0,i=0,o=t.length,a=o-1;i<o;a=i++){var s=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!e&&t.reverse()}});var Py=ve((sT,vy)=>{"use strict";var Ux=ye(),$x=Rt().VectorTileFeature;vy.exports=xy;function xy(t,e){this.options=e||{},this.features=t,this.length=t.length}xy.prototype.feature=function(t){return new Ja(this.features[t],this.options.extent)};function Ja(t,e){this.id=typeof t.id=="number"?t.id:void 0,this.type=t.type,this.rawGeometry=t.type===1?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}Ja.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new Ux(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Ja.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]};Ja.prototype.toGeoJSON=$x.prototype.toGeoJSON});var Ay=ve((lT,Fi)=>{var jx=mi(),wy=Py();Fi.exports=Ul;Fi.exports.fromVectorTileJs=Ul;Fi.exports.fromGeojsonVt=qx;Fi.exports.GeoJSONWrapper=wy;function Ul(t){var e=new jx;return Wx(t,e),e.finish()}function qx(t,e){e=e||{};var r={};for(var n in t)r[n]=new wy(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ul({layers:r})}function Wx(t,e){for(var r in t.layers)e.writeMessage(3,Xx,t.layers[r])}function Xx(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Hx,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,Yx,o[r])}function Hx(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Zx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Jx,r)}function Zx(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),e.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),e.writeVarint(f)}}}function Nl(t,e){return(e<<3)+(t&7)}function Sy(t){return t<<1^t>>31}function Jx(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),e.writeVarint(Nl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(Nl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(Sy(f)),e.writeVarint(Sy(y)),i+=f,o+=y}n===3&&e.writeVarint(Nl(7,1))}}function Yx(t,e){var r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1!==0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}});var km=Y(ye(),1),Pu=Y(uu(),1);var ls;function cu(){return ls==null&&(ls=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ls}var qi;function pu(){if(qi==null&&(qi=!1,cu())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<25;i++){let o=i*4;r.fillStyle=`rgb(${o},${o+1},${o+2})`,r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!==3&&n[i]!==i){qi=!0;break}}}return qi||!1}var Jr=1e-6,Yr=typeof Float32Array<"u"?Float32Array:Array,Kr=Math.random;var d0=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Wi={};Xy(Wi,{add:()=>em,ceil:()=>tm,clone:()=>Jy,copy:()=>Ky,create:()=>fu,cross:()=>fm,dist:()=>Am,distance:()=>du,div:()=>wm,divide:()=>hu,dot:()=>pm,equals:()=>vm,exactEquals:()=>xm,floor:()=>rm,forEach:()=>Cm,fromValues:()=>Yy,inverse:()=>um,len:()=>Im,length:()=>bu,lerp:()=>ym,max:()=>im,min:()=>nm,mul:()=>Sm,multiply:()=>mu,negate:()=>lm,normalize:()=>cm,random:()=>mm,round:()=>om,scale:()=>am,scaleAndAdd:()=>sm,set:()=>Qy,sqrDist:()=>_m,sqrLen:()=>Tm,squaredDistance:()=>gu,squaredLength:()=>xu,str:()=>bm,sub:()=>Pm,subtract:()=>yu,transformMat4:()=>hm,transformQuat:()=>dm,zero:()=>gm});function fu(){var t=new Yr(4);return Yr!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Jy(t){var e=new Yr(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yy(t,e,r,n){var i=new Yr(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Ky(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Qy(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function em(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function yu(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function mu(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function hu(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function tm(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function rm(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function nm(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function im(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function om(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function am(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function sm(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function du(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(r,n,i,o)}function gu(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function bu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function xu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function lm(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function um(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function cm(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function pm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function fm(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=e[0],p=e[1],f=e[2],y=e[3];return t[0]=p*u-f*l+y*s,t[1]=-(c*u)+f*a-y*o,t[2]=c*l-p*a+y*i,t[3]=-(c*s)+p*o-f*i,t}function ym(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function mm(t,e){e=e||1;var r,n,i,o,a,s;do r=Kr()*2-1,n=Kr()*2-1,a=r*r+n*n;while(a>=1);do i=Kr()*2-1,o=Kr()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*i*l,t[3]=e*o*l,t}function hm(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function dm(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return t[0]=c*u+y*-a+p*-l-f*-s,t[1]=p*u+y*-s+f*-a-c*-l,t[2]=f*u+y*-l+c*-s-p*-a,t[3]=e[3],t}function gm(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function bm(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function xm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function vm(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=Jr*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Jr*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Jr*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Jr*Math.max(1,Math.abs(o),Math.abs(u))}var Pm=yu,Sm=mu,wm=hu,Am=du,_m=gu,Im=bu,Tm=xu,Cm=(function(){var t=fu();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}})();function Su(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Em(t,e,r,n){let i=new Pu.default(t,e,r,n);return o=>i.solve(o)}var A0=Em(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function wu(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function de(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function Au(t){return Math.log(t)/Math.LN2%1===0}function tn(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function _u(t,e,r){let n={};for(let i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function nt(t){return Array.isArray(t)?t.map(nt):typeof t=="object"&&t?tn(t,nt):t}var vu={};function ce(t){vu[t]||(typeof console<"u"&&console.warn(t),vu[t]=!0)}function ot(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function vt(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Mm(t,e,r,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,r),f=Math.min(t.width,e+n),y=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function Lm(t,e,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let a=o?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Mm(t,e,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var Qr,en;function Fm(t,e,r,n,i){let o=t.width,a=t.height;(!Qr||!en)&&(Qr=new OffscreenCanvas(o,a),en=Qr.getContext("2d",{willReadFrequently:!0})),Qr.width=o,Qr.height=a,en.drawImage(t,0,0,o,a);let s=en.getImageData(e,r,n,i);return en.clearRect(0,0,o,a),s.data}async function Iu(t,e,r,n,i){if(pu())try{return await Lm(t,e,r,n,i)}catch{}return Fm(t,e,r,n,i)}function us(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function cs(t){return t*Math.PI/180}var Xi=25,Hi=0;var $t=class t{constructor(e,r,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;let o=n/r*e;this.min=-o,this.max=e+o}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,i,o,a){this.cells[o].push(a)}query(e,r,n,i,o){let a=this.min,s=this.max;if(e<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,r,n,i,this._queryCell,l,u,o),l}}_queryCell(e,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):e<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,r,n,i,h,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,r){let n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new t(e.buffer)}};var Dm=8,Vm={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Bm={"*":{type:"source"}},Rm=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],zm={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Om={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Gm={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Nm={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},Um={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},$m={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},jm={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},qm=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Wm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xm={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Hm={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Zm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Jm={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ym={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Km={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eh={type:"array",value:"*"},th={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},rh={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},nh={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},ih={type:"array",value:"*",minimum:1},oh={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},ah={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sh={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},lh={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},uh=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],ch={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},ph={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},fh={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},yh={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},mh={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},hh={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},dh={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},gh={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},bh={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},xh={"*":{type:"string"}},P={$version:Dm,$root:Vm,sources:Bm,source:Rm,source_vector:zm,source_raster:Om,source_raster_dem:Gm,source_geojson:Nm,source_video:Um,source_image:$m,layer:jm,layout:qm,layout_background:Wm,layout_fill:Xm,layout_circle:Hm,layout_heatmap:Zm,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Jm,layout_symbol:Ym,layout_raster:Km,layout_hillshade:Qm,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:eh,filter_operator:th,geometry_type:rh,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:nh,expression:ih,light:oh,sky:ah,terrain:sh,projection:lh,paint:uh,paint_fill:ch,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:ph,paint_circle:fh,paint_heatmap:yh,paint_symbol:mh,paint_raster:hh,paint_hillshade:dh,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:gh,transition:bh,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:xh},vh=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var C=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function xr(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Be=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},vs=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},wr={kind:"null"},k={kind:"number"},$={kind:"string"},U={kind:"boolean"},ze={kind:"color"},yo={kind:"projectionDefinition"},Wt={kind:"object"},N={kind:"value"},Ph={kind:"error"},mo={kind:"collator"},Ar={kind:"formatted"},ho={kind:"padding"},an={kind:"colorArray"},go={kind:"numberArray"},vn={kind:"resolvedImage"},bo={kind:"variableAnchorOffsetCollection"};function Ce(t,e){return{kind:"array",itemType:t,N:e}}function ie(t){if(t.kind==="array"){let e=ie(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var Sh=[wr,k,$,U,ze,yo,Ar,Wt,Ce(N),ho,go,an,vn,bo];function sn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!sn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of Sh)if(!sn(r,e))return null}}return`Expected ${ie(t)} but found ${ie(e)} instead.`}function zs(t,e){return e.some(r=>r.kind===t.kind)}function Xt(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Pt(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var Xu=.96422,Hu=1,Zu=.82521,Ju=4/29,br=6/29,Yu=3*br*br,wh=br*br*br,Ah=Math.PI/180,_h=180/Math.PI;function Ku(t){return t=t%360,t<0&&(t+=360),t}function Qu([t,e,r,n]){t=ps(t),e=ps(e),r=ps(r);let i,o,a=fs((.2225045*t+.7168786*e+.0606169*r)/Hu);t===e&&e===r?i=o=a:(i=fs((.4360747*t+.3850649*e+.1430804*r)/Xu),o=fs((.0139322*t+.0971045*e+.7141733*r)/Zu));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function ps(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fs(t){return t>wh?Math.pow(t,1/3):t/Yu+Ju}function ec([t,e,r,n]){let i=(t+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=Hu*ms(i),o=Xu*ms(o),a=Zu*ms(a),[ys(3.1338561*o-1.6168667*i-.4906146*a),ys(-.9787684*o+1.9161415*i+.033454*a),ys(.0719453*o-.2289914*i+1.4052427*a),n]}function ys(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function ms(t){return t>br?t*t*t:Yu*(t-Ju)}function Ih(t){let[e,r,n,i]=Qu(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ku(Math.atan2(n,r)*_h):NaN,o,e,i]}function Th([t,e,r,n]){return t=isNaN(t)?0:t*Ah,ec([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Ch([t,e,r,n]){t=Ku(t),e/=100,r/=100;function i(o){let a=(o+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}var kh=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function nn(t,e){return kh(t,e)?t[e]:void 0}function Eh(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=nn(Mh,t);if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let o=t.length<6?1:2,a=1;return[Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+o)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=t.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,g,d]=o,x=[u||" ",f||" ",h].join("");if(x===" "||x===" /"||x===",,"||x===",,,"){let b=[l,p,m].join(""),v=b==="%%%"?100:b===""?255:0;if(v){let S=[dr(+s/v,0,1),dr(+c/v,0,1),dr(+y/v,0,1),g?Tu(+g,d):1];if(Cu(S))return S}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=t.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,dr(+s,0,100),dr(+u,0,100),p?Tu(+p,f):1];if(Cu(m))return Ch(m)}}}function Zi(t){return parseInt(t.padEnd(2,t),16)/255}function Tu(t,e){return dr(e?t/100:t,0,1)}function dr(t,e,r){return Math.min(Math.max(e,t),r)}function Cu(t){return!t.some(Number.isNaN)}var Mh={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function wt(t,e,r){return t+r*(e-t)}function vr(t,e,r){return t.map((n,i)=>wt(n,e[i],r))}function Lh(t){return t==="rgb"||t==="hcl"||t==="lab"}var H=class t{constructor(e,r,n,i=1,o=!0){this.r=e,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let r=Eh(e);if(r)return new t(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Ih(this.rgb))}get lab(){return this.overwriteGetter("lab",Qu(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(o=>Math.round(o*255)).join(",")},${i})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=vr(e.rgb,r.rgb,n);return new t(o,a,s,l,!1)}case"hcl":{let[o,a,s,l]=e.hcl,[u,c,p,f]=r.hcl,y,m;if(!isNaN(o)&&!isNaN(u)){let b=u-o;u>o&&b>180?b-=360:u<o&&o-u>180&&(b+=360),y=o+n*b}else isNaN(o)?isNaN(u)?y=NaN:(y=u,(s===1||s===0)&&(m=c)):(y=o,(p===1||p===0)&&(m=a));let[h,g,d,x]=Th([y,m??wt(a,c,n),wt(s,p,n),wt(l,f,n)]);return new t(h,g,d,x,!1)}case"lab":{let[o,a,s,l]=ec(vr(e.lab,r.lab,n));return new t(o,a,s,l,!1)}}}};H.black=new H(0,0,0,1);H.white=new H(1,1,1,1);H.transparent=new H(0,0,0,0);H.red=new H(1,0,0,1);var ln=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Fh=["bottom","center","top"],un=class{constructor(e,r,n,i,o,a){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o,this.verticalAlign=a}},Ee=class t{constructor(e){this.sections=e}static fromString(e){return new t([new un(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Oe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Ge=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Pe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=H.parse(e);return n?new t([n]):void 0}if(!Array.isArray(e))return;let r=[];for(let n of e){if(typeof n!="string")return;let i=H.parse(n);if(!i)return;r.push(i)}return new t(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n,i="rgb"){let o=[];if(e.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)o.push(H.interpolate(e.values[a],r.values[a],n,i));return new t(o)}},ne=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},Dh=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Me=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Dh.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){let i=e.values,o=r.values;if(i.length!==o.length)throw new ne(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new ne(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${o[s]}`);a.push(i[s]);let[l,u]=i[s+1],[c,p]=o[s+1];a.push([wt(l,c,n),wt(u,p,n)])}return new t(a)}},Se=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},At=class t{constructor(e,r,n){this.from=e,this.to=r,this.transition=n}static interpolate(e,r,n){return new t(e,r,n)}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new t(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new t(e.from,e.to,e.transition);if(typeof e=="string")return new t(e,e,1)}};function tc(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function cn(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof At||t instanceof H||t instanceof ln||t instanceof Ee||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Me||t instanceof Se)return!0;if(Array.isArray(t)){for(let e of t)if(!cn(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!cn(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return wr;if(typeof t=="string")return $;if(typeof t=="boolean")return U;if(typeof t=="number")return k;if(t instanceof H)return ze;if(t instanceof At)return yo;if(t instanceof ln)return mo;if(t instanceof Ee)return Ar;if(t instanceof Oe)return ho;if(t instanceof Ge)return go;if(t instanceof Pe)return an;if(t instanceof Me)return bo;if(t instanceof Se)return vn;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=N;break}}return Ce(r||N,e)}else return Wt}function on(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof H||t instanceof At||t instanceof Ee||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Me||t instanceof Se?t.toString():JSON.stringify(t)}var _t=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!cn(e[1]))return r.error("invalid value");let n=e[1],i=ue(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Ji={string:$,number:k,boolean:U,object:Wt},$e=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in Ji)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ji[u],n++}else s=N;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],n++}i=Ce(s,l)}else{if(!Ji[o])throw new Error(`Types doesn\'t contain name = ${o}`);i=Ji[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,N);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(sn(this.type,ue(n))){if(r===this.args.length-1)throw new ne(`Expected value to be of type ${ie(this.type)}, but found ${ie(ue(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ku={"to-boolean":U,"to-color":ze,"to-number":k,"to-string":$},St=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!ku[n])throw new Error(`Can\'t parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=ku[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,N);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof H)return r;if(typeof r=="string"){let o=e.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n=`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=tc(r[0],r[1],r[2],r[3]),!n))return new H(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ne(n||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Oe.parse(r);if(i)return i}throw new ne(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"numberArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ge.parse(r);if(i)return i}throw new ne(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Pe.parse(r);if(i)return i}throw new ne(`Could not parse colorArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=Me.parse(r);if(i)return i}throw new ne(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new ne(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ee.fromString(on(this.args[0].evaluate(e)));case"resolvedImage":return Se.fromString(on(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return on(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Vh=["Unknown","Point","LineString","Polygon"],eo=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Vh[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache.get(e);return r||(r=H.parse(e),this._parseColorCache.set(e,r)),r}},to=class t{constructor(e,r,n=[],i,o=new vs,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${s}]`).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new $e(o,[i]):a==="coerce"?new St(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof _t)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new eo;try{a=new _t(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new Be(n,e))}checkSubtype(e,r){let n=sn(e,r);return n&&this.error(n),n}},ro=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error(`Expected string, but found ${typeof a} instead.`,o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},no=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Ps=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,k),i=r.parse(e[2],2,Ce(r.expectedType||N));if(!n||!i)return null;let o=i.type;return new t(o.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new ne(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new ne(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new ne(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ss=class t{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);return!n||!i?null:zs(n.type,[U,$,k,wr,N])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);if(!Xt(n,["string","array"]))throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},ws=class t{constructor(e,r,n){this.type=k,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);if(!n||!i)return null;if(!zs(n.type,[U,$,k,wr,N]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n,i,o):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Xt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Xt(n,["array"]))return n.indexOf(r,i);throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},As=class t{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(e[1],1,N);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(ue(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},_s=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new t(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},Is=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,k);if(!n||!i)return null;if(!zs(n.type,[Ce(N),$,N]))return r.error(`Expected first argument to be of type array or string, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n.type,n,i,o):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),Xt(r,["string"]))return[...r].slice(n,i).join("");if(Xt(r,["array"]))return r.slice(n,i);throw new ne(`Expected first argument to be of type array or string, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function xo(t,e){let r=t.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=t[o],s=t[o+1],a<=e){if(o===r||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new ne("Input is not a number.");return 0}var Pr=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new t(o,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=xo(r,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Bh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hs,Eu;function Rh(){if(Eu)return hs;Eu=1,hs=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<r)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<r));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},hs}var zh=Rh(),Oh=Bh(zh),ke=class t{constructor(e,r,n,i,o){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let o=0;if(e.name==="exponential")o=ds(r,e.base,n,i);else if(e.name==="linear")o=ds(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Oh(a[0],a[1],a[2],a[3]).solve(ds(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,k),!o)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=an?l=ze:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Pt(l,k)&&!Pt(l,yo)&&!Pt(l,ze)&&!Pt(l,ho)&&!Pt(l,go)&&!Pt(l,an)&&!Pt(l,bo)&&!Pt(l,Ce(k))?r.error(`Type ${ie(l)} is not interpolatable.`):new t(l,n,i,o,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=xo(r,i),s=r[a],l=r[a+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return wt(c,p,u);case"color":return H.interpolate(c,p,u);case"padding":return Oe.interpolate(c,p,u);case"colorArray":return Pe.interpolate(c,p,u);case"numberArray":return Ge.interpolate(c,p,u);case"variableAnchorOffsetCollection":return Me.interpolate(c,p,u);case"array":return vr(c,p,u);case"projectionDefinition":return At.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"hcl");case"colorArray":return Pe.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"lab");case"colorArray":return Pe.interpolate(c,p,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function ds(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var lt={color:H.interpolate,number:wt,padding:Oe.interpolate,numberArray:Ge.interpolate,colorArray:Pe.interpolate,variableAnchorOffsetCollection:Me.interpolate,array:vr},io=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>sn(i,s.type))?new t(N,o):new t(n,o)}evaluate(e){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof Se&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Mu(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Gh(t,e,r){return e===r}function Nh(t,e,r){return e!==r}function Uh(t,e,r){return e<r}function $h(t,e,r){return e>r}function jh(t,e,r){return e<=r}function qh(t,e,r){return e>=r}function rc(t,e,r,n){return n.compare(e,r)===0}function Wh(t,e,r,n){return!rc(t,e,r,n)}function Xh(t,e,r,n){return n.compare(e,r)<0}function Hh(t,e,r,n){return n.compare(e,r)>0}function Zh(t,e,r,n){return n.compare(e,r)<=0}function Jh(t,e,r,n){return n.compare(e,r)>=0}function _r(t,e,r){let n=t!=="=="&&t!=="!=";return class nc{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,N);if(!l)return null;if(!Mu(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type \'${ie(l.type)}\'.`);let u=a.parse(o[2],2,N);if(!u)return null;if(!Mu(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type \'${ie(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types \'${ie(l.type)}\' and \'${ie(u.type)}\'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new $e(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new $e(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,mo),!c)return null}return new nc(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ne(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var Yh=_r("==",Gh,rc),Kh=_r("!=",Nh,Wh),Qh=_r("<",Uh,Xh),ed=_r(">",$h,Hh),td=_r("<=",jh,Zh),rd=_r(">=",qh,Jh),oo=class t{constructor(e,r,n){this.type=mo,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,$),!a)?null:new t(i,o,a)}evaluate(e){return new ln(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},Ts=class t{constructor(e,r,n,i,o){this.type=$,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,$),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,$),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,k),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,k),!l)?null:new t(n,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},pn=class t{constructor(e){this.type=Ar,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,k),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ce($)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Fh.includes(s["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${s["vertical-align"]}\' instead.`);if(p=r.parse(s["vertical-align"],1,$),!p)return null}let f=i[i.length-1];f.scale=l,f.font=u,f.textColor=c,f.verticalAlign=p}else{let l=r.parse(e[a],1,N);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return ue(i)===vn?new un("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new un(on(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new Ee(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}},Cs=class t{constructor(e){this.type=vn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,$);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Se.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},ks=class t{constructor(e){this.type=k,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ie(n.type)} instead.`):new t(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ne(`Expected value to be of type string or array, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},He=8192;function nd(t,e){let r=id(t[0]),n=ad(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*He),Math.round(n*i*He)]}function Os(t,e){let r=Math.pow(2,e.z),n=(t[0]/He+e.x)/r,i=(t[1]/He+e.y)/r;return[od(n),sd(i)]}function id(t){return(180+t)/360}function od(t){return t*360-180}function ad(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function sd(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Pn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function fn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ld(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function ud(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function vo(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return yd(o,i)===0?!1:!!(Lu(t,e,r,n)&&Lu(r,n,t,e))}function cd(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(vo(t,e,n[i],n[i+1]))return!0;return!1}function Ir(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(ud(t,i[o],i[o+1]))return r;ld(t,i[o],i[o+1])&&(n=!n)}return n}function pd(t,e){for(let r of e)if(Ir(t,r))return!0;return!1}function ic(t,e){for(let r of t)if(!Ir(r,e))return!1;for(let r=0;r<t.length-1;++r)if(cd(t[r],t[r+1],e))return!1;return!0}function fd(t,e){for(let r of e)if(ic(t,r))return!0;return!1}function yd(t,e){return t[0]*e[1]-t[1]*e[0]}function Lu(t,e,r,n){let i=t[0]-r[0],o=t[1]-r[1],a=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function Gs(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=[];for(let a=0;a<t[i].length;a++){let s=nd(t[i][a],r);Pn(e,s),o.push(s)}n.push(o)}return n}function oc(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Gs(t[i],e,r);n.push(o)}return n}function ac(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;o===0&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}Pn(e,t)}function md(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Fu(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];ac(u,e,r,i),a.push(u)}return a}function Du(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Pn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){md(e);for(let s of a)for(let l of s)ac(l,e,r,i)}return a}function hd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Gs(e.coordinates,n,i),a=Fu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!Ir(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Fu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!pd(s,o))return!1}return!0}function dd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Gs(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!ic(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!fd(s,o))return!1}return!0}var yn=class t{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new t(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return hd(e,this.geometries);if(e.geometryType()==="LineString")return dd(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},ao=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};function sc(t,e,r=0,n=t.length-1,i=gd){for(;n>r;){if(n-r>600){let l=n-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),y=Math.max(r,Math.floor(e-u*p/l+f)),m=Math.min(n,Math.floor(e+(l-u)*p/l+f));sc(t,e,y,m,i)}let o=t[e],a=r,s=n;for(rn(t,r,e),i(t[n],o)>0&&rn(t,r,n);a<s;){for(rn(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?rn(t,r,s):(s++,rn(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function rn(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function gd(t,e){return t<e?-1:t>e?1:0}function Yt(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=xd(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(sc(n[a],e,1,n[a].length-1,bd),n[a]=n[a].slice(0,e));return n}function bd(t,e){return e.area-t.area}function xd(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}var vd=6378.137,Vu=1/298.257223563,Bu=Vu*(2-Vu),Ru=Math.PI/180,mn=class{constructor(e){let r=Ru*vd*1e3,n=Math.cos(e*Ru),i=1/(1-Bu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-Bu)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,f=(e[l+1][1]-c)*this.ky,y=0;(p!==0||f!==0)&&(y=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*f)/(p*p+f*f),y>1?(u=e[l+1][0],c=e[l+1][1]):y>0&&(u+=p/this.kx*y,c+=f/this.ky*y)),p=this.wrap(r[0]-u)*this.kx,f=(r[1]-c)*this.ky;let m=p*p+f*f;m<n&&(n=m,i=u,o=c,a=l,s=y)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Es=100,Ms=50;function lc(t,e){return e[0]-t[0]}function so(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function Ls(t,e){if(t[0]>t[1])return[null,null];let r=so(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Fs(t,e){if(!st(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Pn(r,t[n]);return r}function Ds(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Pn(e,n);return e}function zu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ns(t,e,r){if(!zu(t)||!zu(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function qt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Us(t,e,r,n,i){let o=Math.min(qt(t,[r,n],i),qt(e,[r,n],i)),a=Math.min(qt(r,[t,e],i),qt(n,[t,e],i));return Math.min(o,a)}function Pd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],f=r[c+1];if(vo(l,u,p,f))return 0;a=Math.min(a,Us(l,u,p,f,i))}}return a}function Sd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(t[s],r[l])),a===0)return a;return a}function wd(t,e,r){if(Ir(t,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,qt(t,[a,o],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function Ad(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Ir(t[o],r,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=t[o],s=t[o+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let f=l[p],y=l[u];if(vo(a,s,f,y))return 0;i=Math.min(i,Us(a,s,f,y,n))}}return i}function Ou(t,e){for(let r of t)for(let n of r)if(Ir(n,e,!0))return!0;return!1}function _d(t,e,r,n=1/0){let i=Ds(t),o=Ds(e);if(n!==1/0&&Ns(i,o,r)>=n)return n;if(fn(i,o)){if(Ou(t,e))return 0}else if(Ou(e,t))return 0;let a=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],f=s[l];for(let y of e)for(let m=0,h=y.length,g=h-1;m<h;g=m++){let d=y[g],x=y[m];if(vo(p,f,d,x))return 0;a=Math.min(a,Us(p,f,d,x,r))}}return a}function Gu(t,e,r,n,i,o){if(!o)return;let a=Ns(Fs(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function Yi(t,e,r,n,i,o,a){if(!o||!a)return;let s=Ns(Fs(n,o),Fs(i,a),r);s<e&&t.push([s,o,a])}function lo(t,e,r,n,i=1/0){let o=Math.min(n.distance(t[0],r[0][0]),i);if(o===0)return o;let a=new ao([[0,[0,t.length-1],[0,0]]],lc),s=Ds(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Ms:Es;if(so(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Ad(t,u,r,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let f=wd(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=Ls(u,e);Gu(a,o,n,t,s,p[0]),Gu(a,o,n,t,s,p[1])}}return o}function uo(t,e,r,n,i,o=1/0){let a=Math.min(o,i.distance(t[0],r[0]));if(a===0)return a;let s=new ao([[0,[0,t.length-1],[0,r.length-1]]],lc);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Ms:Es,f=n?Ms:Es;if(so(u)<=p&&so(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Pd(t,u,r,c,i),a=Math.min(a,y);else if(e&&!n){let m=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(y=qt(r[h],m,i),a=Math.min(a,y),a===0)return a}else if(!e&&n){let m=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(y=qt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=Sd(t,u,r,c,i),a=Math.min(a,y)}else{let y=Ls(u,e),m=Ls(c,n);Yi(s,a,i,t,r,y[0],m[0]),Yi(s,a,i,t,r,y[0],m[1]),Yi(s,a,i,t,r,y[1],m[0]),Yi(s,a,i,t,r,y[1],m[1])}}return a}function Id(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Td(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Cd(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Yt(r,0).map(a=>a.map(s=>s.map(l=>Os([l.x,l.y],t.canonical)))),i=new mn(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,lo([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,lo(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,_d(s,a.coordinates,i,o));break}if(o===0)return o}return o}function gs(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var hn=class t{constructor(e,r){this.type=k,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>gs(i.geometry)).flat());if(n.type==="Feature")return new t(n,gs(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,gs(n))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Id(e,this.geometries);if(e.geometryType()==="LineString")return Td(e,this.geometries);if(e.geometryType()==="Polygon")return Cd(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},dn=class t{constructor(e){this.type=N,this.key=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?r.error("Global state property must be defined."):typeof n!="string"?r.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new t(n)}evaluate(e){var r;let n=(r=e.globals)===null||r===void 0?void 0:r.globalState;return!n||Object.keys(n).length===0?null:nn(n,this.key)}eachChild(){}outputDefined(){return!1}},Kt={"==":Yh,"!=":Kh,">":ed,"<":Qh,">=":rd,"<=":td,array:$e,at:Ps,boolean:$e,case:_s,coalesce:io,collator:oo,format:pn,image:Cs,in:Ss,"index-of":ws,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:ks,let:ro,literal:_t,match:As,number:$e,"number-format":Ts,object:$e,slice:Is,step:Pr,string:$e,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:no,within:yn,distance:hn,"global-state":dn},Ze=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new to(r.registry,co,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],h=Array.isArray(u)?u[y-1]:u.type,g=l.parse(m,1+p.length,h);if(!g){f=!0;break}p.push(g)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new t(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Ed(f)).join(" | "),p=[];for(let f=1;f<e.length;f++){let y=r.parse(e[f],1+p.length);if(!y)return null;p.push(ie(y.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function Nu(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let o=i?i.evaluate(t):1,a=tc(e,r,n,o);if(a)throw new ne(a);return new H(e/255,r/255,n/255,o,!1)}function Uu(t,e){return t in e}function bs(t,e){let r=e[t];return typeof r>"u"?null:r}function kd(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function jt(t){return{type:t}}Ze.register(Kt,{error:[Ph,[$],(t,[e])=>{throw new ne(e.evaluate(t))}],typeof:[$,[N],(t,[e])=>ie(ue(e.evaluate(t)))],"to-rgba":[Ce(k,4),[ze],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[k,k,k],Nu],rgba:[ze,[k,k,k,k],Nu],has:{type:U,overloads:[[[$],(t,[e])=>Uu(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>Uu(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[$],(t,[e])=>bs(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>bs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[$],(t,[e])=>bs(e.evaluate(t),t.featureState||{})],properties:[Wt,[],t=>t.properties()],"geometry-type":[$,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],"heatmap-density":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],"line-progress":[k,[],t=>t.globals.lineProgress||0],accumulated:[N,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[k,jt(k),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[k,jt(k),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},"/":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,jt(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,jt(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[$,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[$],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[N],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ce($)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ce(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[$,Ce(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[$,Ce(N)],(t,[e,r])=>kd(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[jt(U),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[jt(U),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[$],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[$,[$],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[$,[$],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[$,jt(N),(t,e)=>e.map(r=>on(r.evaluate(t))).join("")],"resolved-locale":[$,[mo],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Ed(t){return Array.isArray(t)?`(${t.map(ie).join(", ")})`:`(${ie(t.type)}...)`}function co(t){if(t instanceof no)return co(t.boundExpression);if(t instanceof Ze&&t.name==="error")return!1;if(t instanceof oo)return!1;if(t instanceof yn)return!1;if(t instanceof hn)return!1;if(t instanceof dn)return!1;let e=t instanceof St||t instanceof $e,r=!0;return t.eachChild(n=>{e?r=r&&co(n):r=r&&n instanceof _t}),r?Po(t)&&So(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Po(t){if(t instanceof Ze){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof yn||t instanceof hn)return!1;let e=!0;return t.eachChild(r=>{e&&!Po(r)&&(e=!1)}),e}function gn(t){if(t instanceof Ze&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!gn(r)&&(e=!1)}),e}function So(t,e){if(t instanceof Ze&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!So(n,e)&&(r=!1)}),r}function Vs(t){return{result:"success",value:t}}function gr(t){return{result:"error",value:t}}function It(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function uc(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function $s(t){return!!t.expression&&t.expression.interpolated}function j(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function wo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ue(t)===Wt}function Md(t){return t}function Ld(t){switch(t.type){case"color":return H.parse;case"padding":return Oe.parse;case"numberArray":return Ge.parse;case"colorArray":return Pe.parse;default:return null}}function Fd(t){switch(t){case"exponential":return pc;case"interval":return Vd;case"categorical":return Dd;case"identity":return Bd;default:throw new Error(`Unknown function type "${t}"`)}}function cc(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||($s(e)?"exponential":"interval"),a=Ld(e);if(a&&(t=xr({},t),t.stops&&(t.stops=t.stops.map(c=>[c[0],a(c[1])])),t.default?t.default=a(t.default):t.default=a(e.default)),t.colorSpace&&!Lh(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=Fd(o),l,u;if(o==="categorical"){l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}if(r){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],g=h[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:t.type,property:t.property,default:t.default,stops:[]},p.push(g)),c[g].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,cc(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:ke.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return pc({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(i){let c=o==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:ke.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[t.property]:void 0;return f===void 0?Sn(t.default,e.default):s(t,e,f,l,u)}}}function Sn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Dd(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return Sn(o,t.default,e.default)}function Vd(t,e,r){if(j(r)!=="number")return Sn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=xo(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function pc(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return Sn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let o=xo(t.stops.map(c=>c[0]),r),a=Rd(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=lt[e.type]||Md;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,t.colorSpace)}}:u(s,l,a,t.colorSpace)}function Bd(t,e,r){switch(e.type){case"color":r=H.parse(r);break;case"formatted":r=Ee.fromString(r.toString());break;case"resolvedImage":r=Se.fromString(r.toString());break;case"padding":r=Oe.parse(r);break;case"colorArray":r=Pe.parse(r);break;case"numberArray":r=Ge.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return Sn(r,t.default,e.default)}function Rd(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Ht=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new eo,this._defaultValue=r?Od(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ne(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function wn(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Kt}function Qt(t,e){let r=new to(Kt,co,[],e?zd(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Vs(new Ht(n,e)):gr(r.errors)}var Je=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!gn(r.expression),this.globalStateRefs=Ao(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}},Tt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!gn(r.expression),this.globalStateRefs=Ao(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}interpolationFactor(e,r,n){return this.interpolationType?ke.interpolationFactor(this.interpolationType,e,r,n):0}};function fc(t){return t._styleExpression!==void 0}function yc(t,e){let r=Qt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Po(n);if(!i&&!It(e))return gr([new Be("","data expressions not supported")]);let o=So(n,["zoom"]);if(!o&&!uc(e))return gr([new Be("","zoom expressions not supported")]);let a=Qi(n);if(!a&&!o)return gr([new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Be)return gr([a]);if(a instanceof ke&&!$s(e))return gr([new Be("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return Vs(i?new Je("constant",r.value):new Je("source",r.value));let s=a instanceof ke?a.interpolation:void 0;return Vs(i?new Tt("camera",r.value,a.labels,s):new Tt("composite",r.value,a.labels,s))}var bn=class t{constructor(e,r){this._parameters=e,this._specification=r,xr(this,cc(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function mc(t,e){if(wo(t))return new bn(t,e);if(wn(t)){let r=yc(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${n.message}`).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=H.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Oe.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=Ge.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=Pe.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=Me.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=At.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function Qi(t){let e=null;if(t instanceof ro)e=Qi(t.result);else if(t instanceof io){for(let r of t.args)if(e=Qi(r),e)break}else(t instanceof Pr||t instanceof ke)&&t.input instanceof Ze&&t.input.name==="zoom"&&(e=t);return e instanceof Be||t.eachChild(r=>{let n=Qi(r);n instanceof Be?e=n:!e&&n?e=new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new Be("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function Ao(t,e=new Set){return t instanceof dn&&e.add(t.key),t.eachChild(r=>{Ao(r,e)}),e}function zd(t){let e={color:ze,string:$,number:k,enum:$,boolean:U,formatted:Ar,padding:ho,numberArray:go,colorArray:an,projectionDefinition:yo,resolvedImage:vn,variableAnchorOffsetCollection:bo};return t.type==="array"?Ce(e[t.value]||N,t.length):e[t.type]}function Od(t){if(t.type==="color"&&wo(t.default))return new H(0,0,0,0);switch(t.type){case"color":return H.parse(t.default)||null;case"padding":return Oe.parse(t.default)||null;case"numberArray":return Ge.parse(t.default)||null;case"colorArray":return Pe.parse(t.default)||null;case"variableAnchorOffsetCollection":return Me.parse(t.default)||null;case"projectionDefinition":return At.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function js(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!js(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Gd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ct(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};js(t)||(t=po(t));let e=Qt(t,Gd);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=hc(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>Ao(e.value.expression)}}}function Nd(t,e){return t<e?-1:t>e?1:0}function hc(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(hc(t[e]))return!0;return!1}function po(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?xs(t[1],t[2],"=="):e==="!="?Ki(xs(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xs(t[1],t[2],e):e==="any"?Ud(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(po)):e==="none"?["all"].concat(t.slice(1).map(po).map(Ki)):e==="in"?$u(t[1],t.slice(2)):e==="!in"?Ki($u(t[1],t.slice(2))):e==="has"?ju(t[1]):e==="!has"?Ki(ju(t[1])):!0}function xs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Ud(t){return["any"].concat(t.map(po))}function $u(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Nd)]]:["filter-in-small",t,["literal",e]]}}function ju(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ki(t){return["!",t]}function Bs(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t===void 0||t===null)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let o of t)i+=`${Bs(o)},`;return`${i}]`}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+=`${JSON.stringify(r[i])}:${Bs(t[r[i]])},`;return`${n}}`}function $d(t){let e="";for(let r of vh)e+=`/${Bs(t[r])}`;return e}function dc(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||$d(t[i]);e&&(e[t[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(t[i])}let n=[];for(let i in r)n.push(r[i]);return n}function gc(t){let e=t.key,r=t.value;return r?[new C(e,r,"constants have been deprecated as of v8")]:[]}function le(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Zt(t){if(Array.isArray(t))return t.map(Zt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Zt(t[r]);return e}return le(t)}function Re(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec,l=[],u=j(r);if(u!=="object")return[new C(e,r,`object expected, ${u} found`)];for(let c in r){let p=c.split(".")[0],f=nn(n,p)||n["*"],y;if(nn(i,p))y=i[p];else if(nn(n,p))y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new C(e,r[c],`unknown property "${c}"`));continue}l=l.concat(y({key:(e&&`${e}.`)+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new C(e,r,`missing required property "${c}"`));return l}function qs(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.key,s=t.arrayElementValidator||n;if(j(e)!=="array")return[new C(a,e,`array expected, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new C(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new C(a,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:`${a}[${c}]`}));return u}function _o(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new C(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new C(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new C(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function bc(t){let e=t.valueSpec,r=le(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=j(t.value.stops)==="array"&&j(t.value.stops[0])==="array"&&j(t.value.stops[0][0])==="object",c=Re({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new C(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new C(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!$s(t.valueSpec)&&c.push(new C(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!It(t.valueSpec)?c.push(new C(t.key,t.value,"property functions not supported")):s&&!uc(t.valueSpec)&&c.push(new C(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new C(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new C(h.key,h.value,\'identity function may not have a "stops" property\')];let g=[],d=h.value;return g=g.concat(qs({key:h.key,value:d,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(d)==="array"&&d.length===0&&g.push(new C(h.key,d,"array must have at least one stop")),g}function f(h){let g=[],d=h.value,x=h.key;if(j(d)!=="array")return[new C(x,d,`array expected, ${j(d)} found`)];if(d.length!==2)return[new C(x,d,`array length 2 expected, length ${d.length} found`)];if(u){if(j(d[0])!=="object")return[new C(x,d,`object expected, ${j(d[0])} found`)];if(d[0].zoom===void 0)return[new C(x,d,"object stop key must have zoom")];if(d[0].value===void 0)return[new C(x,d,"object stop key must have value")];if(a&&a>le(d[0].zoom))return[new C(x,d[0].zoom,"stop zoom values must appear in ascending order")];le(d[0].zoom)!==a&&(a=le(d[0].zoom),o=void 0,i={}),g=g.concat(Re({key:`${x}[0]`,value:d[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:_o,value:y}}))}else g=g.concat(y({key:`${x}[0]`,value:d[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},d));return wn(Zt(d[1]))?g.concat([new C(`${x}[1]`,d[1],"expressions are not allowed in function stops.")]):g.concat(h.validateSpec({key:`${x}[1]`,value:d[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,g){let d=j(h.value),x=le(h.value),b=h.value!==null?h.value:g;if(!n)n=d;else if(d!==n)return[new C(h.key,b,`${d} stop domain type must match previous stop domain type ${n}`)];if(d!=="number"&&d!=="string"&&d!=="boolean")return[new C(h.key,b,"stop domain value must be a number, string, or boolean")];if(d!=="number"&&r!=="categorical"){let v=`number expected, ${d} found`;return It(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new C(h.key,b,v)]}return r==="categorical"&&d==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new C(h.key,b,`integer expected, found ${x}`)]:r!=="categorical"&&d==="number"&&o!==void 0&&x<o?[new C(h.key,b,"stop domain values must appear in ascending order")]:(o=x,r==="categorical"&&x in i?[new C(h.key,b,"stop domain values must be unique")]:(i[x]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function Sr(t){let e=(t.expressionContext==="property"?yc:Qt)(Zt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new C(`${t.key}${n.key}`,t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new C(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!So(r,["zoom","feature-state"]))return[new C(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Po(r))return[new C(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function jd(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new C(r,e,`boolean expected, ${n} found`)]:[]}function Rs(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new C(e,r,`color expected, ${n} found`)]:H.parse(String(r))?[]:[new C(e,r,`color expected, "${r}" found`)]}function xn(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Ws(t){return js(Zt(t.value))?Sr(xr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(t)}function xc(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new C(r,e,`array expected, ${j(e)} found`)];let n=t.styleSpec,i,o=[];if(e.length<1)return[new C(r,e,"filter array must have at least 1 element")];switch(o=o.concat(xn({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),le(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&le(e[1])==="$type"&&o.push(new C(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new C(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=j(e[a]),le(e[1])==="$type"?o=o.concat(xn({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new C(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(xc({key:`${r}[${a}]`,value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new C(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`));break}return o}function vc(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new C(r,a,`unknown property "${s}"`)];let p;if(j(a)==="string"&&It(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new C(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \\`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\\`.`)];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new C(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&wo(Zt(a))&&le(a.type)==="identity"&&f.push(new C(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Pc(t){return vc(t,"paint")}function Sc(t){return vc(t,"layout")}function wc(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;if(j(r)!=="object")return[new C(n,r,`object expected, ${j(r)} found`)];!r.type&&!r.ref&&e.push(new C(n,r,\'either "type" or "ref" is required\'));let a=le(r.type),s=le(r.ref);if(r.id){let l=le(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];le(c.id)===l&&e.push(new C(n,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new C(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{le(u.id)===s&&(l=u)}),l?l.ref?e.push(new C(n,r.ref,"ref cannot reference another ref layer")):a=le(l.type):e.push(new C(n,r.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!r.source)e.push(new C(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&le(l.type);l?u==="vector"&&a==="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&a==="color-relief"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new C(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new C(n,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new C(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new C(n,r.source,`source "${r.source}" not found`))}return e=e.concat(Re({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Ws,layout(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Sc(xr({layerType:a},u))}}})},paint(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Pc(xr({layerType:a},u))}}})}}})),e}function Jt(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new C(r,e,`string expected, ${n} found`)]:[]}function qd(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,o=i.source_raster_dem,a=t.style,s=[],l=j(n);if(n===void 0)return s;if(l!=="object")return s.push(new C("source_raster_dem",n,`object expected, ${l} found`)),s;let c=le(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let y in n)!c&&p.includes(y)?s.push(new C(y,n[y],`In "${r}": "${y}" is only valid when "encoding" is set to "custom". ${f} encoding found`)):o[y]?s=s.concat(t.validateSpec({key:y,value:n[y],valueSpec:o[y],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new C(y,n[y],`unknown property "${y}"`));return s}var qu={promoteId:Wd};function Ac(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new C(r,e,\'"type" is required\')];let a=le(e.type),s;switch(a){case"vector":case"raster":return s=Re({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:qu,validateSpec:o}),s;case"raster-dem":return s=qd({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Re({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:qu}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...Sr({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Sr({key:`${r}.${l}.reduce`,value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return Re({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Re({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new C(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Wd({key:t,value:e}){if(j(e)==="string")return Jt({key:t,value:e});{let r=[];for(let n in e)r.push(...Jt({key:`${t}.${n}`,value:e[n]}));return r}}function _c(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("light",e,`object expected, ${a} found`)]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],`unknown property "${s}"`)])}return o}function Ic(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("sky",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function Tc(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("terrain",e,`object expected, ${a} found`)]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],`unknown property "${s}"`)]);return o}function Xd(t){return Jt(t).length===0?[]:Sr(t)}function Hd(t){return Jt(t).length===0?[]:Sr(t)}function Zd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new C(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Jd(t){let e=t.key,r=t.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Yd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<r.length;o++)i=i.concat(Rs({key:`${e}[${o}]`,value:r[o]}));return i}else return Rs({key:e,value:r})}function Kd(t){let e=t.key,r=t.value,n=j(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new C(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(xn({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(qs({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function Cc(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&e.push(new C(n,r,`all the sprites\' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new C(n,r,`all the sprites\' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Re({key:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Jt({key:n,value:r})}function Qd(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("projection",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function eg(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=j(r);return n==="array"&&!rg(r)&&!tg(r)?[new C(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new C(e,r,`projection expected, invalid type "${n}" found`)]}function tg(t){return!!["interpolate","step","literal"].includes(t[0])}function rg(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function ng(t){return!!t&&t.constructor===Object}function kc(t){return ng(t.value)?[]:[new C(t.key,t.value,`object expected, ${j(t.value)} found`)]}var Wu={"*"(){return[]},array:qs,boolean:jd,number:_o,color:Rs,constants:gc,enum:xn,filter:Ws,function:bc,layer:wc,object:Re,source:Ac,light:_c,sky:Ic,terrain:Tc,projection:Qd,projectionDefinition:eg,string:Jt,formatted:Xd,resolvedImage:Hd,padding:Zd,numberArray:Jd,colorArray:Yd,variableAnchorOffsetCollection:Kd,sprite:Cc,state:kc};function fo(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=fo,r.expression&&wo(le(e))?bc(t):r.expression&&wn(Zt(e))?Sr(t):r.type&&Wu[r.type]?Wu[r.type](t):Re(xr({},t,{valueSpec:r.type?n[r.type]:r}))}function Ec(t){let e=t.value,r=t.key,n=Jt(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Le(t,e=P){let r=[];return r=r.concat(fo({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:fo,objectElementValidators:{glyphs:Ec,"*"(){return[]}}})),t.constants&&(r=r.concat(gc({key:"constants",value:t.constants}))),Mc(r)}Le.source=qe(je(Ac));Le.sprite=qe(je(Cc));Le.glyphs=qe(je(Ec));Le.light=qe(je(_c));Le.sky=qe(je(Ic));Le.terrain=qe(je(Tc));Le.state=qe(je(kc));Le.layer=qe(je(wc));Le.filter=qe(je(Ws));Le.paintProperty=qe(je(Pc));Le.layoutProperty=qe(je(Sc));function je(t){return function(e){return t({...e,validateSpec:fo})}}function Mc(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function qe(t){return function(...e){return Mc(t.apply(this,e))}}var Lc="AbortError";function Fc(t){return t.message===Lc}function Xs(){return new Error(Lc)}var Io={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dc(t){return Io.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Vc(t,e){Io.REGISTERED_PROTOCOLS[t]=e}function Bc(t){delete Io.REGISTERED_PROTOCOLS[t]}var Rc="global-dispatcher",er=class extends Error{constructor(e,r,n,i){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=i}},Oc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ig=t=>/^file:/.test(t)||/^file:/.test(Oc())&&!/^\\w+:/.test(t);async function og(t,e){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:Oc(),signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let n;try{n=await fetch(r)}catch(a){throw new er(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new er(n.status,n.statusText,t.url,a)}let i;t.type==="arrayBuffer"||t.type==="image"?i=n.arrayBuffer():t.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Xs();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function ag(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",t.headers?.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials=t.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new er(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Xs())}),i.send(t.body)})}var Gc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=Dc(t.url);if(r)return r(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Rc},e)}if(!ig(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return og(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Rc},e)}return ag(t,e)},Nc=(t,e)=>Gc(de(t,{type:"json"}),e),Uc=(t,e)=>Gc(de(t,{type:"arrayBuffer"}),e);var ut={};function I(t,e,r={}){if(ut[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ut[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I("Object",Object);I("Set",Set);I("TransferableGridIndex",$t);I("Color",H);I("Error",Error);I("AJAXError",er);I("ResolvedImage",Se);I("StylePropertyFunction",bn);I("StyleExpression",Ht,{omit:["_evaluator"]});I("ZoomDependentExpression",Tt);I("ZoomConstantExpression",Je);I("CompoundExpression",Ze,{omit:["_evaluate"]});for(let t in Kt)Kt[t]._classRegistryKey||I(`Expression_${t}`,Kt[t]);function $c(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function Hs(t){let e=t.constructor;return t.$name||e._classRegistryKey}function sg(t){if(t===null||typeof t!="object")return!1;let e=Hs(t);return!!(e&&e!=="Object")}function jc(t){return!sg(t)&&(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||$c(t)||vt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Tr(t,e){if(jc(t)){if(($c(t)||vt(t))&&e&&e.push(t),ArrayBuffer.isView(t)){let o=t;e&&e.push(o.buffer)}return t instanceof ImageData&&e&&e.push(t.data.buffer),t}if(Array.isArray(t)){let o=[];for(let a of t)o.push(Tr(a,e));return o}if(typeof t!="object")throw new Error(`can\'t serialize object of type ${typeof t}`);let r=Hs(t);if(!r)throw new Error(`can\'t serialize object of unregistered class ${t.constructor.name}`);if(!ut[r])throw new Error(`${r} is not registered.`);let{klass:n}=ut[r],i=n.serialize?n.serialize(t,e):{};if(n.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o)||ut[r].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=ut[r].shallow.indexOf(o)>=0?a:Tr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}function Cr(t){if(jc(t))return t;if(Array.isArray(t))return t.map(Cr);if(typeof t!="object")throw new Error(`can\'t deserialize object of type ${typeof t}`);let e=Hs(t)||"Object";if(!ut[e])throw new Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=ut[e];if(!r)throw new Error(`can\'t deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=ut[e].shallow.indexOf(i)>=0?o:Cr(o)}return n}var To=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var lg={once:!0},Co=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new To(()=>this.process()),this.subscription=us(this.target,"message",n=>this.receive(n),!1),this.globalScope=at(self)?e:window}registerMessageHandler(e,r){this.messageHandlers[e]=r}sendAsync(e,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=r?us(r.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[o];let u={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(u)},lg):null;this.resolveRejects[o]={resolve:u=>{a?.unsubscribe(),n(u)},reject:u=>{a?.unsubscribe(),i(u)}};let s=[],l={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:Tr(e.data,s)};this.target.postMessage(l,{transfer:s})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!=="resource://android"&&location.origin!=="resource://android"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(at(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(e,r)}async processTask(e,r){if(r.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;r.error?o.reject(Cr(r.error)):o.resolve(Cr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=Cr(r.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,r,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?Tr(r):null,data:Tr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function qc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Zs(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var ko=class{constructor(e,r={}){de(this,r),this.type=e}},An=class extends ko{constructor(e,r={}){super("error",de({error:e},r))}},Eo=class{on(e,r){return this._listeners=this._listeners||{},qc(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return Zs(e,r,this._listeners),Zs(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},qc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new ko(e,r||{}));let n=e.type;if(this.listens(n)){e.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)Zs(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(de(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof An&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}};var ct=Le,K0=ct.source,Q0=ct.light,ev=ct.sky,tv=ct.terrain,rv=ct.filter,Wc=ct.paintProperty,Xc=ct.layoutProperty;function Hc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new An(new Error(n.message))),r=!0;return r}var _n=class{constructor(){this.first=!0}update(e,r){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};var q={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function In(t){for(let e of t)if(Mo(e.charCodeAt(0)))return!0;return!1}function Zc(t){for(let e of t)if(!pg(e.charCodeAt(0)))return!1;return!0}function Js(t){let e=t.map(r=>{try{return new RegExp(`\\\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var ug=["Arab","Dupl","Mong","Ougr","Syrc"],cg=Js(ug);function pg(t){return!cg.test(String.fromCodePoint(t))}var fg=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],Jc=Js(fg);function Yc(t){return t<11904?!1:q["CJK Compatibility Forms"](t)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)||q["Enclosed CJK Letters and Months"](t)||q["Halfwidth and Fullwidth Forms"](t)||q["Ideographic Description Characters"](t)||q["Vertical Forms"](t)?!0:Jc.test(String.fromCodePoint(t))}function Mo(t){return t===746||t===747?!0:t<4352?!1:!!(q["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||q["Enclosed CJK Letters and Months"](t)||q["Ideographic Description Characters"](t)||q.Kanbun(t)||q.Katakana(t)&&t!==12540||q["Halfwidth and Fullwidth Forms"](t)&&t!==65288&&t!==65289&&t!==65293&&!(t>=65306&&t<=65310)&&t!==65339&&t!==65341&&t!==65343&&!(t>=65371&&t<=65503)&&t!==65507&&!(t>=65512&&t<=65519)||q["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||q["Vertical Forms"](t)||q["Yijing Hexagram Symbols"](t)||/\\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\\p{sc=Hang}/u.test(String.fromCodePoint(t))||Jc.test(String.fromCodePoint(t)))}function yg(t){return!!(q["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||q["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||q["Letterlike Symbols"](t)||q["Number Forms"](t)||q["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||q["Control Pictures"](t)&&t!==9251||q["Optical Character Recognition"](t)||q["Enclosed Alphanumerics"](t)||q["Geometric Shapes"](t)||q["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||q["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||q["CJK Symbols and Punctuation"](t)||q.Katakana(t)||q["Private Use Area"](t)||q["CJK Compatibility Forms"](t)||q["Small Form Variants"](t)||q["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function Ys(t){return!(Mo(t)||yg(t))}function Kc(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var mg=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],hg=Js(mg);function Qc(t){return hg.test(String.fromCodePoint(t))}function dg(t,e){return!(!e&&Qc(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||q.Khmer(t))}function ep(t){for(let e of t)if(Qc(e.charCodeAt(0)))return!0;return!1}function tp(t,e){for(let r of t)if(!dg(r.charCodeAt(0),e))return!1;return!0}var Ks=class{constructor(){this.TIMEOUT=5e3;this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null;this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(we.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,r){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let n=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s});r(n);let o=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await Promise.race([i,o]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:n};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}},we=new Ks;var W=class{constructor(e,r){this.zoom=e,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new _n,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _n,this.transition={},this.globalState={})}isSupportedScript(e){return tp(e,we.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var kr=class{constructor(e,r){this.property=e,this.value=r,this.expression=mc(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},Tn=class{constructor(e){this.property=e,this.value=new kr(e,void 0)}transitioned(e,r){return new Fo(this.property,this.value,r,de({},e.transition,this.transition),e.now)}untransitioned(){return new Fo(this.property,this.value,null,{},0)}},Lo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return nt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].value=new kr(this._values[e].property,r===null?void 0:nt(r))}getTransition(e){return nt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].transition=nt(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e[`${r}-transition`]=i)}return e}transitioned(e,r){let n=new Do(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,r._values[i]);return n}untransitioned(){let e=new Do(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Fo=class{constructor(e,r,n,i,o){this.property=e,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(e,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,r,n),o,Su(s))}}else return o}},Do=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},Vo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return nt(this._values[e].value)}setValue(e,r){this._values[e]=new kr(this._values[e].property,r===null?void 0:nt(r))}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},ge=class{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,i){return this.property.evaluate(this.value,this.parameters,e,r,n,i)}},kt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},E=class{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){let i=this.specification.type,o=lt[i];return o?o(e,r,n):e}},F=class{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new ge(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new ge(this,e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ge(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=lt[i];if(o){let a=o(e.value.value,r.value.value,n);return new ge(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,r,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(r,n,i,o,a)}},pt=class extends F{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new ge(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new ge(this,{kind:"constant",value:l},r)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ge(this,{kind:"constant",value:o},r)}else return new ge(this,e.expression,r)}evaluate(e,r,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,i),e.evaluate({zoom:Math.floor(r.zoom)},n,i),e.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):e.value}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},tr=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(e.expression.evaluate(new W(Math.floor(r.zoom-1),r)),e.expression.evaluate(new W(Math.floor(r.zoom),r)),e.expression.evaluate(new W(Math.floor(r.zoom+1),r)),r)}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},ft=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ee=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in e){let n=e[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new kr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Tn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",F);I("DataConstantProperty",E);I("CrossFadedDataDrivenProperty",pt);I("CrossFadedProperty",tr);I("ColorRampProperty",ft);var Bo="-transition",oe=class extends Eo{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ct(e.filter)),r.layout&&(this._unevaluatedLayout=new Vo(r.layout)),r.paint)){this._transitionablePaint=new Lo(r.paint);for(let n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(let n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new kt(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ct(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let r in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[r];for(let i of n.getGlobalStateRefs())e.add(i)}for(let r of this._featureFilter.getGlobalStateRefs())e.add(r);return e}setLayoutProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.layout.${e}`;if(this._validate(Xc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Bo)?this._transitionablePaint.getTransition(e.slice(0,-Bo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(Wc,i,e,r,n))return!1}if(e.endsWith(Bo))return this._transitionablePaint.setTransition(e.slice(0,-Bo.length),r||void 0),!1;{let i=this._transitionablePaint._values[e],o=i.property.specification["property-type"]==="cross-faded-data-driven",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),_u(e,(r,n)=>r!==void 0&&!(n==="layout"&&!Object.keys(r).length)&&!(n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,i,o={}){return o&&o.validate===!1?!1:Hc(this,e.call(ct,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:P,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof ge)||!It(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var gg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Et=class{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},bg=128,xg=5,te=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*xg),bg),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function Q(t,e=1){let r=0,n=0,i=t.map(a=>{let s=vg(a.type),l=r=rp(r,Math.max(e,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=rp(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function vg(t){return gg[t].BYTES_PER_ELEMENT}function rp(t,e){return Math.ceil(t/e)*e}var np=Y(ye(),1),rr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.int16[i+0]=r,this.int16[i+1]=n,e}};rr.prototype.bytesPerElement=4;I("StructArrayLayout2i4",rr);var Cn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=i,e}};Cn.prototype.bytesPerElement=6;I("StructArrayLayout3i6",Cn);var Ro=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};Ro.prototype.bytesPerElement=8;I("StructArrayLayout4i8",Ro);var kn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};kn.prototype.bytesPerElement=12;I("StructArrayLayout2i4i12",kn);var En=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=r,this.int16[l+1]=n,this.uint8[u+4]=i,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};En.prototype.bytesPerElement=8;I("StructArrayLayout2i4ub8",En);var Mt=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.float32[i+0]=r,this.float32[i+1]=n,e}};Mt.prototype.bytesPerElement=8;I("StructArrayLayout2f8",Mt);var Mn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,r,n,i,o,a,s,l,u,c)}emplace(e,r,n,i,o,a,s,l,u,c,p){let f=e*10;return this.uint16[f+0]=r,this.uint16[f+1]=n,this.uint16[f+2]=i,this.uint16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,e}};Mn.prototype.bytesPerElement=20;I("StructArrayLayout10ui20",Mn);var Ln=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f){let y=this.length;return this.resize(y+1),this.emplace(y,e,r,n,i,o,a,s,l,u,c,p,f)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y){let m=e*12;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=i,this.int16[m+3]=o,this.uint16[m+4]=a,this.uint16[m+5]=s,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=p,this.int16[m+10]=f,this.int16[m+11]=y,e}};Ln.prototype.bytesPerElement=24;I("StructArrayLayout4i4ui4i24",Ln);var Fn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=i,e}};Fn.prototype.bytesPerElement=12;I("StructArrayLayout3f12",Fn);var Dn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint32[n+0]=r,e}};Dn.prototype.bytesPerElement=4;I("StructArrayLayout1ul4",Dn);var Vn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,i,o,a,s,l,u)}emplace(e,r,n,i,o,a,s,l,u,c){let p=e*10,f=e*5;return this.int16[p+0]=r,this.int16[p+1]=n,this.int16[p+2]=i,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[f+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Vn.prototype.bytesPerElement=20;I("StructArrayLayout6i1ul2ui20",Vn);var Bn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Bn.prototype.bytesPerElement=12;I("StructArrayLayout2i2i2i12",Bn);var zo=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,n,i,o)}emplace(e,r,n,i,o,a){let s=e*4,l=e*8;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[l+6]=o,this.int16[l+7]=a,e}};zo.prototype.bytesPerElement=16;I("StructArrayLayout2f1f2i16",zo);var Rn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*16,u=e*4,c=e*8;return this.uint8[l+0]=r,this.uint8[l+1]=n,this.float32[u+1]=i,this.float32[u+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};Rn.prototype.bytesPerElement=16;I("StructArrayLayout2ub2f2i16",Rn);var zn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};zn.prototype.bytesPerElement=6;I("StructArrayLayout3ui6",zn);var On=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d){let x=this.length;return this.resize(x+1),this.emplace(x,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x){let b=e*24,v=e*12,S=e*48;return this.int16[b+0]=r,this.int16[b+1]=n,this.uint16[b+2]=i,this.uint16[b+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[S+36]=m,this.uint8[S+37]=h,this.uint8[S+38]=g,this.uint32[v+10]=d,this.int16[b+22]=x,e}};On.prototype.bytesPerElement=48;I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",On);var Gn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z){let L=this.length;return this.resize(L+1),this.emplace(L,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z,L){let _=e*32,B=e*16;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=i,this.int16[_+3]=o,this.int16[_+4]=a,this.int16[_+5]=s,this.int16[_+6]=l,this.int16[_+7]=u,this.uint16[_+8]=c,this.uint16[_+9]=p,this.uint16[_+10]=f,this.uint16[_+11]=y,this.uint16[_+12]=m,this.uint16[_+13]=h,this.uint16[_+14]=g,this.uint16[_+15]=d,this.uint16[_+16]=x,this.uint16[_+17]=b,this.uint16[_+18]=v,this.uint16[_+19]=S,this.uint16[_+20]=A,this.uint16[_+21]=w,this.uint16[_+22]=T,this.uint32[B+12]=M,this.float32[B+13]=D,this.float32[B+14]=V,this.uint16[_+30]=z,this.uint16[_+31]=L,e}};Gn.prototype.bytesPerElement=64;I("StructArrayLayout8i15ui1ul2f2ui64",Gn);var nr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.float32[n+0]=r,e}};nr.prototype.bytesPerElement=4;I("StructArrayLayout1f4",nr);var Nn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,e}};Nn.prototype.bytesPerElement=12;I("StructArrayLayout1ui2f12",Nn);var Un=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};Un.prototype.bytesPerElement=8;I("StructArrayLayout1ul2ui8",Un);var $n=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.uint16[i+0]=r,this.uint16[i+1]=n,e}};$n.prototype.bytesPerElement=4;I("StructArrayLayout2ui4",$n);var Oo=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint16[n+0]=r,e}};Oo.prototype.bytesPerElement=2;I("StructArrayLayout1ui2",Oo);var Er=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};Er.prototype.bytesPerElement=16;I("StructArrayLayout4f16",Er);var Go=class extends Et{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new np.default(this.anchorPointX,this.anchorPointY)}};Go.prototype.size=20;var jn=class extends Vn{get(e){return new Go(this,e)}};I("CollisionBoxArray",jn);var No=class extends Et{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};No.prototype.size=48;var qn=class extends On{get(e){return new No(this,e)}};I("PlacedSymbolArray",qn);var Uo=class extends Et{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};Uo.prototype.size=64;var Wn=class extends Gn{get(e){return new Uo(this,e)}};I("SymbolInstanceArray",Wn);var Xn=class extends nr{getoffsetX(e){return this.float32[e*1+0]}};I("GlyphOffsetArray",Xn);var Hn=class extends Cn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};I("SymbolLineVertexArray",Hn);var $o=class extends Et{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};$o.prototype.size=12;var Zn=class extends Nn{get(e){return new $o(this,e)}};I("TextAnchorOffsetArray",Zn);var jo=class extends Et{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};jo.prototype.size=8;var Jn=class extends Un{get(e){return new jo(this,e)}};I("FeatureIndexArray",Jn);var qo=class extends rr{};var Wo=class extends rr{},Xo=class extends rr{},Ho=class extends kn{};var Zo=class extends En{},Jo=class extends Mt{},yt=class extends Mn{},Yo=class extends Ln{},Ko=class extends Fn{},Qo=class extends Dn{},Yn=class extends Bn{};var ea=class extends Rn{};var Fe=class extends zn{},Lt=class extends $n{};var Pg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:ip,size:kv,alignment:Ev}=Pg;var pe=class t{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1;this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&ce(`Max vertices per segment is ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${t.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i?this.createNewSegment(r,n,i):o}createNewSegment(e,r,n){let i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(i.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,r,n){return this.prepareSegment(0,e,r,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,i){return new t([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};pe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;I("SegmentVector",pe);function Qs(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Kn=Q([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var up=Y(rl(),1);var Qn=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(lp(e)),this.positions.push(r,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=lp(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(e,r){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return nl(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let r=new t;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function lp(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,up.default)(String(t))}function nl(t,e,r,n){for(;r<n;){let i=t[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(t[o]<i);do a--;while(t[a]>i);if(o>=a)break;ra(t,o,a),ra(e,3*o,3*a),ra(e,3*o+1,3*a+1),ra(e,3*o+2,3*a+2)}a-r<n-a?(nl(t,e,r,a),r=a+1):(nl(t,e,a+1,n),n=a)}}function ra(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}I("FeaturePositionMap",Qn);var ei=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Mr=class extends ei{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var na=class extends ei{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},ia=class extends ei{constructor(e,r){super(e,r),this.current=H.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}};var qv=new Float32Array(16);function il(t){return[Qs(255*t.r,255*t.g),Qs(255*t.b,255*t.a)]}var ir=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new ia(e,r):new Mr(e,r)}},Ft=class{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new na(e,r):new Mr(e,r)}},We=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:`a_${o}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new W(0),r,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,r,o)}_setPaintValue(e,r,n){if(this.type==="color"){let i=il(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>`u_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${s}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new W(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new W(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(e,r,o,a)}_setPaintValue(e,r,n,i){if(this.type==="color"){let o=il(n),a=il(i);for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=it(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new Mr(e,r)}},Ye=class{constructor(e,r,n,i,o,a){this.expression=e,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,i,o){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=e;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Kn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Kn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},oa=class{constructor(e,r,n){this.binders={},this._buffers=[];let i=[];for(let o in e.paint._values){if(!n(o))continue;let a=e.paint.get(o);if(!(a instanceof ge)||!It(a.property.specification))continue;let s=_g(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new Ft(l.value,s):new ir(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||f){let y=cp(o,u,"source");this.binders[o]=f?new Ye(l,u,c,r,y,e.id):new We(l,s,u,y),i.push(`/a_${o}`)}else{let y=cp(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push(`/z_${o}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof We||r instanceof De?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof Ye)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof Ft&&i.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,i,o){let a=!1;for(let s in e){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof We||f instanceof De||f instanceof Ye)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let r in this.binders){let n=this.binders[r];(n instanceof ir||n instanceof Ft)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Ye)for(let i=0;i<Kn.members.length;i++)e.push(Kn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ir||n instanceof Ft||n instanceof De)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof ir||o instanceof Ft||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(e,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(e&&n instanceof Ye){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof Ye)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof We||r instanceof De||r instanceof Ye)&&r.destroy()}}},Ae=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new oa(i,r,n);this.needsUpload=!1,this._featureMap=new Qn,this._bufferOffset=0}populatePaintArrays(e,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,r,o,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function _g(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Ig(t){return{"line-pattern":{source:yt,composite:yt},"fill-pattern":{source:yt,composite:yt},"fill-extrusion-pattern":{source:yt,composite:yt}}[t]}function cp(t,e,r){let n={color:{source:Mt,composite:Er},number:{source:nr,composite:Mt}},i=Ig(t);return i&&i[r]||n[e][r]}I("ConstantBinder",ir);I("CrossFadedConstantBinder",Ft);I("SourceExpressionBinder",We);I("CrossFadedCompositeBinder",Ye);I("CompositeExpressionBinder",De);I("ProgramConfiguration",oa,{omit:["_buffers"]});I("ProgramConfigurationSet",Ae);var Tg=15,ol=Math.pow(2,Tg-1)-1,pp=-ol-1;function _e(t){let e=8192/t.extent,r=t.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=it(s,pp,ol),a.y=it(l,pp,ol),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ne(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?_e(t):[]}}var fp=-32768;function Cg(t,e,r,n,i){t.emplaceBack(fp+e*8+n,fp+r*8+i)}var or=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Wo,this.indexArray=new Fe,this.segments=new pe,this.programConfigurations=new Ae(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){let i=this.layers[0],o=[],a=null,s=!1,l=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),l=l||c.paint.get("circle-pitch-alignment")==="map"}let u=l?r.subdivisionGranularity.circle:1;for(let{feature:c,id:p,index:f,sourceLayerIndex:y}of e){let m=this.layers[0]._featureFilter.needGeometry,h=Ne(c,m);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),h,n))continue;let g=s?a.evaluate(h,{},n):void 0,d={id:p,properties:c.properties,type:c.type,sourceLayerIndex:y,index:f,geometry:m?h.geometry:_e(c),patterns:{},sortKey:g};o.push(d)}s&&o.sort((c,p)=>c.sortKey-p.sortKey);for(let c of o){let{geometry:p,index:f,sourceLayerIndex:y}=c,m=e[f].feature;this.addFeature(c,p,f,n,u),r.featureIndex.insert(m,p,f,y,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ip),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,i,o=1){let a;switch(o){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${o}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let l of r)for(let u of l){let c=u.x,p=u.y;if(c<0||c>=8192||p<0||p>=8192)continue;let f=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),y=f.vertexLength;for(let m=0;m<s;m++)for(let h=0;h<s;h++)Cg(this.layoutVertexArray,c,p,a[h],a[m]);for(let m=0;m<s-1;m++)for(let h=0;h<s-1;h++){let g=y+m*s+h,d=y+(m+1)*s+h;this.indexArray.emplaceBack(g,d+1,g+1),this.indexArray.emplaceBack(g,d,d+1)}f.vertexLength+=s*s,f.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};I("CircleBucket",or,{omit:["layers"]});var ti=Y(ye(),1);function mp(t,e){for(let r=0;r<t.length;r++)if(Lr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Lr(t,e[r]))return!0;return!!sl(t,e)}function hp(t,e,r){return!!(Lr(t,e)||al(e,t,r))}function aa(t,e){if(t.length===1)return yp(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Lr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(yp(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(sl(t,e[r]))return!0;return!1}function dp(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];if(t.length>=3){for(let o=0;o<i.length;o++)if(Lr(t,i[o]))return!0}if(kg(t,i,r))return!0}return!1}function kg(t,e,r){if(t.length>1){if(sl(t,e))return!0;for(let n=0;n<e.length;n++)if(al(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(al(t[n],e,r))return!0;return!1}function sl(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(Eg(n,i,a,s))return!0}}return!1}function Eg(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function al(t,e,r){let n=r*r;if(e.length===1)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(ll(t,o,a)<n)return!0}return!1}function ll(t,e,r){let n=e.distSqr(r);if(n===0)return t.distSqr(e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function yp(t,e){let r=!1,n,i,o;for(let a=0;a<t.length;a++){n=t[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>e.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function Lr(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){let o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function gp(t,e,r,n,i){for(let a of t)if(e<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new ti.default(e,r),new ti.default(e,i),new ti.default(n,i),new ti.default(n,r)];if(t.length>2){for(let a of o)if(Lr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(Mg(s,l,o))return!0}return!1}function Mg(t,e,r){let n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;let o=ot(t,e,r[0]);return o!==ot(t,e,r[1])||o!==ot(t,e,r[2])||o!==ot(t,e,r[3])}var sa=Y(ye(),1);function ar(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Dt(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Vt(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=sa.default.convert(e)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<t.length;s++){let l=t[s];a.push(l.sub(o))}return a}function bp(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new sa.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new sa.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(e)._add(l))}r.push(o)}return r}var xp,Lg=()=>xp=xp||new ee({"circle-sort-key":new F(P.layout_circle["circle-sort-key"])}),vp,Fg=()=>vp=vp||new ee({"circle-radius":new F(P.paint_circle["circle-radius"]),"circle-color":new F(P.paint_circle["circle-color"]),"circle-blur":new F(P.paint_circle["circle-blur"]),"circle-opacity":new F(P.paint_circle["circle-opacity"]),"circle-translate":new E(P.paint_circle["circle-translate"]),"circle-translate-anchor":new E(P.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new E(P.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new E(P.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new F(P.paint_circle["circle-stroke-width"]),"circle-stroke-color":new F(P.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new F(P.paint_circle["circle-stroke-opacity"])}),Pp={get paint(){return Fg()},get layout(){return Lg()}};var Sp=Y(ye(),1);var la=class extends oe{constructor(e){super(e,Pp)}createBucket(e){return new or(e)}queryRadius(e){let r=e;return ar("circle-radius",this,r)+ar("circle-stroke-width",this,r)+Dt(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=Vt(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("circle-radius").evaluate(r,n),p=this.paint.get("circle-stroke-width").evaluate(r,n),f=c+p,y=this.paint.get("circle-pitch-alignment")==="map",m=y?u:Dg(u,o,s,l),h=y?f*a:f;for(let g of i)for(let d of g){let x=y?d:wp(d,o,s,l),b=h,v=o.projectTileCoordinates(d.x,d.y,s,l).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=o.cameraToCenterDistance/v),hp(m,x,b))return!0}return!1}};function wp(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Sp.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function Dg(t,e,r,n){return t.map(i=>wp(i,e,r,n))}var ri=class extends or{};I("HeatmapBucket",ri,{omit:["layers"]});var Ap,Vg=()=>Ap=Ap||new ee({"heatmap-radius":new F(P.paint_heatmap["heatmap-radius"]),"heatmap-weight":new F(P.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new E(P.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ft(P.paint_heatmap["heatmap-color"]),"heatmap-opacity":new E(P.paint_heatmap["heatmap-opacity"])}),_p={get paint(){return Vg()}};function ul(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`);return t.width=e,t.height=r,t.data=i,t}function Ip(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=ul({},{width:e,height:r},n);cl(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function cl(t,e,r,n,i,o){if(i.width===0||i.height===0)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*t.width+r.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return e}var sr=class t{constructor(e,r){ul(this,e,1,r)}resize(e){Ip(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,1)}},fe=class t{constructor(e,r){ul(this,e,4,r)}resize(e){Ip(this,e,4)}replace(e,r){r?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,4)}setPixel(e,r,n){let i=(e*this.width+r)*4;this.data[i+0]=Math.round(n.r*255/n.a),this.data[i+1]=Math.round(n.g*255/n.a),this.data[i+2]=Math.round(n.b*255/n.a),this.data[i+3]=Math.round(n.a*255)}};I("AlphaImage",sr);I("RGBAImage",fe);function Tp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new fe({width:r,height:n});if(!Au(r))throw new Error(`width is not a power of 2 - ${r}`);let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.setPixel(a/4/r,s/4,u)};if(t.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=t.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var Cp="big-fb";var ua=class extends oe{createBucket(e){return new ri(e)}constructor(e){super(e,_p),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Tp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Cp)&&this.heatmapFbos.delete(Cp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var kp,Bg=()=>kp=kp||new ee({"hillshade-illumination-direction":new E(P.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new E(P.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new E(P.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new E(P.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new E(P.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new E(P.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new E(P.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new E(P.paint_hillshade["hillshade-method"])}),Ep={get paint(){return Bg()}};var ca=class extends oe{constructor(e){super(e,Ep),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,o=Math.max(e.length,r.length,n.length,i.length);e=e.concat(Array(o-e.length).fill(e.at(-1))),r=r.concat(Array(o-r.length).fill(r.at(-1))),n=n.concat(Array(o-n.length).fill(n.at(-1))),i=i.concat(Array(o-i.length).fill(i.at(-1)));let a=r.map(cs);return{directionRadians:e.map(cs),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Mp,Rg=()=>Mp=Mp||new ee({"color-relief-opacity":new E(P["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ft(P["paint_color-relief"]["color-relief-color"])}),Lp={get paint(){return Rg()}};var ni=class{constructor(e,r,n,i){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(r,i)}update(e,r,n){let{width:i,height:o}=e,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!n,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(r&&r.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!r||r.premultiply!==!1)),a)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,i,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,r,n){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),n===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(n=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,n||e),this.filter=e),r!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};var ii=class{constructor(e,r,n,i=1,o=1,a=1,s=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){ce(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return pl(e,this.getUnpackVector())}getPixels(){return new fe({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};function pl(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],a=Math.min(r,n,i),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/i)%256}}I("DEMData",ii);var pa=class extends oe{constructor(e){super(e,Lp)}_createColorRamp(e){let r={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof Je&&n._styleExpression.expression instanceof ke){this.colorRampExpression=n;let a=n._styleExpression.expression;r.elevationStops=a.labels,r.colorStops=[];for(let s of r.elevationStops)r.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[H.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=e)return r;let i={elevationStops:[],colorStops:[]},o=(r.elevationStops.length-1)/(e-1);for(let a=0;a<r.elevationStops.length-.5;a+=o)i.elevationStops.push(r.elevationStops[Math.round(a)]),i.colorStops.push(r.colorStops[Math.round(a)]);return ce(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,r,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(r),o=new fe({width:i.colorStops.length,height:1}),a=new fe({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let l=pl(i.elevationStops[s],n);a.setPixel(0,s,new H(l.r/255,l.g/255,l.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new ni(e,a,e.gl.RGBA),colorTexture:new ni(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};var zg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Fp,size:U1,alignment:$1}=zg;function Fr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${t}-pattern`);a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Dr(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${t}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var ci=Y(ye(),1);function ml(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=Vp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=$g(t,e,o,r)),t.length>80*r){s=t[0],l=t[1];let c=s,p=l;for(let f=r;f<i;f+=r){let y=t[f],m=t[f+1];y<s&&(s=y),m<l&&(l=m),y>c&&(c=y),m>p&&(p=m)}u=Math.max(c-s,p-l),u=u!==0?32767/u:0}return ai(o,a,r,s,l,u,0),a}function Vp(t,e,r,n,i){let o;if(i===eb(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=Dp(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=Dp(a/n|0,t[a],t[a+1],o);return o&&Vr(o,o.next)&&(li(o),o=o.next),o}function lr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Vr(r,r.next)||se(r.prev,r,r.next)===0)){if(li(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function ai(t,e,r,n,i,o,a){if(!t)return;!a&&o&&Hg(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?Gg(t,n,i,o):Og(t)){e.push(l.i,t.i,u.i),li(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Ng(lr(t),e),ai(t,e,r,n,i,o,2)):a===2&&Ug(t,e,r,n,i,o):ai(lr(t),e,r,n,i,o,1);break}}}function Og(t){let e=t.prev,r=t,n=t.next;if(se(e,r,n)>=0)return!1;let i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=Math.min(i,o,a),p=Math.min(s,l,u),f=Math.max(i,o,a),y=Math.max(s,l,u),m=n.next;for(;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&oi(i,s,o,l,a,u,m.x,m.y)&&se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Gg(t,e,r,n){let i=t.prev,o=t,a=t.next;if(se(i,o,a)>=0)return!1;let s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=Math.min(s,l,u),m=Math.min(c,p,f),h=Math.max(s,l,u),g=Math.max(c,p,f),d=fl(y,m,e,r,n),x=fl(h,g,e,r,n),b=t.prevZ,v=t.nextZ;for(;b&&b.z>=d&&v&&v.z<=x;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=d;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ng(t,e){let r=t;do{let n=r.prev,i=r.next.next;!Vr(n,i)&&Rp(n,r,r.next,i)&&si(n,i)&&si(i,n)&&(e.push(n.i,r.i,i.i),li(r),li(r.next),r=t=i),r=r.next}while(r!==t);return lr(r)}function Ug(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Yg(a,s)){let l=zp(a,s);a=lr(a,a.next),l=lr(l,l.next),ai(a,e,r,n,i,o,0),ai(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function $g(t,e,r,n){let i=[];for(let o=0,a=e.length;o<a;o++){let s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=Vp(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(Jg(u))}i.sort(jg);for(let o=0;o<i.length;o++)r=qg(i[o],r);return r}function jg(t,e){let r=t.x-e.x;if(r===0&&(r=t.y-e.y,r===0)){let n=(t.next.y-t.y)/(t.next.x-t.x),i=(e.next.y-e.y)/(e.next.x-e.x);r=n-i}return r}function qg(t,e){let r=Wg(t,e);if(!r)return e;let n=zp(r,t);return lr(n,n.next),lr(r,r.next)}function Wg(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(Vr(t,r))return r;do{if(Vr(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let p=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(p<=n&&p>o&&(o=p,a=r.x<r.next.x?r:r.next,p===n))return a}r=r.next}while(r!==e);if(!a)return null;let s=a,l=a.x,u=a.y,c=1/0;r=a;do{if(n>=r.x&&r.x>=l&&n!==r.x&&Bp(i<u?n:o,i,l,u,i<u?o:n,i,r.x,r.y)){let p=Math.abs(i-r.y)/(n-r.x);si(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&Xg(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function Xg(t,e){return se(t.prev,t,e.prev)<0&&se(e.next,t,t.next)<0}function Hg(t,e,r,n){let i=t;do i.z===0&&(i.z=fl(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zg(i)}function Zg(t){let e,r=1;do{let n=t,i;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let u=0;u<r&&(s++,a=a.nextZ,!!a);u++);let l=r;for(;s>0||l>0&&a;)s!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1);return t}function fl(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Jg(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Bp(t,e,r,n,i,o,a,s){return(i-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(n-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function oi(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&Bp(t,e,r,n,i,o,a,s)}function Yg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Kg(t,e)&&(si(t,e)&&si(e,t)&&Qg(t,e)&&(se(t.prev,t,e.prev)||se(t,e.prev,e))||Vr(t,e)&&se(t.prev,t,t.next)>0&&se(e.prev,e,e.next)>0)}function se(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Vr(t,e){return t.x===e.x&&t.y===e.y}function Rp(t,e,r,n){let i=ya(se(t,e,r)),o=ya(se(t,e,n)),a=ya(se(r,n,t)),s=ya(se(r,n,e));return!!(i!==o&&a!==s||i===0&&fa(t,r,e)||o===0&&fa(t,n,e)||a===0&&fa(r,t,n)||s===0&&fa(r,e,n))}function fa(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ya(t){return t>0?1:t<0?-1:0}function Kg(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Rp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function si(t,e){return se(t.prev,t,t.next)<0?se(t,e,t.next)>=0&&se(t,t.prev,e)>=0:se(t,e,t.prev)<0||se(t,t.next,e)<0}function Qg(t,e){let r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function zp(t,e){let r=yl(t.i,t.x,t.y),n=yl(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Dp(t,e,r,n){let i=yl(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function li(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function yl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function eb(t,e,r,n){let i=0;for(let o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}var Bt=class{constructor(e,r){if(r>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=r}getGranularityForZoomLevel(e){let r=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/r),this._minGranularity,1)}},ha=class ha{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};ha.noSubdivision=new ha({fill:new Bt(0,0),line:new Bt(0,0),tile:new Bt(0,0),stencil:new Bt(0,0),circle:1});var ma=ha;I("SubdivisionGranularityExpression",Bt);I("SubdivisionGranularitySetting",ma);var Br=-32768,ui=32767,hl=class{constructor(e,r){this._vertexBuffer=[];this._vertexDictionary=new Map;this._used=!1;this._granularity=e,this._granularityCellSize=8192/e,this._canonical=r}_getKey(e,r){return e=e+32768,r=r+32768,e<<16|r<<0}_vertexToIndex(e,r){if(e<-32768||r<-32768||e>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let n=Math.round(e)|0,i=Math.round(r)|0,o=this._getKey(n,i);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,a),this._vertexBuffer.push(n,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return rb(this._vertexBuffer,e);let r=[],n=e.length;for(let i=0;i<n;i+=3){let o=[e[i+0],e[i+1],e[i+2]],a=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let h=0;h<3;h++){let g=a[h*2],d=a[h*2+1];s=Math.min(s,g),u=Math.max(u,g),l=Math.min(l,d),c=Math.max(c,d)}if(s===u||l===c)continue;let p=Math.floor(s/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize),y=Math.floor(l/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize);if(p===f&&y===m){r.push(...o);continue}for(let h=y;h<m;h++){let g=this._scanlineGenerateVertexRingForCellRow(h,a,o);nb(this._vertexBuffer,g,r)}}return r}_scanlineGenerateVertexRingForCellRow(e,r,n){let i=e*this._granularityCellSize,o=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let l=r[s*2],u=r[s*2+1],c=r[(s+1)*2%6],p=r[((s+1)*2+1)%6],f=r[(s+2)*2%6],y=r[((s+2)*2+1)%6],m=c-l,h=p-u,g=m===0,d=h===0,x=(i-u)/h,b=(o-u)/h,v=Math.min(x,b),S=Math.max(x,b);if(!d&&(v>=1||S<=0)||d&&(u<i||u>o)){p>=i&&p<=o&&a.push(n[(s+1)%3]);continue}if(!d&&v>0){let T=l+m*v,M=u+h*v;a.push(this._vertexToIndex(T,M))}let A=l+m*Math.max(v,0),w=l+m*Math.min(S,1);if(g||this._generateIntraEdgeVertices(a,l,u,c,p,A,w),!d&&S<1){let T=l+m*S,M=u+h*S;a.push(this._vertexToIndex(T,M))}(d||p>=i&&p<=o)&&a.push(n[(s+1)%3]),!d&&(p<=i||p>=o)&&this._generateInterEdgeVertices(a,l,u,c,p,f,y,w,i,o)}return a}_generateIntraEdgeVertices(e,r,n,i,o,a,s){let l=i-r,u=o-n,c=u===0,p=c?Math.min(r,i):Math.min(a,s),f=c?Math.max(r,i):Math.max(a,s),y=Math.floor(p/this._granularityCellSize)+1,m=Math.ceil(f/this._granularityCellSize)-1;if(c?r<i:a<s)for(let g=y;g<=m;g++){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}else for(let g=m;g>=y;g--){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}}_generateInterEdgeVertices(e,r,n,i,o,a,s,l,u,c){let p=o-n,f=a-i,y=s-o,m=(u-o)/y,h=(c-o)/y,g=Math.min(m,h),d=Math.max(m,h),x=i+f*g,b=Math.floor(Math.min(x,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(x,l)/this._granularityCellSize)-1,S=l<x,A=y===0;if(A&&(s===u||s===c))return;if(A||g>=1||d<=0){let T=r-a,M=n-s,D=(u-s)/M,V=(c-s)/M,z=Math.min(D,V),L=a+T*z;b=Math.floor(Math.min(L,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(L,l)/this._granularityCellSize)-1,S=l<L}let w=p>0?c:u;if(S)for(let T=b;T<=v;T++){let M=T*this._granularityCellSize;e.push(this._vertexToIndex(M,w))}else for(let T=v;T>=b;T--){let M=T*this._granularityCellSize;e.push(this._vertexToIndex(M,w))}}_generateOutline(e){let r=[];for(let n of e){let i=Ke(n,this._granularity,!0),o=this._pointArrayToIndices(i),a=[];for(let s=1;s<o.length;s++)a.push(o[s-1]),a.push(o[s]);r.push(a)}return r}_handlePoles(e){let r=!1,n=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(r||n)&&this._fillPoles(e,r,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let r=0;r<e.length;r+=2){let n=e[r+1];n===Br&&(e[r+1]=Br+1),n===ui&&(e[r+1]=ui-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===Br)?(e.push(r),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(o,a)),e.push(this._vertexToIndex(i,a))):(e.push(n),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(o,a)),e.push(n),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,r,n){let i=this._vertexBuffer,o=0,a=8192,s=e.length;for(let l=2;l<s;l+=3){let u=e[l-2],c=e[l-1],p=e[l],f=i[u*2],y=i[u*2+1],m=i[c*2],h=i[c*2+1],g=i[p*2],d=i[p*2+1];r&&(y===o&&h===o&&this._generatePoleQuad(e,u,c,f,m,Br),h===o&&d===o&&this._generatePoleQuad(e,c,p,m,g,Br),d===o&&y===o&&this._generatePoleQuad(e,p,u,g,f,Br)),n&&(y===a&&h===a&&this._generatePoleQuad(e,u,c,f,m,ui),h===a&&d===a&&this._generatePoleQuad(e,c,p,m,g,ui),d===a&&y===a&&this._generatePoleQuad(e,p,u,g,f,ui))}}_initializeVertices(e){for(let r=0;r<e.length;r+=2)this._vertexToIndex(e[r],e[r+1])}subdividePolygonInternal(e,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:n,holeIndices:i}=tb(e);this._initializeVertices(n);let o;try{let s=ml(n,i),l=this._convertIndices(n,s);o=this._subdivideTrianglesScanline(l)}catch(s){console.error(s)}let a=[];return r&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:a}}_convertIndices(e,r){let n=[];for(let i=0;i<r.length;i++){let o=e[r[i]*2],a=e[r[i]*2+1];n.push(this._vertexToIndex(o,a))}return n}_pointArrayToIndices(e){let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(this._vertexToIndex(i.x,i.y))}return r}};function da(t,e,r,n=!0){return new hl(r,e).subdividePolygonInternal(t,n)}function Ke(t,e,r=!1){if(!t||t.length<1)return[];if(t.length<2)return[];let n=t[0],i=t[t.length-1],o=r&&(n.x!==i.x||n.y!==i.y);if(e<2)return o?[...t,t[0]]:[...t];let a=Math.floor(8192/e),s=[];s.push(new ci.default(t[0].x,t[0].y));let l=t.length,u=o?l:l-1;for(let c=0;c<u;c++){let p=t[c],f=c<l-1?t[c+1]:t[0],y=p.x,m=p.y,h=f.x,g=f.y,d=y!==h,x=m!==g;if(!d&&!x)continue;let b=h-y,v=g-m,S=Math.abs(b),A=Math.abs(v),w=y,T=m;for(;;){let D=b>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,V=v>0?(Math.floor(T/a)+1)*a:(Math.ceil(T/a)-1)*a,z=Math.abs(w-D),L=Math.abs(T-V),_=Math.abs(w-h),B=Math.abs(T-g),G=d?z/S:Number.POSITIVE_INFINITY,O=x?L/A:Number.POSITIVE_INFINITY;if((_<=z||!d)&&(B<=L||!x))break;if(G<O&&d||!x){w=D,T=T+v*G;let R=new ci.default(w,Math.round(T));(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}else{w=w+b*O,T=V;let R=new ci.default(Math.round(w),T);(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}}let M=new ci.default(h,g);(s[s.length-1].x!==M.x||s[s.length-1].y!==M.y)&&s.push(M)}return s}function tb(t){let e=[],r=[];for(let n of t)if(n.length!==0){n!==t[0]&&e.push(r.length/2);for(let i=0;i<n.length;i++)r.push(n[i].x),r.push(n[i].y)}return{flattened:r,holeIndices:e}}function rb(t,e){let r=[];for(let n=0;n<e.length;n+=3){let i=e[n],o=e[n+1],a=e[n+2],s=t[i*2],l=t[i*2+1],u=t[o*2],c=t[o*2+1],p=t[a*2],f=t[a*2+1],y=u-s,m=c-l,h=p-s,g=f-l;y*g-m*h>0?(r.push(i),r.push(a),r.push(o)):(r.push(i),r.push(o),r.push(a))}return r}function nb(t,e,r){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,i=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<i&&(i=u,n=l)}let o=e.length,a=n,s=(a+1)%o;for(;;){let l=a-1>=0?a-1:o-1,u=(s+1)%o,c=t[e[l]*2],p=t[e[l]*2+1],f=t[e[u]*2],y=t[e[u]*2+1],m=t[e[a]*2],h=t[e[a]*2+1],g=t[e[s]*2],d=t[e[s]*2+1],x=!1;if(c<f)x=!0;else if(c>f)x=!1;else{let b=g-m,S=d-h,A=-b,w=h<d?1:-1,T=((c-m)*S+(p-h)*A)*w,M=((f-m)*S+(y-h)*A)*w;T>M&&(x=!0)}if(x){let b=e[l],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),a--,a<0&&(a=o-1)}else{let b=e[u],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),s++,s>=o&&(s=0)}if(l===u)break}}function ga(t,e,r,n,i,o,a,s,l){let u=i.length/2,c=a&&s&&l;if(u<pe.MAX_VERTEX_ARRAY_LENGTH){let p=e.prepareSegment(u,r,n),f=p.vertexLength;for(let h=0;h<o.length;h+=3)n.emplaceBack(f+o[h],f+o[h+1],f+o[h+2]);p.vertexLength+=u,p.primitiveLength+=o.length/3;let y,m;c&&(m=a.prepareSegment(u,r,s),y=m.vertexLength,m.vertexLength+=u);for(let h=0;h<i.length;h+=2)t(i[h],i[h+1]);if(c)for(let h=0;h<l.length;h++){let g=l[h];for(let d=1;d<g.length;d+=2)s.emplaceBack(y+g[d-1],y+g[d]);m.primitiveLength+=g.length/2}}else ib(e,r,n,i,o,t),c&&ob(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a?.forceNewSegmentOnNextPrepare()}function pi(t,e,r,n,i,o,a){if(o){let s=n.count;return r(e[i*2],e[i*2+1]),t[i]=n.count,n.count++,a.vertexLength++,s}else return t[i]}function ib(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=2;p<i.length;p+=3){let f=i[p-2],y=i[p-1],m=i[p],h=a[f]<l,g=a[y]<l,d=a[m]<l,x=(h?1:0)+(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,h=!0,g=!0,d=!0,c=0);let b=pi(a,n,o,s,f,h,u),v=pi(a,n,o,s,y,g,u),S=pi(a,n,o,s,m,d,u);r.emplaceBack(c+b-l,c+v-l,c+S-l),u.primitiveLength++}}function ob(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=0;p<i.length;p++){let f=i[p];for(let y=1;y<i[p].length;y+=2){let m=f[y-1],h=f[y],g=a[m]<l,d=a[h]<l,x=(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,g=!0,d=!0,c=0);let b=pi(a,n,o,s,m,g,u),v=pi(a,n,o,s,h,d,u);r.emplaceBack(c+b-l,c+v-l),u.primitiveLength++}}}var ab=500,ur=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Xo,this.indexArray=new Fe,this.indexArray2=new Lt,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.segments2=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Fr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Dr("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,n,i,o,a){for(let s of Yt(r,ab)){let l=da(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;ga((c,p)=>{u.emplaceBack(c,p)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};I("FillBucket",ur,{omit:["layers","patternFeatures"]});var Op,sb=()=>Op=Op||new ee({"fill-sort-key":new F(P.layout_fill["fill-sort-key"])}),Gp,lb=()=>Gp=Gp||new ee({"fill-antialias":new E(P.paint_fill["fill-antialias"]),"fill-opacity":new F(P.paint_fill["fill-opacity"]),"fill-color":new F(P.paint_fill["fill-color"]),"fill-outline-color":new F(P.paint_fill["fill-outline-color"]),"fill-translate":new E(P.paint_fill["fill-translate"]),"fill-translate-anchor":new E(P.paint_fill["fill-translate-anchor"]),"fill-pattern":new pt(P.paint_fill["fill-pattern"])}),Np={get paint(){return lb()},get layout(){return sb()}};var ba=class extends oe{constructor(e){super(e,Np)}recalculate(e,r){super.recalculate(e,r);let n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new ur(e)}queryRadius(){return Dt(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:n,pixelsToTileUnits:i}){let o=Vt(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return aa(o,r)}isTileClipped(){return!0}};var ub=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Up=Q([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:$p,size:kS,alignment:ES}=ub;var Jp=Y(Rt(),1);var Pb=Jp.default.VectorTileFeature.types,Sb=500,bl=Math.pow(2,13);function fi(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*bl)*2+a,i*bl*2,o*bl*2,Math.round(s))}var cr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ho,this.centroidVertexArray=new qo,this.indexArray=new Fe,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Fr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=Ne(i,l);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:_e(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Dr("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{},r.subdivisionGranularity),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(e,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n,e.subdivisionGranularity)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$p),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Up.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,n,i,o,a){for(let s of Yt(r,Sb)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,i,e,s,a);let c=this.layoutVertexArray.length-u,p=Math.floor(l.x/l.sampleCount),f=Math.floor(l.y/l.sampleCount);for(let y=0;y<c;y++)this.centroidVertexArray.emplaceBack(p,f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,r,n,i,o){if(i.length<1||Zp(i[0]))return;for(let p of i)p.length!==0&&wb(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=Pb[n.type]==="Polygon";for(let p of i){if(p.length===0||Zp(p))continue;let f=Ke(p,s,l);this._generateSideFaces(f,a)}if(!l)return;let u=da(i,r,s,!1),c=this.layoutVertexArray;ga((p,f)=>{fi(c,p,f,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(e,r){let n=0;for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(Ab(o,a))continue;r.segment.vertexLength+4>pe.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(a)._perp()._unit(),l=a.dist(o);n+l>32768&&(n=0),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,n);let u=r.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}};function wb(t,e){for(let r=0;r<e.length;r++){let n=e[r];r===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(t.x+=n.x,t.y+=n.y,t.sampleCount++)}}I("FillExtrusionBucket",cr,{omit:["layers","features"]});function Ab(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zp(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Yp,_b=()=>Yp=Yp||new ee({"fill-extrusion-opacity":new E(P["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new F(P["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new E(P["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new E(P["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pt(P["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new F(P["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new F(P["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new E(P["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Kp={get paint(){return _b()}};var va=Y(ye(),1);var Pa=class extends oe{constructor(e){super(e,Kp)}createBucket(e){return new cr(e)}queryRadius(){return Dt(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){let l=Vt(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),u=this.paint.get("fill-extrusion-height").evaluate(r,n),c=this.paint.get("fill-extrusion-base").evaluate(r,n),p=Cb(l,s,0),f=Tb(i,c,u,s),y=f[0],m=f[1];return Ib(y,m,p)}};function yi(t,e){return t.x*e.x+t.y*e.y}function Qp(t,e){if(t.length===1){let r=0,n=e[r++],i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){let o=e[r],a=t[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=yi(s,s),p=yi(s,l),f=yi(l,l),y=yi(u,s),m=yi(u,l),h=c*f-p*p,g=(f*y-p*m)/h,d=(c*m-p*y)/h,x=1-g-d,b=n.z*x+i.z*g+o.z*d;if(isFinite(b))return b}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function Ib(t,e,r){let n=1/0;aa(r,e)&&(n=Qp(r,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=t[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];mp(r,f)&&(n=Math.min(n,Qp(r,f)))}}return n===1/0?!1:n}function Tb(t,e,r,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of t){let h=[],g=[];for(let d of m){let x=d.x,b=d.y,v=n[0]*x+n[4]*b+n[12],S=n[1]*x+n[5]*b+n[13],A=n[2]*x+n[6]*b+n[14],w=n[3]*x+n[7]*b+n[15],T=v+a,M=S+s,D=A+l,V=w+u,z=v+c,L=S+p,_=A+f,B=w+y,G=new va.default(T/V,M/V);G.z=D/V,h.push(G);let O=new va.default(z/B,L/B);O.z=_/B,g.push(O)}i.push(h),o.push(g)}return[i,o]}function Cb(t,e,r){let n=[];for(let i of t){let o=[i.x,i.y,r,1];Wi.transformMat4(o,o,e),n.push(new va.default(o[0]/o[3],o[1]/o[3]))}return n}var kb=Q([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ef,size:fw,alignment:yw}=kb;var Eb=Q([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:tf,size:dw,alignment:gw}=Eb;var of=Y(Rt(),1);var Mb=of.default.VectorTileFeature.types,rf=63,Lb=Math.cos(75/2*(Math.PI/180)),Fb=15,Db=20,Vb=15,af=1/2,nf=Math.pow(2,Vb-1)/af,pr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Zo,this.layoutVertexArray2=new Jo,this.indexArray=new Fe,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Fr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Dr("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,tf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ef),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let r=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(e,r,n,i,o,a){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap"),c=s.get("line-miter-limit"),p=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let f of r)this.addLine(f,e,l,u,c,p,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a,s,l){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let u=s?l.line.getGranularityForZoomLevel(s.z):1;if(e=Ke(e,u),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=Mb[r.type]==="Polygon",p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(c?3:2))return;n==="bevel"&&(o=1.05);let y=this.overscaling<=16?Fb*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),h,g,d,x,b;this.e1=this.e2=-1,c&&(h=e[p-2],b=e[f].sub(h)._unit()._perp());for(let v=f;v<p;v++){if(d=v===p-1?c?e[f+1]:void 0:e[v+1],d&&e[v].equals(d))continue;b&&(x=b),h&&(g=h),h=e[v],b=d?d.sub(h)._unit()._perp():x,x=x||b;let S=x.add(b);(S.x!==0||S.y!==0)&&S._unit();let A=x.x*b.x+x.y*b.y,w=S.x*b.x+S.y*b.y,T=w!==0?1/w:1/0,M=2*Math.sqrt(2-2*w),D=w<Lb&&g&&d,V=x.x*b.y-x.y*b.x>0;if(D&&v>f){let _=h.dist(g);if(_>2*y){let B=h.sub(h.sub(g)._mult(y/_)._round());this.updateDistance(g,B),this.addCurrentVertex(B,x,0,0,m),g=B}}let z=g&&d,L=z?n:c?"butt":i;if(z&&L==="round"&&(T<a?L="miter":T<=2&&(L="fakeround")),L==="miter"&&T>o&&(L="bevel"),L==="bevel"&&(T>2&&(L="flipbevel"),T<o&&(L="miter")),g&&this.updateDistance(g,h),L==="miter")S._mult(T),this.addCurrentVertex(h,S,0,0,m);else if(L==="flipbevel"){if(T>100)S=b.mult(-1);else{let _=T*x.add(b).mag()/x.sub(b).mag();S._perp()._mult(_*(V?-1:1))}this.addCurrentVertex(h,S,0,0,m),this.addCurrentVertex(h,S.mult(-1),0,0,m)}else if(L==="bevel"||L==="fakeround"){let _=-Math.sqrt(T*T-1),B=V?_:0,G=V?0:_;if(g&&this.addCurrentVertex(h,x,B,G,m),L==="fakeround"){let O=Math.round(M*180/Math.PI/Db);for(let R=1;R<O;R++){let K=R/O;if(K!==.5){let re=K-.5,me=1.0904+A*(-3.2452+A*(3.55645-A*1.43519)),Ut=.848013+A*(-1.06021+A*.215638);K=K+K*re*(K-1)*(me*re*re+Ut)}let X=b.sub(x)._mult(K)._add(x)._unit()._mult(V?-1:1);this.addHalfVertex(h,X.x,X.y,!1,V,0,m)}}d&&this.addCurrentVertex(h,b,-B,-G,m)}else if(L==="butt")this.addCurrentVertex(h,S,0,0,m);else if(L==="square"){let _=g?1:-1;this.addCurrentVertex(h,S,_,_,m)}else L==="round"&&(g&&(this.addCurrentVertex(h,x,0,0,m),this.addCurrentVertex(h,x,1,1,m,!0)),d&&(this.addCurrentVertex(h,b,-1,-1,m,!0),this.addCurrentVertex(h,b,0,0,m)));if(D&&v<p-1){let _=h.dist(d);if(_>2*y){let B=h.add(d.sub(h)._mult(y/_)._round());this.updateDistance(h,B),this.addCurrentVertex(B,b,0,0,m),h=B}}}}addCurrentVertex(e,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(e,s,l,a,!1,n,o),this.addHalfVertex(e,u,c,a,!0,-i,o),this.distance>nf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,i,o,a))}addHalfVertex({x:e,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(nf-1):this.scaledDistance)*af;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(rf*n)+128,Math.round(rf*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,p,this.e2),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}};I("LineBucket",pr,{omit:["layers","patternFeatures"]});var sf,Bb=()=>sf=sf||new ee({"line-cap":new E(P.layout_line["line-cap"]),"line-join":new F(P.layout_line["line-join"]),"line-miter-limit":new E(P.layout_line["line-miter-limit"]),"line-round-limit":new E(P.layout_line["line-round-limit"]),"line-sort-key":new F(P.layout_line["line-sort-key"])}),lf,Rb=()=>lf=lf||new ee({"line-opacity":new F(P.paint_line["line-opacity"]),"line-color":new F(P.paint_line["line-color"]),"line-translate":new E(P.paint_line["line-translate"]),"line-translate-anchor":new E(P.paint_line["line-translate-anchor"]),"line-width":new F(P.paint_line["line-width"]),"line-gap-width":new F(P.paint_line["line-gap-width"]),"line-offset":new F(P.paint_line["line-offset"]),"line-blur":new F(P.paint_line["line-blur"]),"line-dasharray":new tr(P.paint_line["line-dasharray"]),"line-pattern":new pt(P.paint_line["line-pattern"]),"line-gradient":new ft(P.paint_line["line-gradient"])}),xl={get paint(){return Rb()},get layout(){return Bb()}};var vl=class extends F{possiblyEvaluate(e,r){return r=new W(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,i){return r=de({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Sa;var wa=class extends oe{constructor(e){super(e,xl),this.gradientVersion=0,Sa||(Sa=new vl(xl.paint.properties["line-width"].specification),Sa.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();fc(r)?this.stepInterpolant=r._styleExpression.expression instanceof Pr:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Sa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new pr(e)}queryRadius(e){let r=e,n=uf(ar("line-width",this,r),ar("line-gap-width",this,r)),i=ar("line-offset",this,r);return n/2+Math.abs(i)+Dt(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=Vt(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*uf(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),u=this.paint.get("line-offset").evaluate(r,n);return u&&(i=bp(i,u*a)),dp(s,i,l)}isTileClipped(){return!0}};function uf(t,e){return e>0?e+2*t:t}var cf=Q([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pf=Q([{name:"a_projected_pos",components:3,type:"Float32"}],4),Zw=Q([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ff=Q([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),Jw=Q([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Pl=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Yw=Q([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Kw=Q([{name:"triangle",components:3,type:"Uint16"}]),Qw=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),eA=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),tA=Q([{type:"Float32",name:"offsetX"}]),rA=Q([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nA=Q([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var vi=Y(ye(),1);function zb(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),we.applyArabicShaping&&(t=we.applyArabicShaping(t)),t}function yf(t,e,r){return t.sections.forEach(n=>{n.text=zb(n.text,e,r)}),t}function mf(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return`${u}:${f.x}:${f.y}`}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let h=s(y,m,p),g=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[g].geometry,!0)]=g,n[h].geometry=null}else y in r?a(y,m,p):m in e?s(y,m,p):(o(u),e[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var zr={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function hf(t){let e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;(!n||!Ys(n)||zr[t[r+1]])&&(!i||!Ys(i)||zr[t[r-1]])&&zr[t[r]]?e+=zr[t[r]]:e+=t[r]}return e}var ae=24;var rx=Y(mi(),1),nx=3;var Ia=nx;function hi(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],o=0,a=0;for(let s of t)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();c&&l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}var he=1;var Ta=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+he,this.paddedRect.y+he]}get br(){return[this.paddedRect.x+this.paddedRect.w-he,this.paddedRect.y+this.paddedRect.h-he]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-he*2)/this.pixelRatio,(this.paddedRect.h-he*2)/this.pixelRatio]}},di=class{constructor(e,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(r,i,o);let{w:a,h:s}=hi(o),l=new fe({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;fe.copy(c.data,l,{x:0,y:0},{x:p.x+he,y:p.y+he},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+he,y=p.y+he,m=c.data.width,h=c.data.height;fe.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),fe.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),fe.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),fe.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),fe.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,r,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*he,h:o.data.height+2*he};n.push(a),r[i]=new Ta(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;let[i,o]=e.tl;n.update(r.data,void 0,{x:i,y:o})}};I("ImagePosition",Ta);I("ImageAtlas",di);var Ea=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(Ea||{}),bi=-17;function ix(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var Sf=57344,wf=63743,Ca=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(e,r,n){let i=new t;return i.scale=e||1,i.fontStack=r,i.verticalAlign=n||"bottom",i}static forImage(e,r){let n=new t;return n.imageName=e,n.verticalAlign=r||"bottom",n}},gi=class t{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){let n=new t;for(let i=0;i<e.sections.length;i++){let o=e.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=hf(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&ka[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ka[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){let n=new t;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,n=0;for(let i=0;i<this.length();i++){let o=this.getSection(i);if(o.imageName){let a=e[o.imageName];if(!a)continue;let s=a.displaySize;r=Math.max(r,s[0]),n=Math.max(n,s[1])}}return{maxImageWidth:r,maxImageHeight:n}}addTextSection(e,r){this.text+=e.text,this.sections.push(Ca.forText(e.scale,e.fontStack||r,e.verticalAlign));let n=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(n)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce(`Reached maximum number of images ${wf-Sf+2}`);return}this.text+=String.fromCharCode(n),this.sections.push(Ca.forImage(r,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=wf?null:++this.imageSectionID:(this.imageSectionID=Sf,this.imageSectionID)}};function ox(t,e){let r=[],n=t.text,i=0;for(let o of e)r.push(t.substring(i,o)),i=o;return i<n.length&&r.push(t.substring(i,n.length)),r}function xi(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=gi.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:d,processStyledBidirectionalText:x}=we;if(d&&h.sections.length===1){g=[];let S=d(h.toString(),Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A,w.sections=h.sections;for(let T=0;T<A.length;T++)w.sectionIndex.push(0);g.push(w)}}else if(x){g=[];let S=x(h.text,h.sectionIndex,Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A[0],w.sectionIndex=A[1],w.sections=h.sections,g.push(w)}}else g=ox(h,Al(h,u,o,e,n,y));let b=[],v={positionedLines:b,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return yx(v,e,r,n,g,a,s,l,p,u,f,m),ix(b)?!1:v}var ka={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ax={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},sx={40:!0};function If(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ae/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function lx(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=If(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function Af(t,e,r,n){let i=Math.pow(t-e,2);return n?t<e?i/2:i*2:i+Math.abs(r)*r}function ux(t,e,r){let n=0;return t===10&&(n-=1e4),r&&(n+=150),(t===40||t===65288)&&(n+=50),(e===41||e===65289)&&(n+=50),n}function _f(t,e,r,n,i,o){let a=null,s=Af(e,r,i,o);for(let l of n){let u=e-l.x,c=Af(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function Tf(t){return t?Tf(t.priorBreak).concat(t.index):[]}function Al(t,e,r,n,i,o){if(!t)return[];let a=[],s=lx(t,e,r,n,i,o),l=t.text.indexOf("\\u200B")>=0,u=0;for(let c=0;c<t.length();c++){let p=t.getSection(c),f=t.getCharCode(c);if(ka[f]||(u+=If(f,p,n,i,e,o)),c<t.length()-1){let y=Yc(f);(ax[f]||y||p.imageName||c!==t.length()-2&&sx[t.getCharCode(c+1)])&&a.push(_f(c+1,u,s,a,ux(f,t.getCharCode(c+1),y&&l),!1))}}return Tf(_f(t.length(),u,s,a,0,!0))}function Cf(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:e,verticalAlign:r}}function cx(t,e,r){let n=e.getMaxScale()*ae,{maxImageWidth:i,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(n,o*r);return{verticalLineContentWidth:Math.max(n,i*r),horizontalLineContentHeight:a}}function kf(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function px(t,e,r,n){if(t&&t.rect)return t;let i=e[r.fontStack],o=i&&i[n];return o?{rect:null,metrics:o.metrics}:null}function fx(t,e,r){return!(t===1||!e&&!Mo(r)||e&&(ka[r]||Kc(r)))}function yx(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=0,m=0,h=0,g=s==="right"?1:s==="left"?0:.5,d=ae/p,x=0;for(let S of i){S.trim();let A=S.getMaxScale(),w={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=w;let T=w.positionedGlyphs,M=0;if(!S.length()){y+=o,++x;continue}let D=cx(n,S,d);for(let L=0;L<S.length();L++){let _=S.getSection(L),B=S.getSectionIndex(L),G=S.getCharCode(L),O=fx(l,c,G),R;if(_.imageName){if(t.iconsInText=!0,_.scale=_.scale*d,R=hx(_,O,A,D,n),!R)continue;M=Math.max(M,R.imageOffset)}else if(R=mx(_,G,O,D,e,r),!R)continue;let{rect:K,metrics:X,baselineOffset:re}=R;if(T.push({glyph:G,imageName:_.imageName,x:f,y:y+re+bi,vertical:O,scale:_.scale,fontStack:_.fontStack,sectionIndex:B,metrics:X,rect:K}),!O)f+=X.advance*_.scale+u;else{t.verticalizable=!0;let me=_.imageName?X.advance:ae;f+=me*_.scale+u}}if(T.length!==0){let L=f-u;m=Math.max(L,m),dx(T,0,T.length-1,g)}f=0;let V=(A-1)*ae;w.lineOffset=Math.max(M,V);let z=o*A+M;y+=z,h=Math.max(z,h),++x}let{horizontalAlign:b,verticalAlign:v}=Cf(a);gx(t.positionedLines,g,b,v,m,h,o,y,i.length),t.top+=-v*y,t.bottom=t.top+y,t.left+=-b*m,t.right=t.left+m}function mx(t,e,r,n,i,o){let a=o[t.fontStack],s=a&&a[e],l=px(s,i,t,e);if(l===null)return null;let u;if(r)u=n.verticalLineContentWidth-t.scale*ae;else{let c=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-t.scale*ae)*c}return{rect:l.rect,metrics:l.metrics,baselineOffset:u}}function hx(t,e,r,n,i){let o=i[t.imageName];if(!o)return null;let a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:he,top:-Ia,advance:e?s[1]:s[0]},u;if(e)u=n.verticalLineContentWidth-s[1]*t.scale;else{let p=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-s[1]*t.scale)*p}let c=(e?s[0]:s[1])*t.scale-ae*r;return{rect:a,metrics:l,baselineOffset:u,imageOffset:c}}function dx(t,e,r,n){if(n===0)return;let i=t[r],o=i.metrics.advance*i.scale,a=(t[r].x+o)*n;for(let s=e;s<=r;s++)t[s].x-=a}function gx(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-bi:c=-n*l*a+.5*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function Ef(t,e,r){let{horizontalAlign:n,verticalAlign:i}=Cf(r),o=e[0],a=e[1],s=o-t.displaySize[0]*n,l=s+t.displaySize[0],u=a-t.displaySize[1]*i,c=u+t.displaySize[1];return{image:t,top:u,bottom:c,left:s,right:l}}function Ma(t){let e=t.left,r=t.top,n=t.right-e,i=t.bottom-r,o=t.image.content[2]-t.image.content[0],a=t.image.content[3]-t.image.content[1],s=t.image.textFitWidth??"stretchOrShrink",l=t.image.textFitHeight??"stretchOrShrink",u=o/a;if(l==="proportional"){if(s==="stretchOnly"&&n/i<u||s==="proportional"){let c=Math.ceil(i*u);e*=c/n,n=c}}else if(s==="proportional"&&l==="stretchOnly"&&u!==0&&n/i>u){let c=Math.ceil(n/u);r*=c/i,i=c}return{x1:e,y1:r,x2:e+n,y2:r+i}}function _l(t,e,r,n,i,o){let a=t.image,s;if(a.content){let g=a.content,d=a.pixelRatio||1;s=[g[0]/d,g[1]/d,a.displaySize[0]-g[2]/d,a.displaySize[1]-g[3]/d]}let l=e.left*o,u=e.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=e.top*o,h=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var Mf=Y(Rt(),1);var Nr=255,zt=128,Qe=Nr*zt;function Il(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new W(t+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=t;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new W(s)),c=r.evaluate(new W(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function Tl(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var bx=Mf.default.VectorTileFeature.types,xx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function La(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Qe,Math.round(s[0])):0,m=s?Math.min(Qe,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function Lf(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function vx(t){for(let e of t.sections)if(ep(e.text))return!0;return!1}var Pi=class{constructor(e){this.layoutVertexArray=new Yo,this.indexArray=new Fe,this.programConfigurations=e,this.segments=new pe,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new Qo,this.hasVisibleVertices=!1,this.placedSymbolArray=new qn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,cf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,pf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,xx,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};I("SymbolBuffers",Pi);var Si=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new pe,this.collisionVertexArray=new ea}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ff.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",Si);var Xe=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(l=>l.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=Tl(i,"text-overlap","text-allow-overlap")!=="never"||Tl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>Ea[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pi(new Ae(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Pi(new Ae(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Xn,this.lineVertexArray=new Hn,this.symbolInstances=new Wn,this.textAnchorOffsets=new Zn}calculateGlyphDependencies(e,r,n,i,o){for(let a=0;a<e.length;a++)if(r[e.charCodeAt(a)]=!0,(n||i)&&o){let s=zr[e.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(e,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Ee&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new W(this.zoom,{globalState:this.globalState});for(let{feature:g,id:d,index:x,sourceLayerIndex:b}of e){let v=i._featureFilter.needGeometry,S=Ne(g,v);if(!i._featureFilter.filter(h,S,n))continue;v||(S.geometry=_e(g));let A;if(u){let D=i.getValueAndResolveTokens("text-field",S,n,m),V=Ee.factory(D),z=this.hasRTLText=this.hasRTLText||vx(V);(!z||we.getRTLTextPluginStatus()==="unavailable"||z&&we.isParsed())&&(A=yf(V,i,S))}let w;if(c){let D=i.getValueAndResolveTokens("icon-image",S,n,m);D instanceof Se?w=D:w=Se.fromString(D)}if(!A&&!w)continue;let T=this.sortFeaturesByKey?p.evaluate(S,{},n):void 0,M={id:d,text:A,icon:w,index:x,sourceLayerIndex:b,geometry:S.geometry,properties:g.properties,type:bx[g.type],sortKey:T};if(this.features.push(M),w&&(f[w.name]=!0),A){let D=a.evaluate(S,{},n).join(","),V=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let z of A.sections)if(z.image)f[z.image.name]=!0;else{let L=In(A.toString()),_=z.fontStack||D,B=y[_]=y[_]||{};this.calculateGlyphDependencies(z.text,B,V,this.allowVerticalPlacement,L)}}}o.get("symbol-placement")==="line"&&(this.features=mf(this.features)),this.sortFeaturesByKey&&this.features.sort((g,d)=>g.sortKey-d.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(r[e.segment+1]),o=e.dist(r[e.segment]),a={};for(let s=e.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,i,o,a,s,l,u,c,p,f){let y=e.indexArray,m=e.layoutVertexArray,h=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,d=h.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:S,tr:A,bl:w,br:T,tex:M,pixelOffsetTL:D,pixelOffsetBR:V,minFontScaleX:z,minFontScaleY:L,glyphOffset:_,isSDF:B,sectionIndex:G}=r[v],O=h.vertexLength,R=_[1];La(m,l.x,l.y,S.x,R+S.y,M.x,M.y,n,B,D.x,D.y,z,L),La(m,l.x,l.y,A.x,R+A.y,M.x+M.w,M.y,n,B,V.x,D.y,z,L),La(m,l.x,l.y,w.x,R+w.y,M.x,M.y+M.h,n,B,D.x,V.y,z,L),La(m,l.x,l.y,T.x,R+T.y,M.x+M.w,M.y+M.h,n,B,V.x,V.y,z,L),Lf(e.dynamicLayoutVertexArray,l,x),y.emplaceBack(O,O+2,O+1),y.emplaceBack(O+1,O+2,O+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_[0]),(v===r.length-1||G!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[G])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,d,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,r,n,i,o,a){return r.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(e,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,r,n,i){for(let o=e;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Si(Yn,Pl.members,Lt),this.iconCollisionBox=new Si(Yn,Pl.members,Lt);for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=e.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=e.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=e.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=e.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){let n=e.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+2,o+1),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(e),n=Math.cos(e),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(e,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};I("SymbolBucket",Xe,{omit:["layers","collisionBoxArray","features","compareText"]});Xe.MAX_GLYPHS=65535;Xe.addDynamicAttributes=Lf;function Ff(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var Df,Px=()=>Df=Df||new ee({"symbol-placement":new E(P.layout_symbol["symbol-placement"]),"symbol-spacing":new E(P.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new E(P.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new F(P.layout_symbol["symbol-sort-key"]),"symbol-z-order":new E(P.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new E(P.layout_symbol["icon-allow-overlap"]),"icon-overlap":new E(P.layout_symbol["icon-overlap"]),"icon-ignore-placement":new E(P.layout_symbol["icon-ignore-placement"]),"icon-optional":new E(P.layout_symbol["icon-optional"]),"icon-rotation-alignment":new E(P.layout_symbol["icon-rotation-alignment"]),"icon-size":new F(P.layout_symbol["icon-size"]),"icon-text-fit":new E(P.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new E(P.layout_symbol["icon-text-fit-padding"]),"icon-image":new F(P.layout_symbol["icon-image"]),"icon-rotate":new F(P.layout_symbol["icon-rotate"]),"icon-padding":new F(P.layout_symbol["icon-padding"]),"icon-keep-upright":new E(P.layout_symbol["icon-keep-upright"]),"icon-offset":new F(P.layout_symbol["icon-offset"]),"icon-anchor":new F(P.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new E(P.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new E(P.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new E(P.layout_symbol["text-rotation-alignment"]),"text-field":new F(P.layout_symbol["text-field"]),"text-font":new F(P.layout_symbol["text-font"]),"text-size":new F(P.layout_symbol["text-size"]),"text-max-width":new F(P.layout_symbol["text-max-width"]),"text-line-height":new E(P.layout_symbol["text-line-height"]),"text-letter-spacing":new F(P.layout_symbol["text-letter-spacing"]),"text-justify":new F(P.layout_symbol["text-justify"]),"text-radial-offset":new F(P.layout_symbol["text-radial-offset"]),"text-variable-anchor":new E(P.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new F(P.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new F(P.layout_symbol["text-anchor"]),"text-max-angle":new E(P.layout_symbol["text-max-angle"]),"text-writing-mode":new E(P.layout_symbol["text-writing-mode"]),"text-rotate":new F(P.layout_symbol["text-rotate"]),"text-padding":new E(P.layout_symbol["text-padding"]),"text-keep-upright":new E(P.layout_symbol["text-keep-upright"]),"text-transform":new F(P.layout_symbol["text-transform"]),"text-offset":new F(P.layout_symbol["text-offset"]),"text-allow-overlap":new E(P.layout_symbol["text-allow-overlap"]),"text-overlap":new E(P.layout_symbol["text-overlap"]),"text-ignore-placement":new E(P.layout_symbol["text-ignore-placement"]),"text-optional":new E(P.layout_symbol["text-optional"])}),Vf,Sx=()=>Vf=Vf||new ee({"icon-opacity":new F(P.paint_symbol["icon-opacity"]),"icon-color":new F(P.paint_symbol["icon-color"]),"icon-halo-color":new F(P.paint_symbol["icon-halo-color"]),"icon-halo-width":new F(P.paint_symbol["icon-halo-width"]),"icon-halo-blur":new F(P.paint_symbol["icon-halo-blur"]),"icon-translate":new E(P.paint_symbol["icon-translate"]),"icon-translate-anchor":new E(P.paint_symbol["icon-translate-anchor"]),"text-opacity":new F(P.paint_symbol["text-opacity"]),"text-color":new F(P.paint_symbol["text-color"],{runtimeType:ze,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new F(P.paint_symbol["text-halo-color"]),"text-halo-width":new F(P.paint_symbol["text-halo-width"]),"text-halo-blur":new F(P.paint_symbol["text-halo-blur"]),"text-translate":new E(P.paint_symbol["text-translate"]),"text-translate-anchor":new E(P.paint_symbol["text-translate-anchor"])}),Fa={get paint(){return Sx()},get layout(){return Px()}};var wi=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:wr,this.defaultValue=e}evaluate(e){if(e.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;e(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};I("FormatSectionOverride",wi,{omit:["defaultValue"]});var Da=class t extends oe{constructor(e){super(e,Fa)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let o of n)i.indexOf(o)<0&&i.push(o);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,i){let o=this.layout.get(e).evaluate(r,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!wn(a.value)&&o?Ff(r.properties,o):o}createBucket(e){return new Xe(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Fa.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new wi(r),i=new Ht(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new Je("source",i):o=new Tt("composite",i,r.value.zoomStops),this.paint._values[e]=new ge(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!this.layout||r.isDataDriven()||n.isDataDriven()?!1:t.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let n=e.get("text-field"),i=Fa.paint.properties[r],o=!1,a=s=>{for(let l of s)if(i.overrides&&i.overrides.hasOverride(l)){o=!0;return}};if(n.value.kind==="constant"&&n.value.value instanceof Ee)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof _t&&ue(u.value)===Ar){let c=u.value;a(c.sections)}else u instanceof pn?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Bf(t,e,r,n=1){let i=t.get("icon-padding").evaluate(e,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var Rf,wx=()=>Rf=Rf||new ee({"background-color":new E(P.paint_background["background-color"]),"background-pattern":new tr(P.paint_background["background-pattern"]),"background-opacity":new E(P.paint_background["background-opacity"])}),zf={get paint(){return wx()}};var Va=class extends oe{constructor(e){super(e,zf)}};var Of,Ax=()=>Of=Of||new ee({"raster-opacity":new E(P.paint_raster["raster-opacity"]),"raster-hue-rotate":new E(P.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new E(P.paint_raster["raster-brightness-min"]),"raster-brightness-max":new E(P.paint_raster["raster-brightness-max"]),"raster-saturation":new E(P.paint_raster["raster-saturation"]),"raster-contrast":new E(P.paint_raster["raster-contrast"]),"raster-resampling":new E(P.paint_raster["raster-resampling"]),"raster-fade-duration":new E(P.paint_raster["raster-fade-duration"])}),Gf={get paint(){return Ax()}};var Ba=class extends oe{constructor(e){super(e,Gf)}};var Ra=class extends oe{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Nf(t){if(t.type==="custom")return new Ra(t);switch(t.type){case"background":return new Va(t);case"circle":return new la(t);case"color-relief":return new pa(t);case"fill":return new ba(t);case"fill-extrusion":return new Pa(t);case"heatmap":return new ua(t);case"hillshade":return new ca(t);case"line":return new wa(t);case"raster":return new Ba(t);case"symbol":return new Da(t)}}var za=class{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(e,r){for(let i of e){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Nf(i);o._featureFilter=Ct(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=dc(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var fy=Y(Rt(),1),yy=Y(mi(),1);var Ur=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var $f=Y(Rt(),1),jf=Y(mi(),1);var Oa=class{constructor(e,r,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=i,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(e[r]=this[r]);return e}};var Ai=Y(ye(),1),fr=class t{constructor(){this.minX=1/0;this.maxX=-1/0;this.minY=1/0;this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new t;return r.extend(e(new Ai.default(this.minX,this.minY))),r.extend(e(new Ai.default(this.maxX,this.minY))),r.extend(e(new Ai.default(this.minX,this.maxY))),r.extend(e(new Ai.default(this.maxX,this.maxY))),r}static fromPoints(e){let r=new t;for(let n of e)r.extend(n);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};var _i=class{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $t(8192,16,0),this.grid3D=new $t(8192,16,0),this.featureIndexArray=new Jn,this.promoteId=r}insert(e,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new $f.default.VectorTile(new jf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ur(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,i){this.loadVTLayers();let o=e.params,a=8192/e.tileSize/e.scale,s=Ct(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=fr.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=fr.fromPoints(e.cameraQueryGeometry).expandBy(u),y=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,(g,d,x,b)=>gp(e.cameraQueryGeometry,g-u,d-u,x+u,b+u));for(let g of y)p.push(g);p.sort(_x);let m={},h;for(let g=0;g<p.length;g++){let d=p[g];if(d===h)continue;h=d;let x=this.featureIndexArray.get(d),b=null;this.loadMatchingFeature(m,x.bucketIndex,x.sourceLayerIndex,x.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,S,A)=>(b||(b=_e(v)),S.queryIntersectsFeature({queryGeometry:l,feature:v,featureState:A,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!f.some(d=>a.has(d)))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let d=Ne(h,!0);if(!o.filter(new W(this.tileID.overscaledZ),d,this.tileID.canonical))return}else if(!o.filter(new W(this.tileID.overscaledZ),h))return;let g=this.getId(h,y);for(let d=0;d<f.length;d++){let x=f[d];if(a&&!a.has(x))continue;let b=l[x];if(!b)continue;let v={};g&&c&&(v=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let S=de({},u[x]);S.paint=Uf(S.paint,b.paint,h,v,s),S.layout=Uf(S.layout,b.layout,h,v,s);let A=!p||p(h,b,v);if(!A)continue;let w=new Oa(h,this.z,this.x,this.y,g);w.layer=S;let T=e[x];T===void 0&&(T=e[x]=[]),T.push({featureIndex:i,feature:w,intersectionZ:A})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=Ct(o);for(let p of e)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(e){for(let r of this.bucketLayerIDs)for(let n of r)if(e===n)return!0;return!1}getId(e,r){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[i],typeof n=="boolean"&&(n=Number(n)),n===void 0&&e.properties?.cluster&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};I("FeatureIndex",_i,{omit:["rawTileData","sourceLayerCoder"]});function Uf(t,e,r,n,i){return tn(t,(o,a)=>{let s=e instanceof kt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function _x(t,e){return e-t}var qf=Y(ye(),1);var et=class t extends qf.default{constructor(e,r,n,i){super(e,r),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};I("Anchor",et);function Cl(t,e,r,n,i){if(e.segment===void 0||r===0)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=t[a-1],p=t[a],f=t[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Wf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Xf(t,e,r){return t?3/5*e*r:0}function Hf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Zf(t,e,r,n,i,o){let a=Xf(r,i,o),s=Hf(r,n)*o,l=0,u=Wf(t)/2;for(let c=0;c<t.length-1;c++){let p=t[c],f=t[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=lt.number(p.x,f.x,m),g=lt.number(p.y,f.y,m),d=new et(h,g,f.angleTo(p),c);return d._round(),!a||Cl(t,d,s,a,e)?d:void 0}l+=y}}function Jf(t,e,r,n,i,o,a,s,l){let u=Xf(n,o,a),c=Hf(n,i),p=c*a,f=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-p<e/4&&(e=p+e/4);let y=o*2,m=f?e/2*s%e:(c/2+y)*a*s%e;return Yf(t,m,e,u,r,p,f,!1,l)}function Yf(t,e,r,n,i,o,a,s,l){let u=o/2,c=Wf(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],g=t[m+1],d=h.dist(g),x=g.angleTo(h);for(;f+r<p+d;){f+=r;let b=(f-p)/d,v=lt.number(h.x,g.x,b),S=lt.number(h.y,g.y,b);if(v>=0&&v<l&&S>=0&&S<l&&f-u>=0&&f+u<=c){let A=new et(v,S,x,m);A._round(),(!n||Cl(t,A,o,n,i))&&y.push(A)}}p+=d}return!s&&!y.length&&!a&&(y=Yf(t,p/2,r,n,i,o,a,!0,l)),y}var ht=Y(ye(),1);function Kf(t,e,r,n,i){let o=[];for(let a=0;a<t.length;a++){let s=t[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<e&&p.x<e||(c.x<e?c=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var be=Y(ye(),1);var $r=he;function kl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*$r,l=o.paddedRect.h-2*$r,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=o.stretchX||[[0,s]],p=o.stretchY||[[0,l]],f=(_,B)=>_+B[1]-B[0],y=c.reduce(f,0),m=p.reduce(f,0),h=s-y,g=l-m,d=0,x=y,b=0,v=m,S=0,A=h,w=0,T=g;if(o.content&&n){let _=o.content,B=_[2]-_[0],G=_[3]-_[1];(o.textFitWidth||o.textFitHeight)&&(u=Ma(t)),d=Ga(c,0,_[0]),b=Ga(p,0,_[1]),x=Ga(c,_[0],_[2]),v=Ga(p,_[1],_[3]),S=_[0]-d,w=_[1]-b,A=B-x,T=G-v}let M=u.x1,D=u.y1,V=u.x2-M,z=u.y2-D,L=(_,B,G,O)=>{let R=Na(_.stretch-d,x,V,M),K=Ua(_.fixed-S,A,_.stretch,y),X=Na(B.stretch-b,v,z,D),re=Ua(B.fixed-w,T,B.stretch,m),me=Na(G.stretch-d,x,V,M),Ut=Ua(G.fixed-S,A,G.stretch,y),tt=Na(O.stretch-b,v,z,D),gt=Ua(O.fixed-w,T,O.stretch,m),Gi=new be.default(R,X),Ni=new be.default(me,X),Ui=new be.default(me,tt),$i=new be.default(R,tt),is=new be.default(K/a,re/a),Ie=new be.default(Ut/a,gt/a),bt=e*Math.PI/180;if(bt){let xt=Math.sin(bt),Zr=Math.cos(bt),Ve=[Zr,-xt,xt,Zr];Gi._matMult(Ve),Ni._matMult(Ve),$i._matMult(Ve),Ui._matMult(Ve)}let Hr=_.stretch+_.fixed,os=G.stretch+G.fixed,ji=B.stretch+B.fixed,as=O.stretch+O.fixed,Te={x:o.paddedRect.x+$r+Hr,y:o.paddedRect.y+$r+ji,w:os-Hr,h:as-ji},xe=A/a/V,rt=T/a/z;return{tl:Gi,tr:Ni,bl:$i,br:Ui,tex:Te,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:is,pixelOffsetBR:Ie,minFontScaleX:xe,minFontScaleY:rt,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=Qf(c,h,y),B=Qf(p,g,m);for(let G=0;G<_.length-1;G++){let O=_[G],R=_[G+1];for(let K=0;K<B.length-1;K++){let X=B[K],re=B[K+1];i.push(L(O,X,R,re))}}}return i}function Ga(t,e,r){let n=0;for(let i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Qf(t,e,r){let n=[{fixed:-$r,stretch:0}];for(let[i,o]of t){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:e+$r,stretch:r}),n}function Na(t,e,r,n){return t/e*r+n}function Ua(t,e,r,n){return t-e*r/n}function ey(t,e,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of e.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=Ia+1,h=!0,g=1,d=0,x=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ae,re=(ae-p.metrics.width*p.scale)/2;d=c.lineOffset/2-(p.imageName?-re:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,g=X.pixelRatio,m=he/g}let v=i?[p.x+b,p.y]:[0,0],S=i?[0,0]:[p.x+b+r[0],p.y+r[1]-d],A=[0,0];x&&(A=S,S=[0,0]);let w=p.metrics.isDoubleResolution?2:1,T=(p.metrics.left-m)*p.scale-b+S[0],M=(-p.metrics.top-m)*p.scale+S[1],D=T+f.w/w*p.scale/g,V=M+f.h/w*p.scale/g,z=new be.default(T,M),L=new be.default(D,M),_=new be.default(T,V),B=new be.default(D,V);if(x){let X=new be.default(-b,b-bi),re=-Math.PI/2,me=ae/2-b,Ut=p.imageName?me:0,tt=new be.default(5-bi-me,-Ut),gt=new be.default(...A);z._rotateAround(re,X)._add(tt)._add(gt),L._rotateAround(re,X)._add(tt)._add(gt),_._rotateAround(re,X)._add(tt)._add(gt),B._rotateAround(re,X)._add(tt)._add(gt)}if(l){let X=Math.sin(l),re=Math.cos(l),me=[re,-X,X,re];z._matMult(me),L._matMult(me),_._matMult(me),B._matMult(me)}let G=new be.default(0,0),O=new be.default(0,0);u.push({tl:z,tr:L,bl:_,br:B,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:G,pixelOffsetBR:O,minFontScaleX:0,minFontScaleY:0})}return u}var Ii=Y(ye(),1);var yr=class{constructor(e,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=e.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Ma(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};p.y1=p.y1*s-l[0],p.y2=p.y2*s+l[2],p.x1=p.x1*s-l[3],p.x2=p.x2*s+l[1];let f=a.collisionPadding;if(f&&(p.x1-=f[0]*s,p.y1-=f[1]*s,p.x2+=f[2]*s,p.y2+=f[3]*s),c){let y=new Ii.default(p.x1,p.y1),m=new Ii.default(p.x2,p.y1),h=new Ii.default(p.x1,p.y2),g=new Ii.default(p.x2,p.y2),d=c*Math.PI/180;y._rotate(d),m._rotate(d),h._rotate(d),g._rotate(d),p.x1=Math.min(y.x,m.x,h.x,g.x),p.x2=Math.max(y.x,m.x,h.x,g.x),p.y1=Math.min(y.y,m.y,h.y,g.y),p.y2=Math.max(y.y,m.y,h.y,g.y)}e.emplaceBack(r.x,r.y,p.x1,p.y1,p.x2,p.y2,n,i,o)}this.boxEndIndex=e.length}};var Ti=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};var El=Y(ye(),1);function ty(t,e=1,r=!1){let n=fr.fromPoints(t[0]),i=Math.min(n.width(),n.height()),o=i/2,a=new Ti([],Ix),{minX:s,minY:l,maxX:u,maxY:c}=n;if(i===0)return new El.default(s,l);for(let y=s;y<u;y+=i)for(let m=l;m<c;m+=i)a.push(new jr(y+o,m+o,o,t));let p=Cx(t),f=a.length;for(;a.length;){let y=a.pop();(y.d>p.d||!p.d)&&(p=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,f)),!(y.max-p.d<=e)&&(o=y.h/2,a.push(new jr(y.p.x-o,y.p.y-o,o,t)),a.push(new jr(y.p.x+o,y.p.y-o,o,t)),a.push(new jr(y.p.x-o,y.p.y+o,o,t)),a.push(new jr(y.p.x+o,y.p.y+o,o,t)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Ix(t,e){return e.max-t.max}function jr(t,e,r,n){this.p=new El.default(t,e),this.h=r,this.d=Tx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Tx(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){let o=e[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>t.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,ll(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Cx(t){let e=0,r=0,n=0,i=t[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,e+=c*3}return new jr(r/e,n/e,0,t)}var Dl=Y(rl(),1);var Ml=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(Ml||{}),Ot=7,$a=Number.POSITIVE_INFINITY;function Ll(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-Ot;break;case"bottom-right":case"bottom-left":s=-l+Ot;break;case"bottom":s=-o+Ot;break;case"top":s=o-Ot;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Ot;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Ot;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return e[1]!==$a?n(t,e[0],e[1]):r(t,e[0])}function Fl(t,e,r){let n=t.layout,i=n.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(i){let a=i.values,s=[];for(let l=0;l<a.length;l+=2){let u=s[l]=a[l],c=a[l+1].map(p=>p*ae);u.startsWith("top")?c[1]-=Ot:u.startsWith("bottom")&&(c[1]+=Ot),s[l+1]=c}return new Me(s)}let o=n.get("text-variable-anchor");if(o){let a;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?a=[n.get("text-radial-offset").evaluate(e,{},r)*ae,$a]:a=n.get("text-offset").evaluate(e,{},r).map(u=>u*ae);let l=[];for(let u of o)l.push(u,Ll(u,a));return new Me(l)}return null}function iy(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new W(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new W(c),t.canonical),i["text-size"].possiblyEvaluate(new W(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new W(c),t.canonical),i["icon-size"].possiblyEvaluate(new W(p),t.canonical)]}let a=n.get("text-line-height")*ae,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of t.bucket.features){let p=n.get("text-font").evaluate(c,{},t.canonical).join(","),f=u.evaluate(c,{},t.canonical),y=o.layoutTextSize.evaluate(c,{},t.canonical),m=o.layoutIconSize.evaluate(c,{},t.canonical),h={horizontal:{},vertical:void 0},g=c.text,d=[0,0];if(g){let S=g.toString(),A=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ae,w=Zc(S)?A:0,T=n.get("text-anchor").evaluate(c,{},t.canonical),M=Fl(r,c,t.canonical);if(!M){let _=n.get("text-radial-offset").evaluate(c,{},t.canonical);_?d=Ll(T,[_*ae,$a]):d=n.get("text-offset").evaluate(c,{},t.canonical).map(B=>B*ae)}let D=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),z=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ae:1/0,L=()=>{t.bucket.allowVerticalPlacement&&In(S)&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,"left",w,d,2,!0,y,f))};if(!s&&M){let _=new Set;if(D==="auto")for(let G=0;G<M.values.length;G+=2)_.add(ry(M.values[G]));else _.add(D);let B=!1;for(let G of _)if(!h.horizontal[G])if(B)h.horizontal[G]=h.horizontal[0];else{let O=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,"center",G,w,d,1,!1,y,f);O&&(h.horizontal[G]=O,B=O.positionedLines.length===1)}L()}else{D==="auto"&&(D=ry(T));let _=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,1,!1,y,f);_&&(h.horizontal[D]=_),L(),In(S)&&s&&l&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,2,!1,y,f))}}let x,b=!1;if(c.icon&&c.icon.name){let S=t.imageMap[c.icon.name];S&&(x=Ef(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),b=!!S.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(S.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=oy(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||x)&&kx(t.bucket,c,h,x,t.imageMap,o,y,m,d,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function ry(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kx(t,e,r,n,i,o,a,s,l,u,c,p){let f=o.textMaxSize.evaluate(e,{});f===void 0&&(f=a);let y=t.layers[0].layout,m=y.get("icon-offset").evaluate(e,{},c),h=oy(r.horizontal),g=24,d=a/g,x=t.tilePixelRatio*d,b=t.tilePixelRatio*f/g,v=t.tilePixelRatio*s,S=t.tilePixelRatio*y.get("symbol-spacing"),A=y.get("text-padding")*t.tilePixelRatio,w=Bf(y,e,c,t.tilePixelRatio),T=y.get("text-max-angle")/180*Math.PI,M=y.get("text-rotation-alignment")!=="viewport"&&y.get("symbol-placement")!=="point",D=y.get("icon-rotation-alignment")==="map"&&y.get("symbol-placement")!=="point",V=y.get("symbol-placement"),z=S/2,L=y.get("icon-text-fit"),_;n&&L!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(_=_l(n,r.vertical,L,y.get("icon-text-fit-padding"),m,d)),h&&(n=_l(n,h,L,y.get("icon-text-fit-padding"),m,d)));let B=c?p.line.getGranularityForZoomLevel(c.z):1,G=(O,R)=>{R.x<0||R.x>=8192||R.y<0||R.y>=8192||Mx(t,R,O,r,n,i,_,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,[A,A,A,A],M,l,v,w,D,m,e,o,u,c,a)};if(V==="line")for(let O of Kf(e.geometry,0,0,8192,8192)){let R=Ke(O,B),K=Jf(R,S,T,r.vertical||h,n,g,b,t.overscaling,8192);for(let X of K){let re=h;(!re||!Lx(t,re.text,z,X))&&G(R,X)}}else if(V==="line-center"){for(let O of e.geometry)if(O.length>1){let R=Ke(O,B),K=Zf(R,T,r.vertical||h,n,g,b);K&&G(R,K)}}else if(e.type==="Polygon")for(let O of Yt(e.geometry,0)){let R=ty(O,16),K=Ke(O[0],B,!0);G(K,new et(R.x,R.y,0))}else if(e.type==="LineString")for(let O of e.geometry){let R=Ke(O,B);G(R,new et(R[0].x,R[0].y,0))}else if(e.type==="Point")for(let O of e.geometry)for(let R of O)G([R],new et(R.x,R.y,0))}function Ex(t,e){let r=t.length,n=e?.values;if(n?.length>0)for(let i=0;i<n.length;i+=2){let o=Ml[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function ny(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=ey(e,r,s,i,o,a,n,t.allowVerticalPlacement),g=t.textSizeData,d=null;g.kind==="source"?(d=[zt*i.layout.get("text-size").evaluate(a,{})],d[0]>Qe&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)):g.kind==="composite"&&(d=[zt*y.compositeTextSizes[0].evaluate(a,{},m),zt*y.compositeTextSizes[1].evaluate(a,{},m)],(d[0]>Qe||d[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)),t.addSymbols(t.text,h,d,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let x of c)p[x]=t.text.placedSymbolArray.length-1;return h.length*4}function oy(t){for(let e in t)return t[e];return null}function Mx(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T){let M=t.addToLineVertexArray(e,r),D,V,z,L,_=0,B=0,G=0,O=0,R=-1,K=-1,X={},re=(0,Dl.default)("");if(t.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(v,{},w)+90,rt=n.vertical;z=new yr(l,e,u,c,p,rt,f,y,m,xe),a&&(L=new yr(l,e,u,c,p,a,g,d,m,xe))}if(i){let Te=s.layout.get("icon-rotate").evaluate(v,{}),xe=s.layout.get("icon-text-fit")!=="none",rt=kl(i,Te,A,xe),xt=a?kl(a,Te,A,xe):void 0;V=new yr(l,e,u,c,p,i,g,d,!1,Te),_=rt.length*4;let Zr=t.iconSizeData,Ve=null;Zr.kind==="source"?(Ve=[zt*s.layout.get("icon-size").evaluate(v,{})],Ve[0]>Qe&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)):Zr.kind==="composite"&&(Ve=[zt*S.compositeIconSizes[0].evaluate(v,{},w),zt*S.compositeIconSizes[1].evaluate(v,{},w)],(Ve[0]>Qe||Ve[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)),t.addSymbols(t.icon,rt,Ve,b,x,v,0,e,M.lineStartIndex,M.lineLength,-1,w),R=t.icon.placedSymbolArray.length-1,xt&&(B=xt.length*4,t.addSymbols(t.icon,xt,Ve,b,x,v,2,e,M.lineStartIndex,M.lineLength,-1,w),K=t.icon.placedSymbolArray.length-1)}let me=Object.keys(n.horizontal);for(let Te of me){let xe=n.horizontal[Te];if(!D){re=(0,Dl.default)(xe.text);let xt=s.layout.get("text-rotate").evaluate(v,{},w);D=new yr(l,e,u,c,p,xe,f,y,m,xt)}let rt=xe.positionedLines.length===1;if(G+=ny(t,e,xe,o,s,m,v,h,M,n.vertical?1:3,rt?me:[Te],X,R,S,w),rt)break}n.vertical&&(O+=ny(t,e,n.vertical,o,s,m,v,h,M,2,["vertical"],X,K,S,w));let Ut=D?D.boxStartIndex:t.collisionBoxArray.length,tt=D?D.boxEndIndex:t.collisionBoxArray.length,gt=z?z.boxStartIndex:t.collisionBoxArray.length,Gi=z?z.boxEndIndex:t.collisionBoxArray.length,Ni=V?V.boxStartIndex:t.collisionBoxArray.length,Ui=V?V.boxEndIndex:t.collisionBoxArray.length,$i=L?L.boxStartIndex:t.collisionBoxArray.length,is=L?L.boxEndIndex:t.collisionBoxArray.length,Ie=-1,bt=(Te,xe)=>Te&&Te.circleDiameter?Math.max(Te.circleDiameter,xe):xe;Ie=bt(D,Ie),Ie=bt(z,Ie),Ie=bt(V,Ie),Ie=bt(L,Ie);let Hr=Ie>-1?1:0;Hr&&(Ie*=T/ae),t.glyphOffsetArray.length>=Xe.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let os=Fl(s,v,w),[ji,as]=Ex(t.textAnchorOffsets,os);t.symbolInstances.emplaceBack(e.x,e.y,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical||-1,R,K,re,Ut,tt,gt,Gi,Ni,Ui,$i,is,u,G,O,_,B,Hr,0,f,Ie,ji,as)}function Lx(t,e,r,n){let i=t.compareText;if(!(e in i))i[e]=[];else{let o=i[e];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[e].push(n),!1}var ja=1,Ci=class{constructor(e){let r={},n=[];for(let s in e){let l=e[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*ja,h:p.bitmap.height+2*ja};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=hi(n),a=new sr({width:i||1,height:o||1});for(let s in e){let l=e[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;sr.copy(c.bitmap,a,{x:0,y:0},{x:p.x+ja,y:p.y+ja},c.bitmap)}}this.image=a,this.positions=r}};I("GlyphAtlas",Ci);function sy(t,e,r){e=Math.pow(2,r)-e-1;var n=ay(t*256,e*256,r),i=ay((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function ay(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}var py=Y(ye(),1);var Vl=63710088e-1,ki=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(wu(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return Vl*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof t)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new t(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new t(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var ly=2*Math.PI*Vl;function uy(t){return ly*Math.cos(t*Math.PI/180)}function Fx(t){return(180+t)/360}function Dx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Vx(t,e){return t/uy(e)}function Bx(t){return t*360-180}function Bl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Rx(t,e){return t*uy(Bl(e))}function zx(t){return 1/Math.cos(t*Math.PI/180)}var Ei=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=ki.convert(e);return new t(Fx(n.lng),Dx(n.lat),Vx(r,n.lat))}toLngLat(){return new ki(Bx(this.x),Bl(this.y))}toAltitude(){return Rx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ly*zx(Bl(this.y))}};function cy(t,e,r){return!(t<Hi||t>Xi||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}var qa=class{constructor(e,r,n){if(!cy(e,r,n))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${Hi}<=z<=${Xi} `);this.z=e,this.x=r,this.y=n,this.key=Mi(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){let i=sy(this.x,this.y,this.z),o=Ox(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){let r=Math.pow(2,this.z);return new py.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},Rl=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Mi(e,r.z,r.z,r.x,r.y)}},Li=class t{constructor(e,r,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new qa(n,+i,+o),this.key=Mi(r,e,n,i,o)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Mi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Mi(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new t(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new t(r,this.wrap,r,n,i),new t(r,this.wrap,r,n+1,i),new t(r,this.wrap,r,n,i+1),new t(r,this.wrap,r,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new t(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Rl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ei(e.x-this.wrap,e.y))}};function Mi(t,e,r,n,i){t*=2,t<0&&(t=t*-1-1);let o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}function Ox(t,e,r){let n="",i;for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}I("CanonicalTileID",qa);I("OverscaledTileID",Li,{omit:["terrainRttPosMatrix32f"]});var Wa=class{constructor(e){this.tileID=new Li(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.globalState=e.globalState}async parse(e,r,n,i,o){this.status="parsing",this.data=e,this.collisionBoxArray=new jn;let a=new Ur(Object.keys(e.layers).sort()),s=new _i(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n,subdivisionGranularity:o},c=r.familiesBySource[this.source];for(let A in c){let w=e.layers[A];if(!w)continue;w.version===1&&ce(`Vector tile source "${this.source}" layer "${A}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let T=a.encode(A),M=[];for(let D=0;D<w.length;D++){let V=w.feature(D),z=s.getId(V,A);M.push({feature:V,id:z,index:D,sourceLayerIndex:T})}for(let D of c[A]){let V=D[0];if(V.source!==this.source&&ce(`layer.source = ${V.source} does not equal this.source = ${this.source}`),V.minzoom&&this.zoom<Math.floor(V.minzoom)||V.maxzoom&&this.zoom>=V.maxzoom||V.visibility==="none")continue;zl(D,this.zoom,n),(l[V.id]=V.createBucket({index:s.bucketLayerIDs.length,layers:D,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source,globalState:this.globalState})).populate(M,u,this.tileID.canonical),s.bucketLayerIDs.push(D.map(L=>L.id))}}let p=tn(u.glyphDependencies,A=>Object.keys(A).map(Number));this.inFlightDependencies.forEach(A=>A?.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){let A=new AbortController;this.inFlightDependencies.push(A),f=i.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},A)}let y=Object.keys(u.iconDependencies),m=Promise.resolve({});if(y.length){let A=new AbortController;this.inFlightDependencies.push(A),m=i.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"icons"}},A)}let h=Object.keys(u.patternDependencies),g=Promise.resolve({});if(h.length){let A=new AbortController;this.inFlightDependencies.push(A),g=i.sendAsync({type:"GI",data:{icons:h,source:this.source,tileID:this.tileID,type:"patterns"}},A)}let[d,x,b]=await Promise.all([f,m,g]),v=new Ci(d),S=new di(x,b);for(let A in l){let w=l[A];w instanceof Xe?(zl(w.layers,this.zoom,n),iy({bucket:w,glyphMap:d,glyphPositions:v.positions,imageMap:x,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):w.hasPattern&&(w instanceof pr||w instanceof ur||w instanceof cr)&&(zl(w.layers,this.zoom,n),w.addFeatures(u,this.tileID.canonical,S.patternPositions))}return this.status="done",{buckets:Object.values(l).filter(A=>!A.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:v.image,imageAtlas:S,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?x:null,glyphPositions:this.returnDependencies?v.positions:null}}};function zl(t,e,r){let n=new W(e);for(let i of t)i.recalculate(n,r)}var Gx=60,XI=1e3/Gx;var qr=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}};var Wr=class{constructor(e,r,n){this.actor=e,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(e,r){let n=await Uc(e.request,r);try{return{vectorTile:new fy.default.VectorTile(new yy.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s=`Unable to parse the tile at ${e.request.url}, `;throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+=`got error: ${i.message}`,new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new qr(e.request):!1,i=new Wa(e);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(e,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return de({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(e){let r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=e.showCollisionBoxes,n.globalState=e.globalState,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=de({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}async abortTile(e){let r=this.loading,n=e.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(e){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}};var Xa=class{constructor(){this.loaded={}}async loadTile(e){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,u=i.width+2,c=i.height+2,p=vt(i)?new fe({width:u,height:c},await Iu(i,-1,-1,u,c)):i,f=new ii(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var Gy=Y(gy(),1);var Ol=Y(ye(),1),by=Y(Rt(),1);var Nx=by.default.VectorTileFeature.prototype.toGeoJSON,Gl=class{constructor(e){this._feature=e,this.extent=8192,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(this._feature.type===1){let e=[];for(let r of this._feature.geometry)e.push([new Ol.default(r[0],r[1])]);return e}else{let e=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new Ol.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Nx.call(this,e,r,n)}},Za=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new Gl(this._features[e])}};var Ny=Y(Ay(),1);var _y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$l=1,Di=8,Bi=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==$l)throw new Error(`Got v${i} data when expected v${$l}.`);let o=_y[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new t(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=_y.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Di+a+s+l),this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($l<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ql(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let g=f;g<=p;g++){let d=a[2*g],x=a[2*g+1];d>=e&&d<=n&&x>=r&&x<=i&&u.push(o[g])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=e&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?e<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let g=f;g<=p;g++)Iy(o[2*g],o[2*g+1],e,r)<=u&&l.push(i[g]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];Iy(m,h,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function ql(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;Ty(t,e,a,n,i,o),ql(t,e,r,n,a-1,1-o),ql(t,e,r,a+1,i,1-o)}function Ty(t,e,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));Ty(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(Vi(t,e,n,r),e[2*i+o]>a&&Vi(t,e,n,i);s<l;){for(Vi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?Vi(t,e,n,l):(l++,Vi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Vi(t,e,r,n){jl(t,r,n),jl(e,2*r,2*n),jl(e,2*r+1,2*n+1)}function jl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function Iy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Kx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Cy=Math.fround||(t=>(e=>(t[0]=+e,t[0])))(new Float32Array(1)),mr=2,Nt=3,Wl=4,Gt=5,Ey=6,Ri=class{constructor(e){this.options=Object.assign(Object.create(Kx),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o=`prepare ${e.length} points`;r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=Cy(Ya(c)),y=Cy(Ka(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(e,r){let n=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(Ya(n),Ka(a),Ya(o),Ka(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Gt]>1?ky(u,f,this.clusterProps):this.points[u[f+Nt]])}return c}getChildren(e){let r=this._getOriginId(e),n=this._getOriginZoom(e),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+Wl]===e&&p.push(a[y+Gt]>1?ky(a,y,this.clusterProps):this.points[a[y+Nt]])}if(p.length===0)throw new Error(i);return p}getLeaves(e,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,e,r,n,0),i}getTile(e,r,n){let i=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(e){let r=this._getOriginZoom(e)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(e);if(r++,n.length!==1)break;e=n[0].properties.cluster_id}return r}_appendLeaves(e,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(e,l.cluster_id,n,i,o):o<i?o++:e.push(s),e.length===n)break}return o}_createTree(e){let r=new Bi(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)r.add(e[n],e[n+1]);return r.finish(),r.data=e,r}_addTileFeatures(e,r,n,i,o,a){for(let s of e){let l=s*this.stride,u=r[l+Gt]>1,c,p,f;if(u)c=My(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Nt]];c=h.properties;let[g,d]=h.geometry.coordinates;p=Ya(g),f=Ka(d)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Nt]:m=this.points[r[l+Nt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=e.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+mr]<=r)continue;l[p+mr]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Gt],g=h;for(let d of m){let x=d*c;l[x+mr]>r&&(g+=l[x+Gt])}if(g>h&&g>=a){let d=f*h,x=y*h,b,v=-1,S=((p/c|0)<<5)+(r+1)+this.points.length;for(let A of m){let w=A*c;if(l[w+mr]<=r)continue;l[w+mr]=r;let T=l[w+Gt];d+=l[w]*T,x+=l[w+1]*T,l[w+Wl]=S,o&&(b||(b=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,w)))}l[p+Wl]=S,u.push(d/g,x/g,1/0,S,-1,g),o&&u.push(v)}else{for(let d=0;d<c;d++)u.push(l[p+d]);if(g>1)for(let d of m){let x=d*c;if(!(l[x+mr]<=r)){l[x+mr]=r;for(let b=0;b<c;b++)u.push(l[x+b])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+Gt]>1){let a=this.clusterProps[e[r+Ey]];return n?Object.assign({},a):a}let i=this.points[e[r+Nt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function ky(t,e,r){return{type:"Feature",id:t[e+Nt],properties:My(t,e,r),geometry:{type:"Point",coordinates:[Qx(t[e]),e0(t[e+1])]}}}function My(t,e,r){let n=t[e+Gt],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,o=t[e+Ey],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Nt],point_count:n,point_count_abbreviated:i})}function Ya(t){return t/360+.5}function Ka(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Qx(t){return(t-.5)*360}function e0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function zi(t,e,r,n){let i=n,o=e+(r-e>>1),a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1];for(let f=e+3;f<r;f+=3){let y=t0(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){let m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&zi(t,e,s,n),t[s+2]=i,r-s>3&&zi(t,s,r,n))}function t0(t,e,r,n,i,o){let a=i-r,s=o-n;if(a!==0||s!==0){let l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=t-r,s=e-n,a*a+s*s}function dt(t,e,r,n){let i={id:t??null,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")Qa(i,r);else if(e==="Polygon")Qa(i,r[0]);else if(e==="MultiLineString")for(let o of r)Qa(i,o);else if(e==="MultiPolygon")for(let o of r)Qa(i,o[0]);return i}function Qa(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Zl(t,e){let r=[];if(t.type==="FeatureCollection")for(let n=0;n<t.features.length;n++)es(r,t.features[n],e,n);else t.type==="Feature"?es(r,t,e):es(r,{geometry:t},e);return r}function es(t,e,r,n){if(!e.geometry)return;let i=e.geometry.coordinates;if(i&&i.length===0)return;let o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")Ly(i,s);else if(o==="MultiPoint")for(let u of i)Ly(u,s);else if(o==="LineString")Hl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(let u of i)s=[],Hl(u,s,a,!1),t.push(dt(l,"LineString",s,e.properties));return}else Xl(i,s,a,!1);else if(o==="Polygon")Xl(i,s,a,!0);else if(o==="MultiPolygon")for(let u of i){let c=[];Xl(u,c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(let u of e.geometry.geometries)es(t,{id:l,geometry:u,properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(dt(l,o,s,e.properties))}function Ly(t,e){e.push(Fy(t[0]),Dy(t[1]),0)}function Hl(t,e,r,n){let i,o,a=0;for(let l=0;l<t.length;l++){let u=Fy(t[l][0]),c=Dy(t[l][1]);e.push(u,c,0),l>0&&(n?a+=(i*c-u*o)/2:a+=Math.sqrt(Math.pow(u-i,2)+Math.pow(c-o,2))),i=u,o=c}let s=e.length-3;e[2]=1,zi(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Xl(t,e,r,n){for(let i=0;i<t.length;i++){let o=[];Hl(t[i],o,r,n),e.push(o)}}function Fy(t){return t/360+.5}function Dy(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Ue(t,e,r,n,i,o,a,s){if(r/=e,n/=e,o>=r&&a<n)return t;if(a<r||o>=n)return null;let l=[];for(let u of t){let c=u.geometry,p=u.type,f=i===0?u.minX:u.minY,y=i===0?u.maxX:u.maxY;if(f>=r&&y<n){l.push(u);continue}else if(y<r||f>=n)continue;let m=[];if(p==="Point"||p==="MultiPoint")r0(c,m,r,n,i);else if(p==="LineString")By(c,m,r,n,i,!1,s.lineMetrics);else if(p==="MultiLineString")Jl(c,m,r,n,i,!1);else if(p==="Polygon")Jl(c,m,r,n,i,!0);else if(p==="MultiPolygon")for(let h of c){let g=[];Jl(h,g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&p==="LineString"){for(let h of m)l.push(dt(u.id,p,h,u.tags));continue}(p==="LineString"||p==="MultiLineString")&&(m.length===1?(p="LineString",m=m[0]):p="MultiLineString"),(p==="Point"||p==="MultiPoint")&&(p=m.length===3?"Point":"MultiPoint"),l.push(dt(u.id,p,m,u.tags))}}return l.length?l:null}function r0(t,e,r,n,i){for(let o=0;o<t.length;o+=3){let a=t[o+i];a>=r&&a<=n&&Xr(e,t[o],t[o+1],t[o+2])}}function By(t,e,r,n,i,o,a){let s=Vy(t),l=i===0?n0:i0,u=t.start,c,p;for(let d=0;d<t.length-3;d+=3){let x=t[d],b=t[d+1],v=t[d+2],S=t[d+3],A=t[d+4],w=i===0?x:b,T=i===0?S:A,M=!1;a&&(c=Math.sqrt(Math.pow(x-S,2)+Math.pow(b-A,2))),w<r?T>r&&(p=l(s,x,b,S,A,r),a&&(s.start=u+c*p)):w>n?T<n&&(p=l(s,x,b,S,A,n),a&&(s.start=u+c*p)):Xr(s,x,b,v),T<r&&w>=r&&(p=l(s,x,b,S,A,r),M=!0),T>n&&w<=n&&(p=l(s,x,b,S,A,n),M=!0),!o&&M&&(a&&(s.end=u+c*p),e.push(s),s=Vy(t)),a&&(u+=c)}let f=t.length-3,y=t[f],m=t[f+1],h=t[f+2],g=i===0?y:m;g>=r&&g<=n&&Xr(s,y,m,h),f=s.length-3,o&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&Xr(s,s[0],s[1],s[2]),s.length&&e.push(s)}function Vy(t){let e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Jl(t,e,r,n,i,o){for(let a of t)By(a,e,r,n,i,o,!1)}function Xr(t,e,r,n){t.push(e,r,n)}function n0(t,e,r,n,i,o){let a=(o-e)/(n-e);return Xr(t,o,r+(i-r)*a,1),a}function i0(t,e,r,n,i,o){let a=(o-r)/(i-r);return Xr(t,e+(n-e)*a,o,1),a}function Kl(t,e){let r=e.buffer/e.extent,n=t,i=Ue(t,1,-1-r,r,0,-1,2,e),o=Ue(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=Ue(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=Ry(i,1).concat(n)),o&&(n=n.concat(Ry(o,-1)))),n}function Ry(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Yl(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(let s of i.geometry)a.push(Yl(s,e))}else if(o==="MultiPolygon"){a=[];for(let s of i.geometry){let l=[];for(let u of s)l.push(Yl(u,e));a.push(l)}}r.push(dt(i.id,o,a,i.tags))}return r}function Yl(t,e){let r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ts(t,e){if(t.transformed)return t;let r=1<<t.z,n=t.x,i=t.y;for(let o of t.features){let a=o.geometry,s=o.type;if(o.geometry=[],s===1)for(let l=0;l<a.length;l+=2)o.geometry.push(zy(a[l],a[l+1],e,r,n,i));else for(let l=0;l<a.length;l++){let u=[];for(let c=0;c<a[l].length;c+=2)u.push(zy(a[l][c],a[l][c+1],e,r,n,i));o.geometry.push(u)}}return t.transformed=!0,t}function zy(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function eu(t,e,r,n,i){let o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let s of t)o0(a,s,o,i);return a}function o0(t,e,r,n){let i=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let s=0;s<i.length;s+=3)a.push(i[s],i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")Ql(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let s=0;s<i.length;s++)Ql(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(let s=0;s<i.length;s++){let l=i[s];for(let u=0;u<l.length;u++)Ql(a,l[u],t,r,!0,u===0)}if(a.length){let s=e.tags||null;if(o==="LineString"&&n.lineMetrics){s={};for(let u in e.tags)s[u]=e.tags[u];s.mapbox_clip_start=i.start/i.size,s.mapbox_clip_end=i.end/i.size}let l={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:s};e.id!==null&&(l.id=e.id),t.features.push(l)}}function Ql(t,e,r,n,i,o){let a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}let s=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l],e[l+1])),r.numPoints++;i&&a0(s,o),t.push(s)}function a0(t,e){let r=0;for(let n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(let n=0,i=t.length;n<i/2;n+=2){let o=t[n],a=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=o,t[i-1-n]=a}}var s0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ru=class{constructor(e,r){r=this.options=l0(Object.create(s0),r);let n=r.debug;if(n&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=Zl(e,r);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=Kl(i,r),i.length&&this.splitTile(i,0,0,0),n&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,r,n,i,o,a,s){let l=[e,r,n,i],u=this.options,c=u.debug;for(;l.length;){i=l.pop(),n=l.pop(),r=l.pop(),e=l.pop();let p=1<<r,f=tu(r,n,i),y=this.tiles[f];if(!y&&(c>1&&console.time("creation"),y=this.tiles[f]=eu(e,r,n,i,u),this.tileCoords.push({z:r,x:n,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,i,y.numFeatures,y.numPoints,y.numSimplified),console.timeEnd("creation"));let T=`z${r}`;this.stats[T]=(this.stats[T]||0)+1,this.total++}if(y.source=e,o==null){if(r===u.indexMaxZoom||y.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(o!=null){let T=o-r;if(n!==a>>T||i!==s>>T)continue}}if(y.source=null,e.length===0)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,h=.5-m,g=.5+m,d=1+m,x=null,b=null,v=null,S=null,A=Ue(e,p,n-m,n+g,0,y.minX,y.maxX,u),w=Ue(e,p,n+h,n+d,0,y.minX,y.maxX,u);e=null,A&&(x=Ue(A,p,i-m,i+g,1,y.minY,y.maxY,u),b=Ue(A,p,i+h,i+d,1,y.minY,y.maxY,u),A=null),w&&(v=Ue(w,p,i-m,i+g,1,y.minY,y.maxY,u),S=Ue(w,p,i+h,i+d,1,y.minY,y.maxY,u),w=null),c>1&&console.timeEnd("clipping"),l.push(x||[],r+1,n*2,i*2),l.push(b||[],r+1,n*2,i*2+1),l.push(v||[],r+1,n*2+1,i*2),l.push(S||[],r+1,n*2+1,i*2+1)}}getTile(e,r,n){e=+e,r=+r,n=+n;let i=this.options,{extent:o,debug:a}=i;if(e<0||e>24)return null;let s=1<<e;r=r+s&s-1;let l=tu(e,r,n);if(this.tiles[l])return ts(this.tiles[l],o);a>1&&console.log("drilling down to z%d-%d-%d",e,r,n);let u=e,c=r,p=n,f;for(;!f&&u>0;)u--,c=c>>1,p=p>>1,f=this.tiles[tu(u,c,p)];return!f||!f.source?null:(a>1&&(console.log("found parent tile z%d-%d-%d",u,c,p),console.time("drilling down")),this.splitTile(f.source,u,c,p,e,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[l]?ts(this.tiles[l],o):null)}};function tu(t,e,r){return((1<<t)*r+e)*32+t}function l0(t,e){for(let r in e)t[r]=e[r];return t}function nu(t,e){return new ru(t,e)}function Oi(t,e){return e?t.properties[e]:t.id}function iu(t,e){if(t==null)return!0;if(t.type==="Feature")return Oi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=Oi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ou(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(Oi(t,e),t);else for(let n of t.features)r.set(Oi(n,e),n);return r}function Oy(t,e,r){if(e.removeAll&&t.clear(),e.remove)for(let n of e.remove)t.delete(n);if(e.add)for(let n of e.add){let i=Oi(n,r);i!=null&&t.set(i,n)}if(e.update)for(let n of e.update){let i=t.get(n.id);if(i==null)continue;let o=n.newGeometry||n.removeAllProperties,a=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((o||a)&&(i={...i},t.set(n.id,i),a&&(i.properties={...i.properties})),n.newGeometry&&(i.geometry=n.newGeometry),n.removeAllProperties)i.properties={};else if(n.removeProperties?.length>0)for(let s of n.removeProperties)Object.prototype.hasOwnProperty.call(i.properties,s)&&delete i.properties[s];if(n.addOrUpdateProperties?.length>0)for(let{key:s,value:l}of n.addOrUpdateProperties)i.properties[s]=l}}var rs=class extends Wr{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new Za(o.features),s=(0,Ny.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){this._pendingRequest?.abort();let n=r&&r.request&&r.request.collectResourceTiming?new qr(r.request):!1;this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(r,this._pendingRequest),this._geoJSONIndex=r.cluster?new Ri(u0(r)).load((await this._pendingData).features):nu(await this._pendingData,r.geojsonVtOptions),this.loaded={};let i={};if(n){let o=n.finish();o&&(i.resourceTiming={},i.resourceTiming[r.source]=JSON.parse(JSON.stringify(o)))}return i}catch(i){if(delete this._pendingRequest,Fc(i))return{abandoned:!0};throw i}}async getData(){return this._pendingData}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadAndProcessGeoJSON(r,n){let i=await this.loadGeoJSON(r,n);if(delete this._pendingRequest,typeof i!="object")throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if((0,Gy.default)(i,!0),r.filter){let o=Qt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(o.result==="error")throw new Error(o.value.map(s=>`${s.key}: ${s.message}`).join(", "));i={type:"FeatureCollection",features:i.features.filter(s=>o.value.evaluate({zoom:0},s))}}return i}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await Nc(r.request,n);return this._dataUpdateable=iu(o.data,i)?ou(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=iu(o,i)?ou(o,i):void 0,o}catch{throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`)}if(!r.dataDiff)throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${r.source}`);return Oy(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function u0({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(e);for(let s of a){let[l,u]=e[s],c=Qt(u),p=Qt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return t.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},t.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},t}var ns=class{constructor(e){this.self=e,this.actor=new Co(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(`Worker source with name "${r}" already registered.`);this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=Vc,this.self.removeProtocol=Bc,this.self.registerRTLTextPlugin=r=>{we.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("GD",(r,n)=>this._getWorkerSource(r,n.type,n.source).getData()),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(e,r){this.availableImages[e]=r;for(let n in this.workerSources[e]){let i=this.workerSources[e][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(e,r){return await we.syncState(r,this.self.importScripts)}_getAvailableImages(e){let r=this.availableImages[e];return r||(r=[]),r}_getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new za),r}_getWorkerSource(e,r,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),!this.workerSources[e][r][n]){let i={sendAsync:(o,a)=>(o.targetMapId=e,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[e][r][n]=new Wr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new rs(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(e),this._getAvailableImages(e));break}}return this.workerSources[e][r][n]}_getDEMWorkerSource(e,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]=new Xa),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new ns(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n',TD=()=>jr.WORKER_URL?jr.WORKER_URL:URL.createObjectURL(new Blob([PD],{type:"text/javascript"}));function SD(){return new Worker(TD())}var CD="maplibre_preloaded_worker_pool",G0=class X0{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<X0.workerCount;)this.workers.push(SD());return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[CD]}numActive(){return Object.keys(this.active).length}},MD=Math.floor(ve.hardwareConcurrency/2);G0.workerCount=ZS(globalThis)?Math.max(Math.min(MD,3),1):1;var Jh;function q0(){return Jh||(Jh=new G0),Jh}var $0=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let i=this.workerPool.acquire(t);for(let r=0;r<i.length;r++){let n=i[r],a=new wD(n,t);a.name="Worker ".concat(r),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let i=[];for(let r of this.actors)i.push(r.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}},el;function ID(){return el||(el=new $0(q0(),Tc),el.registerMessageHandler("GR",(e,t,i)=>Hl(t,i))),el}function ED(e,t){let i=V.create();return V.translate(i,i,[1,1,0]),V.scale(i,i,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?V.multiply(i,i,e.calculatePosMatrix(t.toUnwrapped())):i}function AD(e,t,i){if(e)for(let r of e){let n=t[r];if(n&&n.source===i&&n.type==="fill-extrusion")return!0}else for(let r in t){let n=t[r];if(n.source===i&&n.type==="fill-extrusion")return!0}return!1}function kD(e,t,i,r,n,a,o){var p;let s=AD((p=n==null?void 0:n.layers)!=null?p:null,t,e.id),l=a.maxPitchScaleFactor(),u=e.tilesIn(r,l,s);u.sort(Y0);let h=[];for(let d of u)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,i,e._state,d.queryGeometry,d.cameraQueryGeometry,d.scale,n,a,l,ED(e.transform,d.tileID),o?(f,y)=>o(d.tileID,f,y):void 0)});let c=RD(h);return zD(c,e)}function DD(e,t,i,r,n,a,o){let s={},l=a.queryRenderedSymbols(r),u=[];for(let h of Object.keys(l).map(Number))u.push(o[h]);u.sort(Y0);for(let h of u){let c=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],t,h.bucketIndex,h.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(let p in c){let d=s[p]=s[p]||[],f=c[p];f.sort((y,g)=>{let _=h.featureSortOrder;if(_){let b=_.indexOf(y.featureIndex);return _.indexOf(g.featureIndex)-b}else return g.featureIndex-y.featureIndex});for(let y of f)d.push(y)}}return BD(s,e,i)}function LD(e,t){let i=e.getRenderableIds().map(a=>e.getTileByID(a)),r=[],n={};for(let a=0;a<i.length;a++){let o=i[a],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(r,t))}return r}function Y0(e,t){let i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function RD(e){let t={},i={};for(let r of e){let n=r.queryResults,a=r.wrappedTileID,o=i[a]=i[a]||{};for(let s in n){let l=n[s],u=o[s]=o[s]||{},h=t[s]=t[s]||[];for(let c of l)u[c.featureIndex]||(u[c.featureIndex]=!0,h.push(c))}}return t}function zD(e,t){for(let i in e)for(let r of e[i])Z0(r,t);return e}function BD(e,t,i){for(let r in e)for(let n of e[r]){let a=t[r],o=i[a.source];Z0(n,o)}return e}function Z0(e,t){let i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}async function W0(e,t,i){let r=e;if(e.url?r=(await Kl(t.transformRequest(e.url,"Source"),i)).data:await ve.frameAsync(i),!r)return null;let n=Fo(K(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in r&&r.vector_layers&&(n.vectorLayerIds=r.vector_layers.map(a=>a.id)),n}var Ni=63710088e-1,oe=class uo{constructor(t,i){if(isNaN(t)||isNaN(i))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(i,")"));if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new uo(pn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let i=Math.PI/180,r=this.lat*i,n=t.lat*i,a=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*i);return Ni*Math.acos(Math.min(a,1))}static convert(t){if(t instanceof uo)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new uo(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new uo(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}},Zi=class Dr{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof oe?new oe(t.lng,t.lat):oe.convert(t),this}setSouthWest(t){return this._sw=t instanceof oe?new oe(t.lng,t.lat):oe.convert(t),this}extend(t){let i=this._sw,r=this._ne,n,a;if(t instanceof oe)n=t,a=t;else if(t instanceof Dr){if(n=t._sw,a=t._ne,!n||!a)return this}else{if(Array.isArray(t))if(t.length===4||t.every(Array.isArray)){let o=t;return this.extend(Dr.convert(o))}else{let o=t;return this.extend(oe.convert(o))}else if(t&&("lng"in t||"lon"in t)&&"lat"in t)return this.extend(oe.convert(t));return this}return!i&&!r?(this._sw=new oe(n.lng,n.lat),this._ne=new oe(a.lng,a.lat)):(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)),this}getCenter(){return new oe((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new oe(this.getWest(),this.getNorth())}getSouthEast(){return new oe(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return"LngLatBounds(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:i,lat:r}=oe.convert(t),n=this._sw.lat<=r&&r<=this._ne.lat,a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),n&&a}static convert(t){return t instanceof Dr||!t?t:new Dr(t)}static fromLngLat(t,i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*t.lat);return new Dr(new oe(t.lng-n,t.lat-r),new oe(t.lng+n,t.lat+r))}adjustAntiMeridian(){let t=new oe(this._sw.lng,this._sw.lat),i=new oe(this._ne.lng,this._ne.lat);return t.lng>i.lng?new Dr(t,new oe(i.lng+360,i.lat)):new Dr(t,i)}},H0=2*Math.PI*Ni;function K0(e){return H0*Math.cos(e*Math.PI/180)}function ba(e){return(180+e)/360}function vn(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function mn(e,t){return e/K0(t)}function OD(e){return e*360-180}function tp(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function ip(e,t){return e*K0(tp(t))}function FD(e){return 1/Math.cos(e*Math.PI/180)}var Ue=class J0{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=oe.convert(t);return new J0(ba(r.lng),vn(r.lat),mn(i,r.lat))}toLngLat(){return new oe(OD(this.x),tp(this.y))}toAltitude(){return ip(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/H0*FD(tp(this.y))}},Q0=class{constructor(e,t,i){this.bounds=Zi.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=Math.pow(2,e.z),i={minX:Math.floor(ba(this.bounds.getWest())*t),minY:Math.floor(vn(this.bounds.getNorth())*t),maxX:Math.ceil(ba(this.bounds.getEast())*t),maxY:Math.ceil(vn(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}},ND=class extends Ft{constructor(e,t,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,K(this,Fo(t,["url","scheme","tileSize","promoteId"])),this._options=K({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}async load(){this._loaded=!1,this.fire(new $("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await W0(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(K(this,e),e.bounds&&(this.tileBounds=new Q0(e.bounds,this.minzoom,this.maxzoom)),this.fire(new $("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new $("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new ne(e))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return K({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),r="LT";else if(e.state==="loading")return new Promise((n,a)=>{e.reloadPromise={resolve:n,reject:a}});e.abortController=new AbortController;try{let n=await e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,n)}catch(n){if(delete e.abortController,e.aborted)return;if(n&&n.status!==404)throw n;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},ev=class extends Ft{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=K({type:"raster"},t),K(this,Fo(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new $("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let t=await W0(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(K(this,t),t.bounds&&(this.tileBounds=new Q0(t.bounds,this.minzoom,this.maxzoom)),this.fire(new $("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new $("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this.fire(new ne(t))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return K({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let i=await Gi.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let r=this.map.painter.context,n=r.gl,a=i.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new st(r,a,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};function VD(e,t,i){t=Math.pow(2,i)-t-1;var r=Ry(e*256,t*256,i),n=Ry((e+1)*256,(t+1)*256,i);return r[0]+","+r[1]+","+n[0]+","+n[1]}function Ry(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i),n=e*r-2*Math.PI*6378137/2,a=t*r-2*Math.PI*6378137/2;return[n,a]}var jD=se(ce(),1);function UD(e,t,i){return!(e<Sp||e>Zl||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}function GD(e,t){let{x:i,y:r}=Ue.fromLngLat(t);return!(e<Sp||e>Zl||r<0||r>=1||i<0||i>=1)}var Pu=class{constructor(e,t,i){if(!UD(e,t,i))throw new Error("x=".concat(t,", y=").concat(i,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," ").concat(Sp,"<=z<=").concat(Zl," "));this.z=e,this.x=t,this.y=i,this.key=la(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){let r=VD(this.x,this.y,this.z),n=XD(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new jD.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},Nl=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=la(e,t.z,t.z,t.x,t.y)}},Tt=class yi{constructor(t,i,r,n,a){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(r));this.overscaledZ=t,this.wrap=i,this.canonical=new Pu(r,+n,+a),this.key=la(i,t,r,n,a)}clone(){return new yi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let i=this.canonical.z-t;return t>this.canonical.z?new yi(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new yi(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(t,i){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?la(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):la(this.wrap*+i,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let i=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new yi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=this.canonical.x*2,n=this.canonical.y*2;return[new yi(i,this.wrap,i,r,n),new yi(i,this.wrap,i,r+1,n),new yi(i,this.wrap,i,r,n+1),new yi(i,this.wrap,i,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new yi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new yi(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Nl(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new Ue(t.x-this.wrap,t.y))}};function la(e,t,i,r,n){e*=2,e<0&&(e=e*-1-1);let a=1<<i;return(a*a*e+a*n+r).toString(36)+i.toString(36)+t.toString(36)}function XD(e,t,i){let r="",n;for(let a=e;a>0;a--)n=1<<a-1,r+=(t&n?1:0)+(i&n?2:0);return r}H("CanonicalTileID",Pu);H("OverscaledTileID",Tt,{omit:["terrainRttPosMatrix32f"]});var qD=class extends ev{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=K({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(t,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let r=await Gi.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(r&&r.data){let n=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let a=hr(n)&&Mg()?n:await this.readImageNow(n),o={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let s=await e.actor.sendAsync({type:"LDT",data:o});e.dem=s,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(r){if(delete e.abortController,e.aborted)e.state="unloaded";else if(r)throw e.state="errored",r}}async readImageNow(e){if(typeof VideoFrame<"u"&&Bw()){let t=e.width+2,i=e.height+2;try{return new Ye({width:t,height:i},await JS(e,-1,-1,t,i))}catch(r){}}return ve.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,i=Math.pow(2,t.z),r=(t.x-1+i)%i,n=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+i)%i,o=t.x+1===i?e.wrap+1:e.wrap,s={};return s[new Tt(e.overscaledZ,n,t.z,r,t.y).key]={backfilled:!1},s[new Tt(e.overscaledZ,o,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(s[new Tt(e.overscaledZ,n,t.z,r,t.y-1).key]={backfilled:!1},s[new Tt(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new Tt(e.overscaledZ,o,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<i&&(s[new Tt(e.overscaledZ,n,t.z,r,t.y+1).key]={backfilled:!1},s[new Tt(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new Tt(e.overscaledZ,o,t.z,a,t.y+1).key]={backfilled:!1}),s}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}},$D=class extends Ft{constructor(e,t,i,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(r),this._data=t.data,this._options=K({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&ct('The maxzoom value "'.concat(this.maxzoom,'" is expected to be greater than the clusterMaxZoom value "').concat(t.clusterMaxZoom,'".')),this.workerOptions=K({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer!==void 0?t.buffer:128),tolerance:this._pixelsToTileUnits(t.tolerance!==void 0?t.tolerance:.375),extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(8192/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||ct("Integer expected for option 'clusterMaxZoom': provided value \"".concat(e,'" rounded to "').concat(t,'"')),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}async getData(){let e=K({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(t=>t.coordinates).flat(1/0):e.coordinates.flat(1/0)}async getBounds(){let e=new Zi,t=await this.getData(),i;switch(t.type){case"FeatureCollection":i=t.features.map(r=>this.getCoordinatesFromGeometry(r.geometry)).flat(1/0);break;case"Feature":i=this.getCoordinatesFromGeometry(t.geometry);break;default:i=this.getCoordinatesFromGeometry(t);break}if(i.length==0)return e;for(let r=0;r<i.length-1;r+=2)e.extend([i[r],i[r+1]]);return e}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(e){let t=K({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(ve.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new $("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new $("dataabort",{dataType:"source"}));return}let r=null;i.resourceTiming&&i.resourceTiming[this.id]&&(r=i.resourceTiming[this.id].slice(0));let n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&K(n,{resourceTiming:r}),this.fire(new $("data",ri(nt({},n),{sourceDataType:"metadata"}))),this.fire(new $("data",ri(nt({},n),{sourceDataType:"content"})))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new $("dataabort",{dataType:"source"}));return}this.fire(new ne(i))}}loaded(){return this._pendingLoads===0}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=this.actor;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;let r=await this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return K({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},tl=se(ce(),1),qi=class rp{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let i=new rp;return i.extend(t(new tl.default(this.minX,this.minY))),i.extend(t(new tl.default(this.maxX,this.minY))),i.extend(t(new tl.default(this.minX,this.maxY))),i.extend(t(new tl.default(this.maxX,this.maxY))),i}static fromPoints(t){let i=new rp;for(let r of t)i.extend(r);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}},$o=class extends Ft{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}async load(e){this._loaded=!1,this.fire(new $("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=await Gi.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new ne(t))}}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new $("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let t=e.map(Ue.fromLngLat);return this.tileID=YD(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(i=>this.tileID.getTilePoint(i)._round()),this.flippedWindingOrder=ZD(this.tileCoords),this.fire(new $("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture||(this.texture=new st(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new $("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:i,maxX:r,maxY:n}=qi.fromPoints(e),a={};for(let o=0;o<=Zl;o++){let s=Math.pow(2,o),l=Math.floor(t*s),u=Math.floor(i*s),h=Math.floor(r*s),c=Math.floor(n*s);a[o]={minTileX:l,minTileY:u,maxTileX:h,maxTileY:c}}return a}};function YD(e){let t=qi.fromPoints(e),i=t.width(),r=t.height(),n=Math.max(i,r),a=Math.max(0,Math.floor(-Math.log(n)/Math.LN2)),o=Math.pow(2,a);return new Pu(a,Math.floor((t.minX+t.maxX)/2*o),Math.floor((t.minY+t.maxY)/2*o))}function ZD(e){let t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[0].x,n=e[2].y-e[0].y;return t*n-i*r<0}var WD=class extends $o{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let t=await cC(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new ne(t))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new ne(new q("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(t.start(0)," and ").concat(t.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new st(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new $("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},HD=class extends $o{constructor(e,t,i,r){super(e,t,i,r),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(n=>!Array.isArray(n)||n.length!==2||n.some(a=>typeof a!="number")))&&this.fire(new ne(new q("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new ne(new q("sources.".concat(e),null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new ne(new q("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new ne(new q("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new ne(new q("sources.".concat(e),null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate!==void 0?t.animate:!0}async load(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new ne(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,i=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new st(t,this.canvas,i.RGBA,{premultiply:!0});let r=!1;for(let n in this.tiles){let a=this.tiles[n];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,r=!0)}r&&this.fire(new $("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},KD={},JD=(e,t,i,r)=>{let n=QD(t.type),a=new n(e,t,i,r);if(a.id!==e)throw new Error("Expected Source id to be ".concat(e," instead of ").concat(a.id));return a},QD=e=>{switch(e){case"geojson":return $D;case"image":return $o;case"raster":return ev;case"raster-dem":return qD;case"vector":return ND;case"video":return WD;case"canvas":return HD}return KD[e]};function e3(e,t){let i={};if(!t)return i;for(let r of e){let n=r.layerIds.map(a=>t.getLayer(a)).filter(Boolean);if(n.length!==0){r.layers=n,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(a=>n.filter(o=>o.id===a)[0]));for(let a of n)i[a.id]=r}}return i}var t3=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}},i3=se($l(),1),r3=se(Sg(),1),tv=class{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=r,this.properties=e.properties,this.id=n}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}},n3=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Oc(8192,16,0),this.grid3D=new Oc(8192,16,0),this.featureIndexArray=new m0,this.promoteId=t}insert(e,t,i,r,n,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);let s=a?this.grid3D:this.grid;for(let l=0;l<t.length;l++){let u=t[l],h=[1/0,1/0,-1/0,-1/0];for(let c=0;c<u.length;c++){let p=u[c];h[0]=Math.min(h[0],p.x),h[1]=Math.min(h[1],p.y),h[2]=Math.max(h[2],p.x),h[3]=Math.max(h[3],p.y)}h[0]<8192&&h[1]<8192&&h[2]>=0&&h[3]>=0&&s.insert(o,h[0],h[1],h[2],h[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new i3.default.VectorTile(new r3.default(this.rawTileData)).layers,this.sourceLayerCoder=new t3(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,r){this.loadVTLayers();let n=e.params,a=8192/e.tileSize/e.scale,o=Mo(n.filter),s=e.queryGeometry,l=e.queryPadding*a,u=qi.fromPoints(s),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=qi.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,g,_,b)=>KE(e.cameraQueryGeometry,y-l,g-l,_+l,b+l));for(let y of p)h.push(y);h.sort(a3);let d={},f;for(let y=0;y<h.length;y++){let g=h[y];if(g===f)continue;f=g;let _=this.featureIndexArray.get(g),b=null;this.loadMatchingFeature(d,_.bucketIndex,_.sourceLayerIndex,_.featureIndex,o,n.layers,n.availableImages,t,i,r,(v,w,T)=>(b||(b=Sn(v)),w.queryIntersectsFeature({queryGeometry:s,feature:v,featureState:T,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,t,i,r,n,a,o,s,l,u,h){let c=this.bucketLayerIDs[t];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){let y=Cn(d,!0);if(!n.filter(new lt(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new lt(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let y=0;y<c.length;y++){let g=c[y];if(a&&!a.has(g))continue;let _=s[g];if(!_)continue;let b={};f&&u&&(b=u.getState(_.sourceLayer||"_geojsonTileLayer",f));let v=K({},l[g]);v.paint=zy(v.paint,_.paint,d,b,o),v.layout=zy(v.layout,_.layout,d,b,o);let w=!h||h(d,_,b);if(!w)continue;let T=new tv(d,this.z,this.x,this.y,f);T.layer=v;let S=e[g];S===void 0&&(S=e[g]=[]),S.push({featureIndex:r,feature:T,intersectionZ:w})}}lookupSymbolFeatures(e,t,i,r,n,a,o,s){let l={};this.loadVTLayers();let u=Mo(n);for(let h of e)this.loadMatchingFeature(l,i,r,h,u,a,o,s,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){var r;let i=e.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[n],typeof i=="boolean"&&(i=Number(i)),i===void 0&&((r=e.properties)!=null&&r.cluster)&&this.promoteId&&(i=Number(e.properties.cluster_id))}return i}};H("FeatureIndex",n3,{omit:["rawTileData","sourceLayerCoder"]});function zy(e,t,i,r,n){return Tp(e,(a,o)=>{let s=t instanceof fu?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s})}function a3(e,t){return t-e}var np="RTLPluginLoaded",o3=class extends Ft{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=ID()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ve.resolveURL(e),!this.url)throw new Error("requested url ".concat(e," is invalid"));if(this.status==="unavailable")if(t)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new $(np))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},Qh=null;function ap(){return Qh||(Qh=new o3),Qh}var s3=3e4,iv=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=k_(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new a0;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=e3(e.buckets,t==null?void 0:t.style),this.hasSymbolBuckets=!1;for(let r in this.buckets){let n=this.buckets[r];if(n instanceof va)if(this.hasSymbolBuckets=!0,i)n.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let n=this.buckets[r];if(n instanceof va&&n.hasRTLText){this.hasRTLText=!0,ap().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let n=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(r).queryRadius(n))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new st(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new st(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,a,o,s,l,u,h){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:a,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:o,queryPadding:this.queryPadding*l,getElevation:h},e,t,i)}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;let r=i.loadVTLayers(),n=t&&t.sourceLayer?t.sourceLayer:"",a=r._geojsonTileLayer||r[n];if(!a)return;let o=Mo(t&&t.filter),{z:s,x:l,y:u}=this.tileID.canonical,h={z:s,x:l,y:u};for(let c=0;c<a.length;c++){let p=a.feature(c);if(o.needGeometry){let y=Cn(p,!0);if(!o.filter(new lt(this.tileID.overscaledZ),y,this.tileID.canonical))continue}else if(!o.filter(new lt(this.tileID.overscaledZ),p))continue;let d=i.getId(p,n),f=new tv(p,s,l,u,d);f.tile=h,e.push(f)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let i=YS(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(!t)r=!0;else if(this.expirationTime<t)r=!0;else{let n=this.expirationTime-t;n?this.expirationTime=i+Math.max(n,s3):r=!0}r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let i=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!t.style.hasLayer(r))continue;let n=this.buckets[r],a=n.layers[0].sourceLayer||"_geojsonTileLayer",o=i[a],s=e[a];if(!o||!s||Object.keys(s).length===0)continue;n.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});let l=t&&t.style&&t.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ve.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ve.now()+e}setDependencies(e,t){let i={};for(let r of t)i[r]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let r=this.dependencies[i];if(r){for(let n of t)if(r[n])return!0}}return!1}},l3=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let n={value:t,timeout:void 0};if(i!==void 0&&(n.timeout=setTimeout(()=>{this.remove(e,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let i=e.wrapped().key,r=t===void 0?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let i in this.data)for(let r of this.data[i])e(r.value)||t.push(r);for(let i of t)this.remove(i.value.tileID,i)}},By=se(ce(),1),u3=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){let r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},K(this.stateChanges[e][r],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let n in this.state[e])n!==r&&(this.deletedStates[e][n]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][r]===null){this.deletedStates[e][r]={};for(let n in this.state[e][r])i[n]||(this.deletedStates[e][r][n]=null)}else for(let n in i)this.deletedStates[e]&&this.deletedStates[e][r]&&this.deletedStates[e][r][n]===null&&delete this.deletedStates[e][r][n]}removeFeatureState(e,t,i){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][r]){this.deletedStates[e][r]={};for(i in this.stateChanges[e][r])this.deletedStates[e][r][i]=null}else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),r=this.state[e]||{},n=this.stateChanges[e]||{},a=K({},r[i],n[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let o=this.deletedStates[e][t];if(o===null)return{};for(let s in o)delete a[s]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let i={};for(let r in this.stateChanges){this.state[r]=this.state[r]||{};let n={};for(let a in this.stateChanges[r])this.state[r][a]||(this.state[r][a]={}),K(this.state[r][a],this.stateChanges[r][a]),n[a]=this.state[r][a];i[r]=n}for(let r in this.deletedStates){this.state[r]=this.state[r]||{};let n={};if(this.deletedStates[r]===null)for(let a in this.state[r])n[a]={},this.state[r][a]={};else for(let a in this.deletedStates[r]){if(this.deletedStates[r][a]===null)this.state[r][a]={};else for(let o of Object.keys(this.deletedStates[r][a]))delete this.state[r][a][o];n[a]=this.state[r][a]}i[r]=i[r]||{},K(i[r],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length!==0)for(let r in e)e[r].setFeatureState(i,t)}},h3=se(ce(),1),ua=89.25;function c3(e,t,i){let r=1/(1<<i.z);return new Ue(e/8192*r+i.x*r,t/8192*r+i.y*r)}function ji(e,t){let i=Ae(t.lat,-$i,$i);return new h3.default(ba(t.lng)*e,vn(i)*e)}function zo(e,t){return new Ue(t.x/e,t.y/e).toLngLat()}function Cl(e){return e.cameraToCenterDistance*Math.min(Math.tan(Xe(90-e.pitch))*.85,Math.tan(Xe(ua-e.pitch)))}function ec(e,t){let i=e.canonical,r=t/It(i.z),n=i.x+Math.pow(2,i.z)*e.wrap,a=V.identity(new Float64Array(16));return V.translate(a,a,[n*r,i.y*r,0]),V.scale(a,a,[r/8192,r/8192,1]),a}function op(e,t,i,r,n){let a=Ue.fromLngLat(e,t),o=mn(1,e.lat),s=n*o,l=s*Math.cos(Xe(i)),u=Math.sqrt(s*s-l*l),h=u*Math.sin(Xe(-r)),c=u*Math.cos(Xe(-r));return new Ue(a.x+h,a.y+c,a.z+l)}function p3(e,t,i){let r=t.intersectsFrustum(e);if(!i||r===0)return r;let n=t.intersectsPlane(i);return n===0?0:r===2&&n===2?2:1}function Oy(e,t,i){let r=0,n=(i-t)/10;for(let a=0;a<10;a++){let o=t+(a+.5)/10*(i-t);r+=n*Math.pow(Math.cos(o),e)}return r}function sp(e,t){return function(i,r,n,a,o){let s=2*((e-1)/Et(Math.cos(Xe(ua-o))/Math.cos(Xe(ua)))-1),l=Math.acos(n/a),u=2*Oy(s-1,0,Xe(o/2)),h=Math.min(Xe(ua),l+Xe(o/2)),c=Math.min(h,l-Xe(o/2)),p=Oy(s-1,c,h),d=Math.atan(r/n),f=Math.hypot(r,n),y=i;return y=y+Et(a/f/Math.max(.5,Math.cos(Xe(o/2)))),y+=s*Et(Math.cos(d))/2,y-=Et(Math.max(1,p/u/t))/2,y}}var d3=9.314,f3=3,m3=sp(d3,f3);function Tu(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+Et(e.tileSize/t.tileSize));return Math.max(0,i)}function Su(e,t){let i=e.getCameraFrustum(),r=e.getClippingPlane(),n=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=Ue.fromLngLat(e.center,e.elevation);n.z=a.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let o=e.getCoveringTilesDetailsProvider(),s=o.allowVariableZoom(e,t),l=Tu(e,t),u=t.minzoom||0,h=t.maxzoom!==void 0?t.maxzoom:e.maxZoom,c=Math.min(Math.max(0,l),h),p=Math.pow(2,c),d=[p*n.x,p*n.y,0],f=[p*a.x,p*a.y,0],y=Math.hypot(a.x-n.x,a.y-n.y),g=Math.abs(a.z-n.z),_=Math.hypot(y,g),b=T=>({zoom:0,x:0,y:0,wrap:T,fullyVisible:!1}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let T=1;T<=3;T++)v.push(b(-T)),v.push(b(T));for(v.push(b(0));v.length>0;){let T=v.pop(),S=T.x,M=T.y,E=T.fullyVisible,L={x:S,y:M,z:T.zoom},z=o.getTileBoundingVolume(L,T.wrap,e.elevation,t);if(!E){let x=p3(i,z,r);if(x===0)continue;E=x===2}let R=o.distanceToTile2d(n.x,n.y,L,z),k=l;s&&(k=(t.calculateTileZoom||m3)(e.zoom+Et(e.tileSize/t.tileSize),R,g,_,e.fov)),k=(t.roundZoom?Math.round:Math.floor)(k),k=Math.max(0,k);let D=Math.min(k,h);if(T.wrap=o.getWrap(a,L,T.wrap),T.zoom>=D){if(T.zoom<u)continue;let x=c-T.zoom,C=d[0]-.5-(S<<x),I=d[1]-.5-(M<<x),F=t.reparseOverscaled?Math.max(T.zoom,k):T.zoom;w.push({tileID:new Tt(T.zoom===h?F:T.zoom,T.wrap,T.zoom,S,M),distanceSq:Bt.sqrLen([f[0]-.5-S,f[1]-.5-M]),tileDistanceToCamera:Math.sqrt(C*C+I*I)});continue}for(let x=0;x<4;x++){let C=(S<<1)+x%2,I=(M<<1)+(x>>1),F=T.zoom+1;v.push({zoom:F,x:C,y:I,wrap:T.wrap,fullyVisible:E})}}return w.sort((T,S)=>T.distanceSq-S.distanceSq).map(T=>T.tileID)}var Fy=se(ce(),1),y3=qi.fromPoints([new Fy.default(0,0),new Fy.default(8192,8192)]),Bo=class ho extends Ft{constructor(t,i,r){super(),this.id=t,this.dispatcher=r,this.on("data",n=>this._dataHandler(n)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=JD(t,i,r,this),this._tiles={},this._cache=new l3(0,n=>this._unloadTile(n)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new u3,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t in this._tiles){let i=this._tiles[t];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,i,r){try{await this._source.loadTile(t),this._tileLoaded(t,i,r)}catch(n){t.state="errored",n.status!==404?this._source.fire(new ne(n,{tile:t})):this.update(this.transform,this.terrain)}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new $("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let i in this._tiles){let r=this._tiles[i];r.upload(t),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Ny).map(t=>t.key)}getRenderableIds(t){let i=[];for(let r in this._tiles)this._isIdRenderable(r,t)&&i.push(this._tiles[r]);return t?i.sort((r,n)=>{let a=r.tileID,o=n.tileID,s=new By.default(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians),l=new By.default(o.canonical.x,o.canonical.y)._rotate(-this.transform.bearingInRadians);return a.overscaledZ-o.overscaledZ||l.y-s.y||l.x-s.x}).map(r=>r.tileID.key):i.map(r=>r.tileID).sort(Ny).map(r=>r.key)}hasRenderableParent(t){let i=this.findLoadedParent(t,0);return i?this._isIdRenderable(i.tileID.key):!1}_isIdRenderable(t,i){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(i||!this._tiles[t].holdingForFade())}reload(t){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let i in this._tiles)t?this._reloadTile(i,"expired"):this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}async _reloadTile(t,i){let r=this._tiles[t];r&&(r.state!=="loading"&&(r.state=i),await this._loadTile(r,t,i))}_tileLoaded(t,i,r){t.timeAdded=ve.now(),r==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new $("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){let i=this.getRenderableIds();for(let n=0;n<i.length;n++){let a=i[n];if(t.neighboringTiles&&t.neighboringTiles[a]){let o=this.getTileByID(a);r(t,o),r(o,t)}}function r(n,a){n.needsHillshadePrepare=!0,n.needsTerrainPrepare=!0;let o=a.tileID.canonical.x-n.tileID.canonical.x,s=a.tileID.canonical.y-n.tileID.canonical.y,l=Math.pow(2,n.tileID.canonical.z),u=a.tileID.key;o===0&&s===0||Math.abs(s)>1||(Math.abs(o)>1&&(Math.abs(o+l)===1?o+=l:Math.abs(o-l)===1&&(o-=l)),!(!a.dem||!n.dem)&&(n.dem.backfillBorder(a.dem,o,s),n.neighboringTiles&&n.neighboringTiles[u]&&(n.neighboringTiles[u].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,i,r,n){for(let a in this._tiles){let o=this._tiles[a];if(n[a]||!o.hasData()||o.tileID.overscaledZ<=i||o.tileID.overscaledZ>r)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>i+1;){let u=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[u.key],o&&o.hasData()&&(s=u)}let l=s;for(;l.overscaledZ>i;)if(l=l.scaledTo(l.overscaledZ-1),t[l.key]||t[l.canonical.key]){n[s.key]=s;break}}}findLoadedParent(t,i){if(t.key in this._loadedParentTiles){let r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=i?r:null}for(let r=t.overscaledZ-1;r>=i;r--){let n=t.scaledTo(r),a=this._getLoadedTile(n);if(a)return a}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){let i=this._tiles[t.key];return i&&i.hasData()?i:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){let i=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=i*r,a=this._maxTileCacheZoomLevels===null?jr.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,o=Math.floor(n*a),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(t){let i=this._prevLng===void 0?t:this._prevLng,r=(t-i)/360,n=Math.round(r);if(this._prevLng=t,n){let a={};for(let o in this._tiles){let s=this._tiles[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+n),a[s.tileID.key]=s}this._tiles=a;for(let o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(let o in this._tiles){let s=this._tiles[o];this._setTileReloadTimer(o,s)}}}_updateCoveredAndRetainedTiles(t,i,r,n,a,o){let s={},l={},u=Object.keys(t),h=ve.now();for(let c of u){let p=t[c],d=this._tiles[c];if(!d||d.fadeEndTime!==0&&d.fadeEndTime<=h)continue;let f=this.findLoadedParent(p,i),y=this.findLoadedSibling(p),g=f||y||null;g&&(this._addTile(g.tileID),s[g.tileID.key]=g.tileID),l[c]=p}this._retainLoadedChildren(l,n,r,t);for(let c in s)t[c]||(this._coveredTiles[c]=!0,t[c]=s[c]);if(o){let c={},p={};for(let d of a)this._tiles[d.key].hasData()?c[d.key]=d:p[d.key]=d;for(let d in p){let f=p[d].children(this._source.maxzoom);this._tiles[f[0].key]&&this._tiles[f[1].key]&&this._tiles[f[2].key]&&this._tiles[f[3].key]&&(c[f[0].key]=t[f[0].key]=f[0],c[f[1].key]=t[f[1].key]=f[1],c[f[2].key]=t[f[2].key]=f[2],c[f[3].key]=t[f[3].key]=f[3],delete p[d])}for(let d in p){let f=p[d],y=this.findLoadedParent(f,this._source.minzoom),g=this.findLoadedSibling(f),_=y||g||null;if(_){c[_.tileID.key]=t[_.tileID.key]=_.tileID;for(let b in c)c[b].isChildOf(_.tileID)&&delete c[b]}}for(let d in this._tiles)c[d]||(this._coveredTiles[d]=!0)}}update(t,i){if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let r;!this.used&&!this.usedForTerrain?r=[]:this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(h=>new Tt(h.canonical.z,h.wrap,h.canonical.z,h.canonical.x,h.canonical.y)):(r=Su(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter(h=>this._source.hasTile(h))));let n=Tu(t,this._source),a=Math.max(n-ho.maxOverzooming,this._source.minzoom),o=Math.max(n+ho.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let h={};for(let c of r)if(c.canonical.z>this._source.minzoom){let p=c.scaledTo(c.canonical.z-1);h[p.key]=p;let d=c.scaledTo(Math.max(this._source.minzoom,Math.min(c.canonical.z,5)));h[d.key]=d}r=r.concat(Object.values(h))}let s=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new $("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(r,n);Vy(this._source.type)&&this._updateCoveredAndRetainedTiles(l,a,o,n,r,i);for(let h in l)this._tiles[h].clearFadeHold();let u=jS(this._tiles,l);for(let h of u){let c=this._tiles[h];c.hasSymbolBuckets&&!c.holdingForFade()?c.setHoldDuration(this.map._fadeDuration):(!c.hasSymbolBuckets||c.symbolFadeFinished())&&this._removeTile(h)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){var l;let r={},n={},a=Math.max(i-ho.maxOverzooming,this._source.minzoom),o=Math.max(i+ho.maxUnderzooming,this._source.minzoom),s={};for(let u of t){let h=this._addTile(u);r[u.key]=u,!h.hasData()&&i<this._source.maxzoom&&(s[u.key]=u)}this._retainLoadedChildren(s,i,o,r);for(let u of t){let h=this._tiles[u.key];if(h.hasData())continue;if(i+1>this._source.maxzoom){let p=u.children(this._source.maxzoom)[0],d=this.getTile(p);if(d&&d.hasData()){r[p.key]=p;continue}}else{let p=u.children(this._source.maxzoom);if(r[p[0].key]&&r[p[1].key]&&r[p[2].key]&&r[p[3].key])continue}let c=h.wasRequested();for(let p=u.overscaledZ-1;p>=a;--p){let d=u.scaledTo(p);if(n[d.key])break;if(n[d.key]=!0,h=this.getTile(d),!h&&c&&(h=this._addTile(d)),h){let f=h.hasData();if((f||!((l=this.map)!=null&&l.cancelPendingTileRequestsWhileZooming)||c)&&(r[d.key]=d),c=h.wasRequested(),f)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let t in this._tiles){let i=[],r,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}i.push(n.key);let a=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(a),r)break;n=a}for(let a of i)this._loadedParentTiles[a]=r}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let t in this._tiles){let i=this._tiles[t].tileID,r=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=r}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));let r=i;return i||(i=new iv(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,r||this._source.fire(new $("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,i){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);let r=i.getExpiryTimeout();r&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},r))}refreshTiles(t){for(let i in this._tiles)!this._isIdRenderable(i)&&this._tiles[i].state!="errored"||t.some(r=>r.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(t){let i=this._tiles[t];i&&(i.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),!(i.uses>0)&&(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){let i=t.sourceDataType;t.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&i==="content"&&(this.reload(t.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,i,r){let n=[],a=this.transform;if(!a)return n;let o=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=r?a.getCameraQueryGeometry(t):t,l=d=>a.screenPointToMercatorCoordinate(d,this.terrain),u=this.transformBbox(t,l,!o),h=this.transformBbox(s,l,!o),c=this.getIds(),p=qi.fromPoints(h);for(let d=0;d<c.length;d++){let f=this._tiles[c[d]];if(f.holdingForFade())continue;let y=o?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=Math.pow(2,a.zoom-f.tileID.overscaledZ),_=i*f.queryPadding*8192/f.tileSize/g;for(let b of y){let v=p.map(w=>b.getTilePoint(new Ue(w.x,w.y)));if(v.expandBy(_),v.intersects(y3)){let w=u.map(S=>b.getTilePoint(S)),T=h.map(S=>b.getTilePoint(S));n.push({tile:f,tileID:o?b:b.unwrapTo(0),queryGeometry:w,cameraQueryGeometry:T,scale:g})}}}return n}transformBbox(t,i,r){let n=t.map(i);if(r){let a=qi.fromPoints(t);a.shrinkBy(Math.min(a.width(),a.height())*.001);let o=a.map(i);qi.fromPoints(n).covers(o)||(n=n.map(s=>s.x>.5?new Ue(s.x-1,s.y,s.z):s))}return n}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(r=>this._tiles[r].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(Vy(this._source.type)){let t=ve.now();for(let i in this._tiles)if(this._tiles[i].fadeEndTime>=t)return!0}return!1}setFeatureState(t,i,r){t=t||"_geojsonTileLayer",this._state.updateState(t,i,r)}removeFeatureState(t,i,r){t=t||"_geojsonTileLayer",this._state.removeFeatureState(t,i,r)}getFeatureState(t,i){return t=t||"_geojsonTileLayer",this._state.getState(t,i)}setDependencies(t,i,r){let n=this._tiles[t];n&&n.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r in this._tiles)this._tiles[r].hasDependency(t,i)&&this._reloadTile(r,"reloading");this._cache.filter(r=>!r.hasDependency(t,i))}};Bo.maxOverzooming=10;Bo.maxUnderzooming=3;function Ny(e,t){let i=Math.abs(e.wrap*2)-+(e.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Vy(e){return e==="raster"||e==="image"||e==="video"}var zi=se(ce(),1),Er=se(ce(),1);function g3(e,t,i,r,n){let a=[];for(let o=0;o<e.length;o++){let s=e[o],l;for(let u=0;u<s.length-1;u++){let h=s[u],c=s[u+1];h.x<t&&c.x<t||(h.x<t?h=new Er.default(t,h.y+(c.y-h.y)*((t-h.x)/(c.x-h.x)))._round():c.x<t&&(c=new Er.default(t,h.y+(c.y-h.y)*((t-h.x)/(c.x-h.x)))._round()),!(h.y<i&&c.y<i)&&(h.y<i?h=new Er.default(h.x+(c.x-h.x)*((i-h.y)/(c.y-h.y)),i)._round():c.y<i&&(c=new Er.default(h.x+(c.x-h.x)*((i-h.y)/(c.y-h.y)),i)._round()),!(h.x>=r&&c.x>=r)&&(h.x>=r?h=new Er.default(r,h.y+(c.y-h.y)*((r-h.x)/(c.x-h.x)))._round():c.x>=r&&(c=new Er.default(r,h.y+(c.y-h.y)*((r-h.x)/(c.x-h.x)))._round()),!(h.y>=n&&c.y>=n)&&(h.y>=n?h=new Er.default(h.x+(c.x-h.x)*((n-h.y)/(c.y-h.y)),n)._round():c.y>=n&&(c=new Er.default(h.x+(c.x-h.x)*((n-h.y)/(c.y-h.y)),n)._round()),(!l||!h.equals(l[l.length-1]))&&(l=[h],a.push(l)),l.push(c)))))}}return a}var _3=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=Ae(e,0,1);let t=1,i=this._distances[t],r=e*this.paddedLength+this.padding;for(;i<r&&t<this._distances.length;)i=this._distances[++t];let n=t-1,a=this._distances[n],o=i-a,s=o>0?(r-a)/o:0;return this.points[n].mult(1-s).add(this.points[t].mult(s))}};function il(e,t){let i=!0;return e==="always"||(e==="never"||t==="never")&&(i=!1),i}var jy=class{constructor(e,t,i){let r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let a=0;a<this.xCellCount*this.yCellCount;a++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,n,a){this.boxCells[n].push(a)}_insertCircleCell(e,t,i,r,n,a){this.circleCells[n].push(a)}_query(e,t,i,r,n,a,o){if(i<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let l=0;l<this.boxKeys.length;l++)s.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],h=this.circles[l*3+1],c=this.circles[l*3+2];s.push({key:this.circleKeys[l],x1:u-c,y1:h-c,x2:u+c,y2:h+c})}}else{let l={hitTest:n,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,r,this._queryCell,s,l,o)}return s}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,n,a){return this._query(e,t,i,r,!0,n,a).length>0}hitTestCircle(e,t,i,r,n){let a=e-i,o=e+i,s=t-i,l=t+i;if(o<0||a>this.width||l<0||s>this.height)return!1;let u=[],h={hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(a,s,o,l,this._queryCellCircle,u,h,n),u.length>0}_queryCell(e,t,i,r,n,a,o,s){let{seenUids:l,hitTest:u,overlapMode:h}=o,c=this.boxCells[n];if(c!==null){let d=this.bboxes;for(let f of c)if(!l.box[f]){l.box[f]=!0;let y=f*4,g=this.boxKeys[f];if(e<=d[y+2]&&t<=d[y+3]&&i>=d[y+0]&&r>=d[y+1]&&(!s||s(g))&&(!u||!il(h,g.overlapMode))&&(a.push({key:g,x1:d[y],y1:d[y+1],x2:d[y+2],y2:d[y+3]}),u))return!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!l.circle[f]){l.circle[f]=!0;let y=f*3,g=this.circleKeys[f];if(this._circleAndRectCollide(d[y],d[y+1],d[y+2],e,t,i,r)&&(!s||s(g))&&(!u||!il(h,g.overlapMode))){let _=d[y],b=d[y+1],v=d[y+2];if(a.push({key:g,x1:_-v,y1:b-v,x2:_+v,y2:b+v}),u)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,a,o,s){let{circle:l,seenUids:u,overlapMode:h}=o,c=this.boxCells[n];if(c!==null){let d=this.bboxes;for(let f of c)if(!u.box[f]){u.box[f]=!0;let y=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,d[y+0],d[y+1],d[y+2],d[y+3])&&(!s||s(g))&&!il(h,g.overlapMode))return a.push(!0),!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!u.circle[f]){u.circle[f]=!0;let y=f*3,g=this.circleKeys[f];if(this._circlesCollide(d[y],d[y+1],d[y+2],l.x,l.y,l.radius)&&(!s||s(g))&&!il(h,g.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,i,r,n,a,o,s){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let d=u;d<=c;d++){let f=this.xCellCount*d+p;if(n.call(this,e,t,i,r,f,a,o,s))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,a){let o=r-e,s=n-t,l=i+a;return l*l>o*o+s*s}_circleAndRectCollide(e,t,i,r,n,a,o){let s=(a-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;let u=(o-n)/2,h=Math.abs(t-(n+u));if(h>u+i)return!1;if(l<=s||h<=u)return!0;let c=l-s,p=h-u;return c*c+p*p<=i*i}},Oo=se(ce(),1);function Sd(e,t,i){let r=V.create();if(!e){let{vecSouth:n,vecEast:a}=Cd(t),o=_o.create();o[0]=a[0],o[1]=a[1],o[2]=n[0],o[3]=n[1],_o.invert(o,o),r[0]=o[0],r[1]=o[1],r[4]=o[2],r[5]=o[3]}return V.scale(r,r,[1/i,1/i,1]),r}function x3(e,t,i,r){if(e){let n=V.create();if(!t){let{vecSouth:a,vecEast:o}=Cd(i);n[0]=o[0],n[1]=o[1],n[4]=a[0],n[5]=a[1]}return V.scale(n,n,[r,r,1]),n}else return i.pixelsToClipSpaceMatrix}function Cd(e){let t=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),n=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),o=Bt.create();o[0]=-n*r*i-a*t,o[1]=-a*r*i+n*t;let s=Bt.length(o);s<1e-9?Bt.zero(o):Bt.scale(o,o,1/s);let l=Bt.create();l[0]=n*r*t-a*i,l[1]=a*r*t+n*i;let u=Bt.length(l);return u<1e-9?Bt.zero(l):Bt.scale(l,l,1/u),{vecEast:l,vecSouth:o}}function Md(e,t,i,r){let n;r?(n=[e,t,r(e,t),1],at.transformMat4(n,n,i)):(n=[e,t,0,1],Id(n,n,i));let a=n[3];return{point:new Oo.default(n[0]/a,n[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function rv(e,t){return .5+.5*(e/t)}function v3(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function b3(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=i?e.textSizeData:e.iconSizeData,f=wu(d,t.transform.zoom),y=[256/t.width*2+1,256/t.height*2+1],g=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let _=e.lineVertexArray,b=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=t.transform.width/t.transform.height,w=!1;for(let T=0;T<b.length;T++){let S=b.get(T);if(S.hidden||S.writingMode===2&&!w){ha(S.numGlyphs,g);continue}w=!1;let M=new Oo.default(S.anchorX,S.anchorY),E={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:_,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:M,unwrappedTileID:l,width:u,height:h,translation:c},L=ov(S.anchorX,S.anchorY,E);if(!v3(L.point,y)){ha(S.numGlyphs,g);continue}let z=L.signedDistanceFromCamera,R=rv(t.transform.cameraToCenterDistance,z),k=Td(d,f,S),D=a?k*t.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/R:k*R,x=Gy({projectionContext:E,pitchedLabelPlaneMatrixInverse:n,symbol:S,fontSize:D,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s});w=x.useVertical,(x.notEnoughRoom||w||x.needsFlipping&&Gy({projectionContext:E,pitchedLabelPlaneMatrixInverse:n,symbol:S,fontSize:D,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s}).notEnoughRoom)&&ha(S.numGlyphs,g)}i?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function nv(e,t,i,r,n,a,o,s){let l=a.glyphStartIndex+a.numGlyphs,u=a.lineStartIndex,h=a.lineStartIndex+a.lineLength,c=t.getoffsetX(a.glyphStartIndex),p=t.getoffsetX(l-1),d=Vl(e*c,i,r,n,a.segment,u,h,s,o);if(!d)return null;let f=Vl(e*p,i,r,n,a.segment,u,h,s,o);return!f||s.projectionCache.anyProjectionOccluded?null:{first:d,last:f}}function Uy(e,t,i,r){if(e===1){let n=Math.abs(i.y-t.y),a=Math.abs(i.x-t.x)*r;if(n>a)return{useVertical:!0}}return(e===2?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function Gy(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:n,flip:a,keepUpright:o,glyphOffsetArray:s,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:h}=e,c=n/24,p=r.lineOffsetX*c,d=r.lineOffsetY*c,f;if(r.numGlyphs>1){let y=r.glyphStartIndex+r.numGlyphs,g=r.lineStartIndex,_=r.lineStartIndex+r.lineLength,b=nv(c,s,p,d,a,r,h,t);if(!b)return{notEnoughRoom:!0};let v=rl(b.first.point.x,b.first.point.y,t,i),w=rl(b.last.point.x,b.last.point.y,t,i);if(o&&!a){let T=Uy(r.writingMode,v,w,u);if(T)return T}f=[b.first];for(let T=r.glyphStartIndex+1;T<y-1;T++){let S=Vl(c*s.getoffsetX(T),p,d,a,r.segment,g,_,t,h);if(!S)return{notEnoughRoom:!0};f.push(S)}f.push(b.last)}else{if(o&&!a){let g=bn(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,_=r.lineStartIndex+r.segment+1,b=new Oo.default(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),v=bn(b.x,b.y,t),w=v.signedDistanceFromCamera>0?v.point:av(t.tileAnchorPoint,b,g,1,t),T=rl(g.x,g.y,t,i),S=rl(w.x,w.y,t,i),M=Uy(r.writingMode,T,S,u);if(M)return M}let y=Vl(c*s.getoffsetX(r.glyphStartIndex),p,d,a,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t,h);if(!y||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[y]}for(let y of f)Ro(l,y.point,y.angle);return{}}function av(e,t,i,r,n){let a=e.add(e.sub(t)._unit()),o=bn(a.x,a.y,n).point,s=i.sub(o);return i.add(s._mult(r/s.mag()))}function lp(e,t,i){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let n=new Oo.default(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),a=bn(n.x,n.y,t);if(a.signedDistanceFromCamera>0)return r.projections[e]=a.point,r.anyProjectionOccluded=r.anyProjectionOccluded||a.isOccluded,a.point;let o=e-i.direction,s=i.distanceFromAnchor===0?t.tileAnchorPoint:new Oo.default(t.lineVertexArray.getx(o),t.lineVertexArray.gety(o)),l=i.absOffsetX-i.distanceFromAnchor+1;return av(s,n,i.previousVertex,l,t)}function bn(e,t,i){let r=e+i.translation[0],n=t+i.translation[1],a;return i.pitchWithMap?(a=Md(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),a.isOccluded=!1):(a=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),a.point.x=(a.point.x*.5+.5)*i.width,a.point.y=(-a.point.y*.5+.5)*i.height),a}function rl(e,t,i,r){if(i.pitchWithMap){let n=[e,t,0,1];return at.transformMat4(n,n,r),i.transform.projectTileCoordinates(n[0]/n[3],n[1]/n[3],i.unwrappedTileID,i.getElevation).point}else return{x:e/i.width*2-1,y:t/i.height*2-1}}function ov(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function up(e,t,i){return e._unit()._perp()._mult(t*i)}function w3(e,t,i,r,n,a,o,s,l){if(s.projectionCache.offsets[e])return s.projectionCache.offsets[e];let u=i.add(t);if(e+l.direction<r||e+l.direction>=n)return s.projectionCache.offsets[e]=u,u;let h=lp(e+l.direction,s,l),c=up(h.sub(i),o,l.direction),p=i.add(c),d=h.add(c);return s.projectionCache.offsets[e]=qS(a,u,p,d)||u,s.projectionCache.offsets[e]}function Vl(e,t,i,r,n,a,o,s,l){let u=r?e-t:e+t,h=u>0?1:-1,c=0;r&&(h*=-1,c=Math.PI),h<0&&(c+=Math.PI);let p=h>0?a+n:a+n+1,d;s.projectionCache.cachedAnchorPoint?d=s.projectionCache.cachedAnchorPoint:(d=bn(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f=d,y=d,g,_,b=0,v=0,w=Math.abs(u),T=[],S;do{if(p+=h,p<a||p>=o)return null;b+=v,y=f,_=g;let z={absOffsetX:w,direction:h,distanceFromAnchor:b,previousVertex:y};if(f=lp(p,s,z),i===0)T.push(y),S=f.sub(y);else{let R,k=f.sub(y);if(k.mag()===0){let D=lp(p+h,s,z);R=up(D.sub(f),i,h)}else R=up(k,i,h);_||(_=y.add(R)),g=w3(p,R,f,a,o,_,i,s,z),T.push(_),S=g.sub(_)}v=S.mag()}while(b+v<=w);let M=(w-b)/v,E=S._mult(M)._add(_||y),L=c+Math.atan2(f.y-y.y,f.x-y.x);return T.push(E),{point:E,angle:l?L:0,path:T}}var P3=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ha(e,t){for(let i=0;i<e;i++){let r=t.length;t.resize(r+4),t.float32.set(P3,r*3)}}function Id(e,t,i){let r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}function T3(e,t){let i=V.create();return V.invert(i,t.pitchedLabelPlaneMatrix),e.map(r=>{let n=Md(r.x,r.y,i,t.getElevation),a=t.transform.projectTileCoordinates(n.point.x,n.point.y,t.unwrappedTileID,t.getElevation);return a.point.x=(a.point.x*.5+.5)*t.width,a.point.y=(-a.point.y*.5+.5)*t.height,a})}function S3(e){let t=0,i=0,r=0,n=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,n=0):(n++,n>i&&(i=n,t=r));return e.slice(t,t+i)}var Oe=100,C3=class{constructor(e,t=new jy(e.width+2*Oe,e.height+2*Oe,25),i=new jy(e.width+2*Oe,e.height+2*Oe,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Oe,this.screenBottomBoundary=e.height+Oe,this.gridRightBoundary=e.width+2*Oe,this.gridBottomBoundary=e.height+2*Oe,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.anchorPointX+s[0],d=e.anchorPointY+s[1],f=this.projectAndGetPerspectiveRatio(p,d,n,u,c),y=i*f.perspectiveRatio,g;if(!a&&!o){let M=f.x+(h?h.x*y:0),E=f.y+(h?h.y*y:0);g={allPointsOccluded:!1,box:[M+e.x1*y,E+e.y1*y,M+e.x2*y,E+e.y2*y]}}else g=this._projectCollisionBox(e,y,r,n,a,o,s,f,u,h,c);let[_,b,v,w]=g.box,T=a?g.allPointsOccluded:f.isOccluded,S=T;return S||(S=f.perspectiveRatio<this.perspectiveRatioCutoff),S||(S=!this.isInsideGrid(_,b,v,w)),S||t!=="always"&&this.grid.hitTest(_,b,v,w,t,l)?{box:[_,b,v,w],placeable:!1,offscreen:!1,occluded:T}:{box:[_,b,v,w],placeable:!0,offscreen:this.isOffscreen(_,b,v,w),occluded:T}}placeCollisionCircles(e,t,i,r,n,a,o,s,l,u,h,c,p,d){let f=[],y=new zi.default(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(y.x,y.y,a,d),_=(l?n*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/g:n*g)/F0,b={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},v=t.lineOffsetX*_,w=t.lineOffsetY*_,T={getElevation:d,pitchedLabelPlaneMatrix:o,lineVertexArray:i,pitchWithMap:l,projectionCache:b,transform:this.transform,tileAnchorPoint:y,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:p},S=nv(_,r,v,w,!1,t,!1,T),M=!1,E=!1,L=!0;if(S){let z=h*.5*g+c,R=new zi.default(-Oe,-Oe),k=new zi.default(this.screenRightBoundary,this.screenBottomBoundary),D=new _3,x=S.first,C=S.last,I=[];for(let G=x.path.length-1;G>=1;G--)I.push(x.path[G]);for(let G=1;G<C.path.length;G++)I.push(C.path[G]);let F=z*2.5;if(l){let G=this.projectPathToScreenSpace(I,T);G.some(J=>J.signedDistanceFromCamera<=0)?I=[]:I=G.map(J=>J.point)}let N=[];if(I.length>0){let G=I[0].clone(),J=I[0].clone();for(let ee=1;ee<I.length;ee++)G.x=Math.min(G.x,I[ee].x),G.y=Math.min(G.y,I[ee].y),J.x=Math.max(J.x,I[ee].x),J.y=Math.max(J.y,I[ee].y);G.x>=R.x&&J.x<=k.x&&G.y>=R.y&&J.y<=k.y?N=[I]:J.x<R.x||G.x>k.x||J.y<R.y||G.y>k.y?N=[]:N=g3([I],R.x,R.y,k.x,k.y)}for(let G of N){D.reset(G,z*.25);let J=0;D.length<=.5*z?J=1:J=Math.ceil(D.paddedLength/F)+1;for(let ee=0;ee<J;ee++){let ke=ee/Math.max(J-1,1),Ie=D.lerp(ke),Be=Ie.x+Oe,Ne=Ie.y+Oe;f.push(Be,Ne,z,0);let bt=Be-z,St=Ne-z,Jt=Be+z,Qt=Ne+z;if(L=L&&this.isOffscreen(bt,St,Jt,Qt),E=E||this.isInsideGrid(bt,St,Jt,Qt),e!=="always"&&this.grid.hitTestCircle(Be,Ne,z,e,u)&&(M=!0,!s))return{circles:[],offscreen:!1,collisionDetected:M}}}}return{circles:!s&&M||!E||g<this.perspectiveRatioCutoff?[]:f,offscreen:L,collisionDetected:M}}projectPathToScreenSpace(e,t){let i=T3(e,t);return S3(i)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=new qi;for(let h of e){let c=new zi.default(h.x+Oe,h.y+Oe);i.extend(c),t.push(c)}let{minX:r,minY:n,maxX:a,maxY:o}=i,s=this.grid.query(r,n,a,o).concat(this.ignoredGrid.query(r,n,a,o)),l={},u={};for(let h of s){let c=h.key;if(l[c.bucketInstanceId]===void 0&&(l[c.bucketInstanceId]={}),l[c.bucketInstanceId][c.featureIndex])continue;let p=[new zi.default(h.x1,h.y1),new zi.default(h.x2,h.y1),new zi.default(h.x2,h.y2),new zi.default(h.x1,h.y2)];x0(t,p)&&(l[c.bucketInstanceId][c.featureIndex]=!0,u[c.bucketInstanceId]===void 0&&(u[c.bucketInstanceId]=[]),u[c.bucketInstanceId].push(c.featureIndex))}return u}insertCollisionBox(e,t,i,r,n,a){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t};o.insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,a){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t};for(let l=0;l<e.length;l+=4)o.insertCircle(s,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t,i,r,n){if(n){let a;r?(a=[e,t,r(e,t),1],at.transformMat4(a,a,n)):(a=[e,t,0,1],Id(a,a,n));let o=a[3];return{x:(a[0]/o+1)/2*this.transform.width+Oe,y:(-a[1]/o+1)/2*this.transform.height+Oe,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o),isOccluded:!1,signedDistanceFromCamera:o}}else{let a=this.transform.projectTileCoordinates(e,t,i,r);return{x:(a.point.x+1)/2*this.transform.width+Oe,y:(-a.point.y+1)/2*this.transform.height+Oe,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera),isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){let n=this.transform.projectTileCoordinates(e,t,i,r);return .5+.5*(this.transform.cameraToCenterDistance/n.signedDistanceFromCamera)}isOffscreen(e,t,i,r){return i<Oe||e>=this.screenRightBoundary||r<Oe||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=V.identity([]);return V.translate(e,e,[-Oe,-Oe,0]),e}_projectCollisionBox(e,t,i,r,n,a,o,s,l,u,h){let c=1,p=0,d=0,f=1,y=e.anchorPointX+o[0],g=e.anchorPointY+o[1];if(a&&!n){let D=this.projectAndGetPerspectiveRatio(y+1,g,r,l,h),x=D.x-s.x,C=D.y-s.y,I=Math.atan(C/x)+(x<0?Math.PI:0),F=Math.sin(I),N=Math.cos(I);c=N,p=F,d=-F,f=N}else if(!a&&n){let D=Cd(this.transform);c=D.vecEast[0],p=D.vecEast[1],d=D.vecSouth[0],f=D.vecSouth[1]}let _=s.x,b=s.y,v=t;if(n){_=y,b=g;let D=this.transform.zoom-i.overscaledZ;if(v=Math.pow(2,-D),v*=this.transform.getPitchedTextCorrection(y,g,r),!u){let x=s.signedDistanceFromCamera/this.transform.cameraToCenterDistance,C=Ae(.5+.5*x,0,4);v*=C}}u&&(_+=c*u.x*v+d*u.y*v,b+=p*u.x*v+f*u.y*v);let w=e.x1*v,T=e.x2*v,S=(w+T)/2,M=e.y1*v,E=e.y2*v,L=(M+E)/2,z=[{offsetX:w,offsetY:M},{offsetX:S,offsetY:M},{offsetX:T,offsetY:M},{offsetX:T,offsetY:L},{offsetX:T,offsetY:E},{offsetX:S,offsetY:E},{offsetX:w,offsetY:E},{offsetX:w,offsetY:L}],R=[];for(let{offsetX:D,offsetY:x}of z)R.push(new zi.default(_+c*D+d*x,b+p*D+f*x));let k=!1;if(n){let D=R.map(x=>this.projectAndGetPerspectiveRatio(x.x,x.y,r,l,h));k=D.some(x=>!x.isOccluded),R=D.map(x=>new zi.default(x.x,x.y))}else k=!0;return{box:VS(R),allPointsOccluded:!k}}},M3=se(ce(),1),I3=class sv extends M3.default{constructor(t,i,r,n){super(t,i),this.angle=r,n!==void 0&&(this.segment=n)}clone(){return new sv(this.x,this.y,this.angle,this.segment)}};H("Anchor",I3);var Fj=se(ce(),1),Nj=se(ce(),1),Vj=se(ce(),1),jj=se(wg(),1),hp=(e=>(e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e))(hp||{}),Uj=Number.POSITIVE_INFINITY;function E3(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}var lv=se(ce(),1),Xy=class{constructor(e,t,i,r){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},$a=class{constructor(e,t,i,r,n){this.text=new Xy(e?e.text:null,t,i,n),this.icon=new Xy(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},qy=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},A3=class{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}},k3=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:i=>i.collisionGroupID===t}}return this.collisionGroups[e]}};function $y(e,t,i,r,n){let{horizontalAlign:a,verticalAlign:o}=j0(e),s=-(a-.5)*t,l=-(o-.5)*i;return new lv.default(s+r[0]*n,l+r[1]*n)}var D3=class{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new C3(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new k3(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,t,i,r){let n=i.getBucket(t),a=i.latestFeatureIndex;if(!n||!a||t.id!==n.layerIds[0])return;let o=i.collisionBoxArray,s=n.layers[0].layout,l=n.layers[0].paint,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/8192,c=i.tileID.toUnwrapped(),p=s.get("text-rotation-alignment")==="map",d=$t(i,1,this.transform.zoom),f=Vr(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),y=Vr(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),g=Sd(p,this.transform,d);this.retainedQueryData[n.bucketInstanceId]=new A3(n.bucketInstanceId,a,n.sourceLayerIndex,n.index,i.tileID);let _={bucket:n,layout:s,translationText:f,translationIcon:y,unwrappedTileID:c,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:i.holdingForFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:wu(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(r)for(let b of n.sortKeyRanges){let{sortKey:v,symbolInstanceStart:w,symbolInstanceEnd:T}=b;e.push({sortKey:v,symbolInstanceStart:w,symbolInstanceEnd:T,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v){let w=hp[e.textAnchor],T=[e.textOffset0,e.textOffset1],S=$y(w,i,r,T,n),M=this.collisionIndex.placeCollisionBox(t,c,s,l,u,o,a,y,h.predicate,b,S,v);if(!(_&&!this.collisionIndex.placeCollisionBox(_,c,s,l,u,o,a,g,h.predicate,b,S,v).placeable)&&M.placeable){let E;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(E=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:T,width:i,height:r,anchor:w,textBoxScale:n,prevAnchor:E},this.markUsedJustification(d,w,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:S,placedGlyphBoxes:M}}}placeLayerBucketPart(e,t,i){let{bucket:r,layout:n,translationText:a,translationIcon:o,unwrappedTileID:s,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=n.get("text-optional"),y=n.get("icon-optional"),g=Fl(n,"text-overlap","text-allow-overlap"),_=g==="always",b=Fl(n,"icon-overlap","icon-allow-overlap"),v=b==="always",w=n.get("text-rotation-alignment")==="map",T=n.get("text-pitch-alignment")==="map",S=n.get("icon-text-fit")!=="none",M=n.get("symbol-z-order")==="viewport-y",E=_&&(v||!r.hasIconData()||y),L=v&&(_||!r.hasTextData()||f);!r.collisionArrays&&c&&r.deserializeCollisionBoxes(c);let z=this.retainedQueryData[r.bucketInstanceId].tileID,R=this._getTerrainElevationFunc(z),k=this.transform.getFastPathSimpleProjectionMatrix(z),D=(x,C,I)=>{var rn,tr;if(t[x.crossTileID])return;if(h){this.placements[x.crossTileID]=new qy(!1,!1,!1);return}let F=!1,N=!1,G=!0,J=null,ee={box:null,placeable:!1,offscreen:null,occluded:!1},ke={box:null,placeable:!1,offscreen:null},Ie=null,Be=null,Ne=null,bt=0,St=0,Jt=0;C.textFeatureIndex?bt=C.textFeatureIndex:x.useRuntimeCollisionCircles&&(bt=x.featureIndex),C.verticalTextFeatureIndex&&(St=C.verticalTextFeatureIndex);let Qt=C.textBox;if(Qt){let ei=gt=>{let Mt=1;if(r.allowVerticalPlacement&&!gt&&this.prevPlacement){let ii=this.prevPlacement.placedOrientations[x.crossTileID];ii&&(this.placedOrientations[x.crossTileID]=ii,Mt=ii,this.markUsedOrientation(r,Mt,x))}return Mt},Vt=(gt,Mt)=>{if(r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&C.verticalTextBox){for(let ii of r.writingModes)if(ii===2?(ee=Mt(),ke=ee):ee=gt(),ee&&ee.placeable)break}else ee=gt()},nn=x.textAnchorOffsetStartIndex,ti=x.textAnchorOffsetEndIndex;if(ti===nn){let gt=(Mt,ii)=>{let wt=this.collisionIndex.placeCollisionBox(Mt,g,u,z,s,T,w,a,d.predicate,R,void 0,k);return wt&&wt.placeable&&(this.markUsedOrientation(r,ii,x),this.placedOrientations[x.crossTileID]=ii),wt};Vt(()=>gt(Qt,1),()=>{let Mt=C.verticalTextBox;return r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&Mt?gt(Mt,2):{box:null,offscreen:null}}),ei(ee&&ee.placeable)}else{let gt=hp[(tr=(rn=this.prevPlacement)==null?void 0:rn.variableOffsets[x.crossTileID])==null?void 0:tr.anchor],Mt=(wt,_h,K1)=>{let J1=wt.x2-wt.x1,Q1=wt.y2-wt.y1,ew=x.textBoxScale,tw=S&&b==="never"?_h:null,an=null,zf=g==="never"?1:2,Bf="never";gt&&zf++;for(let Of=0;Of<zf;Of++){for(let xh=nn;xh<ti;xh++){let Ff=r.textAnchorOffsets.get(xh);if(gt&&Ff.textAnchor!==gt)continue;let vh=this.attemptAnchorPlacement(Ff,wt,J1,Q1,ew,w,T,u,z,s,d,Bf,x,r,K1,a,o,tw,R);if(vh&&(an=vh.placedGlyphBoxes,an&&an.placeable))return F=!0,J=vh.shift,an}gt?gt=null:Bf=g}return i&&!an&&(an={box:this.collisionIndex.placeCollisionBox(Qt,"always",u,z,s,T,w,a,d.predicate,R,void 0,k).box,offscreen:!1,placeable:!1,occluded:!1}),an};Vt(()=>Mt(Qt,C.iconBox,1),()=>{let wt=C.verticalTextBox,_h=ee&&ee.placeable;return r.allowVerticalPlacement&&!_h&&x.numVerticalGlyphVertices>0&&wt?Mt(wt,C.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),ee&&(F=ee.placeable,G=ee.offscreen);let ii=ei(ee&&ee.placeable);if(!F&&this.prevPlacement){let wt=this.prevPlacement.variableOffsets[x.crossTileID];wt&&(this.variableOffsets[x.crossTileID]=wt,this.markUsedJustification(r,wt.anchor,x,ii))}}}if(Ie=ee,F=Ie&&Ie.placeable,G=Ie&&Ie.offscreen,x.useRuntimeCollisionCircles){let ei=r.text.placedSymbolArray.get(x.centerJustifiedTextSymbolIndex),Vt=Td(r.textSizeData,p,ei),nn=n.get("text-padding"),ti=x.collisionCircleDiameter;Be=this.collisionIndex.placeCollisionCircles(g,ei,r.lineVertexArray,r.glyphOffsetArray,Vt,s,l,i,T,d.predicate,ti,nn,a,R),Be.circles.length&&Be.collisionDetected&&!i&&ct("Collisions detected, but collision boxes are not shown"),F=_||Be.circles.length>0&&!Be.collisionDetected,G=G&&Be.offscreen}if(C.iconFeatureIndex&&(Jt=C.iconFeatureIndex),C.iconBox){let ei=Vt=>this.collisionIndex.placeCollisionBox(Vt,b,u,z,s,T,w,o,d.predicate,R,S&&J?J:void 0,k);ke&&ke.placeable&&C.verticalIconBox?(Ne=ei(C.verticalIconBox),N=Ne.placeable):(Ne=ei(C.iconBox),N=Ne.placeable),G=G&&Ne.offscreen}let Cr=f||x.numHorizontalGlyphVertices===0&&x.numVerticalGlyphVertices===0,Ct=y||x.numIconVertices===0;!Cr&&!Ct?N=F=N&&F:Ct?Cr||(N=N&&F):F=N&&F;let Es=F&&Ie.placeable,Xn=N&&Ne.placeable;if(Es&&(ke&&ke.placeable&&St?this.collisionIndex.insertCollisionBox(Ie.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,St,d.ID):this.collisionIndex.insertCollisionBox(Ie.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,bt,d.ID)),Xn&&this.collisionIndex.insertCollisionBox(Ne.box,b,n.get("icon-ignore-placement"),r.bucketInstanceId,Jt,d.ID),Be&&F&&this.collisionIndex.insertCollisionCircles(Be.circles,g,n.get("text-ignore-placement"),r.bucketInstanceId,bt,d.ID),i&&this.storeCollisionData(r.bucketInstanceId,I,C,Ie,Ne,Be),x.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");let tn=(F||E)&&!(Ie!=null&&Ie.occluded),er=(N||L)&&!(Ne!=null&&Ne.occluded);this.placements[x.crossTileID]=new qy(tn,er,G||r.justReloaded),t[x.crossTileID]=!0};if(M){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let x=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let C=x.length-1;C>=0;--C){let I=x[C];D(r.symbolInstances.get(I),r.collisionArrays[I],I)}}else for(let x=e.symbolInstanceStart;x<e.symbolInstanceEnd;x++)D(r.symbolInstances.get(x),r.collisionArrays[x],x);r.justReloaded=!1}storeCollisionData(e,t,i,r,n,a){if(i.textBox||i.iconBox){let o;this.collisionBoxArrays.has(e)?o=this.collisionBoxArrays.get(e):(o=new Map,this.collisionBoxArrays.set(e,o));let s;o.has(t)?s=o.get(t):(s={text:null,icon:null},o.set(t,s)),i.textBox&&(s.text=r.box),i.iconBox&&(s.icon=n.box)}if(a){let o=this.collisionCircleArrays[e];o===void 0&&(o=this.collisionCircleArrays[e]=[]);for(let s=0;s<a.circles.length;s+=4)o.push(a.circles[s+0]-Oe),o.push(a.circles[s+1]-Oe),o.push(a.circles[s+2]),o.push(a.collisionDetected?1:0)}}markUsedJustification(e,t,i,r){let n={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},a;r===2?a=i.verticalPlacedTextSymbolIndex:a=n[E3(t)];let o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let s of o)s>=0&&(a>=0&&s!==a?e.text.placedSymbolArray.get(s).crossTileID=0:e.text.placedSymbolArray.get(s).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let r=t===1||t===3?t:0,n=t===2?t:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let o of a)e.text.placedSymbolArray.get(o).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let s in this.placements){let l=this.placements[s],u=n[s];u?(this.opacities[s]=new $a(u,r,l.text,l.icon),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new $a(null,r,l.text,l.icon,l.skipFade),i=i||l.text||l.icon)}for(let s in n){let l=n[s];if(!this.opacities[s]){let u=new $a(l,r,!1,!1);u.isHidden()||(this.opacities[s]=u,i=i||l.text.placed||l.icon.placed)}}for(let s in a)!this.variableOffsets[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.variableOffsets[s]=a[s]);for(let s in o)!this.placedOrientations[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.placedOrientations[s]=o[s]);if(t&&t.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let r of t){let n=r.getBucket(e);n&&r.latestFeatureIndex&&e.id===n.layerIds[0]&&this.updateBucketOpacities(n,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,t,i,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let n=e.layers[0],a=n.layout,o=new $a(null,0,!1,!1,!0),s=a.get("text-allow-overlap"),l=a.get("icon-allow-overlap"),u=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h=a.get("text-rotation-alignment")==="map",c=a.get("text-pitch-alignment")==="map",p=a.get("icon-text-fit")!=="none",d=new $a(null,0,s&&(l||!e.hasIconData()||a.get("icon-optional")),l&&(s||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let f=(g,_,b)=>{for(let v=0;v<_/4;v++)g.opacityVertexArray.emplaceBack(b);g.hasVisibleVertices=g.hasVisibleVertices||b!==Ya},y=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let _=e.symbolInstances.get(g),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:v,crossTileID:w}=_,T=i[w],S=this.opacities[w];T?S=o:S||(S=d,this.opacities[w]=S),i[w]=!0;let M=b>0||v>0,E=_.numIconVertices>0,L=this.placedOrientations[_.crossTileID],z=L===2,R=L===1||L===3;if(M){let D=Zy(S.text),x=z?Ya:D;f(e.text,b,x);let C=R?Ya:D;f(e.text,v,C);let I=S.text.isHidden();[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex].forEach(G=>{G>=0&&(e.text.placedSymbolArray.get(G).hidden=I||z?1:0)}),_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=I||R?1:0);let F=this.variableOffsets[_.crossTileID];F&&this.markUsedJustification(e,F.anchor,_,L);let N=this.placedOrientations[_.crossTileID];N&&(this.markUsedJustification(e,"left",_,N),this.markUsedOrientation(e,N,_))}if(E){let D=Zy(S.icon),x=!(p&&_.verticalPlacedIconSymbolIndex&&z);if(_.placedIconSymbolIndex>=0){let C=x?D:Ya;f(e.icon,_.numIconVertices,C),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=S.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let C=x?Ya:D;f(e.icon,_.numVerticalIconVertices,C),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=S.icon.isHidden()}}let k=y&&y.has(g)?y.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let D=e.collisionArrays[g];if(D){let x=new lv.default(0,0);if(D.textBox||D.verticalTextBox){let C=!0;if(u){let I=this.variableOffsets[w];I?(x=$y(I.anchor,I.width,I.height,I.textOffset,I.textBoxScale),h&&x._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):C=!1}if(D.textBox||D.verticalTextBox){let I;D.textBox&&(I=z),D.verticalTextBox&&(I=R),Yy(e.textCollisionBox.collisionVertexArray,S.text.placed,!C||I,k.text,x.x,x.y)}}if(D.iconBox||D.verticalIconBox){let C=!!(!R&&D.verticalIconBox),I;D.iconBox&&(I=C),D.verticalIconBox&&(I=!C),Yy(e.iconCollisionBox.collisionVertexArray,S.icon.placed,I,k.icon,p?x.x:0,p?x.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(e.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(e.text.layoutVertexArray.length,") / 4"));if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(e.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(e.icon.layoutVertexArray.length,") / 4"));e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function Yy(e,t,i,r,n,a){(!r||r.length===0)&&(r=[0,0,0,0]);let o=r[0]-Oe,s=r[1]-Oe,l=r[2]-Oe,u=r[3]-Oe;e.emplaceBack(t?1:0,i?1:0,n||0,a||0,o,s),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,s),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,u),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,o,u)}var L3=Math.pow(2,25),R3=Math.pow(2,24),z3=Math.pow(2,17),B3=Math.pow(2,16),O3=Math.pow(2,9),F3=Math.pow(2,8),N3=Math.pow(2,1);function Zy(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=e.placed?1:0,i=Math.floor(e.opacity*127);return i*L3+t*R3+i*z3+t*B3+i*O3+t*F3+i*N3+t}var Ya=0,V3=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,n){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let o=e[this._currentTileIndex];if(t.getBucketParts(a,r,o,this._sortAcrossTiles),this._currentTileIndex++,n())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((o,s)=>o.sortKey-s.sortKey));this._currentPartIndex<a.length;){let o=a[this._currentPartIndex];if(t.placeLayerBucketPart(o,this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0}return!1}},j3=class{constructor(e,t,i,r,n,a,o,s){this.placement=new D3(e,t,a,o,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let r=ve.now(),n=()=>this._forceFullPlacement?!1:ve.now()-r>2;for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],o=t[a],s=this.placement.collisionIndex.transform.zoom;if(o.type==="symbol"&&(!o.minzoom||o.minzoom<=s)&&(!o.maxzoom||o.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new V3(o)),this._inProgressLayer.continuePlacement(i[o.source],this.placement,this._showCollisionBoxes,o,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}},Wy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],tc=1,Za=8,U3=class uv{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(t,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");let n=r>>4;if(n!==tc)throw new Error("Got v".concat(n," data when expected v").concat(tc,"."));let a=Wy[r&15];if(!a)throw new Error("Unrecognized array type.");let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new uv(s,o,a,t)}constructor(t,i=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let a=Wy.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(r,"."));n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,Za,t),this.coords=new this.ArrayType(this.data,Za+s+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(Za+o+s+l),this.ids=new this.IndexArrayType(this.data,Za,t),this.coords=new this.ArrayType(this.data,Za+s+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(tc<<4)+a]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error("Added ".concat(t," items when expected ").concat(this.numItems,"."));return cp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:a,coords:o,nodeSize:s}=this,l=[0,a.length-1,0],u=[];for(;l.length;){let h=l.pop()||0,c=l.pop()||0,p=l.pop()||0;if(c-p<=s){for(let g=p;g<=c;g++){let _=o[2*g],b=o[2*g+1];_>=t&&_<=r&&b>=i&&b<=n&&u.push(a[g])}continue}let d=p+c>>1,f=o[2*d],y=o[2*d+1];f>=t&&f<=r&&y>=i&&y<=n&&u.push(a[d]),(h===0?t<=f:i<=y)&&(l.push(p),l.push(d-1),l.push(1-h)),(h===0?r>=f:n>=y)&&(l.push(d+1),l.push(c),l.push(1-h))}return u}within(t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:n,coords:a,nodeSize:o}=this,s=[0,n.length-1,0],l=[],u=r*r;for(;s.length;){let h=s.pop()||0,c=s.pop()||0,p=s.pop()||0;if(c-p<=o){for(let g=p;g<=c;g++)Hy(a[2*g],a[2*g+1],t,i)<=u&&l.push(n[g]);continue}let d=p+c>>1,f=a[2*d],y=a[2*d+1];Hy(f,y,t,i)<=u&&l.push(n[d]),(h===0?t-r<=f:i-r<=y)&&(s.push(p),s.push(d-1),s.push(1-h)),(h===0?t+r>=f:i+r>=y)&&(s.push(d+1),s.push(c),s.push(1-h))}return l}};function cp(e,t,i,r,n,a){if(n-r<=i)return;let o=r+n>>1;hv(e,t,o,r,n,a),cp(e,t,i,r,o-1,1-a),cp(e,t,i,o+1,n,1-a)}function hv(e,t,i,r,n,a){for(;n>r;){if(n-r>600){let u=n-r+1,h=i-r+1,c=Math.log(u),p=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1),f=Math.max(r,Math.floor(i-h*p/u+d)),y=Math.min(n,Math.floor(i+(u-h)*p/u+d));hv(e,t,i,f,y,a)}let o=t[2*i+a],s=r,l=n;for(Wa(e,t,r,i),t[2*n+a]>o&&Wa(e,t,r,n);s<l;){for(Wa(e,t,s,l),s++,l--;t[2*s+a]<o;)s++;for(;t[2*l+a]>o;)l--}t[2*r+a]===o?Wa(e,t,r,l):(l++,Wa(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Wa(e,t,i,r){ic(e,i,r),ic(t,2*i,2*r),ic(t,2*i+1,2*r+1)}function ic(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function Hy(e,t,i,r){let n=e-i,a=t-r;return n*n+a*a}var Ha=512/8192/2,G3=128,X3=class{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let n=0;n<t.length;n++){let a=t.get(n),o=a.key,s=r.get(o);s?s.push(a):r.set(o,[a])}for(let[n,a]of r){let o=a.map(u=>({x:Math.floor(u.anchorX*Ha),y:Math.floor(u.anchorY*Ha)})),s=a.map(u=>u.crossTileID),l={positions:o,crossTileIDs:s};if(l.positions.length>G3){let u=new U3(l.positions.length,16,Uint16Array);for(let{x:h,y:c}of l.positions)u.add(h,c);u.finish(),delete l.positions,l.index=u}this._symbolsByKey[n]=l}}getScaledCoordinates(e,t){let{x:i,y:r,z:n}=this.tileID.canonical,{x:a,y:o,z:s}=t.canonical,l=s-n,u=Ha/Math.pow(2,l),h=(a*8192+e.anchorX)*u,c=(o*8192+e.anchorY)*u,p=i*8192*Ha,d=r*8192*Ha;return{x:Math.floor(h-p),y:Math.floor(c-d)}}findMatches(e,t,i){let r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let n=0;n<e.length;n++){let a=e.get(n);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let l=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let u of l){let h=o.crossTileIDs[u];if(!i[h]){i[h]=!0,a.crossTileID=h;break}}}else if(o.positions)for(let l=0;l<o.positions.length;l++){let u=o.positions[l],h=o.crossTileIDs[l];if(Math.abs(u.x-s.x)<=r&&Math.abs(u.y-s.y)<=r&&!i[h]){i[h]=!0,a.crossTileID=h;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},q3=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},$3=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let i in this.indexes){let r=this.indexes[i],n={};for(let a in r){let o=r[a];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+t),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let n=0;n<t.symbolInstances.length;n++){let a=t.symbolInstances.get(n);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let a=this.indexes[n];if(Number(n)>e.overscaledZ)for(let o in a){let s=a[o];s.tileID.isChildOf(e)&&s.findMatches(t.symbolInstances,e,r)}else{let o=e.scaledTo(Number(n)),s=a[o.key];s&&s.findMatches(t.symbolInstances,e,r)}}for(let n=0;n<t.symbolInstances.length;n++){let a=t.symbolInstances.get(n);a.crossTileID||(a.crossTileID=i.generate(),r[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new X3(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[e][r]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let r=this.indexes[i];for(let n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}},cv=class{constructor(){this.layerIndexes={},this.crossTileIDs=new q3,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new $3);let n=!1,a={};r.handleWrapJump(i);for(let o of t){let s=o.getBucket(e);!s||e.id!==s.layerIds[0]||(s.bucketInstanceId||(s.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(o.tileID,s,this.crossTileIDs)&&(n=!0),a[s.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(n=!0),n}pruneUnusedLayers(e){let t={};e.forEach(i=>{t[i]=!0});for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}},Y3="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;",Z3="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;",W3="uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",H3="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",K3="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",J3="uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",Q3="in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",eL="uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}",Ky="void main() {fragColor=vec4(1.0);}",tL="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",iL="uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",rL="uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}",nL="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}",aL="uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}",oL="in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}",sL="in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}",lL="in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}",uL="in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}",hL="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",cL="uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}",pL="uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}",dL="in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}",fL="in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}",mL="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",yL="uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}",gL="in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",_L="uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}",xL="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",vL="uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}",bL="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",wL="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}",PL="in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",TL="uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}",SL="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",CL="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}",ML="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",IL="uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}",EL="uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC:\nbasic_hillshade(deriv);break;case COMBINED:\ncombined_hillshade(deriv);break;case IGOR:\nigor_hillshade(deriv);break;case MULTIDIRECTIONAL:\nmultidirectional_hillshade(deriv);break;case STANDARD:\ndefault:\nstandard_hillshade(deriv);break;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",AL="uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}",kL="uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",DL="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}",LL="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",RL="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}",zL="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",BL="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}",OL="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",FL="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}",NL="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",VL="uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}",jL="uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",UL="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}",GL="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",XL="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}",qL="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",$L="in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}",YL="in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}",ZL="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",WL="uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}",HL="in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}",KL="in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}",JL="in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}",QL="in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}",eR="in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}",tR="float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}",iR="#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}",rR="in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}",nR="in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}",aR="uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}",oR="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}",Ui={prelude:Se(Y3,Z3),projectionMercator:Se("",tR),projectionGlobe:Se("",iR),background:Se(W3,H3),backgroundPattern:Se(K3,J3),circle:Se(Q3,eL),clippingMask:Se(Ky,tL),heatmap:Se(iL,rL),heatmapTexture:Se(nL,aL),collisionBox:Se(oL,sL),collisionCircle:Se(lL,uL),colorRelief:Se(hL,cL),debug:Se(pL,dL),depth:Se(Ky,fL),fill:Se(mL,yL),fillOutline:Se(gL,_L),fillOutlinePattern:Se(xL,vL),fillPattern:Se(bL,wL),fillExtrusion:Se(PL,TL),fillExtrusionPattern:Se(SL,CL),hillshadePrepare:Se(ML,IL),hillshade:Se(EL,AL),line:Se(kL,DL),lineGradient:Se(LL,RL),linePattern:Se(zL,BL),lineSDF:Se(OL,FL),raster:Se(NL,VL),symbolIcon:Se(jL,UL),symbolSDF:Se(GL,XL),symbolTextAndIcon:Se(qL,$L),terrain:Se(WL,HL),terrainDepth:Se(YL,KL),terrainCoords:Se(ZL,JL),projectionErrorMeasurement:Se(eR,QL),atmosphere:Se(rR,nR),sky:Se(aR,oR)};function Se(e,t){let i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=a?a.concat(n):n,s={};return e=e.replace(i,(l,u,h,c,p)=>(s[p]=!0,u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nin ").concat(h," ").concat(c," ").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"))),t=t.replace(i,(l,u,h,c,p)=>{let d=c==="float"?"vec2":"vec4",f=p.match(/color/)?"color":d;return s[p]?u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nuniform lowp float u_").concat(p,"_t;\nin ").concat(h," ").concat(d," a_").concat(p,";\nout ").concat(h," ").concat(c," ").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):f==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(p," = a_").concat(p,";\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(p," = unpack_mix_").concat(f,"(a_").concat(p,", u_").concat(p,"_t);\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nuniform lowp float u_").concat(p,"_t;\nin ").concat(h," ").concat(d," a_").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):f==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = a_").concat(p,";\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = unpack_mix_").concat(f,"(a_").concat(p,", u_").concat(p,"_t);\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n")}),{fragmentSource:e,vertexSource:t,staticAttributes:r,staticUniforms:o}}function sR(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}function lR(e){return e.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}var Ta=class{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}},Fr=it([{name:"a_pos",type:"Int16",components:2}]),pv="#define PROJECTION_MERCATOR",dv="mercator",pp=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return dv}get shaderDefine(){return pv}get shaderPreludeCode(){return Ui.projectionMercator}get vertexShaderPreludeCode(){return Ui.projectionMercator.vertexSource}get subdivisionGranularity(){return bd.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,t,i,r,n){if(this._cachedMesh)return this._cachedMesh;let a=new lr;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let o=e.createVertexBuffer(a,Fr.members),s=qe.simpleSegment(0,0,4,2),l=new Ti;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new Ta(o,u,s),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}},Ut=se(ce(),1),un=se(ce(),1),uR=se(ce(),1),Jy=class fv{constructor(t=0,i=0,r=0,n=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=n}interpolate(t,i,r){return i.top!=null&&t.top!=null&&(this.top=Ke.number(t.top,i.top,r)),i.bottom!=null&&t.bottom!=null&&(this.bottom=Ke.number(t.bottom,i.bottom,r)),i.left!=null&&t.left!=null&&(this.left=Ke.number(t.left,i.left,r)),i.right!=null&&t.right!=null&&(this.right=Ke.number(t.right,i.right,r)),this}getCenter(t,i){let r=Ae((this.left+t-this.right)/2,0,t),n=Ae((this.top+i-this.bottom)/2,0,i);return new uR.default(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new fv(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function jl(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function Qy(e){return Math.max(0,Math.floor(e))}var Ed=class{constructor(e,t,i,r,n,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=a===void 0?!0:!!a,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r!=null?r:0,this._maxPitch=n!=null?n:60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new oe(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Qy(this._zoom),this._scale=It(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Jy,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,i){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Qy(this._zoom),this._scale=It(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Jy(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!i&&e.autoCalculateNearFarZ,t&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new un.default(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=pn(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=_o.create(),_o.rotate(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=Ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return ia(this._fovInRadians)}setFov(e){e=Ae(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Xe(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.getConstrained(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=It(t),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return!this._latRange||this._latRange.length!==2||!this._lngRange||this._lngRange.length!==2?null:new Zi([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-$i,$i])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:i,minY:r,maxX:n,maxY:a}=qi.fromPoints(t).extend(e);return[new un.default(i,r),new un.default(n,r),new un.default(n,a),new un.default(i,a),new un.default(i,r)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=V.identity(new Float64Array(16));V.scale(e,e,[this._width/2,-this._height/2,1]),V.translate(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=V.identity(new Float64Array(16)),V.scale(e,e,[1,-1,1]),V.translate(e,e,[-1,-1,0]),V.scale(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,i,r){let n=i!==void 0?i:this.bearing,a=r=r!==void 0?r:this.pitch,o=Ue.fromLngLat(e,t),s=-Math.cos(Xe(a)),l=Math.sin(Xe(a)),u=l*Math.sin(Xe(n)),h=-l*Math.cos(Xe(n)),c=this.elevation,p=t-c,d;s*p>=0||Math.abs(s)<.1?(d=1e4,c=t+d*s):d=-p/s;let f=ip(1,o.y),y,g,_=0,b=10;do{if(_+=1,_>b)break;g=d/f;let T=u*g,S=h*g;y=new Ue(o.x+T,o.y+S),f=1/y.meterInMercatorCoordinateUnits()}while(Math.abs(d-g*f)>1e-12);let v=y.toLngLat(),w=Et(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize);return{center:v,elevation:c,zoom:w}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=mn(1,this.center.lat)*this.worldSize,i=this.cameraToCenterDistance/t,r=Ue.fromLngLat(this.center,this.elevation),n=op(this.center,this.elevation,this.pitch,this.bearing,i);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(n.toLngLat(),ip(n.z,r.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new un.default(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=mn(1,this.center.lat)*this.worldSize,t=this.cameraToCenterDistance/e;return op(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/t,e.canonical.y/t,1/t/8192,1/t/8192]}},mv=class yv{constructor(t,i){this.min=t,this.max=i,this.center=U.scale([],U.add([],this.min,this.max),.5)}quadrant(t){let i=[t%2===0,t<2],r=U.clone(this.min),n=U.clone(this.max);for(let a=0;a<i.length;a++)r[a]=i[a]?this.min[a]:this.center[a],n[a]=i[a]?this.center[a]:this.max[a];return n[2]=this.max[2],new yv(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let r=0;r<t.planes.length;r++){let n=this.intersectsPlane(t.planes[r]);if(n===0)return 0;n===1&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],r=t[3];for(let n=0;n<3;n++)t[n]>0?(i+=t[n]*this.min[n],r+=t[n]*this.max[n]):(r+=t[n]*this.min[n],i+=t[n]*this.max[n]);return i>=0?2:r<0?0:1}},hR=class{distanceToTile2d(e,t,i,r){let n=r.distanceX([e,t]),a=r.distanceY([e,t]);return Math.hypot(n,a)}getWrap(e,t,i){return i}getTileBoundingVolume(e,t,i,r){var s,l;let n=0,a=0;if(r!=null&&r.terrain){let u=new Tt(e.z,t,e.z,e.x,e.y),h=r.terrain.getMinMaxElevation(u);n=(s=h.minElevation)!=null?s:Math.min(0,i),a=(l=h.maxElevation)!=null?l:Math.max(0,i)}let o=1<<e.z;return new mv([t+e.x/o,e.y/o,n],[t+(e.x+1)/o,(e.y+1)/o,a])}allowVariableZoom(e,t){let i=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,r=Ae(78.5-i/2,0,60);return!!t.terrain||e.pitch>r}allowWorldCopies(){return!0}prepareNextFrame(){}},gv=class _v{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(t,i=1,r=0,n,a){let o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],s=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=Math.pow(2,r),u=o.map(d=>cR(d,t,i,l));n&&pR(u,s[0],n,a);let h=s.map(d=>{let f=U.sub([],u[d[0]],u[d[1]]),y=U.sub([],u[d[2]],u[d[1]]),g=U.normalize([],U.cross([],f,y)),_=-U.dot(g,u[d[1]]);return g.concat(_)}),c=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],p=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let d of u)for(let f=0;f<3;f++)c[f]=Math.min(c[f],d[f]),p[f]=Math.max(p[f],d[f]);return new _v(u,h,new mv(c,p))}};function cR(e,t,i,r){let n=at.transformMat4([],e,t),a=1/n[3]/i*r;return at.mul(n,n,[a,a,1/n[3],a])}function pR(e,t,i,r){let n=r?4:0,a=r?0:4,o=0,s=[],l=[];for(let c=0;c<4;c++){let p=U.sub([],e[c+a],e[c+n]),d=U.length(p);U.scale(p,p,1/d),s.push(d),l.push(p)}for(let c=0;c<4;c++){let p=NS(e[c+n],l[c],i);p!==null&&p>=0?o=Math.max(o,p):o=Math.max(o,s[c])}let u=dR(e,t),h=fR(i,u);if(h!==null){let c=h/U.dot(l[0],u);o=Math.min(o,c)}for(let c=0;c<4;c++){let p=Math.min(o,s[c]),d=[e[c+n][0]+l[c][0]*p,e[c+n][1]+l[c][1]*p,e[c+n][2]+l[c][2]*p,1];e[c+a]=d}}function dR(e,t){let i=U.sub([],e[t[0]],e[t[1]]),r=U.sub([],e[t[2]],e[t[1]]),n=[0,0,0,0];return U.normalize(n,U.cross([],i,r)),n[3]=-U.dot(n,e[t[0]]),n}function fR(e,t){let i=U.len(e),r=at.scale([],e,1/i),n=U.sub([],t,U.scale([],r,U.dot(t,r))),a=U.len(n);if(a>0){let o=Math.sqrt(1-r[3]*r[3]),s=U.scale([],r,-r[3]),l=U.add([],s,U.scale([],n,o/a));return bc(t,l)}else return null}var Ul=class xv{constructor(t,i,r,n,a){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Ed({calcMatrices:()=>{this._calcMatrices()},getConstrained:(o,s)=>this.getConstrained(o,s)},t,i,r,n,a),this._coveringTilesDetailsProvider=new hR}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,i){}clone(){let t=new xv;return t.apply(this),t}apply(t,i,r){this._helper.apply(t,i,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let i=[new Nl(0,t)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new Ut.default(0,0)),n=this.screenPointToMercatorCoordinate(new Ut.default(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new Ut.default(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new Ut.default(0,this._helper._height)),s=Math.floor(Math.min(r.x,n.x,a.x,o.x)),l=Math.floor(Math.max(r.x,n.x,a.x,o.x)),u=1;for(let h=s-u;h<=l+u;h++)h!==0&&i.push(new Nl(h,t))}return i}getCameraFrustum(){return gv.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,i){let r=mn(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),o=Ue.fromLngLat(t),s=new Ue(o.x-(n.x-a.x),o.y-(n.y-a.y));this.setCenter(s==null?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(Ue.fromLngLat(t),i.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(Ue.fromLngLat(t))}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(r!=null)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){let r=i||0,n=[t.x,t.y,0,1],a=[t.x,t.y,1,1];at.transformMat4(n,n,this._pixelMatrixInverse),at.transformMat4(a,a,this._pixelMatrixInverse);let o=n[3],s=a[3],l=n[0]/o,u=a[0]/s,h=n[1]/o,c=a[1]/s,p=n[2]/o,d=a[2]/s,f=p===d?0:(r-p)/(d-p);return new Ue(Ke.number(l,u,f)/this.worldSize,Ke.number(h,c,f)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){let n=[t.x*this.worldSize,t.y*this.worldSize,i,1];return at.transformMat4(n,n,r),new Ut.default(n[0]/n[3],n[1]/n[3])}getBounds(){let t=Math.max(0,this._helper._height/2-Cl(this));return new Zi().extend(this.screenPointToLocation(new Ut.default(0,t))).extend(this.screenPointToLocation(new Ut.default(this._helper._width,t))).extend(this.screenPointToLocation(new Ut.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new Ut.default(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?i.pointCoordinate(t)!=null:t.y>this.height/2-Cl(this)}calculatePosMatrix(t,i=!1,r){var l;let n=(l=t.key)!=null?l:la(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(n)){let u=a.get(n);return r?u.f32:u.f64}let o=ec(t,this.worldSize);V.multiply(o,i?this._alignedProjMatrix:this._viewProjMatrix,o);let s={f64:o,f32:new Float32Array(o)};return a.set(n,s),r?s.f32:s.f64}calculateFogMatrix(t){let i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let n=ec(t,this.worldSize);return V.multiply(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(t,i){i=Ae(+i,this.minZoom,this.maxZoom);let r={center:new oe(t.lng,t.lat),zoom:i},n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&n===null){let v=179.9999999999;n=[-v,v]}let a=this.tileSize*It(r.zoom),o=0,s=a,l=0,u=a,h=0,c=0,{x:p,y:d}=this.size;if(this._helper._latRange){let v=this._helper._latRange;o=vn(v[1])*a,s=vn(v[0])*a,s-o<d&&(h=d/(s-o))}n&&(l=pn(ba(n[0])*a,0,a),u=pn(ba(n[1])*a,0,a),u<l&&(u+=a),u-l<p&&(c=p/(u-l)));let{x:f,y}=ji(a,t),g,_,b=Math.max(c||0,h||0);if(b){let v=new Ut.default(c?(u+l)/2:f,h?(s+o)/2:y);return r.center=zo(a,v).wrap(),r.zoom+=Et(b),r}if(this._helper._latRange){let v=d/2;y-v<o&&(_=o+v),y+v>s&&(_=s-v)}if(n){let v=(l+u)/2,w=f;this._helper._renderWorldCopies&&(w=pn(f,v-a/2,v+a/2));let T=p/2;w-T<l&&(g=l+T),w+T>u&&(g=u-T)}if(g!==void 0||_!==void 0){let v=new Ut.default(g!=null?g:f,_!=null?_:y);r.center=zo(a,v).wrap()}return r}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}_calculateNearFarZIfNeeded(t,i,r){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=t-n*this._helper._pixelPerMeter/Math.cos(i),o=n<0?a:t,s=Math.PI/2+this.pitchInRadians,l=Xe(this.fov)*(Math.abs(Math.cos(Xe(this.roll)))*this.height+Math.abs(Math.sin(Xe(this.roll)))*this.width)/this.height*(.5+r.y/this.height),u=Math.sin(l)*o/Math.sin(Ae(Math.PI-s-l,.01,Math.PI-.01)),h=Cl(this),c=Math.atan(h/this._helper.cameraToCenterDistance),p=Xe(90-ua),d=c>p?2*c*(.5+r.y/(h*2)):p,f=Math.sin(d)*o/Math.sin(Ae(Math.PI-s-d,.01,Math.PI-.01)),y=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-i)*y+o)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,i=ji(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=mn(1,this.center.lat)*this.worldSize;let a=Xe(Math.min(this.pitch,ua)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(a));this._calculateNearFarZIfNeeded(o,a,t);let s;s=new Float64Array(16),V.perspective(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),V.invert(this._invProjMatrix,s),s[8]=-t.x*2/this._helper._width,s[9]=t.y*2/this._helper._height,this._projectionMatrix=V.clone(s),V.scale(s,s,[1,-1,1]),V.translate(s,s,[0,0,-this._helper.cameraToCenterDistance]),V.rotateZ(s,s,-this.rollInRadians),V.rotateX(s,s,this.pitchInRadians),V.rotateZ(s,s,-this.bearingInRadians),V.translate(s,s,[-r,-n,0]),this._mercatorMatrix=V.scale([],s,[this.worldSize,this.worldSize,this.worldSize]),V.scale(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=V.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),V.translate(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=V.invert([],s);let l=[0,0,-1,1];at.transformMat4(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),V.perspective(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=-t.x*2/this.width,this._fogMatrix[9]=t.y*2/this.height,V.scale(this._fogMatrix,this._fogMatrix,[1,-1,1]),V.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),V.rotateZ(this._fogMatrix,this._fogMatrix,-this.rollInRadians),V.rotateX(this._fogMatrix,this._fogMatrix,this.pitchInRadians),V.rotateZ(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),V.translate(this._fogMatrix,this._fogMatrix,[-r,-n,0]),V.scale(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),V.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=V.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let u=this._helper._width%2/2,h=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=r-Math.round(r)+c*u+p*h,f=n-Math.round(n)+c*h+p*u,y=new Float64Array(s);if(V.translate(y,y,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=y,s=V.invert(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new Ut.default(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return at.transformMat4(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=mn(1,this.center.lat)*this.worldSize,i=this._helper.cameraToCenterDistance/t;return op(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}lngLatToCameraDepth(t,i){let r=Ue.fromLngLat(t),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return at.transformMat4(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=t,a=this._helper.getMercatorTileCoordinates(i),o=i?this.calculatePosMatrix(i,r,!0):null,s;return i&&i.terrainRttPosMatrix32f&&n?s=i.terrainRttPosMatrix32f:o?s=o:s=E_(),{mainMatrix:s,tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return U.clone(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,i,r,n){let a=this.calculatePosMatrix(r),o;n?(o=[t,i,n(t,i),1],at.transformMat4(o,o,a)):(o=[t,i,0,1],Id(o,o,a));let s=o[3];return{point:new Ut.default(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getMatrixForModel(t,i){let r=Ue.fromLngLat(t,i),n=r.meterInMercatorCoordinateUnits(),a=Zn();return V.translate(a,a,[r.x,r.y,r.z]),V.rotateZ(a,a,Math.PI),V.rotateX(a,a,Math.PI/2),V.scale(a,a,[-n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let i=new Tt(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),n=ec(i,this.worldSize);V.multiply(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];let a=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],o=Br();return V.scale(o,n,a),r.fallbackMatrix=o,r.mainMatrix=o,r}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}},nl=se(ce(),1);function vv(){ct("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function bv(e){if(e.useSlerp)if(e.k<1){let t=bm(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=bm(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),r=new Float64Array(4);Yl.slerp(r,t,i,e.k);let n=QS(r);e.tr.setRoll(n.roll),e.tr.setPitch(n.pitch),e.tr.setBearing(n.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(Ke.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(Ke.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(Ke.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function wv(e,t,i,r,n){let a=n.padding,o=ji(n.worldSize,i.getNorthWest()),s=ji(n.worldSize,i.getNorthEast()),l=ji(n.worldSize,i.getSouthEast()),u=ji(n.worldSize,i.getSouthWest()),h=Xe(-r),c=o.rotate(h),p=s.rotate(h),d=l.rotate(h),f=u.rotate(h),y=new nl.default(Math.max(c.x,p.x,f.x,d.x),Math.max(c.y,p.y,f.y,d.y)),g=new nl.default(Math.min(c.x,p.x,f.x,d.x),Math.min(c.y,p.y,f.y,d.y)),_=y.sub(g),b=n.width-(a.left+a.right+t.left+t.right),v=n.height-(a.top+a.bottom+t.top+t.bottom),w=b/_.x,T=v/_.y;if(T<0||w<0){vv();return}let S=Math.min(Et(n.scale*Math.min(w,T)),e.maxZoom),M=nl.default.convert(e.offset),E=(t.left-t.right)/2,L=(t.top-t.bottom)/2,z=new nl.default(E,L).rotate(Xe(r)),R=M.add(z).mult(n.scale/It(S));return{center:zo(n.worldSize,o.add(l).div(2).sub(R)),zoom:S,bearing:r}}var Gl=class{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return wv(e,t,i,r,n)}handleJumpToCenterZoom(e,t){let i=typeof t.zoom<"u"?+t.zoom:e.zoom;e.zoom!==i&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(oe.convert(t.center))}handleEaseTo(e,t){let i=e.zoom,r=e.padding,n={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a=t.roll===void 0?e.roll:t.roll,o=t.pitch===void 0?e.pitch:t.pitch,s=t.bearing===void 0?e.bearing:t.bearing,l={roll:a,pitch:o,bearing:s},u=typeof t.zoom<"u",h=!e.isPaddingEqual(t.padding),c=!1,p=u?+t.zoom:e.zoom,d=e.centerPoint.add(t.offsetAsPoint),f=e.screenPointToLocation(d),{center:y,zoom:g}=e.getConstrained(oe.convert(t.center||f),p!=null?p:i);jl(e,y);let _=ji(e.worldSize,f),b=ji(e.worldSize,y).sub(_),v=It(g-i);return c=g!==i,{easeFunc:w=>{if(c&&e.setZoom(Ke.number(i,g,w)),L_(n,l)||bv({startEulerAngles:n,endEulerAngles:l,tr:e,k:w,useSlerp:n.roll!=l.roll}),h&&(e.interpolatePadding(r,t.padding,w),d=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let T=It(e.zoom-i),S=g>i?Math.min(2,v):Math.max(.5,v),M=Math.pow(S,1-w),E=zo(e.worldSize,_.add(b.mult(w*M)).mult(T));e.setLocationAtPoint(e.renderWorldCopies?E.wrap():E,d)}},isZooming:c,elevationCenter:y}}handleFlyTo(e,t){let i=typeof t.zoom<"u",r=e.zoom,n=e.getConstrained(oe.convert(t.center||t.locationAtOffset),i?+t.zoom:r),a=n.center,o=n.zoom;jl(e,a);let s=ji(e.worldSize,t.locationAtOffset),l=ji(e.worldSize,a).sub(s),u=l.mag(),h=It(o-r),c=typeof t.minZoom<"u",p;if(c){let d=Math.min(+t.minZoom,r,o),f=e.getConstrained(a,d).zoom;p=It(f-r)}return{easeFunc:(d,f,y,g)=>{e.setZoom(d===1?o:r+Et(f));let _=d===1?a:zo(e.worldSize,s.add(l.mult(y)).mult(f));e.setLocationAtPoint(e.renderWorldCopies?_.wrap():_,g)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:p,pixelPathLength:u}}},mR=0,Pv=1,yR=771,Ze=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};Ze.Replace=[Pv,mR];Ze.disabled=new Ze(Ze.Replace,te.transparent,[!1,!1,!1,!1]);Ze.unblended=new Ze(Ze.Replace,te.transparent,[!0,!0,!0,!0]);Ze.alphaBlended=new Ze([Pv,yR],te.transparent,[!0,!0,!0,!0]);var Ce=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};Ce.disabled=new Ce(!1,1029,2305);Ce.backCCW=new Ce(!0,1029,2305);Ce.frontCCW=new Ce(!0,1028,2305);var de=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};de.ReadOnly=!1;de.ReadWrite=!0;de.disabled=new de(519,de.ReadOnly,[0,1]);var Ee=class{constructor(e,t,i,r,n,a){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=a}};Ee.disabled=new Ee({func:519,mask:0},0,0,7680,7680,7680);var gR=(e,t)=>({u_input:new Y(e,t.u_input),u_output_expected:new Y(e,t.u_output_expected)}),_R=(e,t)=>({u_input:e,u_output_expected:t}),rc=new WeakMap;function cr(e){var t;if(rc.has(e))return rc.get(e);{let i=(t=e.getParameter(e.VERSION))==null?void 0:t.startsWith("WebGL 2.0");return rc.set(e,i),i}}var xR=class Tv{constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;let i=t.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;let n=new lr;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);let a=new Ti;a.emplaceBack(0,1,2),this._fullscreenTriangle=new Ta(i.createVertexBuffer(n,Fr.members),i.createIndexBuffer(a),qe.simpleSegment(0,0,n.length,a.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);let o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),cr(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}get awaitingQuery(){return!!this._readbackQueue}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,i){let r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,i),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,i=t.gl;t.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,i){let r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:te.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,de.disabled,Ee.disabled,Ze.unblended,Ce.disabled,_R(t,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&cr(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);let a=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:a}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&cr(t)){let i=t.clientWaitSync(this._readbackQueue.sync,0,0);if(i===t.WAIT_FAILED){ct("WebGL2 clientWaitSync failed."),this._readbackQueue=null,this._lastReadbackFrame=this._updateCount;return}if(i===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Tv._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let i=0;return i+=t[0]/256,i+=t[1]/65536,i+=t[2]/16777216,t[3]<127&&(i=-i),i/128}},al=8192/128;function vR(e,t){let i=bR(t,"16bit"),r=lr.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),n=Ti.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new Ta(e.createVertexBuffer(r,Fr.members),e.createIndexBuffer(n),qe.simpleSegment(0,0,r.length,n.length))}function bR(e,t){let i=e.granularity!==void 0?Math.max(e.granularity,1):1,r=i+(e.generateBorders?2:0),n=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=r+1,o=n+1,s=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=i+(e.generateBorders?1:0),h=i+(e.generateBorders||e.extendToSouthPole?1:0),c=a*o,p=r*n*6,d=a*o>65536;if(d&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=d||t==="32bit",y=new Int16Array(c*2),g=0;for(let v=l;v<=h;v++)for(let w=s;w<=u;w++){let T=w/i*8192;w===-1&&(T=-al),w===i+1&&(T=8192+al);let S=v/i*8192;v===-1&&(S=e.extendToNorthPole?zr:-al),v===i+1&&(S=e.extendToSouthPole?hn:8192+al),y[g++]=T,y[g++]=S}let _=f?new Uint32Array(p):new Uint16Array(p),b=0;for(let v=0;v<n;v++)for(let w=0;w<r;w++){let T=w+v*a,S=w+1+v*a,M=w+(v+1)*a,E=w+1+(v+1)*a;_[b++]=T,_[b++]=M,_[b++]=S,_[b++]=S,_[b++]=M,_[b++]=E}return{vertices:y.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}var wR="#define GLOBE",PR="globe",eg={errorTransitionTimeSeconds:.5},nc=new bd({fill:new ur(128,2),line:new ur(512,0),tile:new ur(128,32),stencil:new ur(128,1),circle:3}),Sv=class{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return PR}get shaderDefine(){return wR}get shaderPreludeCode(){return Ui.projectionGlobe}get vertexShaderPreludeCode(){return Ui.projectionMercator.vertexSource}get subdivisionGranularity(){return nc}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new xR(e));let t=vn(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5,r=this._errorMeasurement.updateErrorLoop(t,i),n=ve.now();r!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=r,this._errorMeasurementLastChangeTime=n);let a=(n-this._errorMeasurementLastChangeTime)/1e3,o=Math.min(Math.max(a/eg.errorTransitionTimeSeconds,0),1),s=-this._errorMeasurementLastValue;this._errorCorrectionUsable=aa(this._errorCorrectionPreviousValue,s,A_(o))}_getMeshKey(e){return"".concat(e.granularity.toString(36),"_").concat(e.generateBorders?"b":"").concat(e.extendToNorthPole?"n":"").concat(e.extendToSouthPole?"s":"")}getMeshFromTileID(e,t,i,r,n){let a=(n==="stencil"?nc.stencil:nc.tile).getGranularityForZoomLevel(t.z),o=t.y===0&&r,s=t.y===(1<<t.z)-1&&r;return this._getMesh(e,{granularity:a,generateBorders:i,extendToNorthPole:o,extendToSouthPole:s})}_getMesh(e,t){let i=this._getMeshKey(t);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=vR(e,t);return this._tileMeshCache[i]=r,r}recalculate(e){}hasTransition(){let e=ve.now(),t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<eg.errorTransitionTimeSeconds+.2,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}},TR=new vt({type:new W(O.projection.type)}),tg=class extends Ft{constructor(e){super(),this._transitionable=new du(TR),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new lt(0)),this._mercatorProjection=new pp,this._verticalPerspectiveProjection=new Sv}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof Pn){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}},Bi=se(ce(),1);function Cv(e){let t=Cu(e.worldSize,e.center.lat);return 2*Math.PI*t}function SR(e,t,i){let r=Pt(t),n=Pt(i),a=U.dot(r,n),o=Math.acos(a),s=Cv(e);return o/(2*Math.PI)*s}function CR(e,t){let i=ca(e*Math.PI*2+Math.PI,Math.PI*2),r=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5;return[i,r]}function MR(e,t){let i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}function Lr(e,t,i,r,n){let a=1/(1<<n),o=e/8192*a+i*a,s=t/8192*a+r*a,l=ca(o*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*.5,h=Math.cos(u),c=new Float64Array(3);return c[0]=Math.sin(l)*h,c[1]=Math.sin(u),c[2]=Math.cos(l)*h,c}function Pt(e){return MR(e.lng*Math.PI/180,e.lat*Math.PI/180)}function Cu(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function ig(e){let t=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){let r=e[0]/i,n=e[2]/i,a=Math.acos(n),o=(r>0?a:-a)/Math.PI*180;return new oe(pn(o,-180,180),t)}else return new oe(0,t)}function IR(e){let t=ut();t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3];let i=Math.sqrt(1-e[3]*e[3]);return{center:t,radius:i}}function ER(e,t,i){let r=ut();U.sub(r,i,e);let n=ut();return U.scaleAndAdd(n,e,r,t/U.len(r)),n}function Xl(e){return Math.cos(e*Math.PI/180)}function _t(e,t){let i=Xl(e),r=Xl(t);return Et(r/i)}function AR(e,t){return 360/Cv({worldSize:e,center:{lat:t}})}function rg(e,t){let i=e.rotate(t.bearingInRadians),r=t.zoom+_t(t.center.lat,0),n=aa(1/Xl(t.center.lat),1/Xl(Math.min(Math.abs(t.center.lat),60)),_l(r,7,3,0,1)),a=AR(t.worldSize,t.center.lat);return new oe(t.center.lng-i.x*a*n,Ae(t.center.lat+i.y*a,-$i,$i))}function ac(e){let t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function ng(e,t,i,r){let n=e.lat+i*r;if(Math.abs(i)>1){let a=e.lat+i,o=(Math.sign(a)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+i)*Math.PI/180,l=ac(o+r*(s-o)),u=ac(o),h=ac(s),c=(l-u)/(h-u),p=e.lng+t*c;return new oe(p,n)}else{let a=e.lng+t*r;return new oe(a,n)}}var kR=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,r){let n="".concat(e.z,"_").concat(e.x,"_").concat(e.y,"_").concat(r!=null&&r.terrain?"t":""),a=this._cache.get(n);if(a)return a;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let s=this._boundingVolumeFactory(e,t,i,r);return this._cache.set(n,s),this._hadAnyChanges=!0,s}},oc=class dp{constructor(t,i,r,n){this.min=r,this.max=n,this.points=t,this.planes=i}static fromAabb(t,i){let r=[];for(let n=0;n<8;n++)r.push([(n>>0&1)===1?i[0]:t[0],(n>>1&1)===1?i[1]:t[1],(n>>2&1)===1?i[2]:t[2]]);return new dp(r,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,r){let n=Yl.fromEuler([],r[0],r[1],r[2]),a=U.transformQuat([],[i[0],0,0],n),o=U.transformQuat([],[0,i[1],0],n),s=U.transformQuat([],[0,0,i[2]],n),l=[...t],u=[...t];for(let c=0;c<8;c++)for(let p=0;p<3;p++){let d=t[p]+a[p]*((c>>0&1)===1?1:-1)+o[p]*((c>>1&1)===1?1:-1)+s[p]*((c>>2&1)===1?1:-1);l[p]=Math.min(l[p],d),u[p]=Math.max(u[p],d)}let h=[];for(let c=0;c<8;c++){let p=[...t];U.add(p,p,U.scale([],a,(c>>0&1)===1?1:-1)),U.add(p,p,U.scale([],o,(c>>1&1)===1?1:-1)),U.add(p,p,U.scale([],s,(c>>2&1)===1?1:-1)),h.push(p)}return new dp(h,[[...a,-U.dot(a,h[0])],[...o,-U.dot(o,h[0])],[...s,-U.dot(s,h[0])],[-a[0],-a[1],-a[2],-U.dot(a,h[7])],[-o[0],-o[1],-o[2],-U.dot(o,h[7])],[-s[0],-s[1],-s[2],-U.dot(s,h[7])]],l,u)}intersectsFrustum(t){let i=!0,r=this.points.length,n=this.planes.length,a=t.planes.length,o=t.points.length;for(let s=0;s<a;s++){let l=t.planes[s],u=0;for(let h=0;h<r;h++){let c=this.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0;u<r&&(i=!1)}if(i)return 2;for(let s=0;s<n;s++){let l=this.planes[s],u=0;for(let h=0;h<o;h++){let c=t.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let n=0;n<i;n++){let a=this.points[n];t[0]*a[0]+t[1]*a[1]+t[2]*a[2]+t[3]>=0&&r++}return r===i?2:r===0?0:1}};function Ml(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function sc(e,t,i,r,n){let a=e-i,o;return a<0?o=Math.min(-a,1+a-n):a>1?o=Math.min(Math.max(a-n,0),1-a):o=0,Math.max(o,Ml(t,r,n))}var DR=class{constructor(){this._boundingVolumeCache=new kR(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,r){let n=1<<i.z,a=1/n,o=i.x/n,s=i.y/n,l=1,u=.5*l,h=2*l;return h=Math.min(h,sc(e,t,o,s,a)),h=Math.min(h,sc(e,t,o+u,-s-a,a)),h=Math.min(h,sc(e,t,o+u,l+l-s-a,a)),h}getWrap(e,t,i){let r=1<<t.z,n=1/r,a=t.x/r,o=Ml(e.x,a,n),s=Ml(e.x,a-1,n),l=Ml(e.x,a+1,n),u=Math.min(o,s,l);return u===l?1:u===s?-1:0}allowVariableZoom(e,t){return Tu(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,t,i,r){var o,s;let n=0,a=0;if(r!=null&&r.terrain){let l=new Tt(e.z,t,e.z,e.x,e.y),u=r.terrain.getMinMaxElevation(l);n=(o=u.minElevation)!=null?o:Math.min(0,i),a=(s=u.maxElevation)!=null?s:Math.max(0,i)}if(n/=Ni,a/=Ni,n+=1,a+=1,e.z<=0)return oc.fromAabb([-a,-a,-a],[a,a,a]);if(e.z===1)return oc.fromAabb([e.x===0?-a:0,e.y===0?0:-a,-a],[e.x===0?0:a,e.y===0?a:0,a]);{let l=[Lr(0,0,e.x,e.y,e.z),Lr(8192,0,e.x,e.y,e.z),Lr(8192,8192,e.x,e.y,e.z),Lr(0,8192,e.x,e.y,e.z)],u=[];for(let z of l)u.push(U.scale([],z,a));if(a!==n)for(let z of l)u.push(U.scale([],z,n));e.y===0&&u.push([0,1,0]),e.y===(1<<e.z)-1&&u.push([0,-1,0]);let h=[1,1,1],c=[-1,-1,-1];for(let z of u)for(let R=0;R<3;R++)h[R]=Math.min(h[R],z[R]),c[R]=Math.max(c[R],z[R]);let p=Lr(8192/2,8192/2,e.x,e.y,e.z),d=U.cross([],[0,1,0],p);U.normalize(d,d);let f=U.cross([],p,d);U.normalize(f,f);let y=U.cross([],l[2],l[1]);U.normalize(y,y);let g=U.cross([],l[0],l[3]);U.normalize(g,g),u.push(U.scale([],p,a)),e.y>=(1<<e.z)/2&&u.push(U.scale([],Lr(8192/2,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&u.push(U.scale([],Lr(8192/2,8192,e.x,e.y,e.z),a));let _=ag(p,u),b=ag(f,u),v=[-p[0],-p[1],-p[2],_.max],w=[p[0],p[1],p[2],-_.min],T=[-f[0],-f[1],-f[2],b.max],S=[f[0],f[1],f[2],-b.min],M=[...y,0],E=[...g,0],L=[];return e.y===0?L.push(ni(E,M,v),ni(E,M,w)):L.push(ni(T,M,v),ni(T,M,w),ni(T,E,v),ni(T,E,w)),e.y===(1<<e.z)-1?L.push(ni(E,M,v),ni(E,M,w)):L.push(ni(S,M,v),ni(S,M,w),ni(S,E,v),ni(S,E,w)),new oc(L,[v,w,T,S,M,E],h,c)}}};function ag(e,t){let i=1/0,r=-1/0;for(let n of t){let a=U.dot(e,n);i=Math.min(i,a),r=Math.max(r,a)}return{min:i,max:r}}var Mv=class Iv{constructor(){this._cachedClippingPlane=Ua(),this._projectionMatrix=Zn(),this._globeViewProjMatrix32f=E_(),this._globeViewProjMatrixNoCorrection=Zn(),this._globeViewProjMatrixNoCorrectionInverted=Zn(),this._globeProjMatrixInverted=Zn(),this._cameraPosition=ut(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Ed({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,i)=>this.getConstrained(t,i)}),this._coveringTilesDetailsProvider=new DR}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}clone(){let t=new Iv;return t.apply(this),t}apply(t,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=ut();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,n=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let i=this.pitchInRadians,r=this.cameraToCenterDistance/t,n=1,a=Math.sin(i)*r,o=Math.cos(i)*r+n,s=Math.sqrt(a*a+o*o),l=n/s*n,u=-a,h=o,c=Math.sqrt(u*u+h*h);u/=c,h/=c;let p=[0,u,h];U.rotateZ(p,p,[0,0,0],-this.bearingInRadians),U.rotateX(p,p,[0,0,0],-1*this.center.lat*Math.PI/180),U.rotateY(p,p,[0,0,0],this.center.lng*Math.PI/180);let d=1/U.length(p);return U.scale(p,p,d),[...p,-l*d]}isLocationOccluded(t){return!this.isSurfacePointVisible(Pt(t))}transformLightDirection(t){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),a=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],o=[a[2],0,-a[0]],s=[0,0,0];U.cross(s,o,a),U.normalize(o,o),U.normalize(s,s);let l=[o[0]*t[0]+s[0]*t[1]+a[0]*t[2],o[1]*t[0]+s[1]*t[1]+a[1]*t[2],o[2]*t[0]+s[2]*t[1]+a[2]*t[2]],u=[0,0,0];return U.normalize(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,r){let n=c3(t,i,r.canonical),a=CR(n.x,n.y);return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(t,i,r,n){let a=r.canonical,o=Lr(t,i,a.x,a.y,a.z),s=1+(n?n(t,i):0)/Ni,l=[o[0]*s,o[1]*s,o[2]*s,1];at.transformMat4(l,l,this._globeViewProjMatrixNoCorrection);let u=this._cachedClippingPlane,h=u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]<0;return{point:new Bi.default(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=Cu(this.worldSize,this.center.lat),i=Br(),r=Br();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+t*2),V.perspective(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;i[8]=-n.x*2/this._helper._width,i[9]=n.y*2/this._helper._height,this._projectionMatrix=V.clone(i),this._globeProjMatrixInverted=Br(),V.invert(this._globeProjMatrixInverted,i),V.translate(i,i,[0,0,-this.cameraToCenterDistance]),V.rotateZ(i,i,this.rollInRadians),V.rotateX(i,i,-this.pitchInRadians),V.rotateZ(i,i,this.bearingInRadians),V.translate(i,i,[0,0,-t]);let a=ut();a[0]=t,a[1]=t,a[2]=t,V.rotateX(r,i,this.center.lat*Math.PI/180),V.rotateY(r,r,-this.center.lng*Math.PI/180),V.scale(r,r,a),this._globeViewProjMatrixNoCorrection=r,V.rotateX(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),V.rotateY(i,i,-this.center.lng*Math.PI/180),V.scale(i,i,a),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=Br(),V.invert(this._globeViewProjMatrixNoCorrectionInverted,r);let o=ut();this._cameraPosition=ut(),this._cameraPosition[2]=this.cameraToCenterDistance/t,U.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),U.rotateX(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),U.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),U.add(this._cameraPosition,this._cameraPosition,[0,0,1]),U.rotateX(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),U.rotateY(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let s=V.clone(this._globeViewProjMatrixNoCorrectionInverted);V.scale(s,s,[1,1,-1]),this._cachedFrustum=gv.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){ct("calculateFogMatrix is not supported on globe projection.");let i=Br();return V.identity(i),i}getVisibleUnwrappedCoordinates(t){return[new Nl(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&ct("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){if(!this._globeViewProjMatrixNoCorrection)return 1;let r=Pt(t);U.scale(r,r,1+i/Ni);let n=Ua();return at.transformMat4(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){let t=this.width*.5,i=this.height*.5,r=[new Bi.default(0,0),new Bi.default(t,0),new Bi.default(this.width,0),new Bi.default(this.width,i),new Bi.default(this.width,this.height),new Bi.default(t,this.height),new Bi.default(0,this.height),new Bi.default(0,i)],n=[];for(let c of r)n.push(this.unprojectScreenPoint(c));let a=0,o=0,s=0,l=0,u=this.center;for(let c of n){let p=Gt(u.lng,c.lng),d=Gt(u.lat,c.lat);p<o&&(o=p),p>a&&(a=p),d<l&&(l=d),d>s&&(s=d)}let h=[u.lng+o,u.lat+l,u.lng+a,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new Zi(h)}getConstrained(t,i){let r=Ae(t.lat,-$i,$i),n=Ae(+i,this.minZoom+_t(0,r),this.maxZoom);return{center:new oe(t.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}setLocationAtPoint(t,i){let r=this.unprojectScreenPoint(i),n=Pt(r),a=Pt(t),o=ut();U.zero(o);let s=ut();U.rotateY(s,n,o,-this.center.lng*Math.PI/180),U.rotateX(s,s,o,this.center.lat*Math.PI/180);let l=a[0]*a[0]+a[2]*a[2],u=s[0]*s[0];if(l<u)return;let h=Math.sqrt(l-u),c=-h,p=Bs(a[0],a[2],s[0],h),d=Bs(a[0],a[2],s[0],c),f=ut();U.rotateY(f,a,o,-p);let y=Bs(f[1],f[2],s[1],s[2]),g=ut();U.rotateY(g,a,o,-d);let _=Bs(g[1],g[2],s[1],s[2]),b=Math.PI*.5,v=y>=-b&&y<=b,w=_>=-b&&_<=b,T,S;if(v&&w){let z=this.center.lng*Math.PI/180,R=this.center.lat*Math.PI/180,k=Os(p,z),D=Os(y,R),x=Os(d,z),C=Os(_,R);k+D<x+C?(T=p,S=y):(T=d,S=_)}else if(v)T=p,S=y;else if(w)T=d,S=_;else return;let M=T/Math.PI*180,E=S/Math.PI*180,L=this.center.lat;this.setCenter(new oe(M,Ae(E,-90,90))),this.setZoom(this.zoom+_t(L,this.center.lat))}locationToScreenPoint(t,i){let r=Pt(t);if(i){let n=i.getElevationForLngLatZoom(t,this._helper._tileZoom);U.scale(r,r,1+n/Ni)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){let i=Ua();return at.transformMat4(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new Bi.default((i[0]*.5+.5)*this.width,(-i[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(r)return r}return Ue.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}isPointOnMapSurface(t,i){let r=this._cameraPosition,n=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,n)}getRayDirectionFromPixel(t){let i=Ua();i[0]=t.x/this.width*2-1,i[1]=(t.y/this.height*2-1)*-1,i[2]=1,i[3]=1,at.transformMat4(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=ut();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let n=ut();return U.normalize(n,r),n}isSurfacePointVisible(t){let i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let i=Ua();return at.transformMat4(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(t,i){let r=U.dot(t,i),n=1,a=ut(),o=ut();U.scale(o,i,r),U.sub(a,t,o);let s=n-U.dot(a,a);if(s<0)return null;let l=U.dot(t,t)-n,u=-r+(r<0?1:-1)*Math.sqrt(s),h=l/u,c=u,p=Math.min(h,c),d=Math.max(h,c);return{tMin:p,tMax:d}}unprojectScreenPoint(t){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(i,r);if(n){let p=ut();U.add(p,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);let d=ut();return U.normalize(d,p),ig(d)}let a=this._cachedClippingPlane,o=a[0]*r[0]+a[1]*r[1]+a[2]*r[2],s=-bc(a,i)/o,l=2,u=ut();if(s>0)U.add(u,i,[r[0]*s,r[1]*s,r[2]*s]);else{let p=ut();U.add(p,i,[r[0]*l,r[1]*l,r[2]*l]);let d=bc(this._cachedClippingPlane,p);U.sub(u,p,[this._cachedClippingPlane[0]*d,this._cachedClippingPlane[1]*d,this._cachedClippingPlane[2]*d])}let h=IR(a),c=ER(h.center,h.radius,u);return ig(c)}getMatrixForModel(t,i){let r=oe.convert(t),n=1/Ni,a=Zn();return V.rotateY(a,a,r.lng/180*Math.PI),V.rotateX(a,a,-r.lat/180*Math.PI),V.translate(a,a,[0,0,1+i/Ni]),V.rotateX(a,a,Math.PI*.5),V.scale(a,a,[n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let i=this.getProjectionData({overscaledTileID:new Tt(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}},og=class Ev{constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Ed({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,i)=>this.getConstrained(t,i)}),this._globeness=1,this._mercatorTransform=new Ul,this._verticalPerspectiveTransform=new Mv}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,i){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}clone(){let t=new Ev;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let i=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return aa(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return aa(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){let n=this._mercatorTransform.getPitchedTextCorrection(t,i,r),a=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return aa(n,a,this._globeness)}projectTileCoordinates(t,i,r,n){return this.currentTransform.projectTileCoordinates(t,i,r,n)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){return this.currentTransform.lngLatToCameraDepth(t,i)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,i){return this.currentTransform.getConstrained(t,i)}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}setLocationAtPoint(t,i){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,i),this.apply(this._mercatorTransform);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,i){return this.currentTransform.getMatrixForModel(t,i)}getProjectionDataForCustomLayer(t=!0){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=i.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},lc=se(ce(),1),Av=class ar{get useGlobeControls(){return!0}handlePanInertia(t,i){let r=rg(t,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new lc.default(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){let r=t.around,n=i.screenPointToLocation(r);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);let a=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);let o=i.zoom-a;if(o===0)return;let s=.3,l=.5,u=45,h=85,c=.25,p=.75,d=.35,f=.9,y=.5,g=.25,_=Gt(i.center.lng,n.lng),b=_/(Math.abs(_/180)+1),v=Gt(i.center.lat,n.lat),w=i.getRayDirectionFromPixel(r),T=i.cameraPosition,S=U.dot(T,w)*-1,M=ut();U.add(M,T,[w[0]*S,w[1]*S,w[2]*S]);let E=U.length(M)-1,L=Math.exp(-Math.max(E-s,0)*l),z=Cu(i.worldSize,i.center.lat)/Math.min(i.width,i.height),R=_l(z,f,y,1,g),k=(1-It(-o))*Math.min(L,R),D=i.center.lat,x=i.zoom,C=new oe(i.center.lng+b*k,Ae(i.center.lat+v*k,-$i,$i));i.setLocationAtPoint(n,r);let I=i.center,F=_l(Math.abs(_),u,h,0,1),N=_l(z,p,d,0,1),G=Math.pow(Math.max(F,N),c),J=Gt(I.lng,C.lng),ee=Gt(I.lat,C.lat);i.setCenter(new oe(I.lng+J*G,I.lat+ee*G).wrap()),i.setZoom(x+_t(D,i.center.lat))}handleMapControlsPan(t,i,r){if(!t.panDelta)return;let n=i.center.lat,a=i.zoom;i.setCenter(rg(t.panDelta,i).wrap()),i.setZoom(a+_t(n,i.center.lat))}cameraForBoxAndBearing(t,i,r,n,a){let o=wv(t,i,r,n,a),s=i.left/a.width*2-1,l=(a.width-i.right)/a.width*2-1,u=i.top/a.height*-2+1,h=(a.height-i.bottom)/a.height*-2+1,c=Gt(r.getWest(),r.getEast())<0,p=c?r.getEast():r.getWest(),d=c?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),y=Math.min(r.getNorth(),r.getSouth()),g=p+Gt(p,d)*.5,_=f+Gt(f,y)*.5,b=a.clone();b.setCenter(o.center),b.setBearing(o.bearing),b.setPitch(0),b.setRoll(0),b.setZoom(o.zoom);let v=b.modelViewProjectionMatrix,w=[Pt(r.getNorthWest()),Pt(r.getNorthEast()),Pt(r.getSouthWest()),Pt(r.getSouthEast()),Pt(new oe(d,_)),Pt(new oe(p,_)),Pt(new oe(g,f)),Pt(new oe(g,y))],T=Pt(o.center),S=Number.POSITIVE_INFINITY;for(let M of w)s<0&&(S=ar.getLesserNonNegativeNonNull(S,ar.solveVectorScale(M,T,v,"x",s))),l>0&&(S=ar.getLesserNonNegativeNonNull(S,ar.solveVectorScale(M,T,v,"x",l))),u>0&&(S=ar.getLesserNonNegativeNonNull(S,ar.solveVectorScale(M,T,v,"y",u))),h<0&&(S=ar.getLesserNonNegativeNonNull(S,ar.solveVectorScale(M,T,v,"y",h)));if(!Number.isFinite(S)||S===0){vv();return}return o.zoom=b.zoom+Et(S),o}handleJumpToCenterZoom(t,i){let r=t.center.lat,n=t.getConstrained(i.center?oe.convert(i.center):t.center,t.zoom).center;t.setCenter(n.wrap());let a=typeof i.zoom<"u"?+i.zoom:t.zoom+_t(r,n.lat);t.zoom!==a&&t.setZoom(a)}handleEaseTo(t,i){let r=t.zoom,n=t.center,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s=i.roll===void 0?t.roll:i.roll,l=i.pitch===void 0?t.pitch:i.pitch,u=i.bearing===void 0?t.bearing:i.bearing,h={roll:s,pitch:l,bearing:u},c=typeof i.zoom<"u",p=!t.isPaddingEqual(i.padding),d=!1,f=i.center?oe.convert(i.center):n,y=t.getConstrained(f,r).center;jl(t,y);let g=t.clone();g.setCenter(y),g.setZoom(c?+i.zoom:r+_t(n.lat,f.lat)),g.setBearing(i.bearing);let _=new lc.default(Ae(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),Ae(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));g.setLocationAtPoint(y,_);let b=(i.offset&&i.offsetAsPoint.mag())>0?g.center:y,v=c?+i.zoom:r+_t(n.lat,b.lat),w=r+_t(n.lat,0),T=v+_t(b.lat,0),S=Gt(n.lng,b.lng),M=Gt(n.lat,b.lat),E=It(T-w);return d=v!==r,{easeFunc:L=>{if(L_(o,h)||bv({startEulerAngles:o,endEulerAngles:h,tr:t,k:L,useSlerp:o.roll!=h.roll}),p&&t.interpolatePadding(a,i.padding,L),i.around)ct("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{let z=T>w?Math.min(2,E):Math.max(.5,E),R=Math.pow(z,1-L),k=L*R,D=ng(n,S,M,k);t.setCenter(D.wrap())}if(d){let z=Ke.number(w,T,L)+_t(0,t.center.lat);t.setZoom(z)}},isZooming:d,elevationCenter:b}}handleFlyTo(t,i){let r=typeof i.zoom<"u",n=t.center,a=t.zoom,o=t.padding,s=!t.isPaddingEqual(i.padding),l=t.getConstrained(oe.convert(i.center||i.locationAtOffset),a).center,u=r?+i.zoom:t.zoom+_t(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(u),h.setBearing(i.bearing);let c=new lc.default(Ae(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),Ae(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,c);let p=h.center;jl(t,p);let d=SR(t,n,p),f=a+_t(n.lat,0),y=u+_t(p.lat,0),g=It(y-f),_=typeof i.minZoom=="number",b;if(_){let T=+i.minZoom+_t(p.lat,0),S=Math.min(T,f,y)+_t(0,p.lat),M=t.getConstrained(p,S).zoom+_t(p.lat,0);b=It(M-f)}let v=Gt(n.lng,p.lng),w=Gt(n.lat,p.lat);return{easeFunc:(T,S,M,E)=>{let L=ng(n,v,w,M);s&&t.interpolatePadding(o,i.padding,T);let z=T===1?p:L;t.setCenter(z.wrap());let R=f+Et(S);t.setZoom(T===1?u:R+_t(0,z.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:b,pixelPathLength:d}}static solveVectorScale(t,i,r,n,a){let o=a,s=n==="x"?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],l=[r[3],r[7],r[11],r[15]],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],c=i[0]*s[0]+i[1]*s[1]+i[2]*s[2],p=i[0]*l[0]+i[1]*l[1]+i[2]*l[2],d=(c+s[3]-o*p-o*l[3])/(c-u-o*p+o*h);return c+o*h===u+o*p||l[3]*(u-c)+s[3]*(p-h)+u*p===c*h?null:d}static getLesserNonNegativeNonNull(t,i){return i!==null&&i>=0&&i<t?i:t}},sg=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new Gl,this._verticalPerspectiveCameraHelper=new Av}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,n){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};function LR(e){if(Array.isArray(e)){let t=new tg({type:e});return{projection:t,transform:new og,cameraHelper:new sg(t)}}switch(e){case"mercator":return{projection:new pp,transform:new Ul,cameraHelper:new Gl};case"globe":{let t=new tg({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new og,cameraHelper:new sg(t)}}case"vertical-perspective":return{projection:new Sv,transform:new Mv,cameraHelper:new Av};default:return ct("Unknown projection name: ".concat(e,". Falling back to mercator projection.")),{projection:new pp,transform:new Ul,cameraHelper:new Gl}}}var ol=(e,t)=>cu(e,t&&t.filter(i=>i.identifier!=="source.canvas")),RR=jI(),lg=class extends Ft{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let i in this.sourceCaches){let r=this.sourceCaches[i].getSource().type;(r==="vector"||r==="geojson")&&this.sourceCaches[i].reload()}},this.map=e,this.dispatcher=new $0(q0(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(i,r)=>this.getGlyphs(i,r)),this.dispatcher.registerMessageHandler("GI",(i,r)=>this.getImages(i,r)),this.imageManager=new cD,this.imageManager.setEventedParent(this),this.glyphManager=new fD(e._requestManager,t.localIdeographFontFamily),this.lineAtlas=new xD(256,512),this.crossTileSymbolIndex=new cv,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Fc,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",Cp()),ap().on(np,this._rtlPluginLoaded),this.on("data",i=>{if(i.dataType!=="source"||i.sourceDataType!=="metadata")return;let r=this.sourceCaches[i.sourceId];if(!r)return;let n=r.getSource();if(!(!n||!n.vectorLayerIds))for(let a in this._layers){let o=this._layers[a];o.source===n.id&&this._validateLayer(o)}})}setGlobalStateProperty(e,t){var n,a,o;this._checkLoaded();let i=t===null?(o=(a=(n=this.stylesheet.state)==null?void 0:n[e])==null?void 0:a.default)!=null?o:null:t;if(Oi(i,this._globalState[e]))return this;this._globalState[e]=i;let r=this._findGlobalStateAffectedSources([e]);for(let s in this.sourceCaches)r.has(s)&&(this._reloadSource(s),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let r in e)!Oi(this._globalState[r],e[r].default)&&(t.push(r),this._globalState[r]=e[r].default);let i=this._findGlobalStateAffectedSources(t);for(let r in this.sourceCaches)i.has(r)&&(this._reloadSource(r),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;let t=new Set;for(let i in this._layers){let r=this._layers[i],n=r.getLayoutAffectingGlobalStateRefs();for(let a of e)n.has(a)&&t.add(r.source)}return t}loadURL(e,t={},i){this.fire(new $("dataloading",{dataType:"style"})),t.validate=typeof t.validate=="boolean"?t.validate:!0;let r=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;Kl(r,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,t,i)}).catch(a=>{this._loadStyleRequest=null,a&&!n.signal.aborted&&this.fire(new ne(a))})}loadJSON(e,t={},i){this.fire(new $("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ve.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,i)}).catch(()=>{})}loadEmpty(){this.fire(new $("dataloading",{dataType:"style"})),this._load(RR,{validate:!1})}_load(e,t,i){var n,a,o;let r=t.transformStyle?t.transformStyle(i,e):e;if(!(t.validate&&ol(this,ht(r)))){this._loaded=!0,this.stylesheet=r;for(let s in r.sources)this.addSource(s,r.sources[s],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this._createLayers(),this.light=new yD(this.stylesheet.light),this._setProjectionInternal(((n=this.stylesheet.projection)==null?void 0:n.type)||"mercator"),this.sky=new _D(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!=null?a:null),this.setGlobalState((o=this.stylesheet.state)!=null?o:null),this.fire(new $("data",{dataType:"style"})),this.fire(new $("style.load"))}}_createLayers(){let e=Pm(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(t=>t.id),this._layers={},this._serializedLayers=null;for(let t of e){let i=Hh(t);i.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=i}}_loadSprite(e,t=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let r;uD(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(n=>{if(this._spriteRequest=null,n)for(let a in n){this._spritesImagesIds[a]=[];let o=this._spritesImagesIds[a]?this._spritesImagesIds[a].filter(s=>!(s in n)):[];for(let s of o)this.imageManager.removeImage(s),this._changedImages[s]=!0;for(let s in n[a]){let l=a==="default"?s:"".concat(a,":").concat(s);this._spritesImagesIds[a].push(l),l in this.imageManager.images?this.imageManager.updateImage(l,n[a][s],!1):this.imageManager.addImage(l,n[a][s]),t&&(this._changedImages[l]=!0)}}}).catch(n=>{this._spriteRequest=null,r=n,this.fire(new ne(r))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new $("data",{dataType:"style"})),i&&i(r)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new $("data",{dataType:"style"}))}_validateLayer(e){let t=this.sourceCaches[e.source];if(!t)return;let i=e.sourceLayer;if(!i)return;let r=t.getSource();(r.type==="geojson"||r.vectorLayerIds&&r.vectorLayerIds.indexOf(i)===-1)&&this.fire(new ne(new Error('Source layer "'.concat(i,'" does not exist on source "').concat(r.id,'" as specified by style layer "').concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let i=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?Ot(i):i);let r=[];for(let n of e)if(i[n]){let a=t?Ot(i[n]):i[n];r.push(a)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let r=this._layers[i];r.type!=="custom"&&(e[i]=r.serialize())}return e}hasTransitions(){var e,t,i;if((e=this.light)!=null&&e.hasTransition()||(t=this.sky)!=null&&t.hasTransition()||(i=this.projection)!=null&&i.hasTransition())return!0;for(let r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(let r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){let r=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(r.length||n.length)&&this._updateWorkerLayers(r,n);for(let a in this._updatedSources){let o=this._updatedSources[a];if(o==="reload")this._reloadSource(a);else if(o==="clear")this._clearSource(a);else throw new Error("Invalid action ".concat(o))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let a in this._updatedPaintProps)this._layers[a].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let i={};for(let r in this.sourceCaches){let n=this.sourceCaches[r];i[r]=n.used,n.used=!1}for(let r of this._order){let n=this._layers[r];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(let r in i){let n=this.sourceCaches[r];!!i[r]!=!!n.used&&n.fire(new $("data",{sourceDataType:"visibility",dataType:"source",sourceId:r}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new $("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){var a;this._checkLoaded();let i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,((a=t.validate)!=null?a:!0)&&ol(this,ht(e)))return!1;e=Ot(e),e.layers=Pm(e.layers);let r=oM(i,e),n=this._getOperationsToPerform(r);if(n.unimplemented.length>0)throw new Error("Unimplemented: ".concat(n.unimplemented.join(", "),"."));if(n.operations.length===0)return!1;for(let o of n.operations)o();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let t=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,r.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,r.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,r.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,r.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,r.args));break;case"addSource":t.push(()=>this.addSource.apply(this,r.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,r.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case"setLight":t.push(()=>this.setLight.apply(this,r.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,r.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,r.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,r.args));break;case"setSky":t.push(()=>this.setSky.apply(this,r.args));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,r.args));break;case"setTransition":t.push(()=>{});break;default:i.push(r.command);break}return{operations:t,unimplemented:i}}addImage(e,t){if(this.getImage(e))return this.fire(new ne(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new ne(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new $("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,i={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error('Source "'.concat(e,'" already exists.'));if(!t.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(t).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(t.type)>=0&&this._validate(ht.source,"sources.".concat(e),t,null,i))return;this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);let r=this.sourceCaches[e]=new Bo(e,t,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new ne(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(i,'" is using it.'))));let t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.fire(new $("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID=".concat(e));let i=this.sourceCaches[e].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,t,i={}){this._checkLoaded();let r=e.id;if(this.getLayer(r)){this.fire(new ne(new Error('Layer "'.concat(r,'" already exists on this map.'))));return}let n;if(e.type==="custom"){if(ol(this,oD(e)))return;n=Hh(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(r,e.source),e=Ot(e),e=K(e,{source:r})),this._validate(ht.layer,"layers.".concat(r),e,{arrayIndex:-1},i))return;n=Hh(e),this._validateLayer(n),n.setEventedParent(this,{layer:{id:r}})}let a=t?this._order.indexOf(t):this._order.length;if(t&&a===-1){this.fire(new ne(new Error('Cannot add layer "'.concat(r,'" before non-existing layer "').concat(t,'".'))));return}if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=n,this._removedLayers[r]&&n.source&&n.type!=="custom"){let o=this._removedLayers[r];delete this._removedLayers[r],o.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.sourceCaches[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new ne(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));return}if(e===t)return;let i=this._order.indexOf(e);this._order.splice(i,1);let r=t?this._order.indexOf(t):this._order.length;if(t&&r===-1){this.fire(new ne(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(t,'".'))));return}this._order.splice(r,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new ne(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));return}t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,i){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new ne(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))));return}r.minzoom===t&&r.maxzoom===i||(t!=null&&(r.minzoom=t),i!=null&&(r.maxzoom=i),this._updateLayer(r))}setFilter(e,t,i={}){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new ne(new Error('Cannot filter non-existing layer "'.concat(e,'".'))));return}if(!Oi(r.filter,t)){if(t==null){r.setFilter(void 0),this._updateLayer(r);return}this._validate(ht.filter,"layers.".concat(r.id,".filter"),t,null,i)||(r.setFilter(Ot(t)),this._updateLayer(r))}}getFilter(e){return Ot(this.getLayer(e).filter)}setLayoutProperty(e,t,i,r={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new ne(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}Oi(n.getLayoutProperty(t),i)||(n.setLayoutProperty(t,i,r),this._updateLayer(n))}getLayoutProperty(e,t){let i=this.getLayer(e);if(!i){this.fire(new ne(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))));return}return i.getLayoutProperty(t)}setPaintProperty(e,t,i,r={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new ne(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}Oi(n.getPaintProperty(t),i)||(n.setPaintProperty(t,i,r)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null)}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(n===void 0){this.fire(new ne(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=n.getSource().type;if(a==="geojson"&&r){this.fire(new ne(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(a==="vector"&&!r){this.fire(new ne(new Error("The sourceLayer parameter must be provided for vector source types.")));return}e.id===void 0&&this.fire(new ne(new Error("The feature id parameter must be provided."))),n.setFeatureState(r,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let i=e.source,r=this.sourceCaches[i];if(r===void 0){this.fire(new ne(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let n=r.getSource().type,a=n==="vector"?e.sourceLayer:void 0;if(n==="vector"&&!a){this.fire(new ne(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(t&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new ne(new Error("A feature id is required to remove its specific state property.")));return}r.removeFeatureState(a,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,i=e.sourceLayer,r=this.sourceCaches[t];if(r===void 0){this.fire(new ne(new Error("The source '".concat(t,"' does not exist in the map's style."))));return}if(r.getSource().type==="vector"&&!i){this.fire(new ne(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new ne(new Error("The feature id parameter must be provided."))),r.getFeatureState(i,e.id)}getTransition(){return K({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=Tp(this.sourceCaches,n=>n.serialize()),t=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,r=this.stylesheet;return D_({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,projection:r.projection,sources:e,layers:t,terrain:i},n=>n!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=a=>this._layers[a].type==="fill-extrusion",i={},r=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o)){i[o]=a;for(let s of e){let l=s[o];if(l)for(let u of l)r.push(u)}}}r.sort((a,o)=>o.intersectionZ-a.intersectionZ);let n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let s=r.length-1;s>=0;s--){let l=r[s].feature;if(i[l.layer.id]<a)break;n.push(l),r.pop()}else for(let s of e){let l=s[o];if(l)for(let u of l)n.push(u.feature)}}return n}queryRenderedFeatures(e,t,i){t&&t.filter&&this._validate(ht.filter,"queryRenderedFeatures.filter",t.filter,null,t);let r={};if(t&&t.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new ne(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let l of t.layers){let u=this._layers[l];if(!u)return this.fire(new ne(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];r[u.source]=!0}}let n=[];t.availableImages=this._availableImages;let a=this._serializedAllLayers(),o=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,s=ri(nt({},t),{layers:o});for(let l in this.sourceCaches)t.layers&&!r[l]||n.push(kD(this.sourceCaches[l],this._layers,a,e,s,i,this.map.terrain?(u,h,c)=>this.map.terrain.getElevation(u,h,c):void 0));return this.placement&&n.push(DD(this._layers,a,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(e,t){t&&t.filter&&this._validate(ht.filter,"querySourceFeatures.filter",t.filter,null,t);let i=this.sourceCaches[e];return i?LD(i,t):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let i=this.light.getLight(),r=!1;for(let a in e)if(!Oi(e[a],i[a])){r=!0;break}if(!r)return;let n={now:ve.now(),transition:K({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(n)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,t={}){this._checkLoaded();let i=this.getSky(),r=!1;if(!e&&!i)return;if(e&&!i)r=!0;else if(!e&&i)r=!0;else for(let a in e)if(!Oi(e[a],i[a])){r=!0;break}if(!r)return;let n={now:ve.now(),transition:K({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(n)}_setProjectionInternal(e){let t=LR(e);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let i in this.sourceCaches)this.sourceCaches[i].reload()}_validate(e,t,i,r,n={}){return n&&n.validate===!1?!1:ol(this,e.call(ht,K({key:t,style:this.serialize(),value:i,styleSpec:O},r)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ap().off(np,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.sourceCaches){let i=this.sourceCaches[t];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,i,r,n=!1){let a=!1,o=!1,s={};for(let l of this._order){let u=this._layers[l];if(u.type!=="symbol")continue;if(!s[u.source]){let c=this.sourceCaches[u.source];s[u.source]=c.getRenderableIds(!0).map(p=>c.getTileByID(p)).sort((p,d)=>d.tileID.overscaledZ-p.tileID.overscaledZ||(p.tileID.isLessThan(d.tileID)?-1:1))}let h=this.crossTileSymbolIndex.addLayer(u,s[u.source],e.center.lng);a=a||h}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n=n||this._layerOrderChanged||i===0,(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ve.now(),e.zoom))&&(this.pauseablePlacement=new j3(e,this.map.terrain,this._order,n,t,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ve.now()),o=!0),a&&this.pauseablePlacement.placement.setStale()),o||a)for(let l of this._order){let u=this._layers[l];u.type==="symbol"&&this.placement.updateLayerOpacities(u,s[u.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ve.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}async getImages(e,t){let i=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let r=this.sourceCaches[t.source];return r&&r.setDependencies(t.tileID.key,t.type,t.icons),i}async getGlyphs(e,t){let i=await this.glyphManager.getGlyphs(t.stacks),r=this.sourceCaches[t.source];return r&&r.setDependencies(t.tileID.key,t.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),!(e&&this._validate(ht.glyphs,"glyphs",e,null,t))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,t,i={},r){this._checkLoaded();let n=[{id:e,url:t}],a=[...Sl(this.stylesheet.sprite),...n];this._validate(ht.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(n,!0,r))}removeSprite(e){this._checkLoaded();let t=Sl(this.stylesheet.sprite);if(!t.find(i=>i.id===e)){this.fire(new ne(new Error('Sprite "'.concat(e,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[e])for(let i of this._spritesImagesIds[e])this.imageManager.removeImage(i),this._changedImages[i]=!0;t.splice(t.findIndex(i=>i.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new $("data",{dataType:"style"}))}getSprite(){return Sl(this.stylesheet.sprite)}setSprite(e,t={},i){this._checkLoaded(),!(e&&this._validate(ht.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}},zR=it([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),BR=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,a,o,s,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==r.length;for(let h=0;!u&&h<r.length;h++)this.boundPaintVertexBuffers[h]!==r[h]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,n,a,o,s,l):(e.bindVertexArray.set(this.vao),o&&o.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(e,t,i,r,n,a,o,s){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,t.enableAttributes(h,e);for(let c of i)c.enableAttributes(h,e);a&&a.enableAttributes(h,e),o&&o.enableAttributes(h,e),s&&s.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,n);for(let c of i)c.bind(),c.setVertexAttribPointers(h,e,n);a&&(a.bind(),a.setVertexAttribPointers(h,e,n)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(h,e,n)),s&&(s.bind(),s.setVertexAttribPointers(h,e,n)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}},OR=(e,t)=>({u_depth:new le(e,t.u_depth),u_terrain:new le(e,t.u_terrain),u_terrain_dim:new Y(e,t.u_terrain_dim),u_terrain_matrix:new Yt(e,t.u_terrain_matrix),u_terrain_unpack:new Ur(e,t.u_terrain_unpack),u_terrain_exaggeration:new Y(e,t.u_terrain_exaggeration)}),FR=(e,t)=>({u_texture:new le(e,t.u_texture),u_ele_delta:new Y(e,t.u_ele_delta),u_fog_matrix:new Yt(e,t.u_fog_matrix),u_fog_color:new Gr(e,t.u_fog_color),u_fog_ground_blend:new Y(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new Y(e,t.u_fog_ground_blend_opacity),u_horizon_color:new Gr(e,t.u_horizon_color),u_horizon_fog_blend:new Y(e,t.u_horizon_fog_blend),u_is_globe_mode:new Y(e,t.u_is_globe_mode)}),NR=(e,t)=>({u_ele_delta:new Y(e,t.u_ele_delta)}),VR=(e,t)=>({u_texture:new le(e,t.u_texture),u_terrain_coords_id:new Y(e,t.u_terrain_coords_id),u_ele_delta:new Y(e,t.u_ele_delta)}),jR=(e,t,i,r,n)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:i?i.properties.get("fog-color"):te.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:i?i.calculateFogBlendOpacity(r):0,u_horizon_color:i?i.properties.get("horizon-color"):te.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:n?1:0}),UR=e=>({u_ele_delta:e}),GR=(e,t)=>({u_terrain_coords_id:e/255,u_texture:0,u_ele_delta:t}),XR=(e,t)=>({u_projection_matrix:new Yt(e,t.u_projection_matrix),u_projection_tile_mercator_coords:new Ur(e,t.u_projection_tile_mercator_coords),u_projection_clipping_plane:new Ur(e,t.u_projection_clipping_plane),u_projection_transition:new Y(e,t.u_projection_transition),u_projection_fallback_matrix:new Yt(e,t.u_projection_fallback_matrix)}),qR={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function sl(e){let t=[];for(let i=0;i<e.length;i++){if(e[i]===null)continue;let r=e[i].split(" ");t.push(r.pop())}return t}var $R=class{constructor(e,t,i,r,n,a,o,s,l=[]){let u=e.gl;this.program=u.createProgram();let h=sl(t.staticAttributes),c=i?i.getBinderAttributes():[],p=h.concat(c),d=Ui.prelude.staticUniforms?sl(Ui.prelude.staticUniforms):[],f=o.staticUniforms?sl(o.staticUniforms):[],y=t.staticUniforms?sl(t.staticUniforms):[],g=i?i.getBinderUniforms():[],_=d.concat(f).concat(y).concat(g),b=[];for(let L of _)b.indexOf(L)<0&&b.push(L);let v=i?i.defines():[];cr(u)&&v.unshift("#version 300 es"),n&&v.push("#define OVERDRAW_INSPECTOR;"),a&&v.push("#define TERRAIN3D;"),s&&v.push(s),l&&v.push(...l);let w=v.concat(Ui.prelude.fragmentSource,o.fragmentSource,t.fragmentSource).join("\n"),T=v.concat(Ui.prelude.vertexSource,o.vertexSource,t.vertexSource).join("\n");cr(u)||(w=lR(w),T=sR(T));let S=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(u.getShaderInfoLog(S)));u.attachShader(this.program,S);let M=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(M,T),u.compileShader(M),!u.getShaderParameter(M,u.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(u.getShaderInfoLog(M)));u.attachShader(this.program,M),this.attributes={};let E={};this.numAttributes=p.length;for(let L=0;L<this.numAttributes;L++)p[L]&&(u.bindAttribLocation(this.program,L,p[L]),this.attributes[p[L]]=L);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error("Program failed to link: ".concat(u.getProgramInfoLog(this.program)));u.deleteShader(M),u.deleteShader(S);for(let L=0;L<b.length;L++){let z=b[L];if(z&&!E[z]){let R=u.getUniformLocation(this.program,z);R&&(E[z]=R)}}this.fixedUniforms=r(e,E),this.terrainUniforms=OR(e,E),this.projectionUniforms=XR(e,E),this.binderUniforms=i?i.getUniforms(e,E):[]}draw(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(a),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(let T in this.terrainUniforms)this.terrainUniforms[T].set(s[T])}if(l)for(let T in l){let S=qR[T];this.projectionUniforms[S].set(l[T])}if(o)for(let T in this.fixedUniforms)this.fixedUniforms[T].set(o[T]);y&&y.setUniforms(e,this.binderUniforms,d,{zoom:f});let w=0;switch(t){case v.LINES:w=2;break;case v.TRIANGLES:w=3;break;case v.LINE_STRIP:w=1;break}for(let T of p.get()){let S=T.vaos||(T.vaos={});(S[u]||(S[u]=new BR)).bind(e,this,h,y?y.getPaintVertexBuffers():[],c,T.vertexOffset,g,_,b),v.drawElements(t,T.primitiveLength*w,v.UNSIGNED_SHORT,T.primitiveOffset*w*2)}}};function kv(e,t,i){let r=1/$t(i,1,t.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,t.transform.tileZoom)/n,o=a*(i.tileID.canonical.x+i.tileID.wrap*n),s=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[o&65535,s&65535]}}function YR(e,t,i,r){let n=i.imageManager.getPattern(e.from.toString()),a=i.imageManager.getPattern(e.to.toString()),{width:o,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=u*(r.tileID.canonical.x+r.tileID.wrap*l),c=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/$t(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}var ZR=(e,t)=>({u_lightpos:new qt(e,t.u_lightpos),u_lightpos_globe:new qt(e,t.u_lightpos_globe),u_lightintensity:new Y(e,t.u_lightintensity),u_lightcolor:new qt(e,t.u_lightcolor),u_vertical_gradient:new Y(e,t.u_vertical_gradient),u_opacity:new Y(e,t.u_opacity),u_fill_translate:new ae(e,t.u_fill_translate)}),WR=(e,t)=>({u_lightpos:new qt(e,t.u_lightpos),u_lightpos_globe:new qt(e,t.u_lightpos_globe),u_lightintensity:new Y(e,t.u_lightintensity),u_lightcolor:new qt(e,t.u_lightcolor),u_vertical_gradient:new Y(e,t.u_vertical_gradient),u_height_factor:new Y(e,t.u_height_factor),u_opacity:new Y(e,t.u_opacity),u_fill_translate:new ae(e,t.u_fill_translate),u_image:new le(e,t.u_image),u_texsize:new ae(e,t.u_texsize),u_pixel_coord_upper:new ae(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ae(e,t.u_pixel_coord_lower),u_scale:new qt(e,t.u_scale),u_fade:new Y(e,t.u_fade)}),Dv=(e,t,i,r)=>{let n=e.style.light,a=n.properties.get("position"),o=[a.x,a.y,a.z],s=xo.create();n.properties.get("anchor")==="viewport"&&xo.fromRotation(s,e.transform.bearingInRadians),U.transformMat3(o,o,s);let l=e.transform.transformLightDirection(o),u=n.properties.get("color");return{u_lightpos:o,u_lightpos_globe:l,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+t,u_opacity:i,u_fill_translate:r}},HR=(e,t,i,r,n,a,o)=>K(Dv(e,t,i,r),kv(a,e,o),{u_height_factor:-Math.pow(2,n.overscaledZ)/o.tileSize/8}),KR=(e,t)=>({u_fill_translate:new ae(e,t.u_fill_translate)}),JR=(e,t)=>({u_image:new le(e,t.u_image),u_texsize:new ae(e,t.u_texsize),u_pixel_coord_upper:new ae(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ae(e,t.u_pixel_coord_lower),u_scale:new qt(e,t.u_scale),u_fade:new Y(e,t.u_fade),u_fill_translate:new ae(e,t.u_fill_translate)}),QR=(e,t)=>({u_world:new ae(e,t.u_world),u_fill_translate:new ae(e,t.u_fill_translate)}),ez=(e,t)=>({u_world:new ae(e,t.u_world),u_image:new le(e,t.u_image),u_texsize:new ae(e,t.u_texsize),u_pixel_coord_upper:new ae(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ae(e,t.u_pixel_coord_lower),u_scale:new qt(e,t.u_scale),u_fade:new Y(e,t.u_fade),u_fill_translate:new ae(e,t.u_fill_translate)}),Lv=(e,t,i,r)=>K(kv(t,e,i),{u_fill_translate:r}),tz=e=>({u_fill_translate:e}),iz=(e,t)=>({u_world:e,u_fill_translate:t}),rz=(e,t,i,r,n)=>K(Lv(e,t,i,n),{u_world:r}),nz=(e,t)=>({u_camera_to_center_distance:new Y(e,t.u_camera_to_center_distance),u_scale_with_map:new le(e,t.u_scale_with_map),u_pitch_with_map:new le(e,t.u_pitch_with_map),u_extrude_scale:new ae(e,t.u_extrude_scale),u_device_pixel_ratio:new Y(e,t.u_device_pixel_ratio),u_globe_extrude_scale:new Y(e,t.u_globe_extrude_scale),u_translate:new ae(e,t.u_translate)}),az=(e,t,i,r,n)=>{let a=e.transform,o,s,l=0;if(i.paint.get("circle-pitch-alignment")==="map"){let u=$t(t,1,a.zoom);o=!0,s=[u,u],l=u/(8192*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n}else o=!1,s=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+o,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:r}},oz=(e,t)=>({u_pixel_extrude_scale:new ae(e,t.u_pixel_extrude_scale)}),sz=(e,t)=>({u_viewport_size:new ae(e,t.u_viewport_size)}),lz=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),uz=e=>({u_viewport_size:[e.width,e.height]}),hz=(e,t)=>({u_color:new Gr(e,t.u_color),u_overlay:new le(e,t.u_overlay),u_overlay_scale:new Y(e,t.u_overlay_scale)}),ug=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),cz=(e,t)=>({u_extrude_scale:new Y(e,t.u_extrude_scale),u_intensity:new Y(e,t.u_intensity),u_globe_extrude_scale:new Y(e,t.u_globe_extrude_scale)}),pz=(e,t)=>({u_matrix:new Yt(e,t.u_matrix),u_world:new ae(e,t.u_world),u_image:new le(e,t.u_image),u_color_ramp:new le(e,t.u_color_ramp),u_opacity:new Y(e,t.u_opacity)}),Rv=(e,t,i,r)=>{let n=$t(e,1,t)/(8192*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*r;return{u_extrude_scale:$t(e,1,t),u_intensity:i,u_globe_extrude_scale:n}},zv=(e,t,i,r)=>{let n=V.create();V.ortho(n,0,e.width,e.height,0,0,1);let a=e.context.gl;return{u_matrix:n,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:i,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},dz=(e,t)=>({u_image:new le(e,t.u_image),u_latrange:new ae(e,t.u_latrange),u_exaggeration:new Y(e,t.u_exaggeration),u_altitudes:new Qm(e,t.u_altitudes),u_azimuths:new Qm(e,t.u_azimuths),u_accent:new Gr(e,t.u_accent),u_method:new le(e,t.u_method),u_shadows:new Jm(e,t.u_shadows),u_highlights:new Jm(e,t.u_highlights)}),fz=(e,t)=>({u_matrix:new Yt(e,t.u_matrix),u_image:new le(e,t.u_image),u_dimension:new ae(e,t.u_dimension),u_zoom:new Y(e,t.u_zoom),u_unpack:new Ur(e,t.u_unpack)}),mz=(e,t,i)=>{let r=i.paint.get("hillshade-accent-color"),n;switch(i.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0;break}let a=i.getIlluminationProperties();for(let o=0;o<a.directionRadians.length;o++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(a.directionRadians[o]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:gz(e,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:r,u_method:n,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},yz=(e,t)=>{let i=t.stride,r=V.create();return V.ortho(r,0,8192,-8192,0,0,1),V.translate(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function gz(e,t){let i=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new Ue(0,r/i).toLngLat().lat,new Ue(0,(r+1)/i).toLngLat().lat]}var _z=(e,t)=>({u_image:new le(e,t.u_image),u_unpack:new Ur(e,t.u_unpack),u_dimension:new ae(e,t.u_dimension),u_elevation_stops:new le(e,t.u_elevation_stops),u_color_stops:new le(e,t.u_color_stops),u_opacity:new Y(e,t.u_opacity)}),xz=(e,t)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:e.paint.get("color-relief-opacity")}),vz=(e,t)=>({u_translation:new ae(e,t.u_translation),u_ratio:new Y(e,t.u_ratio),u_device_pixel_ratio:new Y(e,t.u_device_pixel_ratio),u_units_to_pixels:new ae(e,t.u_units_to_pixels)}),bz=(e,t)=>({u_translation:new ae(e,t.u_translation),u_ratio:new Y(e,t.u_ratio),u_device_pixel_ratio:new Y(e,t.u_device_pixel_ratio),u_units_to_pixels:new ae(e,t.u_units_to_pixels),u_image:new le(e,t.u_image),u_image_height:new Y(e,t.u_image_height)}),wz=(e,t)=>({u_translation:new ae(e,t.u_translation),u_texsize:new ae(e,t.u_texsize),u_ratio:new Y(e,t.u_ratio),u_device_pixel_ratio:new Y(e,t.u_device_pixel_ratio),u_image:new le(e,t.u_image),u_units_to_pixels:new ae(e,t.u_units_to_pixels),u_scale:new qt(e,t.u_scale),u_fade:new Y(e,t.u_fade)}),Pz=(e,t)=>({u_translation:new ae(e,t.u_translation),u_ratio:new Y(e,t.u_ratio),u_device_pixel_ratio:new Y(e,t.u_device_pixel_ratio),u_units_to_pixels:new ae(e,t.u_units_to_pixels),u_patternscale_a:new ae(e,t.u_patternscale_a),u_patternscale_b:new ae(e,t.u_patternscale_b),u_sdfgamma:new Y(e,t.u_sdfgamma),u_image:new le(e,t.u_image),u_tex_y_a:new Y(e,t.u_tex_y_a),u_tex_y_b:new Y(e,t.u_tex_y_b),u_mix:new Y(e,t.u_mix)}),Ad=(e,t,i,r)=>{let n=e.transform;return{u_translation:Ov(e,t,i),u_ratio:r/$t(t,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Tz=(e,t,i,r,n)=>K(Ad(e,t,i,r),{u_image:0,u_image_height:n}),Sz=(e,t,i,r,n)=>{let a=e.transform,o=Bv(t,a);return{u_translation:Ov(e,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:r/$t(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Cz=(e,t,i,r,n,a)=>{let o=e.transform,s=e.lineAtlas,l=Bv(t,o),u=i.layout.get("line-cap")==="round",h=s.getDash(n.from,u),c=s.getDash(n.to,u),p=h.width*a.fromScale,d=c.width*a.toScale;return K(Ad(e,t,i,r),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-c.height/2],u_sdfgamma:s.width/(Math.min(p,d)*256*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:c.y,u_mix:a.t})};function Bv(e,t){return 1/$t(e,1,t.tileZoom)}function Ov(e,t,i){return Vr(e.transform,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}var Mz=(e,t)=>({u_tl_parent:new ae(e,t.u_tl_parent),u_scale_parent:new Y(e,t.u_scale_parent),u_buffer_scale:new Y(e,t.u_buffer_scale),u_fade_t:new Y(e,t.u_fade_t),u_opacity:new Y(e,t.u_opacity),u_image0:new le(e,t.u_image0),u_image1:new le(e,t.u_image1),u_brightness_low:new Y(e,t.u_brightness_low),u_brightness_high:new Y(e,t.u_brightness_high),u_saturation_factor:new Y(e,t.u_saturation_factor),u_contrast_factor:new Y(e,t.u_contrast_factor),u_spin_weights:new qt(e,t.u_spin_weights),u_coords_top:new Ur(e,t.u_coords_top),u_coords_bottom:new Ur(e,t.u_coords_bottom)}),Iz=(e,t,i,r,n)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:kz(r.paint.get("raster-saturation")),u_contrast_factor:Az(r.paint.get("raster-contrast")),u_spin_weights:Ez(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]});function Ez(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function Az(e){return e>0?1/(1-e):1+e}function kz(e){return e>0?1-1/(1.001-e):-e}var Dz=(e,t)=>({u_is_size_zoom_constant:new le(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new le(e,t.u_is_size_feature_constant),u_size_t:new Y(e,t.u_size_t),u_size:new Y(e,t.u_size),u_camera_to_center_distance:new Y(e,t.u_camera_to_center_distance),u_pitch:new Y(e,t.u_pitch),u_rotate_symbol:new le(e,t.u_rotate_symbol),u_aspect_ratio:new Y(e,t.u_aspect_ratio),u_fade_change:new Y(e,t.u_fade_change),u_label_plane_matrix:new Yt(e,t.u_label_plane_matrix),u_coord_matrix:new Yt(e,t.u_coord_matrix),u_is_text:new le(e,t.u_is_text),u_pitch_with_map:new le(e,t.u_pitch_with_map),u_is_along_line:new le(e,t.u_is_along_line),u_is_variable_anchor:new le(e,t.u_is_variable_anchor),u_texsize:new ae(e,t.u_texsize),u_texture:new le(e,t.u_texture),u_translation:new ae(e,t.u_translation),u_pitched_scale:new Y(e,t.u_pitched_scale)}),Lz=(e,t)=>({u_is_size_zoom_constant:new le(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new le(e,t.u_is_size_feature_constant),u_size_t:new Y(e,t.u_size_t),u_size:new Y(e,t.u_size),u_camera_to_center_distance:new Y(e,t.u_camera_to_center_distance),u_pitch:new Y(e,t.u_pitch),u_rotate_symbol:new le(e,t.u_rotate_symbol),u_aspect_ratio:new Y(e,t.u_aspect_ratio),u_fade_change:new Y(e,t.u_fade_change),u_label_plane_matrix:new Yt(e,t.u_label_plane_matrix),u_coord_matrix:new Yt(e,t.u_coord_matrix),u_is_text:new le(e,t.u_is_text),u_pitch_with_map:new le(e,t.u_pitch_with_map),u_is_along_line:new le(e,t.u_is_along_line),u_is_variable_anchor:new le(e,t.u_is_variable_anchor),u_texsize:new ae(e,t.u_texsize),u_texture:new le(e,t.u_texture),u_gamma_scale:new Y(e,t.u_gamma_scale),u_device_pixel_ratio:new Y(e,t.u_device_pixel_ratio),u_is_halo:new le(e,t.u_is_halo),u_translation:new ae(e,t.u_translation),u_pitched_scale:new Y(e,t.u_pitched_scale)}),Rz=(e,t)=>({u_is_size_zoom_constant:new le(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new le(e,t.u_is_size_feature_constant),u_size_t:new Y(e,t.u_size_t),u_size:new Y(e,t.u_size),u_camera_to_center_distance:new Y(e,t.u_camera_to_center_distance),u_pitch:new Y(e,t.u_pitch),u_rotate_symbol:new le(e,t.u_rotate_symbol),u_aspect_ratio:new Y(e,t.u_aspect_ratio),u_fade_change:new Y(e,t.u_fade_change),u_label_plane_matrix:new Yt(e,t.u_label_plane_matrix),u_coord_matrix:new Yt(e,t.u_coord_matrix),u_is_text:new le(e,t.u_is_text),u_pitch_with_map:new le(e,t.u_pitch_with_map),u_is_along_line:new le(e,t.u_is_along_line),u_is_variable_anchor:new le(e,t.u_is_variable_anchor),u_texsize:new ae(e,t.u_texsize),u_texsize_icon:new ae(e,t.u_texsize_icon),u_texture:new le(e,t.u_texture),u_texture_icon:new le(e,t.u_texture_icon),u_gamma_scale:new Y(e,t.u_gamma_scale),u_device_pixel_ratio:new Y(e,t.u_device_pixel_ratio),u_is_halo:new le(e,t.u_is_halo),u_translation:new ae(e,t.u_translation),u_pitched_scale:new Y(e,t.u_pitched_scale)}),Fv=(e,t,i,r,n,a,o,s,l,u,h,c,p)=>{let d=o.transform;return{u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:d.width/d.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:a,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:p}},Nv=(e,t,i,r,n,a,o,s,l,u,h,c,p,d)=>{let f=o.transform;return K(Fv(e,t,i,r,n,a,o,s,l,u,h,c,d),{u_gamma_scale:r?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+p})},zz=(e,t,i,r,n,a,o,s,l,u,h,c,p)=>K(Nv(e,t,i,r,n,a,o,s,l,u,!0,h,!0,p),{u_texsize_icon:c,u_texture_icon:1}),Bz=(e,t)=>({u_opacity:new Y(e,t.u_opacity),u_color:new Gr(e,t.u_color)}),Oz=(e,t)=>({u_opacity:new Y(e,t.u_opacity),u_image:new le(e,t.u_image),u_pattern_tl_a:new ae(e,t.u_pattern_tl_a),u_pattern_br_a:new ae(e,t.u_pattern_br_a),u_pattern_tl_b:new ae(e,t.u_pattern_tl_b),u_pattern_br_b:new ae(e,t.u_pattern_br_b),u_texsize:new ae(e,t.u_texsize),u_mix:new Y(e,t.u_mix),u_pattern_size_a:new ae(e,t.u_pattern_size_a),u_pattern_size_b:new ae(e,t.u_pattern_size_b),u_scale_a:new Y(e,t.u_scale_a),u_scale_b:new Y(e,t.u_scale_b),u_pixel_coord_upper:new ae(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ae(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new Y(e,t.u_tile_units_to_pixels)}),Fz=(e,t)=>({u_opacity:e,u_color:t}),Nz=(e,t,i,r,n)=>K(YR(i,n,t,r),{u_opacity:e}),Vz=(e,t)=>({u_sun_pos:new qt(e,t.u_sun_pos),u_atmosphere_blend:new Y(e,t.u_atmosphere_blend),u_globe_position:new qt(e,t.u_globe_position),u_globe_radius:new Y(e,t.u_globe_radius),u_inv_proj_matrix:new Yt(e,t.u_inv_proj_matrix)}),jz=(e,t,i,r,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}),Uz=(e,t)=>({u_sky_color:new Gr(e,t.u_sky_color),u_horizon_color:new Gr(e,t.u_horizon_color),u_horizon:new ae(e,t.u_horizon),u_horizon_normal:new ae(e,t.u_horizon_normal),u_sky_horizon_blend:new Y(e,t.u_sky_horizon_blend),u_sky_blend:new Y(e,t.u_sky_blend)}),Gz=(e,t,i)=>{let r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),a=Cl(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-a*n)*i,(t.height/2+a*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:o}},hg=(e,t)=>{},Xz={fillExtrusion:ZR,fillExtrusionPattern:WR,fill:KR,fillPattern:JR,fillOutline:QR,fillOutlinePattern:ez,circle:nz,collisionBox:oz,collisionCircle:sz,debug:hz,depth:hg,clippingMask:hg,heatmap:cz,heatmapTexture:pz,hillshade:dz,hillshadePrepare:fz,colorRelief:_z,line:vz,lineGradient:bz,linePattern:wz,lineSDF:Pz,raster:Mz,symbolIcon:Dz,symbolSDF:Lz,symbolTextAndIcon:Rz,background:Bz,backgroundPattern:Oz,terrain:FR,terrainDepth:NR,terrainCoords:VR,projectionErrorMeasurement:gR,atmosphere:Vz,sky:Uz},qz=class{constructor(e,t,i){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},$z={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Yz=class{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error("Length of new data is ".concat(e.length,", which doesn't match current length of ").concat(this.length));let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],n=t.attributes[r.name];n!==void 0&&e.enableVertexAttribArray(n)}}setVertexAttribPointers(e,t,i){for(let r=0;r<this.attributes.length;r++){let n=this.attributes[r],a=t.attributes[n.name];a!==void 0&&e.vertexAttribPointer(a,n.components,e[$z[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},De=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},Zz=class extends De{getDefault(){return te.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},Wz=class extends De{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},Hz=class extends De{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},Kz=class extends De{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},Jz=class extends De{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},Qz=class extends De{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},eB=class extends De{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},tB=class extends De{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},iB=class extends De{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},rB=class extends De{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},nB=class extends De{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},aB=class extends De{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},oB=class extends De{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},sB=class extends De{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},lB=class extends De{getDefault(){return te.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},uB=class extends De{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},hB=class extends De{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},cB=class extends De{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},pB=class extends De{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},dB=class extends De{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},fB=class extends De{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},mB=class extends De{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},yB=class extends De{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},gB=class extends De{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},_B=class extends De{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},xB=class extends De{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},vB=class extends De{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},bB=class extends De{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;let t=this.gl;cr(t)?t.bindVertexArray(e):(i=t.getExtension("OES_vertex_array_object"))==null||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},wB=class extends De{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},PB=class extends De{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},TB=class extends De{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},kd=class extends De{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},SB=class extends kd{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},CB=class extends kd{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},MB=class extends kd{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},Vv="Framebuffer is not complete";function IB(e){return e.message===Vv}function EB(){return new Error(Vv)}var AB=class{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new SB(e,o),r)this.depthAttachment=n?new MB(e,o):new CB(e,o);else if(n)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw EB()}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}},kB=class{constructor(e){var t,i;if(this.gl=e,this.clearColor=new Zz(this),this.clearDepth=new Wz(this),this.clearStencil=new Hz(this),this.colorMask=new Kz(this),this.depthMask=new Jz(this),this.stencilMask=new Qz(this),this.stencilFunc=new eB(this),this.stencilOp=new tB(this),this.stencilTest=new iB(this),this.depthRange=new rB(this),this.depthTest=new nB(this),this.depthFunc=new aB(this),this.blend=new oB(this),this.blendFunc=new sB(this),this.blendColor=new lB(this),this.blendEquation=new uB(this),this.cullFace=new hB(this),this.cullFaceSide=new cB(this),this.frontFace=new pB(this),this.program=new dB(this),this.activeTexture=new fB(this),this.viewport=new mB(this),this.bindFramebuffer=new yB(this),this.bindRenderbuffer=new gB(this),this.bindTexture=new _B(this),this.bindVertexBuffer=new xB(this),this.bindElementBuffer=new vB(this),this.bindVertexArray=new bB(this),this.pixelStoreUnpack=new wB(this),this.pixelStoreUnpackPremultiplyAlpha=new PB(this),this.pixelStoreUnpackFlipY=new TB(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),cr(e)){this.HALF_FLOAT=e.HALF_FLOAT;let r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(t=e.RGBA16F)!=null?t:r==null?void 0:r.RGBA16F_EXT,this.RGB16F=(i=e.RGB16F)!=null?i:r==null?void 0:r.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let r=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=r==null?void 0:r.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new qz(this,e,t)}createVertexBuffer(e,t,i){return new Yz(this,e,t,i)}createRenderbuffer(e,t,i){let r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new AB(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){let r=this.gl,n=0;e&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof i<"u"&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Oi(e.blendFunction,Ze.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return cr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return cr(this.gl)?this.gl.deleteVertexArray(e):(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}},Dd=se(ce(),1),ll;function cg(e,t,i,r,n){let a=e.context,o=e.transform,s=a.gl,l=e.useProgram("collisionBox"),u=[],h=0,c=0;for(let _=0;_<r.length;_++){let b=r[_],v=t.getTile(b).getBucket(i);if(!v)continue;let w=n?v.textCollisionBox:v.iconCollisionBox,T=v.collisionCircleArray;T.length>0&&(u.push({circleArray:T,circleOffset:c,coord:b}),h+=T.length/4,c=h),w&&l.draw(a,s.LINES,de.disabled,Ee.disabled,e.colorModeForRenderPass(),Ce.disabled,lz(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),o.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,e.transform.zoom,null,null,w.collisionVertexBuffer)}if(!n||!u.length)return;let p=e.useProgram("collisionCircle"),d=new RE;d.resize(h*4),d._trim();let f=0;for(let _ of u)for(let b=0;b<_.circleArray.length/4;b++){let v=b*4,w=_.circleArray[v+0],T=_.circleArray[v+1],S=_.circleArray[v+2],M=_.circleArray[v+3];d.emplace(f++,w,T,S,M,0),d.emplace(f++,w,T,S,M,1),d.emplace(f++,w,T,S,M,2),d.emplace(f++,w,T,S,M,3)}(!ll||ll.length<h*2)&&(ll=DB(h));let y=a.createIndexBuffer(ll,!0),g=a.createVertexBuffer(d,Ak.members,!0);for(let _ of u){let b=uz(e.transform);p.draw(a,s.TRIANGLES,de.disabled,Ee.disabled,e.colorModeForRenderPass(),Ce.disabled,b,e.style.map.terrain&&e.style.map.terrain.getTerrainData(_.coord),null,i.id,g,y,qe.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,e.transform.zoom,null,null,null)}g.destroy(),y.destroy()}function DB(e){let t=e*2,i=new BE;i.resize(t),i._trim();for(let r=0;r<t;r++){let n=r*6;i.uint16[n+0]=r*4+0,i.uint16[n+1]=r*4+1,i.uint16[n+2]=r*4+2,i.uint16[n+3]=r*4+2,i.uint16[n+4]=r*4+3,i.uint16[n+5]=r*4+0}return i}var LB=V.identity(new Float32Array(16));function RB(e,t,i,r,n,a){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:o}=a,s=Ee.disabled,l=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&BB(r,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),n),i.paint.get("icon-opacity").constantOr(1)!==0&&pg(e,t,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),s,l,o),i.paint.get("text-opacity").constantOr(1)!==0&&pg(e,t,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),s,l,o),t.map.showCollisionBoxes&&(cg(e,t,i,r,!0),cg(e,t,i,r,!1))}function zB(e,t,i,r,n,a){let{horizontalAlign:o,verticalAlign:s}=j0(e),l=-(o-.5)*t,u=-(s-.5)*i;return new Dd.default((l/n+r[0])*a,(u/n+r[1])*a)}function BB(e,t,i,r,n,a,o,s,l){let u=t.transform,h=t.style.map.terrain,c=n==="map",p=a==="map";for(let d of e){let f=r.getTile(d),y=f.getBucket(i);if(!y||!y.text||!y.text.segments.get().length)continue;let g=y.textSizeData,_=wu(g,u.zoom),b=$t(f,1,t.transform.zoom),v=Sd(c,t.transform,b),w=i.layout.get("icon-text-fit")!=="none"&&y.hasIconData();if(_){let T=Math.pow(2,u.zoom-f.tileID.overscaledZ),S=h?(E,L)=>h.getElevation(d,E,L):null,M=Vr(u,f,o,s);FB(y,c,p,l,u,v,T,_,w,M,d.toUnwrapped(),S)}}}function OB(e,t,i,r,n,a){let o=t.tileAnchorPoint.add(new Dd.default(t.translation[0],t.translation[1]));if(t.pitchWithMap){let s=r.mult(a);i||(s=s.rotate(-n));let l=o.add(s);return Md(l.x,l.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}else if(i){let s=bn(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),l=Math.atan(s.y/s.x)+(s.x<0?Math.PI:0);return e.add(r.rotate(l))}else return e.add(r)}function FB(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,y={};d.clear();for(let g=0;g<p.length;g++){let _=p.get(g),b=e.allowVerticalPlacement&&!_.placedOrientation,v=!_.hidden&&_.crossTileID&&!b?r[_.crossTileID]:null;if(!v)ha(_.numGlyphs,d);else{let w=new Dd.default(_.anchorX,_.anchorY),T={getElevation:c,width:n.width,height:n.height,pitchedLabelPlaneMatrix:a,lineVertexArray:null,pitchWithMap:i,transform:n,projectionCache:null,tileAnchorPoint:w,translation:u,unwrappedTileID:h},S=i?ov(w.x,w.y,T):bn(w.x,w.y,T),M=rv(n.cameraToCenterDistance,S.signedDistanceFromCamera),E=Td(e.textSizeData,s,_)*M/F0;i&&(E*=e.tilePixelRatio/o);let{width:L,height:z,anchor:R,textOffset:k,textBoxScale:D}=v,x=zB(R,L,z,k,D,E),C=n.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),I=OB(S.point,T,t,x,-n.bearingInRadians,C),F=e.allowVerticalPlacement&&_.placedOrientation===2?Math.PI/2:0;for(let N=0;N<_.numGlyphs;N++)Ro(d,I,F);l&&_.associatedIconIndex>=0&&(y[_.associatedIconIndex]={shiftedAnchor:I,angle:F})}}if(l){f.clear();let g=e.icon.placedSymbolArray;for(let _=0;_<g.length;_++){let b=g.get(_);if(b.hidden)ha(b.numGlyphs,f);else{let v=y[_];if(!v)ha(b.numGlyphs,f);else for(let w=0;w<b.numGlyphs;w++)Ro(f,v.shiftedAnchor,v.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function NB(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function pg(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=e.context,f=d.gl,y=e.transform,g=s==="map",_=l==="map",b=s!=="viewport"&&i.layout.get("symbol-placement")!=="point",v=g&&!_&&!b,w=!i.layout.get("symbol-sort-key").isConstant(),T=!1,S=e.getDepthModeForSublayer(0,de.ReadOnly),M=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],L=y.getCircleRadiusCorrection();for(let z of r){let R=t.getTile(z),k=R.getBucket(i);if(!k)continue;let D=n?k.text:k.icon;if(!D||!D.segments.get().length||!D.hasVisibleVertices)continue;let x=D.programConfigurations.get(i.id),C=n||k.sdfIcons,I=n?k.textSizeData:k.iconSizeData,F=_||y.pitch!==0,N=e.useProgram(NB(C,n,k),x),G=wu(I,y.zoom),J=e.style.map.terrain&&e.style.map.terrain.getTerrainData(z),ee,ke=[0,0],Ie,Be,Ne=null,bt;if(n){if(Ie=R.glyphAtlasTexture,Be=f.LINEAR,ee=R.glyphAtlasTexture.size,k.iconsInText){ke=R.imageAtlasTexture.size,Ne=R.imageAtlasTexture;let ti=I.kind==="composite"||I.kind==="camera";bt=F||e.options.rotating||e.options.zooming||ti?f.LINEAR:f.NEAREST}}else{let ti=i.layout.get("icon-size").constantOr(0)!==1||k.iconsNeedLinear;Ie=R.imageAtlasTexture,Be=C||e.options.rotating||e.options.zooming||ti||F?f.LINEAR:f.NEAREST,ee=R.imageAtlasTexture.size}let St=$t(R,1,e.transform.zoom),Jt=Sd(g,e.transform,St),Qt=V.create();V.invert(Qt,Jt);let Cr=x3(_,g,e.transform,St),Ct=Vr(y,R,a,o),Es=y.getProjectionData({overscaledTileID:z,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),Xn=M&&k.hasTextData(),tn=i.layout.get("icon-text-fit")!=="none"&&Xn&&k.hasIconData();if(b){let ti=e.style.map.terrain?(Mt,ii)=>e.style.map.terrain.getElevation(z,Mt,ii):null,gt=i.layout.get("text-rotation-alignment")==="map";b3(k,e,n,Jt,Qt,_,u,gt,z.toUnwrapped(),y.width,y.height,Ct,ti)}let er=n&&M||tn,rn=_?Jt:e.transform.clipSpaceToPixelsMatrix,tr=b||er?LB:rn,ei=C&&i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Vt;C?k.iconsInText?Vt=zz(I.kind,G,v,_,b,er,e,tr,Cr,Ct,ee,ke,L):Vt=Nv(I.kind,G,v,_,b,er,e,tr,Cr,Ct,n,ee,!0,L):Vt=Fv(I.kind,G,v,_,b,er,e,tr,Cr,Ct,n,ee,L);let nn={program:N,buffers:D,uniformValues:Vt,projectionData:Es,atlasTexture:Ie,atlasTextureIcon:Ne,atlasInterpolation:Be,atlasInterpolationIcon:bt,isSDF:C,hasHalo:ei};if(w&&k.canOverlap){T=!0;let ti=D.segments.get();for(let gt of ti)E.push({segments:new qe([gt]),sortKey:gt.sortKey,state:nn,terrainData:J})}else E.push({segments:D.segments,sortKey:0,state:nn,terrainData:J})}T&&E.sort((z,R)=>z.sortKey-R.sortKey);for(let z of E){let R=z.state;if(d.activeTexture.set(f.TEXTURE0),R.atlasTexture.bind(R.atlasInterpolation,f.CLAMP_TO_EDGE),R.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),R.atlasTextureIcon&&R.atlasTextureIcon.bind(R.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),R.isSDF){let k=R.uniformValues;R.hasHalo&&(k.u_is_halo=1,dg(R.buffers,z.segments,i,e,R.program,S,h,c,k,R.projectionData,z.terrainData)),k.u_is_halo=0}dg(R.buffers,z.segments,i,e,R.program,S,h,c,R.uniformValues,R.projectionData,z.terrainData)}}function dg(e,t,i,r,n,a,o,s,l,u,h){let c=r.context,p=c.gl;n.draw(c,p.TRIANGLES,a,o,s,Ce.backCCW,l,h,u,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function VB(e,t,i,r,n){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=i.paint.get("circle-opacity"),s=i.paint.get("circle-stroke-width"),l=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(o.constantOr(1)===0&&(s.constantOr(1)===0||l.constantOr(1)===0))return;let h=e.context,c=h.gl,p=e.transform,d=e.getDepthModeForSublayer(0,de.ReadOnly),f=Ee.disabled,y=e.colorModeForRenderPass(),g=[],_=p.getCircleRadiusCorrection();for(let b=0;b<r.length;b++){let v=r[b],w=t.getTile(v),T=w.getBucket(i);if(!T)continue;let S=i.paint.get("circle-translate"),M=i.paint.get("circle-translate-anchor"),E=Vr(p,w,S,M),L=T.programConfigurations.get(i.id),z=e.useProgram("circle",L),R=T.layoutVertexBuffer,k=T.indexBuffer,D=e.style.map.terrain&&e.style.map.terrain.getTerrainData(v),x=az(e,w,i,E,_),C=p.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),I={programConfiguration:L,program:z,layoutVertexBuffer:R,indexBuffer:k,uniformValues:x,terrainData:D,projectionData:C};if(u){let F=T.segments.get();for(let N of F)g.push({segments:new qe([N]),sortKey:N.sortKey,state:I})}else g.push({segments:T.segments,sortKey:0,state:I})}u&&g.sort((b,v)=>b.sortKey-v.sortKey);for(let b of g){let{programConfiguration:v,program:w,layoutVertexBuffer:T,indexBuffer:S,uniformValues:M,terrainData:E,projectionData:L}=b.state,z=b.segments;w.draw(h,c.TRIANGLES,d,f,y,Ce.backCCW,M,E,L,i.id,T,S,z,i.paint,e.transform.zoom,v)}}function jB(e,t,i,r,n){if(i.paint.get("heatmap-opacity")===0)return;let a=e.context,{isRenderingToTexture:o,isRenderingGlobe:s}=n;if(e.style.map.terrain){for(let l of r){let u=t.getTile(l);t.hasRenderableParent(l)||(e.renderPass==="offscreen"?XB(e,u,i,l,s):e.renderPass==="translucent"&&qB(e,i,l,o,s))}a.viewport.set([0,0,e.width,e.height])}else e.renderPass==="offscreen"?UB(e,t,i,r):e.renderPass==="translucent"&&GB(e,i)}function UB(e,t,i,r){let n=e.context,a=n.gl,o=e.transform,s=Ee.disabled,l=new Ze([a.ONE,a.ONE],te.transparent,[!0,!0,!0,!0]);$B(n,e,i),n.clear({color:te.transparent});for(let u=0;u<r.length;u++){let h=r[u];if(t.hasRenderableParent(h))continue;let c=t.getTile(h),p=c.getBucket(i);if(!p)continue;let d=p.programConfigurations.get(i.id),f=e.useProgram("heatmap",d),y=o.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=o.getCircleRadiusCorrection();f.draw(n,a.TRIANGLES,de.disabled,s,l,Ce.backCCW,Rv(c,o.zoom,i.paint.get("heatmap-intensity"),g),null,y,i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,i.paint,o.zoom,d)}n.viewport.set([0,0,e.width,e.height])}function GB(e,t){let i=e.context,r=i.gl;i.setColorMode(e.colorModeForRenderPass());let n=t.heatmapFbos.get(Ao);n&&(i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),i.activeTexture.set(r.TEXTURE1),Uv(i,t).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,r.TRIANGLES,de.disabled,Ee.disabled,e.colorModeForRenderPass(),Ce.disabled,zv(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function XB(e,t,i,r,n){let a=e.context,o=a.gl,s=Ee.disabled,l=new Ze([o.ONE,o.ONE],te.transparent,[!0,!0,!0,!0]),u=t.getBucket(i);if(!u)return;let h=r.key,c=i.heatmapFbos.get(h);c||(c=jv(a,t.tileSize,t.tileSize),i.heatmapFbos.set(h,c)),a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,t.tileSize,t.tileSize]),a.clear({color:te.transparent});let p=u.programConfigurations.get(i.id),d=e.useProgram("heatmap",p,!n),f=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),y=e.style.map.terrain.getTerrainData(r);d.draw(a,o.TRIANGLES,de.disabled,s,l,Ce.disabled,Rv(t,e.transform.zoom,i.paint.get("heatmap-intensity"),1),y,f,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,e.transform.zoom,p)}function qB(e,t,i,r,n){let a=e.context,o=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let l=Uv(a,t),u=i.key,h=t.heatmapFbos.get(u);if(!h)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,h.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),l.bind(o.LINEAR,o.CLAMP_TO_EDGE);let c=s.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(a,o.TRIANGLES,de.disabled,Ee.disabled,e.colorModeForRenderPass(),Ce.disabled,zv(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),h.destroy(),t.heatmapFbos.delete(u)}function $B(e,t,i){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let n=i.heatmapFbos.get(Ao);n?(r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),e.bindFramebuffer.set(n.framebuffer)):(n=jv(e,t.width/4,t.height/4),i.heatmapFbos.set(Ao,n))}function jv(e,t,i){var l,u;let r=e.gl,n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);let a=(l=e.HALF_FLOAT)!=null?l:r.UNSIGNED_BYTE,o=(u=e.RGBA16F)!=null?u:r.RGBA;r.texImage2D(r.TEXTURE_2D,0,o,t,i,0,r.RGBA,a,null);let s=e.createFramebuffer(t,i,!1,!1);return s.colorAttachment.set(n),s}function Uv(e,t){return t.colorRampTexture||(t.colorRampTexture=new st(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function YB(e,t,i,r,n){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=i.paint.get("line-opacity"),s=i.paint.get("line-width");if(o.constantOr(1)===0||s.constantOr(1)===0)return;let l=e.getDepthModeForSublayer(0,de.ReadOnly),u=e.colorModeForRenderPass(),h=i.paint.get("line-dasharray"),c=i.paint.get("line-pattern"),p=c.constantOr(1),d=i.paint.get("line-gradient"),f=i.getCrossfadeParameters(),y=p?"linePattern":h?"lineSDF":d?"lineGradient":"line",g=e.context,_=g.gl,b=e.transform,v=!0;for(let w of r){let T=t.getTile(w);if(p&&!T.patternsLoaded())continue;let S=T.getBucket(i);if(!S)continue;let M=S.programConfigurations.get(i.id),E=e.context.program.get(),L=e.useProgram(y,M),z=v||L.program!==E,R=e.style.map.terrain&&e.style.map.terrain.getTerrainData(w),k=c.constantOr(null);if(k&&T.imageAtlas){let F=T.imageAtlas,N=F.patternPositions[k.to.toString()],G=F.patternPositions[k.from.toString()];N&&G&&M.setConstantPatternPositions(N,G)}let D=b.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),x=b.getPixelScale(),C=p?Sz(e,T,i,x,f):h?Cz(e,T,i,x,h,f):d?Tz(e,T,i,x,S.lineClipsArray.length):Ad(e,T,i,x);if(p)g.activeTexture.set(_.TEXTURE0),T.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),M.updatePaintBuffers(f);else if(h&&(z||e.lineAtlas.dirty))g.activeTexture.set(_.TEXTURE0),e.lineAtlas.bind(g);else if(d){let F=S.gradients[i.id],N=F.texture;if(i.gradientVersion!==F.version){let G=256;if(i.stepInterpolant){let J=t.getSource().maxzoom,ee=w.canonical.z===J?Math.ceil(1<<e.transform.maxZoom-w.canonical.z):1,ke=S.maxLineLength/8192*1024*ee;G=Ae(XS(ke),256,g.maxTextureSize)}F.gradient=C0({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:G,image:F.gradient||void 0,clips:S.lineClipsArray}),F.texture?F.texture.update(F.gradient):F.texture=new st(g,F.gradient,_.RGBA),F.version=i.gradientVersion,N=F.texture}g.activeTexture.set(_.TEXTURE0),N.bind(i.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}let I=e.stencilModeForClipping(w);L.draw(g,_.TRIANGLES,l,I,u,Ce.disabled,C,R,D,i.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,i.paint,e.transform.zoom,M,S.layoutVertexBuffer2),v=!1}}function Gv(e,t,i,r,n){if(!i||!r||!r.imageAtlas)return;let a=r.imageAtlas.patternPositions,o=a[i.to.toString()],s=a[i.from.toString()];if(!o&&s&&(o=s),!s&&o&&(s=o),!o||!s){let l=n.getPaintProperty(t);o=a[l],s=a[l]}o&&s&&e.setConstantPatternPositions(o,s)}function ZB(e,t,i,r,n){let a=i.paint.get("fill-color"),o=i.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let{isRenderingToTexture:s}=n,l=e.colorModeForRenderPass(),u=i.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&a.constantOr(te.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(e.renderPass===h){let c=e.getDepthModeForSublayer(1,e.renderPass==="opaque"?de.ReadWrite:de.ReadOnly);fg(e,t,i,r,c,l,!1,s)}if(e.renderPass==="translucent"&&i.paint.get("fill-antialias")){let c=e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,de.ReadOnly);fg(e,t,i,r,c,l,!0,s)}}function fg(e,t,i,r,n,a,o,s){let l=e.context.gl,u="fill-pattern",h=i.paint.get(u),c=h&&h.constantOr(1),p=i.getCrossfadeParameters(),d,f,y,g,_,b=e.transform,v=i.paint.get("fill-translate"),w=i.paint.get("fill-translate-anchor");o?(f=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(f=c?"fillPattern":"fill",d=l.TRIANGLES);let T=h.constantOr(null);for(let S of r){let M=t.getTile(S);if(c&&!M.patternsLoaded())continue;let E=M.getBucket(i);if(!E)continue;let L=E.programConfigurations.get(i.id),z=e.useProgram(f,L),R=e.style.map.terrain&&e.style.map.terrain.getTerrainData(S);c&&(e.context.activeTexture.set(l.TEXTURE0),M.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),L.updatePaintBuffers(p)),Gv(L,u,T,M,i);let k=b.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),D=Vr(b,M,v,w);if(!o)g=E.indexBuffer,_=E.segments,y=c?Lv(e,p,M,D):tz(D);else{g=E.indexBuffer2,_=E.segments2;let C=[l.drawingBufferWidth,l.drawingBufferHeight];y=f==="fillOutlinePattern"&&c?rz(e,p,M,C,D):iz(C,D)}let x=e.stencilModeForClipping(S);z.draw(e.context,d,n,x,a,Ce.backCCW,y,R,k,i.id,E.layoutVertexBuffer,g,_,i.paint,e.transform.zoom,L)}}function WB(e,t,i,r,n){let a=i.paint.get("fill-extrusion-opacity");if(a===0)return;let{isRenderingToTexture:o}=n;if(e.renderPass==="translucent"){let s=new de(e.context.gl.LEQUAL,de.ReadWrite,e.depthRangeFor3D);if(a===1&&!i.paint.get("fill-extrusion-pattern").constantOr(1)){let l=e.colorModeForRenderPass();uc(e,t,i,r,s,Ee.disabled,l,o)}else uc(e,t,i,r,s,Ee.disabled,Ze.disabled,o),uc(e,t,i,r,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),o)}}function uc(e,t,i,r,n,a,o,s){let l=e.context,u=l.gl,h="fill-extrusion-pattern",c=i.paint.get(h),p=c.constantOr(1),d=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity"),y=c.constantOr(null),g=e.transform;for(let _ of r){let b=t.getTile(_),v=b.getBucket(i);if(!v)continue;let w=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_),T=v.programConfigurations.get(i.id),S=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",T);p&&(e.context.activeTexture.set(u.TEXTURE0),b.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),T.updatePaintBuffers(d));let M=g.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!s,applyTerrainMatrix:!0});Gv(T,h,y,b,i);let E=Vr(g,b,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),L=i.paint.get("fill-extrusion-vertical-gradient"),z=p?HR(e,L,f,E,_,d,b):Dv(e,L,f,E);S.draw(l,l.gl.TRIANGLES,n,a,o,Ce.backCCW,z,w,M,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,e.transform.zoom,T,e.style.map.terrain&&v.centroidVertexBuffer)}}function HB(e,t,i,r,n){if(e.renderPass!=="offscreen"&&e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=e.context,s=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,de.ReadOnly),u=e.colorModeForRenderPass();if(e.renderPass==="offscreen")KB(e,t,r,i,l,Ee.disabled,u),o.viewport.set([0,0,e.width,e.height]);else if(e.renderPass==="translucent")if(s){let[h,c,p]=e.stencilConfigForOverlapTwoPass(r);hc(e,t,i,p,h,l,u,!1,a),hc(e,t,i,p,c,l,u,!0,a)}else{let[h,c]=e.getStencilConfigForOverlapAndUpdateStencilID(r);hc(e,t,i,c,h,l,u,!1,a)}}function hc(e,t,i,r,n,a,o,s,l){var g;let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=["#define NUM_ILLUMINATION_SOURCES ".concat(i.paint.get("hillshade-highlight-color").values.length)],f=e.useProgram("hillshade",null,!1,d),y=!e.options.moving;for(let _ of r){let b=t.getTile(_),v=b.fbo;if(!v)continue;let w=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),T=(g=e.style.map.terrain)==null?void 0:g.getTerrainData(_);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,v.colorAttachment.get());let S=c.getProjectionData({overscaledTileID:_,aligned:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(h,p.TRIANGLES,a,n[_.overscaledZ],o,Ce.backCCW,mz(e,b,i),T,S,i.id,w.vertexBuffer,w.indexBuffer,w.segments)}}function KB(e,t,i,r,n,a,o){let s=e.context,l=s.gl;for(let u of i){let h=t.getTile(u),c=h.dem;if(!c||!c.data||!h.needsHillshadePrepare)continue;let p=c.dim,d=c.stride,f=c.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),h.demTexture=h.demTexture||e.getTileTexture(d),h.demTexture){let g=h.demTexture;g.update(f,{premultiply:!1}),g.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else h.demTexture=new st(s,f,l.RGBA,{premultiply:!1}),h.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let y=h.fbo;if(!y){let g=new st(s,{width:p,height:p,data:null},l.RGBA);g.bind(l.LINEAR,l.CLAMP_TO_EDGE),y=h.fbo=s.createFramebuffer(p,p,!0,!1),y.colorAttachment.set(g.texture)}s.bindFramebuffer.set(y.framebuffer),s.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,Ce.disabled,yz(h.tileID,c),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),h.needsHillshadePrepare=!1}}function JB(e,t,i,r,n){if(e.renderPass!=="translucent"||!r.length)return;let{isRenderingToTexture:a}=n,o=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,de.ReadOnly),l=e.colorModeForRenderPass();if(o){let[u,h,c]=e.stencilConfigForOverlapTwoPass(r);cc(e,t,i,c,u,s,l,!1,a),cc(e,t,i,c,h,s,l,!0,a)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(r);cc(e,t,i,h,u,s,l,!1,a)}}function cc(e,t,i,r,n,a,o,s,l){var g;let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=e.useProgram("colorRelief"),f=!e.options.moving,y=!0;for(let _ of r){let b=t.getTile(_),v=b.dem;if(y){let L=p.getParameter(p.MAX_TEXTURE_SIZE),{elevationTexture:z,colorTexture:R}=i.getColorRampTextures(h,L,v.getUnpackVector());h.activeTexture.set(p.TEXTURE1),z.bind(p.NEAREST,p.CLAMP_TO_EDGE),h.activeTexture.set(p.TEXTURE4),R.bind(p.LINEAR,p.CLAMP_TO_EDGE),y=!1}if(!v||!v.data)continue;let w=v.stride,T=v.getPixels();if(h.activeTexture.set(p.TEXTURE0),h.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture=b.demTexture||e.getTileTexture(w),b.demTexture){let L=b.demTexture;L.update(T,{premultiply:!1}),L.bind(p.LINEAR,p.CLAMP_TO_EDGE)}else b.demTexture=new st(h,T,p.RGBA,{premultiply:!1}),b.demTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE);let S=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),M=(g=e.style.map.terrain)==null?void 0:g.getTerrainData(_),E=c.getProjectionData({overscaledTileID:_,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});d.draw(h,p.TRIANGLES,a,n[_.overscaledZ],o,Ce.backCCW,xz(i,b.dem),M,E,i.id,S.vertexBuffer,S.indexBuffer,S.segments)}}var ul=se(ce(),1),pc=[new ul.default(0,0),new ul.default(8192,0),new ul.default(8192,8192),new ul.default(0,8192)];function QB(e,t,i,r,n){if(e.renderPass!=="translucent"||i.paint.get("raster-opacity")===0||!r.length)return;let{isRenderingToTexture:a}=n,o=t.getSource(),s=e.style.projection.useSubdivision;if(o instanceof $o)hl(e,t,i,r,null,!1,!1,o.tileCoords,o.flippedWindingOrder,a);else if(s){let[l,u,h]=e.stencilConfigForOverlapTwoPass(r);hl(e,t,i,h,l,!1,!0,pc,!1,a),hl(e,t,i,h,u,!0,!0,pc,!1,a)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(r);hl(e,t,i,u,l,!1,!0,pc,!1,a)}}function hl(e,t,i,r,n,a,o,s,l=!1,u=!1){let h=r[r.length-1].overscaledZ,c=e.context,p=c.gl,d=e.useProgram("raster"),f=e.transform,y=e.style.projection,g=e.colorModeForRenderPass(),_=!e.options.moving;for(let b of r){let v=e.getDepthModeForSublayer(b.overscaledZ-h,i.paint.get("raster-opacity")===1?de.ReadWrite:de.ReadOnly,p.LESS),w=t.getTile(b);w.registerFadeDuration(i.paint.get("raster-fade-duration"));let T=t.findLoadedParent(b,0),S=t.findLoadedSibling(b),M=eO(w,T||S||null,t,i,e.transform,e.style.map.terrain),E,L,z=i.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;c.activeTexture.set(p.TEXTURE0),w.texture.bind(z,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),c.activeTexture.set(p.TEXTURE1),T?(T.texture.bind(z,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),E=Math.pow(2,T.tileID.overscaledZ-w.tileID.overscaledZ),L=[w.tileID.canonical.x*E%1,w.tileID.canonical.y*E%1]):w.texture.bind(z,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),w.texture.useMipmap&&c.extTextureFilterAnisotropic&&e.transform.pitch>20&&p.texParameterf(p.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax);let R=e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),k=f.getProjectionData({overscaledTileID:b,aligned:_,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),D=Iz(L||[0,0],E||1,M,i,s),x=y.getMeshFromTileID(c,b.canonical,a,o,"raster"),C=n?n[b.overscaledZ]:Ee.disabled;d.draw(c,p.TRIANGLES,v,C,g,l?Ce.frontCCW:Ce.backCCW,D,R,k,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}function eO(e,t,i,r,n,a){let o=r.paint.get("raster-fade-duration");if(!a&&o>0){let s=ve.now(),l=(s-e.timeAdded)/o,u=t?(s-t.timeAdded)/o:-1,h=i.getSource(),c=Tu(n,{tileSize:h.tileSize,roundZoom:h.roundZoom}),p=!t||Math.abs(t.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),d=p&&e.refreshedUponExpiration?1:Ae(p?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),t?{opacity:1,mix:1-d}:{opacity:d,mix:0}}else return{opacity:1,mix:0}}function tO(e,t,i,r,n){let a=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(o===0)return;let{isRenderingToTexture:s}=n,l=e.context,u=l.gl,h=e.style.projection,c=e.transform,p=c.tileSize,d=i.paint.get("background-pattern");if(e.isPatternMissing(d))return;let f=!d&&a.a===1&&o===1&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==f)return;let y=Ee.disabled,g=e.getDepthModeForSublayer(0,f==="opaque"?de.ReadWrite:de.ReadOnly),_=e.colorModeForRenderPass(),b=e.useProgram(d?"backgroundPattern":"background"),v=r||Su(c,{tileSize:p,terrain:e.style.map.terrain});d&&(l.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context));let w=i.getCrossfadeParameters();for(let T of v){let S=c.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),M=d?Nz(o,e,d,{tileID:T,tileSize:p},w):Fz(o,a),E=e.style.map.terrain&&e.style.map.terrain.getTerrainData(T),L=h.getMeshFromTileID(l,T.canonical,!1,!0,"raster");b.draw(l,u.TRIANGLES,g,y,_,Ce.backCCW,M,E,S,i.id,L.vertexBuffer,L.indexBuffer,L.segments)}}var iO=new te(1,0,0,1),rO=new te(0,1,0,1),nO=new te(0,0,1,1),aO=new te(1,0,1,1),oO=new te(0,1,1,1);function sO(e){let t=e.transform.padding,i=3;mg(e,e.transform.height-(t.top||0),i,iO),mg(e,t.bottom||0,i,rO),yg(e,t.left||0,i,nO),yg(e,e.transform.width-(t.right||0),i,aO);let r=e.transform.centerPoint;lO(e,r.x,e.transform.height-r.y,oO)}function lO(e,t,i,r){ql(e,t-2/2,i-20/2,2,20,r),ql(e,t-20/2,i-2/2,20,2,r)}function mg(e,t,i,r){ql(e,0,t+i/2,e.transform.width,i,r)}function yg(e,t,i,r){ql(e,t-i/2,0,i,e.transform.height,r)}function ql(e,t,i,r,n,a){let o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function uO(e,t,i){for(let r=0;r<i.length;r++)hO(e,t,i[r])}function hO(e,t,i){let r=e.context,n=r.gl,a=e.useProgram("debug"),o=de.disabled,s=Ee.disabled,l=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(i);r.activeTexture.set(n.TEXTURE0);let c=t.getTileByID(i.key).latestRawTileData,p=c&&c.byteLength||0,d=Math.floor(p/1024),f=t.getTile(i).tileSize,y=512/Math.min(f,512)*(i.overscaledZ/e.transform.zoom)*.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=" => ".concat(i.overscaledZ));let _="".concat(g," ").concat(d,"kB");cO(e,_);let b=e.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(r,n.TRIANGLES,o,s,Ze.alphaBlended,Ce.disabled,ug(te.transparent,y),null,b,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,n.LINE_STRIP,o,s,l,Ce.disabled,ug(te.red),h,b,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function cO(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function pO(e,t){let i=null,r=Object.values(e._layers).flatMap(s=>s.source&&!s.isHidden(t)?[e.sourceCaches[s.source]]:[]),n=r.filter(s=>s.getSource().type==="vector"),a=r.filter(s=>s.getSource().type!=="vector"),o=s=>{(!i||i.getSource().maxzoom<s.getSource().maxzoom)&&(i=s)};return n.forEach(s=>o(s)),i||a.forEach(s=>o(s)),i}function dO(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,o=i.implementation,s=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(n),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:"const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n".concat(s.shaderPreludeCode.vertexSource),define:s.shaderDefine},defaultProjectionData:u},c=o.renderingMode?o.renderingMode:"2d";if(e.renderPass==="offscreen"){let p=o.prerender;p&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),p.call(o,a.gl,h),a.setDirty(),e.setBaseState())}else if(e.renderPass==="translucent"){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(Ee.disabled);let p=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,de.ReadOnly);a.setDepthMode(p),o.render(a.gl,h),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}function fO(e,t){let i=e.context,r=i.gl,n=e.transform,a=Ze.unblended,o=new de(r.LEQUAL,de.ReadWrite,[0,1]),s=t.sourceCache.getRenderableTiles(),l=e.useProgram("terrainDepth");i.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:te.transparent,depth:1});for(let u of s){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),p=n.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=UR(t.getMeshFrameDelta(n.zoom));l.draw(i,r.TRIANGLES,o,Ee.disabled,a,Ce.backCCW,d,c,p,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function mO(e,t){let i=e.context,r=i.gl,n=e.transform,a=Ze.unblended,o=new de(r.LEQUAL,de.ReadWrite,[0,1]),s=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");i.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:te.transparent,depth:1}),t.coordsIndex=[];for(let h of l){let c=t.getTerrainMesh(h.tileID),p=t.getTerrainData(h.tileID);i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s.texture);let d=GR(255-t.coordsIndex.length,t.getMeshFrameDelta(n.zoom)),f=n.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(i,r.TRIANGLES,o,Ee.disabled,a,Ce.backCCW,d,p,f,"terrain",c.vertexBuffer,c.indexBuffer,c.segments),t.coordsIndex.push(h.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function gg(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,o=a.gl,s=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let c of i){let p=t.getTerrainMesh(c.tileID),d=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,d.texture);let y=t.getMeshFrameDelta(s.zoom),g=s.calculateFogMatrix(c.tileID.toUnwrapped()),_=jR(y,g,e.style.sky,s.pitch,n),b=s.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(a,o.TRIANGLES,u,Ee.disabled,l,Ce.backCCW,_,f,b,"terrain",p.vertexBuffer,p.indexBuffer,p.segments)}}function Xv(e,t){if(!t.mesh){let i=new lr;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let r=new Ti;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),t.mesh=new Ta(e.createVertexBuffer(i,Fr.members),e.createIndexBuffer(r),qe.simpleSegment(0,0,i.length,r.length))}return t.mesh}function yO(e,t){let i=e.context,r=i.gl,n=Gz(t,e.style.map.transform,e.pixelRatio),a=new de(r.LEQUAL,de.ReadWrite,[0,1]),o=Ee.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=Xv(i,t);l.draw(i,r.TRIANGLES,a,o,s,Ce.disabled,n,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function gO(e,t){let i=e.properties.get("position"),r=[-i.x,-i.y,-i.z],n=V.identity(new Float64Array(16));return e.properties.get("anchor")==="map"&&(V.rotateZ(n,n,t.rollInRadians),V.rotateX(n,n,-t.pitchInRadians),V.rotateZ(n,n,t.bearingInRadians),V.rotateX(n,n,t.center.lat*Math.PI/180),V.rotateY(n,n,-t.center.lng*Math.PI/180)),U.transformMat4(r,r,n),r}function _O(e,t,i){let r=e.context,n=r.gl,a=e.useProgram("atmosphere"),o=new de(n.LEQUAL,de.ReadOnly,[0,1]),s=e.transform,l=gO(i,e.transform),u=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=t.properties.get("atmosphere-blend")*u.projectionTransition;if(h===0)return;let c=Cu(s.worldSize,s.center.lat),p=s.inverseProjectionMatrix,d=new Float64Array(4);d[3]=1,at.transformMat4(d,d,s.modelViewProjectionMatrix),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1,at.transformMat4(d,d,p),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1;let f=[d[0],d[1],d[2]],y=jz(l,h,f,c,p),g=Xv(r,t);a.draw(r,n.TRIANGLES,o,Ee.disabled,Ze.alphaBlended,Ce.disabled,y,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}var xO=class{constructor(e,t){this.context=new kB(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:V.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Bo.maxUnderzooming+Bo.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new cv}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let r of this.style._order)this.style._layers[r].resize()}setup(){let e=this.context,t=new lr;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,Fr.members),this.tileExtentSegments=qe.simpleSegment(0,0,4,2);let i=new lr;i.emplaceBack(0,0),i.emplaceBack(8192,0),i.emplaceBack(0,8192),i.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(i,Fr.members),this.debugSegments=qe.simpleSegment(0,0,4,5);let r=new SE;r.emplaceBack(0,0,0,0),r.emplaceBack(8192,0,8192,0),r.emplaceBack(0,8192,0,8192),r.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(r,zR.members),this.rasterBoundsSegments=qe.simpleSegment(0,0,4,2);let n=new lr;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(n,Fr.members),this.rasterBoundsSegmentsPosOnly=qe.simpleSegment(0,0,4,5);let a=new lr;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,Fr.members),this.viewportSegments=qe.simpleSegment(0,0,4,2);let o=new OE;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let s=new Ti;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new Ee({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new Ta(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=V.create();V.ortho(i,0,this.width,this.height,0,0,1),V.scale(i,i,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let r={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,de.disabled,this.stencilClearMode,Ze.disabled,Ce.disabled,null,null,r,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(Ze.disabled),r.setDepthMode(de.disabled);let n={};for(let a of t)n[a.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){let n=this.context,a=n.gl,o=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(let u of t){let h=e[u.key],c=this.style.map.terrain&&this.style.map.terrain.getTerrainData(u),p=o.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),d=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(n,a.TRIANGLES,de.disabled,new Ee({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),Ze.disabled,i?Ce.disabled:Ce.backCCW,null,c,d,"$clipping",p.vertexBuffer,p.indexBuffer,p.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),a=this.getDepthModeFor3D(),o=Su(r,{tileSize:r.tileSize});for(let s of o){let l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),u=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),h=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,a,Ee.disabled,Ze.disabled,Ce.backCCW,null,l,h,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new Ee({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new Ee({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let a={};for(let o=0;o<n;o++)a[o+r]=new Ee({func:t.GEQUAL,mask:255},o+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[a,i]}return[{[r]:Ee.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){let a={},o={};for(let s=0;s<n;s++)a[s+r]=new Ee({func:t.GREATER,mask:255},n+1+s,255,t.KEEP,t.KEEP,t.REPLACE),o[s+r]=new Ee({func:t.GREATER,mask:255},1+s,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=n*2+1,[a,o,i]}else return this.nextStencilID=3,[{[r]:new Ee({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new Ee({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Ze([e.CONSTANT_COLOR,e.ONE],new te(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ze.unblended:Ze.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return de.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new de(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new de(this.context.gl.LEQUAL,de.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){var u,h;this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ve.now()),this.imageManager.beginFrame();let i=this.style._order,r=this.style.sourceCaches,n={},a={},o={},s={isRenderingToTexture:!1,isRenderingGlobe:((u=e.projection)==null?void 0:u.transitionState)>0};for(let c in r){let p=r[c];p.used&&p.prepare(this.context),n[c]=p.getVisibleCoordinates(!1),a[c]=n[c].slice().reverse(),o[c]=p.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let c=0;c<i.length;c++){let p=i[c];if(this.style._layers[p].is3D()){this.opaquePassCutoff=c;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let c of i){let p=this.style._layers[c];if(!p.hasOffscreenPass()||p.isHidden(this.transform.zoom))continue;let d=a[p.source];p.type!=="custom"&&!d.length||this.renderLayer(this,r[p.source],p,d,s)}if((h=this.style.projection)==null||h.updateGPUdependent({context:this.context,useProgram:c=>this.useProgram(c)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?te.black:te.transparent,depth:1}),this.clearStencil(),this.style.sky&&yO(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){let c=this.style._layers[i[this.currentLayer]],p=r[c.source],d=n[c.source];this._renderTileClippingMasks(c,d,!1),this.renderLayer(this,p,c,d,s)}this.renderPass="translucent";let l=!1;for(this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let c=this.style._layers[i[this.currentLayer]],p=r[c.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(c,s))continue;!this.opaquePassEnabledForLayer()&&!l&&(l=!0,s.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let d=(c.type==="symbol"?o:a)[c.source];this._renderTileClippingMasks(c,n[c.source],!!this.renderToTexture),this.renderLayer(this,p,c,d,s)}if(s.isRenderingGlobe&&_O(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=pO(this.style,this.transform.zoom);c&&uO(this,c,c.getVisibleCoordinates())}this.options.showPadding&&sO(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix,r=this.terrainFacilitator.dirty;r||(r=e?!V.exactEquals(t,i):!V.equals(t,i)),r||(r=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),r&&(V.copy(t,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,fO(this,this.style.map.terrain),mO(this,this.style.map.terrain))}renderLayer(e,t,i,r,n){i.isHidden(this.transform.zoom)||i.type!=="background"&&i.type!=="custom"&&!(r||[]).length||(this.id=i.id,Hk(i)?RB(e,t,i,r,this.style.placement.variableOffsets,n):nA(i)?VB(e,t,i,r,n):uA(i)?jB(e,t,i,r,n):Sk(i)?YB(e,t,i,r,n):WA(i)?ZB(e,t,i,r,n):sk(i)?WB(e,t,i,r,n):dA(i)?HB(e,t,i,r,n):_A(i)?JB(e,t,i,r,n):nD(i)?QB(e,t,i,r,n):eD(i)?tO(e,t,i,r,n):sD(i)&&dO(e,t,i,n))}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,r=[]){this.cache=this.cache||{};let n=!!this.style.map.terrain,a=this.style.projection,o=i?Ui.projectionMercator:a.shaderPreludeCode,s=i?pv:a.shaderDefine,l="/".concat(i?dv:a.shaderVariantName),u=t?t.cacheKey:"",h=this._showOverdrawInspector?"/overdraw":"",c=n?"/terrain":"",p=r?"/".concat(r.join("/")):"",d=e+u+l+h+c+p;return this.cache[d]||(this.cache[d]=new $R(this.context,Ui[e],t,Xz[e],this._showOverdrawInspector,n,o,s,r)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new st(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};function qv(e,t){let i=!1,r=null,n=null,a,o=()=>{r=null,i&&(e.apply(n,a),r=setTimeout(o,t),i=!1)};return(...s)=>(i=!0,n=this,a=s,r||o(),r)}var vO=class{constructor(e){this._getCurrentHash=()=>{let t=window.location.hash.replace("#","");if(this._hashName){let i;return t.split("&").map(r=>r.split("=")).forEach(r=>{r[0]===this._hashName&&(i=r)}),(i&&i[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getCurrentHash();if(t.length===0)return;let i=t.join("/"),r=i;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r="".concat(this._hashName,"=").concat(i));let n=window.location.hash.replace(r,"");n.startsWith("#&")?n=n.slice(0,1)+n.slice(2):n==="#"&&(n="");let a=window.location.href.replace(/(#.+)?$/,n);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=qv(this._updateHashUnthrottled,30*1e3/100),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),a=Math.round(t.lng*n)/n,o=Math.round(t.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(e?u+="/".concat(a,"/").concat(o,"/").concat(i):u+="".concat(i,"/").concat(o,"/").concat(a),(s||l)&&(u+="/".concat(Math.round(s*10)/10)),l&&(u+="/".concat(Math.round(l))),this._hashName){let h=this._hashName,c=!1,p=window.location.hash.slice(1).split("&").map(d=>{let f=d.split("=")[0];return f===h?(c=!0,"".concat(f,"=").concat(u)):d}).filter(d=>d);return c||p.push("".concat(h,"=").concat(u)),"#".concat(p.join("&"))}return"#".concat(u)}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new oe(+e[2],+e[1])}catch(n){return!1}let t=+e[0],i=+(e[3]||0),r=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}},bO=se(ce(),1),Yo={linearity:.3,easing:Pp(0,0,.3,1)},wO=K({deceleration:2500,maxSpeed:1400},Yo),PO=K({deceleration:20,maxSpeed:1400},Yo),TO=K({deceleration:1e3,maxSpeed:360},Yo),SO=K({deceleration:1e3,maxSpeed:90},Yo),CO=K({deceleration:1e3,maxSpeed:360},Yo),MO=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ve.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=ve.now(),i=160;for(;e.length>0&&t-e[0].time>i;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new bO.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of this._inertiaBuffer)t.zoom+=n.zoomDelta||0,t.bearing+=n.bearingDelta||0,t.pitch+=n.pitchDelta||0,t.roll+=n.rollDelta||0,n.panDelta&&t.pan._add(n.panDelta),n.around&&(t.around=n.around),n.pinchAround&&(t.pinchAround=n.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(t.pan.mag()){let n=Ja(t.pan.mag(),i,K({},wO,e||{})),a=t.pan.mult(n.amount/t.pan.mag()),o=this._map.cameraHelper.handlePanInertia(a,this._map.transform);r.center=o.easingCenter,r.offset=o.easingOffset,Ka(r,n)}if(t.zoom){let n=Ja(t.zoom,i,PO);r.zoom=this._map.transform.zoom+n.amount,Ka(r,n)}if(t.bearing){let n=Ja(t.bearing,i,TO);r.bearing=this._map.transform.bearing+Ae(n.amount,-179,179),Ka(r,n)}if(t.pitch){let n=Ja(t.pitch,i,SO);r.pitch=this._map.transform.pitch+n.amount,Ka(r,n)}if(t.roll){let n=Ja(t.roll,i,CO);r.roll=this._map.transform.roll+Ae(n.amount,-179,179),Ka(r,n)}if(r.zoom||r.bearing){let n=t.pinchAround===void 0?t.around:t.pinchAround;r.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),K(r,{noMoveStart:!0})}};function Ka(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Ja(e,t,i){let{maxSpeed:r,linearity:n,deceleration:a}=i,o=Ae(e*n/(t/1e3),-r,r),s=Math.abs(o)/(a*n);return{easing:i.easing,duration:s*1e3,amount:o*(s/2)}}var IO=se(ce(),1),si=class extends ${preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let n=be.mousePos(t.getCanvas(),i),a=t.unproject(n);super(e,K({point:n,lngLat:a,originalEvent:i},r)),this._defaultPrevented=!1,this.target=t}},cl=class extends ${preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let r=e==="touchend"?i.changedTouches:i.touches,n=be.touchPos(t.getCanvasContainer(),r),a=n.map(l=>t.unproject(l)),o=n.reduce((l,u,h,c)=>l.add(u.div(c.length)),new IO.default(0,0)),s=t.unproject(o);super(e,{points:n,point:o,lngLats:a,lngLat:s,originalEvent:i}),this._defaultPrevented=!1}},EO=class extends ${preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}},AO=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new EO(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new si(e.type,this._map,e))}mouseup(e){this._map.fire(new si(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new si(e.type,this._map,e))}dblclick(e){return this._firePreventable(new si(e.type,this._map,e))}mouseover(e){this._map.fire(new si(e.type,this._map,e))}mouseout(e){this._map.fire(new si(e.type,this._map,e))}touchstart(e){return this._firePreventable(new cl(e.type,this._map,e))}touchmove(e){this._map.fire(new cl(e.type,this._map,e))}touchend(e){this._map.fire(new cl(e.type,this._map,e))}touchcancel(e){this._map.fire(new cl(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},kO=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new si(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new si("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new si(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},DO=se(ce(),1),Zo=class{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(DO.default.convert(e),this._map.terrain)}},LO=class{constructor(e,t){this._map=e,this._tr=new Zo(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(be.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=be.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),a=Math.max(r.x,i.x),o=Math.min(r.y,i.y),s=Math.max(r.y,i.y);be.setTransform(this._box,"translate(".concat(n,"px,").concat(o,"px)")),this._box.style.width="".concat(a-n,"px"),this._box.style.height="".concat(s-o,"px")}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,r=t;if(this.reset(),be.suppressClick(),i.x===r.x&&i.y===r.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new $("boxzoomend",{originalEvent:e})),{cameraAnimation:n=>n.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(be.remove(this._box),this._box=null),be.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new $(e,{originalEvent:t}))}},RO=se(ce(),1);function fp(e,t){if(e.length!==t.length)throw new Error("The number of touches and points are not equal - touches ".concat(e.length,", points ").concat(t.length));let i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}function zO(e){let t=new RO.default(0,0);for(let i of e)t._add(i);return t.div(e.length)}var $v=500,BO=500,Ld=30,OO=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=zO(t),this.touches=fp(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=fp(i,t);for(let n in this.touches){let a=this.touches[n],o=r[n];(!o||o.dist(a)>Ld)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>BO)&&(this.aborted=!0),i.length===0){let r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}},mp=class{constructor(e){this.singleTap=new OO(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let r=this.singleTap.touchend(e,t,i);if(r){let n=e.timeStamp-this.lastTime<$v,a=!this.lastTap||this.lastTap.dist(r)<Ld;if((!n||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},FO=class{constructor(e){this._tr=new Zo(e),this._zoomIn=new mp({numTouches:1,numTaps:2}),this._zoomOut=new mp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i),a=this._tr;if(r)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(r)},{originalEvent:e})};if(n)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(n)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},NO=se(ce(),1),Mu=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let r=Array.isArray(t)?t[0]:t;if(!(!this._moved&&r.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(i,r)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&be.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}},VO=0,jO=2,UO={[VO]:1,[jO]:2};function GO(e,t){let i=UO[t];return e.buttons===void 0||(e.buttons&i)!==i}var Iu=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=be.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!GO(e,this._eventButton)}isValidEndEvent(e){return be.mouseButton(e)===this._eventButton}};var Rd=0,zd=2,Eu=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function XO({enable:e,clickTolerance:t}){let i=new Iu({checkCorrectEvent:r=>be.mouseButton(r)===Rd&&!r.ctrlKey});return new Mu({clickTolerance:t,move:(r,n)=>({around:n,panDelta:n.sub(r)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Eu})}function qO({enable:e,clickTolerance:t,aroundCenter:i=!0,minPixelCenterThreshold:r=100,rotateDegreesPerPixelMoved:n=.8},a){let o=new Iu({checkCorrectEvent:s=>be.mouseButton(s)===Rd&&s.ctrlKey||be.mouseButton(s)===zd&&!s.ctrlKey});return new Mu({clickTolerance:t,move:(s,l)=>{let u=a();if(i&&Math.abs(u.y-s.y)>r)return{bearingDelta:eC(new NO.default(s.x,l.y),l,u)};let h=(l.x-s.x)*n;return i&&l.y<u.y&&(h=-h),{bearingDelta:h}},moveStateManager:o,enable:e,assignEvents:Eu})}function $O({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){let r=new Iu({checkCorrectEvent:n=>be.mouseButton(n)===Rd&&n.ctrlKey||be.mouseButton(n)===zd});return new Mu({clickTolerance:t,move:(n,a)=>({pitchDelta:(a.y-n.y)*i}),moveStateManager:r,enable:e,assignEvents:Eu})}function YO({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){let n=new Iu({checkCorrectEvent:a=>be.mouseButton(a)===zd&&a.ctrlKey});return new Mu({clickTolerance:t,move:(a,o)=>{let s=r(),l=(o.x-a.x)*i;return o.y<s.y&&(l=-l),{rollDelta:l}},moveStateManager:n,enable:e,assignEvents:Eu})}var dc=se(ce(),1),ZO=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new dc.default(0,0)}_shouldBePrevented(e){let t=this._map.cooperativeGestures.isEnabled()?2:1;return e<t}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(this._shouldBePrevented(i.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,i)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let r=fp(i,t),n=new dc.default(0,0),a=new dc.default(0,0),o=0;for(let l in r){let u=r[l],h=this._touches[l];h&&(n._add(u),a._add(u.sub(h)),o++,r[l]=u)}if(this._touches=r,this._shouldBePrevented(o)||!a.mag())return;let s=a.div(o);return this._sum._add(s),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(o),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Bd=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[r,n]=this._firstTwoTouches,a=pl(i,t,r),o=pl(i,t,n);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[r,n]=this._firstTwoTouches,a=pl(i,t,r),o=pl(i,t,n);a&&o||(this._active&&be.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function pl(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}var WO=.1;function _g(e,t){return Math.log(e/t)/Math.LN2}var HO=class extends Bd{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(_g(this._distance,this._startDistance))<WO))return this._active=!0,{zoomDelta:_g(this._distance,i),pinchAround:t}}},KO=25;function xg(e,t){return e.angleWith(t)*180/Math.PI}var JO=class extends Bd{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:xg(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,i=KO/t*360,r=xg(e,this._startVector);return Math.abs(r)<i}};function fc(e){return Math.abs(e.y)>Math.abs(e.x)}var QO=100,eF=class extends Bd{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,fc(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(this._valid!==void 0)return this._valid;let r=2,n=e.mag()>=r,a=t.mag()>=r;if(!n&&!a)return;if(!n||!a)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<QO?void 0:!1;let o=e.y>0==t.y>0;return fc(e)&&fc(t)&&o}},tF={panStep:100,bearingStep:15,pitchStep:10},iF=class{constructor(e){this._tr=new Zo(e);let t=tF;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:o=>{let s=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:rF,zoom:t?Math.round(s.zoom)+t*(e.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-n*this._panStep,-a*this._panStep],center:s.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function rF(e){return e*(2-e)}var vg=4.000244140625,nF=1/100,aF=1/450,oF=2,sF=5,lF=class{constructor(e,t){this._onTimeout=i=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=new Zo(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=nF,this._wheelZoomRate=aF}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i=ve.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t!==0&&t%vg===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=be.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundCenter?this._aroundPoint=i.transform.locationToScreenPoint(oe.convert(i.center)):this._aroundPoint=t,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let o=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=o),typeof this._targetZoom=="number"&&(this._targetZoom+=o)}if(this._delta!==0){let o=this._type==="wheel"&&Math.abs(this._delta)>vg?this._wheelZoomRate:this._defaultZoomRate,s=oF/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&s!==0&&(s=1/s);let l=typeof this._targetZoom!="number"?e.scale:It(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),Et(l*s)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,i=this._startZoom,r=this._easing,n=!1,a;if(this._type==="wheel"&&i&&r){let o=ve.now()-this._lastWheelEventTime,s=Math.min((o+sF)/200,1),l=r(s);a=Ke.number(i,t,l),s<1?this._frameId||(this._frameId=!0):n=!0}else a=t,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!n,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=wc;if(this._prevEase){let i=this._prevEase,r=(ve.now()-i.start)/i.duration,n=i.easing(r+.01)-i.easing(r),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.27*.27-a*a);t=Pp(a,o,.25,1)}return this._prevEase={start:ve.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},uF=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},hF=class{constructor(e){this._tr=new Zo(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},cF=class{constructor(){this._tap=new mp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,i);else{let r=t[0],n=e.timeStamp-this._tapTime<$v,a=this._tapPoint.dist(r)<Ld;!n||!a?this.reset():i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier)}}touchmove(e,t,i){if(!this._tapTime)this._tap.touchmove(e,t,i);else if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},pF=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},dF=class{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},fF=class{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},mF=class{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=be.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(be.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new $("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},yF=se(ce(),1),dl=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,gF=class extends ${};function mc(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var _F=class{constructor(e,t){this.handleWindowEvent=r=>{this.handleEvent(r,"".concat(r.type,"Window"))},this.handleEvent=(r,n)=>{if(r.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let a=r.type==="renderFrame"?void 0:r,o={needsRenderFrame:!1},s={},l={};for(let{handlerName:c,handler:p,allowed:d}of this._handlers){if(!p.isEnabled())continue;let f;if(this._blockedByActive(l,d,c))p.reset();else if(p[n||r.type]){if(iC(r,n||r.type)){let y=be.mousePos(this._map.getCanvas(),r);f=p[n||r.type](r,y)}else if(tC(r,n||r.type)){let y=r.touches,g=this._getMapTouches(y),_=be.touchPos(this._map.getCanvas(),g);f=p[n||r.type](r,_,g)}else rC(n||r.type)||(f=p[n||r.type](r));this.mergeHandlerResult(o,s,f,c,a),f&&f.needsRenderFrame&&this._triggerRenderFrame()}(f||p.isActive())&&(l[c]=p)}let u={};for(let c in this._previousActiveHandlers)l[c]||(u[c]=a);this._previousActiveHandlers=l,(Object.keys(u).length||mc(o))&&(this._changes.push([o,s,u]),this._triggerRenderFrame()),(Object.keys(l).length||mc(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=o;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new MO(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(let[r,n,a]of this._listeners)be.addEventListener(r,n,r===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(let[e,t,i]of this._listeners)be.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new AO(t,e));let r=t.boxZoom=new LO(t,e);this._add("boxZoom",r),e.interactive&&e.boxZoom&&r.enable();let n=t.cooperativeGestures=new mF(t,e.cooperativeGestures);this._add("cooperativeGestures",n),e.cooperativeGestures&&n.enable();let a=new FO(t),o=new hF(t);t.doubleClickZoom=new uF(o,a),this._add("tapZoom",a),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let s=new cF;this._add("tapDragZoom",s);let l=t.touchPitch=new eF(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),h=qO(e,u),c=$O(e),p=YO(e,u);t.dragRotate=new dF(e,h,c,p),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",p,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let d=XO(e),f=new ZO(e,t);t.dragPan=new pF(i,d,f),this._add("mousePan",d),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let y=new JO,g=new HO;t.touchZoomRotate=new fF(i,g,y,s),this._add("touchRotate",y,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let _=t.scrollZoom=new lF(t,()=>this._triggerRenderFrame());this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let b=t.keyboard=new iF(t);this._add("keyboard",b),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new kO(t))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!dl(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let r=i.target;this._el.contains(r)&&t.push(i)}return t}mergeHandlerResult(e,t,i,r,n){if(!i)return;K(e,i);let a={handlerName:r,originalEvent:i.originalEvent||n};i.zoomDelta!==void 0&&(t.zoom=a),i.panDelta!==void 0&&(t.drag=a),i.rollDelta!==void 0&&(t.roll=a),i.pitchDelta!==void 0&&(t.pitch=a),i.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},i={};for(let[r,n,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new yF.default(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),r.around!==void 0&&(e.around=r.around),r.pinchAround!==void 0&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),K(t,n),K(i,a);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let r=this._map,n=r._getTransformForUpdate(),a=r.terrain;if(!mc(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:l,pitchDelta:u,rollDelta:h,around:c,pinchAround:p}=e;p!==void 0&&(c=p),c=c||r.transform.centerPoint,a&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let d={panDelta:o,zoomDelta:s,rollDelta:h,pitchDelta:u,bearingDelta:l,around:c};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let f=c.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(o?c.sub(o):c);a?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,n,f)):t.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(o))):this._map.cameraHelper.handleMapControlsPan(d,n,f)):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._map.cameraHelper.handleMapControlsPan(d,n,f)),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,t,i){let r=dl(this._eventsInProgress),n=dl(e),a={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(a["".concat(h,"start")]=c),this._eventsInProgress[h]=e[h]}!r&&n&&this._fireEvent("movestart",n.originalEvent);for(let h in a)this._fireEvent(h,a[h]);n&&this._fireEvent("move",n.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let o={},s;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:p}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],s=t[c]||p,o["".concat(h,"end")]=s)}for(let h in o)this._fireEvent(h,o[h]);let l=dl(this._eventsInProgress),u=(r||n)&&!l;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let h=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(h)}if(i&&u){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=p=>p!==0&&-this._bearingSnap<p&&p<this._bearingSnap;h&&(h.essential||!ve.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:s})):(this._map.fire(new $("moveend",{originalEvent:s})),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new $(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new gF("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},Qa=se(ce(),1),xF=class extends Ft{constructor(e,t,i){super(),this._renderFrameCallback=()=>{let r=Math.min((ve.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new oe(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,i){return e=Qa.default.convert(e).mult(-1),this.panTo(this.transform.center,K({offset:e},t),i)}panTo(e,t,i){return this.easeTo(K({center:e},t),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(K({zoom:e},t),i)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new $("movestart",t)).fire(new $("move",t)).fire(new $("moveend",t))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,i){return this.easeTo(K({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,K({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(K({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=Zi.convert(e).adjustAntiMeridian();let i=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,t,i,r){let n={top:0,bottom:0,right:0,left:0};if(r=K({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},r),typeof r.padding=="number"){let l=r.padding;r.padding={top:l,bottom:l,right:l,left:l}}let a=K(n,r.padding);r.padding=a;let o=this.transform,s=new Zi(e,t);return this.cameraHelper.cameraForBoxAndBearing(r,a,s,i,o)}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,t,i,r,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(Qa.default.convert(e)),this.transform.screenPointToLocation(Qa.default.convert(t)),i,r),r,n)}_fitInternal(e,t,i){return e?(t=K(e,t),delete t.padding,t.linear?this.easeTo(t,i):this.flyTo(t,i)):this}jumpTo(e,t){this.stop();let i=this._getTransformForUpdate(),r=!1,n=!1,a=!1,o=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,e);let s=i.zoom!==o;return"elevation"in e&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),"bearing"in e&&i.bearing!==+e.bearing&&(r=!0,i.setBearing(+e.bearing)),"pitch"in e&&i.pitch!==+e.pitch&&(n=!0,i.setPitch(+e.pitch)),"roll"in e&&i.roll!==+e.roll&&(a=!0,i.setRoll(+e.roll)),e.padding!=null&&!i.isPaddingEqual(e.padding)&&i.setPadding(e.padding),this._applyUpdatedTransform(i),this.fire(new $("movestart",t)).fire(new $("move",t)),s&&this.fire(new $("zoomstart",t)).fire(new $("zoom",t)).fire(new $("zoomend",t)),r&&this.fire(new $("rotatestart",t)).fire(new $("rotate",t)).fire(new $("rotateend",t)),n&&this.fire(new $("pitchstart",t)).fire(new $("pitch",t)).fire(new $("pitchend",t)),a&&this.fire(new $("rollstart",t)).fire(new $("roll",t)).fire(new $("rollend",t)),this.fire(new $("moveend",t))}calculateCameraOptionsFromTo(e,t,i,r=0){let n=Ue.fromLngLat(e,t),a=Ue.fromLngLat(i,r),o=a.x-n.x,s=a.y-n.y,l=a.z-n.z,u=Math.hypot(o,s,l);if(u===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(o,s),c=Et(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=Math.atan2(o,-s)*180/Math.PI,d=Math.acos(h/u)*180/Math.PI;return d=l<0?90-d:90+d,{center:a.toLngLat(),elevation:r,zoom:c,pitch:d,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,n){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:i,pitch:r,roll:n}}easeTo(e,t){this._stop(!1,e.easeId),e=K({offset:[0,0],duration:500,easing:wc},e),(e.animate===!1||!e.essential&&ve.prefersReducedMotion)&&(e.duration=0);let i=this._getTransformForUpdate(),r=this.getBearing(),n=i.pitch,a=i.roll,o="bearing"in e?this._normalizeBearing(e.bearing,r):r,s="pitch"in e?+e.pitch:n,l="roll"in e?this._normalizeBearing(e.roll,a):a,u="padding"in e?e.padding:i.padding,h=Qa.default.convert(e.offset),c,p;e.around&&(c=oe.convert(e.around),p=i.locationToScreenPoint(c));let d={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(i,{bearing:o,pitch:s,roll:l,padding:u,around:c,aroundPoint:p,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||r!==o,this._pitching=this._pitching||s!==n,this._rolling=this._rolling||l!==a,this._padding=!i.isPaddingEqual(u),this._zooming=this._zooming||f.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,d),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(y=>{f.easeFunc(y),this.terrain&&!e.freezeElevation&&this._updateElevation(y),this._applyUpdatedTransform(i),this._fireMoveEvents(t)},y=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,y)},e),this}_prepareEase(e,t,i={}){this._moving=!0,!t&&!i.moving&&this.fire(new $("movestart",e)),this._zooming&&!i.zooming&&this.fire(new $("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new $("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new $("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new $("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&t!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,r=(t-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-r),this._elevationTarget=t}this.transform.setElevation(Ke.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){return{}}_applyUpdatedTransform(e){let t=[];if(t.push(r=>this._elevateCameraIfInsideTerrain(r)),this.transformCameraUpdate&&t.push(r=>this.transformCameraUpdate(r)),!t.length)return;let i=e.clone();for(let r of t){let n=i.clone(),{center:a,zoom:o,roll:s,pitch:l,bearing:u,elevation:h}=r(n);a&&n.setCenter(a),h!==void 0&&n.setElevation(h),o!==void 0&&n.setZoom(o),s!==void 0&&n.setRoll(s),l!==void 0&&n.setPitch(l),u!==void 0&&n.setBearing(u),i.apply(n)}this.transform.apply(i)}_fireMoveEvents(e){this.fire(new $("move",e)),this._zooming&&this.fire(new $("zoom",e)),this._rotating&&this.fire(new $("rotate",e)),this._pitching&&this.fire(new $("pitch",e)),this._rolling&&this.fire(new $("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let i=this._zooming,r=this._rotating,n=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new $("zoomend",e)),r&&this.fire(new $("rotateend",e)),n&&this.fire(new $("pitchend",e)),a&&this.fire(new $("rollend",e)),this.fire(new $("moveend",e))}flyTo(e,t){if(!e.essential&&ve.prefersReducedMotion){let k=Fo(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(k,t)}this.stop(),e=K({offset:[0,0],speed:1.2,curve:1.42,easing:wc},e);let i=this._getTransformForUpdate(),r=i.bearing,n=i.pitch,a=i.roll,o=i.padding,s="bearing"in e?this._normalizeBearing(e.bearing,r):r,l="pitch"in e?+e.pitch:n,u="roll"in e?this._normalizeBearing(e.roll,a):a,h="padding"in e?e.padding:i.padding,c=Qa.default.convert(e.offset),p=i.centerPoint.add(c),d=i.screenPointToLocation(p),f=this.cameraHelper.handleFlyTo(i,{bearing:s,pitch:l,roll:u,padding:h,locationAtOffset:d,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),y=e.curve,g=Math.max(i.width,i.height),_=g/f.scaleOfZoom,b=f.pixelPathLength;if(typeof f.scaleOfMinZoom=="number"){let k=g/f.scaleOfMinZoom;y=Math.sqrt(k/b*2)}let v=y*y;function w(k){let D=(_*_-g*g+(k?-1:1)*v*v*b*b)/(2*(k?_:g)*v*b);return Math.log(Math.sqrt(D*D+1)-D)}function T(k){return(Math.exp(k)-Math.exp(-k))/2}function S(k){return(Math.exp(k)+Math.exp(-k))/2}function M(k){return T(k)/S(k)}let E=w(!1),L=function(k){return S(E)/S(E+y*k)},z=function(k){return g*((S(E)*M(E+y*k)-T(E))/v)/b},R=(w(!0)-E)/y;if(Math.abs(b)<2e-6||!isFinite(R)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let k=_<g?-1:1;R=Math.abs(Math.log(_/g))/y,z=()=>0,L=D=>Math.exp(k*y*D)}if("duration"in e)e.duration=+e.duration;else{let k="screenSpeed"in e?+e.screenSpeed/y:+e.speed;e.duration=1e3*R/k}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==s,this._pitching=l!==n,this._rolling=u!==a,this._padding=!i.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(k=>{let D=k*R,x=1/L(D),C=z(D);this._rotating&&i.setBearing(Ke.number(r,s,k)),this._pitching&&i.setPitch(Ke.number(n,l,k)),this._rolling&&i.setRoll(Ke.number(a,u,k)),this._padding&&(i.interpolatePadding(o,h,k),p=i.centerPoint.add(c)),f.easeFunc(k,x,C,p),this.terrain&&!e.freezeElevation&&this._updateElevation(k),this._applyUpdatedTransform(i),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,t)}return e||((i=this.handlers)==null||i.stop(!1)),this}_ease(e,t,i){i.animate===!1||i.duration===0?(e(1),t()):(this._easeStart=ve.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=pn(e,-180,180);let i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(oe.convert(e),this.transform.tileZoom):null}},Ar=se(ce(),1),Yv={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},vF=class{constructor(e=Yv){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"||t.dataType==="style"||t.type==="terrain")&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=be.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=be.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=be.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){be.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let i=this._map._getUIString("AttributionControl.".concat(t));e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(r=>typeof r!="string"?"":r)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let r=this._map.style.stylesheet;this.styleOwner=r.owner,this.styleId=r.id}let t=this._map.style.sourceCaches;for(let r in t){let n=t[r];if(n.used||n.usedForTerrain){let a=n.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(r=>String(r).trim()),e.sort((r,n)=>r.length-n.length),e=e.filter((r,n)=>{for(let a=n+1;a<e.length;a++)if(e[a].indexOf(r)>=0)return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=be.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},bF=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=be.create("div","maplibregl-ctrl");let t=be.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){be.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},wF=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(let r of i)if(r.id===e){r.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},yp=(e=>(e.create="create",e.load="load",e.fullLoad="fullLoad",e))(yp||{}),fl=null,eo=[],PF=60,yc=1e3/PF,gc="loadTime",_c="fullLoadTime",to={mark(e){performance.mark(e)},frame(e){let t=e;if(fl!=null){let i=t-fl;eo.push(i)}fl=t},clearMetrics(){fl=null,eo=[],performance.clearMeasures(gc),performance.clearMeasures(_c);for(let e in yp)performance.clearMarks(yp[e])},getPerformanceMetrics(){performance.measure(gc,"create","load"),performance.measure(_c,"create","fullLoad");let e=performance.getEntriesByName(gc)[0].duration,t=performance.getEntriesByName(_c)[0].duration,i=eo.length,r=1/(eo.reduce((o,s)=>o+s,0)/i/1e3),n=eo.filter(o=>o>yc).reduce((o,s)=>o+(s-yc)/yc,0),a=n/(i+n)*100;return{loadTime:e,fullLoadTime:t,fps:r,percentDroppedFrames:a,totalFrames:i}}},TF=it([{name:"a_pos3d",type:"Int16",components:3}]),SF=class extends Ft{constructor(e){super(),this._lastTilesetChange=ve.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let i={};for(let r of Su(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))i[r.key]=!0,this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.terrainRttPosMatrix32f=new Float64Array(16),V.ortho(r.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[r.key]=new iv(r,this.tileSize),this._lastTilesetChange=ve.now());for(let r in this._tiles)i[r]||delete this._tiles[r]}freeRtt(e){for(let t in this._tiles){let i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let i of this._renderableTilesKeys){let r=this._tiles[i].tileID,n=e.clone(),a=Br();if(r.canonical.equals(e.canonical))V.ortho(a,0,8192,8192,0,0,1);else if(r.canonical.isChildOf(e.canonical)){let o=r.canonical.z-e.canonical.z,s=r.canonical.x-(r.canonical.x>>o<<o),l=r.canonical.y-(r.canonical.y>>o<<o),u=8192>>o;V.ortho(a,0,u,u,0,0,1),V.translate(a,a,[-s*u,-l*u,0])}else if(e.canonical.isChildOf(r.canonical)){let o=e.canonical.z-r.canonical.z,s=e.canonical.x-(e.canonical.x>>o<<o),l=e.canonical.y-(e.canonical.y>>o<<o),u=8192>>o;V.ortho(a,0,8192,8192,0,0,1),V.translate(a,a,[s*u,l*u,0]),V.scale(a,a,[1/2**o,1/2**o,0])}else continue;n.terrainRttPosMatrix32f=new Float32Array(a),t[i]=n}return t}_getTerrainCoordsForTileRanges(e,t){let i={};for(let r of this._renderableTilesKeys){let n=this._tiles[r].tileID;if(!this._isWithinTileRanges(n,t))continue;let a=e.clone(),o=Br();if(n.canonical.z===e.canonical.z){let s=e.canonical.x-n.canonical.x,l=e.canonical.y-n.canonical.y;V.ortho(o,0,8192,8192,0,0,1),V.translate(o,o,[s*8192,l*8192,0])}else if(n.canonical.z>e.canonical.z){let s=n.canonical.z-e.canonical.z,l=n.canonical.x-(n.canonical.x>>s<<s),u=n.canonical.y-(n.canonical.y>>s<<s),h=e.canonical.x-(n.canonical.x>>s),c=e.canonical.y-(n.canonical.y>>s),p=8192>>s;V.ortho(o,0,p,p,0,0,1),V.translate(o,o,[-l*p+h*8192,-u*p+c*8192,0])}else{let s=e.canonical.z-n.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s),u=e.canonical.y-(e.canonical.y>>s<<s),h=(e.canonical.x>>s)-n.canonical.x,c=(e.canonical.y>>s)-n.canonical.y,p=8192<<s;V.ortho(o,0,p,p,0,0,1),V.translate(o,o,[l*8192+h*p,u*8192+c*p,0])}a.terrainRttPosMatrix32f=new Float32Array(o),i[r]=a}return i}getSourceTile(e,t){let i=this.sourceCache._source,r=e.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(n&&n.dem)&&t)for(;r>=i.minzoom&&!(n&&n.dem);)n=this.sourceCache.getTileByID(e.scaledTo(r--).key);return n}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}},CF=class{constructor(e,t,i){this._meshCache={},this.painter=e,this.sourceCache=new SF(t),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,i,r=8192){var p;if(!(t>=0&&t<r&&i>=0&&i<r))return 0;let n=this.getTerrainData(e),a=(p=n.tile)==null?void 0:p.dem;if(!a)return 0;let o=Bt.transformMat4([],[t/r*8192,i/r*8192],n.u_terrain_matrix),s=[o[0]*a.dim,o[1]*a.dim],l=Math.floor(s[0]),u=Math.floor(s[1]),h=s[0]-l,c=s[1]-u;return a.get(l,u)*(1-h)*(1-c)+a.get(l+1,u)*h*(1-c)+a.get(l,u+1)*(1-h)*c+a.get(l+1,u+1)*h*c}getElevationForLngLatZoom(e,t){if(!GD(t,e.wrap()))return 0;let{tileID:i,mercatorX:r,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,r%8192,n%8192,8192)}getElevation(e,t,i,r=8192){return this.getDEMElevation(e,t,i,r)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let r=this.painter.context,n=new Ye({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new st(r,n,r.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new st(r,new Ye({width:1,height:1}),r.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=V.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let r=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new st(r,t.dem.getPixels(),r.gl.RGBA,{premultiply:!1}),t.demTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t&&t+t.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){let r=this.sourceCache.sourceCache._source.maxzoom,n=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:ct("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),s=V.fromScaling(new Float64Array(16),[1/(8192<<n),1/(8192<<n),0]);V.translate(s,s,[a*8192,o*8192,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,i=t.width/devicePixelRatio,r=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==i||this._fbo.height!==r)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new st(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new st(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let n=0,a=0;n<this._coordsTextureSize;n++)for(let o=0;o<this._coordsTextureSize;o++,a+=4)t[a+0]=o&255,t[a+1]=n&255,t[a+2]=o>>8<<4|n>>8,t[a+3]=0;let i=new Ye({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),r=new st(e,i,e.gl.RGBA,{premultiply:!1});return r.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),i=this.painter.context,r=i.gl,n=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),o=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(n,o-a-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null);let s=t[0]+(t[2]>>4<<8),l=t[1]+((t[2]&15)<<8),u=this.coordsIndex[255-t[3]],h=u&&this.sourceCache.getTileByID(u);if(!h)return null;let c=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*c;return new Ue((h.tileID.canonical.x*c+s)/p+h.tileID.wrap,(h.tileID.canonical.y*c+l)/p,this.getElevation(h.tileID,s,l,c))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(e){var S;let t=((S=this.painter.style.projection)==null?void 0:S.transitionState)>0,i=t&&e.canonical.y===0,r=t&&e.canonical.y===(1<<e.canonical.z)-1,n="m_".concat(i?"n":"","_").concat(r?"s":"");if(this._meshCache[n])return this._meshCache[n];let a=this.painter.context,o=new TE,s=new Ti,l=this.meshSize,u=8192/l,h=l*l;for(let M=0;M<=l;M++)for(let E=0;E<=l;E++)o.emplaceBack(E*u,M*u,0);for(let M=0;M<h;M+=l+1)for(let E=0;E<l;E++)s.emplaceBack(E+M,l+E+M+1,l+E+M+2),s.emplaceBack(E+M,l+E+M+2,E+M+1);let c=o.length,p=0,d=c+(l+1),f=(l+1)*l,y=i?zr:0,g=i?0:1,_=r?hn:8192,b=r?0:1;for(let M=0;M<=l;M++)o.emplaceBack(M*u,y,g);for(let M=0;M<=l;M++)o.emplaceBack(M*u,_,b);for(let M=0;M<l;M++)s.emplaceBack(f+M,d+M,d+M+1),s.emplaceBack(f+M,d+M+1,f+M+1),s.emplaceBack(p+M,c+M+1,c+M),s.emplaceBack(p+M,p+M+1,c+M+1);let v=o.length,w=v+(l+1)*2;for(let M of[0,1])for(let E=0;E<=l;E++)for(let L of[0,1])o.emplaceBack(M*8192,E*u,L);for(let M=0;M<l*2;M+=2)s.emplaceBack(v+M,v+M+1,v+M+3),s.emplaceBack(v+M,v+M+3,v+M+2),s.emplaceBack(w+M,w+M+3,w+M+1),s.emplaceBack(w+M,w+M+2,w+M+3);let T=new Ta(a.createVertexBuffer(o,TF.members),a.createIndexBuffer(s),qe.simpleSegment(0,0,o.length,s.length));return this._meshCache[n]=T,T}getMeshFrameDelta(e){return 2*Math.PI*Ni/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var r;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(r=this.getMinMaxElevation(i).minElevation)!=null?r:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=Ue.fromLngLat(e.wrap()),r=(1<<t)*8192,n=i.x*r,a=i.y*r,o=Math.floor(n/8192),s=Math.floor(a/8192);return{tileID:new Tt(t,0,t,o,s),mercatorX:n,mercatorY:a}}},MF=class{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new st(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(i.texture),{id:e,fbo:t,texture:i,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return this._objects.length<this._size?!1:this._objects.some(e=>!e.inUse)===!1}},Yn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},IF=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new MF(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsAscending={};for(let i in e.sourceCaches){this._coordsAscending[i]={};let r=e.sourceCaches[i].getVisibleCoordinates(),n=e.sourceCaches[i].getSource(),a=n instanceof $o?n.terrainTileRanges:null;for(let o of r){let s=this.terrain.sourceCache.getTerrainCoords(o,a);for(let l in s)this._coordsAscending[i][l]||(this._coordsAscending[i][l]=[]),this._coordsAscending[i][l].push(s[l])}}this._coordsAscendingStr={};for(let i of e._order){let r=e._layers[i],n=r.source;if(Yn[r.type]&&!this._coordsAscendingStr[n]){this._coordsAscendingStr[n]={};for(let a in this._coordsAscending[n])this._coordsAscendingStr[n][a]=this._coordsAscending[n][a].map(o=>o.key).sort().join()}}for(let i of this._renderableTiles)for(let r in this._coordsAscendingStr){let n=this._coordsAscendingStr[r][i.tileID.key];n&&n!==i.rttCoords[r]&&(i.rtt=[])}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let i=ri(nt({},t),{isRenderingToTexture:!0}),r=e.type,n=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Yn[r]&&((!this._prevType||!Yn[this._prevType])&&this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Yn[this._prevType]||Yn[r]&&a){this._prevType=r;let o=this._stacks.length-1,s=this._stacks[o]||[];for(let l of this._renderableTiles){if(this.pool.isFull()&&(gg(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(l),l.rtt[o]){let h=this.pool.getObjectForId(l.rtt[o].id);if(h.stamp===l.rtt[o].stamp){this.pool.useObject(h);continue}}let u=this.pool.getOrCreateFreeObject();this.pool.useObject(u),this.pool.stampObject(u),l.rtt[o]={id:u.id,stamp:u.stamp},n.context.bindFramebuffer.set(u.fbo.framebuffer),n.context.clear({color:te.transparent,stencil:0}),n.currentStencilSource=void 0;for(let h=0;h<s.length;h++){let c=n.style._layers[s[h]],p=c.source?this._coordsAscending[c.source][l.tileID.key]:[l.tileID];n.context.viewport.set([0,0,u.fbo.width,u.fbo.height]),n._renderTileClippingMasks(c,p,!0),n.renderLayer(n,n.style.sourceCaches[c.source],c,p,i),c.source&&(l.rttCoords[c.source]=this._coordsAscendingStr[c.source][l.tileID.key])}}return gg(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),Yn[r]}return!1}},EF={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},AF=Cg.version,Il=-2,Zv=22,Rr=0,Wv=60,ml=180,bg={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Yv,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:Il,maxZoom:Zv,minPitch:Rr,maxPitch:Wv,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:jr.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Gj=class extends xF{constructor(e){var o,s;to.mark("create");let t=ri(nt(nt({},bg),e),{canvasContextAttributes:nt(nt({},bg.canvasContextAttributes),e.canvasContextAttributes)});if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<Rr)throw new Error("minPitch must be greater than or equal to ".concat(Rr));if(t.maxPitch!=null&&t.maxPitch>ml)throw new Error("maxPitch must be less than or equal to ".concat(ml));let i=new Ul,r=new Gl;if(t.minZoom!==void 0&&i.setMinZoom(t.minZoom),t.maxZoom!==void 0&&i.setMaxZoom(t.maxZoom),t.minPitch!==void 0&&i.setMinPitch(t.minPitch),t.maxPitch!==void 0&&i.setMaxPitch(t.maxPitch),t.renderWorldCopies!==void 0&&i.setRenderWorldCopies(t.renderWorldCopies),super(i,r,{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new wF,this._controls=[],this._mapId=k_(),this._contextLost=l=>{l.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new $("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new $("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes=nt({},t.canvasContextAttributes),this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._centerClampedToGround=t.centerClampedToGround,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=nt(nt({},EF),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Gi.addThrottleControl(()=>this.isMoving()),this._requestManager=new dC(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error("Container '".concat(t.container,"' not found."))}else if(t.container instanceof HTMLElement)this._container=t.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let l=!1,u=qv(h=>{this._trackResize&&!this._removed&&(this.resize(h),this.redraw())},50);this._resizeObserver=new ResizeObserver(h=>{if(!l){l=!0;return}u(h)}),this._resizeObserver.observe(this._container)}this.handlers=new _F(this,t);let n=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash&&new vO(n).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,K({},t.fitBoundsOptions,{duration:0}))));let a=typeof t.style=="string"||((s=(o=t.style)==null?void 0:o.projection)==null?void 0:s.type)!=="globe";this.resize(null,a),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new vF(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new bF,t.logoPosition),this.on("style.load",()=>{if(a||this._resizeTransform(),this.transform.unmodified){let l=Fo(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new $("".concat(l.dataType,"data"),l))}),this.on("dataloading",l=>{this.fire(new $("".concat(l.dataType,"dataloading"),l))}),this.on("dataabort",l=>{this.fire(new $("sourcedataabort",l))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(e.getDefaultPosition?t=e.getDefaultPosition():t="top-right"),!e||!e.onAdd)return this.fire(new ne(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t];return t.indexOf("bottom")!==-1?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new ne(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,i,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,t=!0){let[i,r]=this._containerDimensions(),n=this._getClampedPixelRatio(i,r);if(this._resizeCanvas(i,r,n),this.painter.resize(i,r,n),this.painter.overLimit()){let o=this.painter.context.gl;this._maxCanvasSize=[o.drawingBufferWidth,o.drawingBufferHeight];let s=this._getClampedPixelRatio(i,r);this._resizeCanvas(i,r,s),this.painter.resize(i,r,s)}this._resizeTransform(t);let a=!this._moving;return a&&(this.stop(),this.fire(new $("movestart",e)).fire(new $("move",e))),this.fire(new $("resize",e)),a&&this.fire(new $("moveend",e)),this}_resizeTransform(e=!0){var r;let[t,i]=this._containerDimensions();this.transform.resize(t,i,e),(r=this._requestedCameraState)==null||r.resize(t,i,e)}_getClampedPixelRatio(e,t){let{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),a=e*n,o=t*n,s=a>i?i/a:1,l=o>r?r/o:1;return Math.min(s,l)*n}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(Zi.convert(e)),this._update()}setMinZoom(e){if(e=e!=null?e:Il,e>=Il&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(Il," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if(e=e!=null?e:Zv,e>=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if(e=e!=null?e:Rr,e<Rr)throw new Error("minPitch must be greater than or equal to ".concat(Rr));if(e>=Rr&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(Rr," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if(e=e!=null?e:Wv,e>ml)throw new Error("maxPitch must be less than or equal to ".concat(ml));if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(oe.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(Ar.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||((e=this.handlers)==null?void 0:e.isMoving())}isZooming(){var e;return this._zooming||((e=this.handlers)==null?void 0:e.isZooming())}isRotating(){var e;return this._rotating||((e=this.handlers)==null?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if(e==="mouseenter"||e==="mouseover"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length?r||(r=!0,i.call(this,new si(e,this,n.originalEvent,{features:o}))):r=!1},mouseout:()=>{r=!1}}}}else if(e==="mouseleave"||e==="mouseout"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(o=>this.getLayer(o));(a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[]).length?r=!0:r&&(r=!1,i.call(this,new si(e,this,n.originalEvent)))},mouseout:n=>{r&&(r=!1,i.call(this,new si(e,this,n.originalEvent)))}}}}else{let r=n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length&&(n.features=o,i.call(this,n),delete n.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;let r=this._delegatedListeners[e];for(let n=0;n<r.length;n++){let a=r[n];if(a.listener===i&&a.layers.length===t.length&&a.layers.every(o=>t.includes(o))){for(let o in a.delegates)this.off(o,a.delegates[o]);r.splice(n,1);return}}}on(e,t,i){if(i===void 0)return super.on(e,t);let r=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(let a in n.delegates)this.on(a,n.delegates[a]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(i===void 0)return super.once(e,t);let r=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,r,i);for(let a in n.delegates){let o=n.delegates[a];n.delegates[a]=(...s)=>{this._removeDelegatedListener(e,r,i),o(...s)}}this._saveDelegatedListener(e,n);for(let a in n.delegates)this.once(a,n.delegates[a]);return this}off(e,t,i){if(i===void 0)return super.off(e,t);let r=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,r,i),this}queryRenderedFeatures(e,t){if(!this.style)return[];let i,r=e instanceof Ar.default||Array.isArray(e),n=r?e:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(r?{}:e)||{},n instanceof Ar.default||typeof n[0]=="number")i=[Ar.default.convert(n)];else{let a=Ar.default.convert(n[0]),o=Ar.default.convert(n[1]);i=[a,new Ar.default(o.x,a.y),o,new Ar.default(a.x,o.y),a]}return this.style.queryRenderedFeatures(i,t,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=K({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw new Error("Missing UI string '".concat(e,"'"));return t}_updateStyle(e,t){var r,n;if(t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let i=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new lg(this,t||{});else return(n=(r=this.style)==null?void 0:r.projection)==null||n.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new lg(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,t){if(typeof e=="string"){let i=e,r=this._requestManager.transformRequest(i,"Style");Kl(r,new AbortController).then(n=>{this._updateDiff(n.data,t)}).catch(n=>{n&&this.fire(new ne(n))})}else typeof e=="object"&&this._updateDiff(e,t)}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(i){ct("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():ct("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style&&this.style.sourceCaches[e];if(t===void 0){this.fire(new ne(new Error("There is no source with ID '".concat(e,"'"))));return}return t.loaded()}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this._centerClampedToGround&&this.transform.setElevation(0);else{let t=this.style.sourceCaches[e.source];if(!t)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));this.terrain===null&&t.reload();for(let i in this.style._layers){let r=this.style._layers[i];r.type==="hillshade"&&r.source===e.source&&ct("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),r.type==="color-relief"&&r.source===e.source&&ct("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new CF(this.painter,t,e),this.painter.renderToTexture=new IF(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var r;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===e.source&&!this._elevationFreeze&&(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((r=i.source)==null?void 0:r.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new $("terrain",{terrain:e})),this}getTerrain(){var e,t;return(t=(e=this.terrain)==null?void 0:e.options)!=null?t:null}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let i=e[t]._tiles;for(let r in i){let n=i[r];if(!(n.state==="loaded"||n.state==="errored"))return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let r=this.getSource(i);if(!r)throw new Error('There is no source with ID "'.concat(i,'", cannot set LOD parameters'));r.calculateTileZoom=sp(Math.max(1,e),Math.max(1,t))}else for(let r in this.style.sourceCaches)this.style.sourceCaches[r].getSource().calculateTileZoom=sp(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let i=this.style.sourceCaches[e];if(!i)throw new Error('There is no source cache with ID "'.concat(e,'", cannot refresh tile'));t===void 0?i.reload(!0):i.refreshTiles(t.map(r=>new Pu(r.z,r.x,r.y)))}addImage(e,t,i={}){let{pixelRatio:r=1,sdf:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}=i;this._lazyInitEmptyStyle();let h=0;if(t instanceof HTMLImageElement||hr(t)){let{width:c,height:p,data:d}=ve.getImageData(t);this.style.addImage(e,{data:new Ye({width:c,height:p},d),pixelRatio:r,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:h})}else{if(t.width===void 0||t.height===void 0)return this.fire(new ne(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:c,height:p,data:d}=t,f=t;return this.style.addImage(e,{data:new Ye({width:c,height:p},new Uint8Array(d)),pixelRatio:r,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:h,userImage:f}),f.onAdd&&f.onAdd(this,e),this}}}updateImage(e,t){let i=this.style.getImage(e);if(!i)return this.fire(new ne(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let r=t instanceof HTMLImageElement||hr(t)?ve.getImageData(t):t,{width:n,height:a,data:o}=r;if(n===void 0||a===void 0)return this.fire(new ne(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==i.data.width||a!==i.data.height)return this.fire(new ne(new Error("The width and height of the updated image must be that same as the previous version of the image")));let s=!(t instanceof HTMLImageElement||hr(t));return i.data.replace(o,s),this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new ne(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return Gi.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,r=>{r||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,i=>{i||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=be.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=be.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);let n=this._controlContainer=be.create("div","maplibregl-control-container",e),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(o=>{a[o]=be.create("div","maplibregl-ctrl-".concat(o," "),n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width="".concat(e,"px"),this._canvas.style.height="".concat(t,"px")}_setupPainter(){let e=ri(nt({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{t={requestedAttributes:e},r&&(t.statusMessage=r.statusMessage,t.type=r.type)},{once:!0});let i=null;if(this._canvasContextAttributes.contextType?i=this._canvas.getContext(this._canvasContextAttributes.contextType,e):i=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){let r="Failed to initialize WebGL";throw t?(t.message=r,new Error(JSON.stringify(t))):new Error(r)}this.painter=new xO(i,this.transform),Mp.testSupport(i)}migrateProjection(e,t){super.migrateProjection(e,t),this.painter.transform=e,this.fire(new $("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var o,s,l,u,h;let t=this._idleTriggered?this._fadeDuration:0,i=((o=this.style.projection)==null?void 0:o.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let c=this.transform.zoom,p=ve.now();this.style.zoomHistory.update(c,p);let d=new lt(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),f=d.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=f),this.style.update(d)}let n=((s=this.style.projection)==null?void 0:s.transitionState)>0!==i;(l=this.style.projection)==null||l.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((u=this.style.projection)==null?void 0:u.transitionState,(h=this.style.projection)==null?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||n)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):this._centerClampedToGround&&this.transform.setElevation(0),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,n),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new $("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,to.mark("load"),this.fire(new $("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new $("idle")),this._loaded&&!this._fullyLoaded&&!a&&(this._fullyLoaded=!0,to.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Gi.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)==null||t.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),be.remove(this._canvasContainer),be.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),to.clearMetrics(),this._removed=!0,this.fire(new $("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ve.frame(this._frameRequest,e=>{to.frame(e),this._frameRequest=null;try{this._render(e)}catch(t){if(!nC(t)&&!IB(t))throw t}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return AF}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},Xj=se(ce(),1);var qj=se(ce(),1);var $j=se(ce(),1);var Yj=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var kF=se(ce(),1),Zj=Cg.version;function Wj(e){jr.WORKER_URL=e}var Hj=kF.default;A();var t$={top:0,bottom:0,left:0,right:0,type:"pixel"},Wo={enabled:!1,thickness:0,size:0,offset:0,segments:3};function i$(e,t){var i,r,n,a,o;return{bevelEnabled:(i=e==null?void 0:e.enabled)!=null?i:Wo.enabled,bevelThickness:(r=e==null?void 0:e.thickness)!=null?r:Wo.thickness,bevelSize:(n=e==null?void 0:e.size)!=null?n:(e==null?void 0:e.thickness)||Wo.size,bevelOffset:(a=e==null?void 0:e.offset)!=null?a:Wo.offset,bevelSegments:(o=e==null?void 0:e.segments)!=null?o:Wo.segments,depth:t}}var Hv="mappedin";var Kv={MASKS:12,GEOMETRY:0,IMAGE_MESH:1,XRAY_PATH:9,STENCIL_PATH:10,ALWAYS_ON_TOP_PATHS:11,ALWAYS_ON_TOP_MODELS:12},r$={SHOULD_CAST_SHADOWS:30},n$={PATH:1,UNDERGROUND_MASK:251,CLIPPING_BASELINE:252},a$=250,o$={tension:0,cornerRadius:.5};A();function DF(e,t,i){let r={translateX:e.x,translateY:e.y,translateZ:e.z,scale:e.meterInMercatorCoordinateUnits()},n=new rr,a=new rr().makeTranslation(r.translateX,r.translateY,r.translateZ).scale(new Ve(r.scale,-r.scale,r.scale));return{id:Hv,type:"custom",renderingMode:"3d",render:(o,s)=>{n.fromArray(s.defaultProjectionData.mainMatrix),t.projectionMatrix.copy(n).multiply(a),i()}}}A();function LF(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}A();var RF=e=>t=>{if(!t.includes("mappedin")){let i={};for(let r in e){let n=e[r];t.includes("mappedin")||(e[r]=n)}return{url:t,headers:i}}return{url:t,headers:e}};A();function Au(e){return(e%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}A();var zF=1e4;function BF(e,t){var n;let i=(n=t==null?void 0:t.timeout)!=null?n:zF,r=t==null?void 0:t.styleUrl;return new Promise((a,o)=>{let s=!1,l=()=>{e.off("style.load",u),e.off("error",h),clearTimeout(c)},u=()=>{s||(s=!0,l(),a())},h=p=>{var y,g;let d=(y=p.error)==null?void 0:y.url;if((d==null?void 0:d.includes("style"))||r&&d===r){if(s)return;s=!0,l(),o(new Error("Style loading failed: ".concat(((g=p.error)==null?void 0:g.message)||"Unknown error")))}},c=setTimeout(()=>{s||(s=!0,l(),o(new Error("Style loading timed out")))},i);e.once("style.load",u),e.on("error",h)})}A();A();A();A();A();A();A();A();var At=63710088e-1,Qv={centimeters:At*100,centimetres:At*100,degrees:At/111325,feet:At*3.28084,inches:At*39.37,kilometers:At/1e3,kilometres:At/1e3,meters:At,metres:At,miles:At/1609.344,millimeters:At*1e3,millimetres:At*1e3,nauticalmiles:At/1852,radians:1,yards:At*1.0936},P$={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/At,yards:1.0936133};function qr(e,t,i){i===void 0&&(i={});var r={type:"Feature"};return(i.id===0||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function OF(e,t,i){if(i===void 0&&(i={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Jv(e[0])||!Jv(e[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:e};return qr(r,t,i)}function T$(e,t,i){i===void 0&&(i={});for(var r=0,n=e;r<n.length;r++){var a=n[r];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var o=0;o<a[a.length-1].length;o++)if(a[a.length-1][o]!==a[0][o])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:e};return qr(s,t,i)}function eb(e,t,i){if(i===void 0&&(i={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var r={type:"LineString",coordinates:e};return qr(r,t,i)}function S$(e,t){t===void 0&&(t={});var i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function C$(e,t,i){i===void 0&&(i={});var r={type:"MultiLineString",coordinates:e};return qr(r,t,i)}function M$(e,t,i){i===void 0&&(i={});var r={type:"MultiPolygon",coordinates:e};return qr(r,t,i)}function I$(e,t){t===void 0&&(t="kilometers");var i=Qv[t];if(!i)throw new Error(t+" units is invalid");return e*i}function E$(e,t){t===void 0&&(t="kilometers");var i=Qv[t];if(!i)throw new Error(t+" units is invalid");return e/i}function A$(e){var t=e%(2*Math.PI);return t*180/Math.PI}function k$(e){var t=e%360;return t*Math.PI/180}function Jv(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function ku(e,t,i){if(e!==null)for(var r,n,a,o,s,l,u,h=0,c=0,p,d=e.type,f=d==="FeatureCollection",y=d==="Feature",g=f?e.features.length:1,_=0;_<g;_++){u=f?e.features[_].geometry:y?e.geometry:e,p=u?u.type==="GeometryCollection":!1,s=p?u.geometries.length:1;for(var b=0;b<s;b++){var v=0,w=0;if(o=p?u.geometries[b]:u,o!==null){l=o.coordinates;var T=o.type;switch(h=i&&(T==="Polygon"||T==="MultiPolygon")?1:0,T){case null:break;case"Point":if(t(l,c,_,v,w)===!1)return!1;c++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(t(l[r],c,_,v,w)===!1)return!1;c++,T==="MultiPoint"&&v++}T==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-h;n++){if(t(l[r][n],c,_,v,w)===!1)return!1;c++}T==="MultiLineString"&&v++,T==="Polygon"&&w++}T==="Polygon"&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(w=0,n=0;n<l[r].length;n++){for(a=0;a<l[r][n].length-h;a++){if(t(l[r][n][a],c,_,v,w)===!1)return!1;c++}w++}v++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(ku(o.geometries[r],t,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function B$(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var i=0;i<e.features.length&&t(e.features[i],i)!==!1;i++);}function FF(e,t){var i,r,n,a,o,s,l,u,h,c,p=0,d=e.type==="FeatureCollection",f=e.type==="Feature",y=d?e.features.length:1;for(i=0;i<y;i++){for(s=d?e.features[i].geometry:f?e.geometry:e,u=d?e.features[i].properties:f?e.properties:{},h=d?e.features[i].bbox:f?e.bbox:void 0,c=d?e.features[i].id:f?e.id:void 0,l=s?s.type==="GeometryCollection":!1,o=l?s.geometries.length:1,n=0;n<o;n++){if(a=l?s.geometries[n]:s,a===null){if(t(null,p,u,h,c)===!1)return!1;continue}switch(a.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(a,p,u,h,c)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],p,u,h,c)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}p++}}function NF(e,t){FF(e,function(i,r,n,a,o){var s=i===null?null:i.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(qr(i,n,{bbox:a,id:o}),r,0)===!1?!1:void 0}var l;switch(s){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var u=0;u<i.coordinates.length;u++){var h=i.coordinates[u],c={type:l,coordinates:h};if(t(qr(c,n),r,u)===!1)return!1}})}function VF(e,t){NF(e,function(i,r,n){var a=0;if(i.geometry){var o=i.geometry.type;if(!(o==="Point"||o==="MultiPoint")){var s,l=0,u=0,h=0;if(ku(i,function(c,p,d,f,y){if(s===void 0||r>l||f>u||y>h){s=c,l=r,u=f,h=y,a=0;return}var g=eb([s,c],i.properties);if(t(g,r,n,y,a)===!1)return!1;a++,s=c})===!1)return!1}}})}function O$(e,t,i){var r=i,n=!1;return VF(e,function(a,o,s,l,u){n===!1&&i===void 0?r=a:r=t(r,a,o,s,l,u),n=!0}),r}function Od(e){var t=[1/0,1/0,-1/0,-1/0];return ku(e,function(i){t[0]>i[0]&&(t[0]=i[0]),t[1]>i[1]&&(t[1]=i[1]),t[2]<i[0]&&(t[2]=i[0]),t[3]<i[1]&&(t[3]=i[1])}),t}Od.default=Od;var tb=Od;function ib(e){return tb(e)}A();A();var jF=new Set(Object.keys(fi.NAMES));var UF=e=>jF.has(e.toLowerCase()),GF=e=>{if(!e.startsWith("#"))return!1;let t=e.slice(1);if(t.length!==3&&t.length!==6)return!1;for(let i=0;i<t.length;i++)if(!(t[i]>="0"&&t[i]<="9"||t[i]>="A"&&t[i]<="F"||t[i]>="a"&&t[i]<="f"))return!1;return!0},XF=e=>{if(!e.startsWith("rgb(")&&!e.startsWith("rgba("))return!1;let t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t||i!==e.length-1)return!1;let r=e.slice(t+1,i).split(",");if(r.length!==3&&r.length!==4)return!1;for(let n=0;n<r.length;n++){let a=r[n].trim();if(n<3)if(a.endsWith("%")){let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseInt(a,10);if(isNaN(o)||o<0||o>255)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0},qF=e=>{if(!e.startsWith("hsl(")&&!e.startsWith("hsla("))return!1;let t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t||i!==e.length-1)return!1;let r=e.slice(t+1,i).split(",");if(r.length!==3&&r.length!==4)return!1;for(let n=0;n<r.length;n++){let a=r[n].trim();if(n===0){let o=parseFloat(a);if(isNaN(o))return!1}else if(n<3){if(!a.endsWith("%"))return!1;let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0};var Du=e=>e==null||typeof e!="string"?!1:!!(GF(e)||XF(e)||qF(e)||UF(e));A();A();A();A();var Sa=class{constructor(){P(this,"type","interaction");P(this,"hover",!1);P(this,"dirty",!1)}};A();A();var Ho=class{constructor(t,i,r=0,n){P(this,"id");P(this,"type");P(this,"component");P(this,"worldPosition");P(this,"verticalOffset");P(this,"disposed",!1);P(this,"positionDirty",!0);P(this,"parentId");this.id=t.id,this.component=t,this.type=t.type,this.worldPosition={x:i.x,y:i.y,z:i.z+r},this.verticalOffset=r,this.parentId=n}updatePosition(t,i,r){this.worldPosition.x=t,this.worldPosition.y=i,this.worldPosition.z=r,this.positionDirty=!0}setAltitude(t){this.worldPosition.z=t,this.positionDirty=!0}};A();A();A();var Fd=[0,4,6,8,10],$r=()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let r=0;r<e.length;r++)r>0&&(r&3)===0&&(t=Math.random()*4294967296),e[r]=t>>>((r&3)<<3)&255;let i=e.map(r=>r.toString(16).padStart(2,"0"));return i[6]="4"+i[6][1],i[8]=["8","9","a","b"].includes(i[7][0])?i[7]:"a"+i[7][1],Fd.map((r,n)=>i.slice(r,n===Fd.length-1?void 0:Fd[n+1]).join("")).join("-")};function t7(e,t=0){let i=3735928559^t,r=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),i=Math.imul(i^a,2654435761),r=Math.imul(r^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&r)+(i>>>0)}A();import{z as Nd}from"zod";A();var Vd=Nd.union([Nd.enum(["low","medium","high","always-visible"]),Nd.number()]),rb=["","","low","medium","high","always-visible"];function nb(e){return Math.min(5,Math.max(2,e))}function Mn(e){if(typeof e=="number")return nb(e);let t=rb.indexOf(e);return t===-1?3:t}function ZF(e){let t=nb(e);return rb[t]}A();A();import{z as fe}from"zod";A();function Lu(e){"@babel/helpers - typeof";return Lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(e)}var WF=/^\s+/,HF=/\s+$/;function Q(e,t){if(e=e||"",t=t||{},e instanceof Q)return e;if(!(this instanceof Q))return new Q(e,t);var i=KF(e);this._originalInput=e,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||i.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}Q.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),i,r,n,a,o,s;return i=t.r/255,r=t.g/255,n=t.b/255,i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),.2126*a+.7152*o+.0722*s},setAlpha:function(t){return this._a=cb(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=ob(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=ob(this._r,this._g,this._b),i=Math.round(t.h*360),r=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+i+", "+r+"%, "+n+"%)":"hsva("+i+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=ab(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ab(this._r,this._g,this._b),i=Math.round(t.h*360),r=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+i+", "+r+"%, "+n+"%)":"hsla("+i+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return sb(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return t5(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Je(this._r,255)*100)+"%",g:Math.round(Je(this._g,255)*100)+"%",b:Math.round(Je(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Je(this._r,255)*100)+"%, "+Math.round(Je(this._g,255)*100)+"%, "+Math.round(Je(this._b,255)*100)+"%)":"rgba("+Math.round(Je(this._r,255)*100)+"%, "+Math.round(Je(this._g,255)*100)+"%, "+Math.round(Je(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:d5[sb(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var i="#"+lb(this._r,this._g,this._b,this._a),r=i,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=Q(t);r="#"+lb(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+i+",endColorstr="+r+")"},toString:function(t){var i=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,a=!i&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return a?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return Q(this.toString())},_applyModification:function(t,i){var r=t.apply(null,[this].concat([].slice.call(i)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(a5,arguments)},brighten:function(){return this._applyModification(o5,arguments)},darken:function(){return this._applyModification(s5,arguments)},desaturate:function(){return this._applyModification(i5,arguments)},saturate:function(){return this._applyModification(r5,arguments)},greyscale:function(){return this._applyModification(n5,arguments)},spin:function(){return this._applyModification(l5,arguments)},_applyCombination:function(t,i){return t.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(c5,arguments)},complement:function(){return this._applyCombination(u5,arguments)},monochromatic:function(){return this._applyCombination(p5,arguments)},splitcomplement:function(){return this._applyCombination(h5,arguments)},triad:function(){return this._applyCombination(ub,[3])},tetrad:function(){return this._applyCombination(ub,[4])}};Q.fromRatio=function(e,t){if(Lu(e)=="object"){var i={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?i[r]=e[r]:i[r]=Ko(e[r]));e=i}return Q(e,t)};function KF(e){var t={r:0,g:0,b:0},i=1,r=null,n=null,a=null,o=!1,s=!1;return typeof e=="string"&&(e=g5(e)),Lu(e)=="object"&&(yr(e.r)&&yr(e.g)&&yr(e.b)?(t=JF(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):yr(e.h)&&yr(e.s)&&yr(e.v)?(r=Ko(e.s),n=Ko(e.v),t=e5(e.h,r,n),o=!0,s="hsv"):yr(e.h)&&yr(e.s)&&yr(e.l)&&(r=Ko(e.s),a=Ko(e.l),t=QF(e.h,r,a),o=!0,s="hsl"),e.hasOwnProperty("a")&&(i=e.a)),i=cb(i),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:i}}function JF(e,t,i){return{r:Je(e,255)*255,g:Je(t,255)*255,b:Je(i,255)*255}}function ab(e,t,i){e=Je(e,255),t=Je(t,255),i=Je(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=(r+n)/2;if(r==n)a=o=0;else{var l=r-n;switch(o=s>.5?l/(2-r-n):l/(r+n),r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,l:s}}function QF(e,t,i){var r,n,a;e=Je(e,360),t=Je(t,100),i=Je(i,100);function o(u,h,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?u+(h-u)*6*c:c<1/2?h:c<2/3?u+(h-u)*(2/3-c)*6:u}if(t===0)r=n=a=i;else{var s=i<.5?i*(1+t):i+t-i*t,l=2*i-s;r=o(l,s,e+1/3),n=o(l,s,e),a=o(l,s,e-1/3)}return{r:r*255,g:n*255,b:a*255}}function ob(e,t,i){e=Je(e,255),t=Je(t,255),i=Je(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=r,l=r-n;if(o=r===0?0:l/r,r==n)a=0;else{switch(r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,v:s}}function e5(e,t,i){e=Je(e,360)*6,t=Je(t,100),i=Je(i,100);var r=Math.floor(e),n=e-r,a=i*(1-t),o=i*(1-n*t),s=i*(1-(1-n)*t),l=r%6,u=[i,o,a,a,s,i][l],h=[s,i,i,o,a,a][l],c=[a,a,s,i,i,o][l];return{r:u*255,g:h*255,b:c*255}}function sb(e,t,i,r){var n=[Ci(Math.round(e).toString(16)),Ci(Math.round(t).toString(16)),Ci(Math.round(i).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function t5(e,t,i,r,n){var a=[Ci(Math.round(e).toString(16)),Ci(Math.round(t).toString(16)),Ci(Math.round(i).toString(16)),Ci(pb(r))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function lb(e,t,i,r){var n=[Ci(pb(r)),Ci(Math.round(e).toString(16)),Ci(Math.round(t).toString(16)),Ci(Math.round(i).toString(16))];return n.join("")}Q.equals=function(e,t){return!e||!t?!1:Q(e).toRgbString()==Q(t).toRgbString()};Q.random=function(){return Q.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function i5(e,t){t=t===0?0:t||10;var i=Q(e).toHsl();return i.s-=t/100,i.s=Ru(i.s),Q(i)}function r5(e,t){t=t===0?0:t||10;var i=Q(e).toHsl();return i.s+=t/100,i.s=Ru(i.s),Q(i)}function n5(e){return Q(e).desaturate(100)}function a5(e,t){t=t===0?0:t||10;var i=Q(e).toHsl();return i.l+=t/100,i.l=Ru(i.l),Q(i)}function o5(e,t){t=t===0?0:t||10;var i=Q(e).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(t/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(t/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(t/100)))),Q(i)}function s5(e,t){t=t===0?0:t||10;var i=Q(e).toHsl();return i.l-=t/100,i.l=Ru(i.l),Q(i)}function l5(e,t){var i=Q(e).toHsl(),r=(i.h+t)%360;return i.h=r<0?360+r:r,Q(i)}function u5(e){var t=Q(e).toHsl();return t.h=(t.h+180)%360,Q(t)}function ub(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Q(e).toHsl(),r=[Q(e)],n=360/t,a=1;a<t;a++)r.push(Q({h:(i.h+a*n)%360,s:i.s,l:i.l}));return r}function h5(e){var t=Q(e).toHsl(),i=t.h;return[Q(e),Q({h:(i+72)%360,s:t.s,l:t.l}),Q({h:(i+216)%360,s:t.s,l:t.l})]}function c5(e,t,i){t=t||6,i=i||30;var r=Q(e).toHsl(),n=360/i,a=[Q(e)];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,a.push(Q(r));return a}function p5(e,t){t=t||6;for(var i=Q(e).toHsv(),r=i.h,n=i.s,a=i.v,o=[],s=1/t;t--;)o.push(Q({h:r,s:n,v:a})),a=(a+s)%1;return o}Q.mix=function(e,t,i){i=i===0?0:i||50;var r=Q(e).toRgb(),n=Q(t).toRgb(),a=i/100,o={r:(n.r-r.r)*a+r.r,g:(n.g-r.g)*a+r.g,b:(n.b-r.b)*a+r.b,a:(n.a-r.a)*a+r.a};return Q(o)};Q.readability=function(e,t){var i=Q(e),r=Q(t);return(Math.max(i.getLuminance(),r.getLuminance())+.05)/(Math.min(i.getLuminance(),r.getLuminance())+.05)};Q.isReadable=function(e,t,i){var r=Q.readability(e,t),n,a;switch(a=!1,n=_5(i),n.level+n.size){case"AAsmall":case"AAAlarge":a=r>=4.5;break;case"AAlarge":a=r>=3;break;case"AAAsmall":a=r>=7;break}return a};Q.mostReadable=function(e,t,i){var r=null,n=0,a,o,s,l;i=i||{},o=i.includeFallbackColors,s=i.level,l=i.size;for(var u=0;u<t.length;u++)a=Q.readability(e,t[u]),a>n&&(n=a,r=Q(t[u]));return Q.isReadable(e,r,{level:s,size:l})||!o?r:(i.includeFallbackColors=!1,Q.mostReadable(e,["#fff","#000"],i))};var jd=Q.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",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",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",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:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},d5=Q.hexNames=f5(jd);function f5(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}function cb(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Je(e,t){m5(e)&&(e="100%");var i=y5(e);return e=Math.min(t,Math.max(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Ru(e){return Math.min(1,Math.max(0,e))}function Zt(e){return parseInt(e,16)}function m5(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function y5(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ci(e){return e.length==1?"0"+e:""+e}function Ko(e){return e<=1&&(e=e*100+"%"),e}function pb(e){return Math.round(parseFloat(e)*255).toString(16)}function hb(e){return Zt(e)/255}var Si=(function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",i="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",n="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function yr(e){return!!Si.CSS_UNIT.exec(e)}function g5(e){e=e.replace(WF,"").replace(HF,"").toLowerCase();var t=!1;if(jd[e])e=jd[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=Si.rgb.exec(e))?{r:i[1],g:i[2],b:i[3]}:(i=Si.rgba.exec(e))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=Si.hsl.exec(e))?{h:i[1],s:i[2],l:i[3]}:(i=Si.hsla.exec(e))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=Si.hsv.exec(e))?{h:i[1],s:i[2],v:i[3]}:(i=Si.hsva.exec(e))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=Si.hex8.exec(e))?{r:Zt(i[1]),g:Zt(i[2]),b:Zt(i[3]),a:hb(i[4]),format:t?"name":"hex8"}:(i=Si.hex6.exec(e))?{r:Zt(i[1]),g:Zt(i[2]),b:Zt(i[3]),format:t?"name":"hex"}:(i=Si.hex4.exec(e))?{r:Zt(i[1]+""+i[1]),g:Zt(i[2]+""+i[2]),b:Zt(i[3]+""+i[3]),a:hb(i[4]+""+i[4]),format:t?"name":"hex8"}:(i=Si.hex3.exec(e))?{r:Zt(i[1]+""+i[1]),g:Zt(i[2]+""+i[2]),b:Zt(i[3]+""+i[3]),format:t?"name":"hex"}:!1}function _5(e){var t,i;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),i=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:t,size:i}}var dt={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},Yr="low-priority",Ud=Object.values(dt),Jo=[dt.RIGHT,dt.LEFT,dt.TOP,dt.HIDDEN],x5=fe.string(),v5=fe.object({on:fe.literal("zoom-level"),input:fe.tuple([fe.number()]).rest(fe.number()),output:fe.tuple([fe.number()]).rest(fe.number()),easing:x5.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"}),db=fe.object({margin:fe.number().min(6).default(6),maxLines:fe.number().min(1).default(2),textSize:fe.number().min(0).default(11.5),maxWidth:fe.number().min(0).default(150),lineHeight:fe.number().min(0).default(1.2),color:fe.string().default("#333"),outlineColor:fe.string().default("white"),textColor:fe.string().optional(),textOutlineColor:fe.string().optional(),pinColor:fe.string().optional(),pinOutlineColor:fe.string().optional(),pinColorInactive:fe.string().optional(),pinOutlineColorInactive:fe.string().optional(),icon:fe.string().optional(),iconSize:fe.number().min(0).default(20),iconScale:fe.union([fe.number(),v5]).default(1),iconPadding:fe.number().min(0).default(2),iconFit:fe.enum(["fill","contain","cover"]).default("cover"),iconOverflow:fe.enum(["visible","hidden"]).default("hidden"),iconVisible:fe.union([fe.boolean(),fe.number()]).default(!0),opacity:fe.number().min(0).max(1).default(1),__EXPERIMENTAL_wrapperBackgroundColor:fe.string().optional(),__EXPERIMENTAL_wrapperPaddingX:fe.number().min(0).default(0),__EXPERIMENTAL_wrapperPaddingY:fe.number().min(0).default(0),__EXPERIMENTAL_wrapperBorderRadius:fe.number().min(0).default(0),__EXPERIMENTAL_wrapperDotSize:fe.number().min(0).default(0),__EXPERIMENTAL_wrapperShadowColor:fe.string().optional(),__EXPERIMENTAL_wrapperShadowOffsetX:fe.number().default(0),__EXPERIMENTAL_wrapperShadowOffsetY:fe.number().default(0),__EXPERIMENTAL_wrapperShadowBlur:fe.number().min(0).default(0)}),zu=e=>{var n,a;let t=nt({},e);t.color!=null&&(t.textColor==null&&(t.textColor=t.color),t.pinColor==null&&(t.pinColor=t.color)),t.outlineColor!=null&&(t.textOutlineColor==null&&(t.textOutlineColor=t.outlineColor),t.pinOutlineColor==null&&(t.pinOutlineColor=t.outlineColor));let i=(n=t.pinColor)!=null?n:t.color,r=(a=t.pinOutlineColor)!=null?a:t.outlineColor;return i!=null&&t.pinColorInactive==null&&(t.pinColorInactive=Q(i).toRgbString()),r!=null&&t.pinOutlineColorInactive==null&&(t.pinOutlineColorInactive=Q(r).toRgbString()),t},Bu=db.transform(e=>zu(e)),Gd=e=>Bu.parse(e);var Xd=(e,t)=>["color","outlineColor","maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"].some(r=>t[r]!=null&&e[r]!==t[r]),qd=(e,t)=>["color","outlineColor","icon","iconSize","iconScale","iconVisible","iconPadding","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"].some(r=>t[r]!=null&&e[r]!==t[r]),$d=(e,t)=>{var i,r;return t.textPlacement!=null&&e.textPlacement!==t.textPlacement||((i=t.appearance)==null?void 0:i.margin)!=null&&((r=e.appearance)==null?void 0:r.margin)!==t.appearance.margin};var fb=4,b5=6,_b=6.5,Ou=_b/2,mb=[Ou,Ou,Ou,Ou],Qo=class Qo{constructor(t,i,r){P(this,"lines",0);P(this,"id");P(this,"rank");P(this,"type","label");P(this,"initialRank");P(this,"contextConfigured",!1);P(this,"fillText");P(this,"newStyle",{});P(this,"currentOpacity",0);P(this,"visibilityNeedsUpdate",!1);P(this,"activePlacement",dt.RIGHT);P(this,"text");P(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});P(this,"projection",{x:0,y:0});P(this,"labelCacheId");P(this,"_cache",{});P(this,"appearance");P(this,"options");P(this,"visible",!0);P(this,"enabled",!0);P(this,"interactive",!1);P(this,"isOccluded",!1);P(this,"offscreen",!1);P(this,"canShow",!1);P(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});P(this,"dimensions",{width:0,height:0});P(this,"currentStrategyIndex",-1);P(this,"totalPinSize",0);P(this,"iconScale",1);P(this,"iconPadding");P(this,"dirty",!0);P(this,"textDirty",!0);P(this,"pinDirty",!0);P(this,"attachedDirty",!0);P(this,"collisionDirty",!0);P(this,"lastTextAlign");P(this,"imageHash");P(this,"pinSize",0);P(this,"iconVisible",!1);P(this,"dp");P(this,"_cachedStrategies",null);P(this,"animate",!0);P(this,"onStrategySelected",t=>{var r;if(this.currentStrategyIndex===t)return;this.currentStrategyIndex=t;let i=this.strategies[t];if(this.activePlacement=(r=i==null?void 0:i.name)!=null?r:this.activePlacement,i){i.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}});P(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var a,o,s;if(this.id=(a=i.id)!=null?a:$r(),this.options=i!=null?i:{},this.text=t,this.dp=(l=1)=>l*r,typeof i.rank=="string")this.rank=Mn(i.rank),this.initialRank=this.rank;else if(i.rank!=null&&i.rank>0)this.rank=i.rank,this.initialRank=i.rank;else{let l=Math.trunc(Qo.testId*10)/10;Qo.testId+=.001,this.rank=l,this.initialRank=l}this.options.textPlacement=(o=i.textPlacement)!=null?o:Jo;let n=Gd((s=i.appearance)!=null?s:{});this.appearance=n,this.iconPadding=n.iconPadding}get scaledPinSize(){return this.totalPinSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}get textVisible(){return this.offscreen||!this.visible||!this.canShow||!this.enabled?!1:this.style.textLabelVisible===!0&&this.style.textAlign!=null&&this.style.left!=null&&this.style.top!=null}calculatePinSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.pinSize=this.dp(this.appearance.iconSize):this.pinSize=this.dp(_b),this.totalPinSize=Math.ceil((this.pinSize+2.5)/t)}getNoTextBbox(t){let i=this.scaledPinSize/2+t;return[i,i,i,i]}getHiddenTextPlacementBbox(t){return this.iconVisible?this.getNoTextBbox(t):mb}getBoundingBoxForPlacement(t){let{width:i,height:r}=this.dimensions,{margin:n}=this.appearance,a=Math.max(b5,n);if(this.text==="")return this.getNoTextBbox(a);let o=Math.max(this.scaledPinSize,r);switch(t){case dt.RIGHT:return[o/2+a,o/2+a,this.scaledPinSize/2+a,this.scaledPinSize/2+i+a];case dt.LEFT:return[o/2+a,o/2+a,this.scaledPinSize/2+i+a,this.scaledPinSize/2+a];case dt.TOP:{let s=this.dp();return[r+this.scaledPinSize/2/s+a,this.scaledPinSize/2+a,i/2+a,i/2+a]}case dt.CENTER:return[r/2+a,r/2+a,i/2+a,i/2+a];case dt.HIDDEN:return this.getHiddenTextPlacementBbox(a);case Yr:return mb;default:return this.getNoTextBbox(a)}}getStrategyStyleForPlacement(t){let{width:i,height:r}=this.dimensions;switch(t){case dt.TOP:this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.scaledPinSize/2,this.newStyle.left=-i/2;return;case dt.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-i-this.scaledPinSize/2-fb,this.newStyle.textLabelVisible=!0;return;case dt.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.scaledPinSize/2+fb,this.newStyle.textLabelVisible=!0;return;case dt.CENTER:this.newStyle.pinVisibility=0,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r/2,this.newStyle.left=-i/2;return;case dt.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case Yr:default:this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return}}invalidateStrategies(){this._cachedStrategies=null}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let t=Array.isArray(this.options.textPlacement)?this.options.textPlacement:[this.options.textPlacement],i=[],r=!1;for(let n of t)this.options.rank==="always-visible"&&n===dt.HIDDEN&&t.length>1||(i.push({name:n,getBoundingBox:()=>this.getBoundingBoxForPlacement(n),onStrategySelected:()=>this.getStrategyStyleForPlacement(n)}),n===dt.HIDDEN&&(r=!0));return r&&i.push({name:Yr,getBoundingBox:()=>this.getBoundingBoxForPlacement(Yr),onStrategySelected:()=>this.getStrategyStyleForPlacement(Yr)}),this._cachedStrategies=i,i}recomputeCurrentStrategy(t=this.iconScale){let i=this.iconScale!==t;if(i||this.dirty){let r=this.pinDirty,n=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,i&&!r&&this.calculatePinSize(),n){n.onStrategySelected();let a=this.style;this.style=this.newStyle,this.newStyle=a}this.dirty=!1}}toPackedMessage(t=!1){var s;let i=this.strategies[this.currentStrategyIndex],r=this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.text!==""&&i!=null&&i.name!==dt.HIDDEN&&i.name!==Yr;if(this.visible&&t&&this.collisionDirty===!1&&r?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,r&&this.currentStrategyIndex!==((s=this.packedMessage.bboxes[0])==null?void 0:s[4])){let l=this.packedMessage.bboxes;for(let u=1;u<l.length;u++)if(l[u][4]===this.currentStrategyIndex){let h=l[0];l[0]=l[u],l[u]=h;break}}if(!this.collisionDirty)return this.packedMessage;let n=[],a=this.strategies,o=-1;for(let l=0;l<a.length;l++){let u=a[l].getBoundingBox();n.push([u[0],u[1],u[2],u[3],l]),r&&l===this.currentStrategyIndex&&(o=n.length-1)}if(o>0){let l=n[0];n[0]=n[o],n[o]=l}return this.packedMessage.bboxes=n,this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};P(Qo,"testId",0);var Zr=Qo,Fu=Zr;A();var Wb=jf(Yb());A();var Ge={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center",TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",HIDDEN:"hidden"},nf=Object.values(Ge),af=[Ge.CENTER,Ge.HIDDEN],Zb=Object.freeze({size:8,color:"#666"});var os=class os{constructor(t,i={}){P(this,"id");P(this,"type","marker");P(this,"rank",0);P(this,"initialRank",0);P(this,"activePlacement","center");P(this,"pointerEvents","none");P(this,"options",{rank:"low",interactive:!1,id:"",placement:af,dynamicResize:!1,occlude:!0,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:nt({},Zb),animated:!0});P(this,"projection",{x:0,y:0});P(this,"enabled",!0);P(this,"interactive",!1);P(this,"canShow",!1);P(this,"visible",!0);P(this,"isOccluded",!1);P(this,"offscreen",!1);P(this,"strategyIndex",-1);P(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});P(this,"dimensions",{width:0,height:0});P(this,"markerContainer");P(this,"containerEl");P(this,"contentEl",null);P(this,"contentHtml","");P(this,"style",{top:"0px",left:"0px"});P(this,"dirty",!1);P(this,"attachedDirty",!0);P(this,"collisionDirty",!0);P(this,"visibilityNeedsUpdate","show");P(this,"animation",null);P(this,"currentStrategyIndex",-1);P(this,"onStrategySelected",(t,i=!1)=>{var n;if(this.currentStrategyIndex===t&&!i)return;this.currentStrategyIndex=t;let r=this.strategies[t];if(this.activePlacement=(n=r==null?void 0:r.name)!=null?n:"center",this.activePlacement===Ge.HIDDEN){this.markerContainer.setAttribute("data-placement",Ge.HIDDEN);let a=this.options.lowPriorityPin,o=a.size,s=a.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(o,"px")),this.markerContainer.style.setProperty("--pin-color",s),this.markerContainer.style.opacity="0.6",this.style.top=-o/2+"px",this.style.left=-o/2+"px"}else{this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:a,height:o}=this.dimensions,s=-o/2+"px",l=-a/2+"px";switch(this.style.top=s,this.style.left=l,this.activePlacement){case Ge.TOP:this.style.top=-o+"px";break;case Ge.BOTTOM:this.style.top="0px";break;case Ge.LEFT:this.style.left=-a+"px";break;case Ge.RIGHT:this.style.left="0px";break;case Ge.TOP_LEFT:this.style.top=-o+"px",this.style.left=-a+"px";break;case Ge.TOP_RIGHT:this.style.top=-o+"px",this.style.left="0px";break;case Ge.BOTTOM_LEFT:this.style.top="0px",this.style.left=-a+"px";break;case Ge.BOTTOM_RIGHT:this.style.top="0px",this.style.left="0px";break;case Ge.CENTER:default:this.style.top=s,this.style.left=l}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left});P(this,"_cachedStrategies",null);P(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!0});P(this,"_cachedLowPriorityPinIndex",null);var r,n,a,o;if(this.id=(i==null?void 0:i.id)||$r(),this.options=(0,Wb.default)(this.options,i),this.options.placement=(r=i.placement)!=null?r:this.options.placement,typeof i.rank=="string")this.rank=Mn(i.rank);else if(i.rank!=null&&i.rank>0)this.rank=i.rank;else{let s=Math.trunc(os.testId*10)/10;os.testId+=.001,this.rank=s}typeof i.interactive=="string"&&(this.pointerEvents=i.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML='<div class="mappedin-marker-content">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.markerContainer.setAttribute("data-animated",String(this.options.animated)),this.containerEl=(n=this.markerContainer.firstElementChild)!=null?n:null,this.contentEl=(o=(a=this.markerContainer.firstElementChild)==null?void 0:a.firstElementChild)!=null?o:null}updateDimensionsIfZeroWidthHeight(t,i){this.dimensions.width===0&&this.dimensions.height===0&&this.updateDimensions(t,i)}updateDimensions(t,i){if(t!=null&&i!=null)this.dimensions={width:t,height:i};else{let{width:r,height:n}=this.markerContainer.getBoundingClientRect();this.dimensions={width:r,height:n}}this.currentStrategyIndex=-1,this.invalidateStrategies()}invalidateStrategies(){this._cachedStrategies=null,this._cachedLowPriorityPinIndex=null}getBoundingBoxForPlacement(t){let{width:i,height:r}=this.dimensions;switch(t){case Ge.TOP:return[r+4,4,i/2+4,i/2+4];case Ge.BOTTOM:return[4,r+4,i/2+4,i/2+4];case Ge.LEFT:return[r/2+4,r/2+4,i+4,4];case Ge.RIGHT:return[r/2+4,r/2+4,4,i+4];case Ge.TOP_LEFT:return[r+4,4,i+4,4];case Ge.TOP_RIGHT:return[r+4,4,4,i+4];case Ge.BOTTOM_LEFT:return[4,r+4,i+4,4];case Ge.BOTTOM_RIGHT:return[4,r+4,4,i+4];case Ge.HIDDEN:{let n=Math.max(2,4/2),a=this.options.lowPriorityPin.size/2+n;return[a,a,a,a]}default:return[r/2+4,r/2+4,i/2+4,i/2+4]}}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let{width:t,height:i}=this.dimensions;if(t===0||i===0)return[];let r=Array.isArray(this.options.placement)?this.options.placement:[this.options.placement],n=[];for(let a of r)this.options.rank==="always-visible"&&a===Ge.HIDDEN&&r.length>1||n.push({name:a,getBoundingBox:()=>this.getBoundingBoxForPlacement(a)});return this._cachedStrategies=n,n}toPackedMessage(t=!1){var o;this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let i=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&i&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,i&&this.currentStrategyIndex!==((o=this.packedMessage.bboxes[0])==null?void 0:o[4])){let s=this.packedMessage.bboxes;for(let l=1;l<s.length;l++)if(s[l][4]===this.currentStrategyIndex){let u=s[0];s[0]=s[l],s[l]=u;break}}if(!this.collisionDirty)return this.packedMessage;let r=[],n=this.strategies,a=-1;for(let s=0;s<n.length;s++){let l=n[s].getBoundingBox();r.push([l[0],l[1],l[2],l[3],s]),s===this.currentStrategyIndex&&i&&(a=r.length-1)}if(a>0){let s=r[0];r[0]=r[a],r[a]=s}return this.packedMessage.bboxes=r,this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this._cachedLowPriorityPinIndex!=null?this._cachedLowPriorityPinIndex:this.options.rank==="always-visible"?(this._cachedLowPriorityPinIndex=-1,-1):(this._cachedLowPriorityPinIndex=this.strategies.findIndex(t=>t.name===Ge.HIDDEN),this._cachedLowPriorityPinIndex)}destroy(){}};P(os,"testId",0);var xr=os;A();A();A();A();A();A();function Hb(e,t){return t.x+t.w<e.x+e.w&&t.x>e.x&&t.y>e.y&&t.y+t.h<e.y+e.h}A();function Kb(e,t){let[i,r]=t;return i>=e.x&&i<=e.x+e.w&&r>=e.y&&r<=e.y+e.h}A();function Jb(e,t){let i=t.x,r=t.y,n=t.x+t.w,a=t.y+t.h,o=e.x,s=e.y,l=e.x+e.w,u=e.y+e.h;return i<l&&o<n&&r<u&&s<a}A();function vr(e,t){for(let i=0;i<t.length;i++)e.push(t[i])}A();var Re=class{constructor(t,i,r,n,a){P(this,"x");P(this,"y");P(this,"w");P(this,"h");P(this,"userData");this.userData=typeof a>"u"?null:a,this.x=t,this.y=i,this.w=r,this.h=n}contains(t){return t===this?!1:Hb(this,t)}intersects(t){return Jb(this,t)}intersectsPoint(t){return Kb(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.8)",t.fillRect(this.x,this.y,this.w,this.h)}};var Ki=class e{constructor(t,i){P(this,"topLeft");P(this,"topRight");P(this,"bottomLeft");P(this,"bottomRight");P(this,"divided",!1);P(this,"boundary");P(this,"capacity",16);P(this,"objects",[]);P(this,"parent");this.parent=i,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:i,w:r,h:n}=this.boundary;this.topLeft=new e(new Re(t,i,r/2,n/2),this),this.topRight=new e(new Re(t+r/2,i,r/2,n/2),this),this.bottomLeft=new e(new Re(t,i+n/2,r/2,n/2),this),this.bottomRight=new e(new Re(t+r/2,i+n/2,r/2,n/2),this),this.divided=!0}queryRect(t){let i=[];if(this.boundary.intersects(t))i.push(...this.objects);else return[];return this.divided&&(vr(i,this.topLeft.queryRect(t)),vr(i,this.topRight.queryRect(t)),vr(i,this.bottomLeft.queryRect(t)),vr(i,this.bottomRight.queryRect(t))),i}queryPoint(t){let i=[];if(this.boundary.intersectsPoint(t))i.push(...this.objects);else return[];return this.divided&&(vr(i,this.topLeft.queryPoint(t)),vr(i,this.topRight.queryPoint(t)),vr(i,this.bottomLeft.queryPoint(t)),vr(i,this.bottomRight.queryPoint(t))),i}insert(t){return(this.parent?!this.boundary.contains(t):!this.boundary.intersects(t))?!1:this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0)}drawObjects(t){this.objects.forEach(i=>i.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};A();var ci=class{constructor(){P(this,"_subscribers",{});P(this,"_abortController",new AbortController)}get signal(){return this._abortController.signal}publish(t,i){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(r){typeof r=="function"&&r(i)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,i,r){let n=r==null?void 0:r.signal;if(n!=null&&n.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(i);let a=()=>{this.off(t,i)};return n&&n.addEventListener("abort",a,{once:!0}),a}off(t,i){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let r=this._subscribers[t].indexOf(i);r!==-1&&this._subscribers[t].splice(r,1)}destroy(){this.signal.aborted||(this._subscribers={},this._abortController.abort())}};A();var of=9,pi=200,Yu=10;function sf(e,t,i,r,n,a,o="-1"){var z,R;let s=1/0,l=1/0,u=-1/0,h=-1/0,c=new Re(-Yu,0,5,i),p=new Re(-Yu,0,t,5),d=new Re(t-5,0,t+Yu,i),f=new Re(0,i-5,t,i+Yu),y=m6(t,i,r,n,a),g=[c,p,d,f],_=new Re(-pi,-pi,t+pi*2,i+pi*2);for(let k of e){let D,x;for(let C=0;C<k.bboxes.length;C++){if(k.bboxes[C]==null||(D=k.bboxes[C].boundingBox,x=k.bboxes[C].index,k.lockedToStrategyIndex!==-1&&x!==k.lockedToStrategyIndex))continue;let[I,F,N,G]=D,[J,ee,ke,Ie]=[k.y-I,k.y+F,k.x-N,k.x+G],Be=ke,Ne=J,bt=Ie-ke,St=ee-J;s=Math.min(s,Be)-pi,l=Math.min(l,Ne)-pi,u=Math.max(u,Be+bt)+pi,h=Math.max(h,Ne+St)+pi,k.bboxes[C].boundingRect=new Re(Be,Ne,bt,St)}}let b=new Ki(new Re(s,l,u-s,h-l)),v={msgId:o,colliders:new Array(e.length),staticColliders:[],debug:[]},w=0;for(let k=0;k<e.length;k++){let D=e[k];((R=(z=D.bboxes)==null?void 0:z[0])==null?void 0:R.index)===of&&(v.staticColliders.push(D.bboxes[0].boundingRect),b.insert(D.bboxes[0].boundingRect),w++)}e=e.slice(w,e.length);let T=-pi,S=t+pi,M=-pi,E=i+pi,L;for(let k=0;k<e.length;k++){L=e[k];let D=L.x<T||L.x>S||L.y<M||L.y>E?1:0;if(v.colliders[k]=[-1,D],L.enabledAndVisible){let[x,C,I]=[1/0,-1,void 0];for(let{index:F,boundingRect:N}of L.bboxes){if(N==null)continue;let G=[];if(G=b.queryRect(N).filter(ee=>N.intersects(ee)),L.shouldCollideWithScreenEdges)for(let ee of g)N.intersects(ee)&&G.push(ee);if(N.intersects(y)){v.colliders[k]=[-1,D,N];break}if(G.length<x&&(I=N,C=F,x=G.length),G.length===0){b.insert(N),v.colliders[k]=[F,_.contains(N)?0:1,N];break}}L.rank===5&&I!=null&&(b.insert(I),v.colliders[k]=[C,_.contains(I)?0:1,I])}}return v}function m6(e,t,i,r,n){switch(n){case"top-left":return new Re(0,0,i,r);case"top-right":return new Re(e-i,0,i,r);case"bottom-left":return new Re(0,t-r,i,r);case"bottom-right":return new Re(e-i,t-r,i,r);case"center":return new Re((e-i)/2,(t-r)/2,i,r);case"top":return new Re((e-i)/2,0,i,r);case"bottom":return new Re((e-i)/2,t-r,i,r);case"left":return new Re(0,(t-r)/2,i,r);case"right":return new Re(e-i,(t-r)/2,i,r);default:return new Re(0,t-r,i,r)}}A();A();function lf(e){let t=e[0].map(i=>{let r=i[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:i[1]===1,rank:i[2]===1?5:0,x:i[3],y:i[4],shouldCollideWithScreenEdges:i[5]===1,bboxes:r,lockedToStrategyIndex:i[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:t,devicePixelRatio:e[1]}}var Wr=class{constructor(){P(this,"onerror",()=>{});P(this,"onmessage",()=>{});P(this,"postMessage",t=>{let i=lf(t);this.onmessage({data:sf(i.colliders,i.totalWidth,i.totalHeight,i.watermarkWidth,i.watermarkHeight,i.watermarkPosition,i.msgId)})});P(this,"terminate",()=>{})}};A();var uf='"use strict";(()=>{var ne=Object.defineProperty;var oe=(n,e,t)=>e in n?ne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var u=(n,e,t)=>oe(n,typeof e!="symbol"?e+"":e,t);function O(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function Q(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function Y(n,e){let t=e.x,o=e.y,r=e.x+e.w,h=e.y+e.h,L=n.x,m=n.y,x=n.x+n.w,T=n.y+n.h;return t<x&&L<r&&o<T&&m<h}function f(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var i=class{constructor(e,t,o,r,h){u(this,"x");u(this,"y");u(this,"w");u(this,"h");u(this,"userData");this.userData=typeof h>"u"?null:h,this.x=e,this.y=t,this.w=o,this.h=r}contains(e){return e===this?!1:O(this,e)}intersects(e){return Y(this,e)}intersectsPoint(e){return Q(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var S=class n{constructor(e,t){u(this,"topLeft");u(this,"topRight");u(this,"bottomLeft");u(this,"bottomRight");u(this,"divided",!1);u(this,"boundary");u(this,"capacity",16);u(this,"objects",[]);u(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:r}=this.boundary;this.topLeft=new n(new i(e,t,o/2,r/2),this),this.topRight=new n(new i(e+o/2,t,o/2,r/2),this),this.bottomLeft=new n(new i(e,t+r/2,o/2,r/2),this),this.bottomRight=new n(new i(e+o/2,t+r/2,o/2,r/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryRect(e)),f(t,this.topRight.queryRect(e)),f(t,this.bottomLeft.queryRect(e)),f(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryPoint(e)),f(t,this.topRight.queryPoint(e)),f(t,this.bottomLeft.queryPoint(e)),f(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var ie=9,l=200,C=10;function K(n,e,t,o,r,h,L="-1"){var j,N;let m=1/0,x=1/0,T=-1/0,B=-1/0,F=new i(-C,0,5,t),k=new i(-C,0,e,5),U=new i(e-5,0,e+C,t),G=new i(0,t-5,e,t+C),J=se(e,t,o,r,h),Z=[F,k,U,G],M=new i(-l,-l,e+l*2,t+l*2);for(let s of n){let b,I;for(let p=0;p<s.bboxes.length;p++){if(s.bboxes[p]==null||(b=s.bboxes[p].boundingBox,I=s.bboxes[p].index,s.lockedToStrategyIndex!==-1&&I!==s.lockedToStrategyIndex))continue;let[a,P,c,y]=b,[E,g,z,te]=[s.y-a,s.y+P,s.x-c,s.x+y],v=z,D=E,q=te-z,X=g-E;m=Math.min(m,v)-l,x=Math.min(x,D)-l,T=Math.max(T,v+q)+l,B=Math.max(B,D+X)+l,s.bboxes[p].boundingRect=new i(v,D,q,X)}}let w=new S(new i(m,x,T-m,B-x)),R={msgId:L,colliders:new Array(n.length),staticColliders:[],debug:[]},_=0;for(let s=0;s<n.length;s++){let b=n[s];((N=(j=b.bboxes)==null?void 0:j[0])==null?void 0:N.index)===ie&&(R.staticColliders.push(b.bboxes[0].boundingRect),w.insert(b.bboxes[0].boundingRect),_++)}n=n.slice(_,n.length);let $=-l,W=e+l,H=-l,ee=t+l,d;for(let s=0;s<n.length;s++){d=n[s];let b=d.x<$||d.x>W||d.y<H||d.y>ee?1:0;if(R.colliders[s]=[-1,b],d.enabledAndVisible){let[I,p,a]=[1/0,-1,void 0];for(let{index:P,boundingRect:c}of d.bboxes){if(c==null)continue;let y=[];if(y=w.queryRect(c).filter(g=>c.intersects(g)),d.shouldCollideWithScreenEdges)for(let g of Z)c.intersects(g)&&y.push(g);if(c.intersects(J)){R.colliders[s]=[-1,b,c];break}if(y.length<I&&(a=c,p=P,I=y.length),y.length===0){w.insert(c),R.colliders[s]=[P,M.contains(c)?0:1,c];break}}d.rank===5&&a!=null&&(w.insert(a),R.colliders[s]=[p,M.contains(a)?0:1,a])}}return R}function se(n,e,t,o,r){switch(r){case"top-left":return new i(0,0,t,o);case"top-right":return new i(n-t,0,t,o);case"bottom-left":return new i(0,e-o,t,o);case"bottom-right":return new i(n-t,e-o,t,o);case"center":return new i((n-t)/2,(e-o)/2,t,o);case"top":return new i((n-t)/2,0,t,o);case"bottom":return new i((n-t)/2,e-o,t,o);case"left":return new i(0,(e-o)/2,t,o);case"right":return new i(n-t,(e-o)/2,t,o);default:return new i(0,e-o,t,o)}}function V(n){let e=n[0].map(t=>{let o=t[0].map(r=>({index:r[4],boundingBox:[r[0],r[1],r[2],r[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:o,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],watermarkWidth:n[4],watermarkHeight:n[5],watermarkPosition:n[6],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=V(n.data);self.postMessage(K(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';var ls,kn,Dn,Ea,$e,br,Zu,Qb,ss=class extends ci{constructor(i,r,n,a,o=!0,s){super();he(this,Zu);P(this,"worker");P(this,"collidersDirty",!0);P(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);P(this,"visibleCollidersQTree",new Ki(new Re(0,0,0,0)));P(this,"interactiveCollidersQTree",new Ki(new Re(0,0,0,0)));he(this,ls);he(this,kn);he(this,Dn);he(this,Ea,!1);he(this,$e,null);he(this,br,null);P(this,"working",!1);P(this,"componentArray",[]);P(this,"update",(i,r,n="bottom-left",a=!1,o=[])=>{let s=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];for(let d of B(this,ls).entities)this.componentArray.push(d.component);this.resize(i,r,n),this.collidersDirty=!1,s=!0}else for(let d=0;d<this.componentArray.length;d++)if(this.componentArray[d].collisionDirty){s=!0;break}s&&this.componentArray.sort((d,f)=>f.rank-d.rank);let l=this.packedMessage[0],u=o.length+this.componentArray.length,h=a;l.length=u;let c=0,p;for(let d=0;d<o.length;d++){let f=o[d];l[c]==null&&(l[c]=[[],0,0,0,0,0,-1]),p=l[c],p[0]=[[f.h/2,f.h/2,f.w/2,f.w/2,of]],p[1]=1,p[2]=1,p[3]=f.x,p[4]=f.y,p[5]=0,p[6]=-1,c++}for(let d=0;d<this.componentArray.length;d++){let f=this.componentArray[d],y=f.toPackedMessage(h);l[c]==null&&(l[c]=[[],0,0,0,0,0,-1]),p=l[c],p[0]=y.bboxes,p[1]=y.enabled&&f.visible&&(y.rank===5||!f.isOccluded)?1:0,p[2]=y.rank===5?1:0,p[3]=y.x,p[4]=y.y,p[5]=y.shouldCollideWithScreenEdges?1:0,p[6]=y.lockedToStrategyIndex,c++}this.working||(this.working=!0,this.worker.postMessage(this.packedMessage))});P(this,"resolve",i=>{if(this.working=!1,this.collidersDirty||!i.data)return;let r=i.data.colliders,n=-1,a,o,s=new Re(0,0,B(this,kn),B(this,Dn));this.visibleCollidersQTree=new Ki(s),this.interactiveCollidersQTree=new Ki(s);for(let l=0;l<this.componentArray.length;l++){let u=this.componentArray[l];if(r[l]==null)continue;n=r[l][0],a=r[l][2];let h=u.offscreen,c=r[l][1]===1;u.offscreen=c,n!==-1&&a!=null?(o=new Re(a.x,a.y,a.w,a.h,{entityId:u.id}),this.visibleCollidersQTree.insert(o),u.interactive&&this.interactiveCollidersQTree.insert(o),(u.canShow===!1||u.visibilityNeedsUpdate!==!1||h&&!c)&&"visibilityNeedsUpdate"in u&&(u.visibilityNeedsUpdate="show"),n!==-1&&n!==u.currentStrategyIndex&&(u.activeBoundingBox=o,u.onStrategySelected(n))):((u.canShow===!0||u.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in u&&(u.visibilityNeedsUpdate="hide"),n!==-1&&n!==u.currentStrategyIndex&&u.onStrategySelected(n))}Oa(this,Zu,Qb).call(this),this.publish("visibility-changed")});P(this,"destroy",()=>{var i;this.worker.terminate(),(i=B(this,$e))==null||i.remove()});if(ie(this,ls,i),ie(this,kn,r),ie(this,Dn,n),!o)this.worker=new Wr;else if(a)this.worker=new Worker(a);else if(uf)try{this.worker=new Worker(URL.createObjectURL(new Blob([uf])))}catch(l){this.worker=new Wr}else this.worker=new Wr;this.worker.onerror=()=>{this.working=!1,this.worker=new Wr,this.worker.onmessage=l=>this.resolve(l)},this.worker.onmessage=l=>this.resolve(l),s&&(ie(this,$e,document.createElement("canvas")),B(this,$e).style.cssText="position:absolute;top:0;left:0;pointer-events:none;z-index:0;display:none;",B(this,$e).width=r,B(this,$e).height=n,B(this,$e).style.width=r+"px",B(this,$e).style.height=n+"px",s.appendChild(B(this,$e)),ie(this,br,B(this,$e).getContext("2d")))}resizeCanvas(i,r){ie(this,kn,i),ie(this,Dn,r),B(this,$e)&&(B(this,$e).width=i,B(this,$e).height=r,B(this,$e).style.width=i+"px",B(this,$e).style.height=r+"px")}resize(i,r,n){this.packedMessage[6]=n,this.packedMessage[5]=r,this.packedMessage[4]=i,this.packedMessage[3]=B(this,kn),this.packedMessage[2]=B(this,Dn)}showCollisionBoxes(){ie(this,Ea,!0),B(this,$e)&&(B(this,$e).style.display="block")}hideCollisionBoxes(){ie(this,Ea,!1),B(this,br)&&B(this,$e)&&(B(this,br).clearRect(0,0,B(this,$e).width,B(this,$e).height),B(this,$e).style.display="none")}};ls=new WeakMap,kn=new WeakMap,Dn=new WeakMap,Ea=new WeakMap,$e=new WeakMap,br=new WeakMap,Zu=new WeakSet,Qb=function(){!B(this,Ea)||!B(this,br)||!B(this,$e)||(B(this,br).clearRect(0,0,B(this,$e).width,B(this,$e).height),this.visibleCollidersQTree.drawObjects(B(this,br)))};A();A();A();var y6=(function(){let t,i;return r=>{if((!i||!i)&&(t=document.createElement("canvas"),t.width=500*r,t.height=500*r,t.style.width="500px",t.style.height="500px",i=t.getContext("2d")),!i)throw new Error("Could not get 2D context");return{measureCanvas:t,measureCanvasContext:i}}})(),e1=({text:e,size:t,maxWidth:i,pixelRatio:r,maxLines:n=2,lineHeight:a=1.2,options:o={strokeText:!0}})=>{let s="bold ".concat(t*r,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:l}=y6(r);l.font=s;let u=[],h=e.split(" "),c=0,p=0,d=0;for(;p<h.length;){let _=h[p];if(c===n&&c>0){u[c-1]+="...";break}if(u[c]==null&&(u[c]=_,p++),h.length===1){u[c]=_;break}if(h[p]==null)break;let{width:b}=l.measureText(u[c]+" "+h[p]);b<=i*r?(u[c]+=" "+h[p],p++):c++}u.forEach(_=>{let{width:b}=l.measureText(_);d=Math.max(b,d)});let f=t*r*a,y=u.length*f;return{maxWidth:d,maxHeight:y,lines:u.length,draw:(_,b,v)=>{u.length===1?(o.strokeText&&_.strokeText(u[0],b,v),_.fillText(u[0],b,v)):(o.strokeText&&(_.strokeText(u[0],b,v-f/2),_.strokeText(u[1],b,v+f/2)),_.fillText(u[0],b,v-f/2),_.fillText(u[1],b,v+f/2))}}};A();var g6=(()=>{let e;return{getDeviceType(){if(e)return e;let{userAgent:t,platform:i,maxTouchPoints:r}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),a=i==="iPad"||i.indexOf("Mac")===0&&r>0&&!window.MSStream,o=/android/i.test(t);return e={isIpad:a,isMobile:o||n||a,isIOS:n,isAndroid:o,isSafari12:/Version\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},e},_reset(){e=void 0}}})(),t1=g6.getDeviceType,i1=(()=>{let e,t,i;function r(){if(t!==void 0)return t;e||(e=document.createElement("canvas"));let a=e.getContext("webgl")||e.getContext("experimental-webgl");if(!a)return t;try{let o=t1().isFirefox?null:a.getExtension("WEBGL_debug_renderer_info");return t=o?a.getParameter(o.UNMASKED_RENDERER_WEBGL):a.getParameter(a.RENDERER),t}catch(o){let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}function n(){var o,s;if(!t1().isWindows)return!1;if(i!==void 0)return i;let a=(s=(o=_6())==null?void 0:o.toLowerCase())!=null?s:"";return i=a.includes("intel")&&(a.includes("uhd")||a.includes("iris")),i}return{getInfo:r,shouldDisableOffscreenCanvas:n,_setCanvas(a){e=a,t=void 0,i=void 0}}})(),_6=i1.getInfo,hf=i1.shouldDisableOffscreenCanvas;A();function r1(e){let t=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?t.src="data:image/svg+xml;base64,".concat(btoa(e)):t.src=e),t}function a1(e){return(e*100|0)/100}function b6(e,t=0){let i=3735928559^t,r=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),i=Math.imul(i^a,2654435761),r=Math.imul(r^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&r)+(i>>>0)}var us=class extends ci{constructor(i,r,n){super();P(this,"dirty",!1);P(this,"state");P(this,"colliderContext");P(this,"colliderCanvas");P(this,"transformRequestFunc");P(this,"transformRequest",async i=>this.transformRequestFunc?await this.transformRequestFunc(i):{url:i});P(this,"pinCache",{});P(this,"wrapperCache",{});P(this,"imageCache",{});P(this,"imagePromiseCache",{});P(this,"imageDimensionsCache",{});P(this,"textCache",{});P(this,"drawCount",0);P(this,"projectionCount",0);P(this,"animatingCount",0);P(this,"drawAttemptCount",0);P(this,"statsElement");P(this,"update",i=>{let r=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height),this.dirty&&(this.wrapperCache={}),Hr&&(this.drawCount=0,this.drawAttemptCount=0);let n,a,o,s,l,u;for(let h of this.state.entities)if((h==null?void 0:h.component)instanceof Fu&&!h.disposed){if(u=h.component,l=u.appearance.iconVisible,u.appearance.icon!=null&&l!=null){let p=typeof l=="boolean"?l:i>=l;p!==u.iconVisible&&(u.iconVisible=p,u.dirty=!0)}if((u.pinDirty||u.dirty||this.dirty)&&u.calculatePinSize(),u.offscreen||!u.visible)continue;if(a={active:u.appearance.pinColor,inactive:u.appearance.pinColorInactive},o={active:u.appearance.pinOutlineColor,inactive:u.appearance.pinOutlineColorInactive},s=a1(u.pinSize),n="".concat(a.active,"-").concat(a.inactive,"-").concat(o.active,"-").concat(o.inactive,"-").concat(s,"-").concat(u.iconVisible),u.labelCacheId=n,(!this.pinCache[n]||this.dirty)&&(this.prepare(u,n,this.colliderContext),u.dirty=!0),(u.appearance.icon&&(!u.imageHash||u.pinDirty)||this.dirty)&&this.cacheImage(u),this.textCache[u.id]==null||u.textDirty||this.dirty){u.dirty=!0,this.textCache[u.id]={};let{textDrawFn:p,width:d,height:f}=this.processText(u.text,u.appearance.textSize,u.appearance.maxWidth,u.appearance.maxLines,u.appearance.lineHeight),y=["left","center","right"];for(let g of y)this.textCache[u.id][g]=this.textToCanvas(p,u.appearance.textSize,g,d,f,u.appearance.textColor,u.appearance.textOutlineColor);u.dimensions={width:Math.ceil(d/r),height:Math.ceil(f/r)}}let c=1;if(u.appearance.iconScale)if(typeof u.appearance.iconScale=="number")c=u.appearance.iconScale;else{let{on:p,input:d,output:f,easing:y}=u.appearance.iconScale;p==="zoom-level"?c=a1(om(i,d,f,y!=null?y:"linear")):ft.warn("Unsupported interpolation property: ".concat(p))}Hr&&this.drawAttemptCount++,u.recomputeCurrentStrategy(u.iconVisible?c:1),u.canShow&&(u.enabled||u.visibilityNeedsUpdate!==!1)&&this.draw(u,n,this.colliderContext),u.textDirty=!1,u.pinDirty=!1}this.dirty=!1,Hr&&this.updateStatsOverlay()});P(this,"processText",(i,r,n,a,o)=>{let s=this.state.pixelRatio,{draw:l,maxWidth:u,maxHeight:h}=e1({text:i,size:r,pixelRatio:s,maxWidth:n,maxLines:a,lineHeight:o});return{textDrawFn:l,width:u+2.5*s*2,height:h+2.5*s*2}});P(this,"textToCanvas",(i,r,n,a,o,s,l)=>{let u=this.state.pixelRatio,h,c=a,p=o;window.OffscreenCanvas!=null&&!hf()?h=new OffscreenCanvas(c,p):(h=document.createElement("canvas"),h.width=c,h.height=p,h.style.width=c+"px",h.style.height=p+"px");let d=h.getContext("2d",{willReadFrequently:!0});if(!d)return;let f=2.5*u;d.textAlign=n,d.font="bold ".concat(r*u,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),d.textBaseline="middle",d.lineJoin="miter",d.miterLimit=2,d.strokeStyle="white",d.lineWidth=f,d.fillStyle=s,d.strokeStyle=l;let y=n==="left"?f/2:n==="center"?c/2:c-f/2;return i(d,y,(p+f/2)/2),h});P(this,"cacheImage",i=>{if(!i.appearance.icon)return;let r=b6(i.appearance.icon);this.imagePromiseCache[r]||(this.imagePromiseCache[r]=new Promise(n=>{this.transformRequest(i.appearance.icon).then(a=>{let o=r1(a.url);o.onload=()=>{this.imageCache[r]=o,this.publish("img:loaded"),n(o)}})})),i.imageHash!==r&&(i.imageHash=r,this.imagePromiseCache[r].then(()=>{i.dirty=!0}))});P(this,"createPinCanvas",(i,r,n,a,o=1)=>{let s,l=this.state.pixelRatio,u=i.totalPinSize*2*l*o;window.OffscreenCanvas!=null?s=new OffscreenCanvas(u,u):(s=document.createElement("canvas"),s.width=u,s.height=u,s.style.width=u/l+"px",s.style.height=u/l+"px");let h=s.getContext("2d");return h.shadowColor="rgba(0,0,0,0.3)",h.shadowOffsetY=2*l,h.shadowBlur=5*l,h.beginPath(),h.arc(u/2,u/2,(r/2+2.5*l/2)*o,0,2*Math.PI),h.fillStyle=n,h.fill(),h.beginPath(),h.arc(u/2,u/2,r/2*o,0,2*Math.PI),h.shadowColor="transparent",h.fillStyle=a,h.fill(),s});P(this,"prepare",(i,r,n)=>{let a=this.state.pixelRatio;n.lineWidth=4*a;let o=typeof i.appearance.iconScale=="number"?[i.appearance.iconScale]:i.appearance.iconScale==null?[]:i.appearance.iconScale.output,s=o.length>0?Math.max(...o):void 0,l=this.createPinCanvas(i,i.pinSize,i.appearance.pinOutlineColor,i.appearance.pinColor,s),u=this.createPinCanvas(i,3.5*a,i.appearance.pinOutlineColorInactive,i.appearance.pinColorInactive,s);this.pinCache[r]=[l,u]});this.state=i,this.colliderCanvas=r,this.colliderContext=r.getContext("2d"),this.transformRequestFunc=n}updateStatsOverlay(){let i=this.colliderCanvas.parentElement;if(!(!i||typeof document>"u")){if(!this.statsElement){let r=document.createElement("div");r.className="mi-2d-draw-stats",r.style.cssText=["position: absolute","bottom: 8px","left: 8px","padding: 6px 10px","background: rgba(0, 0, 0, 0.6)","color: #fff","font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace","border-radius: 4px","pointer-events: none","z-index: 1000","user-select: none","white-space: pre"].join(";"),i.appendChild(r),this.statsElement=r}this.statsElement.textContent="projections: ".concat(this.projectionCount,"\n")+"draw-attempts: ".concat(this.drawAttemptCount,"\n")+"draws: ".concat(this.drawCount,"\n")+"animating: ".concat(this.animatingCount)}}createWrapperSprite(i,r,n,a,o,s,l,u,h,c){let p=i+n*2,d=r+a*2,f;window.OffscreenCanvas!=null&&!hf()?f=new OffscreenCanvas(p,d):(f=document.createElement("canvas"),f.width=p,f.height=d);let y=f.getContext("2d");return l&&(y.shadowColor=l,y.shadowOffsetX=u,y.shadowOffsetY=h,y.shadowBlur=c),y.fillStyle=s,o(y,n,a,i,r),y.fill(),f}drawWrapperBackground(i,r,n,a,o){var z;let s=i.appearance.__EXPERIMENTAL_wrapperBackgroundColor;if(!s)return;let l=i.appearance.__EXPERIMENTAL_wrapperPaddingX*o,u=i.appearance.__EXPERIMENTAL_wrapperPaddingY*o,h=i.appearance.__EXPERIMENTAL_wrapperBorderRadius*o,c=(i.pinSize+2.5*o)/2,p=(z=i.appearance.__EXPERIMENTAL_wrapperShadowColor)!=null?z:"",d=i.appearance.__EXPERIMENTAL_wrapperShadowOffsetX*o,f=i.appearance.__EXPERIMENTAL_wrapperShadowOffsetY*o,y=i.appearance.__EXPERIMENTAL_wrapperShadowBlur*o,g=p?Math.ceil(y+(d<0?-d:d)):0,_=p?Math.ceil(y+(f<0?-f:f)):0,b=i.style.textLabelVisible===!0&&i.style.textAlign!=null&&i.style.left!=null&&i.style.top!=null,v,w,T,S,M,E;if(b){let R=1/0,k=1/0,D=-1/0,x=-1/0;i.style.pinVisibility!==0&&(n-c<R&&(R=n-c),a-c<k&&(k=a-c),n+c>D&&(D=n+c),a+c>x&&(x=a+c));let C=n+i.style.left*o,I=a+i.style.top*o,F=i.dimensions.width*o,N=i.dimensions.height*o;C<R&&(R=C),I<k&&(k=I),C+F>D&&(D=C+F),I+N>x&&(x=I+N),v=R-l,w=k-u,T=Math.ceil(D-R+l*2),S=Math.ceil(x-k+u*2),M="R|".concat(T,"|").concat(S,"|").concat(h,"|").concat(s,"|").concat(p,"|").concat(d,"|").concat(f,"|").concat(y),E=(G,J,ee,ke,Ie)=>{G.beginPath(),h>0&&typeof G.roundRect=="function"?G.roundRect(J,ee,ke,Ie,h):G.rect(J,ee,ke,Ie)}}else if(i.style.pinVisibility===1){let R=l>u?l:u,k=Math.ceil((c+R)*2);T=k,S=k,v=n-k/2,w=a-k/2,M="C|".concat(k,"|").concat(s,"|").concat(p,"|").concat(d,"|").concat(f,"|").concat(y),E=(D,x,C,I,F)=>{D.beginPath(),D.arc(x+I/2,C+F/2,I/2,0,2*Math.PI)}}else if(i.style.pinVisibility===.5){let R=i.appearance.__EXPERIMENTAL_wrapperDotSize,k=R>0?R*o:3.5*o,D=Math.ceil(k);T=D,S=D,v=n-D/2,w=a-D/2,M="D|".concat(D,"|").concat(s,"|").concat(p,"|").concat(d,"|").concat(f,"|").concat(y),E=(x,C,I,F,N)=>{x.beginPath(),x.arc(C+F/2,I+N/2,F/2,0,2*Math.PI)}}else return;let L=this.wrapperCache[M];L||(L=this.createWrapperSprite(T,S,g,_,E,s,p,d,f,y),this.wrapperCache[M]=L),r.drawImage(L,v-g,w-_)}draw(i,r,n){var h;if(!i.canShow||!i.visible)return;Hr&&this.drawCount++,n.save(),n.globalAlpha=i.currentOpacity;let a=this.state.pixelRatio,o=i.projection.x*a,s=i.projection.y*a,l=i.style.pinVisibility===1?this.pinCache[r][0]:this.pinCache[r][1],u=i.style.pinVisibility===1?i.scaledPinSize*a:i.totalPinSize*a;if(this.drawWrapperBackground(i,n,o,s,a),i.style.pinVisibility!==0&&n.drawImage(l,o-u,s-u,u*2,u*2),i.appearance.icon&&i.iconVisible&&i.imageHash&&i.appearance.iconSize&&this.imageCache[i.imageHash]&&i.style.pinVisibility===1){let c=this.imageCache[i.imageHash],p=(i.scaledPinSize-i.scaledIconPadding)*a,d=i.appearance.iconFit,f=p,y=p,g="".concat(i.imageHash,"_").concat(d);if(this.imageDimensionsCache[g])f=this.imageDimensionsCache[g].width,y=this.imageDimensionsCache[g].height;else{let _=c.width*a,b=c.height*a;if(d==="contain"){let v=Math.sqrt(_**2+b**2),w=p/v;f=_*w,y=b*w}if(d==="cover"){let v=p/_,w=p/b,T=Math.max(v,w);f=_*T,y=b*T}}n.save(),n.beginPath(),n.arc(o,s,p/2,0,2*Math.PI),n.closePath(),((h=i==null?void 0:i.appearance)==null?void 0:h.iconOverflow)!=="visible"&&n.clip(),n.drawImage(c,o-f/2,s-y/2,f,y),n.restore()}i.style.textLabelVisible&&i.style.textAlign!=null&&i.style.left!=null&&i.style.top!=null&&n.drawImage(this.textCache[i.id][i.style.textAlign],o+i.style.left*a,s+i.style.top*a),n.restore()}};A();var hs=class extends ci{constructor(i){super();P(this,"state");P(this,"animating",new Map);P(this,"isAnimating",!1);P(this,"startTime",-1);P(this,"showDuration",300);P(this,"hideDuration",250);P(this,"update",()=>{var i;this.animating.clear();for(let r of this.state.entities){let n=r.component;if(n instanceof Fu){if(n.visibilityNeedsUpdate==="show"){n.canShow=!0;let a=(i=n.appearance.opacity)!=null?i:1;if(n.offscreen){n.currentOpacity=a,n.visibilityNeedsUpdate=!1;continue}this.animating.set(n,[n.currentOpacity,a])}else if(n.visibilityNeedsUpdate==="hide"){if(n.offscreen){n.currentOpacity=0,n.canShow=!1,n.visibilityNeedsUpdate=!1;continue}this.animating.set(n,[n.currentOpacity,0])}}}this.startTime=performance.now(),this.publish("animate:2d")});P(this,"playAnimations");this.state=i,this.playAnimations=this._playAnimations}_playAnimations(){let i=performance.now();for(let[r,[n,a]]of this.animating.entries()){let o=a===1?this.showDuration:this.hideDuration,s=(i-this.startTime)/o;r.currentOpacity=Mh(s,0,1,n,a,a===0?Ls:Ch),i-this.startTime>=o&&(a===1?r.canShow=!0:a===0&&(r.canShow=!1),r.visibilityNeedsUpdate=!1,this.animating.delete(r))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};A();var w6=["running","paused"],cs=class{constructor(t){P(this,"state");this.state=t}update(t){let i;for(let r of this.state.entities)if(r&&(i=r.component,i&&"containerEl"in i&&i.markerContainer!=null)){let n=i;n.visibilityNeedsUpdate!==!1&&(n.visibilityNeedsUpdate==="show"?n.canShow=!0:n.canShow=!1),n.offscreen&&(n.animation&&(n.animation.cancel(),n.animation=null),n.markerContainer.style.opacity="0");let a=n.animation!=null&&(n.animation.pending===!0||w6.includes(n.animation.playState));if((n.canShow&&n.visible===!0||a)&&!n.offscreen&&(n.markerContainer.style.transform="translate3D(".concat(n.projection.x,"px, ").concat(n.projection.y,"px, 0px)")),n.canShow===!0&&n.visible===!0&&!n.offscreen?n.markerContainer.style.pointerEvents=t?"none":n.pointerEvents:n.markerContainer.style.pointerEvents="none",n.currentStrategyIndex===-1&&n.visible&&n.visibilityNeedsUpdate==="show")continue;if(n.visibilityNeedsUpdate!==!1&&!n.offscreen){let o=n.canShow&&n.visible?"1":"0";n.animation&&n.animation.cancel(),n.options.animated===!1?(n.markerContainer.style.opacity=o,n.animation=null):(n.visibilityNeedsUpdate==="show"&&(n.markerContainer.style.opacity="0"),n.animation=n.markerContainer.animate([{opacity:o}],{duration:300,easing:"ease-in-out",fill:"forwards"})),n.visibilityNeedsUpdate=!1}}}};A();var ps=class{constructor(t,i){P(this,"state");P(this,"dirty",!0);P(this,"domTree");this.state=t,this.domTree=i}update(){var t;if(this.dirty){for(let i of Array.from(this.domTree.children)){let r=(t=i.userData)==null?void 0:t.entityId,n=r!=null?this.state.entityMap.get(r):void 0;if(n){let a=n.component;(!a.enabled||!a.visible||!this.state.entityIds.has(r))&&this.domTree.removeChild(i)}else this.domTree.removeChild(i)}for(let i of this.state.entities){let r=i.component;r instanceof xr&&r.enabled&&r.markerContainer&&!this.domTree.contains(r.markerContainer)&&(r.markerContainer.userData={entityId:i.id},this.domTree.appendChild(r.markerContainer),r.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}};A();var ds=class extends ci{constructor(i,r){super();P(this,"state");P(this,"dirty",!0);P(this,"domTree");P(this,"observers",new Map);P(this,"updateDimensions",i=>{var r;for(let n of i){let o=(r=n.target.parentElement)==null?void 0:r.getAttribute("data-marker-id");if(o){let s=this.state.entityMap.get(o);if(s){let l=s.component;l instanceof xr&&(l.updateDimensions(n.contentRect.width,n.contentRect.height),l.collisionDirty=!0)}}}this.publish("dimensions-update")});this.state=i,this.domTree=r}setupObserver(){var i;for(let r of this.observers.values())r.disconnect();this.observers.clear();for(let r of this.domTree.children){let n=r.getAttribute("data-marker-id");if(n!=null){let a=this.state.entityMap.get(n);if(a){let o=a.component;if((i=o.options)!=null&&i.dynamicResize){let s=new ResizeObserver(this.updateDimensions);s.observe(o.containerEl),this.observers.set(r.userData.entityId,s)}}}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let i of this.observers.values())i.disconnect();this.observers.clear()}};var fs=9,Hr=!1,rt,Ln,ms,Wt,Rn,kt,wr,Mi,zn,Aa,Pr,Kr,Ii,Ei,Ai,ki,Di,ys,gs,ka,o1,s1,Wu,_s,Hu,Ku,pf=class{constructor(t,i,r,n={}){he(this,ka);he(this,rt);he(this,Ln);he(this,ms);he(this,Wt);he(this,Rn);he(this,kt);he(this,wr);he(this,Mi);he(this,zn);he(this,Aa);he(this,Pr);he(this,Kr,fs);he(this,Ii,null);he(this,Ei,null);he(this,Ai,null);he(this,ki,null);P(this,"collidersNeedRecomputing",!0);he(this,Di);he(this,ys,0);he(this,gs,[]);he(this,Wu,()=>{B(this,ki)&&(cancelAnimationFrame(B(this,ki)),ie(this,ki,null)),ie(this,ki,requestAnimationFrame(()=>{ie(this,ki,null),B(this,Mi).update(),B(this,_s).call(this)}))});he(this,_s,()=>{ie(this,Ei,requestAnimationFrame(()=>{ie(this,Ei,null),Hr&&(B(this,wr).animatingCount=B(this,Mi).animating.size),B(this,wr).update(B(this,ys)),B(this,zn).update(!1)}))});he(this,Hu,()=>{B(this,_s).call(this)});he(this,Ku,()=>{B(this,Ai)&&(cancelAnimationFrame(B(this,Ai)),ie(this,Ai,null)),ie(this,Ai,requestAnimationFrame(()=>{ie(this,Ai,null),B(this,Mi).playAnimations()}))});var o,s;ie(this,rt,i),ie(this,Ln,t),ie(this,ms,r),ie(this,Di,(o=n.watermark)!=null?o:{width:0,height:0,position:"bottom-left"}),ie(this,Wt,document.createElement("canvas")),B(this,Wt).style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",t.appendChild(B(this,Wt));let a=document.createElement("div");a.classList.add("mappedin-2d-entities"),Object.assign(a.style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",overflow:"hidden",pointerEvents:"none",zIndex:"2",transformStyle:"preserve-3d"}),t.appendChild(a),ie(this,Rn,a),this.resize(),ie(this,kt,new ss(i,B(this,Ln).clientWidth,B(this,Ln).clientHeight,n.workerUrl,(s=n.useCollisionWorker)!=null?s:!0,t)),ie(this,wr,new us(i,B(this,Wt),n.transformImageRequest)),ie(this,Mi,new hs(i)),ie(this,zn,new cs(i)),ie(this,Aa,new ps(i,B(this,Rn))),ie(this,Pr,new ds(i,B(this,Rn))),B(this,kt).on("visibility-changed",B(this,Wu),{signal:B(this,kt).signal}),B(this,Mi).on("draw:2d",B(this,Hu),{signal:B(this,Mi).signal}),B(this,Mi).on("animate:2d",B(this,Ku),{signal:B(this,Mi).signal}),B(this,Pr).on("dimensions-update",()=>{B(this,kt).collidersDirty=!0,Oa(this,ka,s1).call(this)},{signal:B(this,Pr).signal})}get collisionSystem(){return B(this,kt)}get drawSystem(){return B(this,wr)}get domDrawSystem(){return B(this,zn)}get labelCanvas(){return B(this,Wt)}registerEntity(t){B(this,rt).entityMap.set(t.id,t)}addEntity(t){B(this,rt).entityMap.set(t.id,t),B(this,rt).entities.add(t),B(this,rt).entityIds.add(t.id)}activateEntity(t){B(this,rt).entities.add(t),B(this,rt).entityIds.add(t.id)}deactivateEntity(t){B(this,rt).entities.delete(t),B(this,rt).entityIds.delete(t.id)}removeEntity(t){B(this,rt).entities.delete(t),B(this,rt).entityMap.delete(t.id),B(this,rt).entityIds.delete(t.id)}clearEntities(){B(this,rt).entities.clear(),B(this,rt).entityMap.clear(),B(this,rt).entityIds.clear()}getEntity(t){return B(this,rt).entityMap.get(t)}hasActiveEntity(t){return B(this,rt).entities.has(t)}resize(){var n;let{clientWidth:t,clientHeight:i}=B(this,Ln),r=B(this,rt).pixelRatio;B(this,Wt).width=t*r,B(this,Wt).height=i*r,B(this,Wt).style.width=t+"px",B(this,Wt).style.height=i+"px",(n=B(this,kt))==null||n.resizeCanvas(t,i)}update(t,i,r=!1,n=[]){ie(this,ys,t),ie(this,gs,n),Oa(this,ka,o1).call(this),B(this,Aa).update(),B(this,Pr).update(),B(this,Ei)&&(cancelAnimationFrame(B(this,Ei)),ie(this,Ei,null)),B(this,wr).update(t),B(this,zn).update(i);let a=this.collidersNeedRecomputing,o=!a&&r;a&&ie(this,Kr,fs),Uf(this,Kr)._++,B(this,Kr)>=fs&&(ie(this,Kr,0),B(this,kt).update(B(this,Di).width,B(this,Di).height,B(this,Di).position,o,n)),this.collidersNeedRecomputing=!1}updateWatermark(t){ie(this,Di,t)}markDirty(){B(this,Aa).dirty=!0,B(this,Pr).dirty=!0,B(this,kt).collidersDirty=!0,this.collidersNeedRecomputing=!0,ie(this,Kr,fs)}cancelPendingFrames(){B(this,Ii)&&(cancelAnimationFrame(B(this,Ii)),ie(this,Ii,null)),B(this,Ei)&&(cancelAnimationFrame(B(this,Ei)),ie(this,Ei,null)),B(this,Ai)&&(cancelAnimationFrame(B(this,Ai)),ie(this,Ai,null)),B(this,ki)&&(cancelAnimationFrame(B(this,ki)),ie(this,ki,null))}createLabel(t,i){return new Zr(t,i,B(this,rt).pixelRatio)}createMarker(t,i={}){return new xr(t,i)}showCollisionBoxes(){B(this,kt).showCollisionBoxes()}hideCollisionBoxes(){B(this,kt).hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),B(this,kt).destroy(),B(this,Pr).destroy(),B(this,Wt).remove(),B(this,Rn).remove()}};rt=new WeakMap,Ln=new WeakMap,ms=new WeakMap,Wt=new WeakMap,Rn=new WeakMap,kt=new WeakMap,wr=new WeakMap,Mi=new WeakMap,zn=new WeakMap,Aa=new WeakMap,Pr=new WeakMap,Kr=new WeakMap,Ii=new WeakMap,Ei=new WeakMap,Ai=new WeakMap,ki=new WeakMap,Di=new WeakMap,ys=new WeakMap,gs=new WeakMap,ka=new WeakSet,o1=function(){let t=0;for(let i of B(this,rt).entities){let r=i.worldPosition,n=B(this,ms).call(this,r.x,r.y,r.z);Hr&&t++,n&&(i.component.projection.x=n.x,i.component.projection.y=n.y)}Hr&&(B(this,wr).projectionCount=t)},s1=function(){B(this,Ii)&&(cancelAnimationFrame(B(this,Ii)),ie(this,Ii,null)),ie(this,Ii,requestAnimationFrame(()=>{ie(this,Ii,null),B(this,kt).update(B(this,Di).width,B(this,Di).height,B(this,Di).position,!1,B(this,gs))}))},Wu=new WeakMap,_s=new WeakMap,Hu=new WeakMap,Ku=new WeakMap;A();import{z as ze}from"zod";var l1=Ud,u1=nf,P6=ze.object({rank:Vd.optional(),appearance:Bu.optional(),interactive:ze.boolean().default(!1),textPlacement:ze.union([ze.enum(l1),ze.array(ze.enum(l1))]).default(Jo),occlude:ze.boolean().default(!0)}),df=ze.object({rank:ze.union([ze.enum(["low","medium","high","always-visible"]),ze.number()]).optional(),interactive:ze.union([ze.boolean(),ze.literal("pointer-events-auto")]).optional(),id:ze.string().optional(),placement:ze.union([ze.enum(u1),ze.array(ze.enum(u1))]).optional(),dynamicResize:ze.boolean().optional(),zIndex:ze.number().optional(),lowPriorityPin:ze.object({size:ze.number().positive().optional(),color:ze.string().optional()}).optional(),animated:ze.boolean().optional()}),T6=e=>{P6.parse(e!=null?e:{})},tW=(e,t,i)=>{ze.array(ze.number()).min(2).max(3).parse(e),ze.string().parse(t),T6(i)};function iW(e,t,i){ze.array(ze.number()).min(2).max(3).parse(e),ze.string().parse(t),df.parse(i)}A();var Bn=class extends zt{constructor(){super(...arguments);P(this,"type","geometry");P(this,"userData",{entityId:"",type:"geometry"});P(this,"components",[])}raycast(i,r){this.userData.type==="model"&&this.children[0]&&i.intersectObject(this.children[0],!0).forEach(n=>{r.push(n)})}},Ht=class{constructor(t,i){P(this,"id",$r());P(this,"components");P(this,"parentId");P(this,"type");P(this,"entities2D",new Map);this.components=[t,i],this.type=t.type}getComponent(t){return this.components.find(i=>(i==null?void 0:i.type)===t)}get object3d(){return this.components[0].mesh}get parentObject3D(){var t;return(t=this.components[0].mesh)==null?void 0:t.parent}attach(t){this.parentObject3D instanceof Dt?t.object3d.userData.attachedEntityId=this.id:this.entities2D.set(t.id,t)}detach(t){this.parentObject3D instanceof Dt&&(t.object3d.userData.parentEntityId=void 0),this.entities2D.delete(t.id)}removeAllEntities(){for(let t of this.entities2D.values())this.detach(t)}};A();var Ji=class extends zt{},Tr=class{constructor(t,i,r=0){P(this,"id");P(this,"type");P(this,"entity2D");P(this,"verticalOffset");P(this,"object3d",new Ji);P(this,"components");P(this,"disposed",!1);P(this,"worldPosition",new Ve);this.id=t.id||$r(),this.components=[t],this.verticalOffset=r,this.object3d=new Ji,this.object3d.position.set(i.x,i.y,i.z+r),this.object3d.userData.entityId=this.id,this.type=t.type,this.object3d.userData.type=this.type,this.positionDirty=!0,this.entity2D=new Ho(t,{x:i.x,y:i.y,z:i.z+r})}get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}getComponent(t){return this.components.find(i=>(i==null?void 0:i.type)===t)}computeWorldPosition(){return this.object3d.matrixAutoUpdate=!0,this.object3d.getWorldPosition(this.worldPosition),this.object3d.matrixAutoUpdate=!1,this.worldPosition}get position(){return this.positionDirty&&(this.computeWorldPosition(),this.positionDirty=!1),this.worldPosition}get positionDirty(){return this.object3d.userData.worldPositionDirty}set positionDirty(t){this.object3d.userData.worldPositionDirty=t}updatePosition(t){this.object3d.position.copy(t),this.positionDirty=!0,this.syncEntity2DWorldPosition()}setAltitude(t){this.object3d.position.z=t,this.positionDirty=!0,this.syncEntity2DWorldPosition()}syncPosition(){let t=this.position;this.entity2D.worldPosition.x=t.x,this.entity2D.worldPosition.y=t.y,this.entity2D.worldPosition.z=t.z}syncEntity2DWorldPosition(){let t=this.computeWorldPosition();this.entity2D.worldPosition.x=t.x,this.entity2D.worldPosition.y=t.y,this.entity2D.worldPosition.z=t.z}};A();function ff(e){return e instanceof As?Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y):Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y)&&Number.isFinite(e.min.z)&&Number.isFinite(e.max.z)}A();import{z as ye}from"zod";A();var h1=class extends ci{constructor(i,r,n=!0){super();P(this,"rendererState");P(this,"convertTo3DMapPosition");P(this,"textSet",new Set);P(this,"batchedTextMap",new Map);P(this,"resolvedBatchedTextMap",new Map);P(this,"useWorker",!0);P(this,"debugTextAreaMesh",new Map);(n===!1||!Ah())&&(this.useWorker=!1,S6(!1)),this.rendererState=i,this.convertTo3DMapPosition=r}remove(i){this.textSet.delete(i)}getBatchedText(i){return this.resolvedBatchedTextMap.get(i)}update(i){var s,l,u;let r,n,a,o=[];for(let h of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(h),(r==null?void 0:r.type)==="text3d"){n=r.components[0],a=r.components[1];let c=(s=n.mesh)==null?void 0:s.parent;if(!c||!(c instanceof Nt)||!(n instanceof Qu))continue;if("textArea"in n.feature.properties&&n.mesh!=null&&n.polygonEntityId!=null&&n.textMesh==null&&n.mesh.parent!=null&&((u=(l=n.feature.properties)==null?void 0:l.textArea)==null?void 0:u.position)!=null){if(this.textSet.has(n.polygonEntityId))continue;this.textSet.add(n.polygonEntityId),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Da().then(({BatchedText:f})=>{let y=new f;return y.type="batchedtext",c.add(y),this.resolvedBatchedTextMap.set(c,y),y}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");o.push(c1({entityId:h,textComponent:n,styleComponent:a,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"text-area"}).then(f=>(f&&f.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(f.textComponent,i),f)))}else if(n.mesh!=null&&n.textMesh==null&&n.mesh.parent!=null){if(this.textSet.has(h.toString()))continue;this.textSet.add(h.toString()),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Da().then(({BatchedText:f})=>{let y=new f;return y.type="batchedtext",c.add(y),this.resolvedBatchedTextMap.set(c,y),y}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");o.push(c1({entityId:h,textComponent:n,styleComponent:a,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"point"}).then(f=>(f&&f.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(f.textComponent,i),f)))}let p=this.batchedTextMap.get(c);n.textMesh&&p&&Promise.all([p,Promise.resolve({meshComponent:n,styleComponent:a})]).then(([d,{meshComponent:f,styleComponent:y}])=>{let{textMesh:g}=f;if(g){if(d){let _=gf(d,g);f.visible&&!_?d.add(g):!f.visible&&_&&d.remove(g)}y.flipToFaceCamera&&this.flipIfNeeded(f,i)}})}return Promise.all(o).then(h=>{if(h.length===0)return;let c=new Set(h.map(d=>d==null?void 0:d.batchedText)),p=[];return c.forEach(d=>{p.push(new Promise(f=>{d?d.sync(()=>{f()}):f()}))}),this.publish("render"),Promise.all(p)})}flipIfNeeded(i,r){let n=i.textMesh;if(!n)return!1;let a=n.rotation.z,o=Au(a+r);return o>Math.PI/2&&o<3*Math.PI/2?(n.rotation.z=Au(a+Math.PI),n.updateMatrix(),!0):!1}showTextAreaMesh(){let i,r;for(let n of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(n),(i==null?void 0:i.type)==="text3d"&&(r=i.components[0],"textArea"in r.feature.properties)){let a=r.feature.properties.textArea;if(!a)continue;let o=new Qf(a.maxWidth,a.maxHeight),s=new Mr(o,new sn({color:"pink"})),{textMesh:l}=r;if(!l)continue;let u=this.convertTo3DMapPosition(a.position,xs);s.position.copy(u),s.position.z=l.position.z-.1,s.rotation.z=l.rotation.z,mf.identity(),mf.makeRotationAxis(new Ve(0,0,1),l.userData.rotationZ),xs.set(a.maxWidth/2,0,0),xs.applyMatrix4(mf),s.position.x-=xs.x,s.position.y-=xs.y,this.rendererState.geometryScene.add(s),this.debugTextAreaMesh.set(n,s)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(i=>{this.rendererState.geometryScene.remove(i)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function S6(e){Da().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var mf=new rr,xs=new Ve,yf;async function IW(e){let{preloadFont:t}=await Da();return t(e)}function Da(){return yf||(yf=import("./text3d-WK55MUUL.js").then(e=>e)),yf}async function c1({entityId:e,textComponent:t,styleComponent:i,convertTo3DMapPosition:r,batchedMeshPromise:n,rendererState:a,type:o="text-area"}){return Promise.all([Da(),Promise.resolve({entityId:e,meshComponent:t,styleComponent:i})]).then(([{createTroikaTextPoint:s,createTroikaTextArea:l},u])=>o==="text-area"?l(u.entityId,u.meshComponent,u.styleComponent,r):s(u.entityId,u.meshComponent,u.styleComponent,r)).catch(s=>{ft.warn("Trouble creating text: ",s)}).then(s=>{if(!(s!=null&&s.text))return;let l=[Promise.resolve(s.text),n,Promise.resolve()];if(t.polygonEntityId){let u=a.geometry3DMap.get(t.polygonEntityId);if((u==null?void 0:u.type)==="geometry"){let h=u.components[0],c=u.components[1];h.textMesh=s.text,s.text.position.z=c.altitude+c.height+C6}}else l[2]=Da().then(({syncText:u})=>u(s.text));return Promise.all(l)}).then(s=>{if(!s)return;let[l,u]=s;return u.add(l),t.batchedText||(t.batchedText=u),{text:l,batchedText:u,textComponent:t,styleComponent:i}})}function gf(e,t){return e._members.has(t)}var C6=.5;var M6=ye.object({visible:ye.boolean(),color:ye.string(),flipToFaceCamera:ye.boolean(),font:ye.string().optional(),fontSize:ye.number(),margin:ye.union([ye.number(),ye.tuple([ye.number(),ye.number(),ye.number(),ye.number()])]),outlineColor:ye.string(),outlineOpacity:ye.number(),outlineBlur:ye.union([ye.number(),ye.string()]),outlineWidth:ye.number(),outlineOffsetX:ye.number(),outlineOffsetY:ye.number(),strokeWidth:ye.number(),maxWidth:ye.number().optional(),maxHeight:ye.number().optional(),strokeOpacity:ye.number(),strokeColor:ye.string(),fillOpacity:ye.number(),hoverColor:ye.string().optional(),id:ye.union([ye.string(),ye.number()]),type:ye.literal("text3d"),position:ye.tuple([ye.number(),ye.number(),ye.number()]),content:ye.string(),rotation:ye.number()}),p1=ye.strictObject(M6.partial().omit({id:!0,type:!0}).shape),d1=ye.strictObject(p1.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape),zW=ye.strictObject({appearance:p1.optional(),parentId:ye.string().optional()}),Qu=class{constructor(t){P(this,"mesh",new Bn);P(this,"textMesh");P(this,"type","text3d");P(this,"feature");P(this,"parent");P(this,"batchedText");P(this,"polygonEntityId");this.feature=t}get visible(){return this.batchedText&&this.textMesh?gf(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(t){this.batchedText&&this.textMesh?t?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=t),this.mesh.visible=t}};A();var La,eh=class{constructor(t){P(this,"type","outline");P(this,"color");P(this,"dirty",!0);P(this,"enabled",!0);he(this,La,!1);P(this,"edgeColors");P(this,"edgeVisibility");P(this,"geometry");P(this,"ranges");P(this,"topFaceVerticesIndices");this.color=t}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||B(this,La)===t)return;ie(this,La,t);let i=this.edgeVisibility.array,r=t?1:0;for(let n=0;n<this.ranges.count;n++){let a=this.ranges.start+n;i[a]=r}this.edgeVisibility.needsUpdate=!0}get visible(){return B(this,La)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};La=new WeakMap;A();A();function XW(e){return e instanceof Qi?e.material:null}function _f(e,t){return e==="auto"?t===1?bh:wh:e==="back"?Gf:e==="front"?bh:wh}function qW(e,t,i=1){let r=_f(t,i);e.side!==r&&(e.side=r)}A();A();var th=class extends Zf{constructor(i){let r=i,n=3,a=n*4;super(new Uint8Array(i*a),n,i,qf,Xf);P(this,"_width");P(this,"_height");P(this,"_propertiesLength");this._width=a,this._height=r,this._propertiesLength=n}setColor(i,r,n){let a=this.image.data,o=i*this._width;a[o]=Math.round(r.r*255),a[o+1]=Math.round(r.g*255),a[o+2]=Math.round(r.b*255),a[o+3]=0,a[o+4]=Math.round(n.r*255),a[o+5]=Math.round(n.g*255),a[o+6]=Math.round(n.b*255),a[o+7]=0,this.needsUpdate=!0}getColor(i){let r=this.image.data,n=i*this._width,a=new fi(r[n]/255,r[n+1]/255,r[n+2]/255),o=new fi(r[n+4]/255,r[n+5]/255,r[n+6]/255);return{color:a,topColor:o}}setTexture(i,r,n){let a=this.image.data,o=i*this._width;a[o+8]=r?255:0,a[o+9]=n?255:0,a[o+10]=0,a[o+11]=0,this.needsUpdate=!0}getTexture(i){let r=this.image.data,n=i*this._width,a=r[n+8]===255,o=r[n+9]===255;return{texture:a,topTexture:o}}};A();var f1="#define LAMBERT\nvarying vec3 vViewPosition;\nvarying vec4 vPosition;\nvarying vec2 vUv;\nvarying vec4 finalPosition;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\nvarying float vBatchId;\nvarying vec4 vWorldPosition;\nvarying vec3 vWorldNormal;\n\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n vWorldNormal = normalize((modelMatrix * vec4(objectNormal, 0.0)).xyz);\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n vec4 _fogWorldPos = vec4(transformed, 1.0);\n #ifdef USE_BATCHING\n _fogWorldPos = batchingMatrix * _fogWorldPos;\n #endif\n vWorldPosition = modelMatrix * _fogWorldPos;\n \n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n \n // To mitigate visual defects on machines such as windows and iOS\n vBatchId = getIndirectIndex(gl_DrawID) + 0.5;\n vViewPosition = - mvPosition.xyz;\n worldNormal = normal;\n vUv = uv;\n vVerticalOffset = position.z;\n}\n";A();var m1="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform float uGradientEnd;\nuniform float uGradientIntensity;\nuniform float uMinSideAlpha;\nuniform float uMaxSideAlpha;\nuniform float uGradientStart;\nuniform highp sampler2D uPropertiesTexture;\nuniform highp sampler2D uTopTexture;\nuniform highp sampler2D uTexture;\nuniform float uRepeatYFactor;\nuniform bool uBlendTexture;\nuniform float effectStart;\nuniform float effectDistance;\nuniform float darkenAmount;\nuniform float darkenUseDepth;\nuniform float desaturateAmount;\nuniform float desaturateUseDepth;\nuniform float washOutAmount;\nuniform float washOutUseDepth;\nvarying float vBatchId;\n\nvarying vec2 vUv;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\n\nfloat shadowThreshold = 0.05;\nfloat shadowStrengthMultiplier = 0.6;\n\n#include <common>\nuniform sampler2D shadowMap;\nuniform mat4 lightMatrix;\nuniform float cameraNear;\nuniform float cameraFar;\nuniform float shadowBias;\nuniform float shadowOpacity;\nuniform vec3 baseColor;\nuniform float shadowMapSize;\nuniform float pcfSpread;\nuniform vec3 sunDir;\nuniform float normalBias;\nuniform bool shadowEnabled;\nuniform float depthRangeMax;\nvarying vec4 vWorldPosition;\nvarying vec3 vWorldNormal;\n\nfloat interleavedGradientNoise(vec2 position) {\n vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n return fract(magic.z * fract(dot(position, magic.xy)));\n}\n\n// Compile-time sample count for loop unrolling (injected via material)\n#ifndef PCF_SAMPLES\n#define PCF_SAMPLES 4\n#endif\n\n// Poisson disk samples - only define what we need based on sample count\n#if PCF_SAMPLES <= 4\nconst vec2 poissonDisk[4] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760)\n);\n#elif PCF_SAMPLES <= 8\nconst vec2 poissonDisk[8] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379)\n);\n#else\nconst vec2 poissonDisk[16] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554),\n vec2(0.53742981, -0.47373420),\n vec2(-0.26496911, -0.41893023),\n vec2(0.79197514, 0.19090188),\n vec2(-0.24188840, 0.99706507),\n vec2(-0.81409955, 0.91437590),\n vec2(0.19984126, 0.78641367),\n vec2(0.14383161, -0.14100790)\n);\n#endif\n\n/**\n * Samples the shadow map using PCF (Percentage Closer Filtering)\n * Uses compile-time loop count for GPU optimization\n * @param lightSpacePos Position in light space coordinates\n * @param outDepthGap Output: average depth gap between receiver and caster (for self-shadow detection)\n * @returns Visibility factor (1.0 = fully lit, 0.0 = fully shadowed)\n */\nfloat sampleShadowWithDepthGap(vec3 lightSpacePos, out float outDepthGap) {\n float scaledTexelSize = (1.0 / shadowMapSize) * pcfSpread;\n float currentDepth = lightSpacePos.z * depthRangeMax;\n \n // Rotation for temporal stability\n float noise = interleavedGradientNoise(gl_FragCoord.xy) * 6.283185;\n float cosNoise = cos(noise);\n float sinNoise = sin(noise);\n mat2 rotation = mat2(cosNoise, -sinNoise, sinNoise, cosNoise);\n \n float shadow = 0.0;\n float totalDepthGap = 0.0;\n float shadowSamples = 0.0;\n \n // Compile-time unrolled loop - GPU can optimize this efficiently\n for(int i = 0; i < PCF_SAMPLES; i++) {\n vec2 offset = rotation * poissonDisk[i] * scaledTexelSize;\n vec2 uv = clamp(lightSpacePos.xy + offset, 0.0, 1.0);\n \n float sampledDepth = texture2D(shadowMap, uv).r;\n float inShadow = step(sampledDepth + shadowBias, currentDepth);\n shadow += inShadow;\n \n // Track depth gap for shadow samples\n if(inShadow > 0.5) {\n totalDepthGap += currentDepth - sampledDepth;\n shadowSamples += 1.0;\n }\n }\n \n // Calculate average depth gap (0 if no shadow samples)\n outDepthGap = shadowSamples > 0.0 ? totalDepthGap / shadowSamples : 0.0;\n \n return 1.0 - shadow / float(PCF_SAMPLES);\n}\n\n/**\n * Samples the shadow map using PCF (Percentage Closer Filtering)\n * Uses compile-time loop count for GPU optimization\n * @param lightSpacePos Position in light space coordinates\n * @returns Visibility factor (1.0 = fully lit, 0.0 = fully shadowed)\n */\nfloat sampleShadow(vec3 lightSpacePos) {\n float unusedDepthGap;\n return sampleShadowWithDepthGap(lightSpacePos, unusedDepthGap);\n}\n\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {\n vec3 texturedColor = diffuseColor * texColor.rgb;\n return mix(diffuseColor, texturedColor, texColor.a);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n // get the normalized world normal of vertex fragment\n vec3 surfaceNormal = normalize(worldNormal);\n\n // dot product with Z up (1.0 = horizontal top, 0.0 = vertical side)\n float dotUp = abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)));\n\n int idx = int(vBatchId) * 1;\n vec3 diffuse = texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb;\n bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;\n\n if(shouldShowTexture) {\n vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));\n diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;\n }\n\n // if this is a fragment facing upwards, use topColor (dotUp > 0.99996 \u2248 angle < 0.02\xB0)\n if(dotUp > 0.99996) {\n bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;\n\n if(shouldShowTopTexture) {\n vec4 topTex2d = texture2D(uTopTexture, vUv);\n diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;\n } else {\n diffuse = texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb;\n }\n }\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n\n // only for vertical surfaces (dotUp < 0.0175 \u2248 angle > 89\xB0)\n if(dotUp < 0.0175) {\n\n // get the percentage of the z position from the ground, up\n float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);\n\n // gradient based on percentage\n float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);\n\n // mix the shadow color with the diffuse color based on the alpha and opacity\n diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);\n }\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n if (shadowEnabled){\n vec3 surfaceNormal = normalize(vWorldNormal);\n float ndl = max(dot(surfaceNormal, -sunDir), 0.0);\n \n // Apply normal offset bias to prevent self-shadowing on thin geometry\n // Offset the position along the surface normal before shadow calculation\n vec3 normalOffset = surfaceNormal * normalBias;\n vec4 offsetWorldPos = vWorldPosition + vec4(normalOffset, 0.0);\n \n // Calculate shadow in light space using offset position\n vec4 shadowCoord = lightMatrix * offsetWorldPos;\n vec3 projCoords = shadowCoord.xyz / shadowCoord.w;\n \n // Check if fragment is within shadow map bounds\n bool inBounds = projCoords.x >= 0.0 && projCoords.x <= 1.0 && \n projCoords.y >= 0.0 && projCoords.y <= 1.0 && \n projCoords.z >= 0.0 && projCoords.z <= 1.0;\n \n \n if(inBounds){\n float depthGap;\n float visibility = sampleShadowWithDepthGap(projCoords, depthGap);\n float shadowIntensity = 1.0 - visibility;\n \n // Prevent self-shadowing on sun-facing surfaces, but keep real shadows from objects above\n // depthGap is small for self-shadowing, larger for real shadows from other objects\n // Only apply normal-based fade when depth gap is small (likely self-shadow)\n float selfShadowThreshold = 0.001; // Depth gap threshold for self-shadow detection\n float isSelfShadow = 1.0 - smoothstep(0.0, selfShadowThreshold, depthGap);\n \n // Normal-based fade: reduce shadows on sun-facing surfaces\n float normalFade = 1.0 - smoothstep(0.3, 0.7, ndl);\n \n // Combine: only apply normal fade for self-shadows, keep full intensity for real shadows\n float combinedFade = mix(1.0, normalFade, isSelfShadow);\n shadowIntensity *= combinedFade;\n \n // Only apply shadow if intensity is significant (prevents subtle darkening)\n if(shadowIntensity > shadowThreshold) {\n float shadowStrength = shadowIntensity * shadowOpacity;\n vec3 shadowedColor = mix(gl_FragColor.rgb, baseColor * gl_FragColor.rgb, shadowStrength * shadowStrengthMultiplier);\n gl_FragColor.rgb = shadowedColor;\n }\n }\n }\n\n // Depth-based visual effects: de-emphasize geometry below a given altitude.\n // effectStart = altitude where effects begin,\n // effectDistance = range over which effects reach full strength.\n if(effectDistance > 0.0) {\n // Normalized depth: 0 at effectStart altitude, 1 at the furthest affected geometry\n float t = clamp((effectStart - vWorldPosition.z) / effectDistance, 0.0, 1.0);\n // Depth curve: ramps quickly then plateaus (max ~0.9 to keep layers distinguishable)\n float fade = pow(t, 0.65) * 0.9;\n\n // Desaturate towards grayscale using perceptual luminance weights\n float luma = dot(gl_FragColor.rgb, vec3(0.299, 0.587, 0.114));\n float dsFade = desaturateUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(luma), desaturateAmount * dsFade);\n\n // Darken towards #333333\n float dkFade = darkenUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2), darkenAmount * dkFade);\n\n // Wash out towards white\n float woFade = washOutUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(1.0), washOutAmount * woFade);\n }\n\n #include <dithering_fragment>\n\n}\n";var I6=-.05,E6=1,vs=class e extends em{constructor(i,r,n=1){super(i);P(this,"propertiesTexture");P(this,"texturesVisible",!1);P(this,"pcfSampleCount",4);P(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:void 0},uTexture:{value:void 0},uRepeatYFactor:{value:1},uBlendTexture:{value:!1},effectStart:{value:0},effectDistance:{value:0},darkenAmount:{value:0},darkenUseDepth:{value:1},desaturateAmount:{value:0},desaturateUseDepth:{value:1},washOutAmount:{value:0},washOutUseDepth:{value:0},shadowOpacity:{value:.5},shadowMapSize:{value:1024},pcfSpread:{value:1},sunDir:{value:new Ve(0,1,0)},normalBias:{value:.05},shadowEnabled:{value:!1},depthRangeMax:{value:1},shadowMap:{value:null},lightMatrix:{value:new rr},cameraNear:{value:.1},cameraFar:{value:1e3},shadowBias:{value:1e-5},baseColor:{value:new Ve(0,0,0)}});P(this,"colorSpace",Ph);P(this,"showTextures",i=>{this.texturesVisible=!0;let r=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(r||n)&&(this.propertiesTexture.setTexture(i,r,n),this.needsUpdate=!0)});this.alphaTest=.01,this.propertiesTexture=new th(r),this.uniforms.uRepeatYFactor.value=n,this.onBeforeCompile=a=>{let o=this.uniforms.uGradientIntensity,s=this.uniforms.uGradientEnd,l=this.uniforms.uGradientStart,u=this.uniforms.uTopTexture,h=this.uniforms.uTexture,c=this.uniforms.uRepeatYFactor,p=this.uniforms.uBlendTexture,d=this.uniforms.effectStart,f=this.uniforms.effectDistance,y=this.uniforms.darkenAmount,g=this.uniforms.darkenUseDepth,_=this.uniforms.desaturateAmount,b=this.uniforms.desaturateUseDepth,v=this.uniforms.washOutAmount,w=this.uniforms.washOutUseDepth,T=this.uniforms.shadowOpacity,S=this.uniforms.shadowMapSize,M=this.uniforms.pcfSpread,E=this.uniforms.sunDir,L=this.uniforms.normalBias,z=this.uniforms.shadowEnabled,R=this.uniforms.depthRangeMax,k=this.uniforms.shadowMap,D=this.uniforms.lightMatrix,x=this.uniforms.cameraNear,C=this.uniforms.cameraFar,I=this.uniforms.shadowBias,F=this.uniforms.baseColor;this.uniforms=a.uniforms,a.vertexShader=f1,a.fragmentShader="#define PCF_SAMPLES ".concat(this.pcfSampleCount,"\n")+m1,k!=null&&k.value&&(z!=null&&z.value)&&(D!=null&&D.value)&&(a.uniforms.shadowMap={value:k.value},a.uniforms.lightMatrix={value:D.value},a.uniforms.cameraNear={value:x.value},a.uniforms.cameraFar={value:C.value},a.uniforms.shadowBias={value:I.value},a.uniforms.baseColor={value:F.value},a.uniforms.shadowMapSize={value:S.value},a.uniforms.pcfSpread={value:M.value},a.uniforms.sunDir={value:E.value},a.uniforms.normalBias={value:L.value},a.uniforms.shadowEnabled={value:!0},a.uniforms.depthRangeMax={value:R.value}),Object.assign(this.uniforms,{uGradientIntensity:o,uGradientEnd:s,uGradientStart:l,effectStart:d,effectDistance:f,darkenAmount:y,darkenUseDepth:g,desaturateAmount:_,desaturateUseDepth:b,washOutAmount:v,washOutUseDepth:w,shadowOpacity:T,shadowMapSize:S,pcfSpread:M,sunDir:E,normalBias:L,shadowEnabled:z,depthRangeMax:R,shadowMap:k,lightMatrix:D,cameraNear:x,cameraFar:C,shadowBias:I,baseColor:F,uMinSideAlpha:{value:I6},uMaxSideAlpha:{value:E6},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:h,uRepeatYFactor:c,uBlendTexture:p}),this.userData||(this.userData={}),this.userData.shadowUniforms=a.uniforms}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(i){i!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=i,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(i){if(i==null){this.uniforms.uTexture.value=null;return}i.wrapS=Fa,i.wrapT=Fa,i.colorSpace=this.colorSpace,this.uniforms.uTexture.value=i}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(i){if(i==null){this.uniforms.uTopTexture.value=null;return}i.wrapS=Fa,i.wrapT=Fa,i.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=i}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(i){i!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=i,this.colorSpace=i?$f:Ph,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(i,r,n){this.uniforms.uGradientStart.value=i,this.uniforms.uGradientEnd.value=r,this.uniforms.uGradientIntensity.value=n}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setEffectRange(i,r){this.uniforms.effectStart.value=i,this.uniforms.effectDistance.value=r}getEffectRange(){return{start:this.uniforms.effectStart.value,distance:this.uniforms.effectDistance.value}}setVisualEffect(i,r,n,a,o,s){this.uniforms.darkenAmount.value=i,this.uniforms.darkenUseDepth.value=r?1:0,this.uniforms.desaturateAmount.value=n,this.uniforms.desaturateUseDepth.value=a?1:0,this.uniforms.washOutAmount.value=o,this.uniforms.washOutUseDepth.value=s?1:0}getVisualEffect(){return{darkenAmount:this.uniforms.darkenAmount.value,darkenUseDepth:this.uniforms.darkenUseDepth.value,desaturateAmount:this.uniforms.desaturateAmount.value,desaturateUseDepth:this.uniforms.desaturateUseDepth.value,washOutAmount:this.uniforms.washOutAmount.value,washOutUseDepth:this.uniforms.washOutUseDepth.value}}setColor(i,r,n){this.propertiesTexture.setColor(i,r,n)}getColor(i){return this.propertiesTexture.getColor(i)}hideTextures(i){this.texturesVisible=!1;let r=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(r||n)&&(this.propertiesTexture.setTexture(i,!1,!1),this.needsUpdate=!0)}removeSideTexture(i){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let r=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(i,!1,r),this.needsUpdate=!0}}removeTopTexture(i){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let r=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(i,r,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}setShadowUniforms(i,r,n,a,o,s,l,u,h,c,p,d,f,y){this.uniforms.lightMatrix.value.copy(r),this.uniforms.shadowMap.value=i,this.uniforms.sunDir.value.copy(p),this.uniforms.shadowOpacity.value=s,this.uniforms.baseColor.value=l,this.uniforms.shadowBias.value=o,this.uniforms.normalBias.value=d,this.uniforms.pcfSpread.value=h,this.uniforms.shadowMapSize.value=u,this.uniforms.shadowEnabled.value=y,this.uniforms.depthRangeMax.value=f,this.uniforms.cameraNear.value=n,this.uniforms.cameraFar.value=a,c!==this.pcfSampleCount&&(this.pcfSampleCount=c,this.needsUpdate=!0)}clone(i){let r=new e(i!=null?i:{},1,this.repeatYFactor);this.texture&&(r.texture=this.texture),this.topTexture&&(r.topTexture=this.topTexture),this.blendTexture&&(r.blendTexture=this.blendTexture);let n=this.getGradientShading();return n.intensity>0&&r.setGradientShading(n.start,n.end,n.intensity),r}};A();function SH(e,t){var h,c,p,d;let i=0;for(let f of e)i+=((c=(h=f.components[0])==null?void 0:h.geometry)==null?void 0:c.attributes.position.count)||0;let r=new fi(t.color),n=(p=t.opacity)!=null?p:1,a=new vs({color:r,side:_f((d=t.side)!=null?d:"auto",n),opacity:n,transparent:n<1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},e.length),o=new Ra(e.length,i,0,a);o.renderOrder=Kv.GEOMETRY;let s,l,u;for(let f of e)s=f.components[0],!(!(s instanceof Qi)||!s.geometry)&&(s.mesh=o,s.material=a,s.instanceIndex=o.addGeometry(s.geometry),o.addInstance(s.instanceIndex),o.userData.entities[s.instanceIndex]=f.id,a instanceof vs&&a.setColor(s.instanceIndex,r,t.topColor?new fi(t.topColor):r),l=o.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(u=o.getGeometryRangeAt(l),u&&(s.batchedProps.range=u),s.batchedProps.geometryId=l));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}function xf(e,t=30){return Q(e).darken(t).toRgbString()}function CH(e,t,i,r){if(t.length<1)return;e.boundingBox||e.computeBoundingBox();let n=e.boundingBox,a=e.getAttribute("position"),o=e.getAttribute("normal"),s=e.getAttribute("uv"),l,u;e.index?(l=e.index.count/3,u=function(v,w){return e.index.getX(v*3+w)}):(l=a.count/3,u=function(v,w){return v*3+w});let h=new rr;h.makeRotationFromQuaternion(new Th().setFromEuler(new Sh(0,0,i/180*Math.PI)));let c=t.find(v=>v.face==="top"),p;c&&(p={min:r(c.bounds[1],c.bounds[0],0),max:r(c.bounds[3],c.bounds[2],n.max.z)});let d=t.find(v=>v.face==="side"),f;if(d&&(f={min:r(d.bounds[1],d.bounds[0],0),max:r(d.bounds[3],d.bounds[2],n.max.z)}),!(!f&&!p))for(let v=0;v<l;++v){let w=o.getX(u(v,0))+o.getX(u(v,1))+o.getX(u(v,2)),T=o.getY(u(v,0))+o.getY(u(v,1))+o.getY(u(v,2)),S=o.getZ(u(v,0))+o.getZ(u(v,1))+o.getZ(u(v,2)),M=Math.abs(w),E=Math.abs(T),L=Math.abs(S);var y,g;M<=E&&M<=L?(y="x",E<=L?g="y":g="z"):E<=M&&E<=L?(y="y",M<=L?g="x":g="z"):(y="z",M<=E?g="x":g="y"),y==="z"&&(y=g,g="z");let z,R,k,D,x,C;if(g==="z"||y==="z"){if(!d||!f)continue;z=d.repeat.u,R=d.repeat.v,k=d.offset.u,D=d.offset.v,x=d.rotation,C=f}else{if(!c||!p)continue;z=c.repeat.u,R=c.repeat.v,k=c.offset.u,D=c.offset.v,x=(360-i+c.rotation)%360,C=p}let{min:I,max:F}=C,N=new zt;N.position.set(I.x,I.y,0),N.updateMatrix(),N.updateMatrixWorld();let G=I.clone().applyMatrix4(h),J=F.clone().applyMatrix4(h),ee=Math.abs(J.x-G.x),ke=Math.abs(J.y-G.y),Ie=new Ve(ee,ke,F.z).applyMatrix4(N.matrixWorld),Be=Math.abs(Ie[y]-I[y]),Ne=Math.abs(Ie[g]-I[g]),bt=x*Math.PI/180||0,St=Math.cos(bt),Jt=Math.sin(bt),Qt=N.matrixWorld.clone().invert(),Cr=new Th().setFromEuler(new Sh(0,0,i/180*Math.PI));for(let Ct=0;Ct<3;Ct++){let Xn=new Ve(a.getX(u(v,Ct)),a.getY(u(v,Ct)),a.getZ(u(v,Ct))).applyMatrix4(Qt);Xn.applyQuaternion(Cr);let tn=Xn.applyMatrix4(N.matrixWorld),er=tn.x,rn=tn.y,tr=tn.z;var _,b;y==="x"?_=z*(er-I[y])/Be+k:y==="y"?_=z*(rn-I[y])/Be+k:_=z*(tr-I[y])/Be+k,g==="x"?b=R*(er-I[g])/Ne+D:g==="y"?b=R*(rn-I[g])/Ne+D:b=R*(tr-I[g])/Ne+D,_-=.5,b-=.5;let ei=_*St-b*Jt+.5,Vt=_*Jt+b*St+.5;s.setX(u(v,Ct),ei),s.setY(u(v,Ct),Vt)}}}function ih(e){if(!e.startsWith("data:"))return;let t=e.indexOf(",");if(t===-1)return;let i=e.slice(5,t),r=e.slice(t+1),n=i.split(";"),a=n[0]||"",o=n.includes("base64");return{mimeType:a,isBase64:o,data:r}}function MH(e){if(e.trimStart().startsWith("{"))return!0;let t=ih(e);return t!=null&&t.mimeType==="application/json"}function IH(e){let t=ih(e);return t?atob(t.data):e}function EH(e){let t=ih(e);return!t||!t.isBase64?!1:t.mimeType==="application/gltf-binary"||t.mimeType==="application/octet-stream"}function AH(e){let t=ih(e);if(!t)return ft.error("Invalid binary data URI",e),new ArrayBuffer(0);let i=atob(t.data),r=new Uint8Array(i.length);for(let n=0;n<i.length;n++)r[n]=i.charCodeAt(n);return r.buffer}A();var rh=class{constructor(){P(this,"type","focusable");P(this,"dirty",!0);P(this,"vertices");P(this,"boundingBox",new on)}};A();var nh=class{constructor(t,i){P(this,"type","texture");P(this,"texture");P(this,"topTexture");P(this,"showTexture",!0);P(this,"showTopTexture",!0);P(this,"textureInstance");P(this,"topTextureInstance");P(this,"dirty",!0);this.texture=typeof t=="string"?{path:t}:t,this.topTexture=typeof i=="string"?{path:i}:i}};A();var ah=class{constructor(){P(this,"type","border");P(this,"dirty",!0);P(this,"needsRebuild",!1);P(this,"mesh")}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}};A();var oh=class{constructor(){P(this,"type","mask");P(this,"maskId",0);P(this,"enabled",!0);P(this,"mode","mask");P(this,"effect","hide");P(this,"dirty",!0)}};A();var sh=class{constructor(){P(this,"type","clippingPlane");P(this,"dirty",!0);P(this,"needsRebuild",!1);P(this,"verticalOffset",1/0);P(this,"plane");P(this,"holeFillMesh");P(this,"topColor");P(this,"topVisible",!0)}};function bs(e,t,i){if(t!==void 0){if(e.type==="model"||e.type==="path"||e.type==="marker"||e.type==="label"||e.type==="geometry"||e.type==="group-container"||e.type==="custom-geometry")return t===!0?(e instanceof Tr&&e.components[1]===void 0?(e.components[1]=new Sa,e.components[1].dirty=!0,e.components[0].interactive=!0):e instanceof Ht&&e.components[2]===void 0?(e.components[2]=new Sa,e.components[2].dirty=!0):e instanceof Nt&&e.components[0]===void 0&&(e.components[0]=new Sa,e.components[0].dirty=!0),!0):(e instanceof Tr?(e.components[1]=void 0,e.components[0].interactive=!1):e instanceof Ht?e.components[2]=void 0:e instanceof Nt&&(e.components[0]=void 0),!0);if(e.type==="batched-geometry-group"){let r;for(let n of e.userData.entities3D.values())r=i.geometry3DMap.get(n),bs(r,t,i);return!0}}return!1}function yK(e,t,i){var r;if(!(!(i!=null&&i.color)&&!("topColor"in i))){if(i!==void 0&&e.type==="batched-geometry-group"){let n,a=(r=t.outlinesOptions)==null?void 0:r.darkenFactor;for(let o of e.userData.entities3D.values())n=t.geometry3DMap.get(o),n&&g1(n,i,a);return!0}return!1}}function D6(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].shading=t,e.components[1].dirty=!0)}function gK(e,t,i){if(i!==void 0&&e.type==="batched-geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);n&&D6(n,i)}return!0}return!1}function _K(e,t){t!==void 0&&e.type==="geometry"&&(t.showImage!==void 0&&(e.components[1].showImage=t.showImage),t.flipImageToFaceCamera!==void 0&&(e.components[1].flipImageToFaceCamera=t.flipImageToFaceCamera))}function L6(e,t,i){if(i!==void 0){if(e.type==="geometry"){let r=e.components[1];if(r.height!==i)return r.height=i,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else if(e.type==="batched-geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&L6(n,t,i)}return!0}}return!1}function g1(e,t,i){if(t!==void 0){let r=!1;(e.type==="path"||e.type==="geometry")&&(t.initialColor!==void 0&&t.initialColor!==e.components[1].initialColor&&(e.components[1].initialColor=t.initialColor,r=!0),t.color!==void 0&&t.color!==e.components[1].color&&(e.components[1].color=t.color,r=!0,e.components[3]&&(e.components[3].color=xf(t.color,i),e.components[3].dirty=!0)),"topColor"in t&&(e.components[1].topColor=t.topColor,r=!0),r&&(e.components[1].dirty=!0))}}function xK(e,t,i,r){if(t!==void 0){if(e.type==="label"||e.type==="marker"){let n=i(t[1],t[0],t[2]||0);e.updatePosition(n),r==null||r.expandBoundsIfOutside(n)}else if(e.type==="custom-geometry"){let n=e.components[0],a=i(t[1],t[0],t[2]||0);n.position.copy(a),r==null||r.expandBoundsIfOutside(a)}}}function vK(e,t){var i;return t!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parentObject3D!==t&&e.parentObject3D instanceof Nt?((i=e.parentObject3D)==null||i.removeEntity(e),t.addEntity(e),!0):!1}function bK(e,t){t!==void 0&&(e.type==="marker"||e.type==="label")&&e.components[0].enabled!==t&&(e.components[0].enabled=t)}function wK(e,t,i){var r;if(t!==void 0&&e.type==="marker"){let n=e.components[0],a=!1;if(t.contentHTML!==void 0&&(n.containerEl.innerHTML=t.contentHTML,n.contentHtml=t.contentHTML,a=!0),v1(e,t.placement)&&(n.collisionDirty=!0,a=!0),t.dynamicResize!==void 0&&(n.options.dynamicResize=t.dynamicResize,a=!0),x1(e,(r=t.options)==null?void 0:r.occlude)&&(a=!0),t.options!=null){try{df.parse(t.options||{})}catch(o){return ft.error(o),!1}if(t.options.interactive!=null&&(t.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",bs(e,!1,i)):(n.pointerEvents="none",bs(e,t.options.interactive,i))),t.options.zIndex!=null&&(n.options.zIndex=t.options.zIndex),t.options.animated!=null&&(n.options.animated=t.options.animated,n.markerContainer.setAttribute("data-animated",String(t.options.animated)),t.options.animated===!1&&n.animation)){try{n.animation.commitStyles()}catch(o){}n.animation.cancel(),n.animation=null}_1(e,t.options.rank),a=!0}return a}return!1}function _1(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=Mn(t),!0):!1}function R6(e,t){var o;if(((o=t==null?void 0:t.options)==null?void 0:o.appearance)==null)return;let i=zu(t.options.appearance||{}),r=i.opacity!=null&&i.opacity!==e.appearance.opacity,a=i.iconScale!=null&&i.iconScale!==e.appearance.iconScale&&typeof i.iconScale=="number"&&Number.isFinite(i.iconScale);r&&(i.opacity=vf(i.opacity)),a&&(i.iconScale=vf(i.iconScale)),wf(e.appearance,i),r&&e.canShow&&e.visibilityNeedsUpdate!=="hide"&&(e.visibilityNeedsUpdate="show")}function PK(e,t,i){var r,n,a,o,s,l;if(t!==void 0&&e.type==="label"){let u=e.components[0];t.text!==void 0&&t.text!==u.text&&(u.text=t.text,u.textDirty=!0),Xd(u.appearance,((r=t.options)==null?void 0:r.appearance)||{})&&(u.textDirty=!0),qd(u.appearance,((n=t.options)==null?void 0:n.appearance)||{})&&(u.pinDirty=!0),R6(u,t),$d(u.options,t.options||{})&&(v1(e,(a=t.options)==null?void 0:a.textPlacement),u.currentStrategyIndex=-1,u.collisionDirty=!0),bs(e,(o=t.options)==null?void 0:o.interactive,i),_1(e,(s=t.options)==null?void 0:s.rank),x1(e,(l=t.options)==null?void 0:l.occlude)}}function x1(e,t){if(t!==void 0&&(e.type==="label"||e.type==="marker")){let i=e.components[2];if(i)return i.enabled=t,!0}return!1}function v1(e,t){if(t!==void 0){if(e.type==="label"){let i=e.components[0];return i.options.textPlacement=t,i.invalidateStrategies(),!0}else if(e.type==="marker"){let i=e.components[0];return i.options.placement=t,i.invalidateStrategies(),!0}}return!1}function TK(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=t,e.components[1].dirty=!0)}function SK(e,t){if(t!==void 0){let i=e.components[2];if(e.type==="geometry"&&i!=null)return i.hover=t,i.dirty=!0,!0}return!1}function CK(e,t){t!==void 0&&e.type==="image"&&(e.components[1].flipImageToFaceCamera=t)}function MK(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].enableImageCollisions=t)}function b1(e,t,i){if(i!==void 0){if(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"||e.type==="image"||e.type==="text3d"){let r=!1;i!==e.components[1].visible&&(e.components[1].visible=i,e.components[1].dirty=!0,r=!0);let n=e.components[3];return n&&r&&(n.dirty=!0),r}else if(e.type==="batched-geometry-group"){if(e.visible!==i)return e.setVisible(i),!0}else if(e.type==="group-container"){if(e.visible!==i)return e.setVisible(i),i===!1&&e.traverse(r=>{if(r instanceof Ji){let n=t.geometry2DMap.get(r.userData.entityId);if(n){let a=n.components[0];a instanceof Zr&&(a.canShow=i)}}}),!0}else if(e.type==="label"&&e.components[0].visible!==i)return e.components[0].visible=i,!0}return!1}function z6(e,t,i){if(i!==void 0)if(e.type==="batched-geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&z6(n,t,i)}return!0}else if(e.type==="group-container"){if(e.opacity!==i){e.setOpacity(i);let r=1;return e.parent instanceof Nt&&(r=e.parent.opacity),w1(e,t,r),!0}}else e instanceof Ht&&e.components[1].opacity!==i&&(e.components[1].opacity=i,e.components[1].dirty=!0);return!1}function w1(e,t,i=1){if(e.type==="group-container"&&"children"in e&&e.children.length>0){let r=i*e.opacity;e.userData.computedOpacity=r;for(let n of e.children)(n instanceof Dt&&n.type==="batched-geometry-group"||n instanceof Nt&&n.type==="group-container")&&w1(n,t,r)}else if(e.type==="batched-geometry-group")for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r),a;((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(a=n.components[1],a.dirty=!0)}}function IK(e,t,i){let r=!1;if((i==null?void 0:i.texture)!=null||(i==null?void 0:i.topTexture)!=null){if(e.type==="batched-geometry-group")for(let n of e.userData.entities3D.values()){let a=t.geometry3DMap.get(n);a&&B6(a,i)}return!0}return r}function B6(e,t){if(e.type==="geometry"&&((t==null?void 0:t.texture)!=null||(t==null?void 0:t.topTexture)!=null)){let i=!1,r=e.components[6];if(r==null?(e.components[6]=new nh(t==null?void 0:t.texture,t==null?void 0:t.topTexture),i=!0):((t==null?void 0:t.texture)!=null&&(r==null?void 0:r.texture)!==(t==null?void 0:t.texture)&&(r.texture=typeof t.texture=="string"?{path:t.texture}:t.texture,i=!0,r.dirty=!0),(t==null?void 0:t.topTexture)!=null&&(r==null?void 0:r.topTexture)!==(t==null?void 0:t.topTexture)&&(r.topTexture=typeof t.topTexture=="string"?{path:t.topTexture}:t.topTexture,i=!0,r.dirty=!0)),i&&e.components[0]instanceof Qi){let n=e.components[0];return n.detached===!1&&(n.shouldDetach=!0,n.dirty=!0),!0}}return!1}function O6(e,t){let i=!1,r;for(r in t)t[r]!=null&&e[r]!==t[r]&&(e[r]=t[r],i=!0);return i&&(e.dirty=!0),i}function F6(e,t,i){if(e.type==="geometry")O6(e.components[1],i);else if(e.type==="batched-geometry-group"){let r;for(let n of e.userData.entities3D.values())r=t.geometry3DMap.get(n),(r==null?void 0:r.type)==="geometry"&&F6(r,t,i)}}function EK(e,t){if(Object.keys(t!=null?t:{}).length===0||t==null)return!1;if(e.type==="batched-geometry-group"){e.components[0]==null&&t.enabled===!0&&(e.components[0]=new oh);let i=e.components[0];if(i==null)return!1;t.enabled!=null&&i.enabled!==t.enabled&&(i.enabled=t.enabled,i.dirty=!0),t.maskId!=null&&Number.isInteger(t.maskId)&&i.maskId!==t.maskId&&(i.maskId=t.maskId,i.dirty=!0),t.effect!=null&&i&&i.effect!==t.effect&&(i.effect=t.effect,i.dirty=!0),t.mode!=null&&i&&i.mode!==t.mode&&(i.mode=t.mode,i.dirty=!0)}return!1}function AK(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1];if(i.opacity!==t){i.opacity=t;let r=e.components[0],n=e.components[3];n&&(n.dirty=!0),r.detached===!1&&(r.shouldDetach=!0,r.dirty=!0),i.dirty=!0;let a=e.parentObject3D;return(a==null?void 0:a.type)==="batched-geometry-group"&&(a.userData.shadingDirty=!0),!0}}return!1}function N6(e,t,i){if(i!==void 0)if(e.type==="geometry"||e.type==="path"||e.type==="custom-geometry"){let r=e.components[1];if(r.altitude!==i)return r.altitude=i,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else{if(e.type==="group-container"&&e.altitude!==i)return e.setAltitude(i),!0;if(e.type==="batched-geometry-group"){let r;for(let n of e.userData.entities3D.values())r=t.geometry3DMap.get(n),r&&N6(r,t,i)}}return!1}function V6(e,t,i){var r;if(i!==void 0){if(e.type==="batched-geometry-group")for(let n of e.userData.entities3D.values()){let a=t.geometry3DMap.get(n);a instanceof Ht&&V6(a,t,i)}else if(e.type==="geometry"){let n=e.components[3],a=e.components[1];if(!n&&i===!0){let o=(r=t.outlinesOptions)==null?void 0:r.darkenFactor;e.components[3]=new eh(xf(a.color,o))}else n&&(n.enabled=i,n.dirty=!0)}return!0}return!1}function kK(e,t){if(t!==void 0){let i,r=4;if(e.type==="geometry"?(i=e.components[4],r=4):e.type==="group-container"&&(i=e.components[1],r=1),t===!0&&i==null)return e.components[r]=new rh,!0;if(t===!1&&i!=null)return e.components[r]=void 0,!0}return!1}function DK(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1];if(i.renderOrder!==t){i.renderOrder=t;let r=e.components[0];return r.detached===!1&&(r.shouldDetach=!0,r.dirty=!0),r.imageMesh&&(r.imageMesh.renderOrder=t+1),i.dirty=!0,!0}}return!1}function j6(e,t,i){if(i!=null){if(e.type==="geometry"){let r=e.components[1];r.side!==i&&(r.side=i,r.dirty=!0)}else if(e.type==="batched-geometry-group")for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);n instanceof Ht&&j6(n,t,i)}}}function LK(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1],r;if(r=e.components[5],t.borderVisible!==i.borderVisible&&t.borderVisible!=null){if(t.borderVisible===!0){if(r==null){let n=new ah;e.components[5]=n,r=e.components[5]}r.visible=!0,r.dirty=!0}else t.borderVisible===!1&&r!=null&&(r.visible=!1,r.dirty=!0);i.borderVisible=t.borderVisible}i.borderColor!==t.borderColor&&t.borderColor!=null&&(i.borderColor=t.borderColor,r&&(r.dirty=!0)),i.borderWidth!==t.borderWidth&&t.borderWidth!=null&&(i.borderWidth=t.borderWidth,r&&(r.needsRebuild=!0))}}function RK(e,t,i){var o;let{visible:r,color:n}=i;if(e.type!=="path")return;let a=e.components[0];r!=null&&b1(e,t,r),n!=null&&g1(e,{color:n},(o=t.outlinesOptions)==null?void 0:o.darkenFactor),Object.assign(a,U6(i)),bf(i)||(a.materialDirty=!0,i.width!=null&&(a.updateScreenSpaceState(),a.dirty=!0),(i.smoothingTension!=null||i.smoothingCornerRadius!=null)&&(a.dirty=!0),i.__EXPERIMENTAL_GEOMETRY!=null&&(a.dirty=!0),i.__EXPERIMENTAL_ENDCAP_EXTENSION!=null&&(a.dirty=!0))}function U6(e){return ws(e,G6)}var G6=["smoothingTension","smoothingCornerRadius","animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","highlightCompleteFraction","highlightStartFraction","highlightEndFraction","highlightColor","highlightWidthMultiplier","dashed","visibleThroughGeometry","xrayOpacity","xrayStyle","dashLength","dashGap","dashRelativeToWidth","dashSize","gapSize","dashAbsolute","dashMeters","gapMeters","__EXPERIMENTAL_GEOMETRY","__EXPERIMENTAL_ENDCAP_EXTENSION","__EXPERIMENTAL_BILLBOARDING","__EXPERIMENTAL_BORDER","__EXPERIMENTAL_PREVENT_SELF_OVERLAP"];function zK(e){if(!(e instanceof Ht&&e.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var X6=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function BK(e,t,i){b1(e,t,i.visible);let r=e.components[1],n=ws(i,X6);"margin"in i&&ft.warn("update to margin is not supported atm"),"content"in i&&ft.warn("content update is not supported atm");try{d1.parse(n)}catch(a){ft.error(a);return}Object.keys(n).length>0&&(Object.assign(r,n),r.dirty=!0)}var q6=["color","material","opacity","verticalOffset","rotation","position","scale"];function OK(e,t,i,r){var s;let n=ws(t,q6),a=e.components[1],o=e.components[0];if(Object.keys(n).length>0){if(n.material&&(a.material=n.material),n.opacity!=null&&(a.opacity=n.opacity),n.verticalOffset!=null&&(a.verticalOffset=n.verticalOffset),n.color!=null&&(a.color=n.color),n.position!=null&&(o.feature.geometry.coordinates=n.position,o.positionDirty=!0,i&&r)){let l=i(n.position[1],n.position[0],(s=n.position[2])!=null?s:0);r.expandBoundsIfOutside(l)}n.rotation!=null&&(a.rotation=n.rotation),n.scale!=null&&(a.scale=n.scale),n.visibleThroughGeometry!=null&&(o.visibleThroughGeometry=n.visibleThroughGeometry),a.dirty=!0}}function FK(e,t){if(t!==void 0&&e.type==="model"){if(!e.components[1].EXPERIMENTAL_clippingEnabled)return;let r=e.components[7];r==null&&(e.components[7]=new sh,r=e.components[7]),r=e.components[7],t.clippingPlaneZOffset!=null&&r.verticalOffset!==t.clippingPlaneZOffset&&(r.verticalOffset=t.clippingPlaneZOffset,r.dirty=!0),t.clippingPlaneTopColor!=null&&r.topColor!==t.clippingPlaneTopColor&&(r.topColor=t.clippingPlaneTopColor,r.dirty=!0),t.clippingPlaneTopVisible!=null&&r.topVisible!==t.clippingPlaneTopVisible&&(r.topVisible=t.clippingPlaneTopVisible,r.dirty=!0)}}var lh=new on,y1=new Ve;function $6(e,t,i){if(lh.makeEmpty(),lh.setFromObject(e),ff(lh)){lh.getCenter(y1);let c=i(y1);return[c[0],c[1]]}let r=1/0,n=1/0,a=-1/0,o=-1/0,s,l,u;for(let c of e.userData.entities3D.values())s=t.geometry3DMap.get(c),(s==null?void 0:s.type)==="geometry"&&(l=s.components[0],l&&(u=l.featureBbox,u[0]<r&&(r=u[0]),u[1]<n&&(n=u[1]),u[2]>a&&(a=u[2]),u[3]>o&&(o=u[3])));if(r!==1/0)return[(r+a)/2,(n+o)/2];let h=i(e.position);return[h[0],h[1]]}function NK(e,t,i){if(e.userData.centroid)return e.userData.centroid;let r=$6(e,t,i);return e.userData.centroid=r,r}A();A();var Sf=jf(D1());function L1(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}L1.prototype=Error.prototype;Sf.default.Error=function(e){throw new L1(e)};var Sr=Sf.default;var jV="gray",Cf=new Sr.ClipperOffset,Rt=100;function Mf(e,t,i){let{color:r=jV,opacity:n=1,width:a=1,join:o="round",cap:s="round",height:l=.01,altitude:u=0}=i||{};Array.isArray(n)&&(n=0);let h=[],c=e.geometry.coordinates.every(_=>_[2]!=null);for(let _=0;_<e.geometry.coordinates.length-1;_++){let b=t(e.geometry.coordinates[_][1],e.geometry.coordinates[_][0],e.geometry.coordinates[_][2]),v=t(e.geometry.coordinates[_+1][1],e.geometry.coordinates[_+1][0],e.geometry.coordinates[_+1][2]);h.push([b,v])}let p=h[0][0].y;Cf.AddPaths(h.map(_=>_.map(b=>({X:b.x*Rt,Y:(c?b.z:b.y)*Rt}))),o==="round"?Sr.JoinType.jsRound:o==="miter"?Sr.JoinType.jsMiter:Sr.JoinType.jsSquare,s==="round"?Sr.EndType.etOpenRound:s==="butt"?Sr.EndType.etOpenButt:Sr.EndType.etOpenSquare);let d=new Sr.PolyTree;Cf.Execute(d,a/2*Rt);let f=[],y={bevelEnabled:!1,depth:l};for(let _ of d.m_AllPolys){let b=new Kf;if(_.IsHole())continue;let v=_.m_polygon;b.moveTo(v[0].X/Rt,v[0].Y/Rt),v.slice(1).forEach(w=>b.lineTo(w.X/Rt,w.Y/Rt)),b.lineTo(v[0].X/Rt,v[0].Y/Rt),b.holes=_.m_Childs.map(w=>{let T=new Hf,S=w.m_polygon;return T.moveTo(S[0].X/Rt,S[0].Y/Rt),S.slice(1).forEach(M=>T.lineTo(M.X/Rt,M.Y/Rt)),T.lineTo(S[0].X/Rt,S[0].Y/Rt),T}),f.push(new Jf(b,y))}let g=ks(f);return c&&(g.rotateX(Math.PI/2),g.translate(0,p+l/2,u||0)),g.userData={style:{color:r,opacity:n}},Cf.Clear(),g}A();A();var Kt=63710088e-1,rJ={centimeters:Kt*100,centimetres:Kt*100,degrees:360/(2*Math.PI),feet:Kt*3.28084,inches:Kt*39.37,kilometers:Kt/1e3,kilometres:Kt/1e3,meters:Kt,metres:Kt,miles:Kt/1609.344,millimeters:Kt*1e3,millimetres:Kt*1e3,nauticalmiles:Kt/1852,radians:1,yards:Kt*1.0936};function R1(e,t,i={}){let r={type:"Feature"};return(i.id===0||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function z1(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return R1({type:"LineString",coordinates:e},t,i)}function B1(e,t={}){let i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function O1(e,t,i={}){return R1({type:"MultiLineString",coordinates:e},t,i)}A();function dh(e){return e.type==="Feature"?e.geometry:e}function UV(e,t={}){let i=dh(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),i.type){case"Polygon":return GV(i,t);case"MultiPolygon":return XV(i,t);default:throw new Error("invalid poly")}}function GV(e,t={}){let r=dh(e).coordinates,n=t.properties?t.properties:e.type==="Feature"?e.properties:{};return F1(r,n)}function XV(e,t={}){let r=dh(e).coordinates,n=t.properties?t.properties:e.type==="Feature"?e.properties:{},a=[];return r.forEach(o=>{a.push(F1(o,n))}),B1(a)}function F1(e,t){return e.length>1?O1(e,t):z1(e[0],t)}var If=UV;A();function N1(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}function Ef(e){for(;e.children.length>0;)Ef(e.children[0]);"geometry"in e&&e.geometry&&e.geometry.dispose(),"material"in e&&Array.isArray(e.material)?e.material.forEach(function(t){N1(t)}):"material"in e&&typeof e.material<"u"&&N1(e.material),e.parent&&e.parent.remove(e)}A();function V1(e){return e!=null&&e.geometry.type==="Polygon"&&e.geometry.coordinates[0].length>2}function qV(e,t){let i=e[0]*t[0]+e[1]*t[1],r=Math.sqrt(e[0]*e[0]+e[1]*e[1]),n=Math.sqrt(t[0]*t[0]+t[1]*t[1]);if(r===0||n===0)return 0;let a=i/(r*n),o=Math.max(-1,Math.min(1,a));return Math.acos(o)*(180/Math.PI)}function $V(e,t=5){if(e.length<3)return e;let i=e.length>3&&e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1],r=[],n=i?e.length-1:e.length;for(let a=0;a<n;a++){let o=i&&a===0?e[e.length-2]:e[a-1],s=e[a],l=i&&a===e.length-1?e[1]:e[a+1];if(o==null||l==null){r.push(s);continue}let u=[s[0]-o[0],s[1]-o[1]],h=[l[0]-s[0],l[1]-s[1]];qV(u,h)>t&&r.push(s)}if(i&&r.length>0){let a=r[0],o=r[r.length-1];(a[0]!==o[0]||a[1]!==o[1])&&r.push([a[0],a[1]])}return r}function j1(e,t=5){return ri(nt({},e),{geometry:ri(nt({},e.geometry),{coordinates:e.geometry.coordinates.map(i=>$V(i,t))})})}var G1=.1,YV=15,ZV=.25,U1=class{constructor(t,i){P(this,"rendererState");P(this,"dirty",!1);P(this,"convertTo3DMapPosition");P(this,"colorToMaterialCache",{});this.rendererState=t,this.convertTo3DMapPosition=i}update(){var n,a,o;let t,i,r;for(let s of this.rendererState.geometry3DsInScene)if(r=s.components[0],t=s.components[1],i=s.components[5],s.type==="geometry"&&r instanceof Qi&&i!=null){if(i!=null&&i.dirty){if(i.mesh==null)try{if(!V1(r.feature))continue;let l=this.buildBorder(r.feature,t,i);l!=null&&((n=r.mesh)==null||n.add(l))}catch(l){ft.error(l),i.dirty=!1}(a=i.mesh)==null||a.children.forEach(l=>{i&&l.material.color.set(t.borderColor)}),i.dirty=!1,i.visible=t.borderVisible}if(i!=null&&i.needsRebuild){i.mesh!=null&&(Ef(i.mesh),i.mesh=void 0);try{let l=this.buildBorder(r.feature,t,i);l!=null&&((o=r.mesh)==null||o.add(l))}catch(l){ft.error(l)}i.needsRebuild=!1,i.visible=t.borderVisible}}}buildBorder(t,i,r){var v,w,T,S,M;let n=If(t),a=j1(t,YV);if(((w=(v=a.geometry.coordinates[0])==null?void 0:v.length)!=null?w:0)<3)return;let o=If(a),s=i.borderWidth/2,l=i.borderColor,u=Mf(n,this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"square"}),h=u.clone();h.translate(0,0,i.height);let c;o.geometry.type==="LineString"?c=o.geometry.coordinates:c=o.geometry.coordinates.flat();let p=[];c.pop();for(let E of c||[])try{let L=Mf({type:"Feature",geometry:{type:"LineString",coordinates:[[E[0],E[1],0],[E[0],E[1],i.height]]},properties:{}},this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"butt"});p.push(L)}catch(L){ft.warn(L)}let d=ks([u,h,...p]),f=(T=this.colorToMaterialCache[l])==null?void 0:T[0];f==null&&(f=new sn({color:l}));let y=(S=this.colorToMaterialCache[l])==null?void 0:S[1];y==null&&(y=new sn({color:l})),this.colorToMaterialCache[l]=[f,y];let g=new zt,_=new Mr(d,f),b=new Mr(d,y);return g.add(_),g.add(b),b.material.depthWrite=!1,b.material.depthTest=!1,b.material.opacity=ZV,b.material.transparent=!0,g.position.z=(M=i.altitude)!=null?M:0,r.mesh=g,g}destroy(){for(let[t,[i,r]]of Object.entries(this.colorToMaterialCache))i.dispose(),r.dispose();this.colorToMaterialCache={}}};var Af="#ffffff",WV=.1,fh=.1,HV="#333333",Ss,Cs,Ms,kf=class{constructor(t={}){P(this,"type","style");P(this,"initialColor",Af);he(this,Ss,Af);P(this,"initialTopColor");he(this,Cs);he(this,Ms);P(this,"dirty",!0);P(this,"visible",!0);P(this,"opacity",1);P(this,"width",WV);P(this,"height",fh);P(this,"initialHeight",fh);P(this,"altitude",0);P(this,"join","round");P(this,"cap","round");P(this,"showImage",!0);P(this,"flipImageToFaceCamera",!0);P(this,"enableImageCollisions",!1);P(this,"url");P(this,"side","double");P(this,"renderOrder",0);P(this,"shading");P(this,"bevel");P(this,"borderVisible",!1);P(this,"borderColor",HV);P(this,"borderWidth");P(this,"effectStart",0);P(this,"effectDistance",0);P(this,"darkenAmount",0);P(this,"darkenUseDepth",!0);P(this,"desaturateAmount",0);P(this,"desaturateUseDepth",!0);P(this,"washOutAmount",0);P(this,"washOutUseDepth",!1);P(this,"maxImageSize");this.color=(t==null?void 0:t.color)!==void 0?t.color:this.color,this.initialColor=this.color,this.width=(t==null?void 0:t.width)!==void 0?t.width:this.width,this.opacity=(t==null?void 0:t.opacity)!==void 0?t.opacity:this.opacity,this.visible=(t==null?void 0:t.visible)!==void 0?t.visible:this.visible,this.height=(t==null?void 0:t.height)!==void 0?t.height:this.height,this.initialHeight=this.height,this.altitude=(t==null?void 0:t.altitude)!==void 0?t.altitude:this.altitude,this.join=(t==null?void 0:t.join)!==void 0?t.join:this.join,this.cap=(t==null?void 0:t.cap)!==void 0?t.cap:this.cap,this.topColor=t==null?void 0:t.topColor,this.initialTopColor=this.topColor,this.showImage=(t==null?void 0:t.showImage)!==void 0?t.showImage:this.showImage,this.flipImageToFaceCamera=(t==null?void 0:t.flipImageToFaceCamera)!==void 0?t.flipImageToFaceCamera:this.flipImageToFaceCamera,this.url=t==null?void 0:t.url,this.side=(t==null?void 0:t.side)!==void 0?t.side:this.side,this.renderOrder=(t==null?void 0:t.renderOrder)!==void 0?t.renderOrder:this.renderOrder,this.shading=t==null?void 0:t.shading,this.bevel=t==null?void 0:t.bevel,this.borderVisible=(t==null?void 0:t.borderVisible)!==void 0?t.borderVisible:this.borderVisible,this.borderColor=(t==null?void 0:t.borderColor)!==void 0?t.borderColor:this.borderColor,this.borderWidth=(t==null?void 0:t.borderWidth)!==void 0?t.borderWidth:G1,this.enableImageCollisions=(t==null?void 0:t.enableImageCollisions)!==void 0?t.enableImageCollisions:this.enableImageCollisions,this.effectStart=(t==null?void 0:t.effectStart)!==void 0?t.effectStart:this.effectStart,this.effectDistance=(t==null?void 0:t.effectDistance)!==void 0?t.effectDistance:this.effectDistance,this.darkenAmount=(t==null?void 0:t.darkenAmount)!==void 0?t.darkenAmount:this.darkenAmount,this.darkenUseDepth=(t==null?void 0:t.darkenUseDepth)!==void 0?t.darkenUseDepth:this.darkenUseDepth,this.desaturateAmount=(t==null?void 0:t.desaturateAmount)!==void 0?t.desaturateAmount:this.desaturateAmount,this.desaturateUseDepth=(t==null?void 0:t.desaturateUseDepth)!==void 0?t.desaturateUseDepth:this.desaturateUseDepth,this.washOutAmount=(t==null?void 0:t.washOutAmount)!==void 0?t.washOutAmount:this.washOutAmount,this.washOutUseDepth=(t==null?void 0:t.washOutUseDepth)!==void 0?t.washOutUseDepth:this.washOutUseDepth,this.maxImageSize=t==null?void 0:t.maxImageSize}set color(t){Du(t)?ie(this,Ss,t):ft.warn('Failed to update color. Invalid color "'.concat(t,'".'))}get color(){return B(this,Ss)}set topColor(t){t===void 0||Du(t)?ie(this,Cs,t):ft.warn('Failed to update top color. Invalid color "'.concat(t,'".'))}get topColor(){return B(this,Cs)}set hoverColor(t){Du(t)?ie(this,Ms,t):ft.warn('Failed to update hover color. Invalid color "'.concat(t,'".'))}get hoverColor(){return B(this,Ms)}};Ss=new WeakMap,Cs=new WeakMap,Ms=new WeakMap;var Ra=class extends Wf{constructor(){super(...arguments);P(this,"type","entityBatchedMesh");P(this,"userData",{entities:{}})}},Is,Vn,Qi=class{constructor(t){P(this,"mesh");P(this,"imageMesh");P(this,"textMesh");P(this,"textEntityId");P(this,"type","geometry");P(this,"dirty",!0);P(this,"shouldDetach",!1);P(this,"detached",!1);P(this,"instanceIndex",-1);P(this,"geometry");P(this,"batchedProps");P(this,"material");P(this,"feature");P(this,"currentHeight",fh);P(this,"color",new fi);P(this,"topColor",new fi);P(this,"position",new Ve);P(this,"altitude",0);he(this,Is,1);he(this,Vn);this.feature=t}get visible(){return this.mesh&&this.instanceIndex!==-1?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(t){this.mesh&&this.instanceIndex!==-1&&this.mesh.setVisibleAt(this.instanceIndex,t)}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(t){this.mesh&&(this.mesh.renderOrder=t)}setColor(t,i){this.color.set(t),this.topColor.set(i),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}getColor(){var t;return(t=this.material)==null?void 0:t.getColor(this.instanceIndex)}get opacity(){return B(this,Is)}set opacity(t){ie(this,Is,t)}get featureBbox(){return B(this,Vn)?B(this,Vn):(ie(this,Vn,ib(this.feature)),B(this,Vn))}};Is=new WeakMap,Vn=new WeakMap;var Dt=class extends zt{constructor(i){super();P(this,"visible",!0);P(this,"type","batched-geometry-group");P(this,"components",[]);P(this,"userData",{entityId:"",entities3D:new Set,dirty:!0,shadingDirty:!0,positionDirty:!1});this.userData.entityId=i}getComponent(i){return this.components.find(r=>(r==null?void 0:r.type)===i)}setVisible(i){this.visible!==i&&(this.visible=i,this.dispatchEvent({type:"childremoved",child:this}))}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}getfirstChildEntityId(){let i;for(let n of this.children)if(!n.userData.detached){i=n;break}return i instanceof Ra?Object.values(i.userData.entities)[0]:void 0}};var Nt=class e extends zt{constructor(i){super();P(this,"childrenIds",new Set);P(this,"children",[]);P(this,"type","group-container");P(this,"userData",{entityId:"",entities2D:new Set,dirty:!0,occluderDirty:!1,opacity:1,computedOpacity:1,preloadGeometry:!1});P(this,"components",[]);this.userData.entityId=i}getComponent(){}addOccluderFeature(i,r){this.userData.occluderFeature=i,this.userData.occluderId=r,this.userData.occluderDirty=!0}addEntity(i){i instanceof e?(this.childrenIds.add(i.userData.entityId),this.add(i)):i instanceof Tr?(this.childrenIds.add(i.id),this.add(i.object3d),this.userData.entities2D.add(i.id),i.positionDirty=!0):i instanceof Dt?(this.childrenIds.add(i.userData.entityId),this.add(i)):i instanceof Ht&&i.object3d&&(this.childrenIds.add(i.id),this.add(i.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(i){i instanceof e?(this.childrenIds.delete(i.userData.entityId),this.remove(i)):i instanceof Tr?(this.childrenIds.delete(i.id),this.userData.entities2D.delete(i.id),this.remove(i.object3d)):i instanceof Dt?(this.childrenIds.delete(i.userData.entityId),this.remove(i)):i instanceof Ht&&i.object3d&&(this.childrenIds.delete(i.id),this.add(i.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(i){this.visible!==i&&(this.visible=i,this.dispatchEvent({type:"childremoved",child:this}))}setAltitude(i){if(this.position.z!==i){let r=!1;this.matrixWorldAutoUpdate===!1&&(r=!0,jn(this)),this.position.z=i,this.updateMatrixWorld(),r&&Un(this),this.dispatchEvent({type:"childremoved",child:this}),this.set2DGeometryChildrenPositionDirty()}}set2DGeometryChildrenPositionDirty(){this.children.forEach(i=>{i instanceof Ji?i.userData.worldPositionDirty=!0:i instanceof e&&i.set2DGeometryChildrenPositionDirty()})}get altitude(){return this.position.z}setOpacity(i){this.userData.opacity=i}get opacity(){return this.userData.opacity}};A();A();var Df=63710088e-1;function X1(e){return(2*Math.atan(Math.exp((.5-e)*2*Math.PI))-Math.PI/2)*180/Math.PI}function q1(e){return e*360-180}function mh(e){let t=e*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)}function yh(e){return(e+180)/360}function KV(e,t,i,r){let n=e*Math.PI/180,a=2*Math.PI*Df*Math.cos(n),o=i/a,s=r/a,l=yh(t),u=mh(e),h=l+o,c=u-s,p=q1(h);return{lat:X1(c),lon:p}}function JV(e,t,i,r){let n=yh(t),a=mh(e),o=yh(r),s=mh(i),l=o-n,u=a-s,h=e*Math.PI/180,c=2*Math.PI*Df*Math.cos(h),p=l*c,d=u*c;return{x:p,y:d}}function QV(e,t,i=1e-10){if(e.length!==t.length)return!1;let r=Math.abs(e[0]-t[0])<i,n=Math.abs(e[1]-t[1])<i;if(e.length===3&&t.length===3){let a=Math.abs(e[2]-t[2])<i;return r&&n&&a}return r&&n}A();function e8(e){let t=e.min,i=e.max,r=new Ve(t.x,t.y,t.z),n=new Ve(i.x,t.y,t.z),a=new Ve(t.x,i.y,t.z),o=new Ve(i.x,i.y,t.z);return[r,n,a,o]}A();function $1(e,t){let i;return typeof t=="string"||typeof t=="number"?(i=e.geometry2DMap.get(t),i==null&&(i=e.geometry3DMap.get(t))):typeof(t==null?void 0:t.id)=="string"||typeof(t==null?void 0:t.id)=="number"?(i=e.geometry2DMap.get(t.id),i==null&&(i=e.geometry3DMap.get(t.id))):i=t,i}function uQ(e,t,i=[],r=new on,n){(e.getSystems().renderSystem.threeDdirty||e.getSystems().renderSystem.twoDdirty)&&e.renderSync();let a=$1(e.getInternalState(),t);return Y1(a,i,r,n),i}var gh=new Ve;function Y1(e,t=[],i=new on,r){if(e.visible){if(e.isMesh||e.isLine||e.isPoints){let n=e.geometry;if(n.isBufferGeometry){let a=n.attributes.position;for(let o=0;o<a.count;o++)gh.fromBufferAttribute(a,o),r!==void 0&&(gh.z=r),t.push(gh.clone()),i.expandByPoint(gh)}}for(let n of e.children)Y1(n,t,i,r)}}A();function ws(e,t){let i={};for(let r=0;r<t.length;r++){let n=t[r];n in e&&(i[n]=e[n])}return i}function bf(e){return Object.keys(e).length===0}var t8=()=>{};function jn(e,t=!1){t?e.traverse(i=>{jn(i)}):(e.matrixWorldAutoUpdate=!0,e.updateMatrixWorld=zt.prototype.updateMatrixWorld)}function Un(e,t=!1){t?e.traverse(i=>{Un(i)}):(e.matrixWorldAutoUpdate=!1,e.updateMatrixWorld=t8)}var i8=(e,t,i,r,n,a=!1)=>{var l;let o=e instanceof Nt&&e.userData.preloadGeometry,s=a||o&&!e.visible;if(e.children&&(e.visible||o)){jn(e);for(let u of e.children){if(u.visible&&u.type&&!s)if(jn(u),"entities3D"in u.userData&&((l=u.userData)!=null&&l.entities3D)&&u instanceof Dt){i.add(u.userData.entityId),r.add(u);for(let h of u.userData.entities3D.values())i.add(h),t.has(h)&&r.add(t.get(h))}else u.type==="group-container"||u.type==="custom-geometry"?(i.add(u.userData.entityId),r.add(u)):u instanceof Bn&&(i.add(u.userData.entityId),t.has(u.userData.entityId)&&r.add(t.get(u.userData.entityId)));else Un(u);u instanceof Dt&&u.userData.dirty&&n.add(u.userData.entityId),i8(u,t,i,r,n,s)}}else Un(e);return i},r8=(e,t,i,r)=>{var n;if(e.children&&e.visible&&!((n=e.userData)!=null&&n.hidden)){jn(e);for(let a of e.children)a instanceof Ji&&(a.visible?(jn(a),i.add(a.userData.entityId),t.has(a.userData.entityId)&&r.add(t.get(a.userData.entityId))):Un(a)),r8(a,t,i,r)}else Un(e);return i};function wf(e,t){for(let i in t)if(!(i==="__proto__"||i==="constructor"||i==="prototype")){if(t[i]==null){e[i]=void 0;continue}Array.isArray(t[i])?e[i]=t[i]:typeof t[i]=="object"&&typeof e[i]=="object"&&e[i]!==null&&!Array.isArray(e[i])?wf(e[i],t[i]):e[i]=t[i]}return e}function n8(e){return fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}async function SQ(e){let t=await n8(e),{access_token:i}=await t.json();return{"x-mappedin-tiles-key":i}}function CQ(e,t,i){let r=e*(Math.PI/180)/2,n=t/2;return i*Math.tan(r)/n}function MQ(e){return new Zi(new oe(e[0][0],e[0][1]),new oe(e[1][0],e[1][1])).getCenter().toArray()}function IQ(e,t){return e<t||t<=12}function EQ(e){let t=1;return e.type==="batched-geometry-group"&&e.parent!=null&&e.parent instanceof Nt?t=e.parent.userData.computedOpacity:(e.type==="geometry"||e.type==="custom-geometry"||e.type==="model")&&e.parentObject3D!=null&&e.parentObject3D instanceof Dt&&e.parentObject3D.parent!=null&&e.parentObject3D.parent instanceof Nt&&(t=e.parentObject3D.parent.userData.computedOpacity),t}var a8="maplibre-frustum-culling-hack";function AQ(){let e=new Yf(.01,.01,.01),t=new sn({opacity:0,depthWrite:!1,transparent:!0}),i=new Mr(e,t);return i.position.copy(new Ve(0,50,0)),i.frustumCulled=!1,i.name=a8,i}var en=new Ve,Z1=new Na;function kQ(e,t,i=new As){return e.updateMatrixWorld(),e.traverse(r=>{if(r instanceof Mr){let a=r.geometry.attributes.position;if(t.position.distanceTo(r.position)<t.near)return;for(let s=0;s<a.count;s++)en.fromBufferAttribute(a,s),en.applyMatrix4(r.matrixWorld),en.applyMatrix4(t.matrixWorldInverse),en.applyMatrix4(t.projectionMatrix),en.z<1&&en.z>0&&(Z1.set(en.x,en.y),i.expandByPoint(Z1))}}),i}function W1(e,t){let i=t.clientWidth,r=t.clientHeight;return new Na((e.x+1)*i/2,(1-e.y)*r/2)}function DQ(e,t,i){let r=document.createElement("div");r.style.position="absolute",r.style.border="2px solid ".concat(t),r.style.pointerEvents="none";let n=W1(new Na(e.min.x,e.min.y),i),a=W1(new Na(e.max.x,e.max.y),i);r.style.left="".concat(n.x,"px"),r.style.top="".concat(a.y,"px");let o=Math.abs(a.x-n.x),s=Math.abs(a.y-n.y);return r.style.width="".concat(o,"px"),r.style.height="".concat(s,"px"),i.appendChild(r),r}function LQ(e,t){let i=0,r=0,n=e.clientWidth,a=e.clientHeight;if(t){let{left:o,top:s,right:l,bottom:u,type:h}=t,c=o!=null?o:0,p=s!=null?s:0,d=l!=null?l:0,f=u!=null?u:0;h==="portion"?(i=c*n,r=p*a,n=n-i-d*n,a=a-r-f*a):(i=c,r=p,n=n-i-d,a=a-r-f)}return[i,r,n,a].map(o=>Math.max(o,0))}function vf(e){return(e*100|0)/100}function RQ(e,t,i){t>e.getMaxZoom()?(e.setMaxZoom(i),e.setMinZoom(t)):(e.setMinZoom(t),e.setMaxZoom(i))}A();var Lf=class{constructor(t){P(this,"type","text3dStyle");P(this,"visible");P(this,"altitude");P(this,"color");P(this,"dirty",!0);P(this,"maxWidth");P(this,"maxHeight");P(this,"hoverByPolygon");P(this,"flipToFaceCamera",H1.flipToFaceCamera);P(this,"font");P(this,"fillOpacity");P(this,"fontSize");P(this,"margin");P(this,"outlineWidth");P(this,"outlineBlur");P(this,"outlineOffsetX");P(this,"strokeColor");P(this,"strokeOpacity");P(this,"strokeWidth");P(this,"hoverColor");P(this,"outlineOffsetY");P(this,"outlineColor");P(this,"outlineOpacity");t&&Object.assign(this,t)}getState(t=!1){let i={};for(let r in this)!t&&r==="dirty"||this[r]!==void 0&&(i[r]=this[r]);return i}},H1=Object.freeze({visible:!0,color:"black",flipToFaceCamera:!0,fillOpacity:1,font:void 0,fontSize:2,margin:[.2,1,.2,1.5],outlineColor:"black",outlineOpacity:1,outlineWidth:0,outlineOffsetX:0,outlineOffsetY:0,outlineBlur:0,strokeOpacity:1,strokeWidth:0,maxWidth:void 0,maxHeight:void 0,strokeColor:"black",hoverColor:void 0});A();A();var Gn,Rf=class{constructor(t){P(this,"type","modelStyle");P(this,"dirty",!0);P(this,"renderOrderDirty",!0);P(this,"visible",!0);P(this,"opacity",1);P(this,"verticalOffset",0);P(this,"interactive",!1);P(this,"color");P(this,"material");P(this,"rotation");P(this,"scale");he(this,Gn,!1);P(this,"EXPERIMENTAL_clippingEnabled",!1);P(this,"clippingPlaneZOffset",1/0);P(this,"clippingPlaneTopColor");P(this,"clippingPlaneTopVisible",!0);if(t){let i=t,{visibleThroughGeometry:r,EXPERIMENTAL_clippingEnabled:n}=i,a=Nf(i,["visibleThroughGeometry","EXPERIMENTAL_clippingEnabled"]);Object.assign(this,a),r!==void 0&&ie(this,Gn,r),n!==void 0&&(this.EXPERIMENTAL_clippingEnabled=n)}}get visibleThroughGeometry(){return B(this,Gn)}set visibleThroughGeometry(t){B(this,Gn)!==t&&(ie(this,Gn,t),this.renderOrderDirty=!0)}};Gn=new WeakMap;A();var o8=[1,1,1],s8=[0,0,0];export{iw as a,rw as b,l8 as c,ft as d,$r as e,t7 as f,im as g,c8 as h,ci as i,qr as j,OF as k,T$ as l,eb as m,S$ as n,C$ as o,M$ as p,I$ as q,E$ as r,A$ as s,k$ as t,ku as u,B$ as v,NF as w,O$ as x,tb as y,Df as z,Va as A,rm as B,Mh as C,lw as D,Rs as E,Dh as F,vw as G,bw as H,ym as I,gm as J,Lh as K,_m as L,Li as M,uw as N,v8 as O,hw as P,cw as Q,pw as R,lm as S,um as T,Eh as U,hm as V,cm as W,dw as X,fw as Y,mw as Z,yw as _,Du as $,Vd as aa,ZF as ba,Q as ca,Ud as da,Jo as ea,db as fa,Gd as ga,Zr as ha,Yb as ia,nf as ja,xr as ka,Re as la,Ki as ma,hf as na,pf as oa,tW as pa,iW as qa,Ue as ra,Gj as sa,Wj as ta,Hj as ua,Tr as va,Bn as wa,Ht as xa,ff as ya,t$ as za,i$ as Aa,Hv as Ba,Kv as Ca,r$ as Da,n$ as Ea,a$ as Fa,o$ as Ga,DF as Ha,KV as Ia,JV as Ja,QV as Ka,e8 as La,$1 as Ma,uQ as Na,LF as Oa,RF as Pa,Au as Qa,BF as Ra,jn as Sa,Un as Ta,i8 as Ua,r8 as Va,SQ as Wa,CQ as Xa,MQ as Ya,IQ as Za,EQ as _a,AQ as $a,kQ as ab,DQ as bb,LQ as cb,RQ as db,Lf as eb,H1 as fb,Rf as gb,o8 as hb,s8 as ib,h1 as jb,S6 as kb,IW as lb,zW as mb,Qu as nb,eh as ob,XW as pb,_f as qb,qW as rb,vs as sb,SH as tb,xf as ub,CH as vb,MH as wb,IH as xb,EH as yb,AH as zb,rh as Ab,nh as Bb,sh as Cb,bs as Db,yK as Eb,gK as Fb,_K as Gb,L6 as Hb,g1 as Ib,xK as Jb,vK as Kb,bK as Lb,wK as Mb,PK as Nb,x1 as Ob,TK as Pb,SK as Qb,CK as Rb,MK as Sb,b1 as Tb,z6 as Ub,IK as Vb,B6 as Wb,F6 as Xb,EK as Yb,AK as Zb,N6 as _b,V6 as $b,kK as ac,DK as bc,j6 as cc,LK as dc,RK as ec,U6 as fc,zK as gc,X6 as hc,BK as ic,OK as jc,FK as kc,NK as lc,Sr as mc,Mf as nc,Ef as oc,U1 as pc,Af as qc,kf as rc,Ra as sc,Qi as tc,Dt as uc,Nt as vc};