@mappedin/mappedin-js 6.21.1 → 6.22.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.
@@ -1,4 +1,4 @@
1
- import{a as qo}from"./chunk-DEPTGCUS.js";import{$ as Uu,C as _n,D as Uo,Ma as cf,Na as pf,O as sa,Oa as df,P as ju,Pa as ff,Q as ke,Ua as Go,Y as Br,_ as bi,a as M,aa as vt,b as N,ba as Et,d as Nu,da as Nr,e as af,f as Vu,ha as si,i as vi,ia as lf,ob as Xo,r as of,ta as uf,u as sf,za as hf}from"./chunk-73NFNZ3A.js";import{b as rf,d as nf}from"./chunk-PWEV3AFA.js";var ub=rf((Po,ea)=>{M();var UB=200,Xv="__lodash_hash_undefined__",GB=800,XB=16,qv=9007199254740991,$v="[object Arguments]",qB="[object Array]",$B="[object AsyncFunction]",YB="[object Boolean]",ZB="[object Date]",WB="[object Error]",Yv="[object Function]",HB="[object GeneratorFunction]",KB="[object Map]",JB="[object Number]",QB="[object Null]",Zv="[object Object]",e5="[object Proxy]",t5="[object RegExp]",i5="[object Set]",r5="[object String]",n5="[object Undefined]",a5="[object WeakMap]",o5="[object ArrayBuffer]",s5="[object DataView]",l5="[object Float32Array]",u5="[object Float64Array]",h5="[object Int8Array]",c5="[object Int16Array]",p5="[object Int32Array]",d5="[object Uint8Array]",f5="[object Uint8ClampedArray]",m5="[object Uint16Array]",y5="[object Uint32Array]",g5=/[\\^$.*+?()[\]{}|]/g,_5=/^\[object .+?Constructor\]$/,x5=/^(?:0|[1-9]\d*)$/,Ge={};Ge[l5]=Ge[u5]=Ge[h5]=Ge[c5]=Ge[p5]=Ge[d5]=Ge[f5]=Ge[m5]=Ge[y5]=!0;Ge[$v]=Ge[qB]=Ge[o5]=Ge[YB]=Ge[s5]=Ge[ZB]=Ge[WB]=Ge[Yv]=Ge[KB]=Ge[JB]=Ge[Zv]=Ge[t5]=Ge[i5]=Ge[r5]=Ge[a5]=!1;var Wv=typeof global=="object"&&global&&global.Object===Object&&global,v5=typeof self=="object"&&self&&self.Object===Object&&self,Co=Wv||v5||Function("return this")(),Hv=typeof Po=="object"&&Po&&!Po.nodeType&&Po,To=Hv&&typeof ea=="object"&&ea&&!ea.nodeType&&ea,Kv=To&&To.exports===Hv,hd=Kv&&Wv.process,zv=(function(){try{var e=To&&To.require&&To.require("util").types;return e||hd&&hd.binding&&hd.binding("util")}catch{}})(),Fv=zv&&zv.isTypedArray;function b5(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 w5(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}function P5(e){return function(t){return e(t)}}function T5(e,t){return e?.[t]}function S5(e,t){return function(i){return e(t(i))}}var C5=Array.prototype,M5=Function.prototype,hu=Object.prototype,cd=Co["__core-js_shared__"],cu=M5.toString,rr=hu.hasOwnProperty,Ov=(function(){var e=/[^.]+$/.exec(cd&&cd.keys&&cd.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),Jv=hu.toString,I5=cu.call(Object),E5=RegExp("^"+cu.call(rr).replace(g5,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lu=Kv?Co.Buffer:void 0,Bv=Co.Symbol,Nv=Co.Uint8Array,Vv=lu?lu.allocUnsafe:void 0,Qv=S5(Object.getPrototypeOf,Object),jv=Object.create,A5=hu.propertyIsEnumerable,k5=C5.splice,sn=Bv?Bv.toStringTag:void 0,uu=(function(){try{var e=gd(Object,"defineProperty");return e({},"",{}),e}catch{}})(),D5=lu?lu.isBuffer:void 0,Uv=Math.max,L5=Date.now,eb=gd(Co,"Map"),So=gd(Object,"create"),R5=(function(){function e(){}return function(t){if(!un(t))return{};if(jv)return jv(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}})();function ln(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 z5(){this.__data__=So?So(null):{},this.size=0}function F5(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function O5(e){var t=this.__data__;if(So){var i=t[e];return i===Xv?void 0:i}return rr.call(t,e)?t[e]:void 0}function B5(e){var t=this.__data__;return So?t[e]!==void 0:rr.call(t,e)}function N5(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=So&&t===void 0?Xv:t,this}ln.prototype.clear=z5;ln.prototype.delete=F5;ln.prototype.get=O5;ln.prototype.has=B5;ln.prototype.set=N5;function nr(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 V5(){this.__data__=[],this.size=0}function j5(e){var t=this.__data__,i=pu(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():k5.call(t,i,1),--this.size,!0}function U5(e){var t=this.__data__,i=pu(t,e);return i<0?void 0:t[i][1]}function G5(e){return pu(this.__data__,e)>-1}function X5(e,t){var i=this.__data__,r=pu(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}nr.prototype.clear=V5;nr.prototype.delete=j5;nr.prototype.get=U5;nr.prototype.has=G5;nr.prototype.set=X5;function ta(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 q5(){this.size=0,this.__data__={hash:new ln,map:new(eb||nr),string:new ln}}function $5(e){var t=fu(this,e).delete(e);return this.size-=t?1:0,t}function Y5(e){return fu(this,e).get(e)}function Z5(e){return fu(this,e).has(e)}function W5(e,t){var i=fu(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}ta.prototype.clear=q5;ta.prototype.delete=$5;ta.prototype.get=Y5;ta.prototype.has=Z5;ta.prototype.set=W5;function ia(e){var t=this.__data__=new nr(e);this.size=t.size}function H5(){this.__data__=new nr,this.size=0}function K5(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}function J5(e){return this.__data__.get(e)}function Q5(e){return this.__data__.has(e)}function e4(e,t){var i=this.__data__;if(i instanceof nr){var r=i.__data__;if(!eb||r.length<UB-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new ta(r)}return i.set(e,t),this.size=i.size,this}ia.prototype.clear=H5;ia.prototype.delete=K5;ia.prototype.get=J5;ia.prototype.has=Q5;ia.prototype.set=e4;function t4(e,t){var i=md(e),r=!i&&fd(e),n=!i&&!r&&nb(e),a=!i&&!r&&!n&&ob(e),o=i||r||n||a,s=o?w5(e.length,String):[],l=s.length;for(var u in e)(t||rr.call(e,u))&&!(o&&(u=="length"||n&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ib(u,l)))&&s.push(u);return s}function pd(e,t,i){(i!==void 0&&!mu(e[t],i)||i===void 0&&!(t in e))&&yd(e,t,i)}function i4(e,t,i){var r=e[t];(!(rr.call(e,t)&&mu(r,i))||i===void 0&&!(t in e))&&yd(e,t,i)}function pu(e,t){for(var i=e.length;i--;)if(mu(e[i][0],t))return i;return-1}function yd(e,t,i){t=="__proto__"&&uu?uu(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var r4=y4();function du(e){return e==null?e===void 0?n5:QB:sn&&sn in Object(e)?g4(e):P4(e)}function Gv(e){return Mo(e)&&du(e)==$v}function n4(e){if(!un(e)||b4(e))return!1;var t=xd(e)?E5:_5;return t.test(M4(e))}function a4(e){return Mo(e)&&ab(e.length)&&!!Ge[du(e)]}function o4(e){if(!un(e))return w4(e);var t=rb(e),i=[];for(var r in e)r=="constructor"&&(t||!rr.call(e,r))||i.push(r);return i}function tb(e,t,i,r,n){e!==t&&r4(t,function(a,o){if(n||(n=new ia),un(a))s4(e,t,o,i,tb,r,n);else{var s=r?r(dd(e,o),a,o+"",e,t,n):void 0;s===void 0&&(s=a),pd(e,o,s)}},sb)}function s4(e,t,i,r,n,a,o){var s=dd(e,i),l=dd(t,i),u=o.get(l);if(u){pd(e,i,u);return}var h=a?a(s,l,i+"",e,t,o):void 0,c=h===void 0;if(c){var p=md(l),d=!p&&nb(l),f=!p&&!d&&ob(l);h=l,p||d||f?md(s)?h=s:I4(s)?h=d4(s):d?(c=!1,h=h4(l,!0)):f?(c=!1,h=p4(l,!0)):h=[]:E4(l)||fd(l)?(h=s,fd(s)?h=A4(s):(!un(s)||xd(s))&&(h=_4(l))):c=!1}c&&(o.set(l,h),n(h,l,r,a,o),o.delete(l)),pd(e,i,h)}function l4(e,t){return S4(T4(e,t,lb),e+"")}var u4=uu?function(e,t){return uu(e,"toString",{configurable:!0,enumerable:!1,value:D4(t),writable:!0})}:lb;function h4(e,t){if(t)return e.slice();var i=e.length,r=Vv?Vv(i):new e.constructor(i);return e.copy(r),r}function c4(e){var t=new e.constructor(e.byteLength);return new Nv(t).set(new Nv(e)),t}function p4(e,t){var i=t?c4(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}function d4(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t}function f4(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?yd(i,s,l):i4(i,s,l)}return i}function m4(e){return l4(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&&x4(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 y4(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 fu(e,t){var i=e.__data__;return v4(t)?i[typeof t=="string"?"string":"hash"]:i.map}function gd(e,t){var i=T5(e,t);return n4(i)?i:void 0}function g4(e){var t=rr.call(e,sn),i=e[sn];try{e[sn]=void 0;var r=!0}catch{}var n=Jv.call(e);return r&&(t?e[sn]=i:delete e[sn]),n}function _4(e){return typeof e.constructor=="function"&&!rb(e)?R5(Qv(e)):{}}function ib(e,t){var i=typeof e;return t=t??qv,!!t&&(i=="number"||i!="symbol"&&x5.test(e))&&e>-1&&e%1==0&&e<t}function x4(e,t,i){if(!un(i))return!1;var r=typeof t;return(r=="number"?_d(i)&&ib(t,i.length):r=="string"&&t in i)?mu(i[t],e):!1}function v4(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function b4(e){return!!Ov&&Ov in e}function rb(e){var t=e&&e.constructor,i=typeof t=="function"&&t.prototype||hu;return e===i}function w4(e){var t=[];if(e!=null)for(var i in Object(e))t.push(i);return t}function P4(e){return Jv.call(e)}function T4(e,t,i){return t=Uv(t===void 0?e.length-1:t,0),function(){for(var r=arguments,n=-1,a=Uv(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),b5(e,this,s)}}function dd(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var S4=C4(u4);function C4(e){var t=0,i=0;return function(){var r=L5(),n=XB-(r-i);if(i=r,n>0){if(++t>=GB)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function M4(e){if(e!=null){try{return cu.call(e)}catch{}try{return e+""}catch{}}return""}function mu(e,t){return e===t||e!==e&&t!==t}var fd=Gv((function(){return arguments})())?Gv:function(e){return Mo(e)&&rr.call(e,"callee")&&!A5.call(e,"callee")},md=Array.isArray;function _d(e){return e!=null&&ab(e.length)&&!xd(e)}function I4(e){return Mo(e)&&_d(e)}var nb=D5||L4;function xd(e){if(!un(e))return!1;var t=du(e);return t==Yv||t==HB||t==$B||t==e5}function ab(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=qv}function un(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Mo(e){return e!=null&&typeof e=="object"}function E4(e){if(!Mo(e)||du(e)!=Zv)return!1;var t=Qv(e);if(t===null)return!0;var i=rr.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&cu.call(i)==I5}var ob=Fv?P5(Fv):a4;function A4(e){return f4(e,sb(e))}function sb(e){return _d(e)?t4(e,!0):o4(e)}var k4=m4(function(e,t,i){tb(e,t,i)});function D4(e){return function(){return e}}function lb(e){return e}function L4(){return!1}ea.exports=k4});var Wb=rf((aK,No)=>{"use strict";M();var p6=!1,pn=!1,Ub=!0,Gb=!1,m={},Xb=!1;typeof No<"u"&&No.exports?(No.exports=m,Xb=!0):typeof document<"u"?window.ClipperLib=m:self.ClipperLib=m;var Iu;Xb?(ht="chrome",Iu="Netscape"):(ht=navigator.userAgent.toString().toLowerCase(),Iu=navigator.appName);var ht,ve={};ht.indexOf("chrome")!=-1&&ht.indexOf("chromium")==-1?ve.chrome=1:ve.chrome=0;ht.indexOf("chromium")!=-1?ve.chromium=1:ve.chromium=0;ht.indexOf("safari")!=-1&&ht.indexOf("chrome")==-1&&ht.indexOf("chromium")==-1?ve.safari=1:ve.safari=0;ht.indexOf("firefox")!=-1?ve.firefox=1:ve.firefox=0;ht.indexOf("firefox/17")!=-1?ve.firefox17=1:ve.firefox17=0;ht.indexOf("firefox/15")!=-1?ve.firefox15=1:ve.firefox15=0;ht.indexOf("firefox/3")!=-1?ve.firefox3=1:ve.firefox3=0;ht.indexOf("opera")!=-1?ve.opera=1:ve.opera=0;ht.indexOf("msie 10")!=-1?ve.msie10=1:ve.msie10=0;ht.indexOf("msie 9")!=-1?ve.msie9=1:ve.msie9=0;ht.indexOf("msie 8")!=-1?ve.msie8=1:ve.msie8=0;ht.indexOf("msie 7")!=-1?ve.msie7=1:ve.msie7=0;ht.indexOf("msie ")!=-1?ve.msie=1:ve.msie=0;m.biginteger_used=null;var Rr,d6=0xdeadbeefcafe,Vb=(d6&16777215)==15715070;function U(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 Pe(){return new U(null)}function f6(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 m6(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 y6(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}Vb&&Iu=="Microsoft Internet Explorer"?(U.prototype.am=m6,Rr=30):Vb&&Iu!="Netscape"?(U.prototype.am=f6,Rr=26):(U.prototype.am=y6,Rr=28);U.prototype.DB=Rr;U.prototype.DM=(1<<Rr)-1;U.prototype.DV=1<<Rr;var Nd=52;U.prototype.FV=Math.pow(2,Nd);U.prototype.F1=Nd-Rr;U.prototype.F2=2*Rr-Nd;var g6="0123456789abcdefghijklmnopqrstuvwxyz",Au=new Array,na,ai;na=48;for(ai=0;ai<=9;++ai)Au[na++]=ai;na=97;for(ai=10;ai<36;++ai)Au[na++]=ai;na=65;for(ai=10;ai<36;++ai)Au[na++]=ai;function jb(e){return g6.charAt(e)}function qb(e,t){var i=Au[e.charCodeAt(t)];return i??-1}function _6(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function x6(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 Lr(e){var t=Pe();return t.fromInt(e),t}function v6(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:qb(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&&U.ZERO.subTo(this,this)}function b6(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function w6(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=jb(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+=jb(r));return n?a:"0"}function P6(){var e=Pe();return U.ZERO.subTo(this,e),e}function T6(){return this.s<0?this.negate():this}function S6(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 ku(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 C6(){return this.t<=0?0:this.DB*(this.t-1)+ku(this[this.t-1]^this.s&this.DM)}function M6(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 I6(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 E6(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 A6(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 k6(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 D6(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&&U.ZERO.subTo(t,t)}function L6(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 R6(e,t,i){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t?.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=Pe());var a=Pe(),o=this.s,s=e.s,l=this.DB-ku(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??Pe();for(a.dlShiftTo(g,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),U.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&&U.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),o<0&&U.ZERO.subTo(i,i)}}}function z6(e){var t=Pe();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(U.ZERO)>0&&e.subTo(t,t),t}function dn(e){this.m=e}function F6(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function O6(e){return e}function B6(e){e.divRemTo(this.m,null,e)}function N6(e,t,i){e.multiplyTo(t,i),this.reduce(i)}function V6(e,t){e.squareTo(t),this.reduce(t)}dn.prototype.convert=F6;dn.prototype.revert=O6;dn.prototype.reduce=B6;dn.prototype.mulTo=N6;dn.prototype.sqrTo=V6;function j6(){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 fn(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 U6(e){var t=Pe();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(U.ZERO)>0&&this.m.subTo(t,t),t}function G6(e){var t=Pe();return e.copyTo(t),this.reduce(t),t}function X6(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 q6(e,t){e.squareTo(t),this.reduce(t)}function $6(e,t,i){e.multiplyTo(t,i),this.reduce(i)}fn.prototype.convert=U6;fn.prototype.revert=G6;fn.prototype.reduce=X6;fn.prototype.mulTo=$6;fn.prototype.sqrTo=q6;function Y6(){return(this.t>0?this[0]&1:this.s)==0}function Z6(e,t){if(e>4294967295||e<1)return U.ONE;var i=Pe(),r=Pe(),n=t.convert(this),a=ku(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 W6(e,t){var i;return e<256||t.isEven()?i=new dn(t):i=new fn(t),this.exp(e,i)}U.prototype.copyTo=_6;U.prototype.fromInt=x6;U.prototype.fromString=v6;U.prototype.clamp=b6;U.prototype.dlShiftTo=M6;U.prototype.drShiftTo=I6;U.prototype.lShiftTo=E6;U.prototype.rShiftTo=A6;U.prototype.subTo=k6;U.prototype.multiplyTo=D6;U.prototype.squareTo=L6;U.prototype.divRemTo=R6;U.prototype.invDigit=j6;U.prototype.isEven=Y6;U.prototype.exp=Z6;U.prototype.toString=w6;U.prototype.negate=P6;U.prototype.abs=T6;U.prototype.compareTo=S6;U.prototype.bitLength=C6;U.prototype.mod=z6;U.prototype.modPowInt=W6;U.ZERO=Lr(0);U.ONE=Lr(1);function H6(){var e=Pe();return this.copyTo(e),e}function K6(){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 J6(){return this.t==0?this.s:this[0]<<24>>24}function Q6(){return this.t==0?this.s:this[0]<<16>>16}function eN(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function tN(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function iN(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=Lr(i),n=Pe(),a=Pe(),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 rN(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=qb(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&&U.ZERO.subTo(this,this)}function nN(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(U.ONE.shiftLeft(e-1),Vd,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(U.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 aN(){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 oN(e){return this.compareTo(e)==0}function sN(e){return this.compareTo(e)<0?this:e}function lN(e){return this.compareTo(e)>0?this:e}function uN(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 hN(e,t){return e&t}function cN(e){var t=Pe();return this.bitwiseTo(e,hN,t),t}function Vd(e,t){return e|t}function pN(e){var t=Pe();return this.bitwiseTo(e,Vd,t),t}function $b(e,t){return e^t}function dN(e){var t=Pe();return this.bitwiseTo(e,$b,t),t}function Yb(e,t){return e&~t}function fN(e){var t=Pe();return this.bitwiseTo(e,Yb,t),t}function mN(){for(var e=Pe(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function yN(e){var t=Pe();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function gN(e){var t=Pe();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function _N(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 xN(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+_N(this[e]);return this.s<0?this.t*this.DB:-1}function vN(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function bN(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=vN(this[i]^t);return e}function wN(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function PN(e,t){var i=U.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i}function TN(e){return this.changeBit(e,Vd)}function SN(e){return this.changeBit(e,Yb)}function CN(e){return this.changeBit(e,$b)}function MN(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 IN(e){var t=Pe();return this.addTo(e,t),t}function EN(e){var t=Pe();return this.subTo(e,t),t}function AN(e){var t=Pe();return this.multiplyTo(e,t),t}function kN(){var e=Pe();return this.squareTo(e),e}function DN(e){var t=Pe();return this.divRemTo(e,t,null),t}function LN(e){var t=Pe();return this.divRemTo(e,null,t),t}function RN(e){var t=Pe(),i=Pe();return this.divRemTo(e,t,i),new Array(t,i)}function zN(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function FN(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 Vo(){}function Zb(e){return e}function ON(e,t,i){e.multiplyTo(t,i)}function BN(e,t){e.squareTo(t)}Vo.prototype.convert=Zb;Vo.prototype.revert=Zb;Vo.prototype.mulTo=ON;Vo.prototype.sqrTo=BN;function NN(e){return this.exp(e,new Vo)}function VN(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 jN(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 aa(e){this.r2=Pe(),this.q3=Pe(),U.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function UN(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=Pe();return e.copyTo(t),this.reduce(t),t}function GN(e){return e}function XN(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 qN(e,t){e.squareTo(t),this.reduce(t)}function $N(e,t,i){e.multiplyTo(t,i),this.reduce(i)}aa.prototype.convert=UN;aa.prototype.revert=GN;aa.prototype.reduce=XN;aa.prototype.mulTo=$N;aa.prototype.sqrTo=qN;function YN(e,t){var i=e.bitLength(),r,n=Lr(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 dn(t):t.isEven()?a=new aa(t):a=new fn(t);var o=new Array,s=3,l=r-1,u=(1<<r)-1;if(o[1]=a.convert(this),r>1){var h=Pe();for(a.sqrTo(o[1],h);s<=u;)o[s]=Pe(),a.mulTo(h,o[s-2],o[s]),s+=2}var c=e.t-1,p,d=!0,f=Pe(),y;for(i=ku(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 ZN(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 WN(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 HN(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return U.ZERO;for(var i=e.clone(),r=this.clone(),n=Lr(1),a=Lr(0),o=Lr(0),s=Lr(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(U.ONE)!=0)return U.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 Mt=[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],KN=(1<<26)/Mt[Mt.length-1];function JN(e){var t,i=this.abs();if(i.t==1&&i[0]<=Mt[Mt.length-1]){for(t=0;t<Mt.length;++t)if(i[0]==Mt[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<Mt.length;){for(var r=Mt[t],n=t+1;n<Mt.length&&r<KN;)r*=Mt[n++];for(r=i.modInt(r);t<n;)if(r%Mt[t++]==0)return!1}return i.millerRabin(e)}function QN(e){var t=this.subtract(U.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);e=e+1>>1,e>Mt.length&&(e=Mt.length);for(var n=Pe(),a=0;a<e;++a){n.fromInt(Mt[Math.floor(Math.random()*Mt.length)]);var o=n.modPow(r,this);if(o.compareTo(U.ONE)!=0&&o.compareTo(t)!=0){for(var s=1;s++<i&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(U.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}U.prototype.chunkSize=eN;U.prototype.toRadix=iN;U.prototype.fromRadix=rN;U.prototype.fromNumber=nN;U.prototype.bitwiseTo=uN;U.prototype.changeBit=PN;U.prototype.addTo=MN;U.prototype.dMultiply=zN;U.prototype.dAddOffset=FN;U.prototype.multiplyLowerTo=VN;U.prototype.multiplyUpperTo=jN;U.prototype.modInt=WN;U.prototype.millerRabin=QN;U.prototype.clone=H6;U.prototype.intValue=K6;U.prototype.byteValue=J6;U.prototype.shortValue=Q6;U.prototype.signum=tN;U.prototype.toByteArray=aN;U.prototype.equals=oN;U.prototype.min=sN;U.prototype.max=lN;U.prototype.and=cN;U.prototype.or=pN;U.prototype.xor=dN;U.prototype.andNot=fN;U.prototype.not=mN;U.prototype.shiftLeft=yN;U.prototype.shiftRight=gN;U.prototype.getLowestSetBit=xN;U.prototype.bitCount=bN;U.prototype.testBit=wN;U.prototype.setBit=TN;U.prototype.clearBit=SN;U.prototype.flipBit=CN;U.prototype.add=IN;U.prototype.subtract=EN;U.prototype.multiply=AN;U.prototype.divide=DN;U.prototype.remainder=LN;U.prototype.divideAndRemainder=RN;U.prototype.modPow=YN;U.prototype.modInverse=HN;U.prototype.pow=NN;U.prototype.gcd=ZN;U.prototype.isProbablePrime=JN;U.prototype.square=kN;var _e=U;_e.prototype.IsNegative=function(){return this.compareTo(_e.ZERO)==-1};_e.op_Equality=function(e,t){return e.compareTo(t)==0};_e.op_Inequality=function(e,t){return e.compareTo(t)!=0};_e.op_GreaterThan=function(e,t){return e.compareTo(t)>0};_e.op_LessThan=function(e,t){return e.compareTo(t)<0};_e.op_Addition=function(e,t){return new _e(e).add(new _e(t))};_e.op_Subtraction=function(e,t){return new _e(e).subtract(new _e(t))};_e.Int128Mul=function(e,t){return new _e(e).multiply(new _e(t))};_e.op_Division=function(e,t){return e.divide(t)};_e.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof Eu>"u"&&(Eu=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 Eu;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};Eu(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)};ve.msie||ve.opera||ve.safari?m.Cast_Int32=function(e){return e|0}:m.Cast_Int32=function(e){return~~e};ve.chrome?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:ve.firefox&&typeof Number.toInteger=="function"?m.Cast_Int64=function(e){return Number.toInteger(e)}:ve.msie7||ve.msie8?m.Cast_Int64=function(e){return parseInt(e,10)}:ve.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,pn)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};pn?(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};Gb&&(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;p6?(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&&_e.op_Equality(_e.Int128Mul(e.X-t.X,i.Y-t.Y),_e.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?_e.op_Equality(_e.Int128Mul(i.Delta.Y,r.Delta.X),_e.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?_e.op_Equality(_e.Int128Mul(n.Y-a.Y,a.X-o.X),_e.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?_e.op_Equality(_e.Int128Mul(n.Y-a.Y,o.X-s.X),_e.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?_e.op_Equality(_e.Int128Mul(e.Delta.Y,t.Delta.X),_e.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?_e.op_Equality(_e.Int128Mul(e.Y-t.Y,t.X-i.X),_e.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?_e.op_Equality(_e.Int128Mul(e.Y-t.Y,i.X-r.X),_e.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){Ub?!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,pn&&(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,pn&&(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)};pn&&(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),pn&&(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),pn&&(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(Ub&&(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{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 e8=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},t8=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},i8=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},r8=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};ve.msie?m.Clipper.Round=e8:ve.chromium?m.Clipper.Round=i8:ve.safari?m.Clipper.Round=r8:m.Clipper.Round=t8;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};Gb&&(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};Eu(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,P=[];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&&P.push(o)}return!e[0]instanceof Array&&(P=P[0]),typeof P>"u"&&(P=[[]]),P};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};No.exports=m});M();var $o="[MappedinJS]",v1=(n=>(n[n.LOG=0]="LOG",n[n.WARN=1]="WARN",n[n.ERROR=2]="ERROR",n[n.SILENT=3]="SILENT",n))(v1||{});function b1(e="",{prefix:t=$o}={}){let i=`${t}${e?`-${e}`:""}`,r=(n,a)=>{if(typeof window<"u"&&window.rnDebug){let o=a.map(s=>s instanceof Error&&s.stack?`${s.message}
1
+ import{a as qo}from"./chunk-NGRMTFSH.js";import{$ as Uu,C as _n,D as Uo,Ma as cf,Na as pf,O as sa,Oa as df,P as ju,Pa as ff,Q as ke,Ua as Go,Y as Br,_ as bi,a as M,aa as vt,b as N,ba as Et,d as Nu,da as Nr,e as af,f as Vu,ha as si,i as vi,ia as lf,ob as Xo,r as of,ta as uf,u as sf,za as hf}from"./chunk-JVDXHWBF.js";import{b as rf,d as nf}from"./chunk-PWEV3AFA.js";var ub=rf((Po,ea)=>{M();var UB=200,Xv="__lodash_hash_undefined__",GB=800,XB=16,qv=9007199254740991,$v="[object Arguments]",qB="[object Array]",$B="[object AsyncFunction]",YB="[object Boolean]",ZB="[object Date]",WB="[object Error]",Yv="[object Function]",HB="[object GeneratorFunction]",KB="[object Map]",JB="[object Number]",QB="[object Null]",Zv="[object Object]",e5="[object Proxy]",t5="[object RegExp]",i5="[object Set]",r5="[object String]",n5="[object Undefined]",a5="[object WeakMap]",o5="[object ArrayBuffer]",s5="[object DataView]",l5="[object Float32Array]",u5="[object Float64Array]",h5="[object Int8Array]",c5="[object Int16Array]",p5="[object Int32Array]",d5="[object Uint8Array]",f5="[object Uint8ClampedArray]",m5="[object Uint16Array]",y5="[object Uint32Array]",g5=/[\\^$.*+?()[\]{}|]/g,_5=/^\[object .+?Constructor\]$/,x5=/^(?:0|[1-9]\d*)$/,Ge={};Ge[l5]=Ge[u5]=Ge[h5]=Ge[c5]=Ge[p5]=Ge[d5]=Ge[f5]=Ge[m5]=Ge[y5]=!0;Ge[$v]=Ge[qB]=Ge[o5]=Ge[YB]=Ge[s5]=Ge[ZB]=Ge[WB]=Ge[Yv]=Ge[KB]=Ge[JB]=Ge[Zv]=Ge[t5]=Ge[i5]=Ge[r5]=Ge[a5]=!1;var Wv=typeof global=="object"&&global&&global.Object===Object&&global,v5=typeof self=="object"&&self&&self.Object===Object&&self,Co=Wv||v5||Function("return this")(),Hv=typeof Po=="object"&&Po&&!Po.nodeType&&Po,To=Hv&&typeof ea=="object"&&ea&&!ea.nodeType&&ea,Kv=To&&To.exports===Hv,hd=Kv&&Wv.process,zv=(function(){try{var e=To&&To.require&&To.require("util").types;return e||hd&&hd.binding&&hd.binding("util")}catch{}})(),Fv=zv&&zv.isTypedArray;function b5(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 w5(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}function P5(e){return function(t){return e(t)}}function T5(e,t){return e?.[t]}function S5(e,t){return function(i){return e(t(i))}}var C5=Array.prototype,M5=Function.prototype,hu=Object.prototype,cd=Co["__core-js_shared__"],cu=M5.toString,rr=hu.hasOwnProperty,Ov=(function(){var e=/[^.]+$/.exec(cd&&cd.keys&&cd.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),Jv=hu.toString,I5=cu.call(Object),E5=RegExp("^"+cu.call(rr).replace(g5,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lu=Kv?Co.Buffer:void 0,Bv=Co.Symbol,Nv=Co.Uint8Array,Vv=lu?lu.allocUnsafe:void 0,Qv=S5(Object.getPrototypeOf,Object),jv=Object.create,A5=hu.propertyIsEnumerable,k5=C5.splice,sn=Bv?Bv.toStringTag:void 0,uu=(function(){try{var e=gd(Object,"defineProperty");return e({},"",{}),e}catch{}})(),D5=lu?lu.isBuffer:void 0,Uv=Math.max,L5=Date.now,eb=gd(Co,"Map"),So=gd(Object,"create"),R5=(function(){function e(){}return function(t){if(!un(t))return{};if(jv)return jv(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}})();function ln(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 z5(){this.__data__=So?So(null):{},this.size=0}function F5(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function O5(e){var t=this.__data__;if(So){var i=t[e];return i===Xv?void 0:i}return rr.call(t,e)?t[e]:void 0}function B5(e){var t=this.__data__;return So?t[e]!==void 0:rr.call(t,e)}function N5(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=So&&t===void 0?Xv:t,this}ln.prototype.clear=z5;ln.prototype.delete=F5;ln.prototype.get=O5;ln.prototype.has=B5;ln.prototype.set=N5;function nr(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 V5(){this.__data__=[],this.size=0}function j5(e){var t=this.__data__,i=pu(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():k5.call(t,i,1),--this.size,!0}function U5(e){var t=this.__data__,i=pu(t,e);return i<0?void 0:t[i][1]}function G5(e){return pu(this.__data__,e)>-1}function X5(e,t){var i=this.__data__,r=pu(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}nr.prototype.clear=V5;nr.prototype.delete=j5;nr.prototype.get=U5;nr.prototype.has=G5;nr.prototype.set=X5;function ta(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 q5(){this.size=0,this.__data__={hash:new ln,map:new(eb||nr),string:new ln}}function $5(e){var t=fu(this,e).delete(e);return this.size-=t?1:0,t}function Y5(e){return fu(this,e).get(e)}function Z5(e){return fu(this,e).has(e)}function W5(e,t){var i=fu(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}ta.prototype.clear=q5;ta.prototype.delete=$5;ta.prototype.get=Y5;ta.prototype.has=Z5;ta.prototype.set=W5;function ia(e){var t=this.__data__=new nr(e);this.size=t.size}function H5(){this.__data__=new nr,this.size=0}function K5(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}function J5(e){return this.__data__.get(e)}function Q5(e){return this.__data__.has(e)}function e4(e,t){var i=this.__data__;if(i instanceof nr){var r=i.__data__;if(!eb||r.length<UB-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new ta(r)}return i.set(e,t),this.size=i.size,this}ia.prototype.clear=H5;ia.prototype.delete=K5;ia.prototype.get=J5;ia.prototype.has=Q5;ia.prototype.set=e4;function t4(e,t){var i=md(e),r=!i&&fd(e),n=!i&&!r&&nb(e),a=!i&&!r&&!n&&ob(e),o=i||r||n||a,s=o?w5(e.length,String):[],l=s.length;for(var u in e)(t||rr.call(e,u))&&!(o&&(u=="length"||n&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ib(u,l)))&&s.push(u);return s}function pd(e,t,i){(i!==void 0&&!mu(e[t],i)||i===void 0&&!(t in e))&&yd(e,t,i)}function i4(e,t,i){var r=e[t];(!(rr.call(e,t)&&mu(r,i))||i===void 0&&!(t in e))&&yd(e,t,i)}function pu(e,t){for(var i=e.length;i--;)if(mu(e[i][0],t))return i;return-1}function yd(e,t,i){t=="__proto__"&&uu?uu(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var r4=y4();function du(e){return e==null?e===void 0?n5:QB:sn&&sn in Object(e)?g4(e):P4(e)}function Gv(e){return Mo(e)&&du(e)==$v}function n4(e){if(!un(e)||b4(e))return!1;var t=xd(e)?E5:_5;return t.test(M4(e))}function a4(e){return Mo(e)&&ab(e.length)&&!!Ge[du(e)]}function o4(e){if(!un(e))return w4(e);var t=rb(e),i=[];for(var r in e)r=="constructor"&&(t||!rr.call(e,r))||i.push(r);return i}function tb(e,t,i,r,n){e!==t&&r4(t,function(a,o){if(n||(n=new ia),un(a))s4(e,t,o,i,tb,r,n);else{var s=r?r(dd(e,o),a,o+"",e,t,n):void 0;s===void 0&&(s=a),pd(e,o,s)}},sb)}function s4(e,t,i,r,n,a,o){var s=dd(e,i),l=dd(t,i),u=o.get(l);if(u){pd(e,i,u);return}var h=a?a(s,l,i+"",e,t,o):void 0,c=h===void 0;if(c){var p=md(l),d=!p&&nb(l),f=!p&&!d&&ob(l);h=l,p||d||f?md(s)?h=s:I4(s)?h=d4(s):d?(c=!1,h=h4(l,!0)):f?(c=!1,h=p4(l,!0)):h=[]:E4(l)||fd(l)?(h=s,fd(s)?h=A4(s):(!un(s)||xd(s))&&(h=_4(l))):c=!1}c&&(o.set(l,h),n(h,l,r,a,o),o.delete(l)),pd(e,i,h)}function l4(e,t){return S4(T4(e,t,lb),e+"")}var u4=uu?function(e,t){return uu(e,"toString",{configurable:!0,enumerable:!1,value:D4(t),writable:!0})}:lb;function h4(e,t){if(t)return e.slice();var i=e.length,r=Vv?Vv(i):new e.constructor(i);return e.copy(r),r}function c4(e){var t=new e.constructor(e.byteLength);return new Nv(t).set(new Nv(e)),t}function p4(e,t){var i=t?c4(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}function d4(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t}function f4(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?yd(i,s,l):i4(i,s,l)}return i}function m4(e){return l4(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&&x4(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 y4(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 fu(e,t){var i=e.__data__;return v4(t)?i[typeof t=="string"?"string":"hash"]:i.map}function gd(e,t){var i=T5(e,t);return n4(i)?i:void 0}function g4(e){var t=rr.call(e,sn),i=e[sn];try{e[sn]=void 0;var r=!0}catch{}var n=Jv.call(e);return r&&(t?e[sn]=i:delete e[sn]),n}function _4(e){return typeof e.constructor=="function"&&!rb(e)?R5(Qv(e)):{}}function ib(e,t){var i=typeof e;return t=t??qv,!!t&&(i=="number"||i!="symbol"&&x5.test(e))&&e>-1&&e%1==0&&e<t}function x4(e,t,i){if(!un(i))return!1;var r=typeof t;return(r=="number"?_d(i)&&ib(t,i.length):r=="string"&&t in i)?mu(i[t],e):!1}function v4(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function b4(e){return!!Ov&&Ov in e}function rb(e){var t=e&&e.constructor,i=typeof t=="function"&&t.prototype||hu;return e===i}function w4(e){var t=[];if(e!=null)for(var i in Object(e))t.push(i);return t}function P4(e){return Jv.call(e)}function T4(e,t,i){return t=Uv(t===void 0?e.length-1:t,0),function(){for(var r=arguments,n=-1,a=Uv(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),b5(e,this,s)}}function dd(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var S4=C4(u4);function C4(e){var t=0,i=0;return function(){var r=L5(),n=XB-(r-i);if(i=r,n>0){if(++t>=GB)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function M4(e){if(e!=null){try{return cu.call(e)}catch{}try{return e+""}catch{}}return""}function mu(e,t){return e===t||e!==e&&t!==t}var fd=Gv((function(){return arguments})())?Gv:function(e){return Mo(e)&&rr.call(e,"callee")&&!A5.call(e,"callee")},md=Array.isArray;function _d(e){return e!=null&&ab(e.length)&&!xd(e)}function I4(e){return Mo(e)&&_d(e)}var nb=D5||L4;function xd(e){if(!un(e))return!1;var t=du(e);return t==Yv||t==HB||t==$B||t==e5}function ab(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=qv}function un(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Mo(e){return e!=null&&typeof e=="object"}function E4(e){if(!Mo(e)||du(e)!=Zv)return!1;var t=Qv(e);if(t===null)return!0;var i=rr.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&cu.call(i)==I5}var ob=Fv?P5(Fv):a4;function A4(e){return f4(e,sb(e))}function sb(e){return _d(e)?t4(e,!0):o4(e)}var k4=m4(function(e,t,i){tb(e,t,i)});function D4(e){return function(){return e}}function lb(e){return e}function L4(){return!1}ea.exports=k4});var Wb=rf((aK,No)=>{"use strict";M();var p6=!1,pn=!1,Ub=!0,Gb=!1,m={},Xb=!1;typeof No<"u"&&No.exports?(No.exports=m,Xb=!0):typeof document<"u"?window.ClipperLib=m:self.ClipperLib=m;var Iu;Xb?(ht="chrome",Iu="Netscape"):(ht=navigator.userAgent.toString().toLowerCase(),Iu=navigator.appName);var ht,ve={};ht.indexOf("chrome")!=-1&&ht.indexOf("chromium")==-1?ve.chrome=1:ve.chrome=0;ht.indexOf("chromium")!=-1?ve.chromium=1:ve.chromium=0;ht.indexOf("safari")!=-1&&ht.indexOf("chrome")==-1&&ht.indexOf("chromium")==-1?ve.safari=1:ve.safari=0;ht.indexOf("firefox")!=-1?ve.firefox=1:ve.firefox=0;ht.indexOf("firefox/17")!=-1?ve.firefox17=1:ve.firefox17=0;ht.indexOf("firefox/15")!=-1?ve.firefox15=1:ve.firefox15=0;ht.indexOf("firefox/3")!=-1?ve.firefox3=1:ve.firefox3=0;ht.indexOf("opera")!=-1?ve.opera=1:ve.opera=0;ht.indexOf("msie 10")!=-1?ve.msie10=1:ve.msie10=0;ht.indexOf("msie 9")!=-1?ve.msie9=1:ve.msie9=0;ht.indexOf("msie 8")!=-1?ve.msie8=1:ve.msie8=0;ht.indexOf("msie 7")!=-1?ve.msie7=1:ve.msie7=0;ht.indexOf("msie ")!=-1?ve.msie=1:ve.msie=0;m.biginteger_used=null;var Rr,d6=0xdeadbeefcafe,Vb=(d6&16777215)==15715070;function U(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 Pe(){return new U(null)}function f6(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 m6(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 y6(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}Vb&&Iu=="Microsoft Internet Explorer"?(U.prototype.am=m6,Rr=30):Vb&&Iu!="Netscape"?(U.prototype.am=f6,Rr=26):(U.prototype.am=y6,Rr=28);U.prototype.DB=Rr;U.prototype.DM=(1<<Rr)-1;U.prototype.DV=1<<Rr;var Nd=52;U.prototype.FV=Math.pow(2,Nd);U.prototype.F1=Nd-Rr;U.prototype.F2=2*Rr-Nd;var g6="0123456789abcdefghijklmnopqrstuvwxyz",Au=new Array,na,ai;na=48;for(ai=0;ai<=9;++ai)Au[na++]=ai;na=97;for(ai=10;ai<36;++ai)Au[na++]=ai;na=65;for(ai=10;ai<36;++ai)Au[na++]=ai;function jb(e){return g6.charAt(e)}function qb(e,t){var i=Au[e.charCodeAt(t)];return i??-1}function _6(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function x6(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 Lr(e){var t=Pe();return t.fromInt(e),t}function v6(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:qb(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&&U.ZERO.subTo(this,this)}function b6(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function w6(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=jb(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+=jb(r));return n?a:"0"}function P6(){var e=Pe();return U.ZERO.subTo(this,e),e}function T6(){return this.s<0?this.negate():this}function S6(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 ku(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 C6(){return this.t<=0?0:this.DB*(this.t-1)+ku(this[this.t-1]^this.s&this.DM)}function M6(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 I6(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 E6(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 A6(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 k6(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 D6(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&&U.ZERO.subTo(t,t)}function L6(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 R6(e,t,i){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t?.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=Pe());var a=Pe(),o=this.s,s=e.s,l=this.DB-ku(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??Pe();for(a.dlShiftTo(g,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),U.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&&U.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),o<0&&U.ZERO.subTo(i,i)}}}function z6(e){var t=Pe();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(U.ZERO)>0&&e.subTo(t,t),t}function dn(e){this.m=e}function F6(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function O6(e){return e}function B6(e){e.divRemTo(this.m,null,e)}function N6(e,t,i){e.multiplyTo(t,i),this.reduce(i)}function V6(e,t){e.squareTo(t),this.reduce(t)}dn.prototype.convert=F6;dn.prototype.revert=O6;dn.prototype.reduce=B6;dn.prototype.mulTo=N6;dn.prototype.sqrTo=V6;function j6(){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 fn(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 U6(e){var t=Pe();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(U.ZERO)>0&&this.m.subTo(t,t),t}function G6(e){var t=Pe();return e.copyTo(t),this.reduce(t),t}function X6(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 q6(e,t){e.squareTo(t),this.reduce(t)}function $6(e,t,i){e.multiplyTo(t,i),this.reduce(i)}fn.prototype.convert=U6;fn.prototype.revert=G6;fn.prototype.reduce=X6;fn.prototype.mulTo=$6;fn.prototype.sqrTo=q6;function Y6(){return(this.t>0?this[0]&1:this.s)==0}function Z6(e,t){if(e>4294967295||e<1)return U.ONE;var i=Pe(),r=Pe(),n=t.convert(this),a=ku(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 W6(e,t){var i;return e<256||t.isEven()?i=new dn(t):i=new fn(t),this.exp(e,i)}U.prototype.copyTo=_6;U.prototype.fromInt=x6;U.prototype.fromString=v6;U.prototype.clamp=b6;U.prototype.dlShiftTo=M6;U.prototype.drShiftTo=I6;U.prototype.lShiftTo=E6;U.prototype.rShiftTo=A6;U.prototype.subTo=k6;U.prototype.multiplyTo=D6;U.prototype.squareTo=L6;U.prototype.divRemTo=R6;U.prototype.invDigit=j6;U.prototype.isEven=Y6;U.prototype.exp=Z6;U.prototype.toString=w6;U.prototype.negate=P6;U.prototype.abs=T6;U.prototype.compareTo=S6;U.prototype.bitLength=C6;U.prototype.mod=z6;U.prototype.modPowInt=W6;U.ZERO=Lr(0);U.ONE=Lr(1);function H6(){var e=Pe();return this.copyTo(e),e}function K6(){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 J6(){return this.t==0?this.s:this[0]<<24>>24}function Q6(){return this.t==0?this.s:this[0]<<16>>16}function eN(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function tN(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function iN(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=Lr(i),n=Pe(),a=Pe(),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 rN(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=qb(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&&U.ZERO.subTo(this,this)}function nN(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(U.ONE.shiftLeft(e-1),Vd,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(U.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 aN(){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 oN(e){return this.compareTo(e)==0}function sN(e){return this.compareTo(e)<0?this:e}function lN(e){return this.compareTo(e)>0?this:e}function uN(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 hN(e,t){return e&t}function cN(e){var t=Pe();return this.bitwiseTo(e,hN,t),t}function Vd(e,t){return e|t}function pN(e){var t=Pe();return this.bitwiseTo(e,Vd,t),t}function $b(e,t){return e^t}function dN(e){var t=Pe();return this.bitwiseTo(e,$b,t),t}function Yb(e,t){return e&~t}function fN(e){var t=Pe();return this.bitwiseTo(e,Yb,t),t}function mN(){for(var e=Pe(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function yN(e){var t=Pe();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function gN(e){var t=Pe();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function _N(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 xN(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+_N(this[e]);return this.s<0?this.t*this.DB:-1}function vN(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function bN(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=vN(this[i]^t);return e}function wN(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function PN(e,t){var i=U.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i}function TN(e){return this.changeBit(e,Vd)}function SN(e){return this.changeBit(e,Yb)}function CN(e){return this.changeBit(e,$b)}function MN(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 IN(e){var t=Pe();return this.addTo(e,t),t}function EN(e){var t=Pe();return this.subTo(e,t),t}function AN(e){var t=Pe();return this.multiplyTo(e,t),t}function kN(){var e=Pe();return this.squareTo(e),e}function DN(e){var t=Pe();return this.divRemTo(e,t,null),t}function LN(e){var t=Pe();return this.divRemTo(e,null,t),t}function RN(e){var t=Pe(),i=Pe();return this.divRemTo(e,t,i),new Array(t,i)}function zN(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function FN(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 Vo(){}function Zb(e){return e}function ON(e,t,i){e.multiplyTo(t,i)}function BN(e,t){e.squareTo(t)}Vo.prototype.convert=Zb;Vo.prototype.revert=Zb;Vo.prototype.mulTo=ON;Vo.prototype.sqrTo=BN;function NN(e){return this.exp(e,new Vo)}function VN(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 jN(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 aa(e){this.r2=Pe(),this.q3=Pe(),U.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function UN(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=Pe();return e.copyTo(t),this.reduce(t),t}function GN(e){return e}function XN(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 qN(e,t){e.squareTo(t),this.reduce(t)}function $N(e,t,i){e.multiplyTo(t,i),this.reduce(i)}aa.prototype.convert=UN;aa.prototype.revert=GN;aa.prototype.reduce=XN;aa.prototype.mulTo=$N;aa.prototype.sqrTo=qN;function YN(e,t){var i=e.bitLength(),r,n=Lr(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 dn(t):t.isEven()?a=new aa(t):a=new fn(t);var o=new Array,s=3,l=r-1,u=(1<<r)-1;if(o[1]=a.convert(this),r>1){var h=Pe();for(a.sqrTo(o[1],h);s<=u;)o[s]=Pe(),a.mulTo(h,o[s-2],o[s]),s+=2}var c=e.t-1,p,d=!0,f=Pe(),y;for(i=ku(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 ZN(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 WN(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 HN(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return U.ZERO;for(var i=e.clone(),r=this.clone(),n=Lr(1),a=Lr(0),o=Lr(0),s=Lr(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(U.ONE)!=0)return U.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 Mt=[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],KN=(1<<26)/Mt[Mt.length-1];function JN(e){var t,i=this.abs();if(i.t==1&&i[0]<=Mt[Mt.length-1]){for(t=0;t<Mt.length;++t)if(i[0]==Mt[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<Mt.length;){for(var r=Mt[t],n=t+1;n<Mt.length&&r<KN;)r*=Mt[n++];for(r=i.modInt(r);t<n;)if(r%Mt[t++]==0)return!1}return i.millerRabin(e)}function QN(e){var t=this.subtract(U.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);e=e+1>>1,e>Mt.length&&(e=Mt.length);for(var n=Pe(),a=0;a<e;++a){n.fromInt(Mt[Math.floor(Math.random()*Mt.length)]);var o=n.modPow(r,this);if(o.compareTo(U.ONE)!=0&&o.compareTo(t)!=0){for(var s=1;s++<i&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(U.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}U.prototype.chunkSize=eN;U.prototype.toRadix=iN;U.prototype.fromRadix=rN;U.prototype.fromNumber=nN;U.prototype.bitwiseTo=uN;U.prototype.changeBit=PN;U.prototype.addTo=MN;U.prototype.dMultiply=zN;U.prototype.dAddOffset=FN;U.prototype.multiplyLowerTo=VN;U.prototype.multiplyUpperTo=jN;U.prototype.modInt=WN;U.prototype.millerRabin=QN;U.prototype.clone=H6;U.prototype.intValue=K6;U.prototype.byteValue=J6;U.prototype.shortValue=Q6;U.prototype.signum=tN;U.prototype.toByteArray=aN;U.prototype.equals=oN;U.prototype.min=sN;U.prototype.max=lN;U.prototype.and=cN;U.prototype.or=pN;U.prototype.xor=dN;U.prototype.andNot=fN;U.prototype.not=mN;U.prototype.shiftLeft=yN;U.prototype.shiftRight=gN;U.prototype.getLowestSetBit=xN;U.prototype.bitCount=bN;U.prototype.testBit=wN;U.prototype.setBit=TN;U.prototype.clearBit=SN;U.prototype.flipBit=CN;U.prototype.add=IN;U.prototype.subtract=EN;U.prototype.multiply=AN;U.prototype.divide=DN;U.prototype.remainder=LN;U.prototype.divideAndRemainder=RN;U.prototype.modPow=YN;U.prototype.modInverse=HN;U.prototype.pow=NN;U.prototype.gcd=ZN;U.prototype.isProbablePrime=JN;U.prototype.square=kN;var _e=U;_e.prototype.IsNegative=function(){return this.compareTo(_e.ZERO)==-1};_e.op_Equality=function(e,t){return e.compareTo(t)==0};_e.op_Inequality=function(e,t){return e.compareTo(t)!=0};_e.op_GreaterThan=function(e,t){return e.compareTo(t)>0};_e.op_LessThan=function(e,t){return e.compareTo(t)<0};_e.op_Addition=function(e,t){return new _e(e).add(new _e(t))};_e.op_Subtraction=function(e,t){return new _e(e).subtract(new _e(t))};_e.Int128Mul=function(e,t){return new _e(e).multiply(new _e(t))};_e.op_Division=function(e,t){return e.divide(t)};_e.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof Eu>"u"&&(Eu=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 Eu;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};Eu(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)};ve.msie||ve.opera||ve.safari?m.Cast_Int32=function(e){return e|0}:m.Cast_Int32=function(e){return~~e};ve.chrome?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:ve.firefox&&typeof Number.toInteger=="function"?m.Cast_Int64=function(e){return Number.toInteger(e)}:ve.msie7||ve.msie8?m.Cast_Int64=function(e){return parseInt(e,10)}:ve.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,pn)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};pn?(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};Gb&&(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;p6?(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&&_e.op_Equality(_e.Int128Mul(e.X-t.X,i.Y-t.Y),_e.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?_e.op_Equality(_e.Int128Mul(i.Delta.Y,r.Delta.X),_e.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?_e.op_Equality(_e.Int128Mul(n.Y-a.Y,a.X-o.X),_e.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?_e.op_Equality(_e.Int128Mul(n.Y-a.Y,o.X-s.X),_e.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?_e.op_Equality(_e.Int128Mul(e.Delta.Y,t.Delta.X),_e.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?_e.op_Equality(_e.Int128Mul(e.Y-t.Y,t.X-i.X),_e.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?_e.op_Equality(_e.Int128Mul(e.Y-t.Y,i.X-r.X),_e.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){Ub?!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,pn&&(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,pn&&(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)};pn&&(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),pn&&(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),pn&&(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(Ub&&(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{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 e8=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},t8=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},i8=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},r8=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};ve.msie?m.Clipper.Round=e8:ve.chromium?m.Clipper.Round=i8:ve.safari?m.Clipper.Round=r8:m.Clipper.Round=t8;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};Gb&&(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};Eu(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,P=[];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&&P.push(o)}return!e[0]instanceof Array&&(P=P[0]),typeof P>"u"&&(P=[[]]),P};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};No.exports=m});M();var $o="[MappedinJS]",v1=(n=>(n[n.LOG=0]="LOG",n[n.WARN=1]="WARN",n[n.ERROR=2]="ERROR",n[n.SILENT=3]="SILENT",n))(v1||{});function b1(e="",{prefix:t=$o}={}){let i=`${t}${e?`-${e}`:""}`,r=(n,a)=>{if(typeof window<"u"&&window.rnDebug){let o=a.map(s=>s instanceof Error&&s.stack?`${s.message}
2
2
  ${s.stack}`:s);window.rnDebug(`${e} ${n}: ${o.join(" ")}`)}};return{logState:N.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 mf=b1();function C8(e){0<=e&&e<=3&&(mf.logState=e)}var lt=mf;M();function yf(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 E8(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}}M();M();function w1(e,t){return`${t} ${e}`}var la=class extends Error{constructor(t,i=$o){super(w1(t,i)),this.name="MappedinError"}},gf=class extends la{constructor(t,i=$o){super(t,i),this.name="MappedinRenderError"}};var _f=["ease-in","ease-out","ease-in-out","linear","ease-out-cubic"];var Yo=e=>e,P1=e=>e*e,Gu=e=>1-Math.cos(e*Math.PI/2),T1=e=>1-(1-e)*(1-e),S1=e=>1-Math.pow(1-e,3),xf={linear:Yo,"ease-in":P1,"ease-out":T1,"ease-in-out":Gu,"ease-out-cubic":S1};function Xu(e,t,i,r,n,a=Yo){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):xf[a](o);return r+s*(n-r)}function C1(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 vf(e,t,i,r="ease-in"){if(t.length!==i.length)throw new la("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=C1(e,t),a=(e-t[n])/(t[n+1]-t[n]),o=typeof r=="function"?r(a):xf[r](a);return i[n]+o*(i[n+1]-i[n])}M();M();var wi=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-wi.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?wi.Bounce.In(e*2)*.5:wi.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}}}}),ua=function(){return performance.now()},M1=(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=ua()),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})(),xn={Linear:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),a=xn.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=xn.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=xn.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=xn.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}}},bf=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),qu=new M1,B8=(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=wi.Linear.None,this._interpolationFunction=xn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=bf.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=qu,qu.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=ua()),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=ua()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=ua()),!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=wi.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=xn.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=ua()),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 N8=bf.nextId,Pi=qu,V8=Pi.getAll.bind(Pi),j8=Pi.removeAll.bind(Pi),U8=Pi.add.bind(Pi),G8=Pi.remove.bind(Pi),X8=Pi.update.bind(Pi);var I1={linear:wi.Linear.None,"ease-in":wi.Quadratic.In,"ease-out":wi.Quadratic.Out,"ease-in-out":wi.Quadratic.InOut};var E1={tension:0,cornerRadius:.5},A1="mappedin",wf="collision-worker.csp.js",Pf="maplibre-worker.csp.js",$u="";function Tf(e){$u=e}var Sf="";function k1(e){Sf=e}var Cf=!1;function D1(){Cf=!0}function L1(){return Cf}var Mf=!0;function R1(e){Mf=e}function Yu(){return Mf}M();M();M();import dt from"zod";var Zu=dt.enum(_f),z1=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},F1=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},If=e=>z1(e)||F1(e),O1=dt.object({on:dt.literal("zoom-level"),input:dt.tuple([dt.number()]).rest(dt.number()).refine(If,{message:"input array must be strictly increasing or decreasing"}),output:dt.tuple([dt.number()]).rest(dt.number()),easing:Zu.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"}),Zo=/^\d+(\.\d+)?px$/;function Wu(e){return typeof e=="string"&&Zo.test(e)}function B1(e){return parseFloat(e)}function Ef(e){return typeof e=="object"&&e!==null&&"output"in e&&Array.isArray(e.output)&&e.output.length>0&&Wu(e.output[0])}function N1(e){return Wu(e)||Ef(e)}var V1=dt.object({on:dt.literal("zoom-level"),input:dt.tuple([dt.number()]).rest(dt.number()).refine(If,{message:"input array must be strictly increasing or decreasing"}),output:dt.tuple([dt.string().regex(Zo)]).rest(dt.string().regex(Zo)),easing:Zu.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});M();M();M();M();M();M();import{z as Ft}from"zod";var Af=Ft.object({rotation:Ft.array(Ft.number()).length(3).optional(),altitude:Ft.number().optional(),scale:Ft.array(Ft.number()).length(3).optional(),interactive:Ft.boolean().optional(),verticalOffset:Ft.number().optional(),id:Ft.union([Ft.number(),Ft.string()]).optional()}),kf=Ft.object({color:Ft.string()});M();import{z as de}from"zod";var Hu=de.object({visible:de.boolean(),color:de.string(),flipToFaceCamera:de.boolean(),font:de.string().optional(),fontSize:de.number(),margin:de.union([de.number(),de.tuple([de.number(),de.number(),de.number(),de.number()])]),outlineColor:de.string(),outlineOpacity:de.number(),outlineBlur:de.union([de.number(),de.string()]),outlineWidth:de.number(),outlineOffsetX:de.number(),outlineOffsetY:de.number(),strokeWidth:de.number(),maxWidth:de.number().optional(),maxHeight:de.number().optional(),strokeOpacity:de.number(),strokeColor:de.string(),fillOpacity:de.number(),hoverColor:de.string().optional(),id:de.union([de.string(),de.number()]),type:de.literal("text3d"),position:de.tuple([de.number(),de.number(),de.number()]),content:de.string(),rotation:de.number()}),Ku=de.strictObject(Hu.partial().omit({id:!0,type:!0}).shape),Df=de.strictObject(Ku.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape);M();var j1=Object.create,Lc=Object.defineProperty,U1=Object.getOwnPropertyDescriptor,G1=Object.getOwnPropertyNames,X1=Object.getPrototypeOf,q1=Object.prototype.hasOwnProperty,di=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),en=(e,t)=>{for(var i in t)Lc(e,i,{get:t[i],enumerable:!0})},$1=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of G1(t))!q1.call(e,n)&&n!==i&&Lc(e,n,{get:()=>t[n],enumerable:!(r=U1(t,n))||r.enumerable});return e},ne=(e,t,i)=>(i=e!=null?j1(X1(e)):{},$1(t||!e||!e.__esModule?Lc(i,"default",{value:e,enumerable:!0}):i,e)),se=di((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}}),Y1=di((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))}}}),Z1=di((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)}),W1=di((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)}),Oy=di((e,t)=>{var i=Z1(),r=W1();t.exports=i,t.exports.murmur3=i,t.exports.murmur2=r}),By=di((e,t)=>{"use strict";var i=se();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(P){for(var T=0;T<P.length;T++){var I=P[T],E=180-(I.y+d)*360/c;P[T]=[(I.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}}),Ny=di((e,t)=>{"use strict";var i=By();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)}}),H1=di((e,t)=>{"use strict";var i=Ny();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)}}}),ol=di((e,t)=>{t.exports.VectorTile=H1(),t.exports.VectorTileFeature=By(),t.exports.VectorTileLayer=Ny()}),K1=di(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}}),Vy=di((e,t)=>{"use strict";t.exports=r;var i=K1();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,S,C){for(C=C||this.length;this.pos<C;){var F=this.readVarint(),B=F>>3,j=this.pos;this.type=F&7,x(B,S,this),this.pos===j&&this.skip(F)}return S},readMessage:function(x,S){return this.readFields(x,S,this.readVarint()+this.pos)},readFixed32:function(){var x=E(this.buf,this.pos);return this.pos+=4,x},readSFixed32:function(){var x=k(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)+k(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 S=this.buf,C,F;return F=S[this.pos++],C=F&127,F<128||(F=S[this.pos++],C|=(F&127)<<7,F<128)||(F=S[this.pos++],C|=(F&127)<<14,F<128)||(F=S[this.pos++],C|=(F&127)<<21,F<128)?C:(F=S[this.pos],C|=(F&15)<<28,l(C,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,S=this.pos;return this.pos=x,x-S>=o&&s?A(this.buf,S,x):L(this.buf,S,x)},readBytes:function(){var x=this.readVarint()+this.pos,S=this.buf.subarray(this.pos,x);return this.pos=x,S},readPackedVarint:function(x,S){if(this.type!==r.Bytes)return x.push(this.readVarint(S));var C=u(this);for(x=x||[];this.pos<C;)x.push(this.readVarint(S));return x},readPackedSVarint:function(x){if(this.type!==r.Bytes)return x.push(this.readSVarint());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readSVarint());return x},readPackedBoolean:function(x){if(this.type!==r.Bytes)return x.push(this.readBoolean());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readBoolean());return x},readPackedFloat:function(x){if(this.type!==r.Bytes)return x.push(this.readFloat());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readFloat());return x},readPackedDouble:function(x){if(this.type!==r.Bytes)return x.push(this.readDouble());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readDouble());return x},readPackedFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed32());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readFixed32());return x},readPackedSFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed32());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readSFixed32());return x},readPackedFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed64());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readFixed64());return x},readPackedSFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed64());var S=u(this);for(x=x||[];this.pos<S;)x.push(this.readSFixed64());return x},skip:function(x){var S=x&7;if(S===r.Varint)for(;this.buf[this.pos++]>127;);else if(S===r.Bytes)this.pos=this.readVarint()+this.pos;else if(S===r.Fixed32)this.pos+=4;else if(S===r.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+S)},writeTag:function(x,S){this.writeVarint(x<<3|S)},realloc:function(x){for(var S=this.length||16;S<this.pos+x;)S*=2;if(S!==this.length){var C=new Uint8Array(S);C.set(this.buf),this.buf=C,this.length=S}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(x){this.realloc(4),R(this.buf,x,this.pos),this.pos+=4},writeSFixed32:function(x){this.realloc(4),R(this.buf,x,this.pos),this.pos+=4},writeFixed64:function(x){this.realloc(8),R(this.buf,x&-1,this.pos),R(this.buf,Math.floor(x*a),this.pos+4),this.pos+=8},writeSFixed64:function(x){this.realloc(8),R(this.buf,x&-1,this.pos),R(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 S=this.pos;this.pos=D(this.buf,x,this.pos);var C=this.pos-S;C>=128&&f(S,C,this),this.pos=S-1,this.writeVarint(C),this.pos+=C},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 S=x.length;this.writeVarint(S),this.realloc(S);for(var C=0;C<S;C++)this.buf[this.pos++]=x[C]},writeRawMessage:function(x,S){this.pos++;var C=this.pos;x(S,this);var F=this.pos-C;F>=128&&f(C,F,this),this.pos=C-1,this.writeVarint(F),this.pos+=F},writeMessage:function(x,S,C){this.writeTag(x,r.Bytes),this.writeRawMessage(S,C)},writePackedVarint:function(x,S){S.length&&this.writeMessage(x,y,S)},writePackedSVarint:function(x,S){S.length&&this.writeMessage(x,g,S)},writePackedBoolean:function(x,S){S.length&&this.writeMessage(x,v,S)},writePackedFloat:function(x,S){S.length&&this.writeMessage(x,_,S)},writePackedDouble:function(x,S){S.length&&this.writeMessage(x,b,S)},writePackedFixed32:function(x,S){S.length&&this.writeMessage(x,w,S)},writePackedSFixed32:function(x,S){S.length&&this.writeMessage(x,P,S)},writePackedFixed64:function(x,S){S.length&&this.writeMessage(x,T,S)},writePackedSFixed64:function(x,S){S.length&&this.writeMessage(x,I,S)},writeBytesField:function(x,S){this.writeTag(x,r.Bytes),this.writeBytes(S)},writeFixed32Field:function(x,S){this.writeTag(x,r.Fixed32),this.writeFixed32(S)},writeSFixed32Field:function(x,S){this.writeTag(x,r.Fixed32),this.writeSFixed32(S)},writeFixed64Field:function(x,S){this.writeTag(x,r.Fixed64),this.writeFixed64(S)},writeSFixed64Field:function(x,S){this.writeTag(x,r.Fixed64),this.writeSFixed64(S)},writeVarintField:function(x,S){this.writeTag(x,r.Varint),this.writeVarint(S)},writeSVarintField:function(x,S){this.writeTag(x,r.Varint),this.writeSVarint(S)},writeStringField:function(x,S){this.writeTag(x,r.Bytes),this.writeString(S)},writeFloatField:function(x,S){this.writeTag(x,r.Fixed32),this.writeFloat(S)},writeDoubleField:function(x,S){this.writeTag(x,r.Fixed64),this.writeDouble(S)},writeBooleanField:function(x,S){this.writeVarintField(x,!!S)}};function l(x,S,C){var F=C.buf,B,j;if(j=F[C.pos++],B=(j&112)>>4,j<128||(j=F[C.pos++],B|=(j&127)<<3,j<128)||(j=F[C.pos++],B|=(j&127)<<10,j<128)||(j=F[C.pos++],B|=(j&127)<<17,j<128)||(j=F[C.pos++],B|=(j&127)<<24,j<128)||(j=F[C.pos++],B|=(j&1)<<31,j<128))return h(x,B,S);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,S,C){return C?S*4294967296+(x>>>0):(S>>>0)*4294967296+(x>>>0)}function c(x,S){var C,F;if(x>=0?(C=x%4294967296|0,F=x/4294967296|0):(C=~(-x%4294967296),F=~(-x/4294967296),C^4294967295?C=C+1|0:(C=0,F=F+1|0)),x>=18446744073709552e3||x<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");S.realloc(10),p(C,F,S),d(F,S)}function p(x,S,C){C.buf[C.pos++]=x&127|128,x>>>=7,C.buf[C.pos++]=x&127|128,x>>>=7,C.buf[C.pos++]=x&127|128,x>>>=7,C.buf[C.pos++]=x&127|128,x>>>=7,C.buf[C.pos]=x&127}function d(x,S){var C=(x&7)<<4;S.buf[S.pos++]|=C|((x>>>=3)?128:0),x&&(S.buf[S.pos++]=x&127|((x>>>=7)?128:0),x&&(S.buf[S.pos++]=x&127|((x>>>=7)?128:0),x&&(S.buf[S.pos++]=x&127|((x>>>=7)?128:0),x&&(S.buf[S.pos++]=x&127|((x>>>=7)?128:0),x&&(S.buf[S.pos++]=x&127)))))}function f(x,S,C){var F=S<=16383?1:S<=2097151?2:S<=268435455?3:Math.floor(Math.log(S)/(Math.LN2*7));C.realloc(F);for(var B=C.pos-1;B>=x;B--)C.buf[B+F]=C.buf[B]}function y(x,S){for(var C=0;C<x.length;C++)S.writeVarint(x[C])}function g(x,S){for(var C=0;C<x.length;C++)S.writeSVarint(x[C])}function _(x,S){for(var C=0;C<x.length;C++)S.writeFloat(x[C])}function b(x,S){for(var C=0;C<x.length;C++)S.writeDouble(x[C])}function v(x,S){for(var C=0;C<x.length;C++)S.writeBoolean(x[C])}function w(x,S){for(var C=0;C<x.length;C++)S.writeFixed32(x[C])}function P(x,S){for(var C=0;C<x.length;C++)S.writeSFixed32(x[C])}function T(x,S){for(var C=0;C<x.length;C++)S.writeFixed64(x[C])}function I(x,S){for(var C=0;C<x.length;C++)S.writeSFixed64(x[C])}function E(x,S){return(x[S]|x[S+1]<<8|x[S+2]<<16)+x[S+3]*16777216}function R(x,S,C){x[C]=S,x[C+1]=S>>>8,x[C+2]=S>>>16,x[C+3]=S>>>24}function k(x,S){return(x[S]|x[S+1]<<8|x[S+2]<<16)+(x[S+3]<<24)}function L(x,S,C){for(var F="",B=S;B<C;){var j=x[B],H=null,ie=j>239?4:j>223?3:j>191?2:1;if(B+ie>C)break;var Se,Ie,De;ie===1?j<128&&(H=j):ie===2?(Se=x[B+1],(Se&192)===128&&(H=(j&31)<<6|Se&63,H<=127&&(H=null))):ie===3?(Se=x[B+1],Ie=x[B+2],(Se&192)===128&&(Ie&192)===128&&(H=(j&15)<<12|(Se&63)<<6|Ie&63,(H<=2047||H>=55296&&H<=57343)&&(H=null))):ie===4&&(Se=x[B+1],Ie=x[B+2],De=x[B+3],(Se&192)===128&&(Ie&192)===128&&(De&192)===128&&(H=(j&15)<<18|(Se&63)<<12|(Ie&63)<<6|De&63,(H<=65535||H>=1114112)&&(H=null))),H===null?(H=65533,ie=1):H>65535&&(H-=65536,F+=String.fromCharCode(H>>>10&1023|55296),H=56320|H&1023),F+=String.fromCharCode(H),B+=ie}return F}function A(x,S,C){return s.decode(x.subarray(S,C))}function D(x,S,C){for(var F=0,B,j;F<S.length;F++){if(B=S.charCodeAt(F),B>55295&&B<57344)if(j)if(B<56320){x[C++]=239,x[C++]=191,x[C++]=189,j=B;continue}else B=j-55296<<10|B-56320|65536,j=null;else{B>56319||F+1===S.length?(x[C++]=239,x[C++]=191,x[C++]=189):j=B;continue}else j&&(x[C++]=239,x[C++]=191,x[C++]=189,j=null);B<128?x[C++]=B:(B<2048?x[C++]=B>>6|192:(B<65536?x[C++]=B>>12|224:(x[C++]=B>>18|240,x[C++]=B>>12&63|128),x[C++]=B>>6&63|128),x[C++]=B&63|128)}return C}}),jy={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":"4.1.8","@vitest/eslint-plugin":"^1.6.19","@vitest/ui":"4.1.8",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.3","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",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:"4.1.8","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"]},pnpm:{overrides:{lodash:"^4.18.0",svgo:">=4.0.1",flatted:"^3.4.2","basic-ftp":"^5.3.1",vite:"^6.4.2","fast-uri":"^3.1.1","protocol-buffers-schema":"^3.6.1","ip-address":"^10.1.1",uuid:"^11.1.1",ws:"^8.20.1","picomatch@<2.3.2":"^2.3.2","picomatch@>=4.0.0 <4.0.4":"^4.0.4","brace-expansion@<2.0.0":"^1.1.13","brace-expansion@>=2.0.0 <3.0.0":"^2.0.3","brace-expansion@>=5.0.0 <5.0.6":"^5.0.6"}}},J1=ne(se(),1),Q1=ne(Y1(),1),Ju;function Uy(){return Ju==null&&(Ju=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Ju}var Wo;function ew(){if(Wo==null&&(Wo=!1,Uy())){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(${r},${r+1},${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){Wo=!0;break}}}return Wo||!1}var oe=1e-6,Re=typeof Float32Array<"u"?Float32Array:Array,Ei=Math.random,DV=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 Na={};en(Na,{LDU:()=>gw,add:()=>_w,adjoint:()=>uw,clone:()=>iw,copy:()=>rw,create:()=>tw,determinant:()=>hw,equals:()=>vw,exactEquals:()=>xw,frob:()=>yw,fromRotation:()=>dw,fromScaling:()=>fw,fromValues:()=>aw,identity:()=>nw,invert:()=>lw,mul:()=>Pw,multiply:()=>Gy,multiplyScalar:()=>bw,multiplyScalarAndAdd:()=>ww,rotate:()=>cw,scale:()=>pw,set:()=>ow,str:()=>mw,sub:()=>Tw,subtract:()=>Xy,transpose:()=>sw});function tw(){var e=new Re(4);return Re!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function iw(e){var t=new Re(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function rw(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function nw(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function aw(e,t,i,r){var n=new Re(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function ow(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function sw(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 lw(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 uw(e,t){var i=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=i,e}function hw(e){return e[0]*e[3]-e[2]*e[1]}function Gy(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 cw(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 pw(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 dw(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 fw(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function mw(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function yw(e){return Math.hypot(e[0],e[1],e[2],e[3])}function gw(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 _w(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 Xy(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 xw(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function vw(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)<=oe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=oe*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=oe*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=oe*Math.max(1,Math.abs(a),Math.abs(u))}function bw(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 ww(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 Pw=Gy,Tw=Xy,Va={};en(Va,{add:()=>Yw,adjoint:()=>Lw,clone:()=>Cw,copy:()=>Mw,create:()=>qy,determinant:()=>Rw,equals:()=>Kw,exactEquals:()=>Hw,frob:()=>$w,fromMat2d:()=>jw,fromMat4:()=>Sw,fromQuat:()=>Uw,fromRotation:()=>Nw,fromScaling:()=>Vw,fromTranslation:()=>Bw,fromValues:()=>Iw,identity:()=>Aw,invert:()=>Dw,mul:()=>Jw,multiply:()=>$y,multiplyScalar:()=>Zw,multiplyScalarAndAdd:()=>Ww,normalFromMat4:()=>Gw,projection:()=>Xw,rotate:()=>Fw,scale:()=>Ow,set:()=>Ew,str:()=>qw,sub:()=>Qw,subtract:()=>Yy,translate:()=>zw,transpose:()=>kw});function qy(){var e=new Re(9);return Re!=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 Sw(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 Cw(e){var t=new Re(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 Mw(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 Iw(e,t,i,r,n,a,o,s,l){var u=new Re(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 Ew(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 Aw(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 kw(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 Dw(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 Lw(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 Rw(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 $y(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 zw(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 Fw(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 Ow(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 Bw(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 Nw(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 Vw(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 jw(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 Uw(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 Gw(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,P=r*l-n*s,T=r*u-a*s,I=n*u-a*l,E=h*y-c*f,R=h*g-p*f,k=h*_-d*f,L=c*g-p*y,A=c*_-d*y,D=p*_-d*g,x=b*D-v*A+w*L+P*k-T*R+I*E;return x?(x=1/x,e[0]=(s*D-l*A+u*L)*x,e[1]=(l*k-o*D-u*R)*x,e[2]=(o*A-s*k+u*E)*x,e[3]=(n*A-r*D-a*L)*x,e[4]=(i*D-n*k+a*R)*x,e[5]=(r*k-i*A-a*E)*x,e[6]=(y*I-g*T+_*P)*x,e[7]=(g*w-f*I-_*v)*x,e[8]=(f*T-y*w+_*b)*x,e):null}function Xw(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 qw(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function $w(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Yw(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 Yy(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 Zw(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 Ww(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 Hw(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 Kw(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)<=oe*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(r-p)<=oe*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(n-d)<=oe*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(a-f)<=oe*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(o-y)<=oe*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-g)<=oe*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-_)<=oe*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(u-b)<=oe*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(h-v)<=oe*Math.max(1,Math.abs(h),Math.abs(v))}var Jw=$y,Qw=Yy,O={};en(O,{add:()=>O2,adjoint:()=>s2,clone:()=>t2,copy:()=>i2,create:()=>e2,determinant:()=>l2,equals:()=>j2,exactEquals:()=>V2,frob:()=>F2,fromQuat:()=>C2,fromQuat2:()=>b2,fromRotation:()=>g2,fromRotationTranslation:()=>Hy,fromRotationTranslationScale:()=>T2,fromRotationTranslationScaleOrigin:()=>S2,fromScaling:()=>y2,fromTranslation:()=>m2,fromValues:()=>r2,fromXRotation:()=>_2,fromYRotation:()=>x2,fromZRotation:()=>v2,frustum:()=>M2,getRotation:()=>P2,getScaling:()=>Ky,getTranslation:()=>w2,identity:()=>Zy,invert:()=>o2,lookAt:()=>L2,mul:()=>U2,multiply:()=>Wy,multiplyScalar:()=>B2,multiplyScalarAndAdd:()=>N2,ortho:()=>k2,orthoNO:()=>Qy,orthoZO:()=>D2,perspective:()=>I2,perspectiveFromFieldOfView:()=>A2,perspectiveNO:()=>Jy,perspectiveZO:()=>E2,rotate:()=>c2,rotateX:()=>p2,rotateY:()=>d2,rotateZ:()=>f2,scale:()=>h2,set:()=>n2,str:()=>z2,sub:()=>G2,subtract:()=>eg,targetTo:()=>R2,translate:()=>u2,transpose:()=>a2});function e2(){var e=new Re(16);return Re!=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 t2(e){var t=new Re(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 i2(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 r2(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y){var g=new Re(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 n2(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 Zy(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 a2(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 o2(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,P=r*l-n*s,T=r*u-a*s,I=n*u-a*l,E=h*y-c*f,R=h*g-p*f,k=h*_-d*f,L=c*g-p*y,A=c*_-d*y,D=p*_-d*g,x=b*D-v*A+w*L+P*k-T*R+I*E;return x?(x=1/x,e[0]=(s*D-l*A+u*L)*x,e[1]=(n*A-r*D-a*L)*x,e[2]=(y*I-g*T+_*P)*x,e[3]=(p*T-c*I-d*P)*x,e[4]=(l*k-o*D-u*R)*x,e[5]=(i*D-n*k+a*R)*x,e[6]=(g*w-f*I-_*v)*x,e[7]=(h*I-p*w+d*v)*x,e[8]=(o*A-s*k+u*E)*x,e[9]=(r*k-i*A-a*E)*x,e[10]=(f*T-y*w+_*b)*x,e[11]=(c*w-h*T-d*b)*x,e[12]=(s*R-o*L-l*E)*x,e[13]=(i*L-r*R+n*E)*x,e[14]=(y*v-f*P-g*b)*x,e[15]=(h*P-c*v+p*b)*x,e):null}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];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 l2(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,P=i*l-n*o,T=r*l-n*s,I=u*f-h*d,E=u*y-c*d,R=u*g-p*d,k=h*y-c*f,L=h*g-p*f,A=c*g-p*y;return _*A-b*L+v*k+w*R-P*E+T*I}function Wy(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],P=i[2],T=i[3];return e[0]=v*r+w*s+P*c+T*y,e[1]=v*n+w*l+P*p+T*g,e[2]=v*a+w*u+P*d+T*_,e[3]=v*o+w*h+P*f+T*b,v=i[4],w=i[5],P=i[6],T=i[7],e[4]=v*r+w*s+P*c+T*y,e[5]=v*n+w*l+P*p+T*g,e[6]=v*a+w*u+P*d+T*_,e[7]=v*o+w*h+P*f+T*b,v=i[8],w=i[9],P=i[10],T=i[11],e[8]=v*r+w*s+P*c+T*y,e[9]=v*n+w*l+P*p+T*g,e[10]=v*a+w*u+P*d+T*_,e[11]=v*o+w*h+P*f+T*b,v=i[12],w=i[13],P=i[14],T=i[15],e[12]=v*r+w*s+P*c+T*y,e[13]=v*n+w*l+P*p+T*g,e[14]=v*a+w*u+P*d+T*_,e[15]=v*o+w*h+P*f+T*b,e}function u2(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 h2(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 c2(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,P,T,I,E,R,k,L,A,D,x,S;return s<oe?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],P=t[10],T=t[11],I=n*n*h+u,E=a*n*h+o*l,R=o*n*h-a*l,k=n*a*h-o*l,L=a*a*h+u,A=o*a*h+n*l,D=n*o*h+a*l,x=a*o*h-n*l,S=o*o*h+u,e[0]=c*I+y*E+v*R,e[1]=p*I+g*E+w*R,e[2]=d*I+_*E+P*R,e[3]=f*I+b*E+T*R,e[4]=c*k+y*L+v*A,e[5]=p*k+g*L+w*A,e[6]=d*k+_*L+P*A,e[7]=f*k+b*L+T*A,e[8]=c*D+y*x+v*S,e[9]=p*D+g*x+w*S,e[10]=d*D+_*x+P*S,e[11]=f*D+b*x+T*S,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function p2(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 d2(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 f2(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 m2(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 y2(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 g2(e,t,i){var r=i[0],n=i[1],a=i[2],o=Math.hypot(r,n,a),s,l,u;return o<oe?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 _2(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 x2(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 v2(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 Hy(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 b2(e,t){var i=new Re(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),Hy(e,t,i),e}function w2(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Ky(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 P2(e,t){var i=new Re(3);Ky(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 T2(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],P=r[1],T=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)*P,e[5]=(1-(c+g))*P,e[6]=(y+_)*P,e[7]=0,e[8]=(d+b)*T,e[9]=(y-_)*T,e[10]=(1-(c+f))*T,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function S2(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,P=r[0],T=r[1],I=r[2],E=n[0],R=n[1],k=n[2],L=(1-(y+_))*P,A=(d+w)*P,D=(f-v)*P,x=(d-w)*T,S=(1-(p+_))*T,C=(g+b)*T,F=(f+v)*I,B=(g-b)*I,j=(1-(p+y))*I;return e[0]=L,e[1]=A,e[2]=D,e[3]=0,e[4]=x,e[5]=S,e[6]=C,e[7]=0,e[8]=F,e[9]=B,e[10]=j,e[11]=0,e[12]=i[0]+E-(L*E+x*R+F*k),e[13]=i[1]+R-(A*E+S*R+B*k),e[14]=i[2]+k-(D*E+C*R+j*k),e[15]=1,e}function C2(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 M2(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 Jy(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 I2=Jy;function E2(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 A2(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 Qy(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 k2=Qy;function D2(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 L2(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],P=i[1],T=i[2];return Math.abs(f-w)<oe&&Math.abs(y-P)<oe&&Math.abs(g-T)<oe?Zy(e):(h=f-w,c=y-P,p=g-T,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 R2(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 z2(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 F2(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 O2(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 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[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 B2(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 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[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 V2(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 j2(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],P=t[3],T=t[4],I=t[5],E=t[6],R=t[7],k=t[8],L=t[9],A=t[10],D=t[11],x=t[12],S=t[13],C=t[14],F=t[15];return Math.abs(i-b)<=oe*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(r-v)<=oe*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-w)<=oe*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(a-P)<=oe*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(o-T)<=oe*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(s-I)<=oe*Math.max(1,Math.abs(s),Math.abs(I))&&Math.abs(l-E)<=oe*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-R)<=oe*Math.max(1,Math.abs(u),Math.abs(R))&&Math.abs(h-k)<=oe*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(c-L)<=oe*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(p-A)<=oe*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(d-D)<=oe*Math.max(1,Math.abs(d),Math.abs(D))&&Math.abs(f-x)<=oe*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(y-S)<=oe*Math.max(1,Math.abs(y),Math.abs(S))&&Math.abs(g-C)<=oe*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(_-F)<=oe*Math.max(1,Math.abs(_),Math.abs(F))}var U2=Wy,G2=eg,sl={};en(sl,{add:()=>hT,calculateW:()=>QP,clone:()=>oT,conjugate:()=>rT,copy:()=>lT,create:()=>Oh,dot:()=>Lg,equals:()=>yT,exactEquals:()=>mT,exp:()=>Eg,fromEuler:()=>nT,fromMat3:()=>kg,fromValues:()=>sT,getAngle:()=>WP,getAxisAngle:()=>ZP,identity:()=>YP,invert:()=>iT,len:()=>dT,length:()=>Rg,lerp:()=>pT,ln:()=>Ag,mul:()=>cT,multiply:()=>Ig,normalize:()=>Bc,pow:()=>eT,random:()=>tT,rotateX:()=>HP,rotateY:()=>KP,rotateZ:()=>JP,rotationTo:()=>gT,scale:()=>Dg,set:()=>uT,setAxes:()=>xT,setAxisAngle:()=>Mg,slerp:()=>ks,sqlerp:()=>_T,sqrLen:()=>fT,squaredLength:()=>zg,str:()=>aT});var V={};en(V,{add:()=>Y2,angle:()=>dP,bezier:()=>aP,ceil:()=>Z2,clone:()=>X2,copy:()=>q2,create:()=>Rc,cross:()=>As,dist:()=>bP,distance:()=>ag,div:()=>vP,divide:()=>ng,dot:()=>zc,equals:()=>gP,exactEquals:()=>yP,floor:()=>W2,forEach:()=>TP,fromValues:()=>Fh,hermite:()=>nP,inverse:()=>iP,len:()=>ug,length:()=>tg,lerp:()=>rP,max:()=>K2,min:()=>H2,mul:()=>xP,multiply:()=>rg,negate:()=>tP,normalize:()=>lg,random:()=>oP,rotateX:()=>hP,rotateY:()=>cP,rotateZ:()=>pP,round:()=>J2,scale:()=>Q2,scaleAndAdd:()=>eP,set:()=>$2,sqrDist:()=>wP,sqrLen:()=>PP,squaredDistance:()=>og,squaredLength:()=>sg,str:()=>mP,sub:()=>_P,subtract:()=>ig,transformMat3:()=>lP,transformMat4:()=>sP,transformQuat:()=>uP,zero:()=>fP});function Rc(){var e=new Re(3);return Re!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function X2(e){var t=new Re(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function tg(e){var t=e[0],i=e[1],r=e[2];return Math.hypot(t,i,r)}function Fh(e,t,i){var r=new Re(3);return r[0]=e,r[1]=t,r[2]=i,r}function q2(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function $2(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e}function Y2(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function ig(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function rg(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],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}function Z2(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function W2(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function H2(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 K2(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 J2(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function Q2(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function eP(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 ag(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 og(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 sg(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function tP(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function iP(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function lg(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 zc(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function As(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 rP(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 nP(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 aP(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 oP(e,t){t=t||1;var i=Ei()*2*Math.PI,r=Ei()*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 sP(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 lP(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 uP(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 hP(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 cP(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 pP(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 dP(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&&zc(e,t)/h;return Math.acos(Math.min(Math.max(c,-1),1))}function fP(e){return e[0]=0,e[1]=0,e[2]=0,e}function mP(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function yP(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function gP(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)<=oe*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=oe*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=oe*Math.max(1,Math.abs(n),Math.abs(s))}var _P=ig,xP=rg,vP=ng,bP=ag,wP=og,ug=tg,PP=sg,TP=(function(){var e=Rc();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}})(),Je={};en(Je,{add:()=>mg,ceil:()=>SP,clone:()=>cg,copy:()=>dg,create:()=>hg,cross:()=>LP,dist:()=>UP,distance:()=>vg,div:()=>jP,divide:()=>_g,dot:()=>Pg,equals:()=>Cg,exactEquals:()=>Sg,floor:()=>CP,forEach:()=>$P,fromValues:()=>pg,inverse:()=>DP,len:()=>XP,length:()=>Fc,lerp:()=>Tg,max:()=>IP,min:()=>MP,mul:()=>VP,multiply:()=>gg,negate:()=>kP,normalize:()=>wg,random:()=>RP,round:()=>EP,scale:()=>xg,scaleAndAdd:()=>AP,set:()=>fg,sqrDist:()=>GP,sqrLen:()=>qP,squaredDistance:()=>bg,squaredLength:()=>Oc,str:()=>BP,sub:()=>NP,subtract:()=>yg,transformMat4:()=>zP,transformQuat:()=>FP,zero:()=>OP});function hg(){var e=new Re(4);return Re!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function cg(e){var t=new Re(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function pg(e,t,i,r){var n=new Re(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function dg(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function fg(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function mg(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 yg(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 gg(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 _g(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 SP(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 CP(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 MP(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 IP(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 EP(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 xg(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 AP(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 vg(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 bg(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 Fc(e){var t=e[0],i=e[1],r=e[2],n=e[3];return Math.hypot(t,i,r,n)}function Oc(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n}function kP(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function DP(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 wg(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 Pg(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function LP(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 Tg(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 RP(e,t){t=t||1;var i,r,n,a,o,s;do i=Ei()*2-1,r=Ei()*2-1,o=i*i+r*r;while(o>=1);do n=Ei()*2-1,a=Ei()*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 zP(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 FP(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 OP(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function BP(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function Sg(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function Cg(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)<=oe*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=oe*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=oe*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=oe*Math.max(1,Math.abs(a),Math.abs(u))}var NP=yg,VP=gg,jP=_g,UP=vg,GP=bg,XP=Fc,qP=Oc,$P=(function(){var e=hg();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 Oh(){var e=new Re(4);return Re!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function YP(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Mg(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 ZP(e,t){var i=Math.acos(t[3])*2,r=Math.sin(i/2);return r>oe?(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 WP(e,t){var i=Lg(e,t);return Math.acos(2*i*i-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*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 HP(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 KP(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 JP(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 QP(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 Eg(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 Ag(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 eT(e,t,i){return Ag(e,t),Dg(e,e,i),Eg(e,e),e}function ks(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>oe?(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 tT(e){var t=Ei(),i=Ei(),r=Ei(),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 iT(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 rT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function kg(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 nT(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 aT(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var oT=cg,sT=pg,lT=dg,uT=fg,hT=mg,cT=Ig,Dg=xg,Lg=Pg,pT=Tg,Rg=Fc,dT=Rg,zg=Oc,fT=zg,Bc=wg,mT=Sg,yT=Cg,gT=(function(){var e=Rc(),t=Fh(1,0,0),i=Fh(0,1,0);return function(r,n,a){var o=zc(n,a);return o<-.999999?(As(e,t,n),ug(e)<1e-6&&As(e,i,n),lg(e,e),Mg(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(As(e,n,a),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,Bc(r,r))}})(),_T=(function(){var e=Oh(),t=Oh();return function(i,r,n,a,o,s){return ks(e,r,o,s),ks(t,n,a,s),ks(i,e,t,2*s*(1-s)),i}})(),xT=(function(){var e=qy();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],Bc(t,kg(t,e))}})(),At={};en(At,{add:()=>TT,angle:()=>XT,ceil:()=>ST,clone:()=>vT,copy:()=>wT,create:()=>Fg,cross:()=>FT,dist:()=>QT,distance:()=>Vg,div:()=>JT,divide:()=>Ng,dot:()=>zT,equals:()=>ZT,exactEquals:()=>YT,floor:()=>CT,forEach:()=>iS,fromValues:()=>bT,inverse:()=>LT,len:()=>WT,length:()=>Ug,lerp:()=>OT,max:()=>IT,min:()=>MT,mul:()=>KT,multiply:()=>Bg,negate:()=>DT,normalize:()=>RT,random:()=>BT,rotate:()=>GT,round:()=>ET,scale:()=>AT,scaleAndAdd:()=>kT,set:()=>PT,sqrDist:()=>eS,sqrLen:()=>tS,squaredDistance:()=>jg,squaredLength:()=>Gg,str:()=>$T,sub:()=>HT,subtract:()=>Og,transformMat2:()=>NT,transformMat2d:()=>VT,transformMat3:()=>jT,transformMat4:()=>UT,zero:()=>qT});function Fg(){var e=new Re(2);return Re!=Float32Array&&(e[0]=0,e[1]=0),e}function vT(e){var t=new Re(2);return t[0]=e[0],t[1]=e[1],t}function bT(e,t){var i=new Re(2);return i[0]=e,i[1]=t,i}function wT(e,t){return e[0]=t[0],e[1]=t[1],e}function PT(e,t,i){return e[0]=t,e[1]=i,e}function TT(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function Og(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function Bg(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function Ng(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function ST(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function CT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function MT(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e}function IT(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e}function ET(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function AT(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function kT(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e}function Vg(e,t){var i=t[0]-e[0],r=t[1]-e[1];return Math.hypot(i,r)}function jg(e,t){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function Ug(e){var t=e[0],i=e[1];return Math.hypot(t,i)}function Gg(e){var t=e[0],i=e[1];return t*t+i*i}function DT(e,t){return e[0]=-t[0],e[1]=-t[1],e}function LT(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function RT(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 zT(e,t){return e[0]*t[0]+e[1]*t[1]}function FT(e,t,i){var r=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=r,e}function OT(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 BT(e,t){t=t||1;var i=Ei()*2*Math.PI;return e[0]=Math.cos(i)*t,e[1]=Math.sin(i)*t,e}function NT(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 VT(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 jT(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 UT(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 GT(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 XT(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 qT(e){return e[0]=0,e[1]=0,e}function $T(e){return"vec2("+e[0]+", "+e[1]+")"}function YT(e,t){return e[0]===t[0]&&e[1]===t[1]}function ZT(e,t){var i=e[0],r=e[1],n=t[0],a=t[1];return Math.abs(i-n)<=oe*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-a)<=oe*Math.max(1,Math.abs(r),Math.abs(a))}var WT=Ug,HT=Og,KT=Bg,JT=Ng,QT=Vg,eS=jg,tS=Gg,iS=(function(){var e=Fg();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 jt(e,t,i){return t*(8192/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function ha(){return new Float64Array(4)}function rt(){return new Float64Array(3)}function xr(){return new Float64Array(16)}function wn(){let e=new Float64Array(16);return O.identity(e),e}function Xg(){let e=new Float32Array(16);return O.identity(e),e}function Pr(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]:jt(t,i[0],e.zoom),n?i[1]:jt(t,i[1],e.zoom)]}function Bh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Wt(e,t,i){let r=Va.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=V.cross([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),a=V.cross([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),o=V.cross([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),s=V.scale([],n,-e[3]);return V.add(s,s,V.scale([],a,-t[3])),V.add(s,s,V.scale([],o,-i[3])),V.scale(s,s,1/r),s}function rS(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 Ho(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 Bt(e,t){let i=Nn(e,360),r=Nn(t,360),n=r-i,a=r>i?n-360:n+360;return Math.abs(n)<Math.abs(a)?n:a}function Ko(e,t){let i=Nn(e,Math.PI*2),r=Nn(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 Nn(e,t){return(e%t+t)%t}function Ds(e,t,i,r,n){let a=Ce((e-t)/(i-t),0,1);return Ln(r,n,a)}function Ln(e,t,i){return e*(1-i)+t*i}function nS(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 qg(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 Nc(e,t,i,r){let n=new Q1.default(e,t,i,r);return a=>n.solve(a)}var Nh=Nc(.25,.1,.25,1);function Ce(e,t,i){return Math.min(i,Math.max(t,e))}function Xr(e,t,i){let r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function aS(e,t){let i=[];for(let r in e)r in t||i.push(r);return i}function W(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function ao(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 oS=1;function $g(){return oS++}function sS(e){return Math.log(e)/Math.LN2%1===0}function lS(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function bt(e){return Math.pow(2,e)}function wt(e){return Math.log(e)/Math.LN2}function Vc(e,t,i){let r={};for(let n in e)r[n]=t.call(i||this,e[n],n,e);return r}function Yg(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 Ci(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(!Ci(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(!Ci(e[i],t[i]))return!1;return!0}return e===t}function kt(e){return Array.isArray(e)?e.map(kt):typeof e=="object"&&e?Vc(e,kt):e}var Lf={};function at(e){Lf[e]||(typeof console<"u"&&console.warn(e),Lf[e]=!0)}function vr(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function uS(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 J1.default(e.x+c*a,e.y+c*n)}function hS([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 Vn(e){return typeof WorkerGlobalScope<"u"&&typeof e<"u"&&e instanceof WorkerGlobalScope}function cS(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 Qu=null;function pS(e){if(Qu==null){let t=e.navigator?e.navigator.userAgent:null;Qu=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Qu}function Wi(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var dS=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 ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},Rf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",fS=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=Rf})},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):Rf});function mS(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 yS(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?.format;if(!o||!(o.startsWith("BGR")||o.startsWith("RGB")))throw new Error(`Unrecognized format ${o}`);let s=o.startsWith("BGR"),l=new Uint8ClampedArray(r*n*4);if(await a.copyTo(l,mS(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 zf(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function Ne(e){return e*Math.PI/180}function An(e){return e/Math.PI*180}function Zg(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function gS(e){let t=new Float64Array(9);Va.fromQuat(t,e);let i=An(-Math.asin(Ce(t[2],-1,1))),r,n;return Math.hypot(t[5],t[8])<.001?(r=0,n=-An(Math.atan2(t[3],t[4]))):(r=An(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),n=An(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:i+90,bearing:n}}function _S(e,t,i){let r=At.fromValues(t.x-i.x,t.y-i.y),n=At.fromValues(e.x-i.x,e.y-i.y),a=r[0]*n[1]-r[1]*n[0],o=Math.atan2(a,At.dot(r,n));return An(o)}function Ff(e,t,i){let r=new Float64Array(4);return sl.fromEuler(r,e,t-90,i),r}var ll=25,jc=0,zi=85.051129,Wg={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Hg={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function xS(e,t){return Wg[t]&&"touches"in e}function vS(e,t){return Hg[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)}function bS(e){return Wg[e]||Hg[e]}var Kg="AbortError";function wS(e){return e.message===Kg}function ul(){return new Error(Kg)}var PS=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Jo,eh,ye={now:PS,frame(e,t,i){requestAnimationFrame(r=>{if(e.signal.aborted){i(ul());return}t(r)})},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 Jo||(Jo=document.createElement("a")),Jo.href=e,Jo.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(eh==null&&(eh=matchMedia("(prefers-reduced-motion: reduce)")),eh.matches):!1}},TS=ne(se(),1),Pn=class Fe{static testProp(t){if(!Fe.docStyle)return t[0];for(let i=0;i<t.length;i++)if(t[i]in Fe.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(){Fe.docStyle&&Fe.selectProp&&(Fe.userSelect=Fe.docStyle[Fe.selectProp],Fe.docStyle[Fe.selectProp]="none")}static enableDrag(){Fe.docStyle&&Fe.selectProp&&(Fe.docStyle[Fe.selectProp]=Fe.userSelect)}static setTransform(t,i){t.style[Fe.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",Fe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Fe.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Fe.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 TS.default((r.clientX-n.left)/i.x-t.clientLeft,(r.clientY-n.top)/i.y-t.clientTop)}static mousePos(t,i){let r=Fe.getScale(t);return Fe.getPoint(t,r,i)}static touchPos(t,i){let r=[],n=Fe.getScale(t);for(let a=0;a<i.length;a++)r.push(Fe.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 Fe.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)Fe.removeAttributes(r),Fe.clean(r)}static removeAttributes(t){for(let{name:i,value:r}of t.attributes)Fe.isPossiblyDangerous(i,r)&&t.removeAttribute(i)}};Pn.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Pn.selectProp=Pn.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Pn.transformProp=Pn.testProp(["transform","WebkitTransform"]);var ge=Pn,Tr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Jg(e){return Tr.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}var Vh="global-dispatcher",Gs=class extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}},Uc=()=>Vn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,SS=e=>/^file:/.test(e)||/^file:/.test(Uc())&&!/^\w+:/.test(e);async function CS(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:Uc(),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 Gs(0,o.message,e.url,new Blob)}if(!r.ok){let o=await r.blob();throw new Gs(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 ul();return{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}function MS(e,t){return new Promise((i,r)=>{let n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(n.responseType="arraybuffer");for(let a in e.headers)n.setRequestHeader(a,e.headers[a]);e.type==="json"&&(n.responseType="text",e.headers?.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 a=n.response;if(e.type==="json")try{a=JSON.parse(n.response)}catch(o){r(o);return}i({data:a,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let a=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new Gs(n.status,n.statusText,e.url,a))}},t.signal.addEventListener("abort",()=>{n.abort(),r(ul())}),n.send(e.body)})}var hl=function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let i=Jg(e.url);if(i)return i(e,t);if(Vn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Vh},t)}if(!SS(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return CS(e,t);if(Vn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Vh},t)}return MS(e,t)},cl=(e,t)=>hl(W(e,{type:"json"}),t),IS=(e,t)=>hl(W(e,{type:"arrayBuffer"}),t);function Qg(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 ES=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");Qg(r)||(t.crossOrigin="Anonymous"),n.src=r,t.appendChild(n)}})},Gc={supported:!1,testSupport:AS},Ta,Xc=!1,kn,e_=!1;typeof document<"u"&&(kn=document.createElement("img"),kn.onload=()=>{Ta&&t_(Ta),Ta=null,e_=!0},kn.onerror=()=>{Xc=!0,Ta=null},kn.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function AS(e){Xc||!kn||(e_?t_(e):Ta=e)}function t_(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,kn),e.isContextLost())return;Gc.supported=!0}catch{}e.deleteTexture(t),Xc=!0}var Di;(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)=>{Gc.supported&&(h.headers||(h.headers={}),h.headers.accept="image/webp,*/*"),W(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"?dS(h):fS(h),s=async h=>{h.state="running";let{requestParameters:c,supportImageRefresh:p,onError:d,onSuccess:f,abortController:y}=h,g=p===!1&&!Vn(self)&&!Jg(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||Wi(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()?Tr.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Tr.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"||!Qg(y))&&(f.crossOrigin="anonymous"),c.signal.addEventListener("abort",()=>{f.src="",d(ul())}),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})})(Di||(Di={}));Di.resetRequestQueue();var kS=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 Of(e,t,i){i[e]&&i[e].indexOf(t)!==-1||(i[e]=i[e]||[],i[e].push(t))}function th(e,t,i){if(i&&i[e]){let r=i[e].indexOf(t);r!==-1&&i[e].splice(r,1)}}var X=class{constructor(e,t={}){W(this,t),this.type=e}},ee=class extends X{constructor(e,t={}){super("error",W({error:e},t))}},Dt=class{on(e,t){return this._listeners=this._listeners||{},Of(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return th(e,t,this._listeners),th(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Of(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){typeof e=="string"&&(e=new X(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)th(i,o,this._oneTimeListeners),o.call(this,e);let a=this._eventedParent;a&&(W(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof ee&&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}},DS=8,LS={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"}},RS={"*":{type:"source"}},zS=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],FS={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:"*"}},OS={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:"*"}},BS={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:"*"}},NS={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"}},VS={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"}}},jS={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"}}},US={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"}},GS=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],XS={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},qS={"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"}},$S={"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"}},YS={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ZS={"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"}},WS={"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"}},HS={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},KS={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},JS={type:"array",value:"*"},QS={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},eC={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},tC={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},iC={type:"array",value:"*",minimum:1},rC={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}},nC={"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}},aC={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},oC={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},sC=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],lC={"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"}},uC={"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"}},hC={"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"}},cC={"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"}},pC={"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"}},dC={"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"}},fC={"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"}},mC={"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"}},yC={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},gC={"*":{type:"string"}},z={$version:DS,$root:LS,sources:RS,source:zS,source_vector:FS,source_raster:OS,source_raster_dem:BS,source_geojson:NS,source_video:VS,source_image:jS,layer:US,layout:GS,layout_background:XS,layout_fill:qS,layout_circle:$S,layout_heatmap:YS,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:ZS,layout_symbol:WS,layout_raster:HS,layout_hillshade:KS,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:JS,filter_operator:QS,geometry_type:eC,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:tC,expression:iC,light:rC,sky:nC,terrain:aC,projection:oC,paint:sC,paint_fill:lC,"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:uC,paint_circle:hC,paint_heatmap:cC,paint_symbol:pC,paint_raster:dC,paint_hillshade:fC,"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:mC,transition:yC,"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:gC},_C=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function xC(e,t){let i={};for(let r in e)r!=="ref"&&(i[r]=e[r]);return _C.forEach(r=>{r in t&&(i[r]=t[r])}),i}function Bf(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]=xC(e[i],t[e[i].ref]));return e}function Ee(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(!Ee(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(!Ee(e[i],t[i]))return!1;return!0}return e===t}function Ht(e,t){e.push(t)}function i_(e,t,i){Ht(i,{command:"addSource",args:[e,t[e]]})}function r_(e,t,i){Ht(t,{command:"removeSource",args:[e]}),i[e]=!0}function vC(e,t,i,r){r_(e,i,r),i_(e,t,i)}function bC(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!Ee(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!Ee(e[i][r],t[i][r]))return!1;return!0}function wC(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)||r_(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?Ee(e[n],t[n])||(e[n].type==="geojson"&&t[n].type==="geojson"&&bC(e,t,n)?Ht(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):vC(n,t,i,r)):i_(n,t,i))}function Qo(e,t,i,r,n,a){e=e||{},t=t||{};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Ee(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)||Ee(e[o],t[o])||i.push({command:a,args:[r,o,t[o],n]})}function Nf(e){return e.id}function Vf(e,t){return e[t.id]=t,e}function PC(e,t,i){e=e||[],t=t||[];let r=e.map(Nf),n=t.map(Nf),a=e.reduce(Vf,{}),o=t.reduce(Vf,{}),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++:(Ht(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)?(Ht(i,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-y),1)):y++,p=s[s.length-f],Ht(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]||Ee(h,c))){if(!Ee(h.source,c.source)||!Ee(h["source-layer"],c["source-layer"])||!Ee(h.type,c.type)){Ht(i,{command:"removeLayer",args:[u]}),p=s[s.lastIndexOf(u)+1],Ht(i,{command:"addLayer",args:[c,p]});continue}Qo(h.layout,c.layout,i,u,null,"setLayoutProperty"),Qo(h.paint,c.paint,i,u,null,"setPaintProperty"),Ee(h.filter,c.filter)||Ht(i,{command:"setFilter",args:[u,c.filter]}),(!Ee(h.minzoom,c.minzoom)||!Ee(h.maxzoom,c.maxzoom))&&Ht(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?Qo(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Ee(h[d],c[d])||Ht(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?Qo(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Ee(h[d],c[d])||Ht(i,{command:"setLayerProperty",args:[u,d,c[d]]}))}}function TC(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!Ee(e.version,t.version))return[{command:"setStyle",args:[t]}];Ee(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Ee(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),Ee(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Ee(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Ee(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Ee(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Ee(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),Ee(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Ee(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Ee(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Ee(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Ee(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),Ee(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),Ee(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let r={},n=[];wC(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),PC(a,t.layers,i)}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:"setStyle",args:[t]}]}return i}var G=class{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}};function jn(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}var Mi=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},SC=class n_{constructor(t,i=[]){this.parent=t,this.bindings={};for(let[r,n]of i)this.bindings[r]=n}concat(t){return new n_(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},oo={kind:"null"},$={kind:"number"},fe={kind:"string"},ce={kind:"boolean"},ci={kind:"color"},pl={kind:"projectionDefinition"},qr={kind:"object"},ue={kind:"value"},CC={kind:"error"},dl={kind:"collator"},so={kind:"formatted"},fl={kind:"padding"},ja={kind:"colorArray"},ml={kind:"numberArray"},lo={kind:"resolvedImage"},yl={kind:"variableAnchorOffsetCollection"};function Nt(e,t){return{kind:"array",itemType:e,N:t}}function qe(e){if(e.kind==="array"){let t=qe(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}else return e.kind}var MC=[oo,$,fe,ce,ci,pl,so,qr,Nt(ue),fl,ml,ja,lo,yl];function Ua(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ua(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 MC)if(!Ua(i,t))return null}}return`Expected ${qe(e)} but found ${qe(t)} instead.`}function qc(e,t){return t.some(i=>i.kind===e.kind)}function $r(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 cr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}var a_=.96422,o_=1,s_=.82521,l_=4/29,Rn=6/29,u_=3*Rn*Rn,IC=Rn*Rn*Rn,EC=Math.PI/180,AC=180/Math.PI;function h_(e){return e=e%360,e<0&&(e+=360),e}function c_([e,t,i,r]){e=ih(e),t=ih(t),i=ih(i);let n,a,o=rh((.2225045*e+.7168786*t+.0606169*i)/o_);e===t&&t===i?n=a=o:(n=rh((.4360747*e+.3850649*t+.1430804*i)/a_),a=rh((.0139322*e+.0971045*t+.7141733*i)/s_));let s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),r]}function ih(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function rh(e){return e>IC?Math.pow(e,1/3):e/u_+l_}function p_([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=o_*ah(n),a=a_*ah(a),o=s_*ah(o),[nh(3.1338561*a-1.6168667*n-.4906146*o),nh(-.9787684*a+1.9161415*n+.033454*o),nh(.0719453*a-.2289914*n+1.4052427*o),r]}function nh(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 ah(e){return e>Rn?e*e*e:u_*(e-l_)}function kC(e){let[t,i,r,n]=c_(e),a=Math.sqrt(i*i+r*r);return[Math.round(a*1e4)?h_(Math.atan2(r,i)*AC):NaN,a,t,n]}function DC([e,t,i,r]){return e=isNaN(e)?0:e*EC,p_([i,Math.cos(e)*t,Math.sin(e)*t,r])}function LC([e,t,i,r]){e=h_(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 RC=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function La(e,t){return RC(e,t)?e[t]:void 0}function zC(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=La(FC,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[es(e.slice(a,a+=n)),es(e.slice(a,a+=n)),es(e.slice(a,a+=n)),es(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 P=[Tn(+s/w,0,1),Tn(+h/w,0,1),Tn(+d/w,0,1),g?jf(+g,_):1];if(Uf(P))return P}}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,Tn(+s,0,100),Tn(+u,0,100),c?jf(+c,p):1];if(Uf(f))return LC(f)}}}function es(e){return parseInt(e.padEnd(2,e),16)/255}function jf(e,t){return Tn(t?e/100:e,0,1)}function Tn(e,t,i){return Math.min(Math.max(t,e),i)}function Uf(e){return!e.some(Number.isNaN)}var FC={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 wr(e,t,i){return e+i*(t-e)}function Un(e,t,i){return e.map((r,n)=>wr(r,t[n],i))}function OC(e){return e==="rgb"||e==="hcl"||e==="lab"}var J=class Sn{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 Sn)return t;if(typeof t!="string")return;let i=zC(t);if(i)return new Sn(...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",kC(this.rgb))}get lab(){return this.overwriteGetter("lab",c_(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,n]=this.rgb;return`rgba(${[t,i,r].map(a=>Math.round(a*255)).join(",")},${n})`}static interpolate(t,i,r,n="rgb"){switch(n){case"rgb":{let[a,o,s,l]=Un(t.rgb,i.rgb,r);return new Sn(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]=DC([d,f??wr(o,h,r),wr(s,c,r),wr(l,p,r)]);return new Sn(y,g,_,b,!1)}case"lab":{let[a,o,s,l]=p_(Un(t.lab,i.lab,r));return new Sn(a,o,s,l,!1)}}}};J.black=new J(0,0,0,1);J.white=new J(1,1,1,1);J.transparent=new J(0,0,0,0);J.red=new J(1,0,0,1);var $c=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}},BC=["bottom","center","top"],jh=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}},Ki=class Ls{constructor(t){this.sections=t}static fromString(t){return new Ls([new jh(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 Ls?t:Ls.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},Bi=class Sa{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Sa)return t;if(typeof t=="number")return new Sa([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 Sa(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new Sa(Un(t.values,i.values,r))}},Ni=class Ca{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ca)return t;if(typeof t=="number")return new Ca([t]);if(Array.isArray(t)){for(let i of t)if(typeof i!="number")return;return new Ca(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new Ca(Un(t.values,i.values,r))}},ei=class Ma{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ma)return t;if(typeof t=="string"){let r=J.parse(t);return r?new Ma([r]):void 0}if(!Array.isArray(t))return;let i=[];for(let r of t){if(typeof r!="string")return;let n=J.parse(r);if(!n)return;i.push(n)}return new Ma(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 (${t.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)a.push(J.interpolate(t.values[o],i.values[o],r,n));return new Ma(a)}},Ze=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},NC=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Mr=class Rs{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Rs)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"||!NC.has(r)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new Rs(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 Ze(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${i.toString()}`);let o=[];for(let s=0;s<n.length;s+=2){if(n[s]!==a[s])throw new Ze(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${n[s]}, to[${s}]: ${a[s]}`);o.push(n[s]);let[l,u]=n[s+1],[h,c]=a[s+1];o.push([wr(l,h,r),wr(u,c,r)])}return new Rs(o)}},Fi=class d_{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new d_({name:t,available:!1}):null}},tn=class Cn{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}static interpolate(t,i,r){return new Cn(t,i,r)}static parse(t){if(t instanceof Cn)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new Cn(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new Cn(t.from,t.to,t.transition);if(typeof t=="string")return new Cn(t,t,1)}};function f_(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 [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ga(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof tn||e instanceof J||e instanceof $c||e instanceof Ki||e instanceof Bi||e instanceof Ni||e instanceof ei||e instanceof Mr||e instanceof Fi)return!0;if(Array.isArray(e)){for(let t of e)if(!Ga(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!Ga(e[t]))return!1;return!0}else return!1}function ot(e){if(e===null)return oo;if(typeof e=="string")return fe;if(typeof e=="boolean")return ce;if(typeof e=="number")return $;if(e instanceof J)return ci;if(e instanceof tn)return pl;if(e instanceof $c)return dl;if(e instanceof Ki)return so;if(e instanceof Bi)return fl;if(e instanceof Ni)return ml;if(e instanceof ei)return ja;if(e instanceof Mr)return yl;if(e instanceof Fi)return lo;if(Array.isArray(e)){let t=e.length,i;for(let r of e){let n=ot(r);if(!i)i=n;else{if(i===n)continue;i=ue;break}}return Nt(i||ue,t)}else return qr}function Ra(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof J||e instanceof tn||e instanceof Ki||e instanceof Bi||e instanceof Ni||e instanceof ei||e instanceof Mr||e instanceof Fi?e.toString():JSON.stringify(e)}var Xa=class m_{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 ${t.length-1} instead.`);if(!Ga(t[1]))return i.error("invalid value");let r=t[1],n=ot(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 m_(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},ts={string:fe,number:$,boolean:ce,object:qr},qi=class y_{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 ts)||u==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);s=ts[u],r++}else s=ue;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=Nt(s,l)}else{if(!ts[a])throw new Error(`Types doesn't contain name = ${a}`);n=ts[a]}let o=[];for(;r<t.length;r++){let s=i.parse(t[r],r,ue);if(!s)return null;o.push(s)}return new y_(n,o)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if(Ua(this.type,ot(r))){if(i===this.args.length-1)throw new Ze(`Expected value to be of type ${qe(this.type)}, but found ${qe(ot(r))} instead.`)}else return r}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Gf={"to-boolean":ce,"to-color":ci,"to-number":$,"to-string":fe},Dn=class g_{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(!Gf[r])throw new Error(`Can't parse ${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=Gf[r],a=[];for(let o=1;o<t.length;o++){let s=i.parse(t[o],o,ue);if(!s)return null;a.push(s)}return new g_(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 J)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 ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:r=f_(i[0],i[1],i[2],i[3]),!r))return new J(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ze(r||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let n=Bi.parse(i);if(n)return n}throw new Ze(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=Ni.parse(i);if(n)return n}throw new Ze(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=ei.parse(i);if(n)return n}throw new Ze(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let n=Mr.parse(i);if(n)return n}throw new Ze(`Could not parse variableAnchorOffsetCollection from value '${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 Ze(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return Ki.fromString(Ra(this.args[0].evaluate(t)));case"resolvedImage":return Fi.fromString(Ra(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Ra(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},VC=["Unknown","Point","LineString","Polygon"],__=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"?VC[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=J.parse(e),this._parseColorCache.set(e,t)),t}},x_=class v_{constructor(t,i,r=[],n,a=new SC,o=[]){this.registry=t,this.path=r,this.key=r.map(s=>`[${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 qi(a,[n]):o==="coerce"?new Dn(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 ${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 Xa)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new __;try{o=new Xa(o.type,o.evaluate(s))}catch(l){return this.error(l.message),null}}return o}return this.error(`Unknown expression "${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 ${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 v_(this.registry,this._isConstant,n,i||null,a,this.errors)}error(t,...i){let r=`${this.key}${i.map(n=>`[${n}]`).join("")}`;this.errors.push(new Mi(r,t))}checkSubtype(t,i){let r=Ua(t,i);return r&&this.error(r),r}},b_=class w_{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 ${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 ${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 w_(r,n):null}outputDefined(){return this.result.outputDefined()}},P_=class T_{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 T_(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},jC=class S_{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 ${t.length-1} instead.`);let r=i.parse(t[1],1,$),n=i.parse(t[2],2,Nt(i.expectedType||ue));if(!r||!n)return null;let a=n.type;return new S_(a.itemType,r,n)}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new Ze(`Array index out of bounds: ${i} < 0.`);if(i>=r.length)throw new Ze(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i!==Math.floor(i))throw new Ze(`Array index must be an integer, but found ${i} instead.`);return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},UC=class C_{constructor(t,i){this.type=ce,this.needle=t,this.haystack=i}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,ue),n=i.parse(t[2],2,ue);return!r||!n?null:qc(r.type,[ce,fe,$,oo,ue])?new C_(r,n):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${qe(r.type)} instead`)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!$r(i,["boolean","string","number","null"]))throw new Ze(`Expected first argument to be of type boolean, string, number or null, but found ${qe(ot(i))} instead.`);if(!$r(r,["string","array"]))throw new Ze(`Expected second argument to be of type array or string, but found ${qe(ot(r))} instead.`);return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},GC=class Uh{constructor(t,i,r){this.type=$,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 ${t.length-1} instead.`);let r=i.parse(t[1],1,ue),n=i.parse(t[2],2,ue);if(!r||!n)return null;if(!qc(r.type,[ce,fe,$,oo,ue]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${qe(r.type)} instead`);if(t.length===4){let a=i.parse(t[3],3,$);return a?new Uh(r,n,a):null}else return new Uh(r,n)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!$r(i,["boolean","string","number","null"]))throw new Ze(`Expected first argument to be of type boolean, string, number or null, but found ${qe(ot(i))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),$r(r,["string"])){let a=r.indexOf(i,n);return a===-1?-1:[...r.slice(0,a)].length}else{if($r(r,["array"]))return r.indexOf(i,n);throw new Ze(`Expected second argument to be of type array or string, but found ${qe(ot(r))} instead.`)}}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},XC=class M_{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 ${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 ${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=ot(f);else if(p.checkSubtype(r,ot(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,ue);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 M_(r,n,s,a,o,l)}evaluate(t){let i=this.input.evaluate(t);return(ot(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()}},qC=class I_{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 ${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,ce);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 I_(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()}},$C=class Gh{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 ${t.length-1} instead.`);let r=i.parse(t[1],1,ue),n=i.parse(t[2],2,$);if(!r||!n)return null;if(!qc(r.type,[Nt(ue),fe,ue]))return i.error(`Expected first argument to be of type array or string, but found ${qe(r.type)} instead`);if(t.length===4){let a=i.parse(t[3],3,$);return a?new Gh(r.type,r,n,a):null}else return new Gh(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)),$r(i,["string"]))return[...i].slice(r,n).join("");if($r(i,["array"]))return i.slice(r,n);throw new Ze(`Expected first argument to be of type array or string, but found ${qe(ot(i))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}};function gl(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 Ze("Input is not a number.");return 0}var Yc=class E_{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 ${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,$);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 E_(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=gl(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 YC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oh,Xf;function ZC(){if(Xf)return oh;Xf=1,oh=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))}},oh}var WC=ZC(),HC=YC(WC),pi=class Xh{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=sh(i,t.base,r,n);else if(t.name==="linear")a=sh(i,1,r,n);else if(t.name==="cubic-bezier"){let o=t.controlPoints;a=new HC(o[0],o[1],o[2],o[3]).solve(sh(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 ${String(n[0])}`,1,0);if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!==0)return i.error("Expected an even number of arguments.");if(a=i.parse(a,2,$),!a)return null;let s=[],l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&i.expectedType!=ja?l=ci: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!cr(l,$)&&!cr(l,pl)&&!cr(l,ci)&&!cr(l,fl)&&!cr(l,ml)&&!cr(l,ja)&&!cr(l,yl)&&!cr(l,Nt($))?i.error(`Type ${qe(l)} is not interpolatable.`):new Xh(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=gl(i,n),s=i[o],l=i[o+1],u=Xh.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 wr(h,c,u);case"color":return J.interpolate(h,c,u);case"padding":return Bi.interpolate(h,c,u);case"colorArray":return ei.interpolate(h,c,u);case"numberArray":return Ni.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Mr.interpolate(h,c,u);case"array":return Un(h,c,u);case"projectionDefinition":return tn.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return J.interpolate(h,c,u,"hcl");case"colorArray":return ei.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return J.interpolate(h,c,u,"lab");case"colorArray":return ei.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 sh(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 $e={color:J.interpolate,number:wr,padding:Bi.interpolate,numberArray:Ni.interpolate,colorArray:ei.interpolate,variableAnchorOffsetCollection:Mr.interpolate,array:Un},A_=class qh{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=>Ua(n,o.type))?new qh(ue,a):new qh(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 Fi&&!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 qf(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 KC(e,t,i){return t===i}function JC(e,t,i){return t!==i}function QC(e,t,i){return t<i}function eM(e,t,i){return t>i}function tM(e,t,i){return t<=i}function iM(e,t,i){return t>=i}function k_(e,t,i,r){return r.compare(t,i)===0}function rM(e,t,i,r){return!k_(e,t,i,r)}function nM(e,t,i,r){return r.compare(t,i)<0}function aM(e,t,i,r){return r.compare(t,i)>0}function oM(e,t,i,r){return r.compare(t,i)<=0}function sM(e,t,i,r){return r.compare(t,i)>=0}function Hn(e,t,i){let r=e!=="=="&&e!=="!=";return class D_{constructor(a,o,s){this.type=ce,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,ue);if(!l)return null;if(!qf(s,l.type))return o.concat(1).error(`"${s}" comparisons are not supported for type '${qe(l.type)}'.`);let u=o.parse(a[2],2,ue);if(!u)return null;if(!qf(s,u.type))return o.concat(2).error(`"${s}" comparisons are not supported for type '${qe(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${qe(l.type)}' and '${qe(u.type)}'.`);r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new qi(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new qi(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,dl),!h)return null}return new D_(l,u,h)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(r&&this.hasUntypedArgument){let l=ot(o),u=ot(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new Ze(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let l=ot(o),u=ot(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 lM=Hn("==",KC,k_),uM=Hn("!=",JC,rM),hM=Hn("<",QC,nM),cM=Hn(">",eM,aM),pM=Hn("<=",tM,oM),dM=Hn(">=",iM,sM),L_=class R_{constructor(t,i,r){this.type=dl,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,ce);if(!n)return null;let a=i.parse(r["diacritic-sensitive"]===void 0?!1:r["diacritic-sensitive"],1,ce);if(!a)return null;let o=null;return r.locale&&(o=i.parse(r.locale,1,fe),!o)?null:new R_(n,a,o)}evaluate(t){return new $c(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}},fM=class z_{constructor(t,i,r,n,a){this.type=fe,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,$);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,fe),!a))return null;let o=null;if(n.currency&&(o=i.parse(n.currency,1,fe),!o))return null;let s=null;if(n["min-fraction-digits"]&&(s=i.parse(n["min-fraction-digits"],1,$),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=i.parse(n["max-fraction-digits"],1,$),!l)?null:new z_(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}},F_=class O_{constructor(t){this.type=so,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,$),!l))return null;let u=null;if(s["text-font"]&&(u=i.parse(s["text-font"],1,Nt(fe)),!u))return null;let h=null;if(s["text-color"]&&(h=i.parse(s["text-color"],1,ci),!h))return null;let c=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!BC.includes(s["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(c=i.parse(s["vertical-align"],1,fe),!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,ue);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 O_(n)}evaluate(t){let i=r=>{let n=r.content.evaluate(t);return ot(n)===lo?new jh("",n,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new jh(Ra(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 Ki(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}},mM=class B_{constructor(t){this.type=lo,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");let r=i.parse(t[1],1,fe);return r?new B_(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=Fi.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}},yM=class N_{constructor(t){this.type=$,this.input=t}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${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 ${qe(r.type)} instead.`):new N_(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 Ze(`Expected value to be of type string or array, but found ${qe(ot(i))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}},Li=8192;function gM(e,t){let i=_M(e[0]),r=vM(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*Li),Math.round(r*n*Li)]}function Zc(e,t){let i=Math.pow(2,t.z),r=(e[0]/Li+t.x)/i,n=(e[1]/Li+t.y)/i;return[xM(r),bM(n)]}function _M(e){return(180+e)/360}function xM(e){return e*360-180}function vM(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function bM(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 qa(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function wM(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 PM(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 _l(e,t,i,r){let n=[t[0]-e[0],t[1]-e[1]],a=[r[0]-i[0],r[1]-i[1]];return MM(a,n)===0?!1:!!($f(e,t,i,r)&&$f(i,r,e,t))}function TM(e,t,i){for(let r of i)for(let n=0;n<r.length-1;++n)if(_l(e,t,r[n],r[n+1]))return!0;return!1}function Kn(e,t,i=!1){let r=!1;for(let n of t)for(let a=0;a<n.length-1;a++){if(PM(e,n[a],n[a+1]))return i;wM(e,n[a],n[a+1])&&(r=!r)}return r}function SM(e,t){for(let i of t)if(Kn(e,i))return!0;return!1}function V_(e,t){for(let i of e)if(!Kn(i,t))return!1;for(let i=0;i<e.length-1;++i)if(TM(e[i],e[i+1],t))return!1;return!0}function CM(e,t){for(let i of t)if(V_(e,i))return!0;return!1}function MM(e,t){return e[0]*t[1]-e[1]*t[0]}function $f(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 Wc(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=gM(e[n][o],i);uo(t,s),a.push(s)}r.push(a)}return r}function j_(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=Wc(e[n],t,i);r.push(a)}return r}function U_(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 IM(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Yf(e,t,i,r){let n=Math.pow(2,r.z)*Li,a=[r.x*Li,r.y*Li],o=[];for(let s of e)for(let l of s){let u=[l.x+a[0],l.y+a[1]];U_(u,t,i,n),o.push(u)}return o}function Zf(e,t,i,r){let n=Math.pow(2,r.z)*Li,a=[r.x*Li,r.y*Li],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){IM(t);for(let s of o)for(let l of s)U_(l,t,i,n)}return o}function EM(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=Wc(t.coordinates,r,n),o=Yf(e.geometry(),i,r,n);if(!qa(i,r))return!1;for(let s of o)if(!Kn(s,a))return!1}if(t.type==="MultiPolygon"){let a=j_(t.coordinates,r,n),o=Yf(e.geometry(),i,r,n);if(!qa(i,r))return!1;for(let s of o)if(!SM(s,a))return!1}return!0}function AM(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=Wc(t.coordinates,r,n),o=Zf(e.geometry(),i,r,n);if(!qa(i,r))return!1;for(let s of o)if(!V_(s,a))return!1}if(t.type==="MultiPolygon"){let a=j_(t.coordinates,r,n),o=Zf(e.geometry(),i,r,n);if(!qa(i,r))return!1;for(let s of o)if(!CM(s,a))return!1}return!0}var Hc=class zs{constructor(t,i){this.type=ce,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 ${t.length-1} instead.`);if(Ga(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 zs(r,a)}}else if(r.type==="Feature"){let n=r.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new zs(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new zs(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 EM(t,this.geometries);if(t.geometryType()==="LineString")return AM(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},G_=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 X_(e,t,i=0,r=e.length-1,n=kM){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));X_(e,t,d,f,n)}let a=e[t],o=i,s=r;for(ca(e,i,t),n(e[r],a)>0&&ca(e,i,r);o<s;){for(ca(e,o,s),o++,s--;n(e[o],a)<0;)o++;for(;n(e[s],a)>0;)s--}n(e[i],a)===0?ca(e,i,s):(s++,ca(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function ca(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function kM(e,t){return e<t?-1:e>t?1:0}function Kc(e,t){if(e.length<=1)return[e];let i=[],r,n;for(let a of e){let o=LM(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||(X_(i[a],t,1,i[a].length-1,DM),i[a]=i[a].slice(0,t));return i}function DM(e,t){return t.area-e.area}function LM(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 RM=6378.137,Wf=1/298.257223563,Hf=Wf*(2-Wf),Kf=Math.PI/180,Jc=class{constructor(e){let t=Kf*RM*1e3,i=Math.cos(e*Kf),r=1/(1-Hf*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-Hf)}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}},$h=100,Yh=50;function q_(e,t){return t[0]-e[0]}function Xs(e){return e[1]-e[0]+1}function Ji(e,t){return e[1]>=e[0]&&e[1]<t}function Zh(e,t){if(e[0]>e[1])return[null,null];let i=Xs(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 Wh(e,t){if(!Ji(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 Hh(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 Jf(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Qc(e,t,i){if(!Jf(e)||!Jf(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 Gr(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function ep(e,t,i,r,n){let a=Math.min(Gr(e,[i,r],n),Gr(t,[i,r],n)),o=Math.min(Gr(i,[e,t],n),Gr(r,[e,t],n));return Math.min(a,o)}function zM(e,t,i,r,n){if(!(Ji(t,e.length)&&Ji(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(_l(s,l,h,c))return 0;a=Math.min(a,ep(s,l,h,c,n))}}return a}function FM(e,t,i,r,n){if(!(Ji(t,e.length)&&Ji(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 OM(e,t,i){if(Kn(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,Gr(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 BM(e,t,i,r){if(!Ji(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(Kn(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(_l(o,s,p,d))return 0;n=Math.min(n,ep(o,s,p,d,r))}}return n}function Qf(e,t){for(let i of e)for(let r of i)if(Kn(r,t,!0))return!0;return!1}function NM(e,t,i,r=1/0){let n=Hh(e),a=Hh(t);if(r!==1/0&&Qc(n,a,i)>=r)return r;if(qa(n,a)){if(Qf(e,t))return 0}else if(Qf(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(_l(c,p,_,b))return 0;o=Math.min(o,ep(c,p,_,b,i))}}return o}function em(e,t,i,r,n,a){if(!a)return;let o=Qc(Wh(r,a),n,i);o<t&&e.push([o,a,[0,0]])}function is(e,t,i,r,n,a,o){if(!a||!o)return;let s=Qc(Wh(r,a),Wh(n,o),i);s<t&&e.push([s,a,o])}function qs(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 G_([[0,[0,e.length-1],[0,0]]],q_),s=Hh(i);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],h=t?Yh:$h;if(Xs(u)<=h){if(!Ji(u,e.length))return NaN;if(t){let c=BM(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=OM(e[c],i,r);if(a=Math.min(a,p),a===0)return 0}}else{let c=Zh(u,t);em(o,a,r,e,s,c[0]),em(o,a,r,e,s,c[1])}}return a}function $s(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 G_([[0,[0,e.length-1],[0,i.length-1]]],q_);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],h=l[2],c=t?Yh:$h,p=r?Yh:$h;if(Xs(u)<=c&&Xs(h)<=p){if(!Ji(u,e.length)&&Ji(h,i.length))return NaN;let d;if(t&&r)d=zM(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=Gr(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=Gr(e[y],f,n),o=Math.min(o,d),o===0)return o}else d=FM(e,u,i,h,n),o=Math.min(o,d)}else{let d=Zh(u,t),f=Zh(h,r);is(s,o,n,e,i,d[0],f[0]),is(s,o,n,e,i,d[0],f[1]),is(s,o,n,e,i,d[1],f[0]),is(s,o,n,e,i,d[1],f[1])}}return o}function VM(e,t){let i=e.geometry(),r=i.flat().map(o=>Zc([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Jc(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,$s(r,!1,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,$s(r,!1,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,qs(r,!1,o.coordinates,n,a));break}if(a===0)return a}return a}function jM(e,t){let i=e.geometry(),r=i.flat().map(o=>Zc([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Jc(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,$s(r,!0,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,$s(r,!0,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,qs(r,!0,o.coordinates,n,a));break}if(a===0)return a}return a}function UM(e,t){let i=e.geometry();if(i.length===0||i[0].length===0)return NaN;let r=Kc(i,0).map(o=>o.map(s=>s.map(l=>Zc([l.x,l.y],e.canonical)))),n=new Jc(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,qs([o.coordinates],!1,s,n,a));break;case"LineString":a=Math.min(a,qs(o.coordinates,!0,s,n,a));break;case"Polygon":a=Math.min(a,NM(s,o.coordinates,n,a));break}if(a===0)return a}return a}function lh(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 tp=class Fs{constructor(t,i){this.type=$,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 ${t.length-1} instead.`);if(Ga(t[1])){let r=t[1];if(r.type==="FeatureCollection")return new Fs(r,r.features.map(n=>lh(n.geometry)).flat());if(r.type==="Feature")return new Fs(r,lh(r.geometry));if("type"in r&&"coordinates"in r)return new Fs(r,lh(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 VM(t,this.geometries);if(t.geometryType()==="LineString")return jM(t,this.geometries);if(t.geometryType()==="Polygon")return UM(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},ip=class $_{constructor(t){this.type=ue,this.key=t}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${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 ${typeof t[1]} instead.`):new $_(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:La(r,this.key)}eachChild(){}outputDefined(){return!1}},zn={"==":lM,"!=":uM,">":cM,"<":hM,">=":dM,"<=":pM,array:qi,at:jC,boolean:qi,case:qC,coalesce:A_,collator:L_,format:F_,image:mM,in:UC,"index-of":GC,interpolate:pi,"interpolate-hcl":pi,"interpolate-lab":pi,length:yM,let:b_,literal:Xa,match:XC,number:qi,"number-format":fM,object:qi,slice:$C,step:Yc,string:qi,"to-boolean":Dn,"to-color":Dn,"to-number":Dn,"to-string":Dn,var:P_,within:Hc,distance:tp,"global-state":ip},rn=class Ia{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=Ia.definitions[r];if(!n)return i.error(`Unknown expression "${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 x_(i.registry,Ys,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 ${u.length} arguments, but found ${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 Ia(r,a,h,c)}}if(s.length===1)i.errors.push(...l.errors);else{let u=(s.length?s:o).map(([c])=>XM(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(qe(p.type))}i.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(t,i){Ia.definitions=i;for(let r in i)t[r]=Ia}};function tm(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=f_(t,i,r,a);if(o)throw new Ze(o);return new J(t/255,i/255,r/255,a,!1)}function im(e,t){return e in t}function uh(e,t){let i=t[e];return typeof i>"u"?null:i}function GM(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 Vr(e){return{type:e}}rn.register(zn,{error:[CC,[fe],(e,[t])=>{throw new Ze(t.evaluate(e))}],typeof:[fe,[ue],(e,[t])=>qe(ot(t.evaluate(e)))],"to-rgba":[Nt($,4),[ci],(e,[t])=>{let[i,r,n,a]=t.evaluate(e).rgb;return[i*255,r*255,n*255,a]}],rgb:[ci,[$,$,$],tm],rgba:[ci,[$,$,$,$],tm],has:{type:ce,overloads:[[[fe],(e,[t])=>im(t.evaluate(e),e.properties())],[[fe,qr],(e,[t,i])=>im(t.evaluate(e),i.evaluate(e))]]},get:{type:ue,overloads:[[[fe],(e,[t])=>uh(t.evaluate(e),e.properties())],[[fe,qr],(e,[t,i])=>uh(t.evaluate(e),i.evaluate(e))]]},"feature-state":[ue,[fe],(e,[t])=>uh(t.evaluate(e),e.featureState||{})],properties:[qr,[],e=>e.properties()],"geometry-type":[fe,[],e=>e.geometryType()],id:[ue,[],e=>e.id()],zoom:[$,[],e=>e.globals.zoom],"heatmap-density":[$,[],e=>e.globals.heatmapDensity||0],elevation:[$,[],e=>e.globals.elevation||0],"line-progress":[$,[],e=>e.globals.lineProgress||0],accumulated:[ue,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[$,Vr($),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[$,Vr($),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:$,overloads:[[[$,$],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[$],(e,[t])=>-t.evaluate(e)]]},"/":[$,[$,$],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[$,[$,$],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[$,[],()=>Math.LN2],pi:[$,[],()=>Math.PI],e:[$,[],()=>Math.E],"^":[$,[$,$],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[$,[$],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[$,[$],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[$,[$],(e,[t])=>Math.log(t.evaluate(e))],log2:[$,[$],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[$,[$],(e,[t])=>Math.sin(t.evaluate(e))],cos:[$,[$],(e,[t])=>Math.cos(t.evaluate(e))],tan:[$,[$],(e,[t])=>Math.tan(t.evaluate(e))],asin:[$,[$],(e,[t])=>Math.asin(t.evaluate(e))],acos:[$,[$],(e,[t])=>Math.acos(t.evaluate(e))],atan:[$,[$],(e,[t])=>Math.atan(t.evaluate(e))],min:[$,Vr($),(e,t)=>Math.min(...t.map(i=>i.evaluate(e)))],max:[$,Vr($),(e,t)=>Math.max(...t.map(i=>i.evaluate(e)))],abs:[$,[$],(e,[t])=>Math.abs(t.evaluate(e))],round:[$,[$],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[$,[$],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[$,[$],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ce,[fe,ue],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ce,[ue],(e,[t])=>e.id()===t.value],"filter-type-==":[ce,[fe],(e,[t])=>e.geometryType()===t.value],"filter-<":[ce,[fe,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[ce,[fe,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[ce,[fe,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[ce,[fe,ue],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[ce,[ue],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[ce,[ue],(e,[t])=>t.value in e.properties()],"filter-has-id":[ce,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[ce,[Nt(fe)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ce,[Nt(ue)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ce,[fe,Nt(ue)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ce,[fe,Nt(ue)],(e,[t,i])=>GM(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ce,overloads:[[[ce,ce],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Vr(ce),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ce,overloads:[[[ce,ce],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Vr(ce),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ce,[ce],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ce,[fe],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return i?i(t.evaluate(e)):!0}],upcase:[fe,[fe],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[fe,[fe],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[fe,Vr(ue),(e,t)=>t.map(i=>Ra(i.evaluate(e))).join("")],"resolved-locale":[fe,[dl],(e,[t])=>t.evaluate(e).resolvedLocale()]});function XM(e){return Array.isArray(e)?`(${e.map(qe).join(", ")})`:`(${qe(e.type)}...)`}function Ys(e){if(e instanceof P_)return Ys(e.boundExpression);if(e instanceof rn&&e.name==="error"||e instanceof L_||e instanceof Hc||e instanceof tp||e instanceof ip)return!1;let t=e instanceof Dn||e instanceof qi,i=!0;return e.eachChild(r=>{t?i=i&&Ys(r):i=i&&r instanceof Xa}),i?xl(e)&&vl(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function xl(e){if(e instanceof rn&&(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 Hc||e instanceof tp)return!1;let t=!0;return e.eachChild(i=>{t&&!xl(i)&&(t=!1)}),t}function $a(e){if(e instanceof rn&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(i=>{t&&!$a(i)&&(t=!1)}),t}function vl(e,t){if(e instanceof rn&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(r=>{i&&!vl(r,t)&&(i=!1)}),i}function Kh(e){return{result:"success",value:e}}function Mn(e){return{result:"error",value:e}}function Gn(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function Y_(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function rp(e){return!!e.expression&&e.expression.interpolated}function me(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function bl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&ot(e)===qr}function qM(e){return e}function $M(e){switch(e.type){case"color":return J.parse;case"padding":return Bi.parse;case"numberArray":return Ni.parse;case"colorArray":return ei.parse;default:return null}}function YM(e){switch(e){case"exponential":return W_;case"interval":return WM;case"categorical":return ZM;case"identity":return HM;default:throw new Error(`Unknown function type "${e}"`)}}function Z_(e,t){let i=e.stops&&typeof e.stops[0][0]=="object",r=i||e.property!==void 0,n=i||!r,a=e.type||(rp(t)?"exponential":"interval"),o=$M(t);if(o&&(e=jn({},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&&!OC(e.colorSpace))throw new Error(`Unknown color space: "${e.colorSpace}"`);let s=YM(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,Z_(h[f],t)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:pi.interpolationFactor.bind(void 0,d),zoomStops:p.map(f=>f[0]),evaluate({zoom:f},y){return W_({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:pi.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?ho(e.default,t.default):s(e,t,p,l,u)}}}function ho(e,t,i){if(e!==void 0)return e;if(t!==void 0)return t;if(i!==void 0)return i}function ZM(e,t,i,r,n){let a=typeof i===n?r[i]:void 0;return ho(a,e.default,t.default)}function WM(e,t,i){if(me(i)!=="number")return ho(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=gl(e.stops.map(a=>a[0]),i);return e.stops[n][1]}function W_(e,t,i){let r=e.base!==void 0?e.base:1;if(me(i)!=="number")return ho(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=gl(e.stops.map(h=>h[0]),i),o=KM(i,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=$e[t.type]||qM;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 HM(e,t,i){switch(t.type){case"color":i=J.parse(i);break;case"formatted":i=Ki.fromString(i.toString());break;case"resolvedImage":i=Fi.fromString(i.toString());break;case"padding":i=Bi.parse(i);break;case"colorArray":i=ei.parse(i);break;case"numberArray":i=Ni.parse(i);break;default:me(i)!==t.type&&(t.type!=="enum"||!t.values[i])&&(i=void 0)}return ho(i,e.default,t.default)}function KM(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 np=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new __,this._defaultValue=t?tI(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 Ze(`Expected value to be one of ${Object.keys(this._enumValues).map(s=>JSON.stringify(s)).join(", ")}, but found ${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 wl(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in zn}function ap(e,t){let i=new x_(zn,Ys,[],t?eI(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return r?Kh(new np(r,t)):Mn(i.errors)}var Ya=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!$a(t.expression),this.globalStateRefs=Pl(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)}},Zs=class{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!$a(t.expression),this.globalStateRefs=Pl(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?pi.interpolationFactor(this.interpolationType,e,t,i):0}};function JM(e){return e._styleExpression!==void 0}function H_(e,t){let i=ap(e,t);if(i.result==="error")return i;let r=i.value.expression,n=xl(r);if(!n&&!Gn(t))return Mn([new Mi("","data expressions not supported")]);let a=vl(r,["zoom"]);if(!a&&!Y_(t))return Mn([new Mi("","zoom expressions not supported")]);let o=Os(r);if(!o&&!a)return Mn([new Mi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof Mi)return Mn([o]);if(o instanceof pi&&!rp(t))return Mn([new Mi("",'"interpolate" expressions cannot be used with this property')]);if(!o)return Kh(n?new Ya("constant",i.value):new Ya("source",i.value));let s=o instanceof pi?o.interpolation:void 0;return Kh(n?new Zs("camera",i.value,o.labels,s):new Zs("composite",i.value,o.labels,s))}var K_=class J_{constructor(t,i){this._parameters=t,this._specification=i,jn(this,Z_(this._parameters,this._specification))}static deserialize(t){return new J_(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}};function QM(e,t){if(bl(e))return new K_(e,t);if(wl(e)){let i=H_(e,t);if(i.result==="error")throw new Error(i.value.map(r=>`${r.key}: ${r.message}`).join(", "));return i.value}else{let i=e;return t.type==="color"&&typeof e=="string"?i=J.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?i=Bi.parse(e):t.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?i=Ni.parse(e):t.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?i=ei.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?i=Mr.parse(e):t.type==="projectionDefinition"&&typeof e=="string"&&(i=tn.parse(e)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>i}}}function Os(e){let t=null;if(e instanceof b_)t=Os(e.result);else if(e instanceof A_){for(let i of e.args)if(t=Os(i),t)break}else(e instanceof Yc||e instanceof pi)&&e.input instanceof rn&&e.input.name==="zoom"&&(t=e);return t instanceof Mi||e.eachChild(i=>{let r=Os(i);r instanceof Mi?t=r:!t&&r?t=new Mi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Mi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Pl(e,t=new Set){return e instanceof ip&&t.add(e.key),e.eachChild(i=>{Pl(i,t)}),t}function eI(e){let t={color:ci,string:fe,number:$,enum:fe,boolean:ce,formatted:so,padding:fl,numberArray:ml,colorArray:ja,projectionDefinition:pl,resolvedImage:lo,variableAnchorOffsetCollection:yl};return e.type==="array"?Nt(t[e.value]||ue,e.length):t[e.type]}function tI(e){if(e.type==="color"&&bl(e.default))return new J(0,0,0,0);switch(e.type){case"color":return J.parse(e.default)||null;case"padding":return Bi.parse(e.default)||null;case"numberArray":return Ni.parse(e.default)||null;case"colorArray":return ei.parse(e.default)||null;case"variableAnchorOffsetCollection":return Mr.parse(e.default)||null;case"projectionDefinition":return tn.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function op(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(!op(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}var iI={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Za(e){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};op(e)||(e=Ws(e));let t=ap(e,iI);if(t.result==="error")throw new Error(t.value.map(i=>`${i.key}: ${i.message}`).join(", "));{let i=Q_(e);return{filter:(r,n,a)=>t.value.evaluate(r,n,{},a),needGeometry:i,getGlobalStateRefs:()=>Pl(t.value.expression)}}}function rI(e,t){return e<t?-1:e>t?1:0}function Q_(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(Q_(e[t]))return!0;return!1}function Ws(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?hh(e[1],e[2],"=="):t==="!="?rs(hh(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?hh(e[1],e[2],t):t==="any"?nI(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Ws)):t==="none"?["all"].concat(e.slice(1).map(Ws).map(rs)):t==="in"?rm(e[1],e.slice(2)):t==="!in"?rs(rm(e[1],e.slice(2))):t==="has"?nm(e[1]):t==="!has"?rs(nm(e[1])):!0}function hh(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function nI(e){return["any"].concat(e.map(Ws))}function rm(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(rI)]]:["filter-in-small",e,["literal",t]]}}function nm(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function rs(e){return["!",e]}function aI(){let e={},t=z.$version;for(let i in z.$root){let r=z.$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 ex(e){let t=e.key,i=e.value;return i?[new G(t,i,"constants have been deprecated as of v8")]:[]}function Qe(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Zr(e){if(Array.isArray(e))return e.map(Zr);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=Zr(e[i]);return t}return Qe(e)}function Qt(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=me(i);if(u!=="object")return[new G(t,i,`object expected, ${u} found`)];for(let h in i){let c=h.split(".")[0],p=La(r,c)||r["*"],d;if(La(n,c))d=n[c];else if(La(r,c))d=s;else if(n["*"])d=n["*"];else if(r["*"])d=s;else{l.push(new G(t,i[h],`unknown property "${h}"`));continue}l=l.concat(d({key:(t&&`${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 G(t,i,`missing required property "${h}"`));return l}function sp(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(me(t)!=="array")return[new G(o,t,`array expected, ${me(t)} found`)];if(i.length&&t.length!==i.length)return[new G(o,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new G(o,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let l={type:i.value,values:i.values};a.$version<7&&(l.function=i.function),me(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:`${o}[${h}]`}));return u}function Tl(e){let t=e.key,i=e.value,r=e.valueSpec,n=me(i);return n==="number"&&i!==i&&(n="NaN"),n!=="number"?[new G(t,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new G(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new G(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function tx(e){let t=e.valueSpec,i=Qe(e.value.type),r,n={},a,o,s=i!=="categorical"&&e.value.property===void 0,l=!s,u=me(e.value.stops)==="array"&&me(e.value.stops[0])==="array"&&me(e.value.stops[0][0])==="object",h=Qt({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 G(e.key,e.value,'missing required property "property"')),i!=="identity"&&!e.value.stops&&h.push(new G(e.key,e.value,'missing required property "stops"')),i==="exponential"&&e.valueSpec.expression&&!rp(e.valueSpec)&&h.push(new G(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Gn(e.valueSpec)?h.push(new G(e.key,e.value,"property functions not supported")):s&&!Y_(e.valueSpec)&&h.push(new G(e.key,e.value,"zoom functions not supported"))),(i==="categorical"||u)&&e.value.property===void 0&&h.push(new G(e.key,e.value,'"property" property is required')),h;function c(y){if(i==="identity")return[new G(y.key,y.value,'identity function may not have a "stops" property')];let g=[],_=y.value;return g=g.concat(sp({key:y.key,value:_,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),me(_)==="array"&&_.length===0&&g.push(new G(y.key,_,"array must have at least one stop")),g}function p(y){let g=[],_=y.value,b=y.key;if(me(_)!=="array")return[new G(b,_,`array expected, ${me(_)} found`)];if(_.length!==2)return[new G(b,_,`array length 2 expected, length ${_.length} found`)];if(u){if(me(_[0])!=="object")return[new G(b,_,`object expected, ${me(_[0])} found`)];if(_[0].zoom===void 0)return[new G(b,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new G(b,_,"object stop key must have value")];if(o&&o>Qe(_[0].zoom))return[new G(b,_[0].zoom,"stop zoom values must appear in ascending order")];Qe(_[0].zoom)!==o&&(o=Qe(_[0].zoom),a=void 0,n={}),g=g.concat(Qt({key:`${b}[0]`,value:_[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Tl,value:d}}))}else g=g.concat(d({key:`${b}[0]`,value:_[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},_));return wl(Zr(_[1]))?g.concat([new G(`${b}[1]`,_[1],"expressions are not allowed in function stops.")]):g.concat(y.validateSpec({key:`${b}[1]`,value:_[1],valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function d(y,g){let _=me(y.value),b=Qe(y.value),v=y.value!==null?y.value:g;if(!r)r=_;else if(_!==r)return[new G(y.key,v,`${_} stop domain type must match previous stop domain type ${r}`)];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new G(y.key,v,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&i!=="categorical"){let w=`number expected, ${_} found`;return Gn(t)&&i===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new G(y.key,v,w)]}return i==="categorical"&&_==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new G(y.key,v,`integer expected, found ${b}`)]:i!=="categorical"&&_==="number"&&a!==void 0&&b<a?[new G(y.key,v,"stop domain values must appear in ascending order")]:(a=b,i==="categorical"&&b in n?[new G(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 Xn(e){let t=(e.expressionContext==="property"?H_:ap)(Zr(e.value),e.valueSpec);if(t.result==="error")return t.value.map(r=>new G(`${e.key}${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 G(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!$a(i))return[new G(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!$a(i))return[new G(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!vl(i,["zoom","feature-state"]))return[new G(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!xl(i))return[new G(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function oI(e){let t=e.value,i=e.key,r=me(t);return r!=="boolean"?[new G(i,t,`boolean expected, ${r} found`)]:[]}function Jh(e){let t=e.key,i=e.value,r=me(i);return r!=="string"?[new G(t,i,`color expected, ${r} found`)]:J.parse(String(i))?[]:[new G(t,i,`color expected, "${i}" found`)]}function Wa(e){let t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?r.values.indexOf(Qe(i))===-1&&n.push(new G(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(Qe(i))===-1&&n.push(new G(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function lp(e){return op(Zr(e.value))?Xn(jn({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ix(e)}function ix(e){let t=e.value,i=e.key;if(me(t)!=="array")return[new G(i,t,`array expected, ${me(t)} found`)];let r=e.styleSpec,n,a=[];if(t.length<1)return[new G(i,t,"filter array must have at least 1 element")];switch(a=a.concat(Wa({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),Qe(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Qe(t[1])==="$type"&&a.push(new G(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&a.push(new G(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=me(t[1]),n!=="string"&&a.push(new G(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let o=2;o<t.length;o++)n=me(t[o]),Qe(t[1])==="$type"?a=a.concat(Wa({key:`${i}[${o}]`,value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&a.push(new G(`${i}[${o}]`,t[o],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let o=1;o<t.length;o++)a=a.concat(ix({key:`${i}[${o}]`,value:t[o],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=me(t[1]),t.length!==2?a.push(new G(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):n!=="string"&&a.push(new G(`${i}[1]`,t[1],`string expected, ${n} found`));break}return a}function rx(e,t){let i=e.key,r=e.validateSpec,n=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,l=a[`${t}_${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 G(i,o,`unknown property "${s}"`)];let c;if(me(o)==="string"&&Gn(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new G(i,o,`"${s}" does not support interpolation syntax
3
3
  Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];let p=[];return e.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&p.push(new G(i,o,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&bl(Zr(o))&&Qe(o.type)==="identity"&&p.push(new G(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 nx(e){return rx(e,"paint")}function ax(e){return rx(e,"layout")}function ox(e){let t=[],i=e.value,r=e.key,n=e.style,a=e.styleSpec;if(me(i)!=="object")return[new G(r,i,`object expected, ${me(i)} found`)];!i.type&&!i.ref&&t.push(new G(r,i,'either "type" or "ref" is required'));let o=Qe(i.type),s=Qe(i.ref);if(i.id){let l=Qe(i.id);for(let u=0;u<e.arrayIndex;u++){let h=n.layers[u];Qe(h.id)===l&&t.push(new G(r,i.id,`duplicate layer id "${i.id}", previously used at line ${h.id.__line__}`))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach(u=>{u in i&&t.push(new G(r,i[u],`"${u}" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{Qe(u.id)===s&&(l=u)}),l?l.ref?t.push(new G(r,i.ref,"ref cannot reference another ref layer")):o=Qe(l.type):t.push(new G(r,i.ref,`ref layer "${s}" not found`))}else if(o!=="background")if(!i.source)t.push(new G(r,i,'missing required property "source"'));else{let l=n.sources&&n.sources[i.source],u=l&&Qe(l.type);l?u==="vector"&&o==="raster"?t.push(new G(r,i.source,`layer "${i.id}" requires a raster source`)):u!=="raster-dem"&&o==="hillshade"?t.push(new G(r,i.source,`layer "${i.id}" requires a raster-dem source`)):u!=="raster-dem"&&o==="color-relief"?t.push(new G(r,i.source,`layer "${i.id}" requires a raster-dem source`)):u==="raster"&&o!=="raster"?t.push(new G(r,i.source,`layer "${i.id}" requires a vector source`)):u==="vector"&&!i["source-layer"]?t.push(new G(r,i,`layer "${i.id}" must specify a "source-layer"`)):u==="raster-dem"&&o!=="hillshade"&&o!=="color-relief"?t.push(new G(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 G(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new G(r,i.source,`source "${i.source}" not found`))}return t=t.concat(Qt({key:r,value:i,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"})},filter:lp,layout(l){return Qt({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return ax(jn({layerType:o},u))}}})},paint(l){return Qt({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return nx(jn({layerType:o},u))}}})}}})),t}function Wr(e){let t=e.value,i=e.key,r=me(t);return r!=="string"?[new G(i,t,`string expected, ${r} found`)]:[]}function sI(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=me(r);if(r===void 0)return s;if(l!=="object")return s.push(new G("source_raster_dem",r,`object expected, ${l} found`)),s;let u=Qe(r.encoding)==="custom",h=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let p in r)!u&&h.includes(p)?s.push(new G(p,r[p],`In "${i}": "${p}" is only valid when "encoding" is set to "custom". ${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 G(p,r[p],`unknown property "${p}"`));return s}var am={promoteId:lI};function sx(e){let t=e.value,i=e.key,r=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new G(i,t,'"type" is required')];let o=Qe(t.type),s;switch(o){case"vector":case"raster":return s=Qt({key:i,value:t,valueSpec:r[`source_${o.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:am,validateSpec:a}),s;case"raster-dem":return s=sI({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case"geojson":if(s=Qt({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:a,objectElementValidators:am}),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(...Xn({key:`${i}.${l}.map`,value:h,expressionContext:"cluster-map"})),s.push(...Xn({key:`${i}.${l}.reduce`,value:c,expressionContext:"cluster-reduce"}))}return s;case"video":return Qt({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:a,styleSpec:r});case"image":return Qt({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:a,styleSpec:r});case"canvas":return[new G(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Wa({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function lI({key:e,value:t}){if(me(t)==="string")return Wr({key:e,value:t});{let i=[];for(let r in t)i.push(...Wr({key:`${e}.${r}`,value:t[r]}));return i}}function lx(e){let t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],o=me(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new G("light",t,`object expected, ${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 G(s,t[s],`unknown property "${s}"`)])}return a}function ux(e){let t=e.value,i=e.styleSpec,r=i.sky,n=e.style,a=me(t);if(t===void 0)return[];if(a!=="object")return[new G("sky",t,`object expected, ${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 G(s,t[s],`unknown property "${s}"`)]);return o}function hx(e){let t=e.value,i=e.styleSpec,r=i.terrain,n=e.style,a=[],o=me(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new G("terrain",t,`object expected, ${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 G(s,t[s],`unknown property "${s}"`)]);return a}function uI(e){return Wr(e).length===0?[]:Xn(e)}function hI(e){return Wr(e).length===0?[]:Xn(e)}function cI(e){let t=e.key,i=e.value;if(me(i)==="array"){if(i.length<1||i.length>4)return[new G(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},n=[];for(let a=0;a<i.length;a++)n=n.concat(e.validateSpec({key:`${t}[${a}]`,value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return Tl({key:t,value:i,valueSpec:{}})}function pI(e){let t=e.key,i=e.value;if(me(i)==="array"){let r={type:"number"};if(i.length<1)return[new G(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:`${t}[${a}]`,value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return Tl({key:t,value:i,valueSpec:{}})}function dI(e){let t=e.key,i=e.value;if(me(i)==="array"){if(i.length<1)return[new G(t,i,"array length at least 1 expected, length 0 found")];let r=[];for(let n=0;n<i.length;n++)r=r.concat(Jh({key:`${t}[${n}]`,value:i[n]}));return r}else return Jh({key:t,value:i})}function fI(e){let t=e.key,i=e.value,r=me(i),n=e.styleSpec;if(r!=="array"||i.length<1||i.length%2!==0)return[new G(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(Wa({key:`${t}[${o}]`,value:i[o],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(sp({key:`${t}[${o+1}]`,value:i[o+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a}function cx(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 G(r,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),n.push(i[o].id),i[o].url&&a.includes(i[o].url)&&t.push(new G(r,i,`all the sprites' URLs must be unique, but ${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(Qt({key:`${r}[${o}]`,value:i[o],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return Wr({key:r,value:i})}function mI(e){let t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=me(t);if(t===void 0)return[];if(a!=="object")return[new G("projection",t,`object expected, ${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 G(s,t[s],`unknown property "${s}"`)]);return o}function yI(e){let t=e.key,i=e.value;i=i instanceof String?i.valueOf():i;let r=me(i);return r==="array"&&!_I(i)&&!gI(i)?[new G(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]:["array","string"].includes(r)?[]:[new G(t,i,`projection expected, invalid type "${r}" found`)]}function gI(e){return!!["interpolate","step","literal"].includes(e[0])}function _I(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function xI(e){return!!e&&e.constructor===Object}function px(e){return xI(e.value)?[]:[new G(e.key,e.value,`object expected, ${me(e.value)} found`)]}var om={"*"(){return[]},array:sp,boolean:oI,number:Tl,color:Jh,constants:ex,enum:Wa,filter:lp,function:tx,layer:ox,object:Qt,source:sx,light:lx,sky:ux,terrain:hx,projection:mI,projectionDefinition:yI,string:Wr,formatted:uI,resolvedImage:hI,padding:cI,numberArray:pI,colorArray:dI,variableAnchorOffsetCollection:fI,sprite:cx,state:px};function Hs(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=Hs,i.expression&&bl(Qe(t))?tx(e):i.expression&&wl(Zr(t))?Xn(e):i.type&&om[i.type]?om[i.type](e):Qt(jn({},e,{valueSpec:i.type?r[i.type]:i}))}function dx(e){let t=e.value,i=e.key,r=Wr(e);return r.length||(t.indexOf("{fontstack}")===-1&&r.push(new G(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&r.push(new G(i,t,'"glyphs" url must include a "{range}" token'))),r}function ti(e,t=z){let i=[];return i=i.concat(Hs({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Hs,objectElementValidators:{glyphs:dx,"*"(){return[]}}})),e.constants&&(i=i.concat(ex({key:"constants",value:e.constants}))),fx(i)}ti.source=mi(fi(sx));ti.sprite=mi(fi(cx));ti.glyphs=mi(fi(dx));ti.light=mi(fi(lx));ti.sky=mi(fi(ux));ti.terrain=mi(fi(hx));ti.state=mi(fi(px));ti.layer=mi(fi(ox));ti.filter=mi(fi(lp));ti.paintProperty=mi(fi(nx));ti.layoutProperty=mi(fi(ax));function fi(e){return function(t){return e({...t,validateSpec:Hs})}}function fx(e){return[].concat(e).sort((t,i)=>t.line-i.line)}function mi(e){return function(...t){return fx(e.apply(this,t))}}var nt=ti,LV=nt.source,vI=nt.light,bI=nt.sky,RV=nt.terrain,zV=nt.filter,wI=nt.paintProperty,PI=nt.layoutProperty;function Sl(e,t){let i=!1;if(t&&t.length)for(let r of t)e.fire(new ee(new Error(r.message))),i=!0;return i}var Qh=class mx{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 mx(t.buffer)}},$i={};function Z(e,t,i={}){if($i[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),$i[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}Z("Object",Object);Z("Set",Set);Z("TransferableGridIndex",Qh);Z("Color",J);Z("Error",Error);Z("AJAXError",Gs);Z("ResolvedImage",Fi);Z("StylePropertyFunction",K_);Z("StyleExpression",np,{omit:["_evaluator"]});Z("ZoomDependentExpression",Zs);Z("ZoomConstantExpression",Ya);Z("CompoundExpression",rn,{omit:["_evaluate"]});for(let e in zn)zn[e]._classRegistryKey||Z(`Expression_${e}`,zn[e]);function yx(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function up(e){let t=e.constructor;return e.$name||t._classRegistryKey}function TI(e){if(e===null||typeof e!="object")return!1;let t=up(e);return!!(t&&t!=="Object")}function gx(e){return!TI(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||yx(e)||Wi(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function za(e,t){if(gx(e)){if((yx(e)||Wi(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(za(o,t));return a}if(typeof e!="object")throw new Error(`can't serialize object of type ${typeof e}`);let i=up(e);if(!i)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!$i[i])throw new Error(`${i} is not registered.`);let{klass:r}=$i[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)||$i[i].omit.indexOf(a)>=0)continue;let o=e[a];n[a]=$i[i].shallow.indexOf(a)>=0?o:za(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 Fa(e){if(gx(e))return e;if(Array.isArray(e))return e.map(Fa);if(typeof e!="object")throw new Error(`can't deserialize object of type ${typeof e}`);let t=up(e)||"Object";if(!$i[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:i}=$i[t];if(!i)throw new Error(`can't deserialize unregistered class ${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]=$i[t].shallow.indexOf(n)>=0?a:Fa(a)}return r}var ec=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)}},ut={"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 SI(e){for(let t of e)if(EI(t.charCodeAt(0)))return!0;return!1}function hp(e){let t=e.map(i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}}).filter(i=>i);return new RegExp(t.join("|"),"u")}var CI=["Arab","Dupl","Mong","Ougr","Syrc"],FV=hp(CI),MI=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],II=hp(MI);function EI(e){return e===746||e===747?!0:e<4352?!1:!!(ut["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||ut["CJK Compatibility"](e)||ut["CJK Strokes"](e)||ut["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||ut["Enclosed CJK Letters and Months"](e)||ut["Ideographic Description Characters"](e)||ut.Kanbun(e)||ut.Katakana(e)&&e!==12540||ut["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)||ut["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||ut["Vertical Forms"](e)||ut["Yijing Hexagram Symbols"](e)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(e))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(e))||II.test(String.fromCodePoint(e)))}var AI=["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"],kI=hp(AI);function _x(e){return kI.test(String.fromCodePoint(e))}function DI(e,t){return!(!t&&_x(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||ut.Khmer(e))}function LI(e){for(let t of e)if(_x(t.charCodeAt(0)))return!0;return!1}function RI(e,t){for(let i of e)if(!DI(i.charCodeAt(0),t))return!1;return!0}var zI=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(qn.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 ${i}`)}},qn=new zI,tt=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new ec,this.transition=t.transition||{},this.globalState=t.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ec,this.transition={},this.globalState={})}isSupportedScript(e){return RI(e,qn.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}}},Cl=class{constructor(e,t){this.property=e,this.value=t,this.expression=QM(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)}},tc=class{constructor(e){this.property=e,this.value=new Cl(e,void 0)}transitioned(e,t){return new sm(this.property,this.value,t,W({},e.transition,this.transition),e.now)}untransitioned(){return new sm(this.property,this.value,null,{},0)}},Ml=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return kt(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new tc(this._values[e].property)),this._values[e].value=new Cl(this._values[e].property,t===null?void 0:kt(t))}getTransition(e){return kt(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new tc(this._values[e].property)),this._values[e].transition=kt(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[`${t}-transition`]=r)}return e}transitioned(e,t){let i=new lm(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 lm(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},sm=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,qg(o))}}else return n}},lm=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new Il(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}},FI=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return kt(this._values[e].value)}setValue(e,t){this._values[e]=new Cl(this._values[e].property,t===null?void 0:kt(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 Il(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}},hi=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)}},Il=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},Y=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=$e[r];return n?n(e,t,i):e}},Q=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 hi(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)},t):new hi(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 hi(this,{kind:"constant",value:void 0},e.parameters);let r=this.specification.type,n=$e[r];if(n){let a=n(e.value.value,t.value.value,i);return new hi(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)}},El=class extends Q{possiblyEvaluate(e,t,i,r){if(e.value===void 0)return new hi(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 hi(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 hi(this,{kind:"constant",value:n},t)}else return new hi(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}},cp=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 tt(Math.floor(t.zoom-1),t)),e.expression.evaluate(new tt(Math.floor(t.zoom),t)),e.expression.evaluate(new tt(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}},Al=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}},ft=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 Cl(i,void 0),n=this.defaultTransitionablePropertyValues[t]=new tc(i);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}};Z("DataDrivenProperty",Q);Z("DataConstantProperty",Y);Z("CrossFadedDataDrivenProperty",El);Z("CrossFadedProperty",cp);Z("ColorRampProperty",Al);var ns="-transition",yi=class extends Dt{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=Za(e.filter)),t.layout&&(this._unevaluatedLayout=new FI(t.layout)),t.paint)){this._transitionablePaint=new Ml(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 Il(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=Za(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.${this.id}.layout.${e}`;if(this._validate(PI,r,e,t,i))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(ns)?this._transitionablePaint.getTransition(e.slice(0,-ns.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(t!=null){let r=`layers.${this.id}.paint.${e}`;if(this._validate(wI,r,e,t,i))return!1}if(e.endsWith(ns))return this._transitionablePaint.setTransition(e.slice(0,-ns.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),Yg(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:Sl(this,e.call(nt,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:z,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 hi)||!Gn(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}},OI={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},co=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}},BI=128,NI=5,He=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*NI),BI),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 Ke(e,t=1){let i=0,r=0,n=e.map(o=>{let s=VI(o.type),l=i=um(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=um(i,Math.max(r,t));return{members:n,size:a,alignment:t}}function VI(e){return OI[e].BYTES_PER_ELEMENT}function um(e,t){return Math.ceil(e/t)*t}var jI=ne(se(),1),po=class extends He{_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}};po.prototype.bytesPerElement=4;Z("StructArrayLayout2i4",po);var kl=class extends He{_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}};kl.prototype.bytesPerElement=6;Z("StructArrayLayout3i6",kl);var pp=class extends He{_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}};pp.prototype.bytesPerElement=8;Z("StructArrayLayout4i8",pp);var dp=class extends He{_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}};dp.prototype.bytesPerElement=12;Z("StructArrayLayout2i4i12",dp);var fp=class extends He{_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}};fp.prototype.bytesPerElement=8;Z("StructArrayLayout2i4ub8",fp);var Ha=class extends He{_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}};Ha.prototype.bytesPerElement=8;Z("StructArrayLayout2f8",Ha);var mp=class extends He{_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}};mp.prototype.bytesPerElement=20;Z("StructArrayLayout10ui20",mp);var yp=class extends He{_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}};yp.prototype.bytesPerElement=24;Z("StructArrayLayout4i4ui4i24",yp);var gp=class extends He{_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}};gp.prototype.bytesPerElement=12;Z("StructArrayLayout3f12",gp);var _p=class extends He{_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}};_p.prototype.bytesPerElement=4;Z("StructArrayLayout1ul4",_p);var xp=class extends He{_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}};xp.prototype.bytesPerElement=20;Z("StructArrayLayout6i1ul2ui20",xp);var vp=class extends He{_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}};vp.prototype.bytesPerElement=12;Z("StructArrayLayout2i2i2i12",vp);var bp=class extends He{_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}};bp.prototype.bytesPerElement=16;Z("StructArrayLayout2f1f2i16",bp);var wp=class extends He{_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}};wp.prototype.bytesPerElement=16;Z("StructArrayLayout2ub2f2i16",wp);var Dl=class extends He{_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}};Dl.prototype.bytesPerElement=6;Z("StructArrayLayout3ui6",Dl);var Pp=class extends He{_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}};Pp.prototype.bytesPerElement=48;Z("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Pp);var Tp=class extends He{_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,P,T,I,E,R,k,L){let A=this.length;return this.resize(A+1),this.emplace(A,e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,T,I,E,R,k,L)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,T,I,E,R,k,L,A){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]=P,this.uint16[D+21]=T,this.uint16[D+22]=I,this.uint32[x+12]=E,this.float32[x+13]=R,this.float32[x+14]=k,this.uint16[D+30]=L,this.uint16[D+31]=A,e}};Tp.prototype.bytesPerElement=64;Z("StructArrayLayout8i15ui1ul2f2ui64",Tp);var Ll=class extends He{_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}};Ll.prototype.bytesPerElement=4;Z("StructArrayLayout1f4",Ll);var Sp=class extends He{_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}};Sp.prototype.bytesPerElement=12;Z("StructArrayLayout1ui2f12",Sp);var Cp=class extends He{_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}};Cp.prototype.bytesPerElement=8;Z("StructArrayLayout1ul2ui8",Cp);var Mp=class extends He{_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}};Mp.prototype.bytesPerElement=4;Z("StructArrayLayout2ui4",Mp);var Ip=class extends He{_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}};Ip.prototype.bytesPerElement=2;Z("StructArrayLayout1ui2",Ip);var Ep=class extends He{_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}};Ep.prototype.bytesPerElement=16;Z("StructArrayLayout4f16",Ep);var xx=class extends co{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 jI.default(this.anchorPointX,this.anchorPointY)}};xx.prototype.size=20;var vx=class extends xp{get(e){return new xx(this,e)}};Z("CollisionBoxArray",vx);var bx=class extends co{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]}};bx.prototype.size=48;var wx=class extends Pp{get(e){return new bx(this,e)}};Z("PlacedSymbolArray",wx);var Px=class extends co{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]}};Px.prototype.size=64;var Tx=class extends Tp{get(e){return new Px(this,e)}};Z("SymbolInstanceArray",Tx);var Sx=class extends Ll{getoffsetX(e){return this.float32[e*1+0]}};Z("GlyphOffsetArray",Sx);var Cx=class extends kl{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};Z("SymbolLineVertexArray",Cx);var Mx=class extends co{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]}};Mx.prototype.size=12;var Ix=class extends Sp{get(e){return new Mx(this,e)}};Z("TextAnchorOffsetArray",Ix);var Ex=class extends co{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]}};Ex.prototype.size=8;var Ax=class extends Cp{get(e){return new Ex(this,e)}};Z("FeatureIndexArray",Ax);var Yi=class extends po{},UI=class extends kl{},GI=class extends pp{},XI=class extends po{},qI=class extends po{},$I=class extends dp{},YI=class extends fp{},ZI=class extends Ha{},vn=class extends mp{},WI=class extends yp{},HI=class extends gp{},KI=class extends _p{},hm=class extends vp{},JI=class extends bp{},QI=class extends wp{},eE=class extends Dl{},gi=class extends Dl{},ic=class extends Mp{},tE=class extends Ip{},iE=Ke([{name:"a_pos",components:2,type:"Int16"}],4),{members:rE,size:OV,alignment:BV}=iE,Ve=class In{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,n){let a=this.segments[this.segments.length-1];return t>In.MAX_VERTEX_ARRAY_LENGTH&&at(`Max vertices per segment is ${In.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${In.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+t>In.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 In([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}};Ve.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;Z("SegmentVector",Ve);function cm(e,t){return e=Ce(Math.floor(e),0,255),t=Ce(Math.floor(t),0,255),256*e+t}var Ks=Ke([{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"}]),nE=ne(Oy(),1),kx=class Dx{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,n){this.ids.push(pm(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=pm(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 rc(r,n,0,r.length-1),i&&i.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){let i=new Dx;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}};function pm(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,nE.default)(String(e))}function rc(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;as(e,a,o),as(t,3*a,3*o),as(t,3*a+1,3*o+1),as(t,3*a+2,3*o+2)}o-i<r-o?(rc(e,t,i,o),i=o+1):(rc(e,t,o+1,r),r=o)}}function as(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}Z("FeaturePositionMap",kx);var Qi=class{constructor(e,t){this.gl=e.gl,this.location=t}},ae=class extends Qi{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},q=class extends Qi{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},te=class extends Qi{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]))}},Vt=class extends Qi{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]))}},Sr=class extends Qi{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]))}},Cr=class extends Qi{constructor(e,t){super(e,t),this.current=J.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))}},dm=class extends Qi{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)}}},fm=class extends Qi{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)}}},aE=new Float32Array(16),Ut=class extends Qi{constructor(e,t){super(e,t),this.current=aE}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 nc(e){return[cm(255*e.r,255*e.g),cm(255*e.b,255*e.a)]}var Ea=class{constructor(e,t,i){this.value=e,this.uniformNames=t.map(r=>`u_${r}`),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new Cr(e,t):new q(e,t)}},En=class{constructor(e,t){this.uniformNames=t.map(i=>`u_${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 Sr(e,t):new q(e,t)}},Gi=class{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(n=>({name:`a_${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 tt(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=nc(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()}},li=class{constructor(e,t,i,r,n,a){this.expression=e,this.uniformNames=t.map(o=>`u_${o}_t`),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:`a_${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 tt(this.zoom),t,{},r,[],n),o=this.expression.evaluate(new tt(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=nc(i),a=nc(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=Ce(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new q(e,t)}},fr=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,Ks.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Ks.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Lx=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 hi)||!Gn(a.property.specification))continue;let o=oE(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 En(s.value,o):new Ea(s.value,o,l),r.push(`/u_${n}`);else if(s.kind==="source"||c){let p=mm(n,l,"source");this.binders[n]=c?new fr(s,l,u,t,p,e.id):new Gi(s,o,l,p),r.push(`/a_${n}`)}else{let p=mm(n,l,"composite");this.binders[n]=new li(s,o,l,u,t,p),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Gi||t instanceof li?t.maxValue:0}populatePaintArrays(e,t,i,r,n){for(let a in this.binders){let o=this.binders[a];(o instanceof Gi||o instanceof li||o instanceof fr)&&o.populatePaintArray(e,t,i,r,n)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof En&&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 Gi||c instanceof li||c instanceof fr)&&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 Ea||i instanceof En)&&e.push(...i.uniformNames.map(r=>`#define HAS_UNIFORM_${r}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Gi||i instanceof li)for(let r=0;r<i.paintVertexAttributes.length;r++)e.push(i.paintVertexAttributes[r].name);else if(i instanceof fr)for(let r=0;r<Ks.members.length;r++)e.push(Ks.members[r].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Ea||i instanceof En||i instanceof li)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 Ea||n instanceof En||n instanceof li){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 fr){let r=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof Gi||i instanceof li)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Gi||i instanceof li||i instanceof fr)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Gi||t instanceof li||t instanceof fr)&&t.destroy()}}},Hr=class{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Lx(r,t,i);this.needsUpload=!1,this._featureMap=new kx,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 oE(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(`${t}-`,"").replace(/-/g,"_")]}function sE(e){return{"line-pattern":{source:vn,composite:vn},"fill-pattern":{source:vn,composite:vn},"fill-extrusion-pattern":{source:vn,composite:vn}}[e]}function mm(e,t,i){let r={color:{source:Ha,composite:Ep},number:{source:Ll,composite:Ha}},n=sE(e);return n&&n[i]||r[t][i]}Z("ConstantBinder",Ea);Z("CrossFadedConstantBinder",En);Z("SourceExpressionBinder",Gi);Z("CrossFadedCompositeBinder",fr);Z("CompositeExpressionBinder",li);Z("ProgramConfiguration",Lx,{omit:["_buffers"]});Z("ProgramConfigurationSet",Hr);var lE=15,ac=Math.pow(2,lE-1)-1,ym=-ac-1;function nn(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=Ce(s,ym,ac),o.y=Ce(l,ym,ac),(s<o.x||s>o.x+1||l<o.y||l>o.y+1)&&at("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function an(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?nn(e):[]}}var gm=-32768;function uE(e,t,i,r,n){e.emplaceBack(gm+t*8+r,gm+i*8+n)}var Ap=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 XI,this.indexArray=new gi,this.segments=new Ve,this.programConfigurations=new Hr(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=an(u,d);if(!this.layers[0]._featureFilter.filter(new tt(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:nn(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,rE),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: ${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++)uE(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)}};Z("CircleBucket",Ap,{omit:["layers"]});var os=ne(se(),1);function Rx(e,t){for(let i=0;i<e.length;i++)if($n(t,e[i]))return!0;for(let i=0;i<t.length;i++)if($n(e,t[i]))return!0;return!!kp(e,t)}function hE(e,t,i){return!!($n(e,t)||oc(t,e,i))}function zx(e,t){if(e.length===1)return _m(t,e[0]);for(let i=0;i<t.length;i++){let r=t[i];for(let n=0;n<r.length;n++)if($n(e,r[n]))return!0}for(let i=0;i<e.length;i++)if(_m(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(kp(e,t[i]))return!0;return!1}function cE(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($n(e,n[a]))return!0}if(pE(e,n,i))return!0}return!1}function pE(e,t,i){if(e.length>1){if(kp(e,t))return!0;for(let r=0;r<t.length;r++)if(oc(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(oc(e[r],t,i))return!0;return!1}function kp(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(dE(r,n,o,s))return!0}}return!1}function dE(e,t,i,r){return vr(e,i,r)!==vr(t,i,r)&&vr(e,t,i)!==vr(e,t,r)}function oc(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(fE(e,a,o)<r)return!0}return!1}function fE(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 _m(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 $n(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 mE(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 os.default(t,i),new os.default(t,n),new os.default(r,n),new os.default(r,i)];if(e.length>2){for(let o of a)if($n(e,o))return!0}for(let o=0;o<e.length-1;o++){let s=e[o],l=e[o+1];if(yE(s,l,a))return!0}return!1}function yE(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=vr(e,t,i[0]);return a!==vr(e,t,i[1])||a!==vr(e,t,i[2])||a!==vr(e,t,i[3])}var sc=ne(se(),1);function Oa(e,t,i){let r=t.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Rl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function zl(e,t,i,r,n){if(!t[0]&&!t[1])return e;let a=sc.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 gE(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 sc.default(0,0):l.sub(s)._unit()._perp(),c=o===n.length-1?new sc.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 xm,_E=()=>xm=xm||new ft({"circle-sort-key":new Q(z.layout_circle["circle-sort-key"])}),vm,xE=()=>vm=vm||new ft({"circle-radius":new Q(z.paint_circle["circle-radius"]),"circle-color":new Q(z.paint_circle["circle-color"]),"circle-blur":new Q(z.paint_circle["circle-blur"]),"circle-opacity":new Q(z.paint_circle["circle-opacity"]),"circle-translate":new Y(z.paint_circle["circle-translate"]),"circle-translate-anchor":new Y(z.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Y(z.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Y(z.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Q(z.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Q(z.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Q(z.paint_circle["circle-stroke-opacity"])}),vE={get paint(){return xE()},get layout(){return _E()}},bE=ne(se(),1),wE=e=>e.type==="circle",PE=class extends yi{constructor(e){super(e,vE)}createBucket(e){return new Ap(e)}queryRadius(e){let t=e;return Oa("circle-radius",this,t)+Oa("circle-stroke-width",this,t)+Rl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let l=zl(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:TE(l,n,o,s),f=p?c*a:c;for(let y of r)for(let g of y){let _=p?g:Fx(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),hE(d,_,b))return!0}return!1}};function Fx(e,t,i,r){let n=t.projectTileCoordinates(e.x,e.y,i,r).point;return new bE.default((n.x*.5+.5)*t.width,(-n.y*.5+.5)*t.height)}function TE(e,t,i,r){return e.map(n=>Fx(n,t,i,r))}var Ox=class extends Ap{};Z("HeatmapBucket",Ox,{omit:["layers"]});var bm,SE=()=>bm=bm||new ft({"heatmap-radius":new Q(z.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Q(z.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Y(z.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Al(z.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Y(z.paint_heatmap["heatmap-opacity"])}),CE={get paint(){return SE()}};function Dp(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: ${n.length} but got: ${t*i*r}`);return e.width=t,e.height=i,e.data=n,e}function Bx(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let n=Dp({},{width:t,height:i},r);Lp(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 Lp(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 Rp=class Nx{constructor(t,i){Dp(this,t,1,i)}resize(t){Bx(this,t,1)}clone(){return new Nx({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){Lp(t,i,r,n,a,1)}},je=class Vx{constructor(t,i){Dp(this,t,4,i)}resize(t){Bx(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 Vx({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){Lp(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)}};Z("AlphaImage",Rp);Z("RGBAImage",je);function jx(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new je({width:i,height:r});if(!sS(i))throw new Error(`width is not a power of 2 - ${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 Ka="big-fb",ME=e=>e.type==="heatmap",IE=class extends yi{createBucket(e){return new Ox(e)}constructor(e){super(e,CE),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=jx({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ka)&&this.heatmapFbos.delete(Ka)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},wm,EE=()=>wm=wm||new ft({"hillshade-illumination-direction":new Y(z.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Y(z.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Y(z.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Y(z.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Y(z.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Y(z.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Y(z.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Y(z.paint_hillshade["hillshade-method"])}),AE={get paint(){return EE()}},kE=e=>e.type==="hillshade",DE=class extends yi{constructor(e){super(e,AE),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(Ne);return{directionRadians:e.map(Ne),altitudeRadians:a,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},Pm,LE=()=>Pm=Pm||new ft({"color-relief-opacity":new Y(z["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Al(z["paint_color-relief"]["color-relief-color"])}),RE={get paint(){return LE()}},et=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||Wi(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||Wi(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}},zE=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)){at(`"${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 Ux(e,this.getUnpackVector())}getPixels(){return new je({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 Ux(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}}Z("DEMData",zE);var FE=e=>e.type==="color-relief",OE=class extends yi{constructor(e){super(e,RE)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof Ya&&i._styleExpression.expression instanceof pi){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=[J.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 at(`Too many colors in specification of ${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 je({width:r.colorStops.length,height:1}),a=new je({width:r.colorStops.length,height:1});for(let o=0;o<r.elevationStops.length;o++){let s=Ux(r.elevationStops[o],i);a.setPixel(0,o,new J(s.r/255,s.g/255,s.b/255,1)),n.setPixel(0,o,r.colorStops[o])}return this.colorRampTextures={elevationTexture:new et(e,a,e.gl.RGBA),colorTexture:new et(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}},BE=Ke([{name:"a_pos",components:2,type:"Int16"}],4),{members:NE,size:NV,alignment:VV}=BE;function zp(e,t,i){let r=i.patternDependencies,n=!1;for(let a of t){let o=a.paint.get(`${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 Fp(e,t,i,r,n){let a=n.patternDependencies;for(let o of t){let s=o.paint.get(`${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 ss=ne(se(),1);function VE(e,t,i=2){let r=t&&t.length,n=r?t[0]*i:e.length,a=Gx(e,0,n,i,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u;if(r&&(a=qE(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 Ja(a,o,i,s,l,u,0),o}function Gx(e,t,i,r,n){let a;if(n===iA(e,t,i,r)>0)for(let o=t;o<i;o+=r)a=Tm(o/r|0,e[o],e[o+1],a);else for(let o=i-r;o>=t;o-=r)a=Tm(o/r|0,e[o],e[o+1],a);return a&&Yn(a,a.next)&&(eo(a),a=a.next),a}function Kr(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(Yn(i,i.next)||We(i.prev,i,i.next)===0)){if(eo(i),i=t=i.prev,i===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function Ja(e,t,i,r,n,a,o){if(!e)return;!o&&a&&HE(e,r,n,a);let s=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?UE(e,r,n,a):jE(e)){t.push(l.i,e.i,u.i),eo(e),e=u.next,s=u.next;continue}if(e=u,e===s){o?o===1?(e=GE(Kr(e),t),Ja(e,t,i,r,n,a,2)):o===2&&XE(e,t,i,r,n,a):Ja(Kr(e),t,i,r,n,a,1);break}}}function jE(e){let t=e.prev,i=e,r=e.next;if(We(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&&Aa(n,s,a,l,o,u,f.x,f.y)&&We(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function UE(e,t,i,r){let n=e.prev,a=e,o=e.next;if(We(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),_=lc(d,f,t,i,r),b=lc(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&&Aa(s,h,l,c,u,p,v.x,v.y)&&We(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&&Aa(s,h,l,c,u,p,w.x,w.y)&&We(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&&Aa(s,h,l,c,u,p,v.x,v.y)&&We(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&&Aa(s,h,l,c,u,p,w.x,w.y)&&We(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function GE(e,t){let i=e;do{let r=i.prev,n=i.next.next;!Yn(r,n)&&qx(r,i,i.next,n)&&Qa(r,n)&&Qa(n,r)&&(t.push(r.i,i.i,n.i),eo(i),eo(i.next),i=e=n),i=i.next}while(i!==e);return Kr(i)}function XE(e,t,i,r,n,a){let o=e;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&QE(o,s)){let l=$x(o,s);o=Kr(o,o.next),l=Kr(l,l.next),Ja(o,t,i,r,n,a,0),Ja(l,t,i,r,n,a,0);return}s=s.next}o=o.next}while(o!==e)}function qE(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=Gx(e,s,l,r,!1);u===u.next&&(u.steiner=!0),n.push(JE(u))}n.sort($E);for(let a=0;a<n.length;a++)i=YE(n[a],i);return i}function $E(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 YE(e,t){let i=ZE(e,t);if(!i)return t;let r=$x(i,e);return Kr(r,r.next),Kr(i,i.next)}function ZE(e,t){let i=t,r=e.x,n=e.y,a=-1/0,o;if(Yn(e,i))return i;do{if(Yn(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&&Xx(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);Qa(i,e)&&(c<h||c===h&&(i.x>o.x||i.x===o.x&&WE(o,i)))&&(o=i,h=c)}i=i.next}while(i!==s);return o}function WE(e,t){return We(e.prev,e,t.prev)<0&&We(t.next,e,e.next)<0}function HE(e,t,i,r){let n=e;do n.z===0&&(n.z=lc(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,KE(n)}function KE(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 lc(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 JE(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 Xx(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 Aa(e,t,i,r,n,a,o,s){return!(e===o&&t===s)&&Xx(e,t,i,r,n,a,o,s)}function QE(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!eA(e,t)&&(Qa(e,t)&&Qa(t,e)&&tA(e,t)&&(We(e.prev,e,t.prev)||We(e,t.prev,t))||Yn(e,t)&&We(e.prev,e,e.next)>0&&We(t.prev,t,t.next)>0)}function We(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Yn(e,t){return e.x===t.x&&e.y===t.y}function qx(e,t,i,r){let n=us(We(e,t,i)),a=us(We(e,t,r)),o=us(We(i,r,e)),s=us(We(i,r,t));return!!(n!==a&&o!==s||n===0&&ls(e,i,t)||a===0&&ls(e,r,t)||o===0&&ls(i,e,r)||s===0&&ls(i,t,r))}function ls(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 us(e){return e>0?1:e<0?-1:0}function eA(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&&qx(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}function Qa(e,t){return We(e.prev,e,e.next)<0?We(e,t,e.next)>=0&&We(e,e.prev,t)>=0:We(e,t,e.prev)<0||We(e,e.next,t)<0}function tA(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 $x(e,t){let i=uc(e.i,e.x,e.y),r=uc(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 Tm(e,t,i,r){let n=uc(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 eo(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 uc(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function iA(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 Zi=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)}},hc=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}};hc.noSubdivision=new hc({fill:new Zi(0,0),line:new Zi(0,0),tile:new Zi(0,0),stencil:new Zi(0,0),circle:1});var Op=hc;Z("SubdivisionGranularityExpression",Zi);Z("SubdivisionGranularitySetting",Op);var _r=-32768,Ur=32767,rA=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 aA(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);oA(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 I=s+d*v,E=l+f*v;a.push(this._vertexToIndex(I,E))}let P=s+d*Math.max(v,0),T=s+d*Math.min(w,1);if(y||this._generateIntraEdgeVertices(a,s,l,u,h,P,T),!g&&w<1){let I=s+d*w,E=l+f*w;a.push(this._vertexToIndex(I,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,T,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<_,P=p===0;if(P&&(o===l||o===u))return;if(P||y>=1||g<=0){let I=t-a,E=i-o,R=(l-o)/E,k=(u-o)/E,L=Math.min(R,k),A=a+I*L;b=Math.floor(Math.min(A,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(A,s)/this._granularityCellSize)-1,w=s<A}let T=h>0?u:l;if(w)for(let I=b;I<=v;I++){let E=I*this._granularityCellSize;e.push(this._vertexToIndex(E,T))}else for(let I=v;I>=b;I--){let E=I*this._granularityCellSize;e.push(this._vertexToIndex(E,T))}}_generateOutline(e){let t=[];for(let i of e){let r=Bp(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===_r&&(e[t+1]=_r+1),i===Ur&&(e[t+1]=Ur-1)}}_generatePoleQuad(e,t,i,r,n,a){r>n!=(a===_r)?(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,_r),f===n&&g===n&&this._generatePoleQuad(e,u,h,d,y,_r),g===n&&p===n&&this._generatePoleQuad(e,h,l,y,c,_r)),i&&(p===a&&f===a&&this._generatePoleQuad(e,l,u,c,d,Ur),f===a&&g===a&&this._generatePoleQuad(e,u,h,d,y,Ur),g===a&&p===a&&this._generatePoleQuad(e,h,l,y,c,Ur))}}_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}=nA(e);this._initializeVertices(i);let n;try{let o=VE(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 Yx(e,t,i,r=!0){return new rA(i,t).subdividePolygonInternal(e,r)}function Bp(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 ss.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,P=Math.abs(v),T=Math.abs(w),I=d,E=f;for(;;){let k=v>0?(Math.floor(I/o)+1)*o:(Math.ceil(I/o)-1)*o,L=w>0?(Math.floor(E/o)+1)*o:(Math.ceil(E/o)-1)*o,A=Math.abs(I-k),D=Math.abs(E-L),x=Math.abs(I-y),S=Math.abs(E-g),C=_?A/P:Number.POSITIVE_INFINITY,F=b?D/T:Number.POSITIVE_INFINITY;if((x<=A||!_)&&(S<=D||!b))break;if(C<F&&_||!b){I=k,E=E+w*C;let B=new ss.default(I,Math.round(E));(s[s.length-1].x!==B.x||s[s.length-1].y!==B.y)&&s.push(B)}else{I=I+v*F,E=L;let B=new ss.default(Math.round(I),E);(s[s.length-1].x!==B.x||s[s.length-1].y!==B.y)&&s.push(B)}}let R=new ss.default(y,g);(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}return s}function nA(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 aA(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 oA(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,P=-v,T=y<_?1:-1,I=((h-f)*w+(c-y)*P)*T,E=((p-f)*w+(d-y)*P)*T;I>E&&(b=!0)}if(b){let v=t[l],w=t[o],P=t[s];v!==w&&v!==P&&w!==P&&i.push(P,w,v),o--,o<0&&(o=a-1)}else{let v=t[u],w=t[o],P=t[s];v!==w&&v!==P&&w!==P&&i.push(P,w,v),s++,s>=a&&(s=0)}if(l===u)break}}function Zx(e,t,i,r,n,a,o,s,l){let u=n.length/2,h=o&&s&&l;if(u<Ve.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 sA(t,i,r,n,a,e),h&&lA(o,i,s,n,l,e),t.forceNewSegmentOnNextPrepare(),o?.forceNewSegmentOnNextPrepare()}function Ba(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 sA(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>Ve.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,y=!0,g=!0,_=!0,h=0);let v=Ba(o,r,a,s,p,y,u),w=Ba(o,r,a,s,d,g,u),P=Ba(o,r,a,s,f,_,u);i.emplaceBack(h+v-l,h+w-l,h+P-l),u.primitiveLength++}}function lA(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>Ve.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,g=!0,_=!0,h=0);let v=Ba(o,r,a,s,f,g,u),w=Ba(o,r,a,s,y,_,u);i.emplaceBack(h+v-l,h+w-l),u.primitiveLength++}}}var uA=500,Wx=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 qI,this.indexArray=new gi,this.indexArray2=new ic,this.programConfigurations=new Hr(e.layers,e.zoom),this.segments=new Ve,this.segments2=new Ve,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=zp("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=an(o,h);if(!this.layers[0]._featureFilter.filter(new tt(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:nn(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=Fp("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,NE),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 Kc(t,uA)){let s=Yx(o,r,a.fill.getGranularityForZoomLevel(r.z)),l=this.layoutVertexArray;Zx((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)}};Z("FillBucket",Wx,{omit:["layers","patternFeatures"]});var Sm,hA=()=>Sm=Sm||new ft({"fill-sort-key":new Q(z.layout_fill["fill-sort-key"])}),Cm,cA=()=>Cm=Cm||new ft({"fill-antialias":new Y(z.paint_fill["fill-antialias"]),"fill-opacity":new Q(z.paint_fill["fill-opacity"]),"fill-color":new Q(z.paint_fill["fill-color"]),"fill-outline-color":new Q(z.paint_fill["fill-outline-color"]),"fill-translate":new Y(z.paint_fill["fill-translate"]),"fill-translate-anchor":new Y(z.paint_fill["fill-translate-anchor"]),"fill-pattern":new El(z.paint_fill["fill-pattern"])}),pA={get paint(){return cA()},get layout(){return hA()}},dA=e=>e.type==="fill",fA=class extends yi{constructor(e){super(e,pA)}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 Wx(e)}queryRadius(){return Rl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){let n=zl(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r);return zx(n,t)}isTileClipped(){return!0}},mA=Ke([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),yA=Ke([{name:"a_centroid",components:2,type:"Int16"}],4),{members:gA,size:UV,alignment:GV}=mA,_A=ne(ol(),1),xA=_A.default.VectorTileFeature.types,vA=500,ch=Math.pow(2,13);function pa(e,t,i,r,n,a,o,s){e.emplaceBack(t,i,Math.floor(r*ch)*2+o,n*ch*2,a*ch*2,Math.round(s))}var Hx=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 $I,this.centroidVertexArray=new Yi,this.indexArray=new gi,this.programConfigurations=new Hr(e.layers,e.zoom),this.segments=new Ve,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.features=[],this.hasPattern=zp("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=an(r,s);if(!this.layers[0]._featureFilter.filter(new tt(this.zoom,{globalState:this.globalState}),l,i))continue;let u={id:n,sourceLayerIndex:o,index:a,geometry:s?l.geometry:nn(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Fp("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,gA),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,yA.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 Kc(t,vA)){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||Mm(r[0]))return;for(let h of r)h.length!==0&&bA(e,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(t.z),s=xA[i.type]==="Polygon";for(let h of r){if(h.length===0||Mm(h))continue;let c=Bp(h,o,s);this._generateSideFaces(c,a)}if(!s)return;let l=Yx(r,t,o,!1),u=this.layoutVertexArray;Zx((h,c)=>{pa(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(wA(n,a))continue;t.segment.vertexLength+4>Ve.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),pa(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,i),pa(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,i),i+=s,pa(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,i),pa(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 bA(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++)}}Z("FillExtrusionBucket",Hx,{omit:["layers","features"]});function wA(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function Mm(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 Im,PA=()=>Im=Im||new ft({"fill-extrusion-opacity":new Y(z["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Q(z["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Y(z["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Y(z["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new El(z["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Q(z["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Q(z["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Y(z["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),TA={get paint(){return PA()}},cc=ne(se(),1),SA=e=>e.type==="fill-extrusion",CA=class extends yi{constructor(e){super(e,TA)}createBucket(e){return new Hx(e)}queryRadius(){return Rl(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=zl(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=EA(s,o,0),c=IA(r,u,l,o),p=c[0],d=c[1];return MA(p,d,h)}};function da(e,t){return e.x*t.x+e.y*t.y}function Em(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=da(s,s),c=da(s,l),p=da(l,l),d=da(u,s),f=da(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 MA(e,t,i){let r=1/0;zx(i,t)&&(r=Em(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];Rx(i,p)&&(r=Math.min(r,Em(i,p)))}}return r===1/0?!1:r}function IA(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],P=r[1]*b+r[5]*v+r[13],T=r[2]*b+r[6]*v+r[14],I=r[3]*b+r[7]*v+r[15],E=w+o,R=P+s,k=T+l,L=I+u,A=w+h,D=P+c,x=T+p,S=I+d,C=new cc.default(E/L,R/L);C.z=k/L,y.push(C);let F=new cc.default(A/S,D/S);F.z=x/S,g.push(F)}n.push(y),a.push(g)}return[n,a]}function EA(e,t,i){let r=[];for(let n of e){let a=[n.x,n.y,i,1];Je.transformMat4(a,a,t),r.push(new cc.default(a[0]/a[3],a[1]/a[3]))}return r}var AA=Ke([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:kA,size:XV,alignment:qV}=AA,DA=Ke([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:LA,size:$V,alignment:YV}=DA,RA=ne(ol(),1),zA=RA.default.VectorTileFeature.types,Am=63,FA=Math.cos(75/2*(Math.PI/180)),OA=15,BA=20,NA=15,Kx=1/2,km=Math.pow(2,NA-1)/Kx,Jx=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 YI,this.layoutVertexArray2=new ZI,this.indexArray=new gi,this.programConfigurations=new Hr(e.layers,e.zoom),this.segments=new Ve,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=zp("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=an(o,h);if(!this.layers[0]._featureFilter.filter(new tt(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:nn(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=Fp("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,LA)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kA),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=Bp(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=zA[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?OA*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 P=_.x*b.x+_.y*b.y,T=w.x*b.x+w.y*b.y,I=T!==0?1/T:1/0,E=2*Math.sqrt(2-2*T),R=T<FA&&y&&g,k=_.x*b.y-_.y*b.x>0;if(R&&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 L=y&&g,A=L?i:u?"butt":r;if(L&&A==="round"&&(I<a?A="miter":I<=2&&(A="fakeround")),A==="miter"&&I>n&&(A="bevel"),A==="bevel"&&(I>2&&(A="flipbevel"),I<n&&(A="miter")),y&&this.updateDistance(y,f),A==="miter")w._mult(I),this.addCurrentVertex(f,w,0,0,d);else if(A==="flipbevel"){if(I>100)w=b.mult(-1);else{let D=I*_.add(b).mag()/_.sub(b).mag();w._perp()._mult(D*(k?-1:1))}this.addCurrentVertex(f,w,0,0,d),this.addCurrentVertex(f,w.mult(-1),0,0,d)}else if(A==="bevel"||A==="fakeround"){let D=-Math.sqrt(I*I-1),x=k?D:0,S=k?0:D;if(y&&this.addCurrentVertex(f,_,x,S,d),A==="fakeround"){let C=Math.round(E*180/Math.PI/BA);for(let F=1;F<C;F++){let B=F/C;if(B!==.5){let H=B-.5,ie=1.0904+P*(-3.2452+P*(3.55645-P*1.43519)),Se=.848013+P*(-1.06021+P*.215638);B=B+B*H*(B-1)*(ie*H*H+Se)}let j=b.sub(_)._mult(B)._add(_)._unit()._mult(k?-1:1);this.addHalfVertex(f,j.x,j.y,!1,k,0,d)}}g&&this.addCurrentVertex(f,b,-x,-S,d)}else if(A==="butt")this.addCurrentVertex(f,w,0,0,d);else if(A==="square"){let D=y?1:-1;this.addCurrentVertex(f,w,D,D,d)}else A==="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(R&&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>km/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*(km-1):this.scaledDistance)*Kx;if(this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(a?1:0),Math.round(Am*i)+128,Math.round(Am*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()}};Z("LineBucket",Jx,{omit:["layers","patternFeatures"]});var Dm,VA=()=>Dm=Dm||new ft({"line-cap":new Y(z.layout_line["line-cap"]),"line-join":new Q(z.layout_line["line-join"]),"line-miter-limit":new Y(z.layout_line["line-miter-limit"]),"line-round-limit":new Y(z.layout_line["line-round-limit"]),"line-sort-key":new Q(z.layout_line["line-sort-key"])}),Lm,jA=()=>Lm=Lm||new ft({"line-opacity":new Q(z.paint_line["line-opacity"]),"line-color":new Q(z.paint_line["line-color"]),"line-translate":new Y(z.paint_line["line-translate"]),"line-translate-anchor":new Y(z.paint_line["line-translate-anchor"]),"line-width":new Q(z.paint_line["line-width"]),"line-gap-width":new Q(z.paint_line["line-gap-width"]),"line-offset":new Q(z.paint_line["line-offset"]),"line-blur":new Q(z.paint_line["line-blur"]),"line-dasharray":new cp(z.paint_line["line-dasharray"]),"line-pattern":new El(z.paint_line["line-pattern"]),"line-gradient":new Al(z.paint_line["line-gradient"])}),Rm={get paint(){return jA()},get layout(){return VA()}},UA=class extends Q{possiblyEvaluate(e,t){return t=new tt(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=W({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}},hs,GA=e=>e.type==="line",XA=class extends yi{constructor(e){super(e,Rm),this.gradientVersion=0,hs||(hs=new UA(Rm.paint.properties["line-width"].specification),hs.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();JM(t)?this.stepInterpolant=t._styleExpression.expression instanceof Yc: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 Jx(e)}queryRadius(e){let t=e,i=zm(Oa("line-width",this,t),Oa("line-gap-width",this,t)),r=Oa("line-offset",this,t);return i/2+Math.abs(r)+Rl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a}){let o=zl(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),s=a/2*zm(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=gE(r,l*a)),cE(o,r,s)}isTileClipped(){return!0}};function zm(e,t){return t>0?t+2*e:e}var qA=Ke([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),$A=Ke([{name:"a_projected_pos",components:3,type:"Float32"}],4),ZV=Ke([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),YA=Ke([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),WV=Ke([{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"}]),Fm=Ke([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ZA=Ke([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),HV=Ke([{name:"triangle",components:3,type:"Uint16"}]),KV=Ke([{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"}]),JV=Ke([{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"}]),QV=Ke([{type:"Float32",name:"offsetX"}]),ej=Ke([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),tj=Ke([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]),cs=ne(se(),1);function WA(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?e=e.toLocaleUpperCase():r==="lowercase"&&(e=e.toLocaleLowerCase()),qn.applyArabicShaping&&(e=qn.applyArabicShaping(e)),e}function HA(e,t,i){return e.sections.forEach(r=>{r.text=WA(r.text,t,i)}),e}function KA(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`${u}:${p.x}:${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 JA={"!":"\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"},Qx=24,QA=ne(Vy(),1),Om=3;function ek(e,t,i){e===1&&i.readMessage(tk,t)}function tk(e,t,i){if(e===3){let{id:r,bitmap:n,width:a,height:o,left:s,top:l,advance:u}=i.readMessage(ik,{});t.push({id:r,bitmap:new Rp({width:a+2*Om,height:o+2*Om},n),metrics:{width:a,height:o,left:s,top:l,advance:u}})}}function ik(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 rk(e){return new QA.default(e).readFields(ek,[])}function nk(e){let{userImage:t}=e;return t&&t.render&&t.render()?(e.data.replace(new Uint8Array(t.data.buffer)),!0):!1}function e0(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 Kt=1,Np=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+Kt,this.paddedRect.y+Kt]}get br(){return[this.paddedRect.x+this.paddedRect.w-Kt,this.paddedRect.y+this.paddedRect.h-Kt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-Kt*2)/this.pixelRatio,(this.paddedRect.h-Kt*2)/this.pixelRatio]}},ak=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}=e0(n),s=new je({width:a||1,height:o||1});for(let l in e){let u=e[l],h=i[l].paddedRect;je.copy(u.data,s,{x:0,y:0},{x:h.x+Kt,y:h.y+Kt},u.data)}for(let l in t){let u=t[l],h=r[l].paddedRect,c=h.x+Kt,p=h.y+Kt,d=u.data.width,f=u.data.height;je.copy(u.data,s,{x:0,y:0},{x:c,y:p},u.data),je.copy(u.data,s,{x:0,y:f-1},{x:c,y:p-1},{width:d,height:1}),je.copy(u.data,s,{x:0,y:0},{x:c,y:p+f},{width:d,height:1}),je.copy(u.data,s,{x:d-1,y:0},{x:c-1,y:p},{width:1,height:f}),je.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*Kt,h:n.data.height+2*Kt};i.push(a),t[r]=new Np(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})}};Z("ImagePosition",Np);Z("ImageAtlas",ak);var t0=(e=>(e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e))(t0||{});function i0(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 ok=ne(ol(),1),sk=255,Bs=128,Bm=sk*Bs;function Nm(e,t){let{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new tt(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 tt(s)),h=i.evaluate(new tt(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:h,interpolationType:n}}}function Vp(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return e.kind==="source"?r/Bs:e.kind==="composite"?$e.number(r/Bs,n/Bs,i):t}function Fl(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?Ce(pi.interpolationFactor(n,t,a,o),0,1):0;e.kind==="camera"?r=$e.number(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}}function Js(e,t,i){let r="never",n=e.get(t);return n?r=n:e.get(i)&&(r="always"),r}var lk=ok.default.VectorTileFeature.types,uk=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ps(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=s?Math.min(Bm,Math.round(s[0])):0,f=s?Math.min(Bm,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 to(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 hk(e){for(let t of e.sections)if(LI(t.text))return!0;return!1}var pc=class{constructor(e){this.layoutVertexArray=new WI,this.indexArray=new gi,this.programConfigurations=e,this.segments=new Ve,this.dynamicLayoutVertexArray=new HI,this.opacityVertexArray=new KI,this.hasVisibleVertices=!1,this.placedSymbolArray=new wx}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,qA.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,$A.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,uk,!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())}};Z("SymbolBuffers",pc);var dc=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Ve,this.collisionVertexArray=new QI}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,YA.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};Z("CollisionBuffers",dc);var Zn=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=Nm(this.zoom,t["text-size"]),this.iconSizeData=Nm(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=Js(i,"text-overlap","text-allow-overlap")!=="never"||Js(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=>t0[o])),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.sourceID=e.sourceID}createArrays(){this.text=new pc(new Hr(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new pc(new Hr(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Sx,this.lineVertexArray=new Cx,this.symbolInstances=new Tx,this.textAnchorOffsets=new Ix}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=JA[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 Ki&&!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 tt(this.zoom,{globalState:this.globalState});for(let{feature:y,id:g,index:_,sourceLayerIndex:b}of e){let v=r._featureFilter.needGeometry,w=an(y,v);if(!r._featureFilter.filter(f,w,i))continue;v||(w.geometry=nn(y));let P;if(l){let R=r.getValueAndResolveTokens("text-field",w,i,d),k=Ki.factory(R),L=this.hasRTLText=this.hasRTLText||hk(k);(!L||qn.getRTLTextPluginStatus()==="unavailable"||L&&qn.isParsed())&&(P=HA(k,r,w))}let T;if(u){let R=r.getValueAndResolveTokens("icon-image",w,i,d);R instanceof Fi?T=R:T=Fi.fromString(R)}if(!P&&!T)continue;let I=this.sortFeaturesByKey?h.evaluate(w,{},i):void 0,E={id:g,text:P,icon:T,index:_,sourceLayerIndex:b,geometry:w.geometry,properties:y.properties,type:lk[y.type],sortKey:I};if(this.features.push(E),T&&(c[T.name]=!0),P){let R=a.evaluate(w,{},i).join(","),k=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let L of P.sections)if(L.image)c[L.image.name]=!0;else{let A=SI(P.toString()),D=L.fontStack||R,x=p[D]=p[D]||{};this.calculateGlyphDependencies(L.text,x,k,this.allowVerticalPlacement,A)}}}n.get("symbol-placement")==="line"&&(this.features=KA(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:P,bl:T,br:I,tex:E,pixelOffsetTL:R,pixelOffsetBR:k,minFontScaleX:L,minFontScaleY:A,glyphOffset:D,isSDF:x,sectionIndex:S}=t[v],C=f.vertexLength,F=D[1];ps(d,s.x,s.y,w.x,F+w.y,E.x,E.y,i,x,R.x,R.y,L,A),ps(d,s.x,s.y,P.x,F+P.y,E.x+E.w,E.y,i,x,k.x,R.y,L,A),ps(d,s.x,s.y,T.x,F+T.y,E.x,E.y+E.h,i,x,R.x,k.y,L,A),ps(d,s.x,s.y,I.x,F+I.y,E.x+E.w,E.y+E.h,i,x,k.x,k.y,L,A),to(e.dynamicLayoutVertexArray,s,_),p.emplaceBack(C,C+2,C+1),p.emplaceBack(C+1,C+2,C+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(v===t.length-1||S!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},c,b&&b[S])}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 cs.default(e,t)),this._addCollisionDebugVertex(u,h,a,c,p,new cs.default(i,t)),this._addCollisionDebugVertex(u,h,a,c,p,new cs.default(i,r)),this._addCollisionDebugVertex(u,h,a,c,p,new cs.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 dc(hm,Fm.members,ic),this.iconCollisionBox=new dc(hm,Fm.members,ic);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)}}};Z("SymbolBucket",Zn,{omit:["layers","collisionBoxArray","features","compareText"]});Zn.MAX_GLYPHS=65535;Zn.addDynamicAttributes=to;function ck(e,t){return t.replace(/{([^{}]+)}/g,(i,r)=>e&&r in e?String(e[r]):"")}var Vm,pk=()=>Vm=Vm||new ft({"symbol-placement":new Y(z.layout_symbol["symbol-placement"]),"symbol-spacing":new Y(z.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Y(z.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Q(z.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Y(z.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Y(z.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Y(z.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Y(z.layout_symbol["icon-ignore-placement"]),"icon-optional":new Y(z.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Y(z.layout_symbol["icon-rotation-alignment"]),"icon-size":new Q(z.layout_symbol["icon-size"]),"icon-text-fit":new Y(z.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Y(z.layout_symbol["icon-text-fit-padding"]),"icon-image":new Q(z.layout_symbol["icon-image"]),"icon-rotate":new Q(z.layout_symbol["icon-rotate"]),"icon-padding":new Q(z.layout_symbol["icon-padding"]),"icon-keep-upright":new Y(z.layout_symbol["icon-keep-upright"]),"icon-offset":new Q(z.layout_symbol["icon-offset"]),"icon-anchor":new Q(z.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Y(z.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Y(z.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Y(z.layout_symbol["text-rotation-alignment"]),"text-field":new Q(z.layout_symbol["text-field"]),"text-font":new Q(z.layout_symbol["text-font"]),"text-size":new Q(z.layout_symbol["text-size"]),"text-max-width":new Q(z.layout_symbol["text-max-width"]),"text-line-height":new Y(z.layout_symbol["text-line-height"]),"text-letter-spacing":new Q(z.layout_symbol["text-letter-spacing"]),"text-justify":new Q(z.layout_symbol["text-justify"]),"text-radial-offset":new Q(z.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Y(z.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Q(z.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Q(z.layout_symbol["text-anchor"]),"text-max-angle":new Y(z.layout_symbol["text-max-angle"]),"text-writing-mode":new Y(z.layout_symbol["text-writing-mode"]),"text-rotate":new Q(z.layout_symbol["text-rotate"]),"text-padding":new Y(z.layout_symbol["text-padding"]),"text-keep-upright":new Y(z.layout_symbol["text-keep-upright"]),"text-transform":new Q(z.layout_symbol["text-transform"]),"text-offset":new Q(z.layout_symbol["text-offset"]),"text-allow-overlap":new Y(z.layout_symbol["text-allow-overlap"]),"text-overlap":new Y(z.layout_symbol["text-overlap"]),"text-ignore-placement":new Y(z.layout_symbol["text-ignore-placement"]),"text-optional":new Y(z.layout_symbol["text-optional"])}),jm,dk=()=>jm=jm||new ft({"icon-opacity":new Q(z.paint_symbol["icon-opacity"]),"icon-color":new Q(z.paint_symbol["icon-color"]),"icon-halo-color":new Q(z.paint_symbol["icon-halo-color"]),"icon-halo-width":new Q(z.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Q(z.paint_symbol["icon-halo-blur"]),"icon-translate":new Y(z.paint_symbol["icon-translate"]),"icon-translate-anchor":new Y(z.paint_symbol["icon-translate-anchor"]),"text-opacity":new Q(z.paint_symbol["text-opacity"]),"text-color":new Q(z.paint_symbol["text-color"],{runtimeType:ci,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Q(z.paint_symbol["text-halo-color"]),"text-halo-width":new Q(z.paint_symbol["text-halo-width"]),"text-halo-blur":new Q(z.paint_symbol["text-halo-blur"]),"text-translate":new Y(z.paint_symbol["text-translate"]),"text-translate-anchor":new Y(z.paint_symbol["text-translate-anchor"])}),ph={get paint(){return dk()},get layout(){return pk()}},r0=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:oo,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}};Z("FormatSectionOverride",r0,{omit:["defaultValue"]});var fk=e=>e.type==="symbol",mk=class fc extends yi{constructor(t){super(t,ph)}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()&&!wl(o.value)&&a?ck(i.properties,a):a}createBucket(t){return new Zn(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of ph.paint.overridableProperties){if(!fc.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new r0(i),n=new np(r,i.property.specification),a=null;i.value.kind==="constant"||i.value.kind==="source"?a=new Ya("source",n):a=new Zs("composite",n,i.value.zoomStops),this.paint._values[t]=new hi(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!this.layout||i.isDataDriven()||r.isDataDriven()?!1:fc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),n=ph.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 Ki)o(r.value.value.sections);else if(r.value.kind==="source"){let s=u=>{if(!a)if(u instanceof Xa&&ot(u.value)===so){let h=u.value;o(h.sections)}else u instanceof F_?o(u.sections):u.eachChild(s)},l=r.value;l._styleExpression&&s(l._styleExpression.expression)}return a}},Um,yk=()=>Um=Um||new ft({"background-color":new Y(z.paint_background["background-color"]),"background-pattern":new cp(z.paint_background["background-pattern"]),"background-opacity":new Y(z.paint_background["background-opacity"])}),gk={get paint(){return yk()}},_k=e=>e.type==="background",xk=class extends yi{constructor(e){super(e,gk)}},Gm,vk=()=>Gm=Gm||new ft({"raster-opacity":new Y(z.paint_raster["raster-opacity"]),"raster-hue-rotate":new Y(z.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Y(z.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Y(z.paint_raster["raster-brightness-max"]),"raster-saturation":new Y(z.paint_raster["raster-saturation"]),"raster-contrast":new Y(z.paint_raster["raster-contrast"]),"raster-resampling":new Y(z.paint_raster["raster-resampling"]),"raster-fade-duration":new Y(z.paint_raster["raster-fade-duration"])}),bk={get paint(){return vk()}},wk=e=>e.type==="raster",Pk=class extends yi{constructor(e){super(e,bk)}};function Tk(e){let t=[],i=e.id;return i===void 0&&t.push({message:`layers.${i}: missing required property "id"`}),e.render===void 0&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t}var Sk=e=>e.type==="custom",Ck=class extends yi{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 dh(e){if(e.type==="custom")return new Ck(e);switch(e.type){case"background":return new xk(e);case"circle":return new PE(e);case"color-relief":return new OE(e);case"fill":return new fA(e);case"fill-extrusion":return new CA(e);case"heatmap":return new IE(e);case"hillshade":return new DE(e);case"line":return new XA(e);case"raster":return new Pk(e);case"symbol":return new mk(e)}}function Ns(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=`${r}${n}`;i.indexOf(a)===-1&&(i.push(a),t.push({id:r,url:n}))}}return t}function Xm(e,t,i){try{let r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch{throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function Mk(e,t,i,r){let n=Ns(e),a=i>1?"@2x":"",o={},s={};for(let{id:l,url:u}of n){let h=t.transformRequest(Xm(u,a,".json"),"SpriteJSON");o[l]=cl(h,r);let c=t.transformRequest(Xm(u,a,".png"),"SpriteImage");s[l]=Di.getImage(c,r)}return await Promise.all([...Object.values(o),...Object.values(s)]),Ik(o,s)}async function Ik(e,t){let i={};for(let r in e){i[r]={};let n=ye.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 ds=1,Ek=class extends Dt{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new je({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 je({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 ${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 ee(new Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,r&&r.height)||(this.fire(new ee(new Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new ee(new Error(`Image "${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 (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${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 X("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)}:at(`Image "${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+ds*2,n=i.data.height+ds*2,a={w:r,h:n,x:0,y:0},o=new Np(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 et(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}=e0(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+ds,s=a.y+ds,l=this.getImage(n).data,u=l.width,h=l.height;je.copy(l,r,{x:0,y:0},{x:o,y:s},{width:u,height:h}),je.copy(l,r,{x:0,y:h-1},{x:o,y:s-1},{width:u,height:1}),je.copy(l,r,{x:0,y:0},{x:o,y:s+h},{width:u,height:1}),je.copy(l,r,{x:u-1,y:0},{x:o-1,y:s},{width:1,height:h}),je.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||at(`Image with ID: "${t}" was not found`),nk(i)&&this.updateImage(t,i)}}};async function Ak(e,t,i,r){let n=t*256,a=n+255,o=r.transformRequest(i.replace("{fontstack}",e).replace("{range}",`${n}-${a}`),"Glyphs"),s=await IS(o,new AbortController);if(!s||!s.data)throw new Error(`Could not load glyph range. range: ${t}, ${n}-${a}`);let l={};for(let u of rk(s.data))l[u.id]=u;return l}var kk=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=`${o} ${a} ${e}px ${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 P=0;P<l;P++){let T=v.data[4*(w*l+P)+3]/255;if(T===0)continue;let I=(w+g)*h+P+g;if(T===1)b[I]=0,_[I]=1e20;else{let E=.5-T;b[I]=E>0?E*E:0,_[I]=E<0?E*E:0}}qm(b,0,0,h,c,h,this.f,this.v,this.z),qm(_,g,g,l,u,h,this.f,this.v,this.z);for(let w=0;w<p;w++){let P=Math.sqrt(b[w])-Math.sqrt(_[w]);d[w]=Math.round(255-255*(P/this.radius+this.cutoff))}return f}};function qm(e,t,i,r,n,a,o,s,l){for(let u=t;u<t+r;u++)$m(e,i*a+u,a,n,o,s,l);for(let u=i;u<i+n;u++)$m(e,u*a+t,1,r,o,s,l)}function $m(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 mc=class yc{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=yc.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))||ut["CJK Unified Ideographs"](t)||ut["Hangul Syllables"](t)||ut.Hiragana(t)||ut.Katakana(t)||ut["CJK Symbols and Punctuation"](t)||ut["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 yc.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 Rp({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}}}};mc.loadGlyphRange=Ak,mc.TinySDF=kk;var Dk=mc,Lk=class{constructor(){this.specification=z.light.position}possiblyEvaluate(e,t){return hS(e.expression.evaluate(t))}interpolate(e,t,i){return{x:$e.number(e.x,t.x,i),y:$e.number(e.y,t.y,i),z:$e.number(e.z,t.z,i)}}},Ym="-transition",fh,Rk=class extends Dt{constructor(e){super(),fh=fh||new ft({anchor:new Y(z.light.anchor),position:new Lk,color:new Y(z.light.color),intensity:new Y(z.light.intensity)}),this._transitionable=new Ml(fh),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(vI,e,t))for(let i in e){let r=e[i];i.endsWith(Ym)?this._transitionable.setTransition(i.slice(0,-Ym.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:Sl(this,e.call(nt,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:z}))}},zk=new ft({"sky-color":new Y(z.sky["sky-color"]),"horizon-color":new Y(z.sky["horizon-color"]),"fog-color":new Y(z.sky["fog-color"]),"fog-ground-blend":new Y(z.sky["fog-ground-blend"]),"horizon-fog-blend":new Y(z.sky["horizon-fog-blend"]),"sky-horizon-blend":new Y(z.sky["sky-horizon-blend"]),"atmosphere-blend":new Y(z.sky["atmosphere-blend"])}),Zm="-transition",Fk=class extends Dt{constructor(e){super(),this._transitionable=new Ml(zk),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new tt(0))}setSky(e,t={}){if(!this._validate(bI,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(Zm)?this._transitionable.setTransition(i.slice(0,-Zm.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?.validate===!1?!1:Sl(this,e.call(nt,W({value:t,style:{glyphs:!0,sprite:!0},styleSpec:z})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},Ok=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 at("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))}},Bk=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=()=>{}}},Nk={once:!0},Vk=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Bk(()=>this.process()),this.subscription=zf(this.target,"message",i=>this.receive(i),!1),this.globalScope=Vn(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?zf(t.signal,"abort",()=>{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)},Nk):null;this.resolveRejects[n]={resolve:l=>{a?.unsubscribe(),i(l)},reject:l=>{a?.unsubscribe(),r(l)}};let o=[],s={...e,id:n,sourceMapId:this.mapId,origin:location.origin,data:za(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(Vn(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(Fa(t.error)):n.resolve(Fa(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let i=Fa(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?za(t):null,data:za(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},jk='(()=>{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',Uk=()=>Tr.WORKER_URL?Tr.WORKER_URL:URL.createObjectURL(new Blob([jk],{type:"text/javascript"}));function Gk(){return new Worker(Uk())}var Xk="maplibre_preloaded_worker_pool",n0=class a0{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<a0.workerCount;)this.workers.push(Gk());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[Xk]}numActive(){return Object.keys(this.active).length}},qk=Math.floor(ye.hardwareConcurrency/2);n0.workerCount=pS(globalThis)?Math.max(Math.min(qk,3),1):1;var mh;function o0(){return mh||(mh=new n0),mh}var s0=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 Vk(n,t);a.name=`Worker ${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)}},fs;function $k(){return fs||(fs=new s0(o0(),Vh),fs.registerMessageHandler("GR",(e,t,i)=>hl(t,i))),fs}function Yk(e,t){let i=O.create();return O.translate(i,i,[1,1,0]),O.scale(i,i,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?O.multiply(i,i,e.calculatePosMatrix(t.toUnwrapped())):i}function Zk(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 Wk(e,t,i,r,n,a,o){let s=Zk(n?.layers??null,t,e.id),l=a.maxPitchScaleFactor(),u=e.tilesIn(r,l,s);u.sort(l0);let h=[];for(let p of u)h.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(t,i,e._state,p.queryGeometry,p.cameraQueryGeometry,p.scale,n,a,l,Yk(e.transform,p.tileID),o?(d,f)=>o(p.tileID,d,f):void 0)});let c=Jk(h);return Qk(c,e)}function Hk(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(l0);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 eD(s,e,i)}function Kk(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 l0(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 Jk(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 Qk(e,t){for(let i in e)for(let r of e[i])u0(r,t);return e}function eD(e,t,i){for(let r in e)for(let n of e[r]){let a=t[r],o=i[a.source];u0(n,o)}return e}function u0(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 h0(e,t,i){let r=e;if(e.url?r=(await cl(t.transformRequest(e.url,"Source"),i)).data:await ye.frameAsync(i),!r)return null;let n=ao(W(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 Ii=63710088e-1,re=class ka{constructor(t,i){if(isNaN(t)||isNaN(i))throw new Error(`Invalid LngLat object: (${t}, ${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 ka(Xr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${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 Ii*Math.acos(Math.min(a,1))}static convert(t){if(t instanceof ka)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new ka(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new ka(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>]")}},Oi=class mr{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 re?new re(t.lng,t.lat):re.convert(t),this}setSouthWest(t){return this._sw=t instanceof re?new re(t.lng,t.lat):re.convert(t),this}extend(t){let i=this._sw,r=this._ne,n,a;if(t instanceof re)n=t,a=t;else if(t instanceof mr){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(mr.convert(o))}else{let o=t;return this.extend(re.convert(o))}else if(t&&("lng"in t||"lon"in t)&&"lat"in t)return this.extend(re.convert(t));return this}return!i&&!r?(this._sw=new re(n.lng,n.lat),this._ne=new re(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 re((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 re(this.getWest(),this.getNorth())}getSouthEast(){return new re(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(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:i,lat:r}=re.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 mr||!t?t:new mr(t)}static fromLngLat(t,i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*t.lat);return new mr(new re(t.lng-n,t.lat-r),new re(t.lng+n,t.lat+r))}adjustAntiMeridian(){let t=new re(this._sw.lng,this._sw.lat),i=new re(this._ne.lng,this._ne.lat);return t.lng>i.lng?new mr(t,new re(i.lng+360,i.lat)):new mr(t,i)}},c0=2*Math.PI*Ii;function p0(e){return c0*Math.cos(e*Math.PI/180)}function Wn(e){return(180+e)/360}function Jr(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Yr(e,t){return e/p0(t)}function tD(e){return e*360-180}function gc(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function _c(e,t){return e*p0(gc(t))}function iD(e){return 1/Math.cos(e*Math.PI/180)}var Oe=class d0{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=re.convert(t);return new d0(Wn(r.lng),Jr(r.lat),Yr(i,r.lat))}toLngLat(){return new re(tD(this.x),gc(this.y))}toAltitude(){return _c(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/c0*iD(gc(this.y))}},f0=class{constructor(e,t,i){this.bounds=Oi.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(Wn(this.bounds.getWest())*t),minY:Math.floor(Jr(this.bounds.getNorth())*t),maxX:Math.ceil(Wn(this.bounds.getEast())*t),maxY:Math.ceil(Jr(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}},rD=class extends Dt{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,W(this,ao(t,["url","scheme","tileSize","promoteId"])),this._options=W({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 X("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await h0(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(W(this,e),e.bounds&&(this.tileBounds=new f0(e.bounds,this.minzoom,this.maxzoom)),this.fire(new X("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new X("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new ee(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 W({},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}},m0=class extends Dt{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=W({type:"raster"},t),W(this,ao(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new X("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let t=await h0(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(W(this,t),t.bounds&&(this.tileBounds=new f0(t.bounds,this.minzoom,this.maxzoom)),this.fire(new X("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new X("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this.fire(new ee(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 W({},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 Di.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 et(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 nD(e,t,i){t=Math.pow(2,i)-t-1;var r=Wm(e*256,t*256,i),n=Wm((e+1)*256,(t+1)*256,i);return r[0]+","+r[1]+","+n[0]+","+n[1]}function Wm(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 aD=ne(se(),1);function oD(e,t,i){return!(e<jc||e>ll||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}function sD(e,t){let{x:i,y:r}=Oe.fromLngLat(t);return!(e<jc||e>ll||r<0||r>=1||i<0||i>=1)}var Ol=class{constructor(e,t,i){if(!oD(e,t,i))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${jc}<=z<=${ll} `);this.z=e,this.x=t,this.y=i,this.key=Fn(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=nD(this.x,this.y,this.z),n=lD(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 aD.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},Qs=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Fn(e,t.z,t.z,t.x,t.y)}},gt=class ui{constructor(t,i,r,n,a){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=i,this.canonical=new Ol(r,+n,+a),this.key=Fn(i,t,r,n,a)}clone(){return new ui(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 = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?new ui(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ui(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 = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?Fn(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):Fn(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 ui(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 ui(i,this.wrap,i,r,n),new ui(i,this.wrap,i,r+1,n),new ui(i,this.wrap,i,r,n+1),new ui(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 ui(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ui(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 Qs(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Oe(t.x-this.wrap,t.y))}};function Fn(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 lD(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}Z("CanonicalTileID",Ol);Z("OverscaledTileID",gt,{omit:["terrainRttPosMatrix32f"]});var uD=class extends m0{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=W({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 Di.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=Wi(n)&&Uy()?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"&&ew()){let t=e.width+2,i=e.height+2;try{return new je({width:t,height:i},await yS(e,-1,-1,t,i))}catch{}}return ye.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 gt(e.overscaledZ,n,t.z,r,t.y).key]={backfilled:!1},s[new gt(e.overscaledZ,o,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(s[new gt(e.overscaledZ,n,t.z,r,t.y-1).key]={backfilled:!1},s[new gt(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new gt(e.overscaledZ,o,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<i&&(s[new gt(e.overscaledZ,n,t.z,r,t.y+1).key]={backfilled:!1},s[new gt(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new gt(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}})}},hD=class extends Dt{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=W({},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&&at(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=W({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||at(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${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=W({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 Oi,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=W({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(ye.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new X("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new X("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&&W(n,{resourceTiming:r}),this.fire(new X("data",{...n,sourceDataType:"metadata"})),this.fire(new X("data",{...n,sourceDataType:"content"}))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new X("dataabort",{dataType:"source"}));return}this.fire(new ee(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 W({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},ms=ne(se(),1),Ri=class xc{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 xc;return i.extend(t(new ms.default(this.minX,this.minY))),i.extend(t(new ms.default(this.maxX,this.minY))),i.extend(t(new ms.default(this.minX,this.maxY))),i.extend(t(new ms.default(this.maxX,this.maxY))),i}static fromPoints(t){let i=new xc;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}},fo=class extends Dt{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 X("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=await Di.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 ee(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 X("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(Oe.fromLngLat);return this.tileID=cD(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=pD(this.tileCoords),this.fire(new X("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 et(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 X("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}=Ri.fromPoints(e),a={};for(let o=0;o<=ll;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 cD(e){let t=Ri.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 Ol(a,Math.floor((t.minX+t.maxX)/2*o),Math.floor((t.minY+t.maxY)/2*o))}function pD(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 dD=class extends fo{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 ES(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 ee(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 ee(new G(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${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 et(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 X("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}},fD=class extends fo{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 ee(new G(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new ee(new G(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new ee(new G(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new ee(new G(`sources.${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 ee(new G(`sources.${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 ee(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 et(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 X("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}},mD={},yD=(e,t,i,r)=>{let n=gD(t.type),a=new n(e,t,i,r);if(a.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${a.id}`);return a},gD=e=>{switch(e){case"geojson":return hD;case"image":return fo;case"raster":return m0;case"raster-dem":return uD;case"vector":return rD;case"video":return dD;case"canvas":return fD}return mD[e]};function _D(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 xD=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=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},vD=ne(ol(),1),bD=ne(Vy(),1),y0=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}},wD=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 Qh(8192,16,0),this.grid3D=new Qh(8192,16,0),this.featureIndexArray=new Ax,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 vD.default.VectorTile(new bD.default(this.rawTileData)).layers,this.sourceLayerCoder=new xD(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=Za(n.filter),s=e.queryGeometry,l=e.queryPadding*a,u=Ri.fromPoints(s),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Ri.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,g,_,b)=>mE(e.cameraQueryGeometry,y-l,g-l,_+l,b+l));for(let y of p)h.push(y);h.sort(PD);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,P)=>(b||(b=nn(v)),w.queryIntersectsFeature({queryGeometry:s,feature:v,featureState:P,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=an(d,!0);if(!n.filter(new tt(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new tt(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=W({},l[g]);v.paint=Hm(v.paint,_.paint,d,b,o),v.layout=Hm(v.layout,_.layout,d,b,o);let w=!h||h(d,_,b);if(!w)continue;let P=new y0(d,this.z,this.x,this.y,f);P.layer=v;let T=e[g];T===void 0&&(T=e[g]=[]),T.push({featureIndex:r,feature:P,intersectionZ:w})}}lookupSymbolFeatures(e,t,i,r,n,a,o,s){let l={};this.loadVTLayers();let u=Za(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){let i=e.id;if(this.promoteId){let r=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[r],typeof i=="boolean"&&(i=Number(i)),i===void 0&&e.properties?.cluster&&this.promoteId&&(i=Number(e.properties.cluster_id))}return i}};Z("FeatureIndex",wD,{omit:["rawTileData","sourceLayerCoder"]});function Hm(e,t,i,r,n){return Vc(e,(a,o)=>{let s=t instanceof Il?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s})}function PD(e,t){return t-e}var vc="RTLPluginLoaded",TD=class extends Dt{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=$k()}_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=ye.resolveURL(e),!this.url)throw new Error(`requested url ${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 X(vc))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},yh=null;function bc(){return yh||(yh=new TD),yh}var SD=3e4,g0=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=$g(),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 vx;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=_D(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let r in this.buckets){let n=this.buckets[r];if(n instanceof Zn)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 Zn&&n.hasRTLText){this.hasRTLText=!0,bc().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 et(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new et(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=Za(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=an(p,!0);if(!o.filter(new tt(this.tileID.overscaledZ),y,this.tileID.canonical))continue}else if(!o.filter(new tt(this.tileID.overscaledZ),p))continue;let d=i.getId(p,n),f=new y0(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=cS(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,SD):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<ye.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ye.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}},CD=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)}},Km=ne(se(),1),MD=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]||{},W(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=W({},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]={}),W(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]||{},W(i[r],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length!==0)for(let r in e)e[r].setFeatureState(i,t)}},ID=ne(se(),1),On=89.25;function ED(e,t,i){let r=1/(1<<i.z);return new Oe(e/8192*r+i.x*r,t/8192*r+i.y*r)}function Ai(e,t){let i=Ce(t.lat,-zi,zi);return new ID.default(Wn(t.lng)*e,Jr(i)*e)}function io(e,t){return new Oe(t.x/e,t.y/e).toLngLat()}function Vs(e){return e.cameraToCenterDistance*Math.min(Math.tan(Ne(90-e.pitch))*.85,Math.tan(Ne(On-e.pitch)))}function gh(e,t){let i=e.canonical,r=t/bt(i.z),n=i.x+Math.pow(2,i.z)*e.wrap,a=O.identity(new Float64Array(16));return O.translate(a,a,[n*r,i.y*r,0]),O.scale(a,a,[r/8192,r/8192,1]),a}function wc(e,t,i,r,n){let a=Oe.fromLngLat(e,t),o=Yr(1,e.lat),s=n*o,l=s*Math.cos(Ne(i)),u=Math.sqrt(s*s-l*l),h=u*Math.sin(Ne(-r)),c=u*Math.cos(Ne(-r));return new Oe(a.x+h,a.y+c,a.z+l)}function AD(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 Jm(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 Pc(e,t){return function(i,r,n,a,o){let s=2*((e-1)/wt(Math.cos(Ne(On-o))/Math.cos(Ne(On)))-1),l=Math.acos(n/a),u=2*Jm(s-1,0,Ne(o/2)),h=Math.min(Ne(On),l+Ne(o/2)),c=Math.min(h,l-Ne(o/2)),p=Jm(s-1,c,h),d=Math.atan(r/n),f=Math.hypot(r,n),y=i;return y=y+wt(a/f/Math.max(.5,Math.cos(Ne(o/2)))),y+=s*wt(Math.cos(d))/2,y-=wt(Math.max(1,p/u/t))/2,y}}var kD=9.314,DD=3,LD=Pc(kD,DD);function Bl(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+wt(e.tileSize/t.tileSize));return Math.max(0,i)}function Nl(e,t){let i=e.getCameraFrustum(),r=e.getClippingPlane(),n=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=Oe.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=Bl(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=P=>({zoom:0,x:0,y:0,wrap:P,fullyVisible:!1}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let P=1;P<=3;P++)v.push(b(-P)),v.push(b(P));for(v.push(b(0));v.length>0;){let P=v.pop(),T=P.x,I=P.y,E=P.fullyVisible,R={x:T,y:I,z:P.zoom},k=o.getTileBoundingVolume(R,P.wrap,e.elevation,t);if(!E){let x=AD(i,k,r);if(x===0)continue;E=x===2}let L=o.distanceToTile2d(n.x,n.y,R,k),A=l;s&&(A=(t.calculateTileZoom||LD)(e.zoom+wt(e.tileSize/t.tileSize),L,g,_,e.fov)),A=(t.roundZoom?Math.round:Math.floor)(A),A=Math.max(0,A);let D=Math.min(A,h);if(P.wrap=o.getWrap(a,R,P.wrap),P.zoom>=D){if(P.zoom<u)continue;let x=c-P.zoom,S=d[0]-.5-(T<<x),C=d[1]-.5-(I<<x),F=t.reparseOverscaled?Math.max(P.zoom,A):P.zoom;w.push({tileID:new gt(P.zoom===h?F:P.zoom,P.wrap,P.zoom,T,I),distanceSq:At.sqrLen([f[0]-.5-T,f[1]-.5-I]),tileDistanceToCamera:Math.sqrt(S*S+C*C)});continue}for(let x=0;x<4;x++){let S=(T<<1)+x%2,C=(I<<1)+(x>>1),F=P.zoom+1;v.push({zoom:F,x:S,y:C,wrap:P.wrap,fullyVisible:E})}}return w.sort((P,T)=>P.distanceSq-T.distanceSq).map(P=>P.tileID)}var Qm=ne(se(),1),RD=Ri.fromPoints([new Qm.default(0,0),new Qm.default(8192,8192)]),ro=class Da extends Dt{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=yD(t,i,r,this),this._tiles={},this._cache=new CD(0,n=>this._unloadTile(n)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new MD,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 ee(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 X("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(ey).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 Km.default(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians),l=new Km.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(ey).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=ye.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 X("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?Tr.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=ye.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 gt(h.canonical.z,h.wrap,h.canonical.z,h.canonical.x,h.canonical.y)):(r=Nl(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=Bl(t,this._source),a=Math.max(n-Da.maxOverzooming,this._source.minzoom),o=Math.max(n+Da.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 X("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(r,n);ty(this._source.type)&&this._updateCoveredAndRetainedTiles(l,a,o,n,r,i);for(let h in l)this._tiles[h].clearFadeHold();let u=aS(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){let r={},n={},a=Math.max(i-Da.maxOverzooming,this._source.minzoom),o=Math.max(i+Da.maxUnderzooming,this._source.minzoom),s={};for(let l of t){let u=this._addTile(l);r[l.key]=l,!u.hasData()&&i<this._source.maxzoom&&(s[l.key]=l)}this._retainLoadedChildren(s,i,o,r);for(let l of t){let u=this._tiles[l.key];if(u.hasData())continue;if(i+1>this._source.maxzoom){let c=l.children(this._source.maxzoom)[0],p=this.getTile(c);if(p&&p.hasData()){r[c.key]=c;continue}}else{let c=l.children(this._source.maxzoom);if(r[c[0].key]&&r[c[1].key]&&r[c[2].key]&&r[c[3].key])continue}let h=u.wasRequested();for(let c=l.overscaledZ-1;c>=a;--c){let p=l.scaledTo(c);if(n[p.key])break;if(n[p.key]=!0,u=this.getTile(p),!u&&h&&(u=this._addTile(p)),u){let d=u.hasData();if((d||!this.map?.cancelPendingTileRequestsWhileZooming||h)&&(r[p.key]=p),h=u.wasRequested(),d)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 g0(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 X("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=Ri.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 Oe(w.x,w.y)));if(v.expandBy(_),v.intersects(RD)){let w=u.map(T=>b.getTilePoint(T)),P=h.map(T=>b.getTilePoint(T));n.push({tile:f,tileID:o?b:b.unwrapTo(0),queryGeometry:w,cameraQueryGeometry:P,scale:g})}}}return n}transformBbox(t,i,r){let n=t.map(i);if(r){let a=Ri.fromPoints(t);a.shrinkBy(Math.min(a.width(),a.height())*.001);let o=a.map(i);Ri.fromPoints(n).covers(o)||(n=n.map(s=>s.x>.5?new Oe(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(ty(this._source.type)){let t=ye.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))}};ro.maxOverzooming=10;ro.maxUnderzooming=3;function ey(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 ty(e){return e==="raster"||e==="image"||e==="video"}var Ti=ne(se(),1),pr=ne(se(),1);function zD(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 pr.default(t,h.y+(c.y-h.y)*((t-h.x)/(c.x-h.x)))._round():c.x<t&&(c=new pr.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 pr.default(h.x+(c.x-h.x)*((i-h.y)/(c.y-h.y)),i)._round():c.y<i&&(c=new pr.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 pr.default(r,h.y+(c.y-h.y)*((r-h.x)/(c.x-h.x)))._round():c.x>=r&&(c=new pr.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 pr.default(h.x+(c.x-h.x)*((n-h.y)/(c.y-h.y)),n)._round():c.y>=n&&(c=new pr.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 FD=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=Ce(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 ys(e,t){let i=!0;return e==="always"||(e==="never"||t==="never")&&(i=!1),i}var iy=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||!ys(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||!ys(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))&&!ys(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))&&!ys(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}},no=ne(se(),1);function jp(e,t,i){let r=O.create();if(!e){let{vecSouth:n,vecEast:a}=Up(t),o=Na.create();o[0]=a[0],o[1]=a[1],o[2]=n[0],o[3]=n[1],Na.invert(o,o),r[0]=o[0],r[1]=o[1],r[4]=o[2],r[5]=o[3]}return O.scale(r,r,[1/i,1/i,1]),r}function OD(e,t,i,r){if(e){let n=O.create();if(!t){let{vecSouth:a,vecEast:o}=Up(i);n[0]=o[0],n[1]=o[1],n[4]=a[0],n[5]=a[1]}return O.scale(n,n,[r,r,1]),n}else return i.pixelsToClipSpaceMatrix}function Up(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=At.create();o[0]=-n*r*i-a*t,o[1]=-a*r*i+n*t;let s=At.length(o);s<1e-9?At.zero(o):At.scale(o,o,1/s);let l=At.create();l[0]=n*r*t-a*i,l[1]=a*r*t+n*i;let u=At.length(l);return u<1e-9?At.zero(l):At.scale(l,l,1/u),{vecEast:l,vecSouth:o}}function Gp(e,t,i,r){let n;r?(n=[e,t,r(e,t),1],Je.transformMat4(n,n,i)):(n=[e,t,0,1],Xp(n,n,i));let a=n[3];return{point:new no.default(n[0]/a,n[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function _0(e,t){return .5+.5*(e/t)}function BD(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function ND(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=i?e.textSizeData:e.iconSizeData,f=Fl(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 P=0;P<b.length;P++){let T=b.get(P);if(T.hidden||T.writingMode===2&&!w){Bn(T.numGlyphs,g);continue}w=!1;let I=new no.default(T.anchorX,T.anchorY),E={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:_,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:I,unwrappedTileID:l,width:u,height:h,translation:c},R=b0(T.anchorX,T.anchorY,E);if(!BD(R.point,y)){Bn(T.numGlyphs,g);continue}let k=R.signedDistanceFromCamera,L=_0(t.transform.cameraToCenterDistance,k),A=Vp(d,f,T),D=a?A*t.transform.getPitchedTextCorrection(T.anchorX,T.anchorY,l)/L:A*L,x=ny({projectionContext:E,pitchedLabelPlaneMatrixInverse:n,symbol:T,fontSize:D,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s});w=x.useVertical,(x.notEnoughRoom||w||x.needsFlipping&&ny({projectionContext:E,pitchedLabelPlaneMatrixInverse:n,symbol:T,fontSize:D,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s}).notEnoughRoom)&&Bn(T.numGlyphs,g)}i?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function x0(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=el(e*c,i,r,n,a.segment,u,h,s,o);if(!d)return null;let f=el(e*p,i,r,n,a.segment,u,h,s,o);return!f||s.projectionCache.anyProjectionOccluded?null:{first:d,last:f}}function ry(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 ny(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=x0(c,s,p,d,a,r,h,t);if(!b)return{notEnoughRoom:!0};let v=gs(b.first.point.x,b.first.point.y,t,i),w=gs(b.last.point.x,b.last.point.y,t,i);if(o&&!a){let P=ry(r.writingMode,v,w,u);if(P)return P}f=[b.first];for(let P=r.glyphStartIndex+1;P<y-1;P++){let T=el(c*s.getoffsetX(P),p,d,a,r.segment,g,_,t,h);if(!T)return{notEnoughRoom:!0};f.push(T)}f.push(b.last)}else{if(o&&!a){let g=Qr(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,_=r.lineStartIndex+r.segment+1,b=new no.default(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),v=Qr(b.x,b.y,t),w=v.signedDistanceFromCamera>0?v.point:v0(t.tileAnchorPoint,b,g,1,t),P=gs(g.x,g.y,t,i),T=gs(w.x,w.y,t,i),I=ry(r.writingMode,P,T,u);if(I)return I}let y=el(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)to(l,y.point,y.angle);return{}}function v0(e,t,i,r,n){let a=e.add(e.sub(t)._unit()),o=Qr(a.x,a.y,n).point,s=i.sub(o);return i.add(s._mult(r/s.mag()))}function Tc(e,t,i){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let n=new no.default(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),a=Qr(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 no.default(t.lineVertexArray.getx(o),t.lineVertexArray.gety(o)),l=i.absOffsetX-i.distanceFromAnchor+1;return v0(s,n,i.previousVertex,l,t)}function Qr(e,t,i){let r=e+i.translation[0],n=t+i.translation[1],a;return i.pitchWithMap?(a=Gp(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 gs(e,t,i,r){if(i.pitchWithMap){let n=[e,t,0,1];return Je.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 b0(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function Sc(e,t,i){return e._unit()._perp()._mult(t*i)}function VD(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=Tc(e+l.direction,s,l),c=Sc(h.sub(i),o,l.direction),p=i.add(c),d=h.add(c);return s.projectionCache.offsets[e]=uS(a,u,p,d)||u,s.projectionCache.offsets[e]}function el(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=Qr(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),P=[],T;do{if(p+=h,p<a||p>=o)return null;b+=v,y=f,_=g;let k={absOffsetX:w,direction:h,distanceFromAnchor:b,previousVertex:y};if(f=Tc(p,s,k),i===0)P.push(y),T=f.sub(y);else{let L,A=f.sub(y);if(A.mag()===0){let D=Tc(p+h,s,k);L=Sc(D.sub(f),i,h)}else L=Sc(A,i,h);_||(_=y.add(L)),g=VD(p,L,f,a,o,_,i,s,k),P.push(_),T=g.sub(_)}v=T.mag()}while(b+v<=w);let I=(w-b)/v,E=T._mult(I)._add(_||y),R=c+Math.atan2(f.y-y.y,f.x-y.x);return P.push(E),{point:E,angle:l?R:0,path:P}}var jD=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Bn(e,t){for(let i=0;i<e;i++){let r=t.length;t.resize(r+4),t.float32.set(jD,r*3)}}function Xp(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 UD(e,t){let i=O.create();return O.invert(i,t.pitchedLabelPlaneMatrix),e.map(r=>{let n=Gp(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 GD(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 Le=100,XD=class{constructor(e,t=new iy(e.width+2*Le,e.height+2*Le,25),i=new iy(e.width+2*Le,e.height+2*Le,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+Le,this.screenBottomBoundary=e.height+Le,this.gridRightBoundary=e.width+2*Le,this.gridBottomBoundary=e.height+2*Le,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 I=f.x+(h?h.x*y:0),E=f.y+(h?h.y*y:0);g={allPointsOccluded:!1,box:[I+e.x1*y,E+e.y1*y,I+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,P=a?g.allPointsOccluded:f.isOccluded,T=P;return T||(T=f.perspectiveRatio<this.perspectiveRatioCutoff),T||(T=!this.isInsideGrid(_,b,v,w)),T||t!=="always"&&this.grid.hitTest(_,b,v,w,t,l)?{box:[_,b,v,w],placeable:!1,offscreen:!1,occluded:P}:{box:[_,b,v,w],placeable:!0,offscreen:this.isOffscreen(_,b,v,w),occluded:P}}placeCollisionCircles(e,t,i,r,n,a,o,s,l,u,h,c,p,d){let f=[],y=new Ti.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)/Qx,b={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},v=t.lineOffsetX*_,w=t.lineOffsetY*_,P={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},T=x0(_,r,v,w,!1,t,!1,P),I=!1,E=!1,R=!0;if(T){let k=h*.5*g+c,L=new Ti.default(-Le,-Le),A=new Ti.default(this.screenRightBoundary,this.screenBottomBoundary),D=new FD,x=T.first,S=T.last,C=[];for(let j=x.path.length-1;j>=1;j--)C.push(x.path[j]);for(let j=1;j<S.path.length;j++)C.push(S.path[j]);let F=k*2.5;if(l){let j=this.projectPathToScreenSpace(C,P);j.some(H=>H.signedDistanceFromCamera<=0)?C=[]:C=j.map(H=>H.point)}let B=[];if(C.length>0){let j=C[0].clone(),H=C[0].clone();for(let ie=1;ie<C.length;ie++)j.x=Math.min(j.x,C[ie].x),j.y=Math.min(j.y,C[ie].y),H.x=Math.max(H.x,C[ie].x),H.y=Math.max(H.y,C[ie].y);j.x>=L.x&&H.x<=A.x&&j.y>=L.y&&H.y<=A.y?B=[C]:H.x<L.x||j.x>A.x||H.y<L.y||j.y>A.y?B=[]:B=zD([C],L.x,L.y,A.x,A.y)}for(let j of B){D.reset(j,k*.25);let H=0;D.length<=.5*k?H=1:H=Math.ceil(D.paddedLength/F)+1;for(let ie=0;ie<H;ie++){let Se=ie/Math.max(H-1,1),Ie=D.lerp(Se),De=Ie.x+Le,Xe=Ie.y+Le;f.push(De,Xe,k,0);let Lt=De-k,$t=Xe-k,Yt=De+k,Zt=Xe+k;if(R=R&&this.isOffscreen(Lt,$t,Yt,Zt),E=E||this.isInsideGrid(Lt,$t,Yt,Zt),e!=="always"&&this.grid.hitTestCircle(De,Xe,k,e,u)&&(I=!0,!s))return{circles:[],offscreen:!1,collisionDetected:I}}}}return{circles:!s&&I||!E||g<this.perspectiveRatioCutoff?[]:f,offscreen:R,collisionDetected:I}}projectPathToScreenSpace(e,t){let i=UD(e,t);return GD(i)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=new Ri;for(let h of e){let c=new Ti.default(h.x+Le,h.y+Le);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 Ti.default(h.x1,h.y1),new Ti.default(h.x2,h.y1),new Ti.default(h.x2,h.y2),new Ti.default(h.x1,h.y2)];Rx(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],Je.transformMat4(a,a,n)):(a=[e,t,0,1],Xp(a,a,n));let o=a[3];return{x:(a[0]/o+1)/2*this.transform.width+Le,y:(-a[1]/o+1)/2*this.transform.height+Le,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+Le,y:(-a.point.y+1)/2*this.transform.height+Le,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<Le||e>=this.screenRightBoundary||r<Le||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=O.identity([]);return O.translate(e,e,[-Le,-Le,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,S=D.y-s.y,C=Math.atan(S/x)+(x<0?Math.PI:0),F=Math.sin(C),B=Math.cos(C);c=B,p=F,d=-F,f=B}else if(!a&&n){let D=Up(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,S=Ce(.5+.5*x,0,4);v*=S}}u&&(_+=c*u.x*v+d*u.y*v,b+=p*u.x*v+f*u.y*v);let w=e.x1*v,P=e.x2*v,T=(w+P)/2,I=e.y1*v,E=e.y2*v,R=(I+E)/2,k=[{offsetX:w,offsetY:I},{offsetX:T,offsetY:I},{offsetX:P,offsetY:I},{offsetX:P,offsetY:R},{offsetX:P,offsetY:E},{offsetX:T,offsetY:E},{offsetX:w,offsetY:E},{offsetX:w,offsetY:R}],L=[];for(let{offsetX:D,offsetY:x}of k)L.push(new Ti.default(_+c*D+d*x,b+p*D+f*x));let A=!1;if(n){let D=L.map(x=>this.projectAndGetPerspectiveRatio(x.x,x.y,r,l,h));A=D.some(x=>!x.isOccluded),L=D.map(x=>new Ti.default(x.x,x.y))}else A=!0;return{box:nS(L),allPointsOccluded:!A}}},qD=ne(se(),1),$D=class w0 extends qD.default{constructor(t,i,r,n){super(t,i),this.angle=r,n!==void 0&&(this.segment=n)}clone(){return new w0(this.x,this.y,this.angle,this.segment)}};Z("Anchor",$D);var ij=ne(se(),1),rj=ne(se(),1),nj=ne(se(),1),aj=ne(Oy(),1),Cc=(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))(Cc||{}),oj=Number.POSITIVE_INFINITY;function YD(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 P0=ne(se(),1),ay=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}},fa=class{constructor(e,t,i,r,n){this.text=new ay(e?e.text:null,t,i,n),this.icon=new ay(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},oy=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},ZD=class{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}},WD=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 sy(e,t,i,r,n){let{horizontalAlign:a,verticalAlign:o}=i0(e),s=-(a-.5)*t,l=-(o-.5)*i;return new P0.default(s+r[0]*n,l+r[1]*n)}var HD=class{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new XD(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new WD(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=jt(i,1,this.transform.zoom),f=Pr(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),y=Pr(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),g=jp(p,this.transform,d);this.retainedQueryData[n.bucketInstanceId]=new ZD(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:Fl(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:P}=b;e.push({sortKey:v,symbolInstanceStart:w,symbolInstanceEnd:P,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=Cc[e.textAnchor],P=[e.textOffset0,e.textOffset1],T=sy(w,i,r,P,n),I=this.collisionIndex.placeCollisionBox(t,c,s,l,u,o,a,y,h.predicate,b,T,v);if(!(_&&!this.collisionIndex.placeCollisionBox(_,c,s,l,u,o,a,g,h.predicate,b,T,v).placeable)&&I.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:P,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:T,placedGlyphBoxes:I}}}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=Js(n,"text-overlap","text-allow-overlap"),_=g==="always",b=Js(n,"icon-overlap","icon-allow-overlap"),v=b==="always",w=n.get("text-rotation-alignment")==="map",P=n.get("text-pitch-alignment")==="map",T=n.get("icon-text-fit")!=="none",I=n.get("symbol-z-order")==="viewport-y",E=_&&(v||!r.hasIconData()||y),R=v&&(_||!r.hasTextData()||f);!r.collisionArrays&&c&&r.deserializeCollisionBoxes(c);let k=this.retainedQueryData[r.bucketInstanceId].tileID,L=this._getTerrainElevationFunc(k),A=this.transform.getFastPathSimpleProjectionMatrix(k),D=(x,S,C)=>{if(t[x.crossTileID])return;if(h){this.placements[x.crossTileID]=new oy(!1,!1,!1);return}let F=!1,B=!1,j=!0,H=null,ie={box:null,placeable:!1,offscreen:null,occluded:!1},Se={box:null,placeable:!1,offscreen:null},Ie=null,De=null,Xe=null,Lt=0,$t=0,Yt=0;S.textFeatureIndex?Lt=S.textFeatureIndex:x.useRuntimeCollisionCircles&&(Lt=x.featureIndex),S.verticalTextFeatureIndex&&($t=S.verticalTextFeatureIndex);let Zt=S.textBox;if(Zt){let Rt=mt=>{let it=1;if(r.allowVerticalPlacement&&!mt&&this.prevPlacement){let xt=this.prevPlacement.placedOrientations[x.crossTileID];xt&&(this.placedOrientations[x.crossTileID]=xt,it=xt,this.markUsedOrientation(r,it,x))}return it},zt=(mt,it)=>{if(r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&S.verticalTextBox){for(let xt of r.writingModes)if(xt===2?(ie=it(),Se=ie):ie=mt(),ie&&ie.placeable)break}else ie=mt()},hr=x.textAnchorOffsetStartIndex,oi=x.textAnchorOffsetEndIndex;if(oi===hr){let mt=(it,xt)=>{let ct=this.collisionIndex.placeCollisionBox(it,g,u,k,s,P,w,a,d.predicate,L,void 0,A);return ct&&ct.placeable&&(this.markUsedOrientation(r,xt,x),this.placedOrientations[x.crossTileID]=xt),ct};zt(()=>mt(Zt,1),()=>{let it=S.verticalTextBox;return r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&it?mt(it,2):{box:null,offscreen:null}}),Rt(ie&&ie.placeable)}else{let mt=Cc[this.prevPlacement?.variableOffsets[x.crossTileID]?.anchor],it=(ct,oa,m1)=>{let y1=ct.x2-ct.x1,g1=ct.y2-ct.y1,_1=x.textBoxScale,x1=T&&b==="never"?oa:null,Or=null,Jd=g==="never"?1:2,Qd="never";mt&&Jd++;for(let ef=0;ef<Jd;ef++){for(let Ou=hr;Ou<oi;Ou++){let tf=r.textAnchorOffsets.get(Ou);if(mt&&tf.textAnchor!==mt)continue;let Bu=this.attemptAnchorPlacement(tf,ct,y1,g1,_1,w,P,u,k,s,d,Qd,x,r,m1,a,o,x1,L);if(Bu&&(Or=Bu.placedGlyphBoxes,Or&&Or.placeable))return F=!0,H=Bu.shift,Or}mt?mt=null:Qd=g}return i&&!Or&&(Or={box:this.collisionIndex.placeCollisionBox(Zt,"always",u,k,s,P,w,a,d.predicate,L,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),Or};zt(()=>it(Zt,S.iconBox,1),()=>{let ct=S.verticalTextBox,oa=ie&&ie.placeable;return r.allowVerticalPlacement&&!oa&&x.numVerticalGlyphVertices>0&&ct?it(ct,S.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),ie&&(F=ie.placeable,j=ie.offscreen);let xt=Rt(ie&&ie.placeable);if(!F&&this.prevPlacement){let ct=this.prevPlacement.variableOffsets[x.crossTileID];ct&&(this.variableOffsets[x.crossTileID]=ct,this.markUsedJustification(r,ct.anchor,x,xt))}}}if(Ie=ie,F=Ie&&Ie.placeable,j=Ie&&Ie.offscreen,x.useRuntimeCollisionCircles){let Rt=r.text.placedSymbolArray.get(x.centerJustifiedTextSymbolIndex),zt=Vp(r.textSizeData,p,Rt),hr=n.get("text-padding"),oi=x.collisionCircleDiameter;De=this.collisionIndex.placeCollisionCircles(g,Rt,r.lineVertexArray,r.glyphOffsetArray,zt,s,l,i,P,d.predicate,oi,hr,a,L),De.circles.length&&De.collisionDetected&&!i&&at("Collisions detected, but collision boxes are not shown"),F=_||De.circles.length>0&&!De.collisionDetected,j=j&&De.offscreen}if(S.iconFeatureIndex&&(Yt=S.iconFeatureIndex),S.iconBox){let Rt=zt=>this.collisionIndex.placeCollisionBox(zt,b,u,k,s,P,w,o,d.predicate,L,T&&H?H:void 0,A);Se&&Se.placeable&&S.verticalIconBox?(Xe=Rt(S.verticalIconBox),B=Xe.placeable):(Xe=Rt(S.iconBox),B=Xe.placeable),j=j&&Xe.offscreen}let ur=f||x.numHorizontalGlyphVertices===0&&x.numVerticalGlyphVertices===0,_t=y||x.numIconVertices===0;!ur&&!_t?B=F=B&&F:_t?ur||(B=B&&F):F=B&&F;let jo=F&&Ie.placeable,gn=B&&Xe.placeable;if(jo&&(Se&&Se.placeable&&$t?this.collisionIndex.insertCollisionBox(Ie.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,$t,d.ID):this.collisionIndex.insertCollisionBox(Ie.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,Lt,d.ID)),gn&&this.collisionIndex.insertCollisionBox(Xe.box,b,n.get("icon-ignore-placement"),r.bucketInstanceId,Yt,d.ID),De&&F&&this.collisionIndex.insertCollisionCircles(De.circles,g,n.get("text-ignore-placement"),r.bucketInstanceId,Lt,d.ID),i&&this.storeCollisionData(r.bucketInstanceId,C,S,Ie,Xe,De),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 Fr=(F||E)&&!Ie?.occluded,Ui=(B||R)&&!Xe?.occluded;this.placements[x.crossTileID]=new oy(Fr,Ui,j||r.justReloaded),t[x.crossTileID]=!0};if(I){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let x=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let S=x.length-1;S>=0;--S){let C=x[S];D(r.symbolInstances.get(C),r.collisionArrays[C],C)}}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]-Le),o.push(a.circles[s+1]-Le),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[YD(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 fa(u,r,l.text,l.icon),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new fa(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 fa(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 fa(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 fa(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!==ma},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}=_,P=i[w],T=this.opacities[w];P?T=o:T||(T=d,this.opacities[w]=T),i[w]=!0;let I=b>0||v>0,E=_.numIconVertices>0,R=this.placedOrientations[_.crossTileID],k=R===2,L=R===1||R===3;if(I){let D=uy(T.text),x=k?ma:D;f(e.text,b,x);let S=L?ma:D;f(e.text,v,S);let C=T.text.isHidden();[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex].forEach(j=>{j>=0&&(e.text.placedSymbolArray.get(j).hidden=C||k?1:0)}),_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=C||L?1:0);let F=this.variableOffsets[_.crossTileID];F&&this.markUsedJustification(e,F.anchor,_,R);let B=this.placedOrientations[_.crossTileID];B&&(this.markUsedJustification(e,"left",_,B),this.markUsedOrientation(e,B,_))}if(E){let D=uy(T.icon),x=!(p&&_.verticalPlacedIconSymbolIndex&&k);if(_.placedIconSymbolIndex>=0){let S=x?D:ma;f(e.icon,_.numIconVertices,S),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=T.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let S=x?ma:D;f(e.icon,_.numVerticalIconVertices,S),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=T.icon.isHidden()}}let A=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 P0.default(0,0);if(D.textBox||D.verticalTextBox){let S=!0;if(u){let C=this.variableOffsets[w];C?(x=sy(C.anchor,C.width,C.height,C.textOffset,C.textBoxScale),h&&x._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):S=!1}if(D.textBox||D.verticalTextBox){let C;D.textBox&&(C=k),D.verticalTextBox&&(C=L),ly(e.textCollisionBox.collisionVertexArray,T.text.placed,!S||C,A.text,x.x,x.y)}}if(D.iconBox||D.verticalIconBox){let S=!!(!L&&D.verticalIconBox),C;D.iconBox&&(C=S),D.verticalIconBox&&(C=!S),ly(e.iconCollisionBox.collisionVertexArray,T.icon.placed,C,A.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 (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${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 ly(e,t,i,r,n,a){(!r||r.length===0)&&(r=[0,0,0,0]);let o=r[0]-Le,s=r[1]-Le,l=r[2]-Le,u=r[3]-Le;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 KD=Math.pow(2,25),JD=Math.pow(2,24),QD=Math.pow(2,17),e3=Math.pow(2,16),t3=Math.pow(2,9),i3=Math.pow(2,8),r3=Math.pow(2,1);function uy(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*KD+t*JD+i*QD+t*e3+i*t3+t*i3+i*r3+t}var ma=0,n3=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}},a3=class{constructor(e,t,i,r,n,a,o,s){this.placement=new HD(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=ye.now(),n=()=>this._forceFullPlacement?!1:ye.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 n3(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}},hy=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],_h=1,ya=8,o3=class T0{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!==_h)throw new Error(`Got v${n} data when expected v${_h}.`);let a=hy[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 T0(s,o,a,t)}constructor(t,i=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let a=hy.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: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,ya,t),this.coords=new this.ArrayType(this.data,ya+s+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(ya+o+s+l),this.ids=new this.IndexArrayType(this.data,ya,t),this.coords=new this.ArrayType(this.data,ya+s+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(_h<<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 ${t} items when expected ${this.numItems}.`);return Mc(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++)cy(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];cy(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 Mc(e,t,i,r,n,a){if(n-r<=i)return;let o=r+n>>1;S0(e,t,o,r,n,a),Mc(e,t,i,r,o-1,1-a),Mc(e,t,i,o+1,n,1-a)}function S0(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));S0(e,t,i,f,y,a)}let o=t[2*i+a],s=r,l=n;for(ga(e,t,r,i),t[2*n+a]>o&&ga(e,t,r,n);s<l;){for(ga(e,t,s,l),s++,l--;t[2*s+a]<o;)s++;for(;t[2*l+a]>o;)l--}t[2*r+a]===o?ga(e,t,r,l):(l++,ga(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function ga(e,t,i,r){xh(e,i,r),xh(t,2*i,2*r),xh(t,2*i+1,2*r+1)}function xh(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function cy(e,t,i,r){let n=e-i,a=t-r;return n*n+a*a}var _a=512/8192/2,s3=128,l3=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*_a),y:Math.floor(u.anchorY*_a)})),s=a.map(u=>u.crossTileID),l={positions:o,crossTileIDs:s};if(l.positions.length>s3){let u=new o3(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=_a/Math.pow(2,l),h=(a*8192+e.anchorX)*u,c=(o*8192+e.anchorY)*u,p=i*8192*_a,d=r*8192*_a;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)}},u3=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},h3=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 l3(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}},C0=class{constructor(){this.layerIndexes={},this.crossTileIDs=new u3,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new h3);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]}},c3=`#ifdef GL_ES
4
4
  precision mediump float;
@@ -1126,7 +1126,7 @@ if(effectDistance > 0.0) {
1126
1126
  `;var Io=class extends ii{worker;collidersDirty=!0;packedMessage=[[],0,0,0,0,0,"bottom-left"];visibleCollidersQTree=new Vi(new Ae(0,0,0,0));interactiveCollidersQTree=new Vi(new Ae(0,0,0,0));#e;#i;#a;#o=!1;#t=null;#n=null;constructor(t,i,r,n,a=!0,o){if(super(),this.#e=t,this.#i=i,this.#a=r,!a)this.worker=new kr;else if(n)this.worker=new Worker(n);else if(Sd)try{this.worker=new Worker(URL.createObjectURL(new Blob([Sd])))}catch{this.worker=new kr}else this.worker=new kr;this.worker.onerror=()=>{this.working=!1,this.worker=new kr,this.worker.onmessage=s=>this.resolve(s)},this.worker.onmessage=s=>this.resolve(s),o&&(this.#t=document.createElement("canvas"),this.#t.classList.add("mappedin__smart-collision-engine-debug__container"),this.#t.style.display="none",this.#t.width=i,this.#t.height=r,this.#t.style.width=i+"px",this.#t.style.height=r+"px",o.appendChild(this.#t),this.#n=this.#t.getContext("2d"))}working=!1;componentArray=[];resizeCanvas(t,i){this.#i=t,this.#a=i,this.#t&&(this.#t.width=t,this.#t.height=i,this.#t.style.width=t+"px",this.#t.style.height=i+"px")}update=(t,i,r="bottom-left",n=!1,a=[])=>{let o=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];for(let p of this.#e.entities)this.componentArray.push(p.component);this.resize(t,i,r),this.collidersDirty=!1,o=!0}else for(let p=0;p<this.componentArray.length;p++)if(this.componentArray[p].collisionDirty){o=!0;break}o&&this.componentArray.sort((p,d)=>d.rank-p.rank);let s=this.packedMessage[0],l=a.length+this.componentArray.length,u=n;s.length=l;let h=0,c;for(let p=0;p<a.length;p++){let d=a[p];s[h]==null&&(s[h]=[[],0,0,0,0,0,-1]),c=s[h],c[0]=[[d.h/2,d.h/2,d.w/2,d.w/2,wd]],c[1]=1,c[2]=1,c[3]=d.x,c[4]=d.y,c[5]=0,c[6]=-1,h++}for(let p=0;p<this.componentArray.length;p++){let d=this.componentArray[p],f=d.toPackedMessage(u);s[h]==null&&(s[h]=[[],0,0,0,0,0,-1]),c=s[h],c[0]=f.bboxes,c[1]=f.enabled&&d.visible&&(f.rank===5||!d.isOccluded)?1:0,c[2]=f.rank===5?1:0,c[3]=f.x,c[4]=f.y,c[5]=f.shouldCollideWithScreenEdges?1:0,c[6]=f.lockedToStrategyIndex,h++}this.working||(this.working=!0,this.worker.postMessage(this.packedMessage))};resize(t,i,r){this.packedMessage[6]=r,this.packedMessage[5]=i,this.packedMessage[4]=t,this.packedMessage[3]=this.#i,this.packedMessage[2]=this.#a}resolve=t=>{if(this.working=!1,this.collidersDirty||!t.data)return;let i=t.data.colliders,r=-1,n,a,o=new Ae(0,0,this.#i,this.#a);this.visibleCollidersQTree=new Vi(o),this.interactiveCollidersQTree=new Vi(o);for(let s=0;s<this.componentArray.length;s++){let l=this.componentArray[s];if(i[s]==null)continue;r=i[s][0],n=i[s][2];let u=l.offscreen,h=i[s][1]===1;l.offscreen=h,r!==-1&&n!=null?(a=new Ae(n.x,n.y,n.w,n.h,{entityId:l.id}),this.visibleCollidersQTree.insert(a),l.interactive&&this.interactiveCollidersQTree.insert(a),(l.canShow===!1||l.visibilityNeedsUpdate!==!1||u&&!h)&&"visibilityNeedsUpdate"in l&&(l.visibilityNeedsUpdate="show"),r!==-1&&r!==l.currentStrategyIndex&&(l.activeBoundingBox=a,l.onStrategySelected(r))):((l.canShow===!0||l.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in l&&(l.visibilityNeedsUpdate="hide"),r!==-1&&r!==l.currentStrategyIndex&&l.onStrategySelected(r))}this.#r(),this.publish("visibility-changed")};showCollisionBoxes(){this.#o=!0,this.#t&&(this.#t.style.display="block")}hideCollisionBoxes(){this.#o=!1,this.#n&&this.#t&&(this.#n.clearRect(0,0,this.#t.width,this.#t.height),this.#t.style.display="none")}#r(){!this.#o||!this.#n||!this.#t||(this.#n.clearRect(0,0,this.#t.width,this.#t.height),this.visibleCollidersQTree.drawObjects(this.#n))}destroy=()=>{this.worker.terminate(),this.#t?.remove()}};M();M();M();var F4=(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}}})(),mb=({text:e,size:t,maxWidth:i,pixelRatio:r,maxLines:n=2,lineHeight:a=1.2,options:o={strokeText:!0}})=>{let s=`bold ${t*r}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:l}=F4(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))}}};M();var O4=(()=>{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}}})(),yb=O4.getDeviceType,gb=(()=>{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=yb().isFirefox?null:a.getExtension("WEBGL_debug_renderer_info");return t=o?a.getParameter(o.UNMASKED_RENDERER_WEBGL):a.getParameter(a.RENDERER),t}catch{let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}function n(){if(!yb().isWindows)return!1;if(i!==void 0)return i;let a=B4()?.toLowerCase()??"";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}}})(),B4=gb.getInfo,Cd=gb.shouldDisableOffscreenCanvas;M();function _b(e){let t=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?t.src=`data:image/svg+xml;base64,${btoa(e)}`:t.src=e),t}function vb(e){return(e*100|0)/100}function j4(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 Eo=class extends ii{dirty=!1;state;colliderContext;colliderCanvas;transformRequestFunc;constructor(t,i,r){super(),this.state=t,this.colliderCanvas=i,this.colliderContext=i.getContext("2d"),this.transformRequestFunc=r}transformRequest=async t=>this.transformRequestFunc?await this.transformRequestFunc(t):{url:t};pinCache={};wrapperCache={};imageCache={};imagePromiseCache={};imageDimensionsCache={};textCache={};drawCount=0;projectionCount=0;animatingCount=0;drawAttemptCount=0;statsElement;update=t=>{let i=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height),this.dirty&&(this.wrapperCache={}),Dr&&(this.drawCount=0,this.drawAttemptCount=0);let r,n,a,o,s,l;for(let u of this.state.entities)if(u?.component instanceof su&&!u.disposed){if(l=u.component,s=l.appearance.iconVisible,l.appearance.icon!=null&&s!=null){let c=typeof s=="boolean"?s:t>=s;c!==l.iconVisible&&(l.iconVisible=c,l.dirty=!0)}if((l.pinDirty||l.dirty||this.dirty)&&l.calculatePinSize(),l.offscreen||!l.visible)continue;if(n={active:l.appearance.pinColor,inactive:l.appearance.pinColorInactive},a={active:l.appearance.pinOutlineColor,inactive:l.appearance.pinOutlineColorInactive},o=vb(l.pinSize),r=`${n.active}-${n.inactive}-${a.active}-${a.inactive}-${o}-${l.iconVisible}`,l.labelCacheId=r,(!this.pinCache[r]||this.dirty)&&(this.prepare(l,r,this.colliderContext),l.dirty=!0),(l.appearance.icon&&(!l.imageHash||l.pinDirty)||this.dirty)&&this.cacheImage(l),this.textCache[l.id]==null||l.textDirty||this.dirty){l.dirty=!0,this.textCache[l.id]={};let{textDrawFn:c,width:p,height:d}=this.processText(l.text,l.appearance.textSize,l.appearance.maxWidth,l.appearance.maxLines,l.appearance.lineHeight),f=["left","center","right"];for(let y of f)this.textCache[l.id][y]=this.textToCanvas(c,l.appearance.textSize,y,p,d,l.appearance.textColor,l.appearance.textOutlineColor);l.dimensions={width:Math.ceil(p/i),height:Math.ceil(d/i)}}let h=1;if(l.appearance.iconScale)if(typeof l.appearance.iconScale=="number")h=l.appearance.iconScale;else{let{on:c,input:p,output:d,easing:f}=l.appearance.iconScale;c==="zoom-level"?h=vb(vf(t,p,d,f??"linear")):lt.warn(`Unsupported interpolation property: ${c}`)}Dr&&this.drawAttemptCount++,l.recomputeCurrentStrategy(l.iconVisible?h:1),l.canShow&&(l.enabled||l.visibilityNeedsUpdate!==!1)&&this.draw(l,r,this.colliderContext),l.textDirty=!1,l.pinDirty=!1}this.dirty=!1,Dr&&this.updateStatsOverlay()};processText=(t,i,r,n,a)=>{let o=this.state.pixelRatio,{draw:s,maxWidth:l,maxHeight:u}=mb({text:t,size:i,pixelRatio:o,maxWidth:r,maxLines:n,lineHeight:a});return{textDrawFn:s,width:l+2.5*o*2,height:u+2.5*o*2}};textToCanvas=(t,i,r,n,a,o,s)=>{let l=this.state.pixelRatio,u,h=n,c=a;window.OffscreenCanvas!=null&&!Cd()?u=new OffscreenCanvas(h,c):(u=document.createElement("canvas"),u.width=h,u.height=c,u.style.width=h+"px",u.style.height=c+"px");let p=u.getContext("2d",{willReadFrequently:!0});if(!p)return;let d=2.5*l;p.textAlign=r,p.font=`bold ${i*l}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,p.textBaseline="middle",p.lineJoin="miter",p.miterLimit=2,p.strokeStyle="white",p.lineWidth=d,p.fillStyle=o,p.strokeStyle=s;let f=r==="left"?d/2:r==="center"?h/2:h-d/2;return t(p,f,(c+d/2)/2),u};cacheImage=t=>{if(!t.appearance.icon)return;let i=j4(t.appearance.icon);this.imagePromiseCache[i]||(this.imagePromiseCache[i]=new Promise(r=>{this.transformRequest(t.appearance.icon).then(n=>{let a=_b(n.url);a.onload=()=>{this.imageCache[i]=a,this.publish("img:loaded"),r(a)}})})),t.imageHash!==i&&(t.imageHash=i,this.imagePromiseCache[i].then(()=>{t.dirty=!0}))};createPinCanvas=(t,i,r,n,a=1)=>{let o,s=this.state.pixelRatio,l=t.totalPinSize*2*s*a;window.OffscreenCanvas!=null?o=new OffscreenCanvas(l,l):(o=document.createElement("canvas"),o.width=l,o.height=l,o.style.width=l/s+"px",o.style.height=l/s+"px");let u=o.getContext("2d");return u.shadowColor="rgba(0,0,0,0.3)",u.shadowOffsetY=2*s,u.shadowBlur=5*s,u.beginPath(),u.arc(l/2,l/2,(i/2+2.5*s/2)*a,0,2*Math.PI),u.fillStyle=r,u.fill(),u.beginPath(),u.arc(l/2,l/2,i/2*a,0,2*Math.PI),u.shadowColor="transparent",u.fillStyle=n,u.fill(),o};prepare=(t,i,r)=>{let n=this.state.pixelRatio;r.lineWidth=4*n;let a=typeof t.appearance.iconScale=="number"?[t.appearance.iconScale]:t.appearance.iconScale==null?[]:t.appearance.iconScale.output,o=a.length>0?Math.max(...a):void 0,s=this.createPinCanvas(t,t.pinSize,t.appearance.pinOutlineColor,t.appearance.pinColor,o),l=this.createPinCanvas(t,3.5*n,t.appearance.pinOutlineColorInactive,t.appearance.pinColorInactive,o);this.pinCache[i]=[s,l]};updateStatsOverlay(){let t=this.colliderCanvas.parentElement;if(!(!t||typeof document>"u")){if(!this.statsElement){let i=document.createElement("div");i.className="mi-2d-draw-stats",i.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(";"),t.appendChild(i),this.statsElement=i}this.statsElement.textContent=`projections: ${this.projectionCount}
1127
1127
  draw-attempts: ${this.drawAttemptCount}
1128
1128
  draws: ${this.drawCount}
1129
- animating: ${this.animatingCount}`}}createWrapperSprite(t,i,r,n,a,o,s,l,u,h){let c=t+r*2,p=i+n*2,d;window.OffscreenCanvas!=null&&!Cd()?d=new OffscreenCanvas(c,p):(d=document.createElement("canvas"),d.width=c,d.height=p);let f=d.getContext("2d");return s&&(f.shadowColor=s,f.shadowOffsetX=l,f.shadowOffsetY=u,f.shadowBlur=h),f.fillStyle=o,a(f,r,n,t,i),f.fill(),d}drawWrapperBackground(t,i,r,n,a){let o=t.appearance.__EXPERIMENTAL_wrapperBackgroundColor;if(!o)return;let s=t.appearance.__EXPERIMENTAL_wrapperPaddingX*a,l=t.appearance.__EXPERIMENTAL_wrapperPaddingY*a,u=t.appearance.__EXPERIMENTAL_wrapperBorderRadius*a,h=(t.pinSize+2.5*a)/2,c=t.appearance.__EXPERIMENTAL_wrapperShadowColor??"",p=t.appearance.__EXPERIMENTAL_wrapperShadowOffsetX*a,d=t.appearance.__EXPERIMENTAL_wrapperShadowOffsetY*a,f=t.appearance.__EXPERIMENTAL_wrapperShadowBlur*a,y=c?Math.ceil(f+(p<0?-p:p)):0,g=c?Math.ceil(f+(d<0?-d:d)):0,_=t.style.textLabelVisible===!0&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null,b,v,w,P,T,I;if(_){let k=1/0,L=1/0,A=-1/0,D=-1/0;t.style.pinVisibility!==0&&(r-h<k&&(k=r-h),n-h<L&&(L=n-h),r+h>A&&(A=r+h),n+h>D&&(D=n+h));let x=r+t.style.left*a,S=n+t.style.top*a,C=t.dimensions.width*a,F=t.dimensions.height*a;x<k&&(k=x),S<L&&(L=S),x+C>A&&(A=x+C),S+F>D&&(D=S+F),b=k-s,v=L-l,w=Math.ceil(A-k+s*2),P=Math.ceil(D-L+l*2),T=`R|${w}|${P}|${u}|${o}|${c}|${p}|${d}|${f}`,I=(B,j,H,ie,Se)=>{B.beginPath(),u>0&&typeof B.roundRect=="function"?B.roundRect(j,H,ie,Se,u):B.rect(j,H,ie,Se)}}else if(t.style.pinVisibility===1){let k=s>l?s:l,L=Math.ceil((h+k)*2);w=L,P=L,b=r-L/2,v=n-L/2,T=`C|${L}|${o}|${c}|${p}|${d}|${f}`,I=(A,D,x,S,C)=>{A.beginPath(),A.arc(D+S/2,x+C/2,S/2,0,2*Math.PI)}}else if(t.style.pinVisibility===.5){let k=t.appearance.__EXPERIMENTAL_wrapperDotSize,L=k>0?k*a:3.5*a,A=Math.ceil(L);w=A,P=A,b=r-A/2,v=n-A/2,T=`D|${A}|${o}|${c}|${p}|${d}|${f}`,I=(D,x,S,C,F)=>{D.beginPath(),D.arc(x+C/2,S+F/2,C/2,0,2*Math.PI)}}else return;let E=this.wrapperCache[T];E||(E=this.createWrapperSprite(w,P,y,g,I,o,c,p,d,f),this.wrapperCache[T]=E);let R=t.appearance.__EXPERIMENTAL_wrapperOpacity;if(R<1){let k=i.globalAlpha;i.globalAlpha=k*R,i.drawImage(E,b-y,v-g),i.globalAlpha=k}else i.drawImage(E,b-y,v-g)}draw(t,i,r){if(!t.canShow||!t.visible)return;Dr&&this.drawCount++,r.save(),r.globalAlpha=t.currentOpacity;let n=this.state.pixelRatio,a=t.projection.x*n,o=t.projection.y*n,s=t.style.pinVisibility===1?this.pinCache[i][0]:this.pinCache[i][1],l=t.style.pinVisibility===1?t.scaledPinSize*n:t.totalPinSize*n;if(this.drawWrapperBackground(t,r,a,o,n),t.style.pinVisibility!==0&&r.drawImage(s,a-l,o-l,l*2,l*2),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]&&t.style.pinVisibility===1){let u=this.imageCache[t.imageHash],h=(t.scaledPinSize-t.scaledIconPadding)*n,c=t.appearance.iconFit,p=h,d=h,f=`${t.imageHash}_${c}`;if(this.imageDimensionsCache[f])p=this.imageDimensionsCache[f].width,d=this.imageDimensionsCache[f].height;else{let y=u.width*n,g=u.height*n;if(c==="contain"){let _=Math.sqrt(y**2+g**2),b=h/_;p=y*b,d=g*b}if(c==="cover"){let _=h/y,b=h/g,v=Math.max(_,b);p=y*v,d=g*v}}r.save(),r.beginPath(),r.arc(a,o,h/2,0,2*Math.PI),r.closePath(),t?.appearance?.iconOverflow!=="visible"&&r.clip(),r.drawImage(u,a-p/2,o-d/2,p,d),r.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&r.drawImage(this.textCache[t.id][t.style.textAlign],a+t.style.left*n,o+t.style.top*n),r.restore()}};M();var Ao=class extends ii{state;constructor(t){super(),this.state=t,this.playAnimations=this._playAnimations}animating=new Map;isAnimating=!1;showDuration=300;hideDuration=250;update=()=>{let t=performance.now();for(let i of this.state.entities){let r=i.component;if(!(r instanceof su))continue;let n=this.#e(r);if(n===null)continue;if(r.offscreen){this.#i(r,n);continue}let a=this.animating.get(r);a&&a.endOpacity===n||this.animating.set(r,{startOpacity:r.currentOpacity,endOpacity:n,startTime:t})}this.publish("animate:2d")};#e(t){return t.visibilityNeedsUpdate==="show"?(t.canShow=!0,t.appearance.opacity??1):t.visibilityNeedsUpdate==="hide"?0:null}#i(t,i){t.currentOpacity=i,t.canShow=i!==0,t.visibilityNeedsUpdate=!1,this.animating.delete(t)}playAnimations;_playAnimations(){let t=performance.now();for(let[i,r]of this.animating.entries()){if(i.disposed){this.animating.delete(i);continue}let{startOpacity:n,endOpacity:a,startTime:o}=r,s=a===0?this.hideDuration:this.showDuration,l=t-o,u=l/s;i.currentOpacity=Xu(u,0,1,n,a,a===0?Yo:Gu),l>=s&&this.#i(i,a)}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};M();var U4=["running","paused"],ko=class{state;constructor(t){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||U4.includes(n.animation.playState));if((n.canShow&&n.visible===!0||a)&&!n.offscreen&&(n.markerContainer.style.transform=`translate3D(${n.projection.x}px, ${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}}}};M();var Do=class{state;dirty=!0;domTree;constructor(t,i){this.state=t,this.domTree=i}update(){if(this.dirty){for(let t of Array.from(this.domTree.children)){let i=t.userData?.entityId,r=i!=null?this.state.entityMap.get(i):void 0;if(r){let n=r.component;(!n.enabled||!n.visible||!this.state.entityIds.has(i))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t)}for(let t of this.state.entities){let i=t.component;i instanceof ar&&i.enabled&&i.markerContainer&&!this.domTree.contains(i.markerContainer)&&(i.markerContainer.userData={entityId:t.id},this.domTree.appendChild(i.markerContainer),i.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}};M();var Lo=class extends ii{state;dirty=!0;domTree;observers=new Map;constructor(t,i){super(),this.state=t,this.domTree=i}setupObserver(){for(let t of this.observers.values())t.disconnect();this.observers.clear();for(let t of this.domTree.children){let i=t.getAttribute("data-marker-id");if(i!=null){let r=this.state.entityMap.get(i);if(r){let n=r.component;if(n.options?.dynamicResize){let a=new ResizeObserver(this.updateDimensions);a.observe(n.containerEl),this.observers.set(t.userData.entityId,a)}}}}}updateDimensions=t=>{for(let i of t){let n=i.target.parentElement?.getAttribute("data-marker-id");if(n){let a=this.state.entityMap.get(n);if(a){let o=a.component;o instanceof ar&&(o.updateDimensions(i.contentRect.width,i.contentRect.height),o.collisionDirty=!0)}}}this.publish("dimensions-update")};update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};var Ro=9,Dr=!1,Id=class{#e;#i;#a;#o;#t;#n;#r;#d;#s;#y;#g;#f;#m=Ro;#l=null;#u=null;#h=null;#c=null;collidersNeedRecomputing=!0;#p;#_=0;#x=[];get collisionSystem(){return this.#r}get drawSystem(){return this.#d}get domDrawSystem(){return this.#y}get labelCanvas(){return this.#t}constructor(t,i,r,n={}){this.#e=i,this.#i=t,this.#a=r,this.#p=n.watermark??{width:0,height:0,position:"bottom-left"},this.#o=document.createElement("div"),this.#o.classList.add("mappedin__smart-collision-engine__container"),t.appendChild(this.#o),this.#t=document.createElement("canvas"),this.#t.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",this.#o.appendChild(this.#t);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),this.#n=a,this.resize(),this.#r=new Io(i,this.#i.clientWidth,this.#i.clientHeight,n.workerUrl,n.useCollisionWorker??!0,this.#o),this.#d=new Eo(i,this.#t,n.transformImageRequest),this.#s=new Ao(i),this.#y=new ko(i),this.#g=new Do(i,this.#n),this.#f=new Lo(i,this.#n),this.#r.on("visibility-changed",this.#P,{signal:this.#r.signal}),this.#s.on("draw:2d",this.#T,{signal:this.#s.signal}),this.#s.on("animate:2d",this.#S,{signal:this.#s.signal}),this.#f.on("dimensions-update",()=>{this.#r.collidersDirty=!0,this.#w()},{signal:this.#f.signal})}registerEntity(t){this.#e.entityMap.set(t.id,t)}addEntity(t){this.#e.entityMap.set(t.id,t),this.#e.entities.add(t),this.#e.entityIds.add(t.id),t.component instanceof Xt&&(t.component.disposed=!1)}activateEntity(t){this.#e.entities.add(t),this.#e.entityIds.add(t.id),t.component instanceof Xt&&(t.component.disposed=!1)}deactivateEntity(t){this.#e.entities.delete(t),this.#e.entityIds.delete(t.id),t.component instanceof Xt&&(t.component.disposed=!0)}removeEntity(t){this.#e.entities.delete(t),this.#e.entityMap.delete(t.id),this.#e.entityIds.delete(t.id),t.component instanceof Xt&&(t.component.disposed=!0)}clearEntities(){for(let t of this.#e.entities)t.component instanceof Xt&&(t.component.disposed=!0);this.#e.entities.clear(),this.#e.entityMap.clear(),this.#e.entityIds.clear()}getEntity(t){return this.#e.entityMap.get(t)}hasActiveEntity(t){return this.#e.entities.has(t)}resize(){let{clientWidth:t,clientHeight:i}=this.#i,r=this.#e.pixelRatio;this.#t.width=t*r,this.#t.height=i*r,this.#t.style.width=t+"px",this.#t.style.height=i+"px",this.#r?.resizeCanvas(t,i)}#b(){let t=0;for(let i of this.#e.entities){let r=i.worldPosition,n=this.#a(r.x,r.y,r.z);Dr&&t++,n&&(i.component.projection.x=n.x,i.component.projection.y=n.y)}Dr&&(this.#d.projectionCount=t)}update(t,i,r=!1,n=[]){this.#_=t,this.#x=n,this.#b(),this.#g.update(),this.#f.update(),this.#u&&(cancelAnimationFrame(this.#u),this.#u=null),this.#d.update(t),this.#y.update(i);let a=this.collidersNeedRecomputing,o=!a&&r;a&&(this.#m=Ro),this.#m++,(!r||this.#m>=Ro)&&(this.#m=0,this.#r.update(this.#p.width,this.#p.height,this.#p.position,o,n)),this.collidersNeedRecomputing=!1}#w(){this.#l&&(cancelAnimationFrame(this.#l),this.#l=null),this.#l=requestAnimationFrame(()=>{this.#l=null,this.#r.update(this.#p.width,this.#p.height,this.#p.position,!1,this.#x)})}updateWatermark(t){this.#p=t}#P=()=>{this.#c&&(cancelAnimationFrame(this.#c),this.#c=null),this.#c=requestAnimationFrame(()=>{this.#c=null,this.#s.update(),this.#v()})};#v=()=>{this.#u=requestAnimationFrame(()=>{this.#u=null,Dr&&(this.#d.animatingCount=this.#s.animating.size),this.#d.update(this.#_),this.#y.update(!1)})};#T=()=>{this.#v()};#S=()=>{this.#h&&(cancelAnimationFrame(this.#h),this.#h=null),this.#h=requestAnimationFrame(()=>{this.#h=null,this.#s.playAnimations()})};markDirty(){this.#g.dirty=!0,this.#f.dirty=!0,this.#r.collidersDirty=!0,this.collidersNeedRecomputing=!0,this.#m=Ro}cancelPendingFrames(){this.#l&&(cancelAnimationFrame(this.#l),this.#l=null),this.#u&&(cancelAnimationFrame(this.#u),this.#u=null),this.#h&&(cancelAnimationFrame(this.#h),this.#h=null),this.#c&&(cancelAnimationFrame(this.#c),this.#c=null)}createLabel(t,i){return new Xt(t,i,this.#e.pixelRatio)}createMarker(t,i={}){return new ar(t,i)}showCollisionBoxes(){this.#r.showCollisionBoxes()}hideCollisionBoxes(){this.#r.hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),this.#r.destroy(),this.#f.destroy(),this.#o.remove(),this.#n.remove()}};M();import{z as ze}from"zod";var bb=ad,wb=vd,G4=ze.object({rank:rd.optional(),appearance:au.optional(),interactive:ze.boolean().default(!1),textPlacement:ze.union([ze.enum(bb),ze.array(ze.enum(bb))]).default(bo),occlude:ze.boolean().default(!0)}),Ed=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(wb),ze.array(ze.enum(wb))]).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()}),Pb=ze.array(ze.number()).min(2).max(3),Tb=ze.string(),X4=e=>{G4.parse(e??{})},yZ=(e,t,i)=>{Pb.parse(e),Tb.parse(t),X4(i)};function gZ(e,t,i){Pb.parse(e),Tb.parse(t),Ed.parse(i)}M();var hn=class extends vt{type="geometry";userData={entityId:"",type:"geometry"};components=[];raycast(t,i){this.userData.type==="model"&&this.children[0]&&t.intersectObject(this.children[0],!0).forEach(r=>{i.push(r)})}},Tt=class{id=Er();components;getComponent(t){return this.components.find(i=>i?.type===t)}parentId;get object3d(){return this.components[0].mesh}get parentObject3D(){return this.components[0].mesh?.parent}type;entities2D=new Map;constructor(t,i){this.components=[t,i],this.type=t.type}attach(t){this.parentObject3D instanceof St?t.object3d.userData.attachedEntityId=this.id:this.entities2D.set(t.id,t)}detach(t){this.parentObject3D instanceof St&&(t.object3d.userData.parentEntityId=void 0),this.entities2D.delete(t.id)}removeAllEntities(){for(let t of this.entities2D.values())this.detach(t)}};M();var ji=class extends vt{},sr=class{id;type;entity2D;get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}verticalOffset;object3d=new ji;components;getComponent(t){return this.components.find(i=>i?.type===t)}disposed=!1;constructor(t,i,r=0){this.id=t.id||Er(),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 xo(t,{x:i.x,y:i.y,z:i.z+r})}worldPosition=new ke;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}};M();function Ad(e){return e instanceof Xo?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)}M();import{z as pe}from"zod";M();var Sb=class extends ii{rendererState;convertTo3DMapPosition;textSet=new Set;batchedTextMap=new Map;resolvedBatchedTextMap=new Map;useWorker=!0;remove(t){this.textSet.delete(t)}getBatchedText(t){return this.resolvedBatchedTextMap.get(t)}constructor(t,i,r=!0){super(),(r===!1||!Yu())&&(this.useWorker=!1,q4(!1)),this.rendererState=t,this.convertTo3DMapPosition=i}update(t){let i,r,n,a=[];for(let o of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(o),i?.type==="text3d"){r=i.components[0],n=i.components[1];let s=r.mesh?.parent;if(!s||!(s instanceof Ct)||!(r instanceof _u))continue;if("textArea"in r.feature.properties&&r.mesh!=null&&r.polygonEntityId!=null&&r.textMesh==null&&r.mesh.parent!=null&&r.feature.properties?.textArea?.position!=null){if(this.textSet.has(r.polygonEntityId))continue;this.textSet.add(r.polygonEntityId),this.batchedTextMap.has(s)||this.batchedTextMap.set(s,ra().then(({BatchedText:h})=>{let c=new h;return c.type="batchedtext",s.add(c),this.resolvedBatchedTextMap.set(s,c),c}));let u=this.batchedTextMap.get(s);if(!u)throw new Error("batched text required");a.push(Cb({entityId:o,textComponent:r,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:u,rendererState:this.rendererState,type:"text-area"}).then(h=>(h&&h.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(h.textComponent,t),h)))}else if(r.mesh!=null&&r.textMesh==null&&r.mesh.parent!=null){if(this.textSet.has(o.toString()))continue;this.textSet.add(o.toString()),this.batchedTextMap.has(s)||this.batchedTextMap.set(s,ra().then(({BatchedText:h})=>{let c=new h;return c.type="batchedtext",s.add(c),this.resolvedBatchedTextMap.set(s,c),c}));let u=this.batchedTextMap.get(s);if(!u)throw new Error("batched text required");a.push(Cb({entityId:o,textComponent:r,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:u,rendererState:this.rendererState,type:"point"}).then(h=>(h&&h.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(h.textComponent,t),h)))}let l=this.batchedTextMap.get(s);r.textMesh&&l&&Promise.all([l,Promise.resolve({meshComponent:r,styleComponent:n})]).then(([u,{meshComponent:h,styleComponent:c}])=>{let{textMesh:p}=h;if(p){if(u){let d=Ld(u,p);h.visible&&!d?u.add(p):!h.visible&&d&&u.remove(p)}c.flipToFaceCamera&&this.flipIfNeeded(h,t)}})}return Promise.all(a).then(o=>{if(o.length===0)return;let s=new Set(o.map(u=>u?.batchedText)),l=[];return s.forEach(u=>{l.push(new Promise(h=>{u?u.sync(()=>{h()}):h()}))}),this.publish("render"),Promise.all(l)})}flipIfNeeded(t,i){let r=t.textMesh;if(!r)return!1;let n=r.rotation.z,a=Xl(n+i);return a>Math.PI/2&&a<3*Math.PI/2?(r.rotation.z=Xl(n+Math.PI),r.updateMatrix(),!0):!1}debugTextAreaMesh=new Map;showTextAreaMesh(){let t,i;for(let r of this.rendererState.geometry3DIdsInScene)if(t=this.rendererState.geometry3DMap.get(r),t?.type==="text3d"&&(i=t.components[0],"textArea"in i.feature.properties)){let n=i.feature.properties.textArea;if(!n)continue;let a=new ff(n.maxWidth,n.maxHeight),o=new si(a,new Nr({color:"pink"})),{textMesh:s}=i;if(!s)continue;let l=this.convertTo3DMapPosition(n.position,zo);o.position.copy(l),o.position.z=s.position.z-.1,o.rotation.z=s.rotation.z,kd.identity(),kd.makeRotationAxis(new ke(0,0,1),s.userData.rotationZ),zo.set(n.maxWidth/2,0,0),zo.applyMatrix4(kd),o.position.x-=zo.x,o.position.y-=zo.y,this.rendererState.geometryScene.add(o),this.debugTextAreaMesh.set(r,o)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(t=>{this.rendererState.geometryScene.remove(t)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function q4(e){ra().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var kd=new bi,zo=new ke,Dd;async function jZ(e){let{preloadFont:t}=await ra();return t(e)}function ra(){return Dd||(Dd=import("./text3d-TJVE4VTW.js").then(e=>e)),Dd}async function Cb({entityId:e,textComponent:t,styleComponent:i,convertTo3DMapPosition:r,batchedMeshPromise:n,rendererState:a,type:o="text-area"}){return Promise.all([ra(),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=>{lt.warn("Trouble creating text: ",s)}).then(s=>{if(!s?.text)return;let l=[Promise.resolve(s.text),n,Promise.resolve()];if(t.polygonEntityId){let u=a.geometry3DMap.get(t.polygonEntityId);if(u?.type==="geometry"){let h=u.components[0],c=u.components[1];h.textMesh=s.text,s.text.position.z=c.altitude+c.height+$4}}else l[2]=ra().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 Ld(e,t){return e._members.has(t)}var $4=.5;var Y4=pe.object({visible:pe.boolean(),color:pe.string(),flipToFaceCamera:pe.boolean(),font:pe.string().optional(),fontSize:pe.number(),margin:pe.union([pe.number(),pe.tuple([pe.number(),pe.number(),pe.number(),pe.number()])]),outlineColor:pe.string(),outlineOpacity:pe.number(),outlineBlur:pe.union([pe.number(),pe.string()]),outlineWidth:pe.number(),outlineOffsetX:pe.number(),outlineOffsetY:pe.number(),strokeWidth:pe.number(),maxWidth:pe.number().optional(),maxHeight:pe.number().optional(),strokeOpacity:pe.number(),strokeColor:pe.string(),fillOpacity:pe.number(),hoverColor:pe.string().optional(),id:pe.union([pe.string(),pe.number()]),type:pe.literal("text3d"),position:pe.tuple([pe.number(),pe.number(),pe.number()]),content:pe.string(),rotation:pe.number()}),Mb=pe.strictObject(Y4.partial().omit({id:!0,type:!0}).shape),Ib=pe.strictObject(Mb.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape),YZ=pe.strictObject({appearance:Mb.optional(),parentId:pe.string().optional()}),_u=class{mesh=new hn;textMesh;type="text3d";feature;constructor(t){this.feature=t}get visible(){return this.batchedText&&this.textMesh?Ld(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}parent;batchedText;polygonEntityId};M();var xu=class{type="outline";color;dirty=!0;enabled=!0;#e=!1;edgeColors;edgeVisibility;geometry;ranges;topFaceVerticesIndices;get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||this.#e===t)return;this.#e=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 this.#e}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]}constructor(t){this.color=t}};M();M();function eW(e){return e instanceof ni?e.material:null}function Rd(e,t){return e==="auto"?t===1?Nu:Vu:e==="back"?af:e==="front"?Nu:Vu}function tW(e,t,i=1){let r=Rd(t,i);e.side!==r&&(e.side=r)}M();M();var vu=class extends uf{_width;_height;_propertiesLength;constructor(t){let i=t,r=3,n=r*4;super(new Uint8Array(t*n),r,t,sf,of),this._width=n,this._height=i,this._propertiesLength=r}setColor(t,i,r){let n=this.image.data,a=t*this._width;n[a]=Math.round(i.r*255),n[a+1]=Math.round(i.g*255),n[a+2]=Math.round(i.b*255),n[a+3]=0,n[a+4]=Math.round(r.r*255),n[a+5]=Math.round(r.g*255),n[a+6]=Math.round(r.b*255),n[a+7]=0,this.needsUpdate=!0}getColor(t){let i=this.image.data,r=t*this._width,n=new Et(i[r]/255,i[r+1]/255,i[r+2]/255),a=new Et(i[r+4]/255,i[r+5]/255,i[r+6]/255);return{color:n,topColor:a}}setTexture(t,i,r){let n=this.image.data,a=t*this._width;n[a+8]=i?255:0,n[a+9]=r?255:0,n[a+10]=0,n[a+11]=0,this.needsUpdate=!0}getTexture(t){let i=this.image.data,r=t*this._width,n=i[r+8]===255,a=i[r+9]===255;return{texture:n,topTexture:a}}};M();var Eb=`#define LAMBERT
1129
+ animating: ${this.animatingCount}`}}createWrapperSprite(t,i,r,n,a,o,s,l,u,h){let c=t+r*2,p=i+n*2,d;window.OffscreenCanvas!=null&&!Cd()?d=new OffscreenCanvas(c,p):(d=document.createElement("canvas"),d.width=c,d.height=p);let f=d.getContext("2d");return s&&(f.shadowColor=s,f.shadowOffsetX=l,f.shadowOffsetY=u,f.shadowBlur=h),f.fillStyle=o,a(f,r,n,t,i),f.fill(),d}drawWrapperBackground(t,i,r,n,a){let o=t.appearance.__EXPERIMENTAL_wrapperBackgroundColor;if(!o)return;let s=t.appearance.__EXPERIMENTAL_wrapperPaddingX*a,l=t.appearance.__EXPERIMENTAL_wrapperPaddingY*a,u=t.appearance.__EXPERIMENTAL_wrapperBorderRadius*a,h=(t.pinSize+2.5*a)/2,c=t.appearance.__EXPERIMENTAL_wrapperShadowColor??"",p=t.appearance.__EXPERIMENTAL_wrapperShadowOffsetX*a,d=t.appearance.__EXPERIMENTAL_wrapperShadowOffsetY*a,f=t.appearance.__EXPERIMENTAL_wrapperShadowBlur*a,y=c?Math.ceil(f+(p<0?-p:p)):0,g=c?Math.ceil(f+(d<0?-d:d)):0,_=t.style.textLabelVisible===!0&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null,b,v,w,P,T,I;if(_){let k=1/0,L=1/0,A=-1/0,D=-1/0;t.style.pinVisibility!==0&&(r-h<k&&(k=r-h),n-h<L&&(L=n-h),r+h>A&&(A=r+h),n+h>D&&(D=n+h));let x=r+t.style.left*a,S=n+t.style.top*a,C=t.dimensions.width*a,F=t.dimensions.height*a;x<k&&(k=x),S<L&&(L=S),x+C>A&&(A=x+C),S+F>D&&(D=S+F),b=k-s,v=L-l,w=Math.ceil(A-k+s*2),P=Math.ceil(D-L+l*2),T=`R|${w}|${P}|${u}|${o}|${c}|${p}|${d}|${f}`,I=(B,j,H,ie,Se)=>{B.beginPath(),u>0&&typeof B.roundRect=="function"?B.roundRect(j,H,ie,Se,u):B.rect(j,H,ie,Se)}}else if(t.style.pinVisibility===1){let k=s>l?s:l,L=Math.ceil((h+k)*2);w=L,P=L,b=r-L/2,v=n-L/2,T=`C|${L}|${o}|${c}|${p}|${d}|${f}`,I=(A,D,x,S,C)=>{A.beginPath(),A.arc(D+S/2,x+C/2,S/2,0,2*Math.PI)}}else if(t.style.pinVisibility===.5){let k=t.appearance.__EXPERIMENTAL_wrapperDotSize,L=k>0?k*a:3.5*a,A=Math.ceil(L);w=A,P=A,b=r-A/2,v=n-A/2,T=`D|${A}|${o}|${c}|${p}|${d}|${f}`,I=(D,x,S,C,F)=>{D.beginPath(),D.arc(x+C/2,S+F/2,C/2,0,2*Math.PI)}}else return;let E=this.wrapperCache[T];E||(E=this.createWrapperSprite(w,P,y,g,I,o,c,p,d,f),this.wrapperCache[T]=E);let R=t.appearance.__EXPERIMENTAL_wrapperOpacity;if(R<1){let k=i.globalAlpha;i.globalAlpha=k*R,i.drawImage(E,b-y,v-g),i.globalAlpha=k}else i.drawImage(E,b-y,v-g)}draw(t,i,r){if(!t.canShow||!t.visible)return;Dr&&this.drawCount++,r.save(),r.globalAlpha=t.currentOpacity;let n=this.state.pixelRatio,a=t.projection.x*n,o=t.projection.y*n,s=t.style.pinVisibility===1?this.pinCache[i][0]:this.pinCache[i][1],l=t.style.pinVisibility===1?t.scaledPinSize*n:t.totalPinSize*n;if(this.drawWrapperBackground(t,r,a,o,n),t.style.pinVisibility!==0&&r.drawImage(s,a-l,o-l,l*2,l*2),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]&&t.style.pinVisibility===1){let u=this.imageCache[t.imageHash],h=(t.scaledPinSize-t.scaledIconPadding)*n,c=t.appearance.iconFit,p=h,d=h,f=`${t.imageHash}_${c}`;if(this.imageDimensionsCache[f])p=this.imageDimensionsCache[f].width,d=this.imageDimensionsCache[f].height;else{let y=u.width*n,g=u.height*n;if(c==="contain"){let _=Math.sqrt(y**2+g**2),b=h/_;p=y*b,d=g*b}if(c==="cover"){let _=h/y,b=h/g,v=Math.max(_,b);p=y*v,d=g*v}}r.save(),r.beginPath(),r.arc(a,o,h/2,0,2*Math.PI),r.closePath(),t?.appearance?.iconOverflow!=="visible"&&r.clip(),r.drawImage(u,a-p/2,o-d/2,p,d),r.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&r.drawImage(this.textCache[t.id][t.style.textAlign],a+t.style.left*n,o+t.style.top*n),r.restore()}};M();var Ao=class extends ii{state;constructor(t){super(),this.state=t,this.playAnimations=this._playAnimations}animating=new Map;isAnimating=!1;showDuration=300;hideDuration=250;update=()=>{let t=performance.now();for(let i of this.state.entities){let r=i.component;if(!(r instanceof su))continue;let n=this.#e(r);if(n===null)continue;if(r.offscreen){this.#i(r,n);continue}let a=this.animating.get(r);a&&a.endOpacity===n||this.animating.set(r,{startOpacity:r.currentOpacity,endOpacity:n,startTime:t})}this.publish("animate:2d")};#e(t){return t.visibilityNeedsUpdate==="show"?(t.canShow=!0,t.appearance.opacity??1):t.visibilityNeedsUpdate==="hide"?0:null}#i(t,i){t.currentOpacity=i,t.canShow=i!==0,t.visibilityNeedsUpdate=!1,this.animating.delete(t)}playAnimations;_playAnimations(){let t=performance.now();for(let[i,r]of this.animating.entries()){if(i.disposed){this.animating.delete(i);continue}let{startOpacity:n,endOpacity:a,startTime:o}=r,s=a===0?this.hideDuration:this.showDuration,l=t-o,u=l/s;i.currentOpacity=Xu(u,0,1,n,a,a===0?Yo:Gu),l>=s&&this.#i(i,a)}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};M();var U4=["running","paused"],ko=class{state;constructor(t){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||U4.includes(n.animation.playState));if((n.canShow&&n.visible===!0||a)&&!n.offscreen&&(n.markerContainer.style.transform=`translate3D(${n.projection.x}px, ${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}}}};M();var Do=class{state;dirty=!0;domTree;constructor(t,i){this.state=t,this.domTree=i}update(){if(this.dirty){for(let t of Array.from(this.domTree.children)){let i=t.userData?.entityId,r=i!=null?this.state.entityMap.get(i):void 0;if(r){let n=r.component;(!n.enabled||!n.visible||!this.state.entityIds.has(i))&&this.domTree.removeChild(t)}else this.domTree.removeChild(t)}for(let t of this.state.entities){let i=t.component;i instanceof ar&&i.enabled&&i.markerContainer&&!this.domTree.contains(i.markerContainer)&&(i.markerContainer.userData={entityId:t.id},this.domTree.appendChild(i.markerContainer),i.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}};M();var Lo=class extends ii{state;dirty=!0;domTree;observers=new Map;constructor(t,i){super(),this.state=t,this.domTree=i}setupObserver(){for(let t of this.observers.values())t.disconnect();this.observers.clear();for(let t of this.domTree.children){let i=t.getAttribute("data-marker-id");if(i!=null){let r=this.state.entityMap.get(i);if(r){let n=r.component;if(n.options?.dynamicResize){let a=new ResizeObserver(this.updateDimensions);a.observe(n.containerEl),this.observers.set(t.userData.entityId,a)}}}}}updateDimensions=t=>{for(let i of t){let n=i.target.parentElement?.getAttribute("data-marker-id");if(n){let a=this.state.entityMap.get(n);if(a){let o=a.component;o instanceof ar&&(o.updateDimensions(i.contentRect.width,i.contentRect.height),o.collisionDirty=!0)}}}this.publish("dimensions-update")};update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};var Ro=9,Dr=!1,Id=class{#e;#i;#a;#o;#t;#n;#r;#d;#s;#y;#g;#f;#m=Ro;#l=null;#u=null;#h=null;#c=null;collidersNeedRecomputing=!0;#p;#_=0;#x=[];get collisionSystem(){return this.#r}get drawSystem(){return this.#d}get domDrawSystem(){return this.#y}get labelCanvas(){return this.#t}constructor(t,i,r,n={}){this.#e=i,this.#i=t,this.#a=r,this.#p=n.watermark??{width:0,height:0,position:"bottom-left"},this.#o=document.createElement("div"),this.#o.classList.add("mappedin__smart-collision-engine__container"),t.appendChild(this.#o),this.#t=document.createElement("canvas"),this.#t.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",this.#o.appendChild(this.#t);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),this.#n=a,this.resize(),this.#r=new Io(i,this.#i.clientWidth,this.#i.clientHeight,n.workerUrl,n.useCollisionWorker??!0,this.#o),this.#d=new Eo(i,this.#t,n.transformImageRequest),this.#s=new Ao(i),this.#y=new ko(i),this.#g=new Do(i,this.#n),this.#f=new Lo(i,this.#n),this.#r.on("visibility-changed",this.#P,{signal:this.#r.signal}),this.#s.on("draw:2d",this.#T,{signal:this.#s.signal}),this.#s.on("animate:2d",this.#S,{signal:this.#s.signal}),this.#f.on("dimensions-update",()=>{this.#r.collidersDirty=!0,this.#w()},{signal:this.#f.signal})}registerEntity(t){this.#e.entityMap.set(t.id,t)}addEntity(t){this.#e.entityMap.set(t.id,t),this.#e.entities.add(t),this.#e.entityIds.add(t.id),t.component instanceof Xt&&(t.component.disposed=!1)}activateEntity(t){this.#e.entities.add(t),this.#e.entityIds.add(t.id),t.component instanceof Xt&&(t.component.disposed=!1)}deactivateEntity(t){this.#e.entities.delete(t),this.#e.entityIds.delete(t.id),t.component instanceof Xt&&(t.component.disposed=!0)}removeEntity(t){this.#e.entities.delete(t),this.#e.entityMap.delete(t.id),this.#e.entityIds.delete(t.id),t.component instanceof Xt&&(t.component.disposed=!0)}clearEntities(){for(let t of this.#e.entities)t.component instanceof Xt&&(t.component.disposed=!0);this.#e.entities.clear(),this.#e.entityMap.clear(),this.#e.entityIds.clear()}getEntity(t){return this.#e.entityMap.get(t)}hasActiveEntity(t){return this.#e.entities.has(t)}resize(){let{clientWidth:t,clientHeight:i}=this.#i,r=this.#e.pixelRatio;this.#t.width=t*r,this.#t.height=i*r,this.#t.style.width=t+"px",this.#t.style.height=i+"px",this.#r?.resizeCanvas(t,i)}#b(){let t=0;for(let i of this.#e.entities){let r=i.worldPosition,n=this.#a(r.x,r.y,r.z);Dr&&t++,n&&(i.component.projection.x=n.x,i.component.projection.y=n.y)}Dr&&(this.#d.projectionCount=t)}update(t,i,r=!1,n=[]){this.#_=t,this.#x=n,this.#b(),this.#g.update(),this.#f.update(),this.#u&&(cancelAnimationFrame(this.#u),this.#u=null),this.#d.update(t),this.#y.update(i);let a=this.collidersNeedRecomputing,o=!a&&r;a&&(this.#m=Ro),this.#m++,(!r||this.#m>=Ro)&&(this.#m=0,this.#r.update(this.#p.width,this.#p.height,this.#p.position,o,n)),this.collidersNeedRecomputing=!1}#w(){this.#l&&(cancelAnimationFrame(this.#l),this.#l=null),this.#l=requestAnimationFrame(()=>{this.#l=null,this.#r.update(this.#p.width,this.#p.height,this.#p.position,!1,this.#x)})}updateWatermark(t){this.#p=t}#P=()=>{this.#c&&(cancelAnimationFrame(this.#c),this.#c=null),this.#c=requestAnimationFrame(()=>{this.#c=null,this.#s.update(),this.#v()})};#v=()=>{this.#u=requestAnimationFrame(()=>{this.#u=null,Dr&&(this.#d.animatingCount=this.#s.animating.size),this.#d.update(this.#_),this.#y.update(!1)})};#T=()=>{this.#v()};#S=()=>{this.#h&&(cancelAnimationFrame(this.#h),this.#h=null),this.#h=requestAnimationFrame(()=>{this.#h=null,this.#s.playAnimations()})};markDirty(){this.#g.dirty=!0,this.#f.dirty=!0,this.#r.collidersDirty=!0,this.collidersNeedRecomputing=!0,this.#m=Ro}cancelPendingFrames(){this.#l&&(cancelAnimationFrame(this.#l),this.#l=null),this.#u&&(cancelAnimationFrame(this.#u),this.#u=null),this.#h&&(cancelAnimationFrame(this.#h),this.#h=null),this.#c&&(cancelAnimationFrame(this.#c),this.#c=null)}createLabel(t,i){return new Xt(t,i,this.#e.pixelRatio)}createMarker(t,i={}){return new ar(t,i)}showCollisionBoxes(){this.#r.showCollisionBoxes()}hideCollisionBoxes(){this.#r.hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),this.#r.destroy(),this.#f.destroy(),this.#o.remove(),this.#n.remove()}};M();import{z as ze}from"zod";var bb=ad,wb=vd,G4=ze.object({rank:rd.optional(),appearance:au.optional(),interactive:ze.boolean().default(!1),textPlacement:ze.union([ze.enum(bb),ze.array(ze.enum(bb))]).default(bo),occlude:ze.boolean().default(!0)}),Ed=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(wb),ze.array(ze.enum(wb))]).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()}),Pb=ze.array(ze.number()).min(2).max(3),Tb=ze.string(),X4=e=>{G4.parse(e??{})},yZ=(e,t,i)=>{Pb.parse(e),Tb.parse(t),X4(i)};function gZ(e,t,i){Pb.parse(e),Tb.parse(t),Ed.parse(i)}M();var hn=class extends vt{type="geometry";userData={entityId:"",type:"geometry"};components=[];raycast(t,i){this.userData.type==="model"&&this.children[0]&&t.intersectObject(this.children[0],!0).forEach(r=>{i.push(r)})}},Tt=class{id=Er();components;getComponent(t){return this.components.find(i=>i?.type===t)}parentId;get object3d(){return this.components[0].mesh}get parentObject3D(){return this.components[0].mesh?.parent}type;entities2D=new Map;constructor(t,i){this.components=[t,i],this.type=t.type}attach(t){this.parentObject3D instanceof St?t.object3d.userData.attachedEntityId=this.id:this.entities2D.set(t.id,t)}detach(t){this.parentObject3D instanceof St&&(t.object3d.userData.parentEntityId=void 0),this.entities2D.delete(t.id)}removeAllEntities(){for(let t of this.entities2D.values())this.detach(t)}};M();var ji=class extends vt{},sr=class{id;type;entity2D;get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}verticalOffset;object3d=new ji;components;getComponent(t){return this.components.find(i=>i?.type===t)}disposed=!1;constructor(t,i,r=0){this.id=t.id||Er(),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 xo(t,{x:i.x,y:i.y,z:i.z+r})}worldPosition=new ke;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}};M();function Ad(e){return e instanceof Xo?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)}M();import{z as pe}from"zod";M();var Sb=class extends ii{rendererState;convertTo3DMapPosition;textSet=new Set;batchedTextMap=new Map;resolvedBatchedTextMap=new Map;useWorker=!0;remove(t){this.textSet.delete(t)}getBatchedText(t){return this.resolvedBatchedTextMap.get(t)}constructor(t,i,r=!0){super(),(r===!1||!Yu())&&(this.useWorker=!1,q4(!1)),this.rendererState=t,this.convertTo3DMapPosition=i}update(t){let i,r,n,a=[];for(let o of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(o),i?.type==="text3d"){r=i.components[0],n=i.components[1];let s=r.mesh?.parent;if(!s||!(s instanceof Ct)||!(r instanceof _u))continue;if("textArea"in r.feature.properties&&r.mesh!=null&&r.polygonEntityId!=null&&r.textMesh==null&&r.mesh.parent!=null&&r.feature.properties?.textArea?.position!=null){if(this.textSet.has(r.polygonEntityId))continue;this.textSet.add(r.polygonEntityId),this.batchedTextMap.has(s)||this.batchedTextMap.set(s,ra().then(({BatchedText:h})=>{let c=new h;return c.type="batchedtext",s.add(c),this.resolvedBatchedTextMap.set(s,c),c}));let u=this.batchedTextMap.get(s);if(!u)throw new Error("batched text required");a.push(Cb({entityId:o,textComponent:r,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:u,rendererState:this.rendererState,type:"text-area"}).then(h=>(h&&h.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(h.textComponent,t),h)))}else if(r.mesh!=null&&r.textMesh==null&&r.mesh.parent!=null){if(this.textSet.has(o.toString()))continue;this.textSet.add(o.toString()),this.batchedTextMap.has(s)||this.batchedTextMap.set(s,ra().then(({BatchedText:h})=>{let c=new h;return c.type="batchedtext",s.add(c),this.resolvedBatchedTextMap.set(s,c),c}));let u=this.batchedTextMap.get(s);if(!u)throw new Error("batched text required");a.push(Cb({entityId:o,textComponent:r,styleComponent:n,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:u,rendererState:this.rendererState,type:"point"}).then(h=>(h&&h.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(h.textComponent,t),h)))}let l=this.batchedTextMap.get(s);r.textMesh&&l&&Promise.all([l,Promise.resolve({meshComponent:r,styleComponent:n})]).then(([u,{meshComponent:h,styleComponent:c}])=>{let{textMesh:p}=h;if(p){if(u){let d=Ld(u,p);h.visible&&!d?u.add(p):!h.visible&&d&&u.remove(p)}c.flipToFaceCamera&&this.flipIfNeeded(h,t)}})}return Promise.all(a).then(o=>{if(o.length===0)return;let s=new Set(o.map(u=>u?.batchedText)),l=[];return s.forEach(u=>{l.push(new Promise(h=>{u?u.sync(()=>{h()}):h()}))}),this.publish("render"),Promise.all(l)})}flipIfNeeded(t,i){let r=t.textMesh;if(!r)return!1;let n=r.rotation.z,a=Xl(n+i);return a>Math.PI/2&&a<3*Math.PI/2?(r.rotation.z=Xl(n+Math.PI),r.updateMatrix(),!0):!1}debugTextAreaMesh=new Map;showTextAreaMesh(){let t,i;for(let r of this.rendererState.geometry3DIdsInScene)if(t=this.rendererState.geometry3DMap.get(r),t?.type==="text3d"&&(i=t.components[0],"textArea"in i.feature.properties)){let n=i.feature.properties.textArea;if(!n)continue;let a=new ff(n.maxWidth,n.maxHeight),o=new si(a,new Nr({color:"pink"})),{textMesh:s}=i;if(!s)continue;let l=this.convertTo3DMapPosition(n.position,zo);o.position.copy(l),o.position.z=s.position.z-.1,o.rotation.z=s.rotation.z,kd.identity(),kd.makeRotationAxis(new ke(0,0,1),s.userData.rotationZ),zo.set(n.maxWidth/2,0,0),zo.applyMatrix4(kd),o.position.x-=zo.x,o.position.y-=zo.y,this.rendererState.geometryScene.add(o),this.debugTextAreaMesh.set(r,o)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(t=>{this.rendererState.geometryScene.remove(t)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function q4(e){ra().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var kd=new bi,zo=new ke,Dd;async function jZ(e){let{preloadFont:t}=await ra();return t(e)}function ra(){return Dd||(Dd=import("./text3d-4ZJNCN6Y.js").then(e=>e)),Dd}async function Cb({entityId:e,textComponent:t,styleComponent:i,convertTo3DMapPosition:r,batchedMeshPromise:n,rendererState:a,type:o="text-area"}){return Promise.all([ra(),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=>{lt.warn("Trouble creating text: ",s)}).then(s=>{if(!s?.text)return;let l=[Promise.resolve(s.text),n,Promise.resolve()];if(t.polygonEntityId){let u=a.geometry3DMap.get(t.polygonEntityId);if(u?.type==="geometry"){let h=u.components[0],c=u.components[1];h.textMesh=s.text,s.text.position.z=c.altitude+c.height+$4}}else l[2]=ra().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 Ld(e,t){return e._members.has(t)}var $4=.5;var Y4=pe.object({visible:pe.boolean(),color:pe.string(),flipToFaceCamera:pe.boolean(),font:pe.string().optional(),fontSize:pe.number(),margin:pe.union([pe.number(),pe.tuple([pe.number(),pe.number(),pe.number(),pe.number()])]),outlineColor:pe.string(),outlineOpacity:pe.number(),outlineBlur:pe.union([pe.number(),pe.string()]),outlineWidth:pe.number(),outlineOffsetX:pe.number(),outlineOffsetY:pe.number(),strokeWidth:pe.number(),maxWidth:pe.number().optional(),maxHeight:pe.number().optional(),strokeOpacity:pe.number(),strokeColor:pe.string(),fillOpacity:pe.number(),hoverColor:pe.string().optional(),id:pe.union([pe.string(),pe.number()]),type:pe.literal("text3d"),position:pe.tuple([pe.number(),pe.number(),pe.number()]),content:pe.string(),rotation:pe.number()}),Mb=pe.strictObject(Y4.partial().omit({id:!0,type:!0}).shape),Ib=pe.strictObject(Mb.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape),YZ=pe.strictObject({appearance:Mb.optional(),parentId:pe.string().optional()}),_u=class{mesh=new hn;textMesh;type="text3d";feature;constructor(t){this.feature=t}get visible(){return this.batchedText&&this.textMesh?Ld(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}parent;batchedText;polygonEntityId};M();var xu=class{type="outline";color;dirty=!0;enabled=!0;#e=!1;edgeColors;edgeVisibility;geometry;ranges;topFaceVerticesIndices;get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||this.#e===t)return;this.#e=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 this.#e}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]}constructor(t){this.color=t}};M();M();function eW(e){return e instanceof ni?e.material:null}function Rd(e,t){return e==="auto"?t===1?Nu:Vu:e==="back"?af:e==="front"?Nu:Vu}function tW(e,t,i=1){let r=Rd(t,i);e.side!==r&&(e.side=r)}M();M();var vu=class extends uf{_width;_height;_propertiesLength;constructor(t){let i=t,r=3,n=r*4;super(new Uint8Array(t*n),r,t,sf,of),this._width=n,this._height=i,this._propertiesLength=r}setColor(t,i,r){let n=this.image.data,a=t*this._width;n[a]=Math.round(i.r*255),n[a+1]=Math.round(i.g*255),n[a+2]=Math.round(i.b*255),n[a+3]=0,n[a+4]=Math.round(r.r*255),n[a+5]=Math.round(r.g*255),n[a+6]=Math.round(r.b*255),n[a+7]=0,this.needsUpdate=!0}getColor(t){let i=this.image.data,r=t*this._width,n=new Et(i[r]/255,i[r+1]/255,i[r+2]/255),a=new Et(i[r+4]/255,i[r+5]/255,i[r+6]/255);return{color:n,topColor:a}}setTexture(t,i,r){let n=this.image.data,a=t*this._width;n[a+8]=i?255:0,n[a+9]=r?255:0,n[a+10]=0,n[a+11]=0,this.needsUpdate=!0}getTexture(t){let i=this.image.data,r=t*this._width,n=i[r+8]===255,a=i[r+9]===255;return{texture:n,topTexture:a}}};M();var Eb=`#define LAMBERT
1130
1130
  varying vec3 vViewPosition;
1131
1131
  varying vec4 vPosition;
1132
1132
  varying vec2 vUv;